X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;ds=inline;f=src%2Fapps%2FPswGen%2FStorage%2Fmodule.h;h=e0839b391ee3183f0c2c9b914b1763f8f03a0c58;hb=af2feaab777210b8fbd9190904df3dd187acf0cd;hp=ae784e96c17105fd08929878fe448e6b00b1d619;hpb=4a856bc600d1819e01c797881e0591810737c2fd;p=evaf
diff --git a/src/apps/PswGen/Storage/module.h b/src/apps/PswGen/Storage/module.h
index ae784e9..e0839b3 100644
--- a/src/apps/PswGen/Storage/module.h
+++ b/src/apps/PswGen/Storage/module.h
@@ -3,7 +3,7 @@
* @brief Implementation of the iStorage interface
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2012 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -21,6 +21,7 @@
# define __PSWGEN_STORAGE_MODULE_H
#include "istorage.h"
+#include "version.h"
#include
@@ -28,8 +29,8 @@
#include
#include
#include
-#include
+class QSqlDatabase;
namespace eVaf {
namespace PswGen {
@@ -48,6 +49,8 @@ namespace Internal {
class Module : public Plugins::iPlugin
{
Q_OBJECT
+ Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
@@ -123,9 +126,6 @@ private: // Members
/// Name of the database file without path
static char const * const DbName;
- /// Database connection
- QSqlDatabase mDb;
-
/// List of name/data pairs
QMap > mData;
@@ -136,13 +136,23 @@ private: // Methods
* Creates database tables if necessary
* @return True if ok; false if failed
*/
- bool createTables();
+ bool createTables(QSqlDatabase & db);
+
+ /**
+ * Upgrades database tables if necessary
+ * @return True if ok; false if failed
+ *
+ * This function checks if database tables need to upgraded and
+ * performs the upgrade without a loss of data if possible.
+ * Returns false if upgrade is not possible or fails.
+ */
+ bool upgradeTables(QSqlDatabase & db);
/**
* Loads data from the database
* @return True if ok; false if failed
*/
- bool loadData();
+ bool loadData(QSqlDatabase & db);
};