made password dialog working, moved key file creation from KeepassMainWindow to CPasswordDlg
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@121 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
@@ -31,94 +31,97 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
CPasswordDialog::CPasswordDialog(QWidget* parent, bool modal, bool ShowExitButton,bool ChangeKeyMode, Qt::WFlags fl)
|
||||
: QDialog(parent,fl)
|
||||
CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButton,bool ChangeKeyMode)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
createBanner(Banner,Icon_Key32x32,tr("Database Key"));
|
||||
QDir media(config.MountDir);
|
||||
if(media.exists()){
|
||||
QStringList Paths;
|
||||
Paths=media.entryList(QStringList()<<"*",QDir::Dirs);
|
||||
Paths.erase(Paths.begin()); // delete "."
|
||||
Paths.erase(Paths.begin()); // delete ".."
|
||||
for(int i=0;i<Paths.count();i++)
|
||||
Combo_Dirs->addItem(config.MountDir+Paths[i]);
|
||||
}
|
||||
|
||||
Combo_Dirs->setEditText(QString());
|
||||
if(config.RememberLastKey && !ChangeKeyMode){
|
||||
switch(config.LastKeyType){
|
||||
//case PASSWORD: setStatePasswordOnly(); break; //Password-Only is already the default
|
||||
case KEYFILE: setStateKeyFileOnly();
|
||||
Combo_Dirs->setEditText(config.LastKeyLocation);
|
||||
break;
|
||||
case BOTH: setStateBoth();
|
||||
CheckBox_Both->setChecked(true);
|
||||
Combo_Dirs->setEditText(config.LastKeyLocation);
|
||||
break;
|
||||
setupUi(this);
|
||||
createBanner(Banner,Icon_Key32x32,tr("Database Key"));
|
||||
db=DB;
|
||||
QDir media(config.MountDir);
|
||||
if(media.exists()){
|
||||
QStringList Paths;
|
||||
Paths=media.entryList(QStringList()<<"*",QDir::Dirs);
|
||||
Paths.erase(Paths.begin()); // delete "."
|
||||
Paths.erase(Paths.begin()); // delete ".."
|
||||
for(int i=0;i<Paths.count();i++)
|
||||
Combo_Dirs->addItem(config.MountDir+Paths[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
|
||||
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
|
||||
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
|
||||
connect( CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBox_BothChanged(int) ) );
|
||||
connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoMode() ) );
|
||||
connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
|
||||
connect( Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
|
||||
connect( ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit()));
|
||||
|
||||
ButtonExit->setVisible(ShowExitButton);
|
||||
Mode_Set=ChangeKeyMode;
|
||||
if(!ChangeKeyMode){
|
||||
Edit_PasswordRep->hide();
|
||||
Label_PasswordRep->hide();
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
|
||||
}else{
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK_Set() ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
|
||||
}
|
||||
|
||||
if(!config.ShowPasswords)ChangeEchoMode();
|
||||
|
||||
Combo_Dirs->setEditText(QString());
|
||||
if(config.RememberLastKey && !ChangeKeyMode){
|
||||
switch(config.LastKeyType){
|
||||
//case PASSWORD: setStatePasswordOnly(); break; //Password-Only is already the default
|
||||
case KEYFILE: setStateKeyFileOnly();
|
||||
Combo_Dirs->setEditText(config.LastKeyLocation);
|
||||
break;
|
||||
case BOTH: setStateBoth();
|
||||
CheckBox_Both->setChecked(true);
|
||||
Combo_Dirs->setEditText(config.LastKeyLocation);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
|
||||
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
|
||||
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
|
||||
connect( CheckBox_Both, SIGNAL( stateChanged(int) ), this, SLOT( OnCheckBox_BothChanged(int) ) );
|
||||
connect( ButtonChangeEchoMode, SIGNAL( clicked() ), this, SLOT( ChangeEchoMode() ) );
|
||||
connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
|
||||
connect( Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
|
||||
connect( ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit()));
|
||||
|
||||
ButtonExit->setVisible(ShowExitButton);
|
||||
Mode_Set=ChangeKeyMode;
|
||||
if(!ChangeKeyMode){
|
||||
Edit_PasswordRep->hide();
|
||||
Label_PasswordRep->hide();
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK() ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse() ) );
|
||||
}else{
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK_Set() ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
|
||||
}
|
||||
|
||||
if(!config.ShowPasswords)ChangeEchoMode();
|
||||
}
|
||||
|
||||
|
||||
void CPasswordDialog::setStatePasswordOnly(){
|
||||
Combo_Dirs->setEnabled(false);
|
||||
ButtonBrowse->setEnabled(false);
|
||||
Label_KeyFile->setEnabled(false);
|
||||
Label_Password->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);
|
||||
Edit_PasswordRep->setEnabled(true);
|
||||
ButtonChangeEchoMode->setEnabled(true);
|
||||
KeyType=PASSWORD;
|
||||
Combo_Dirs->setEnabled(false);
|
||||
ButtonBrowse->setEnabled(false);
|
||||
Label_KeyFile->setEnabled(false);
|
||||
Label_Password->setEnabled(true);
|
||||
Label_PasswordRep->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);
|
||||
Edit_PasswordRep->setEnabled(true);
|
||||
ButtonChangeEchoMode->setEnabled(true);
|
||||
KeyType=PASSWORD;
|
||||
}
|
||||
|
||||
|
||||
void CPasswordDialog::setStateKeyFileOnly(){
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Label_KeyFile->setEnabled(true);
|
||||
Label_Password->setEnabled(false);
|
||||
Edit_Password->setEnabled(false);
|
||||
Edit_PasswordRep->setEnabled(false);
|
||||
ButtonChangeEchoMode->setEnabled(false);
|
||||
KeyType=KEYFILE;
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Label_KeyFile->setEnabled(true);
|
||||
Label_Password->setEnabled(false);
|
||||
Label_PasswordRep->setEnabled(false);
|
||||
Edit_Password->setEnabled(false);
|
||||
Edit_PasswordRep->setEnabled(false);
|
||||
ButtonChangeEchoMode->setEnabled(false);
|
||||
KeyType=KEYFILE;
|
||||
}
|
||||
|
||||
|
||||
void CPasswordDialog::setStateBoth(){
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Label_KeyFile->setEnabled(true);
|
||||
Label_Password->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);
|
||||
Edit_PasswordRep->setEnabled(true);
|
||||
ButtonChangeEchoMode->setEnabled(true);
|
||||
KeyType=BOTH;
|
||||
Combo_Dirs->setEnabled(true);
|
||||
ButtonBrowse->setEnabled(true);
|
||||
Label_KeyFile->setEnabled(true);
|
||||
Label_Password->setEnabled(true);
|
||||
Label_PasswordRep->setEnabled(true);
|
||||
Edit_Password->setEnabled(true);
|
||||
Edit_PasswordRep->setEnabled(true);
|
||||
ButtonChangeEchoMode->setEnabled(true);
|
||||
KeyType=BOTH;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,122 +161,129 @@ void CPasswordDialog::OnOK(){
|
||||
|
||||
if(password=="" && keyfile==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
return;
|
||||
}
|
||||
|
||||
if(KeyType==BOTH){
|
||||
if(password==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(keyfile==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0);
|
||||
if(KeyType==BOTH){
|
||||
if(password==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(keyfile==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
|
||||
if(KeyType==BOTH || KeyType==KEYFILE){
|
||||
QFileInfo fileinfo(keyfile);
|
||||
if(!fileinfo.exists()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory does not exist."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
if(!fileinfo.isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
if(fileinfo.isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
QFile file(keyfile+"pwsafe.key");
|
||||
if(!file.exists()){
|
||||
QDir dir(keyfile);
|
||||
QStringList files;
|
||||
files=dir.entryList(QStringList()<<"*.key",QDir::Files);
|
||||
if(!files.size()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The given directory does not contain any key files."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(files.size()>1){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The given directory contains more then one key file.\nPlease specify the key file directly."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
QFile file(keyfile+files[0]);
|
||||
Q_ASSERT(file.exists());
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
keyfile+=files[0];
|
||||
}
|
||||
else{ /* pwsafe.key exists */
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
}
|
||||
else{ /* not a directory */
|
||||
QFile file(keyfile);
|
||||
if(!file.exists()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file could not be found."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
|
||||
if(KeyType==BOTH || KeyType==KEYFILE){
|
||||
QFileInfo fileinfo(keyfile);
|
||||
if(Mode_Set){
|
||||
if(fileinfo.exists()){
|
||||
switch(QMessageBox::question(this,tr("File exists."),tr("A file with the selected name already exists, should this file be used as key file\nor do you want to overwrite it with a new generated one?"),
|
||||
tr("Use"),tr("Overwrite"),tr("Cancel"),0,2)){
|
||||
case 0: OverwriteKeyFile=false;
|
||||
break;
|
||||
case 1: OverwriteKeyFile=true;
|
||||
break;
|
||||
case 2: return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
if(!fileinfo.exists()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory does not exist."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
if(!fileinfo.isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
if(fileinfo.isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
QFile file(keyfile+"pwsafe.key");
|
||||
if(!file.exists()){
|
||||
QDir dir(keyfile);
|
||||
QStringList files;
|
||||
files=dir.entryList(QStringList()<<"*.key",QDir::Files);
|
||||
if(!files.size()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The given directory does not contain any key files."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(files.size()>1){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The given directory contains more then one key file.\nPlease specify the key file directly."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
QFile file(keyfile+files[0]);
|
||||
Q_ASSERT(file.exists());
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
keyfile+=files[0];
|
||||
}else{
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
}else{
|
||||
QFile file(keyfile);
|
||||
if(!file.exists()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file could not be found."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(!QFileInfo(file).isReadable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(config.RememberLastKey){
|
||||
config.LastKeyLocation=keyfile;
|
||||
config.LastKeyType=KeyType;
|
||||
}
|
||||
done(1);
|
||||
}
|
||||
if(doAuth())done(1);
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnOK_Set(){
|
||||
password=Edit_Password->text();
|
||||
if(password!=Edit_PasswordRep->text()){
|
||||
QMessageBox::warning(this,tr("Warning"),tr("Password an password repetition are not equal.\nPlease check your input."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
keyfile=Combo_Dirs->currentText();
|
||||
if(password=="" && keyfile==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
password=Edit_Password->text();
|
||||
if(password!=Edit_PasswordRep->text()){
|
||||
QMessageBox::warning(this,tr("Warning"),tr("Password an password repetition are not equal.\nPlease check your input."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
keyfile=Combo_Dirs->currentText();
|
||||
if(password=="" && keyfile==""){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
if(keyfile!=QString()){
|
||||
QFile file(keyfile);
|
||||
if(QFileInfo(file).isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
if(file.exists()){
|
||||
switch(QMessageBox::question(this,tr("File exists."),tr("A file with the selected name already exists, should this file be used as key file or do you want to overwrite it with a newly generated one?"),
|
||||
tr("Use"),tr("Overwrite"),tr("Cancel"),0,2)){
|
||||
case 0:
|
||||
OverwriteKeyFile=false;
|
||||
break;
|
||||
case 1:
|
||||
OverwriteKeyFile=true;
|
||||
break;
|
||||
case 2:
|
||||
return;
|
||||
}
|
||||
}
|
||||
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
|
||||
if(OverwriteKeyFile){
|
||||
if(!DbAuth->createKeyFile(keyfile,32,true)){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file could not be created.\n%1").arg(db->getError()),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(doAuth())done(1);
|
||||
}
|
||||
|
||||
QFile file(keyfile);
|
||||
if(QFileInfo(file).isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
QFile file(keyfile+"pwsafe.key");
|
||||
if(file.exists()){
|
||||
int r=QMessageBox::warning(this,tr("Warning"),tr("A file with the name 'pwsafe.key' already exisits in the given directory.\nDo you want to replace it?"),tr("Yes"),tr("No"),"",1,1);
|
||||
if(r)return;
|
||||
if(!QFileInfo(file).isWritable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The exisiting file is not writable."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
bool CPasswordDialog::doAuth(){
|
||||
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
|
||||
if(password!=QString() && keyfile==QString()){
|
||||
DbAuth->authByPwd(password);
|
||||
}
|
||||
keyfile+="pwsafe.key";
|
||||
}else{
|
||||
QFile file(keyfile);
|
||||
if(file.exists()){
|
||||
int r=QMessageBox::warning(this,tr("Warning"),tr("A file with the this name already exisits.\nDo you want to replace it?"),tr("Yes"),tr("No"),"",1,1);
|
||||
if(r)return;
|
||||
if(!QFileInfo(file).isWritable()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("The exisiting file is not writable."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(password==QString() && keyfile!=QString()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
}
|
||||
if(config.RememberLastKey){
|
||||
config.LastKeyLocation=keyfile;
|
||||
config.LastKeyType=KeyType;
|
||||
}
|
||||
done(1);
|
||||
if(password!=QString() && keyfile!=QString()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
|
||||
if(config.RememberLastKey){
|
||||
config.LastKeyLocation=keyfile;
|
||||
config.LastKeyType=KeyType;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnPasswordChanged(const QString &txt){
|
||||
|
||||
@@ -17,42 +17,44 @@
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
#include "main.h"
|
||||
#ifndef PASSWORDDIALOG_H
|
||||
#define PASSWORDDIALOG_H
|
||||
#include "lib/UrlLabel.h"
|
||||
#include "ui_PasswordDlg.h"
|
||||
#include "main.h"
|
||||
#include "lib/UrlLabel.h"
|
||||
#include "Database.h"
|
||||
|
||||
|
||||
class CPasswordDialog : public QDialog, public Ui_PasswordDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
bool Mode_Set; //true = Set, false = Get
|
||||
void setStatePasswordOnly();
|
||||
void setStateKeyFileOnly();
|
||||
void setStateBoth();
|
||||
|
||||
public:
|
||||
QString keyfile;
|
||||
QString password;
|
||||
tKeyType KeyType;
|
||||
bool OverwriteKeyFile;
|
||||
|
||||
CPasswordDialog(QWidget* parent = 0, bool modal = false,
|
||||
bool ShowExitButton = false, bool KeyMode_Set=false, Qt::WFlags fl = 0 );
|
||||
|
||||
public slots:
|
||||
void OnOK();
|
||||
void OnOK_Set();
|
||||
void OnCancel();
|
||||
void OnButtonBrowse();
|
||||
void OnButtonBrowse_Set();
|
||||
void OnButtonExit();
|
||||
void OnPasswordChanged(const QString &txt);
|
||||
void OnCheckBox_BothChanged(int state);
|
||||
void ChangeEchoMode();
|
||||
void OnComboTextChanged(const QString&);
|
||||
private:
|
||||
bool Mode_Set; //true = Set, false = Get
|
||||
IDatabase* db;
|
||||
void setStatePasswordOnly();
|
||||
void setStateKeyFileOnly();
|
||||
void setStateBoth();
|
||||
bool doAuth();
|
||||
|
||||
public:
|
||||
QString keyfile;
|
||||
QString password;
|
||||
tKeyType KeyType;
|
||||
bool OverwriteKeyFile;
|
||||
CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButton = false, bool KeyMode_Set=false);
|
||||
|
||||
public slots:
|
||||
void OnOK();
|
||||
void OnOK_Set();
|
||||
void OnCancel();
|
||||
void OnButtonBrowse();
|
||||
void OnButtonBrowse_Set();
|
||||
void OnButtonExit();
|
||||
void OnPasswordChanged(const QString &txt);
|
||||
void OnCheckBox_BothChanged(int state);
|
||||
void ChangeEchoMode();
|
||||
void OnComboTextChanged(const QString&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -74,8 +74,22 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
||||
color2=config.BannerColor2;
|
||||
textcolor=config.BannerTextColor;
|
||||
CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
|
||||
checkBox_ShowSysTrayIcon->setChecked(config.ShowSysTrayIcon);
|
||||
checkBox_MinimizeToTray->setChecked(config.MinimizeToTray);
|
||||
checkBox_SaveFileDlgHistory->setChecked(config.SaveFileDlgHistory);
|
||||
Edit_BrowserCmd->setText(config.OpenUrlCommand);
|
||||
// CheckBox_ExpandGroupTree->setChecked(config.ExpandGroupTree);
|
||||
|
||||
switch(config.GroupTreeRestore){
|
||||
case 1:
|
||||
Radio_GroupTreeRestore->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
Radio_GroupTreeExpand->setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
Radio_GroupTreeDoNothing->setChecked(true);
|
||||
}
|
||||
|
||||
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
|
||||
Edit_MountDir->setText(config.MountDir);
|
||||
CheckBox_RememberLastKey->setChecked(config.RememberLastKey);
|
||||
@@ -133,9 +147,17 @@ void CSettingsDlg::apply(){
|
||||
config.BannerTextColor=textcolor;
|
||||
config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
|
||||
config.OpenUrlCommand=Edit_BrowserCmd->text();
|
||||
// config.ExpandGroupTree=CheckBox_ExpandGroupTree->isChecked();
|
||||
config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
|
||||
config.MountDir=Edit_MountDir->text();
|
||||
config.ShowSysTrayIcon=checkBox_ShowSysTrayIcon->isChecked();
|
||||
config.MinimizeToTray=checkBox_MinimizeToTray->isChecked();
|
||||
config.SaveFileDlgHistory=checkBox_SaveFileDlgHistory->isChecked();
|
||||
config.EnableBookmarkMenu=checkBox_EnableBookmarkMenu->isChecked();
|
||||
|
||||
if(Radio_GroupTreeRestore->isChecked())config.GroupTreeRestore=0;
|
||||
if(Radio_GroupTreeExpand->isChecked())config.GroupTreeRestore=1;
|
||||
if(Radio_GroupTreeDoNothing->isChecked())config.GroupTreeRestore=2;
|
||||
|
||||
if(config.MountDir!="" && config.MountDir.right(1)!="/")
|
||||
config.MountDir+="/";
|
||||
config.RememberLastKey=CheckBox_RememberLastKey->isChecked();
|
||||
|
||||
Reference in New Issue
Block a user