From: Enar Väikene Date: Fri, 23 Sep 2011 06:34:50 +0000 (+0300) Subject: Added the name attribute to the eVaf::PswGen::Storage::Data class. X-Git-Url: https://vaikene.ee/gitweb/overview.html?a=commitdiff_plain;h=8d44aa97324c1fb3e5d36d03d5d6b7386cbb589e;p=evaf Added the name attribute to the eVaf::PswGen::Storage::Data class. --- diff --git a/src/apps/PswGen/GUI/gui.cpp b/src/apps/PswGen/GUI/gui.cpp index 965d70e..50eaca1 100644 --- a/src/apps/PswGen/GUI/gui.cpp +++ b/src/apps/PswGen/GUI/gui.cpp @@ -187,7 +187,7 @@ void Module::generateClicked() if (mStorage) { QExplicitlySharedDataPointer data = mStorage->query(wName->text()); if (!data) - data = new Storage::Data(wLength->value()); + data = new Storage::Data(wName->text(), wLength->value()); else data->setLength(wLength->value()); mStorage->save(wName->text(), data); diff --git a/src/apps/PswGen/GUI/version.h b/src/apps/PswGen/GUI/version.h index 690db50..e70248c 100644 --- a/src/apps/PswGen/GUI/version.h +++ b/src/apps/PswGen/GUI/version.h @@ -25,12 +25,12 @@ /** * Module/library version number in the form major,minor,release,build */ -#define VER_FILE_VERSION 0,1,1,1 +#define VER_FILE_VERSION 0,1,2,2 /** * Module/library version number in the string format (shall end with \0) */ -#define VER_FILE_VERSION_STR "0.1.1.1\0" +#define VER_FILE_VERSION_STR "0.1.2.2\0" /** * Module/library name (shall end with \0) diff --git a/src/apps/PswGen/Storage/istorage.h b/src/apps/PswGen/Storage/istorage.h index 8af8ba5..48226d0 100644 --- a/src/apps/PswGen/Storage/istorage.h +++ b/src/apps/PswGen/Storage/istorage.h @@ -39,20 +39,25 @@ class Data : public QSharedData { public: - Data() + Data(QString const & name) : QSharedData() , mModified(false) + , mName(name) , mLength(0) , mFlags(0) {} - Data(int l, uint f = 0) + Data(QString const & name, int l, uint f = 0) : QSharedData() , mModified(false) + , mName(name) , mLength(l) , mFlags(f) {} + /// Name of the password + inline QString const & name() const { return mName; } + /// Length of the generated password inline int length() const { return mLength; } inline void setLength(int value) @@ -83,6 +88,7 @@ public: private: bool mModified; + QString mName; int mLength; uint mFlags; diff --git a/src/apps/PswGen/Storage/module.cpp b/src/apps/PswGen/Storage/module.cpp index e867a0e..b062b30 100644 --- a/src/apps/PswGen/Storage/module.cpp +++ b/src/apps/PswGen/Storage/module.cpp @@ -231,7 +231,7 @@ bool StorageImpl::loadData() while (q.next()) { QString name = q.value(0).toString(); - QExplicitlySharedDataPointer data(new Storage::Data(q.value(1).toInt(), uint(q.value(2).toInt()))); + QExplicitlySharedDataPointer data(new Storage::Data(name, q.value(1).toInt(), uint(q.value(2).toInt()))); mData.insert(name, data); } diff --git a/src/apps/PswGen/Storage/version.h b/src/apps/PswGen/Storage/version.h index 33eaa3d..2712b36 100644 --- a/src/apps/PswGen/Storage/version.h +++ b/src/apps/PswGen/Storage/version.h @@ -25,12 +25,12 @@ /** * Module/library version number in the form major,minor,release,build */ -#define VER_FILE_VERSION 0,1,1,1 +#define VER_FILE_VERSION 0,1,2,2 /** * Module/library version number in the string format (shall end with \0) */ -#define VER_FILE_VERSION_STR "0.1.1.1\0" +#define VER_FILE_VERSION_STR "0.1.2.2\0" /** * Module/library name (shall end with \0)