From 8d44aa97324c1fb3e5d36d03d5d6b7386cbb589e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enar=20V=C3=A4ikene?= Date: Fri, 23 Sep 2011 09:34:50 +0300 Subject: [PATCH] Added the name attribute to the eVaf::PswGen::Storage::Data class. --- src/apps/PswGen/GUI/gui.cpp | 2 +- src/apps/PswGen/GUI/version.h | 4 ++-- src/apps/PswGen/Storage/istorage.h | 10 ++++++++-- src/apps/PswGen/Storage/module.cpp | 2 +- src/apps/PswGen/Storage/version.h | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) 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) -- 2.45.0