From d5ed360fcecc21aa1371d20da6d3148e224dce11 Mon Sep 17 00:00:00 2001 From: tarek_saidi Date: Wed, 29 Nov 2006 15:41:54 +0000 Subject: [PATCH] fixed some minor bugs in password generation dialog, added new options to settings dlg (no functions behind yet) git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@120 b624d157-de02-0410-bad0-e51aec6abb33 --- src/dialogs/EditEntryDlg.cpp | 2 +- src/dialogs/PasswordGenDlg.cpp | 33 +- src/dialogs/PasswordGenDlg.h | 3 +- src/dialogs/SettingsDlg.cpp | 4 +- src/forms/MainWindow.ui | 34 +- src/forms/PasswordGenDlg.ui | 5 +- src/forms/SettingsDlg.ui | 1016 +++++++++++++++++++------------- src/mainwindow.cpp | 13 +- src/mainwindow.h | 2 + 9 files changed, 691 insertions(+), 421 deletions(-) diff --git a/src/dialogs/EditEntryDlg.cpp b/src/dialogs/EditEntryDlg.cpp index 6638fdb..32cacbc 100755 --- a/src/dialogs/EditEntryDlg.cpp +++ b/src/dialogs/EditEntryDlg.cpp @@ -361,7 +361,7 @@ void CEditEntryDlg::OnDeleteAttachment() void CEditEntryDlg::OnButtonGenPw() { - CGenPwDialog dlg(this,true); + CGenPwDialog dlg(this,false); if(dlg.exec()){ Edit_Password->setText(dlg.Edit_dest->text()); Edit_Password_w->setText(dlg.Edit_dest->text()); diff --git a/src/dialogs/PasswordGenDlg.cpp b/src/dialogs/PasswordGenDlg.cpp index dc6dd6c..8ea605a 100755 --- a/src/dialogs/PasswordGenDlg.cpp +++ b/src/dialogs/PasswordGenDlg.cpp @@ -54,8 +54,9 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl) connect(Spin_Num,SIGNAL(valueChanged(int)),this,SLOT(estimateQuality())); connect(Check_CollectEntropy,SIGNAL(stateChanged(int)),this,SLOT(OnCollectEntropyChanged(int))); connect(Edit_chars,SIGNAL(textChanged(const QString&)),this,SLOT(estimateQuality())); + connect(Edit_chars,SIGNAL(textEdited(const QString&)),this,SLOT(OnCharsChanged(const QString&))); - if(StandAloneMode){ + if(!StandAloneMode){ AcceptButton=DialogButtons->addButton(tr("Accept"),QDialogButtonBox::AcceptRole); AcceptButton->setDisabled(true); DialogButtons->addButton(QDialogButtonBox::Cancel); @@ -66,7 +67,7 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl) } Radio_1->setChecked(config.PwGenOptions[0]); - Edit_chars->setDisabled(config.PwGenOptions[0]); + Radio_2->setChecked(!config.PwGenOptions[0]); checkBox1->setChecked(config.PwGenOptions[1]); checkBox2->setChecked(config.PwGenOptions[2]); checkBox3->setChecked(config.PwGenOptions[3]); @@ -76,8 +77,8 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl) checkBox7->setChecked(config.PwGenOptions[7]); Check_CollectEntropy->setChecked(config.PwGenOptions[8]); Check_CollectOncePerSession->setChecked(config.PwGenOptions[9]); - estimateQuality(); - + OnRadio1StateChanged(config.PwGenOptions[0]); + OnRadio2StateChanged(!config.PwGenOptions[0]); } CGenPwDialog::~CGenPwDialog(){ @@ -255,6 +256,30 @@ void CGenPwDialog::estimateQuality(){ Progress_Quali->setValue(bits); } +void CGenPwDialog::OnCharsChanged(const QString& str){ + bool multiple=false; + for(int i=0;isetText(newstr); + +} + void CGenPwDialog::OnAccept() { done(1); diff --git a/src/dialogs/PasswordGenDlg.h b/src/dialogs/PasswordGenDlg.h index 5fe3e88..d502349 100755 --- a/src/dialogs/PasswordGenDlg.h +++ b/src/dialogs/PasswordGenDlg.h @@ -31,7 +31,7 @@ class CGenPwDialog : public QDialog, public Ui_GenPwDlg { Q_OBJECT public: - CGenPwDialog(QWidget* parent = 0, bool ShowCancelButton=false, Qt::WFlags fl = 0 ); + CGenPwDialog(QWidget* parent, bool StandAloneMode, Qt::WFlags fl = 0 ); ~CGenPwDialog(); private: @@ -50,6 +50,7 @@ class CGenPwDialog : public QDialog, public Ui_GenPwDlg virtual void OnAccept(); void estimateQuality(); void OnCollectEntropyChanged(int); + void OnCharsChanged(const QString& str); }; diff --git a/src/dialogs/SettingsDlg.cpp b/src/dialogs/SettingsDlg.cpp index 69c1ae5..bc6b191 100755 --- a/src/dialogs/SettingsDlg.cpp +++ b/src/dialogs/SettingsDlg.cpp @@ -75,7 +75,7 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog) textcolor=config.BannerTextColor; CheckBox_ShowPasswords->setChecked(config.ShowPasswords); Edit_BrowserCmd->setText(config.OpenUrlCommand); - CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree); +// CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree); CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors); Edit_MountDir->setText(config.MountDir); CheckBox_RememberLastKey->setChecked(config.RememberLastKey); @@ -133,7 +133,7 @@ void CSettingsDlg::apply(){ config.BannerTextColor=textcolor; config.ShowPasswords=CheckBox_ShowPasswords->isChecked(); config.OpenUrlCommand=Edit_BrowserCmd->text(); - config.ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked(); +// config.ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked(); config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked(); config.MountDir=Edit_MountDir->text(); if(config.MountDir!="" && config.MountDir.right(1)!="/") diff --git a/src/forms/MainWindow.ui b/src/forms/MainWindow.ui index 82c374d..8216a18 100644 --- a/src/forms/MainWindow.ui +++ b/src/forms/MainWindow.ui @@ -140,20 +140,6 @@ - - - E&xtras - - - - - - &Help - - - - - &File @@ -223,6 +209,21 @@ + + + &Help + + + + + + + + E&xtras + + + + @@ -520,6 +521,11 @@ New Database... + + + Password Generator... + + diff --git a/src/forms/PasswordGenDlg.ui b/src/forms/PasswordGenDlg.ui index 2961b6a..73f65bb 100644 --- a/src/forms/PasswordGenDlg.ui +++ b/src/forms/PasswordGenDlg.ui @@ -44,9 +44,12 @@ Qt::Vertical + + QSizePolicy::Fixed + - 20 + 442 50 diff --git a/src/forms/SettingsDlg.ui b/src/forms/SettingsDlg.ui index 84fd076..d2c31f3 100644 --- a/src/forms/SettingsDlg.ui +++ b/src/forms/SettingsDlg.ui @@ -6,19 +6,19 @@ 0 0 571 - 341 + 420 571 - 341 + 420 571 - 341 + 420 @@ -62,133 +62,52 @@ QTabWidget::Rounded - 2 + 0 - Securi&ty + General - - - - 10 - 20 - 531 - 31 - - - - - 0 - - - 6 - - - - - - 4 - 5 - 0 - 0 - - - - Clear clipboard after: - - - - - - - - 5 - 0 - 0 - 0 - - - - - 80 - 16777215 - - - - 50000 - - - 2 - - - - - - - Seconds - - - - - - - - - 10 - 50 - 531 - 20 - - - - Sh&ow passwords in plain text by default - - - Alt+O - - - - - - Appea&rance - - - - - 20 - 10 - 520 - 90 - + + + 9 - - Banner Color + + 6 - - - - 11 - 20 - 501 - 62 - - - + + + + Show system tray icon + + + + + + + Minimize to tray when clicking the main window's close button + + + + + 0 6 - - + + - Text Color: + Remember last opened file + + + Alt+Ö - + Qt::Horizontal @@ -198,267 +117,588 @@ - 40 + 10 20 - - - - - 4 - 0 - 0 - 0 - + + + + Remember last key type and location - - - 0 - 23 - + + + + + + Qt::Horizontal - + - 16777215 - 23 + 40 + 20 - - Change... - - - - - + - - - - - 4 - 5 - 0 - 0 - - + + + + + + 0 + + + 6 + + + - Color 2: + Save recent directories of file dialogs - - - - - 4 - 0 - 0 - 0 - + + + + Qt::Horizontal - - - 23 - 23 - + + QSizePolicy::Fixed - + - 23 - 23 + 10 + 20 + + + + - + Clear - - - - - 4 - 0 - 0 - 0 - - - - - 23 - 23 - + + + + Qt::Horizontal - + - 23 - 23 + 40 + 20 - - - - - true - - + - - - - - 4 - 0 - 0 - 0 - - - - - 0 - 23 - + + + + + + Sh&ow passwords in plain text by default + + + Alt+O + + + + + + + Enable bookmark menu + + + + + + + 0 + + + 6 + + + + + 0 + + + 6 + + + + + Group tree at start-up: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 0 + + + 0 + + + + + Restore last state + + + + + + + Expand all items + + + + + + + Do not expand any item + + + + + + + + + Qt::Horizontal - + - 16777215 - 23 + 40 + 20 - - Change... - - - - - + - - + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Appea&rance + + + + 9 + + + 6 + + + + + Banner Color + + + + 9 + + + 6 + + + + + 0 + + + 6 + + + + + Text Color: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + 4 + 0 + 0 + 0 + + + + + 0 + 23 + + + + + 16777215 + 23 + + + + Change... + + + + + + + + + + + 4 + 5 + 0 + 0 + + + + Color 2: + + + + + + + + 4 + 0 + 0 + 0 + + + + + 23 + 23 + + + + + 23 + 23 + + + + + + + + + + + + 4 + 0 + 0 + 0 + + + + + 23 + 23 + + + + + 23 + 23 + + + + + + + true + + + + + + + + 4 + 0 + 0 + 0 + + + + + 0 + 23 + + + + + 16777215 + 23 + + + + Change... + + + + + + + + + + + 4 + 0 + 0 + 0 + + + + + 23 + 23 + + + + + 23 + 23 + + + + + + + true + + + + + + + + 4 + 0 + 0 + 0 + + + + + 0 + 23 + + + + + 16777215 + 23 + + + + C&hange... + + + Alt+H + + + + + + + + 4 + 5 + 0 + 0 + + + + Color 1: + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 40 + 20 + + + + + + + + + + + + + Alternating Row Colors + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Security + + + + 9 + + + 6 + + + + + 0 + + + 6 + + + 4 - 0 + 5 0 0 - - - 23 - 23 - - - - - 23 - 23 - - - - - - - true + + Clear clipboard after: - - + + - 4 + 5 0 0 0 - - - 0 - 23 - - - 16777215 - 23 + 80 + 16777215 - - C&hange... + + 50000 - - Alt+H + + 2 - - - - - 4 - 5 - 0 - 0 - - + + - Color 1: + Seconds - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 40 - 20 - - - - - - - - - - 10 - 110 - 521 - 20 - - - - Expand group tree when opening a database - - - Alt+Ö - - - - - - 10 - 130 - 531 - 22 - - - - Alternating Row Colors - - + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -589,92 +829,76 @@ &Other - - - - 10 - 70 - 531 - 66 - - - - - 0 - - - 6 - - - - - - 0 - 23 - - - - - 16777215 - 23 - - - - Browse... - - - - - - - Browser Command: - - - - - - - - - - - - - Mounting Root: - - - - - - - - - 30 - 40 - 501 - 22 - - - - Remember last key type and location - - - - - - 10 - 20 - 521 - 20 - - - - Remember last opened file + + + 9 - - Alt+Ö + + 6 - + + + + 0 + + + 6 + + + + + + 0 + 23 + + + + + 16777215 + 23 + + + + Browse... + + + + + + + Browser Command: + + + + + + + + + + + + + Mounting Root: + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -693,12 +917,10 @@ tabWidget4 - SpinBox_ClipboardTime CheckBox_ShowPasswords ButtonColor1 ButtonTextColor ButtonColor2 - CheckBox_OpenLast diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5a3dbde..93ea270 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -135,6 +135,7 @@ void KeepassMainWindow::setupConnections(){ connect(ViewShowStatusbarAction,SIGNAL(toggled(bool)),statusBar(),SLOT(setVisible(bool))); connect(ExtrasSettingsAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasSettings())); + connect(ExtrasPasswordGenAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasPasswordGen())); connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook())); connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout())); @@ -249,6 +250,10 @@ void KeepassMainWindow::setupMenus(){ case 28: ViewToolButtonSize28Action->setChecked(true); break; } + SysTrayMenu = new QMenu(tr("KeePassX"),this); + SysTrayMenu->addAction(FileExitAction); + SysTray->setContextMenu(SysTrayMenu); + //FileNewMenu->setShortcut(tr("Ctrl+N")); FileOpenAction->setShortcut(tr("Ctrl+O")); FileSaveAction->setShortcut(tr("Ctrl+S")); @@ -988,5 +993,11 @@ toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize)); } void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason){ - this->show(); + if(reason!=QSystemTrayIcon::Context) + this->show(); } + +void KeepassMainWindow::OnExtrasPasswordGen(){ + CGenPwDialog dlg(this,true); + dlg.exec(); +} \ No newline at end of file diff --git a/src/mainwindow.h b/src/mainwindow.h index 229f55a..c5a54ea 100755 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -85,6 +85,7 @@ private slots: void OnUsernPasswVisibilityChanged(bool hide); void OnFileModified(); void OnExtrasSettings(); + void OnExtrasPasswordGen(); void OnHelpAbout(); void OnHelpHandbook(); void OnItemExpanded(QTreeWidgetItem*); @@ -118,6 +119,7 @@ private: QToolBar* toolBar; QSystemTrayIcon* SysTray; QAction* ViewShowToolbarAction; + QMenu* SysTrayMenu; bool ShutingDown; protected: void closeEvent(QCloseEvent* event);