X-Git-Url: https://vaikene.ee/gitweb/pswgen09.html?a=blobdiff_plain;ds=sidebyside;f=src%2Fapps%2FPswGen%2FGUI%2Fgui.cpp;h=706522b1ef44aa30a19d6620b287d70c7dedda8f;hb=25d800db07942aadab4140a4ed05196e7f4dcd12;hp=5ebbf105d35de903c65b4f70beda24baad01afec;hpb=a1941ef19ec631bf25c883c541f6841f8e2d7252;p=evaf
diff --git a/src/apps/PswGen/GUI/gui.cpp b/src/apps/PswGen/GUI/gui.cpp
index 5ebbf10..706522b 100644
--- a/src/apps/PswGen/GUI/gui.cpp
+++ b/src/apps/PswGen/GUI/gui.cpp
@@ -27,18 +27,18 @@
#include
#include
#include
+#include
#include
-using namespace eVaf;
-
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, PswGen::GUI::Module)
+Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::GUI::Module)
//-------------------------------------------------------------------
+using namespace eVaf;
using namespace eVaf::PswGen::GUI;
int const Module::DefaultPasswordLength = 16;
@@ -75,17 +75,30 @@ bool Module::init(QString const & args)
SdiWindow::iSdiWindow * win = evafQueryInterface("iSdiWindow");
EVAF_TEST_X(win, "No iSdiWindow interface");
+ Gui::Window * masterWidget = new Gui::Window;
+ win->addWindow(masterWidget);
+
QVBoxLayout * v = new QVBoxLayout;
- win->widget()->setLayout(v);
+ masterWidget->setLayout(v);
QGridLayout * g = new QGridLayout;
v->addLayout(g);
g->setColumnStretch(2, 2);
- QLabel * l = new QLabel(tr("Web site or application &name:", VER_MODULE_NAME_STR));
+ QLabel * l = new QLabel(tr("Master &password:", VER_MODULE_NAME_STR));
l->setAlignment(Qt::AlignRight);
g->addWidget(l, 0, 0);
+ wMasterPassword = new QLineEdit;
+ l->setBuddy(wMasterPassword);
+ connect(wMasterPassword, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
+ wMasterPassword->setEchoMode(QLineEdit::Password);
+ g->addWidget(wMasterPassword, 0, 1, 1, 2);
+
+ l = new QLabel(tr("Web site or application &name:", VER_MODULE_NAME_STR));
+ l->setAlignment(Qt::AlignRight);
+ g->addWidget(l, 1, 0);
+
wName = new QLineEdit;
l->setBuddy(wName);
if (mStorage) {
@@ -95,18 +108,8 @@ bool Module::init(QString const & args)
wName->setCompleter(completer);
}
connect(wName, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
- g->addWidget(wName, 0, 1, 1, 2);
- win->widget()->setFocusProxy(wName);
-
- l = new QLabel(tr("Master &password:", VER_MODULE_NAME_STR));
- l->setAlignment(Qt::AlignRight);
- g->addWidget(l, 1, 0);
-
- wMasterPassword = new QLineEdit;
- l->setBuddy(wMasterPassword);
- connect(wMasterPassword, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
- wMasterPassword->setEchoMode(QLineEdit::Password);
- g->addWidget(wMasterPassword, 1, 1, 1, 2);
+ g->addWidget(wName, 1, 1, 1, 2);
+ masterWidget->setFocusProxy(wName);
l = new QLabel(tr("&Length of the password:", VER_MODULE_NAME_STR));
l->setAlignment(Qt::AlignRight);
@@ -144,15 +147,15 @@ bool Module::init(QString const & args)
connect(wCopy, SIGNAL(clicked()), this, SLOT(copyClicked()));
h->addWidget(wCopy);
- QAction * a = new QAction(win->widget());
+ QAction * a = new QAction(masterWidget);
a->setShortcut(Qt::Key_Return);
connect(a, SIGNAL(triggered()), this, SLOT(generateClicked()));
- win->widget()->addAction(a);
+ masterWidget->addAction(a);
- a = new QAction(win->widget());
+ a = new QAction(masterWidget);
a->setShortcut(Qt::Key_Escape);
connect(a, SIGNAL(triggered()), qApp, SLOT(quit()));
- win->widget()->addAction(a);
+ masterWidget->addAction(a);
mReady = true;
@@ -187,7 +190,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);