new config system
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@133 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
@@ -32,7 +32,7 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
|
||||
setupUi(this);
|
||||
createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("KeePassX %1").arg(KEEPASS_VERSION),width());
|
||||
loadLicFromFile();
|
||||
|
||||
|
||||
QString AboutTr=tr("<b>Current Translation: None</b><br><br>","Please replace 'None' with the language of your translation");
|
||||
if(TrActive){
|
||||
AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR"));
|
||||
@@ -58,6 +58,9 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
|
||||
str+="<br>";
|
||||
str+="</div><div style='margin-left:10px;'>";
|
||||
str+="<u>"+tr("James Nicholls")+"</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br></div>";
|
||||
str+="<br>";
|
||||
str+="</div><div style='margin-left:10px;'>";
|
||||
str+="<u>"+tr("Constantin Makshin")+"</u><br>"+tr("Various fixes and improvements")+"<br>"+tr("dinosaur-rus@users.sourceforge.net")+"<br></div>";
|
||||
Edit_Thanks->setHtml(str);
|
||||
}
|
||||
|
||||
@@ -85,7 +88,7 @@ return;
|
||||
|
||||
if(!gpl.open(QIODevice::ReadOnly)){
|
||||
QMessageBox::critical(this,tr("Error"),tr("Could not open file '%1'")
|
||||
.arg("'license.txt'")+tr("The following error occured:\n%1").arg(gpl.errorString())
|
||||
.arg("'license.txt'")+tr("The following error occured:\n%1").arg(gpl.errorString())
|
||||
,tr("OK"),0,0,2,1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){
|
||||
setupUi(this);
|
||||
resize(layout()->closestAcceptableSize(this,QSize(0,0)));
|
||||
setMinimumSize(size());
|
||||
setMaximumSize(size());
|
||||
createBanner(&BannerPixmap,getPixmap("dice"),tr("Entropy Collection"),width());
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include <qpushbutton.h>
|
||||
#include <qpalette.h>
|
||||
#include <qfont.h>
|
||||
@@ -69,7 +69,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
||||
connect(Button_CustomIcons,SIGNAL(clicked()),this,SLOT(OnCustomIcons()));
|
||||
connect(ExpirePresetsMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnExpirePreset(QAction*)));
|
||||
connect(ButtonExpirePresets,SIGNAL(triggered(QAction*)),this,SLOT(OnCalendar(QAction*)));
|
||||
|
||||
|
||||
// QAction::data() contains the time until expiration in days.
|
||||
ExpirePresetsMenu->addAction(tr("Today"))->setData(0);
|
||||
ExpirePresetsMenu->addSeparator();
|
||||
@@ -84,7 +84,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
||||
ExpirePresetsMenu->addAction(tr("1 Year"))->setData(365);
|
||||
ButtonExpirePresets->setMenu(ExpirePresetsMenu);
|
||||
ButtonExpirePresets->setDefaultAction(new QAction(tr("Calendar..."),ButtonExpirePresets));
|
||||
|
||||
|
||||
ButtonOpenAttachment->setIcon(getIcon("fileopen"));
|
||||
ButtonDeleteAttachment->setIcon(getIcon("filedelete"));
|
||||
ButtonSaveAttachment->setIcon(getIcon("filesave"));
|
||||
@@ -101,7 +101,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
||||
Edit_Password->setText(Password.string());
|
||||
Edit_Password_w->setText(Password.string());
|
||||
Password.lock();
|
||||
if(!config.ShowPasswords)
|
||||
if(!config->showPasswords())
|
||||
ChangeEchoMode();
|
||||
OnPasswordwLostFocus();
|
||||
int bits=(Password.length()*8);
|
||||
@@ -118,15 +118,15 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
||||
ButtonSaveAttachment->setDisabled(true);
|
||||
ButtonDeleteAttachment->setDisabled(true);
|
||||
Label_AttachmentSize->setText("");
|
||||
}
|
||||
}
|
||||
else{
|
||||
QString unit;
|
||||
int faktor;
|
||||
int prec;
|
||||
if(entry->binarySize()<1000){unit=" Byte";faktor=1;prec=0;}
|
||||
else
|
||||
else
|
||||
if(entry->binarySize()<1000000){unit=" kB";faktor=1000;prec=1;}
|
||||
else{unit=" MB";faktor=1000000;prec=1;}
|
||||
else{unit=" MB";faktor=1000000;prec=1;}
|
||||
Label_AttachmentSize->setText(QString::number((float)entry->binarySize()/(float)faktor,'f',prec)+unit);
|
||||
}
|
||||
if(entry->expire()==Date_Never){
|
||||
@@ -135,7 +135,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
||||
}
|
||||
else{
|
||||
DateTime_Expire->setDateTime(entry->expire());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CEditEntryDlg::~CEditEntryDlg()
|
||||
@@ -183,9 +183,9 @@ void CEditEntryDlg::InitGroupComboBox(){
|
||||
Combo_Group->insertItem(i,db->icon(groups[i]->image()),Space+groups[i]->title());
|
||||
if(groups[i]==entry->group()){
|
||||
Combo_Group->setCurrentIndex(i);
|
||||
GroupIndex=i;
|
||||
GroupIndex=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEditEntryDlg::OnButtonOK()
|
||||
@@ -219,7 +219,7 @@ void CEditEntryDlg::OnButtonOK()
|
||||
password.fill('X');
|
||||
if(entry->image()!=Combo_IconPicker->currentIndex())
|
||||
ModFlag=true;
|
||||
|
||||
|
||||
if(ModFlag){
|
||||
entry->setExpire(DateTime_Expire->dateTime());
|
||||
entry->setLastAccess(QDateTime::currentDateTime());
|
||||
@@ -238,11 +238,11 @@ void CEditEntryDlg::OnButtonOK()
|
||||
EntryMoved=true; ModFlag=true;
|
||||
}
|
||||
entry->setImage(Combo_IconPicker->currentIndex());
|
||||
|
||||
|
||||
if(ModFlag&&EntryMoved)done(2);
|
||||
else if(ModFlag)done(1);
|
||||
else done(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CEditEntryDlg::OnButtonCancel()
|
||||
@@ -268,7 +268,7 @@ Edit_Password_w->setEchoMode(QLineEdit::Normal);
|
||||
|
||||
void CEditEntryDlg::OnPasswordTextChanged(const QString& txt)
|
||||
{
|
||||
Edit_Password_w->setText("");
|
||||
Edit_Password_w->setText(QString());
|
||||
int bits=(Edit_Password->text().length()*8);
|
||||
Label_Bits->setText(QString::number(bits)+" Bit");
|
||||
if(bits>128)bits=128;
|
||||
@@ -307,7 +307,7 @@ else
|
||||
}
|
||||
|
||||
void CEditEntryDlg::OnNewAttachment()
|
||||
{
|
||||
{
|
||||
QString filename=QFileDialog::getOpenFileName(this,tr("Add Attachment..."),QDir::homePath());
|
||||
if(filename=="")return;
|
||||
QFile file(filename);
|
||||
@@ -316,7 +316,7 @@ void CEditEntryDlg::OnNewAttachment()
|
||||
QMessageBox::warning(NULL,tr("Error"),tr("Could not open file."),tr("OK"));
|
||||
return;
|
||||
}
|
||||
ModFlag=true;
|
||||
ModFlag=true;
|
||||
entry->setBinary(file.readAll());
|
||||
file.close();
|
||||
QFileInfo info(filename);
|
||||
@@ -341,7 +341,7 @@ void CEditEntryDlg::OnSaveAttachment(){
|
||||
|
||||
void CEditEntryDlg::saveAttachment(IEntryHandle* pEntry, QWidget* ParentWidget)
|
||||
{
|
||||
if(!pEntry->binarySize()){
|
||||
if(!pEntry->binarySize()){
|
||||
QMessageBox::information(NULL,tr("Error"),tr("The chosen entry has no attachment or it is empty."),tr("OK"));
|
||||
return;
|
||||
}
|
||||
@@ -390,8 +390,8 @@ void CEditEntryDlg::OnButtonGenPw()
|
||||
{
|
||||
CGenPwDialog dlg(this,false);
|
||||
if(dlg.exec()){
|
||||
Edit_Password->setText(dlg.Edit_dest->text());
|
||||
Edit_Password_w->setText(dlg.Edit_dest->text());
|
||||
Edit_Password->setText(dlg.Edit_dest->text());
|
||||
Edit_Password_w->setText(dlg.Edit_dest->text());
|
||||
ModFlag=true;
|
||||
}
|
||||
}
|
||||
@@ -427,6 +427,6 @@ void CEditEntryDlg::OnCalendar(QAction* action){
|
||||
CheckBox_ExpiresNever->setChecked(false);
|
||||
DateTime_Expire->setDate(dlg.calendarWidget->selectedDate());
|
||||
DateTime_Expire->setTime(QTime(0,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QShowEvent>
|
||||
#include "main.h"
|
||||
#include "StandardDatabase.h"
|
||||
#include "Kdb3Database.h"
|
||||
|
||||
class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QStringList>
|
||||
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "PasswordDlg.h"
|
||||
#include "lib/FileDialogs.h"
|
||||
|
||||
@@ -40,31 +40,33 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
|
||||
setupUi(this);
|
||||
createBanner(Banner,getPixmap("key"),tr("Database Key"));
|
||||
db=DB;
|
||||
QDir media(config.MountDir);
|
||||
QString mountDir=config->mountDir();
|
||||
QDir media(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->addItem(mountDir+Paths[i]);
|
||||
}
|
||||
|
||||
|
||||
Combo_Dirs->setEditText(QString());
|
||||
if(settings->value("RememberLastKey",true).toBool() && !ChangeKeyMode){
|
||||
QString LastKeyType=settings->value("LastKeyType","").toString();
|
||||
if(LastKeyType=="KeyFile"){
|
||||
setStateKeyFileOnly();
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString())));
|
||||
}
|
||||
else if(LastKeyType=="Composite"){
|
||||
setStateBoth();
|
||||
CheckBox_Both->setChecked(true);
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString())));
|
||||
if(config->rememberLastKey() && !ChangeKeyMode){
|
||||
switch(config->lastKeyType()){
|
||||
case KEYFILE:
|
||||
setStateKeyFileOnly();
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
|
||||
break;
|
||||
|
||||
case BOTH:
|
||||
setStateBoth();
|
||||
CheckBox_Both->setChecked(true);
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
|
||||
}
|
||||
// if(LastKeyType==Password){... is not required because it is already the default state.
|
||||
}
|
||||
|
||||
|
||||
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&) ) );
|
||||
@@ -73,7 +75,7 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
|
||||
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){
|
||||
@@ -85,8 +87,8 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
|
||||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK_Set() ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
|
||||
}
|
||||
|
||||
if(!config.ShowPasswordsPasswordDlg)ChangeEchoModeDatabaseKey();
|
||||
|
||||
if(!config->showPasswordsPasswordDlg())ChangeEchoModeDatabaseKey();
|
||||
}
|
||||
|
||||
|
||||
@@ -159,16 +161,16 @@ void CPasswordDialog::OnOK(){
|
||||
password=Edit_Password->text();
|
||||
keyfile=Combo_Dirs->currentText();
|
||||
|
||||
if(password=="" && keyfile==""){
|
||||
if(password.isEmpty() && keyfile.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
if(KeyType==BOTH){
|
||||
if(password==""){
|
||||
if(password.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(keyfile==""){
|
||||
if(keyfile.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
@@ -186,7 +188,7 @@ void CPasswordDialog::OnOK(){
|
||||
if(fileinfo.isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
QFile file(keyfile+"pwsafe.key");
|
||||
if(!file.exists()){
|
||||
if(!file.exists()){
|
||||
QDir dir(keyfile);
|
||||
QStringList files;
|
||||
files=dir.entryList(QStringList()<<"*.key",QDir::Files);
|
||||
@@ -200,13 +202,13 @@ void CPasswordDialog::OnOK(){
|
||||
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;}
|
||||
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;}
|
||||
return;}
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
}
|
||||
@@ -231,15 +233,15 @@ void CPasswordDialog::OnOK_Set(){
|
||||
return;
|
||||
}
|
||||
keyfile=Combo_Dirs->currentText();
|
||||
if(password=="" && keyfile==""){
|
||||
if(password.isEmpty() && keyfile.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
if(keyfile!=QString()){
|
||||
|
||||
if(!keyfile.isEmpty()){
|
||||
QFile file(keyfile);
|
||||
if(QFileInfo(file).isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
if(file.exists()){
|
||||
@@ -252,60 +254,55 @@ void CPasswordDialog::OnOK_Set(){
|
||||
OverwriteKeyFile=true;
|
||||
break;
|
||||
case 2:
|
||||
return;
|
||||
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);
|
||||
}
|
||||
|
||||
bool CPasswordDialog::doAuth(){
|
||||
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
|
||||
if(password!=QString() && keyfile==QString()){
|
||||
if(!password.isEmpty() && keyfile.isEmpty()){
|
||||
DbAuth->authByPwd(password);
|
||||
}
|
||||
if(password==QString() && keyfile!=QString()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
if(password.isEmpty() && !keyfile.isEmpty()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
if(password!=QString() && keyfile!=QString()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
|
||||
if(settings->value("RememberLastKey",true).toBool()){
|
||||
if(!password.isEmpty() && !keyfile.isEmpty()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
|
||||
if(config->rememberLastKey()){
|
||||
QString KeyLocation=keyfile;
|
||||
if(settings->value("SaveRelativePaths",true).toBool()){
|
||||
if(config->saveRelativePaths()){
|
||||
KeyLocation=KeyLocation.left(KeyLocation.lastIndexOf("/"));
|
||||
KeyLocation=makePathRelative(KeyLocation,QDir::currentPath())+keyfile.right(keyfile.length()-keyfile.lastIndexOf("/")-1);
|
||||
KeyLocation=makePathRelative(KeyLocation,QDir::currentPath())+keyfile.right(keyfile.length()-keyfile.lastIndexOf("/")-1);
|
||||
}
|
||||
settings->setValue("LastKeyFile",KeyLocation);
|
||||
if(KeyType==PASSWORD)
|
||||
settings->setValue("LastKeyType","Password");
|
||||
if(KeyType==KEYFILE)
|
||||
settings->setValue("LastKeyType","KeyFile");
|
||||
if(KeyType==BOTH)
|
||||
settings->setValue("LastKeyType","Composite");
|
||||
config->setLastKeyLocation(KeyLocation);
|
||||
config->setLastKeyType(KeyType);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnPasswordChanged(const QString &txt){
|
||||
Edit_PasswordRep->setText("");
|
||||
if(CheckBox_Both->isChecked() || txt==QString())
|
||||
Edit_PasswordRep->setText(QString());
|
||||
if(CheckBox_Both->isChecked() || txt.isEmpty())
|
||||
setStateBoth();
|
||||
else
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnComboTextChanged(const QString& txt){
|
||||
if(CheckBox_Both->isChecked() || txt==QString())
|
||||
if(CheckBox_Both->isChecked() || txt.isEmpty())
|
||||
setStateBoth();
|
||||
else
|
||||
setStateKeyFileOnly();
|
||||
@@ -317,17 +314,16 @@ void CPasswordDialog::OnCheckBox_BothChanged(int state){
|
||||
if(state==Qt::Checked)
|
||||
setStateBoth();
|
||||
if(state==Qt::Unchecked){
|
||||
if(Edit_Password->text()!=QString() && Combo_Dirs->currentText()!=QString()){
|
||||
if(!Edit_Password->text().isEmpty() && !Combo_Dirs->currentText().isEmpty()){
|
||||
Combo_Dirs->setEditText(QString());
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
else{
|
||||
if(Edit_Password->text()==QString())
|
||||
if(Edit_Password->text().isEmpty())
|
||||
setStateKeyFileOnly();
|
||||
else
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
#include "PasswordGenDlg.h"
|
||||
#include "CollectEntropyDlg.h"
|
||||
#include "crypto/yarrow.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
|
||||
bool CGenPwDialog::EntropyCollected=false;
|
||||
|
||||
|
||||
CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
|
||||
: QDialog(parent,fl)
|
||||
{
|
||||
setupUi(this);
|
||||
setMinimumSize(size());
|
||||
setMaximumSize(size());
|
||||
createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width());
|
||||
createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width());
|
||||
connect(ButtonGenerate,SIGNAL(clicked()),this,SLOT(OnGeneratePw()));
|
||||
connect(Radio_1,SIGNAL(toggled(bool)),this,SLOT(OnRadio1StateChanged(bool)));
|
||||
connect(Radio_2,SIGNAL(toggled(bool)),this,SLOT(OnRadio2StateChanged(bool)));
|
||||
@@ -56,43 +56,46 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
|
||||
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){
|
||||
AcceptButton=DialogButtons->addButton(tr("Accept"),QDialogButtonBox::AcceptRole);
|
||||
AcceptButton->setDisabled(true);
|
||||
DialogButtons->addButton(QDialogButtonBox::Cancel);
|
||||
DialogButtons->addButton(QDialogButtonBox::Cancel);
|
||||
}
|
||||
else{
|
||||
DialogButtons->addButton(tr("OK"),QDialogButtonBox::AcceptRole);
|
||||
AcceptButton=NULL;
|
||||
}
|
||||
|
||||
Radio_1->setChecked(config.PwGenOptions[0]);
|
||||
Radio_2->setChecked(!config.PwGenOptions[0]);
|
||||
checkBox1->setChecked(config.PwGenOptions[1]);
|
||||
checkBox2->setChecked(config.PwGenOptions[2]);
|
||||
checkBox3->setChecked(config.PwGenOptions[3]);
|
||||
checkBox4->setChecked(config.PwGenOptions[4]);
|
||||
checkBox5->setChecked(config.PwGenOptions[5]);
|
||||
checkBox6->setChecked(config.PwGenOptions[6]);
|
||||
checkBox7->setChecked(config.PwGenOptions[7]);
|
||||
Check_CollectEntropy->setChecked(config.PwGenOptions[8]);
|
||||
Check_CollectOncePerSession->setChecked(config.PwGenOptions[9]);
|
||||
OnRadio1StateChanged(config.PwGenOptions[0]);
|
||||
OnRadio2StateChanged(!config.PwGenOptions[0]);
|
||||
|
||||
QBitArray pwGenOptions=config->pwGenOptions();
|
||||
Radio_1->setChecked(pwGenOptions.at(0));
|
||||
Radio_2->setChecked(!pwGenOptions.at(0));
|
||||
checkBox1->setChecked(pwGenOptions.at(1));
|
||||
checkBox2->setChecked(pwGenOptions.at(2));
|
||||
checkBox3->setChecked(pwGenOptions.at(3));
|
||||
checkBox4->setChecked(pwGenOptions.at(4));
|
||||
checkBox5->setChecked(pwGenOptions.at(5));
|
||||
checkBox6->setChecked(pwGenOptions.at(6));
|
||||
checkBox7->setChecked(pwGenOptions.at(7));
|
||||
Check_CollectEntropy->setChecked(pwGenOptions.at(8));
|
||||
Check_CollectOncePerSession->setChecked(pwGenOptions.at(9));
|
||||
OnRadio1StateChanged(pwGenOptions.at(0));
|
||||
OnRadio2StateChanged(!pwGenOptions.at(0));
|
||||
}
|
||||
|
||||
CGenPwDialog::~CGenPwDialog(){
|
||||
config.PwGenOptions[0]=Radio_1->isChecked();
|
||||
config.PwGenOptions[1]=checkBox1->isChecked();
|
||||
config.PwGenOptions[2]=checkBox2->isChecked();
|
||||
config.PwGenOptions[3]=checkBox3->isChecked();
|
||||
config.PwGenOptions[4]=checkBox4->isChecked();
|
||||
config.PwGenOptions[5]=checkBox5->isChecked();
|
||||
config.PwGenOptions[6]=checkBox6->isChecked();
|
||||
config.PwGenOptions[7]=checkBox7->isChecked();
|
||||
config.PwGenOptions[8]=Check_CollectEntropy->isChecked();
|
||||
config.PwGenOptions[9]=Check_CollectOncePerSession->isChecked();
|
||||
QBitArray pwGenOptions(10);
|
||||
pwGenOptions.setBit(0,Radio_1->isChecked());
|
||||
pwGenOptions.setBit(1,checkBox1->isChecked());
|
||||
pwGenOptions.setBit(2,checkBox2->isChecked());
|
||||
pwGenOptions.setBit(3,checkBox3->isChecked());
|
||||
pwGenOptions.setBit(4,checkBox4->isChecked());
|
||||
pwGenOptions.setBit(5,checkBox5->isChecked());
|
||||
pwGenOptions.setBit(6,checkBox6->isChecked());
|
||||
pwGenOptions.setBit(7,checkBox7->isChecked());
|
||||
pwGenOptions.setBit(8,Check_CollectEntropy->isChecked());
|
||||
pwGenOptions.setBit(9,Check_CollectOncePerSession->isChecked());
|
||||
config->setPwGenOptions(pwGenOptions);
|
||||
}
|
||||
|
||||
void CGenPwDialog::paintEvent(QPaintEvent *event){
|
||||
@@ -129,7 +132,7 @@ void CGenPwDialog::OnRadio2StateChanged(bool state){
|
||||
Edit_chars->setEnabled(true);
|
||||
else
|
||||
Edit_chars->setDisabled(true);
|
||||
|
||||
|
||||
estimateQuality();
|
||||
}
|
||||
|
||||
@@ -141,22 +144,22 @@ void CGenPwDialog::OnGeneratePw()
|
||||
"A...Z" 65...90
|
||||
"a...z" 97...122
|
||||
"0...9" 48...57
|
||||
Special Charakters 33...47; 58...64; 91...96; 123...126
|
||||
Special Characters 33...47; 58...64; 91...96; 123...126
|
||||
"-" 45
|
||||
"_" 95
|
||||
-------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
int num=0;
|
||||
char assoctable[255];
|
||||
|
||||
|
||||
if(Radio_1->isChecked()){
|
||||
if(checkBox1->isChecked())
|
||||
num+=AddToAssoctable(assoctable,65,90,num);
|
||||
num+=AddToAssoctable(assoctable,65,90,num);
|
||||
if(checkBox2->isChecked())
|
||||
num+=AddToAssoctable(assoctable,97,122,num);
|
||||
num+=AddToAssoctable(assoctable,97,122,num);
|
||||
if(checkBox3->isChecked())
|
||||
num+=AddToAssoctable(assoctable,48,57,num);
|
||||
num+=AddToAssoctable(assoctable,48,57,num);
|
||||
if(checkBox4->isChecked()){
|
||||
num+=AddToAssoctable(assoctable,33,47,num);
|
||||
num+=AddToAssoctable(assoctable,58,64,num);
|
||||
@@ -173,7 +176,7 @@ void CGenPwDialog::OnGeneratePw()
|
||||
QString str=Edit_chars->text();
|
||||
for(int i=0;i<str.length();i++){
|
||||
assoctable[i]=str[i].toAscii();
|
||||
num++;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if(num==0){
|
||||
@@ -186,7 +189,7 @@ void CGenPwDialog::OnGeneratePw()
|
||||
int length=Spin_Num->value();
|
||||
char* buffer=new char[length+1];
|
||||
buffer[length]=0;
|
||||
|
||||
|
||||
if(Check_CollectEntropy->isChecked()){
|
||||
if((Check_CollectOncePerSession->isChecked() && !EntropyCollected) || !Check_CollectOncePerSession->isChecked()){
|
||||
CollectEntropyDlg dlg(this);
|
||||
@@ -194,21 +197,21 @@ void CGenPwDialog::OnGeneratePw()
|
||||
EntropyCollected=true;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char tmp;
|
||||
|
||||
unsigned char tmp;
|
||||
for(int i=0;i<length;i++){
|
||||
|
||||
do randomize(&tmp,1);
|
||||
|
||||
do randomize(&tmp,1);
|
||||
while(!trim(tmp,num));
|
||||
|
||||
|
||||
buffer[i]=assoctable[tmp];
|
||||
}
|
||||
|
||||
|
||||
Edit_dest->setText(buffer);
|
||||
delete [] buffer;
|
||||
if(AcceptButton)AcceptButton->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
int CGenPwDialog::AddToAssoctable(char* table,int start,int end,int pos){
|
||||
for(int i=start;i<=end;i++){
|
||||
table[pos]=i;
|
||||
@@ -231,11 +234,11 @@ void CGenPwDialog::estimateQuality(){
|
||||
int num=0;
|
||||
if(Radio_1->isChecked()){
|
||||
if(checkBox1->isChecked())
|
||||
num+=26;
|
||||
num+=26;
|
||||
if(checkBox2->isChecked())
|
||||
num+=26;
|
||||
num+=26;
|
||||
if(checkBox3->isChecked())
|
||||
num+=10;
|
||||
num+=10;
|
||||
if(checkBox4->isChecked())
|
||||
num+=32;
|
||||
if(checkBox5->isChecked())
|
||||
@@ -247,7 +250,7 @@ void CGenPwDialog::estimateQuality(){
|
||||
}
|
||||
else
|
||||
num=Edit_chars->text().length();
|
||||
|
||||
|
||||
float bits=0;
|
||||
if(num)bits=log(num)/log(2);
|
||||
bits=bits*((float)Spin_Num->value());
|
||||
@@ -267,18 +270,18 @@ void CGenPwDialog::OnCharsChanged(const QString& str){
|
||||
else {count++;}
|
||||
}
|
||||
}
|
||||
if(multiple)break;
|
||||
if(multiple)break;
|
||||
}
|
||||
if(!multiple)return;
|
||||
|
||||
|
||||
QString newstr;
|
||||
for(int i=0;i<str.size();i++){
|
||||
if(!newstr.count(str[i])){
|
||||
newstr+=str[i];
|
||||
}
|
||||
newstr+=str[i];
|
||||
}
|
||||
}
|
||||
Edit_chars->setText(newstr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CGenPwDialog::OnAccept()
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "SearchDlg.h"
|
||||
|
||||
|
||||
@@ -37,16 +37,17 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
|
||||
db=database;
|
||||
group=Group;
|
||||
createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width());
|
||||
checkBox_Cs->setChecked(config.SearchOptions[0]);
|
||||
checkBox_regExp->setChecked(config.SearchOptions[1]);
|
||||
checkBox_Title->setChecked(config.SearchOptions[2]);
|
||||
checkBox_Username->setChecked(config.SearchOptions[3]);
|
||||
checkBox_Password->setChecked(config.SearchOptions[4]);
|
||||
checkBox_Comment->setChecked(config.SearchOptions[5]);
|
||||
checkBox_URL->setChecked(config.SearchOptions[6]);
|
||||
checkBox_Attachment->setChecked(config.SearchOptions[7]);
|
||||
QBitArray searchOptions=config->searchOptions();
|
||||
checkBox_Cs->setChecked(searchOptions.at(0));
|
||||
checkBox_regExp->setChecked(searchOptions.at(1));
|
||||
checkBox_Title->setChecked(searchOptions.at(2));
|
||||
checkBox_Username->setChecked(searchOptions.at(3));
|
||||
checkBox_Password->setChecked(searchOptions.at(4));
|
||||
checkBox_Comment->setChecked(searchOptions.at(5));
|
||||
checkBox_URL->setChecked(searchOptions.at(6));
|
||||
checkBox_Attachment->setChecked(searchOptions.at(7));
|
||||
if(group)
|
||||
checkBox_Recursive->setChecked(config.SearchOptions[8]);
|
||||
checkBox_Recursive->setChecked(searchOptions.at(8));
|
||||
else{
|
||||
checkBox_Recursive->setChecked(false);
|
||||
checkBox_Recursive->setEnabled(false);
|
||||
@@ -55,15 +56,17 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
|
||||
|
||||
SearchDialog::~SearchDialog()
|
||||
{
|
||||
config.SearchOptions[0]=checkBox_Cs->isChecked();
|
||||
config.SearchOptions[1]=checkBox_regExp->isChecked();
|
||||
config.SearchOptions[2]=checkBox_Title->isChecked();
|
||||
config.SearchOptions[3]=checkBox_Username->isChecked();
|
||||
config.SearchOptions[4]=checkBox_Password->isChecked();
|
||||
config.SearchOptions[5]=checkBox_Comment->isChecked();
|
||||
config.SearchOptions[6]=checkBox_URL->isChecked();
|
||||
config.SearchOptions[7]=checkBox_Attachment->isChecked();
|
||||
if(group) config.SearchOptions[8]=checkBox_Recursive->isChecked();
|
||||
QBitArray searchOptions(9);
|
||||
searchOptions.setBit(0,checkBox_Cs->isChecked());
|
||||
searchOptions.setBit(1,checkBox_regExp->isChecked());
|
||||
searchOptions.setBit(2,checkBox_Title->isChecked());
|
||||
searchOptions.setBit(3,checkBox_Username->isChecked());
|
||||
searchOptions.setBit(4,checkBox_Password->isChecked());
|
||||
searchOptions.setBit(5,checkBox_Comment->isChecked());
|
||||
searchOptions.setBit(6,checkBox_URL->isChecked());
|
||||
searchOptions.setBit(7,checkBox_Attachment->isChecked());
|
||||
if(group) searchOptions.setBit(8,checkBox_Recursive->isChecked());
|
||||
config->setSearchOptions(searchOptions);
|
||||
}
|
||||
|
||||
void SearchDialog::OnClose()
|
||||
@@ -79,7 +82,7 @@ void SearchDialog::OnSearch()
|
||||
Fields[2]=checkBox_URL->isChecked();
|
||||
Fields[3]=checkBox_Password->isChecked();
|
||||
Fields[4]=checkBox_Comment->isChecked();
|
||||
Fields[5]=checkBox_Attachment->isChecked();
|
||||
Fields[5]=checkBox_Attachment->isChecked();
|
||||
Result=db->search(group,Edit_Search->text(),checkBox_Cs->isChecked(),checkBox_regExp->isChecked(),checkBox_Recursive->isChecked(),Fields);
|
||||
done(1);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include <qpixmap.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qspinbox.h>
|
||||
@@ -40,92 +40,94 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
||||
connect(DialogButtons, SIGNAL( accepted() ), this, SLOT( OnOK() ) );
|
||||
connect(DialogButtons, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
|
||||
connect(DialogButtons, SIGNAL( clicked(QAbstractButton*)), this, SLOT(OnOtherButton(QAbstractButton*)));
|
||||
|
||||
|
||||
connect(ButtonColor1, SIGNAL( clicked() ), this, SLOT( OnColor1() ) );
|
||||
connect(ButtonColor2, SIGNAL( clicked() ), this, SLOT( OnColor2() ) );
|
||||
connect(ButtonTextColor, SIGNAL( clicked() ), this, SLOT( OnTextColor() ) );
|
||||
connect(CheckBox_OpenLast,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxOpenLastChanged(int)));
|
||||
connect(Button_MountDirBrowse,SIGNAL(clicked()),this,SLOT(OnMountDirBrowse()));
|
||||
|
||||
|
||||
connect(Radio_IntPlugin_None,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginNone(bool)));
|
||||
connect(Radio_IntPlugin_Gnome,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginGnome(bool)));
|
||||
connect(Radio_IntPlugin_Kde,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginKde(bool)));
|
||||
|
||||
|
||||
connect(CheckBox_BrowserDefault,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxBrowserDefaultChanged(int)));
|
||||
connect(Button_CustomizeEntryDetails,SIGNAL(clicked()),this,SLOT(OnCustomizeEntryDetails()));
|
||||
|
||||
|
||||
|
||||
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
|
||||
|
||||
|
||||
//General
|
||||
CheckBox_OpenLast->setChecked(settings->value("OpenLastFile",true).toBool());
|
||||
CheckBox_RememberLastKey->setChecked(settings->value("RememberLastKey",true).toBool());
|
||||
checkBox_ShowSysTrayIcon->setChecked(config.ShowSysTrayIcon);
|
||||
checkBox_MinimizeToTray->setChecked(config.MinimizeToTray);
|
||||
checkBox_SaveFileDlgHistory->setChecked(config.SaveFileDlgHistory);
|
||||
|
||||
switch(config.GroupTreeRestore){
|
||||
case 1:
|
||||
CheckBox_OpenLast->setChecked(config->openLastFile());
|
||||
CheckBox_RememberLastKey->setChecked(config->rememberLastKey());
|
||||
checkBox_ShowSysTrayIcon->setChecked(config->showSysTrayIcon());
|
||||
checkBox_MinimizeToTray->setChecked(config->minimizeToTray());
|
||||
checkBox_SaveFileDlgHistory->setChecked(config->saveFileDlgHistory());
|
||||
checkBox_AskBeforeDelete->setChecked(config->askBeforeDelete());
|
||||
|
||||
switch(config->groupTreeState()){
|
||||
case KpxConfig::RestoreLast:
|
||||
Radio_GroupTreeRestore->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
case KpxConfig::ExpandAll:
|
||||
Radio_GroupTreeExpand->setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
Radio_GroupTreeDoNothing->setChecked(true);
|
||||
}
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="ExpandAll")Radio_GroupTreeExpand->setChecked(true);
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="Restore")Radio_GroupTreeRestore->setChecked(true);
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="ExpandNone")Radio_GroupTreeDoNothing->setChecked(true);
|
||||
|
||||
|
||||
//Appearance
|
||||
|
||||
//Appearance
|
||||
QPixmap *pxt=new QPixmap(pixmTextColor->width(),pixmTextColor->height());
|
||||
pxt->fill(config.BannerTextColor);
|
||||
pxt->fill(config->bannerTextColor());
|
||||
pixmTextColor->clear();
|
||||
pixmTextColor->setPixmap(*pxt);
|
||||
|
||||
|
||||
QPixmap *px1=new QPixmap(pixmColor1->width(),pixmColor1->height());
|
||||
px1->fill(config.BannerColor1);
|
||||
px1->fill(config->bannerColor1());
|
||||
pixmColor1->clear();
|
||||
pixmColor1->setPixmap(*px1);
|
||||
|
||||
|
||||
QPixmap *px2=new QPixmap(pixmColor2->width(),pixmColor2->height());
|
||||
px2->fill(config.BannerColor2);
|
||||
px2->fill(config->bannerColor2());
|
||||
pixmColor2->clear();
|
||||
pixmColor2->setPixmap(*px2);
|
||||
|
||||
color1=config.BannerColor1;
|
||||
color2=config.BannerColor2;
|
||||
textcolor=config.BannerTextColor;
|
||||
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
|
||||
|
||||
|
||||
pixmColor2->setPixmap(*px2);
|
||||
|
||||
color1=config->bannerColor1();
|
||||
color2=config->bannerColor2();
|
||||
textcolor=config->bannerTextColor();
|
||||
CheckBox_AlternatingRowColors->setChecked(config->alternatingRowColors());
|
||||
|
||||
|
||||
//Security
|
||||
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
|
||||
CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
|
||||
CheckBox_ShowPasswords_PasswordDlg->setChecked(config.ShowPasswordsPasswordDlg);
|
||||
|
||||
|
||||
SpinBox_ClipboardTime->setValue(config->clipboardTimeOut());
|
||||
CheckBox_ShowPasswords->setChecked(config->showPasswords());
|
||||
CheckBox_ShowPasswords_PasswordDlg->setChecked(config->showPasswordsPasswordDlg());
|
||||
|
||||
|
||||
//Desktop Integration
|
||||
if(PluginLoadError==QString())
|
||||
Label_IntPlugin_Error->hide();
|
||||
else
|
||||
Label_IntPlugin_Error->setText(QString("<html><p style='font-weight:600; color:#8b0000;'>%1</p></body></html>")
|
||||
.arg(tr("Error: %1")).arg(PluginLoadError));
|
||||
|
||||
switch(config.IntegrPlugin){
|
||||
case CConfig::NONE: Radio_IntPlugin_None->setChecked(true); break;
|
||||
case CConfig::GNOME: Radio_IntPlugin_Gnome->setChecked(true); break;
|
||||
case CConfig::KDE: Radio_IntPlugin_Kde->setChecked(true); break;
|
||||
.arg(tr("Error: %1")).arg(PluginLoadError));
|
||||
|
||||
switch(config->integrPlugin()){
|
||||
case KpxConfig::KDE:
|
||||
Radio_IntPlugin_Kde->setChecked(true);
|
||||
break;
|
||||
case KpxConfig::Gnome:
|
||||
Radio_IntPlugin_Gnome->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
Radio_IntPlugin_None->setChecked(true);
|
||||
}
|
||||
if(!PluginsModified)
|
||||
Label_IntPlugin_Info->hide();
|
||||
|
||||
|
||||
|
||||
|
||||
//Advanced
|
||||
QString BrowserCmd=settings->value("BrowserCmd","<<default>>").toString();
|
||||
if(BrowserCmd=="<<default>>"){
|
||||
QString BrowserCmd=config->urlCmd();
|
||||
if(BrowserCmd.isEmpty()){
|
||||
CheckBox_BrowserDefault->setChecked(true);
|
||||
Edit_BrowserCmd->setDisabled(true);
|
||||
}
|
||||
@@ -133,10 +135,10 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
||||
Edit_BrowserCmd->setText(BrowserCmd);
|
||||
CheckBox_BrowserDefault->setChecked(false);
|
||||
}
|
||||
|
||||
Edit_MountDir->setText(config.MountDir);
|
||||
CheckBox_SaveRelativePaths->setChecked(settings->value("SaveRelativePaths",true).toBool());
|
||||
|
||||
|
||||
Edit_MountDir->setText(config->mountDir());
|
||||
CheckBox_SaveRelativePaths->setChecked(config->saveRelativePaths());
|
||||
|
||||
}
|
||||
|
||||
CSettingsDlg::~CSettingsDlg()
|
||||
@@ -153,7 +155,7 @@ void CSettingsDlg::paintEvent(QPaintEvent *event){
|
||||
void CSettingsDlg::OnCheckBoxBrowserDefaultChanged(int state){
|
||||
if(state==Qt::Checked){
|
||||
Edit_BrowserCmd->setDisabled(true);
|
||||
Edit_BrowserCmd->setText("");
|
||||
Edit_BrowserCmd->setText(QString());
|
||||
}
|
||||
else{
|
||||
Edit_BrowserCmd->setDisabled(false);
|
||||
@@ -172,51 +174,49 @@ void CSettingsDlg::OnCancel()
|
||||
}
|
||||
|
||||
void CSettingsDlg::OnOtherButton(QAbstractButton* button){
|
||||
if(DialogButtons->buttonRole(button)==QDialogButtonBox::ApplyRole)
|
||||
if(DialogButtons->buttonRole(button)==QDialogButtonBox::ApplyRole)
|
||||
apply();
|
||||
}
|
||||
|
||||
void CSettingsDlg::apply(){
|
||||
|
||||
|
||||
//General
|
||||
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;
|
||||
settings->setValue("OpenLastFile",CheckBox_OpenLast->isChecked());
|
||||
settings->setValue("RememberLastKey",CheckBox_RememberLastKey->isChecked());
|
||||
if(Radio_GroupTreeExpand->isChecked())settings->setValue("GroupTreeState","ExpandAll");
|
||||
if(Radio_GroupTreeDoNothing->isChecked())settings->setValue("GroupTreeState","ExpandNone");
|
||||
if(Radio_GroupTreeRestore->isChecked())settings->setValue("GroupTreeState","Restore");
|
||||
|
||||
config->setShowSysTrayIcon(checkBox_ShowSysTrayIcon->isChecked());
|
||||
config->setMinimizeToTray(checkBox_MinimizeToTray->isChecked());
|
||||
config->setSaveFileDlgHistory(checkBox_SaveFileDlgHistory->isChecked());
|
||||
config->setEnableBookmarkMenu(checkBox_EnableBookmarkMenu->isChecked());
|
||||
if(Radio_GroupTreeRestore->isChecked())config->setGroupTreeState(KpxConfig::RestoreLast);
|
||||
else if(Radio_GroupTreeExpand->isChecked())config->setGroupTreeState(KpxConfig::ExpandAll);
|
||||
else config->setGroupTreeState(KpxConfig::DoNothing);
|
||||
config->setOpenLastFile(CheckBox_OpenLast->isChecked());
|
||||
config->setRememberLastKey(CheckBox_RememberLastKey->isChecked());
|
||||
config->setAskBeforeDelete(checkBox_AskBeforeDelete->isChecked());
|
||||
|
||||
//Appearence
|
||||
config.BannerColor1=color1;
|
||||
config.BannerColor2=color2;
|
||||
config.BannerTextColor=textcolor;
|
||||
config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
|
||||
|
||||
config->setBannerColor1(color1);
|
||||
config->setBannerColor2(color2);
|
||||
config->setBannerTextColor(textcolor);
|
||||
config->setAlternatingRowColors(CheckBox_AlternatingRowColors->isChecked());
|
||||
|
||||
//Security
|
||||
config.ClipboardTimeOut=SpinBox_ClipboardTime->value();
|
||||
config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
|
||||
config.ShowPasswordsPasswordDlg=CheckBox_ShowPasswords_PasswordDlg->isChecked();
|
||||
|
||||
//Desktop Integration
|
||||
config->setClipboardTimeOut(SpinBox_ClipboardTime->value());
|
||||
config->setShowPasswords(CheckBox_ShowPasswords->isChecked());
|
||||
config->setShowPasswordsPasswordDlg(CheckBox_ShowPasswords_PasswordDlg->isChecked());
|
||||
|
||||
//Desktop Integration
|
||||
PluginsModified=Label_IntPlugin_Info->isVisible();
|
||||
if(Radio_IntPlugin_None->isChecked())config.IntegrPlugin=CConfig::NONE;
|
||||
if(Radio_IntPlugin_Gnome->isChecked())config.IntegrPlugin=CConfig::GNOME;
|
||||
if(Radio_IntPlugin_Kde->isChecked())config.IntegrPlugin=CConfig::KDE;
|
||||
|
||||
if(Radio_IntPlugin_Kde->isChecked())config->setIntegrPlugin(KpxConfig::KDE);
|
||||
else if(Radio_IntPlugin_Gnome->isChecked())config->setIntegrPlugin(KpxConfig::Gnome);
|
||||
else config->setIntegrPlugin(KpxConfig::NoIntegr);
|
||||
|
||||
//Advanced
|
||||
config.OpenUrlCommand=Edit_BrowserCmd->text();
|
||||
config.MountDir=Edit_MountDir->text();
|
||||
if(config.MountDir!="" && config.MountDir.right(1)!="/")
|
||||
config.MountDir+="/";
|
||||
if(CheckBox_BrowserDefault->isChecked())settings->setValue("BrowserCmd","<<default>>");
|
||||
else settings->setValue("BrowserCmd",Edit_BrowserCmd->text());
|
||||
settings->setValue("SaveRelativePaths",CheckBox_SaveRelativePaths->isChecked());
|
||||
config->setUrlCmd(Edit_BrowserCmd->text());
|
||||
config->setMountDir(Edit_MountDir->text());
|
||||
if(!config->mountDir().isEmpty() && config->mountDir().right(1)!="/")
|
||||
config->setMountDir(config->mountDir()+"/");
|
||||
if(CheckBox_BrowserDefault->isChecked())config->setUrlCmd(QString());
|
||||
else config->setUrlCmd(Edit_BrowserCmd->text());
|
||||
config->setSaveRelativePaths(CheckBox_SaveRelativePaths->isChecked());
|
||||
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ void CSettingsDlg::OnTextColor()
|
||||
pixmTextColor->clear();
|
||||
pixmTextColor->setPixmap(*px);
|
||||
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -292,5 +292,5 @@ void CSettingsDlg::OnIntPluginKde(bool toggled){
|
||||
|
||||
void CSettingsDlg::OnCustomizeEntryDetails(){
|
||||
CustomizeDetailViewDialog dlg(this);
|
||||
dlg.exec();
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "SimplePasswordDlg.h"
|
||||
|
||||
SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl)
|
||||
: QDialog(parent,fl)
|
||||
{
|
||||
setupUi(this);
|
||||
if(!config.ShowPasswords)Button_HidePassword->toggle();
|
||||
if(!config->showPasswords())Button_HidePassword->toggle();
|
||||
connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnOK()));
|
||||
connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(OnCancel()));
|
||||
connect(Button_HidePassword,SIGNAL(toggled(bool)),this,SLOT(OnHidePasswordToggled(bool)));
|
||||
@@ -42,9 +42,9 @@ SimplePasswordDialog::~SimplePasswordDialog()
|
||||
|
||||
void SimplePasswordDialog::OnTextChanged(const QString& txt){
|
||||
if(txt==QString())
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
else
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
}
|
||||
|
||||
void SimplePasswordDialog::OnCancel()
|
||||
|
||||
Reference in New Issue
Block a user