new config system

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@133 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 18 years ago
parent 9b25cc235d
commit 9dc8f878b5
  1. 10
      src/Database.h
  2. 47
      src/Kdb3Database.cpp
  3. 19
      src/Kdb3Database.h
  4. 3
      src/dialogs/AboutDlg.cpp
  5. 1
      src/dialogs/CollectEntropyDlg.cpp
  6. 6
      src/dialogs/EditEntryDlg.cpp
  7. 2
      src/dialogs/EditEntryDlg.h
  8. 70
      src/dialogs/PasswordDlg.cpp
  9. 53
      src/dialogs/PasswordGenDlg.cpp
  10. 41
      src/dialogs/SearchDlg.cpp
  11. 126
      src/dialogs/SettingsDlg.cpp
  12. 4
      src/dialogs/SimplePasswordDlg.cpp
  13. 24
      src/forms/CollectEntropyDlg.ui
  14. 45
      src/forms/MainWindow.ui
  15. 620
      src/forms/SettingsDlg.ui
  16. 231
      src/lib/EntryView.cpp
  17. 11
      src/lib/EntryView.h
  18. 89
      src/lib/FileDialogs.cpp
  19. 16
      src/lib/FileDialogs.h
  20. 19
      src/lib/GroupView.cpp
  21. 2
      src/lib/GroupView.h
  22. 1
      src/lib/WaitAnimationWidget.cpp
  23. 84
      src/main.cpp
  24. 8
      src/main.h
  25. 113
      src/mainwindow.cpp
  26. 7
      src/mainwindow.h
  27. 8
      src/plugins/interfaces/IFileDialog.h
  28. 14
      src/src.pro

@ -300,8 +300,6 @@ public:
/*! \return the last error message or an empty QString() object if no error occured.*/ /*! \return the last error message or an empty QString() object if no error occured.*/
virtual QString getError()=0; virtual QString getError()=0;
/*! Creates a clone of a given entry. /*! Creates a clone of a given entry.
All attributes besides the UUID are copied, even the creation date. All attributes besides the UUID are copied, even the creation date.
\param entry The handle of the entry which should be cloned. \param entry The handle of the entry which should be cloned.
@ -399,6 +397,14 @@ public:
\return the search results as a list of pointers to the entry handles.*/ \return the search results as a list of pointers to the entry handles.*/
virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields)=0; virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields)=0;
//! Moves an entry to the recycle bin.
virtual void moveToTrash(IEntryHandle* entry)=0;
//! \returns all entries of the recycle bin.
virtual QList<IEntryHandle*> trashEntries()=0;
//! Empty the recycle bin.
virtual void emptyTrash()=0;
}; };

@ -34,8 +34,9 @@
#include "crypto/yarrow.h" #include "crypto/yarrow.h"
#include "lib/random.h" #include "lib/random.h"
using namespace std; using namespace std;
#include "StandardDatabase.h" #include "Kdb3Database.h"
#include "main.h" #include "main.h"
#include "KpxConfig.h"
#define UNEXP_ERROR error=QString("Unexpected error in: %1, Line:%2").arg(__FILE__).arg(__LINE__); #define UNEXP_ERROR error=QString("Unexpected error in: %1, Line:%2").arg(__FILE__).arg(__LINE__);
@ -412,17 +413,18 @@ void Kdb3Database::createHandles(){
} }
void Kdb3Database::restoreGroupTreeState(){ void Kdb3Database::restoreGroupTreeState(){
if(settings->value("GroupTreeState","ExpandAll")=="ExpandAll"){ switch (config->groupTreeState()){
for(int i=0;i<Groups.size();i++){ case KpxConfig::RestoreLast:
Groups[i].IsExpanded=true;
}
}
else
if(settings->value("GroupTreeState","ExpandAll")=="Restore"){
for(int i=0;i<Groups.size();i++){ for(int i=0;i<Groups.size();i++){
if(TreeStateMetaStream.contains(Groups[i].Id)) if(TreeStateMetaStream.contains(Groups[i].Id))
Groups[i].IsExpanded=TreeStateMetaStream.value(Groups[i].Id); Groups[i].IsExpanded=TreeStateMetaStream.value(Groups[i].Id);
} }
break;
case KpxConfig::ExpandAll:
for(int i=0;i<Groups.size();i++)
Groups[i].IsExpanded=true;
break;
} }
} }
@ -977,7 +979,6 @@ void Kdb3Database::EntryHandle::setVisualIndex(int index){
Kdb3Database::EntryHandle::EntryHandle(Kdb3Database* db){ Kdb3Database::EntryHandle::EntryHandle(Kdb3Database* db){
pDB=db; pDB=db;
ListIndex=0;
valid=true; valid=true;
} }
@ -1675,3 +1676,31 @@ bool Kdb3Database::changeFile(const QString& filename){
} }
return true; return true;
} }
void Kdb3Database::moveToTrash(IEntryHandle* entry){
TrashEntry trash=*((TrashEntry*)dynamic_cast<EntryHandle*>(entry)->Entry);
IGroupHandle* CurGroup=entry->group();
while(CurGroup){
trash.GroupPath << CurGroup->title();
CurGroup=CurGroup->parent();
}
deleteEntry(entry);
trash.Group=NULL;
TrashEntries.append(trash);
TrashHandles.append(EntryHandle(this));
TrashHandles.back().Entry=&TrashEntries.back();
TrashEntries.back().Handle=&TrashHandles.back();
}
void Kdb3Database::emptyTrash(){
TrashEntries.clear();
TrashHandles.clear();
}
QList<IEntryHandle*> Kdb3Database::trashEntries(){
QList<IEntryHandle*> handles;
for(int i=0; i<TrashHandles.size();i++)
if(TrashHandles[i].isValid())
handles << &TrashHandles[i];
return handles;
}

@ -55,6 +55,7 @@ public:
class StdGroup; class StdGroup;
class StdEntry; class StdEntry;
class EntryHandle:public IEntryHandle{ class EntryHandle:public IEntryHandle{
friend class Kdb3Database; friend class Kdb3Database;
public: public:
EntryHandle(Kdb3Database* db); EntryHandle(Kdb3Database* db);
@ -94,11 +95,11 @@ public:
private: private:
void invalidate(){valid=false;} void invalidate(){valid=false;}
bool valid; bool valid;
unsigned int ListIndex; //KpxUuid Uuid; ???
KpxUuid Uuid;
Kdb3Database* pDB; Kdb3Database* pDB;
StdEntry* Entry; StdEntry* Entry;
}; };
class GroupHandle:public IGroupHandle{ class GroupHandle:public IGroupHandle{
friend class Kdb3Database; friend class Kdb3Database;
GroupHandle(Kdb3Database* db); GroupHandle(Kdb3Database* db);
@ -123,8 +124,10 @@ public:
StdGroup* Group; StdGroup* Group;
Kdb3Database* pDB; Kdb3Database* pDB;
}; };
friend class EntryHandle; friend class EntryHandle;
friend class GroupHandle; friend class GroupHandle;
class StdEntry:public CEntry{ class StdEntry:public CEntry{
public: public:
quint32 OldImage; quint32 OldImage;
@ -132,6 +135,7 @@ public:
EntryHandle* Handle; EntryHandle* Handle;
StdGroup* Group; StdGroup* Group;
}; };
class StdGroup:public CGroup{ class StdGroup:public CGroup{
public: public:
StdGroup():CGroup(){}; StdGroup():CGroup(){};
@ -143,6 +147,12 @@ public:
QList<StdGroup*> Childs; QList<StdGroup*> Childs;
QList<StdEntry*> Entries; QList<StdEntry*> Entries;
}; };
class TrashEntry: public StdEntry{
public:
QStringList GroupPath;
};
virtual ~Kdb3Database(){}; virtual ~Kdb3Database(){};
virtual bool load(QString identifier); virtual bool load(QString identifier);
virtual bool save(); virtual bool save();
@ -182,6 +192,9 @@ public:
virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* group); virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* group);
virtual void moveEntry(IEntryHandle* entry, IGroupHandle* group); virtual void moveEntry(IEntryHandle* entry, IGroupHandle* group);
virtual void deleteLastEntry(); virtual void deleteLastEntry();
virtual void moveToTrash(IEntryHandle* entry);
virtual QList<IEntryHandle*> trashEntries();
virtual void emptyTrash();
virtual QList<IGroupHandle*> groups(); virtual QList<IGroupHandle*> groups();
@ -232,8 +245,10 @@ private:
QList<EntryHandle> EntryHandles; QList<EntryHandle> EntryHandles;
QList<GroupHandle> GroupHandles; QList<GroupHandle> GroupHandles;
QList<EntryHandle> TrashHandles;
QList<StdEntry> Entries; QList<StdEntry> Entries;
QList<StdGroup> Groups; QList<StdGroup> Groups;
QList<TrashEntry> TrashEntries;
StdGroup RootGroup; StdGroup RootGroup;
QList<QPixmap>CustomIcons; QList<QPixmap>CustomIcons;
QFile* File; QFile* File;

@ -58,6 +58,9 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
str+="<br>"; str+="<br>";
str+="</div><div style='margin-left:10px;'>"; str+="</div><div style='margin-left:10px;'>";
str+="<u>"+tr("James Nicholls")+"</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br></div>"; 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); Edit_Thanks->setHtml(str);
} }

@ -26,6 +26,7 @@
CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){ CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){
setupUi(this); setupUi(this);
resize(layout()->closestAcceptableSize(this,QSize(0,0)));
setMinimumSize(size()); setMinimumSize(size());
setMaximumSize(size()); setMaximumSize(size());
createBanner(&BannerPixmap,getPixmap("dice"),tr("Entropy Collection"),width()); createBanner(&BannerPixmap,getPixmap("dice"),tr("Entropy Collection"),width());

@ -19,7 +19,7 @@
***************************************************************************/ ***************************************************************************/
#include "main.h" #include "main.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qpalette.h> #include <qpalette.h>
#include <qfont.h> #include <qfont.h>
@ -101,7 +101,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
Edit_Password->setText(Password.string()); Edit_Password->setText(Password.string());
Edit_Password_w->setText(Password.string()); Edit_Password_w->setText(Password.string());
Password.lock(); Password.lock();
if(!config.ShowPasswords) if(!config->showPasswords())
ChangeEchoMode(); ChangeEchoMode();
OnPasswordwLostFocus(); OnPasswordwLostFocus();
int bits=(Password.length()*8); int bits=(Password.length()*8);
@ -268,7 +268,7 @@ Edit_Password_w->setEchoMode(QLineEdit::Normal);
void CEditEntryDlg::OnPasswordTextChanged(const QString& txt) void CEditEntryDlg::OnPasswordTextChanged(const QString& txt)
{ {
Edit_Password_w->setText(""); Edit_Password_w->setText(QString());
int bits=(Edit_Password->text().length()*8); int bits=(Edit_Password->text().length()*8);
Label_Bits->setText(QString::number(bits)+" Bit"); Label_Bits->setText(QString::number(bits)+" Bit");
if(bits>128)bits=128; if(bits>128)bits=128;

@ -24,7 +24,7 @@
#include <QPixmap> #include <QPixmap>
#include <QShowEvent> #include <QShowEvent>
#include "main.h" #include "main.h"
#include "StandardDatabase.h" #include "Kdb3Database.h"
class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
{ {

@ -29,7 +29,7 @@
#include <QStringList> #include <QStringList>
#include "main.h" #include "main.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include "PasswordDlg.h" #include "PasswordDlg.h"
#include "lib/FileDialogs.h" #include "lib/FileDialogs.h"
@ -40,27 +40,29 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
setupUi(this); setupUi(this);
createBanner(Banner,getPixmap("key"),tr("Database Key")); createBanner(Banner,getPixmap("key"),tr("Database Key"));
db=DB; db=DB;
QDir media(config.MountDir); QString mountDir=config->mountDir();
QDir media(mountDir);
if(media.exists()){ if(media.exists()){
QStringList Paths; QStringList Paths;
Paths=media.entryList(QStringList()<<"*",QDir::Dirs); Paths=media.entryList(QStringList()<<"*",QDir::Dirs);
Paths.erase(Paths.begin()); // delete "." Paths.erase(Paths.begin()); // delete "."
Paths.erase(Paths.begin()); // delete ".." Paths.erase(Paths.begin()); // delete ".."
for(int i=0;i<Paths.count();i++) 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()); Combo_Dirs->setEditText(QString());
if(settings->value("RememberLastKey",true).toBool() && !ChangeKeyMode){ if(config->rememberLastKey() && !ChangeKeyMode){
QString LastKeyType=settings->value("LastKeyType","").toString(); switch(config->lastKeyType()){
if(LastKeyType=="KeyFile"){ case KEYFILE:
setStateKeyFileOnly(); setStateKeyFileOnly();
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString()))); Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
} break;
else if(LastKeyType=="Composite"){
setStateBoth(); case BOTH:
CheckBox_Both->setChecked(true); setStateBoth();
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString()))); 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. // if(LastKeyType==Password){... is not required because it is already the default state.
} }
@ -86,7 +88,7 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_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(); password=Edit_Password->text();
keyfile=Combo_Dirs->currentText(); 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); 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(KeyType==BOTH){
if(password==""){ if(password.isEmpty()){
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0); QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0);
return;} return;}
if(keyfile==""){ if(keyfile.isEmpty()){
QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0); QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0);
return;} return;}
} }
@ -231,12 +233,12 @@ void CPasswordDialog::OnOK_Set(){
return; return;
} }
keyfile=Combo_Dirs->currentText(); 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); QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
return; return;
} }
if(keyfile!=QString()){ if(!keyfile.isEmpty()){
QFile file(keyfile); QFile file(keyfile);
if(QFileInfo(file).isDir()){ if(QFileInfo(file).isDir()){
if(keyfile.right(1)!="/")keyfile+="/"; if(keyfile.right(1)!="/")keyfile+="/";
@ -268,44 +270,39 @@ void CPasswordDialog::OnOK_Set(){
bool CPasswordDialog::doAuth(){ bool CPasswordDialog::doAuth(){
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db); IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
if(password!=QString() && keyfile==QString()){ if(!password.isEmpty() && keyfile.isEmpty()){
DbAuth->authByPwd(password); DbAuth->authByPwd(password);
} }
if(password==QString() && keyfile!=QString()){ if(password.isEmpty() && !keyfile.isEmpty()){
if(!DbAuth->authByFile(keyfile))return false; if(!DbAuth->authByFile(keyfile))return false;
} }
if(password!=QString() && keyfile!=QString()){ if(!password.isEmpty() && !keyfile.isEmpty()){
if(!DbAuth->authByFile(keyfile))return false; if(!DbAuth->authByFile(keyfile))return false;
} }
if(settings->value("RememberLastKey",true).toBool()){ if(config->rememberLastKey()){
QString KeyLocation=keyfile; QString KeyLocation=keyfile;
if(settings->value("SaveRelativePaths",true).toBool()){ if(config->saveRelativePaths()){
KeyLocation=KeyLocation.left(KeyLocation.lastIndexOf("/")); 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); config->setLastKeyLocation(KeyLocation);
if(KeyType==PASSWORD) config->setLastKeyType(KeyType);
settings->setValue("LastKeyType","Password");
if(KeyType==KEYFILE)
settings->setValue("LastKeyType","KeyFile");
if(KeyType==BOTH)
settings->setValue("LastKeyType","Composite");
} }
return true; return true;
} }
void CPasswordDialog::OnPasswordChanged(const QString &txt){ void CPasswordDialog::OnPasswordChanged(const QString &txt){
Edit_PasswordRep->setText(""); Edit_PasswordRep->setText(QString());
if(CheckBox_Both->isChecked() || txt==QString()) if(CheckBox_Both->isChecked() || txt.isEmpty())
setStateBoth(); setStateBoth();
else else
setStatePasswordOnly(); setStatePasswordOnly();
} }
void CPasswordDialog::OnComboTextChanged(const QString& txt){ void CPasswordDialog::OnComboTextChanged(const QString& txt){
if(CheckBox_Both->isChecked() || txt==QString()) if(CheckBox_Both->isChecked() || txt.isEmpty())
setStateBoth(); setStateBoth();
else else
setStateKeyFileOnly(); setStateKeyFileOnly();
@ -317,17 +314,16 @@ void CPasswordDialog::OnCheckBox_BothChanged(int state){
if(state==Qt::Checked) if(state==Qt::Checked)
setStateBoth(); setStateBoth();
if(state==Qt::Unchecked){ 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()); Combo_Dirs->setEditText(QString());
setStatePasswordOnly(); setStatePasswordOnly();
} }
else{ else{
if(Edit_Password->text()==QString()) if(Edit_Password->text().isEmpty())
setStateKeyFileOnly(); setStateKeyFileOnly();
else else
setStatePasswordOnly(); setStatePasswordOnly();
} }
} }
} }

@ -29,7 +29,7 @@
#include "PasswordGenDlg.h" #include "PasswordGenDlg.h"
#include "CollectEntropyDlg.h" #include "CollectEntropyDlg.h"
#include "crypto/yarrow.h" #include "crypto/yarrow.h"
#include "PwmConfig.h" #include "KpxConfig.h"
bool CGenPwDialog::EntropyCollected=false; bool CGenPwDialog::EntropyCollected=false;
@ -67,32 +67,35 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
AcceptButton=NULL; AcceptButton=NULL;
} }
Radio_1->setChecked(config.PwGenOptions[0]); QBitArray pwGenOptions=config->pwGenOptions();
Radio_2->setChecked(!config.PwGenOptions[0]); Radio_1->setChecked(pwGenOptions.at(0));
checkBox1->setChecked(config.PwGenOptions[1]); Radio_2->setChecked(!pwGenOptions.at(0));
checkBox2->setChecked(config.PwGenOptions[2]); checkBox1->setChecked(pwGenOptions.at(1));
checkBox3->setChecked(config.PwGenOptions[3]); checkBox2->setChecked(pwGenOptions.at(2));
checkBox4->setChecked(config.PwGenOptions[4]); checkBox3->setChecked(pwGenOptions.at(3));
checkBox5->setChecked(config.PwGenOptions[5]); checkBox4->setChecked(pwGenOptions.at(4));
checkBox6->setChecked(config.PwGenOptions[6]); checkBox5->setChecked(pwGenOptions.at(5));
checkBox7->setChecked(config.PwGenOptions[7]); checkBox6->setChecked(pwGenOptions.at(6));
Check_CollectEntropy->setChecked(config.PwGenOptions[8]); checkBox7->setChecked(pwGenOptions.at(7));
Check_CollectOncePerSession->setChecked(config.PwGenOptions[9]); Check_CollectEntropy->setChecked(pwGenOptions.at(8));
OnRadio1StateChanged(config.PwGenOptions[0]); Check_CollectOncePerSession->setChecked(pwGenOptions.at(9));
OnRadio2StateChanged(!config.PwGenOptions[0]); OnRadio1StateChanged(pwGenOptions.at(0));
OnRadio2StateChanged(!pwGenOptions.at(0));
} }
CGenPwDialog::~CGenPwDialog(){ CGenPwDialog::~CGenPwDialog(){
config.PwGenOptions[0]=Radio_1->isChecked(); QBitArray pwGenOptions(10);
config.PwGenOptions[1]=checkBox1->isChecked(); pwGenOptions.setBit(0,Radio_1->isChecked());
config.PwGenOptions[2]=checkBox2->isChecked(); pwGenOptions.setBit(1,checkBox1->isChecked());
config.PwGenOptions[3]=checkBox3->isChecked(); pwGenOptions.setBit(2,checkBox2->isChecked());
config.PwGenOptions[4]=checkBox4->isChecked(); pwGenOptions.setBit(3,checkBox3->isChecked());
config.PwGenOptions[5]=checkBox5->isChecked(); pwGenOptions.setBit(4,checkBox4->isChecked());
config.PwGenOptions[6]=checkBox6->isChecked(); pwGenOptions.setBit(5,checkBox5->isChecked());
config.PwGenOptions[7]=checkBox7->isChecked(); pwGenOptions.setBit(6,checkBox6->isChecked());
config.PwGenOptions[8]=Check_CollectEntropy->isChecked(); pwGenOptions.setBit(7,checkBox7->isChecked());
config.PwGenOptions[9]=Check_CollectOncePerSession->isChecked(); pwGenOptions.setBit(8,Check_CollectEntropy->isChecked());
pwGenOptions.setBit(9,Check_CollectOncePerSession->isChecked());
config->setPwGenOptions(pwGenOptions);
} }
void CGenPwDialog::paintEvent(QPaintEvent *event){ void CGenPwDialog::paintEvent(QPaintEvent *event){
@ -141,7 +144,7 @@ void CGenPwDialog::OnGeneratePw()
"A...Z" 65...90 "A...Z" 65...90
"a...z" 97...122 "a...z" 97...122
"0...9" 48...57 "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 "-" 45
"_" 95 "_" 95
------------------------------------------------------- -------------------------------------------------------

@ -25,7 +25,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QPainter> #include <QPainter>
#include "main.h" #include "main.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include "SearchDlg.h" #include "SearchDlg.h"
@ -37,16 +37,17 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
db=database; db=database;
group=Group; group=Group;
createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width()); createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width());
checkBox_Cs->setChecked(config.SearchOptions[0]); QBitArray searchOptions=config->searchOptions();
checkBox_regExp->setChecked(config.SearchOptions[1]); checkBox_Cs->setChecked(searchOptions.at(0));
checkBox_Title->setChecked(config.SearchOptions[2]); checkBox_regExp->setChecked(searchOptions.at(1));
checkBox_Username->setChecked(config.SearchOptions[3]); checkBox_Title->setChecked(searchOptions.at(2));
checkBox_Password->setChecked(config.SearchOptions[4]); checkBox_Username->setChecked(searchOptions.at(3));
checkBox_Comment->setChecked(config.SearchOptions[5]); checkBox_Password->setChecked(searchOptions.at(4));
checkBox_URL->setChecked(config.SearchOptions[6]); checkBox_Comment->setChecked(searchOptions.at(5));
checkBox_Attachment->setChecked(config.SearchOptions[7]); checkBox_URL->setChecked(searchOptions.at(6));
checkBox_Attachment->setChecked(searchOptions.at(7));
if(group) if(group)
checkBox_Recursive->setChecked(config.SearchOptions[8]); checkBox_Recursive->setChecked(searchOptions.at(8));
else{ else{
checkBox_Recursive->setChecked(false); checkBox_Recursive->setChecked(false);
checkBox_Recursive->setEnabled(false); checkBox_Recursive->setEnabled(false);
@ -55,15 +56,17 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
SearchDialog::~SearchDialog() SearchDialog::~SearchDialog()
{ {
config.SearchOptions[0]=checkBox_Cs->isChecked(); QBitArray searchOptions(9);
config.SearchOptions[1]=checkBox_regExp->isChecked(); searchOptions.setBit(0,checkBox_Cs->isChecked());
config.SearchOptions[2]=checkBox_Title->isChecked(); searchOptions.setBit(1,checkBox_regExp->isChecked());
config.SearchOptions[3]=checkBox_Username->isChecked(); searchOptions.setBit(2,checkBox_Title->isChecked());
config.SearchOptions[4]=checkBox_Password->isChecked(); searchOptions.setBit(3,checkBox_Username->isChecked());
config.SearchOptions[5]=checkBox_Comment->isChecked(); searchOptions.setBit(4,checkBox_Password->isChecked());
config.SearchOptions[6]=checkBox_URL->isChecked(); searchOptions.setBit(5,checkBox_Comment->isChecked());
config.SearchOptions[7]=checkBox_Attachment->isChecked(); searchOptions.setBit(6,checkBox_URL->isChecked());
if(group) config.SearchOptions[8]=checkBox_Recursive->isChecked(); searchOptions.setBit(7,checkBox_Attachment->isChecked());
if(group) searchOptions.setBit(8,checkBox_Recursive->isChecked());
config->setSearchOptions(searchOptions);
} }
void SearchDialog::OnClose() void SearchDialog::OnClose()

@ -19,7 +19,7 @@
***************************************************************************/ ***************************************************************************/
#include "main.h" #include "main.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include <qpixmap.h> #include <qpixmap.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qspinbox.h> #include <qspinbox.h>
@ -58,53 +58,50 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width()); createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
//General //General
CheckBox_OpenLast->setChecked(settings->value("OpenLastFile",true).toBool()); CheckBox_OpenLast->setChecked(config->openLastFile());
CheckBox_RememberLastKey->setChecked(settings->value("RememberLastKey",true).toBool()); CheckBox_RememberLastKey->setChecked(config->rememberLastKey());
checkBox_ShowSysTrayIcon->setChecked(config.ShowSysTrayIcon); checkBox_ShowSysTrayIcon->setChecked(config->showSysTrayIcon());
checkBox_MinimizeToTray->setChecked(config.MinimizeToTray); checkBox_MinimizeToTray->setChecked(config->minimizeToTray());
checkBox_SaveFileDlgHistory->setChecked(config.SaveFileDlgHistory); checkBox_SaveFileDlgHistory->setChecked(config->saveFileDlgHistory());
checkBox_AskBeforeDelete->setChecked(config->askBeforeDelete());
switch(config.GroupTreeRestore){
case 1: switch(config->groupTreeState()){
case KpxConfig::RestoreLast:
Radio_GroupTreeRestore->setChecked(true); Radio_GroupTreeRestore->setChecked(true);
break; break;
case 2: case KpxConfig::ExpandAll:
Radio_GroupTreeExpand->setChecked(true); Radio_GroupTreeExpand->setChecked(true);
break; break;
case 3: default:
Radio_GroupTreeDoNothing->setChecked(true); 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()); QPixmap *pxt=new QPixmap(pixmTextColor->width(),pixmTextColor->height());
pxt->fill(config.BannerTextColor); pxt->fill(config->bannerTextColor());
pixmTextColor->clear(); pixmTextColor->clear();
pixmTextColor->setPixmap(*pxt); pixmTextColor->setPixmap(*pxt);
QPixmap *px1=new QPixmap(pixmColor1->width(),pixmColor1->height()); QPixmap *px1=new QPixmap(pixmColor1->width(),pixmColor1->height());
px1->fill(config.BannerColor1); px1->fill(config->bannerColor1());
pixmColor1->clear(); pixmColor1->clear();
pixmColor1->setPixmap(*px1); pixmColor1->setPixmap(*px1);
QPixmap *px2=new QPixmap(pixmColor2->width(),pixmColor2->height()); QPixmap *px2=new QPixmap(pixmColor2->width(),pixmColor2->height());
px2->fill(config.BannerColor2); px2->fill(config->bannerColor2());
pixmColor2->clear(); pixmColor2->clear();
pixmColor2->setPixmap(*px2); pixmColor2->setPixmap(*px2);
color1=config.BannerColor1; color1=config->bannerColor1();
color2=config.BannerColor2; color2=config->bannerColor2();
textcolor=config.BannerTextColor; textcolor=config->bannerTextColor();
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors); CheckBox_AlternatingRowColors->setChecked(config->alternatingRowColors());
//Security //Security
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut); SpinBox_ClipboardTime->setValue(config->clipboardTimeOut());
CheckBox_ShowPasswords->setChecked(config.ShowPasswords); CheckBox_ShowPasswords->setChecked(config->showPasswords());
CheckBox_ShowPasswords_PasswordDlg->setChecked(config.ShowPasswordsPasswordDlg); CheckBox_ShowPasswords_PasswordDlg->setChecked(config->showPasswordsPasswordDlg());
//Desktop Integration //Desktop Integration
@ -114,18 +111,23 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
Label_IntPlugin_Error->setText(QString("<html><p style='font-weight:600; color:#8b0000;'>%1</p></body></html>") Label_IntPlugin_Error->setText(QString("<html><p style='font-weight:600; color:#8b0000;'>%1</p></body></html>")
.arg(tr("Error: %1")).arg(PluginLoadError)); .arg(tr("Error: %1")).arg(PluginLoadError));
switch(config.IntegrPlugin){ switch(config->integrPlugin()){
case CConfig::NONE: Radio_IntPlugin_None->setChecked(true); break; case KpxConfig::KDE:
case CConfig::GNOME: Radio_IntPlugin_Gnome->setChecked(true); break; Radio_IntPlugin_Kde->setChecked(true);
case CConfig::KDE: Radio_IntPlugin_Kde->setChecked(true); break; break;
case KpxConfig::Gnome:
Radio_IntPlugin_Gnome->setChecked(true);
break;
default:
Radio_IntPlugin_None->setChecked(true);
} }
if(!PluginsModified) if(!PluginsModified)
Label_IntPlugin_Info->hide(); Label_IntPlugin_Info->hide();
//Advanced //Advanced
QString BrowserCmd=settings->value("BrowserCmd","<<default>>").toString(); QString BrowserCmd=config->urlCmd();
if(BrowserCmd=="<<default>>"){ if(BrowserCmd.isEmpty()){
CheckBox_BrowserDefault->setChecked(true); CheckBox_BrowserDefault->setChecked(true);
Edit_BrowserCmd->setDisabled(true); Edit_BrowserCmd->setDisabled(true);
} }
@ -134,8 +136,8 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
CheckBox_BrowserDefault->setChecked(false); CheckBox_BrowserDefault->setChecked(false);
} }
Edit_MountDir->setText(config.MountDir); Edit_MountDir->setText(config->mountDir());
CheckBox_SaveRelativePaths->setChecked(settings->value("SaveRelativePaths",true).toBool()); CheckBox_SaveRelativePaths->setChecked(config->saveRelativePaths());
} }
@ -153,7 +155,7 @@ void CSettingsDlg::paintEvent(QPaintEvent *event){
void CSettingsDlg::OnCheckBoxBrowserDefaultChanged(int state){ void CSettingsDlg::OnCheckBoxBrowserDefaultChanged(int state){
if(state==Qt::Checked){ if(state==Qt::Checked){
Edit_BrowserCmd->setDisabled(true); Edit_BrowserCmd->setDisabled(true);
Edit_BrowserCmd->setText(""); Edit_BrowserCmd->setText(QString());
} }
else{ else{
Edit_BrowserCmd->setDisabled(false); Edit_BrowserCmd->setDisabled(false);
@ -179,44 +181,42 @@ void CSettingsDlg::OnOtherButton(QAbstractButton* button){
void CSettingsDlg::apply(){ void CSettingsDlg::apply(){
//General //General
config.ShowSysTrayIcon=checkBox_ShowSysTrayIcon->isChecked(); config->setShowSysTrayIcon(checkBox_ShowSysTrayIcon->isChecked());
config.MinimizeToTray=checkBox_MinimizeToTray->isChecked(); config->setMinimizeToTray(checkBox_MinimizeToTray->isChecked());
config.SaveFileDlgHistory=checkBox_SaveFileDlgHistory->isChecked(); config->setSaveFileDlgHistory(checkBox_SaveFileDlgHistory->isChecked());
config.EnableBookmarkMenu=checkBox_EnableBookmarkMenu->isChecked(); config->setEnableBookmarkMenu(checkBox_EnableBookmarkMenu->isChecked());
if(Radio_GroupTreeRestore->isChecked())config.GroupTreeRestore=0; if(Radio_GroupTreeRestore->isChecked())config->setGroupTreeState(KpxConfig::RestoreLast);
if(Radio_GroupTreeExpand->isChecked())config.GroupTreeRestore=1; else if(Radio_GroupTreeExpand->isChecked())config->setGroupTreeState(KpxConfig::ExpandAll);
if(Radio_GroupTreeDoNothing->isChecked())config.GroupTreeRestore=2; else config->setGroupTreeState(KpxConfig::DoNothing);
settings->setValue("OpenLastFile",CheckBox_OpenLast->isChecked()); config->setOpenLastFile(CheckBox_OpenLast->isChecked());
settings->setValue("RememberLastKey",CheckBox_RememberLastKey->isChecked()); config->setRememberLastKey(CheckBox_RememberLastKey->isChecked());
if(Radio_GroupTreeExpand->isChecked())settings->setValue("GroupTreeState","ExpandAll"); config->setAskBeforeDelete(checkBox_AskBeforeDelete->isChecked());
if(Radio_GroupTreeDoNothing->isChecked())settings->setValue("GroupTreeState","ExpandNone");
if(Radio_GroupTreeRestore->isChecked())settings->setValue("GroupTreeState","Restore");
//Appearence //Appearence
config.BannerColor1=color1; config->setBannerColor1(color1);
config.BannerColor2=color2; config->setBannerColor2(color2);
config.BannerTextColor=textcolor; config->setBannerTextColor(textcolor);
config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked(); config->setAlternatingRowColors(CheckBox_AlternatingRowColors->isChecked());
//Security //Security
config.ClipboardTimeOut=SpinBox_ClipboardTime->value(); config->setClipboardTimeOut(SpinBox_ClipboardTime->value());
config.ShowPasswords=CheckBox_ShowPasswords->isChecked(); config->setShowPasswords(CheckBox_ShowPasswords->isChecked());
config.ShowPasswordsPasswordDlg=CheckBox_ShowPasswords_PasswordDlg->isChecked(); config->setShowPasswordsPasswordDlg(CheckBox_ShowPasswords_PasswordDlg->isChecked());
//Desktop Integration //Desktop Integration
PluginsModified=Label_IntPlugin_Info->isVisible(); PluginsModified=Label_IntPlugin_Info->isVisible();
if(Radio_IntPlugin_None->isChecked())config.IntegrPlugin=CConfig::NONE; if(Radio_IntPlugin_Kde->isChecked())config->setIntegrPlugin(KpxConfig::KDE);
if(Radio_IntPlugin_Gnome->isChecked())config.IntegrPlugin=CConfig::GNOME; else if(Radio_IntPlugin_Gnome->isChecked())config->setIntegrPlugin(KpxConfig::Gnome);
if(Radio_IntPlugin_Kde->isChecked())config.IntegrPlugin=CConfig::KDE; else config->setIntegrPlugin(KpxConfig::NoIntegr);
//Advanced //Advanced
config.OpenUrlCommand=Edit_BrowserCmd->text(); config->setUrlCmd(Edit_BrowserCmd->text());
config.MountDir=Edit_MountDir->text(); config->setMountDir(Edit_MountDir->text());
if(config.MountDir!="" && config.MountDir.right(1)!="/") if(!config->mountDir().isEmpty() && config->mountDir().right(1)!="/")
config.MountDir+="/"; config->setMountDir(config->mountDir()+"/");
if(CheckBox_BrowserDefault->isChecked())settings->setValue("BrowserCmd","<<default>>"); if(CheckBox_BrowserDefault->isChecked())config->setUrlCmd(QString());
else settings->setValue("BrowserCmd",Edit_BrowserCmd->text()); else config->setUrlCmd(Edit_BrowserCmd->text());
settings->setValue("SaveRelativePaths",CheckBox_SaveRelativePaths->isChecked()); config->setSaveRelativePaths(CheckBox_SaveRelativePaths->isChecked());
} }

@ -21,14 +21,14 @@
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include "main.h" #include "main.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include "SimplePasswordDlg.h" #include "SimplePasswordDlg.h"
SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl) SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl)
: QDialog(parent,fl) : QDialog(parent,fl)
{ {
setupUi(this); 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::Ok),SIGNAL(clicked()),this,SLOT(OnOK()));
connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(OnCancel())); connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(OnCancel()));
connect(Button_HidePassword,SIGNAL(toggled(bool)),this,SLOT(OnHidePasswordToggled(bool))); connect(Button_HidePassword,SIGNAL(toggled(bool)),this,SLOT(OnHidePasswordToggled(bool)));

@ -6,13 +6,13 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>432</width> <width>432</width>
<height>230</height> <height>316</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy>
<hsizetype>5</hsizetype> <hsizetype>4</hsizetype>
<vsizetype>5</vsizetype> <vsizetype>4</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -51,6 +51,14 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="label" > <widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>4</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" > <property name="text" >
<string>Collecting entropy... <string>Collecting entropy...
Please move the mouse and/or press some keys until enought entropy for a reseed of the random number generator is collected.</string> Please move the mouse and/or press some keys until enought entropy for a reseed of the random number generator is collected.</string>
@ -81,7 +89,7 @@ Please move the mouse and/or press some keys until enought entropy for a reseed
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy>
<hsizetype>5</hsizetype> <hsizetype>5</hsizetype>
<vsizetype>1</vsizetype> <vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -89,7 +97,13 @@ Please move the mouse and/or press some keys until enought entropy for a reseed
<property name="minimumSize" > <property name="minimumSize" >
<size> <size>
<width>16</width> <width>16</width>
<height>45</height> <height>46</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>46</height>
</size> </size>
</property> </property>
<property name="currentIndex" > <property name="currentIndex" >

@ -18,12 +18,21 @@
</property> </property>
<widget class="QWidget" name="centralWidget" > <widget class="QWidget" name="centralWidget" >
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QSplitter" name="HSplitter" > <widget class="QSplitter" name="HSplitter" >
<property name="orientation" > <property name="orientation" >
@ -31,9 +40,7 @@
</property> </property>
<widget class="QSplitter" name="VSplitter" > <widget class="QSplitter" name="VSplitter" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>60</verstretch> <verstretch>60</verstretch>
</sizepolicy> </sizepolicy>
@ -46,9 +53,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>30</horstretch> <horstretch>30</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -68,9 +73,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>70</horstretch> <horstretch>70</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -83,14 +86,12 @@
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QTextEdit" name="DetailView" > <widget class="QTextBrowser" name="DetailView" >
<property name="enabled" > <property name="enabled" >
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>10</verstretch> <verstretch>10</verstretch>
</sizepolicy> </sizepolicy>
@ -104,6 +105,9 @@
<property name="readOnly" > <property name="readOnly" >
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="openLinks" >
<bool>false</bool>
</property>
</widget> </widget>
</widget> </widget>
</item> </item>
@ -221,8 +225,10 @@
<string>E&amp;xtras</string> <string>E&amp;xtras</string>
</property> </property>
<addaction name="ExtrasSettingsAction" /> <addaction name="ExtrasSettingsAction" />
<addaction name="ExtrasShowExpiredEntriesAction" />
<addaction name="ExtrasPasswordGenAction" /> <addaction name="ExtrasPasswordGenAction" />
<addaction name="separator" />
<addaction name="ExtrasShowExpiredEntriesAction" />
<addaction name="ExtrasTrashCanAction" />
</widget> </widget>
<addaction name="menuDatei" /> <addaction name="menuDatei" />
<addaction name="menuBearbeiten" /> <addaction name="menuBearbeiten" />
@ -533,6 +539,11 @@
<string>Show Expired Entries</string> <string>Show Expired Entries</string>
</property> </property>
</action> </action>
<action name="ExtrasTrashCanAction" >
<property name="text" >
<string>Recycle Bin...</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

@ -28,12 +28,21 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -69,12 +78,6 @@
<string>General</string> <string>General</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item> <item>
<widget class="QCheckBox" name="checkBox_ShowSysTrayIcon" > <widget class="QCheckBox" name="checkBox_ShowSysTrayIcon" >
<property name="text" > <property name="text" >
@ -91,12 +94,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QCheckBox" name="CheckBox_OpenLast" > <widget class="QCheckBox" name="CheckBox_OpenLast" >
<property name="text" > <property name="text" >
@ -147,12 +159,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QCheckBox" name="checkBox_SaveFileDlgHistory" > <widget class="QCheckBox" name="checkBox_SaveFileDlgHistory" >
<property name="text" > <property name="text" >
@ -179,7 +200,7 @@
<item> <item>
<widget class="QPushButton" name="Button_ClearFileDlgHistory" > <widget class="QPushButton" name="Button_ClearFileDlgHistory" >
<property name="text" > <property name="text" >
<string>Clear</string> <string>Clear History Now</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -199,73 +220,71 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkBox_EnableBookmarkMenu" > <widget class="QCheckBox" name="checkBox_AskBeforeDelete" >
<property name="text" > <property name="text" >
<string>Enable bookmark menu</string> <string>Always ask before deleting entries or groups</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<layout class="QVBoxLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item> <item row="0" column="0" >
<widget class="QLabel" name="label_3" > <widget class="QLabel" name="label_3" >
<property name="text" > <property name="text" >
<string>Group tree at start-up:</string> <string>Group tree at start-up:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="Radio_GroupTreeRestore" > <widget class="QRadioButton" name="Radio_GroupTreeRestore" >
<property name="text" > <property name="text" >
<string>Restore last state</string> <string>Restore last state</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="1" >
<widget class="QRadioButton" name="Radio_GroupTreeExpand" > <widget class="QRadioButton" name="Radio_GroupTreeExpand" >
<property name="text" > <property name="text" >
<string>Expand all items</string> <string>Expand all items</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="1" >
<widget class="QRadioButton" name="Radio_GroupTreeDoNothing" > <widget class="QRadioButton" name="Radio_GroupTreeDoNothing" >
<property name="text" > <property name="text" >
<string>Do not expand any item</string> <string>Do not expand any item</string>
@ -296,8 +315,8 @@
</property> </property>
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>20</width> <width>531</width>
<height>40</height> <height>16</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -309,30 +328,60 @@
<string>Appea&amp;rance</string> <string>Appea&amp;rance</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QGroupBox" name="groupBox1" > <widget class="QGroupBox" name="groupBox1" >
<property name="title" > <property name="title" >
<string>Banner Color</string> <string>Banner Color</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="0" > <item row="1" column="0" >
@ -361,9 +410,7 @@
<item row="1" column="2" > <item row="1" column="2" >
<widget class="QPushButton" name="ButtonTextColor" > <widget class="QPushButton" name="ButtonTextColor" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -391,9 +438,7 @@
<item row="0" column="4" > <item row="0" column="4" >
<widget class="QLabel" name="textLabel3" > <widget class="QLabel" name="textLabel3" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -406,9 +451,7 @@
<item row="0" column="1" > <item row="0" column="1" >
<widget class="QLabel" name="pixmColor1" > <widget class="QLabel" name="pixmColor1" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -433,9 +476,7 @@
<item row="1" column="1" > <item row="1" column="1" >
<widget class="QLabel" name="pixmTextColor" > <widget class="QLabel" name="pixmTextColor" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -463,9 +504,7 @@
<item row="0" column="6" > <item row="0" column="6" >
<widget class="QPushButton" name="ButtonColor2" > <widget class="QPushButton" name="ButtonColor2" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -493,9 +532,7 @@
<item row="0" column="5" > <item row="0" column="5" >
<widget class="QLabel" name="pixmColor2" > <widget class="QLabel" name="pixmColor2" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -523,9 +560,7 @@
<item row="0" column="2" > <item row="0" column="2" >
<widget class="QPushButton" name="ButtonColor1" > <widget class="QPushButton" name="ButtonColor1" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -553,9 +588,7 @@
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QLabel" name="textLabel1_3" > <widget class="QLabel" name="textLabel1_3" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -602,12 +635,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QPushButton" name="Button_CustomizeEntryDetails" > <widget class="QPushButton" name="Button_CustomizeEntryDetails" >
<property name="text" > <property name="text" >
@ -650,26 +692,89 @@
<string>Security</string> <string>Security</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<layout class="QHBoxLayout" > <widget class="QGroupBox" name="groupBox_2" >
<property name="margin" > <property name="sizePolicy" >
<number>0</number> <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="title" >
<string>Show passwords in plain text in:</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>0</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<widget class="QCheckBox" name="CheckBox_ShowPasswords" >
<property name="text" >
<string>Edit Entry Dialog</string>
</property>
<property name="shortcut" >
<string>Alt+O</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CheckBox_ShowPasswords_PasswordDlg" >
<property name="text" >
<string>Key Dialogs</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="textLabel1" > <widget class="QLabel" name="textLabel1" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -682,9 +787,7 @@
<item> <item>
<widget class="QSpinBox" name="SpinBox_ClipboardTime" > <widget class="QSpinBox" name="SpinBox_ClipboardTime" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<hsizetype>5</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -713,43 +816,40 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2" > <spacer>
<property name="sizePolicy" > <property name="orientation" >
<sizepolicy> <enum>Qt::Vertical</enum>
<hsizetype>5</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="title" > <property name="sizeHint" >
<string>Show passwords in plain text in:</string> <size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="Seite" >
<attribute name="title" >
<string>Features</string>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>You can disable several features of KeePassX here according to your needs in order to keep the user interface slim.</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_EnableBookmarkMenu" >
<property name="text" >
<string>Bookmarks</string>
</property> </property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="CheckBox_ShowPasswords" >
<property name="text" >
<string>Edit Entry Dialog</string>
</property>
<property name="shortcut" >
<string>Alt+O</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="CheckBox_ShowPasswords_PasswordDlg" >
<property name="text" >
<string>Key Dialogs</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -760,7 +860,7 @@
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>131</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -772,18 +872,25 @@
<string>Desktop Integration</string> <string>Desktop Integration</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QLabel" name="Label_IntPlugin_Error" > <widget class="QLabel" name="Label_IntPlugin_Error" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Maximum" hsizetype="Preferred" >
<hsizetype>5</hsizetype>
<vsizetype>4</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -799,9 +906,7 @@
<item> <item>
<widget class="QGroupBox" name="groupBox" > <widget class="QGroupBox" name="groupBox" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<hsizetype>5</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -810,12 +915,21 @@
<string>Plug-Ins</string> <string>Plug-Ins</string>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item> <item>
<widget class="QRadioButton" name="Radio_IntPlugin_None" > <widget class="QRadioButton" name="Radio_IntPlugin_None" >
<property name="text" > <property name="text" >
@ -842,12 +956,21 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item> <item>
<widget class="QLabel" name="Label_IntPlugin_Info" > <widget class="QLabel" name="Label_IntPlugin_Info" >
<property name="text" > <property name="text" >
@ -897,18 +1020,125 @@
<string>Advanced</string> <string>Advanced</string>
</attribute> </attribute>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>Auto-Type Fine Tuning</string>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QSpinBox" name="spinBox_PreGap" >
<property name="whatsThis" >
<string>Time between the activation of an auto-type action by the user and the first simulated key stroke.</string>
</property>
<property name="suffix" >
<string>ms</string>
</property>
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Pre-Gap:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Key Stroke Delay:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="spinBox_KeyStrokeDelay" >
<property name="whatsThis" >
<string>Delay between two simulated key strokes. Increase this if Auto-Type is randomly skipping characters.</string>
</property>
<property name="suffix" >
<string>ms</string>
</property>
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="margin" > <property name="leftMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="spacing" > <property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="2" > <item row="1" column="2" >
@ -979,9 +1209,7 @@
<item row="0" column="2" colspan="2" > <item row="0" column="2" colspan="2" >
<widget class="QCheckBox" name="CheckBox_BrowserDefault" > <widget class="QCheckBox" name="CheckBox_BrowserDefault" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -993,80 +1221,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<string>Auto-Type Fine Tuning</string>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QSpinBox" name="spinBox_PreGap" >
<property name="whatsThis" >
<string>Time between the activation of an auto-type action by the user and the first simulated key stroke.</string>
</property>
<property name="suffix" >
<string>ms</string>
</property>
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Pre-Gap:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Key Stroke Delay:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="spinBox_KeyStrokeDelay" >
<property name="whatsThis" >
<string>Delay between two simulated key strokes. Increase this if Auto-Type is randomly skipping characters.</string>
</property>
<property name="suffix" >
<string>ms</string>
</property>
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="CheckBox_SaveRelativePaths" > <widget class="QCheckBox" name="CheckBox_SaveRelativePaths" >
<property name="whatsThis" > <property name="whatsThis" >

@ -29,13 +29,13 @@
#include <QApplication> #include <QApplication>
#include <QPainter> #include <QPainter>
#include <QPair> #include <QPair>
#include <QMessageBox>
#include "main.h" #include "main.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include "EntryView.h" #include "EntryView.h"
#include "dialogs/EditEntryDlg.h" #include "dialogs/EditEntryDlg.h"
#include "lib/AutoType.h" #include "lib/AutoType.h"
// just for the lessThan funtion // just for the lessThan funtion
QList<EntryViewItem*>* pItems; QList<EntryViewItem*>* pItems;
KeepassEntryView* pEntryView; KeepassEntryView* pEntryView;
@ -46,26 +46,9 @@ KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
header()->setStretchLastSection(false); header()->setStretchLastSection(false);
header()->setClickable(true); header()->setClickable(true);
header()->setCascadingSectionResizes(true); header()->setCascadingSectionResizes(true);
ColumnSizes.resize(NUM_COLUMNS); ColumnSizes=config->columnSizes();
QStringList ColumnSizeConfig=settings->value("Ui/ColumnSizes",QStringList()<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1").toStringList(); Columns=config->columns();
for(int i=0;i<NUM_COLUMNS;i++) ColumnOrder=config->columnOrder();
ColumnSizes[i]=(float)ColumnSizeConfig[i].toInt();
QStringList DefaultColumnConfig=QStringList()<<"1"<<"1"<<"1"<<"1"<<"1"<<"0"<<"0"<<"0"<<"0"<<"0"<<"1";
QStringList ColumnConfig=settings->value("Ui/ShowColumns",DefaultColumnConfig).toStringList();
Columns.resize(NUM_COLUMNS);
if(ColumnConfig.size()<NUM_COLUMNS)ColumnConfig=DefaultColumnConfig;
for(int i=0;i<ColumnConfig.size();i++){
Columns[i]=(bool)ColumnConfig[i].toInt();
}
ColumnOrder.resize(NUM_COLUMNS);
QStringList ColumnOrderConfig=settings->value("Ui/ColumnOrder",QStringList()<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100").toStringList();
for(int i=0;i<NUM_COLUMNS;i++){
if(i<ColumnOrderConfig.size()){
ColumnOrder[i]=ColumnOrderConfig[i].toInt();
}
else
ColumnOrder[i]=100;
}
updateColumns(); updateColumns();
@ -76,31 +59,16 @@ KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
connect(header(),SIGNAL(sectionMoved(int,int,int)),this,SLOT(OnColumnMoved(int,int,int))); connect(header(),SIGNAL(sectionMoved(int,int,int)),this,SLOT(OnColumnMoved(int,int,int)));
Clipboard=QApplication::clipboard(); Clipboard=QApplication::clipboard();
ContextMenu=new QMenu(this); ContextMenu=new QMenu(this);
setAlternatingRowColors(config.AlternatingRowColors); setAlternatingRowColors(config->alternatingRowColors());
pItems=&Items; pItems=&Items;
pEntryView=this; pEntryView=this;
} }
KeepassEntryView::~KeepassEntryView(){ KeepassEntryView::~KeepassEntryView(){
QStringList ColumnSizesConfig; config->setColumnSizes(ColumnSizes);
for(int i=0;i<ColumnSizes.size();i++){ config->setColumns(Columns);
ColumnSizesConfig<<QString::number((int)(ColumnSizes[i])); config->setColumnOrder(ColumnOrder);
}
settings->setValue("Ui/ColumnSizes",ColumnSizesConfig);
QStringList ColumnConfig;
for(int i=0;i<Columns.size();i++){
if(Columns[i])
ColumnConfig<<"1";
else
ColumnConfig<<"0";
}
settings->setValue("Ui/ShowColumns",ColumnConfig);
QStringList ColumnOrderConfig;
for(int i=0;i<NUM_COLUMNS;i++){
ColumnOrderConfig << QString::number(ColumnOrder[i]);
}
settings->setValue("Ui/ColumnOrder",ColumnOrderConfig);
} }
void KeepassEntryView::OnGroupChanged(IGroupHandle* group){ void KeepassEntryView::OnGroupChanged(IGroupHandle* group){
@ -164,7 +132,7 @@ void KeepassEntryView::OnHeaderSectionClicked(int index){
void KeepassEntryView::OnSaveAttachment(){ void KeepassEntryView::OnSaveAttachment(){
Q_ASSERT(selectedItems().size()==1); Q_ASSERT(selectedItems().size()==1);
CEditEntryDlg::saveAttachment(((EntryViewItem*)selectedItems()[0])->EntryHandle,this); CEditEntryDlg::saveAttachment(((EntryViewItem*)selectedItems().first())->EntryHandle,this);
} }
void KeepassEntryView::OnCloneEntry(){ void KeepassEntryView::OnCloneEntry(){
@ -180,6 +148,17 @@ void KeepassEntryView::OnCloneEntry(){
void KeepassEntryView::OnDeleteEntry(){ void KeepassEntryView::OnDeleteEntry(){
QList<QTreeWidgetItem*> entries=selectedItems(); QList<QTreeWidgetItem*> entries=selectedItems();
if(config->askBeforeDelete()){
QString text;
if(entries.size()==1)
text=tr("Are you sure you want delete this entry?");
else
text=tr("Are you sure you want delete these %1 entries?").arg(entries.size());
if(QMessageBox::question(this,tr("Delete?"),text,QMessageBox::Yes | QMessageBox::No,QMessageBox::No)==QMessageBox::No)
return;
}
for(int i=0; i<entries.size();i++){ for(int i=0; i<entries.size();i++){
db->deleteEntry(((EntryViewItem*)entries[i])->EntryHandle); db->deleteEntry(((EntryViewItem*)entries[i])->EntryHandle);
Items.removeAt(Items.indexOf((EntryViewItem*)entries[i])); Items.removeAt(Items.indexOf((EntryViewItem*)entries[i]));
@ -193,18 +172,18 @@ void KeepassEntryView::OnDeleteEntry(){
void KeepassEntryView::updateEntry(EntryViewItem* item){ void KeepassEntryView::updateEntry(EntryViewItem* item){
IEntryHandle* entry = item->EntryHandle; IEntryHandle* entry = item->EntryHandle;
int j=0; int j=0;
if(Columns[0]){ if(Columns.at(0)){
item->setText(j++,entry->title()); item->setText(j++,entry->title());
item->setIcon(0,db->icon(entry->image())); item->setIcon(0,db->icon(entry->image()));
} }
if(Columns[1]){ if (Columns.at(1)){
if(config.ListView_HideUsernames) if(config->hideUsernames())
item->setText(j++,"******"); item->setText(j++,"******");
else else
item->setText(j++,entry->username());} item->setText(j++,entry->username());}
if(Columns[2]){item->setText(j++,entry->url());} if (Columns.at(2)){item->setText(j++,entry->url());}
if(Columns[3]){ if (Columns.at(3)){
if(config.ListView_HidePasswords) if(config->hidePasswords())
item->setText(j++,"******"); item->setText(j++,"******");
else{ else{
SecString password=entry->password(); SecString password=entry->password();
@ -212,19 +191,19 @@ void KeepassEntryView::updateEntry(EntryViewItem* item){
item->setText(j++,password.string()); item->setText(j++,password.string());
} }
} }
if(Columns[4]){ if (Columns.at(4)){
item->setText(j++,entry->comment().section('\n',0,0));} item->setText(j++,entry->comment().section('\n',0,0));}
if(Columns[5]){ if (Columns.at(5)){
item->setText(j++,entry->expire().dateToString(Qt::LocalDate));} item->setText(j++,entry->expire().dateToString(Qt::LocalDate));}
if(Columns[6]){ if (Columns.at(6)){
item->setText(j++,entry->creation().dateToString(Qt::LocalDate));} item->setText(j++,entry->creation().dateToString(Qt::LocalDate));}
if(Columns[7]){ if (Columns.at(7)){
item->setText(j++,entry->lastMod().dateToString(Qt::LocalDate));} item->setText(j++,entry->lastMod().dateToString(Qt::LocalDate));}
if(Columns[8]){ if (Columns.at(8)){
item->setText(j++,entry->lastAccess().dateToString(Qt::LocalDate));} item->setText(j++,entry->lastAccess().dateToString(Qt::LocalDate));}
if(Columns[9]){ if (Columns.at(9)){
item->setText(j++,entry->binaryDesc());} item->setText(j++,entry->binaryDesc());}
if(Columns[10] && ViewMode==ShowSearchResults){ if(Columns.at(10) && ViewMode==ShowSearchResults){
item->setText(j,entry->group()->title()); item->setText(j,entry->group()->title());
item->setIcon(j++,db->icon(entry->group()->image()));} item->setIcon(j++,db->icon(entry->group()->image()));}
} }
@ -279,44 +258,53 @@ void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item,int Column){
void KeepassEntryView::OnEditEntry(){ void KeepassEntryView::OnEditEntry(){
Q_ASSERT(selectedItems().size()==1); Q_ASSERT(selectedItems().size()==1);
editEntry((EntryViewItem*)selectedItems()[0]); editEntry((EntryViewItem*)selectedItems().first());
} }
void KeepassEntryView::OnEditOpenUrl(){ void KeepassEntryView::OnEditOpenUrl(){
Q_ASSERT(selectedItems().size()==1); Q_ASSERT(selectedItems().size()==1);
openBrowser(((EntryViewItem*)selectedItems()[0])->text(logicalColIndex(2))); openBrowser(((EntryViewItem*)selectedItems().first())->text(logicalColIndex(2)));
} }
void KeepassEntryView::OnUsernameToClipboard(){ void KeepassEntryView::OnUsernameToClipboard(){
Clipboard->setText(((EntryViewItem*)selectedItems()[0])->EntryHandle->username(), QClipboard::Clipboard); Clipboard->setText(((EntryViewItem*)selectedItems().first())->EntryHandle->username(), QClipboard::Clipboard);
if(Clipboard->supportsSelection()){
Clipboard->setText(((EntryViewItem*)selectedItems().first())->EntryHandle->username(),QClipboard::Selection);
}
ClipboardTimer.setSingleShot(true); ClipboardTimer.setSingleShot(true);
ClipboardTimer.start(config.ClipboardTimeOut*1000); ClipboardTimer.start(config->clipboardTimeOut()*1000);
} }
void KeepassEntryView::OnPasswordToClipboard(){ void KeepassEntryView::OnPasswordToClipboard(){
SecString password; SecString password;
password=((EntryViewItem*)selectedItems()[0])->EntryHandle->password(); password=((EntryViewItem*)selectedItems().first())->EntryHandle->password();
password.unlock(); password.unlock();
Clipboard->setText(password.string(),QClipboard::Clipboard); Clipboard->setText(password.string(),QClipboard::Clipboard);
if(Clipboard->supportsSelection()){
Clipboard->setText(password.string(),QClipboard::Selection);
}
ClipboardTimer.setSingleShot(true); ClipboardTimer.setSingleShot(true);
ClipboardTimer.start(config.ClipboardTimeOut*1000); ClipboardTimer.start(config->clipboardTimeOut()*1000);
} }
void KeepassEntryView::OnClipboardTimeOut(){ void KeepassEntryView::OnClipboardTimeOut(){
Clipboard->clear(QClipboard::Clipboard); Clipboard->clear(QClipboard::Clipboard);
if(Clipboard->supportsSelection()){
Clipboard->clear(QClipboard::Selection);
}
} }
void KeepassEntryView::contextMenuEvent(QContextMenuEvent* e){ void KeepassEntryView::contextMenuEvent(QContextMenuEvent* e){
if(itemAt(e->pos())){ if(itemAt(e->pos())){
EntryViewItem* item=(EntryViewItem*)itemAt(e->pos()); EntryViewItem* item=(EntryViewItem*)itemAt(e->pos());
if(selectedItems().size()==0){ if(!selectedItems().size()){
setItemSelected(item,true); setItemSelected(item,true);
} }
else{ else{
if(!isItemSelected(item)){ if(!isItemSelected(item)){
while(selectedItems().size()){ while(selectedItems().size()){
setItemSelected(selectedItems()[0],false); setItemSelected(selectedItems().first(),false);
} }
setItemSelected(item,true); setItemSelected(item,true);
} }
@ -324,7 +312,7 @@ void KeepassEntryView::contextMenuEvent(QContextMenuEvent* e){
} }
else else
{while(selectedItems().size()){ {while(selectedItems().size()){
setItemSelected(selectedItems()[0],false);} setItemSelected(selectedItems().first(),false);}
} }
e->accept(); e->accept();
ContextMenu->popup(e->globalPos()); ContextMenu->popup(e->globalPos());
@ -339,7 +327,7 @@ void KeepassEntryView::resizeEvent(QResizeEvent* e){
void KeepassEntryView::showSearchResults(){ void KeepassEntryView::showSearchResults(){
if(ViewMode==Normal){ if(ViewMode==Normal){
ViewMode=ShowSearchResults; ViewMode=ShowSearchResults;
if(Columns[10])ColumnOrder[10]--; if(Columns.at(10))ColumnOrder[10]--;
updateColumns(); updateColumns();
} }
clear(); clear();
@ -368,17 +356,17 @@ void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
Items.push_back(item); Items.push_back(item);
Items.back()->EntryHandle=entries[i]; Items.back()->EntryHandle=entries[i];
int j=0; int j=0;
if(Columns[0]){ if (Columns.at(0)){
item->setText(j++,entries[i]->title()); item->setText(j++,entries[i]->title());
item->setIcon(0,db->icon(entries[i]->image()));} item->setIcon(0,db->icon(entries[i]->image()));}
if(Columns[1]){ if (Columns.at(1)){
if(config.ListView_HideUsernames) if(config->hideUsernames())
item->setText(j++,"******"); item->setText(j++,"******");
else else
item->setText(j++,entries[i]->username());} item->setText(j++,entries[i]->username());}
if(Columns[2]){item->setText(j++,entries[i]->url());} if (Columns.at(2)){item->setText(j++,entries[i]->url());}
if(Columns[3]){ if (Columns.at(3)){
if(config.ListView_HidePasswords) if(config->hidePasswords())
item->setText(j++,"******"); item->setText(j++,"******");
else{ else{
SecString password=entries[i]->password(); SecString password=entries[i]->password();
@ -386,19 +374,19 @@ void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
item->setText(j++,password.string()); item->setText(j++,password.string());
} }
} }
if(Columns[4]){ if (Columns.at(4)){
item->setText(j++,entries[i]->comment().section('\n',0,0));} item->setText(j++,entries[i]->comment().section('\n',0,0));}
if(Columns[5]){ if (Columns.at(5)){
item->setText(j++,entries[i]->expire().dateToString(Qt::LocalDate));} item->setText(j++,entries[i]->expire().dateToString(Qt::LocalDate));}
if(Columns[6]){ if (Columns.at(6)){
item->setText(j++,entries[i]->creation().dateToString(Qt::LocalDate));} item->setText(j++,entries[i]->creation().dateToString(Qt::LocalDate));}
if(Columns[7]){ if (Columns.at(7)){
item->setText(j++,entries[i]->lastMod().dateToString(Qt::LocalDate));} item->setText(j++,entries[i]->lastMod().dateToString(Qt::LocalDate));}
if(Columns[8]){ if (Columns.at(8)){
item->setText(j++,entries[i]->lastAccess().dateToString(Qt::LocalDate));} item->setText(j++,entries[i]->lastAccess().dateToString(Qt::LocalDate));}
if(Columns[9]){ if (Columns.at(9)){
item->setText(j++,entries[i]->binaryDesc());} item->setText(j++,entries[i]->binaryDesc());}
if(Columns[10] && ViewMode==ShowSearchResults){ if(Columns.at(10) && ViewMode==ShowSearchResults){
item->setText(j,entries[i]->group()->title()); item->setText(j,entries[i]->group()->title());
item->setIcon(j++,db->icon(entries[i]->group()->image()));} item->setIcon(j++,db->icon(entries[i]->group()->image()));}
} }
@ -418,43 +406,44 @@ void KeepassEntryView::setEntry(IEntryHandle* entry){
void KeepassEntryView::updateColumns(){ void KeepassEntryView::updateColumns(){
setColumnCount(0); setColumnCount(0);
QStringList cols; QStringList cols;
if(Columns[0]){ if (Columns.at(0)){
cols << tr("Title");} cols << tr("Title");}
if(Columns[1]){ if (Columns.at(1)){
cols << tr("Username");} cols << tr("Username");}
if(Columns[2]){ if (Columns.at(2)){
cols << tr("URL");} cols << tr("URL");}
if(Columns[3]){ if (Columns.at(3)){
cols << tr("Password");} cols << tr("Password");}
if(Columns[4]){ if (Columns.at(4)){
cols << tr("Comments");} cols << tr("Comments");}
if(Columns[5]){ if (Columns.at(5)){
cols << tr("Expires");} cols << tr("Expires");}
if(Columns[6]){ if (Columns.at(6)){
cols << tr("Creation");} cols << tr("Creation");}
if(Columns[7]){ if (Columns.at(7)){
cols << tr("Last Change");} cols << tr("Last Change");}
if(Columns[8]){ if (Columns.at(8)){
cols << tr("Last Access");} cols << tr("Last Access");}
if(Columns[9]){ if (Columns.at(9)){
cols << tr("Attachment");} cols << tr("Attachment");}
if(Columns[10] && ViewMode==ShowSearchResults){ if(Columns.at(10) && ViewMode==ShowSearchResults){
cols << tr("Group");} cols << tr("Group");}
setHeaderLabels(cols); setHeaderLabels(cols);
for(int i=0;i<NUM_COLUMNS;i++){ for(int i=0;i<NUM_COLUMNS;i++){
if(!Columns[i])ColumnOrder[i]=100; if(!Columns.at(i))
ColumnOrder[i]=100;
} }
QMap<int,int> Order; QMap<int,int> Order;
for(int i=NUM_COLUMNS-1;i>=0;i--) for(int i=NUM_COLUMNS-1;i>=0;i--)
Order.insertMulti(ColumnOrder[i],i); Order.insertMulti(ColumnOrder.at(i),i);
QMapIterator<int, int> i(Order); QMapIterator<int, int> i(Order);
while (i.hasNext()) { while (i.hasNext()) {
i.next(); i.next();
int index=i.value(); int index=i.value();
if(!Columns[index])continue; if(!Columns.at(index))continue;
header()->moveSection(header()->visualIndex(logicalColIndex(index)),header()->count()-1); header()->moveSection(header()->visualIndex(logicalColIndex(index)),header()->count()-1);
} }
@ -476,8 +465,8 @@ int KeepassEntryView::logicalColIndex(int LstIndex){
qDebug("%i",LstIndex); qDebug("%i",LstIndex);
int c=-1; int c=-1;
for(int i=0;i<NUM_COLUMNS;i++){ for(int i=0;i<NUM_COLUMNS;i++){
if(Columns[i])c++; if(Columns.at(i))c++;
if(i==10 && Columns[10] && ViewMode!=ShowSearchResults)c--; if(i==10 && Columns.at(10) && ViewMode!=ShowSearchResults)c--;
if(i==LstIndex)return c; if(i==LstIndex)return c;
} }
Q_ASSERT(false); Q_ASSERT(false);
@ -490,18 +479,20 @@ void KeepassEntryView::resizeColumns(){
for(int i=0;i<NUM_COLUMNS;i++){ for(int i=0;i<NUM_COLUMNS;i++){
// if(i==10) continue; //skip "Group" column // if(i==10) continue; //skip "Group" column
if(!Columns[i])ColumnSizes[i]=0; if(!Columns.at(i))
if(Columns[i] && ColumnSizes[i]==0)ColumnSizes[i]=0.1f*(float)w; ColumnSizes[i]=0;
if(Columns.at(i) && !ColumnSizes.at(i))
ColumnSizes[i]=w/10;
} }
for(int i=0;i<header()->count();i++){ for(int i=0;i<header()->count();i++){
sum+=ColumnSizes[columnListIndex(i)]; sum+=ColumnSizes.at(columnListIndex(i));
} }
float stretch=((float)w)/((float)sum); float stretch=((float)w)/((float)sum);
sum=0; sum=0;
for(int i=0;i<header()->count();i++){ for(int i=0;i<header()->count();i++){
int lstIndex=columnListIndex(header()->logicalIndex(i)); int lstIndex=columnListIndex(header()->logicalIndex(i));
int NewSize=qRound(stretch*(float)ColumnSizes[lstIndex]); int NewSize=qRound(stretch*(float)ColumnSizes.at(lstIndex));
sum+=NewSize; sum+=NewSize;
if(i==header()->count()-1){ if(i==header()->count()-1){
NewSize+=(w-sum); // add rounding difference to the last column NewSize+=(w-sum); // add rounding difference to the last column
@ -515,8 +506,8 @@ void KeepassEntryView::resizeColumns(){
int KeepassEntryView::columnListIndex(int LogicalIndex){ int KeepassEntryView::columnListIndex(int LogicalIndex){
int c=-1; int i=0; int c=-1; int i=0;
for(i;i<NUM_COLUMNS;i++){ for(i;i<NUM_COLUMNS;i++){
if(Columns[i])c++; if(Columns.at(i))c++;
if(i==10 && Columns[10] && ViewMode!=ShowSearchResults)c--; if(i==10 && Columns.at(10) && ViewMode!=ShowSearchResults)c--;
if(c==LogicalIndex)break; if(c==LogicalIndex)break;
} }
return i; return i;
@ -534,7 +525,7 @@ void KeepassEntryView::OnColumnResized(int lindex,int Old, int New){
void KeepassEntryView::mousePressEvent(QMouseEvent *event){ void KeepassEntryView::mousePressEvent(QMouseEvent *event){
//save event position - maybe this is the start of a drag //save event position - maybe this is the start of a drag
if (event->button() == Qt::LeftButton) if (event->button() == Qt::LeftButton)
DragStartPos = event->pos(); DragStartPos = event->pos();
QTreeWidget::mousePressEvent(event); QTreeWidget::mousePressEvent(event);
} }
@ -548,10 +539,10 @@ void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
EntryViewItem* DragStartItem=(EntryViewItem*)itemAt(DragStartPos); EntryViewItem* DragStartItem=(EntryViewItem*)itemAt(DragStartPos);
if(!DragStartItem){ if(!DragStartItem){
while(selectedItems().size()){ while(selectedItems().size()){
setItemSelected(selectedItems()[0],false);} setItemSelected(selectedItems().first(),false);}
return; return;
} }
if(selectedItems().size()==0){ if(selectedItems().isEmpty()){
setItemSelected(DragStartItem,true);} setItemSelected(DragStartItem,true);}
else{ else{
bool AlreadySelected=false; bool AlreadySelected=false;
@ -560,7 +551,7 @@ void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
} }
if(!AlreadySelected){ if(!AlreadySelected){
while(selectedItems().size()){ while(selectedItems().size()){
setItemSelected(selectedItems()[0],false); setItemSelected(selectedItems().first(),false);
} }
setItemSelected(DragStartItem,true); setItemSelected(DragStartItem,true);
} }
@ -570,7 +561,7 @@ void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData; QMimeData *mimeData = new QMimeData;
void* pDragItems=&DragItems; void* pDragItems=&DragItems;
mimeData->setData("text/plain;charset=UTF-8",DragItems[0]->text(0).toUtf8()); mimeData->setData("text/plain;charset=UTF-8",DragItems.first()->text(0).toUtf8());
mimeData->setData("application/x-keepassx-entry",QByteArray((char*)&pDragItems,sizeof(void*))); mimeData->setData("application/x-keepassx-entry",QByteArray((char*)&pDragItems,sizeof(void*)));
drag->setMimeData(mimeData); drag->setMimeData(mimeData);
drag->setPixmap(DragPixmap); drag->setPixmap(DragPixmap);
@ -593,7 +584,7 @@ void KeepassEntryView::removeDragItems(){
void KeepassEntryView::OnAutoType(){ void KeepassEntryView::OnAutoType(){
Q_ASSERT(selectedItems().size()==1); Q_ASSERT(selectedItems().size()==1);
QString error; QString error;
AutoType::perform(((EntryViewItem*)selectedItems()[0])->EntryHandle,error); AutoType::perform(((EntryViewItem*)selectedItems().first())->EntryHandle,error);
} }
void KeepassEntryView::paintEvent(QPaintEvent * event){ void KeepassEntryView::paintEvent(QPaintEvent * event){
@ -654,7 +645,7 @@ void KeepassEntryView::setCurrentEntry(IEntryHandle* entry){
bool found=false; bool found=false;
int i=0; int i=0;
for(i;i<Items.size();i++) for(i;i<Items.size();i++)
if(Items[i]->EntryHandle==entry){found=true; break;} if(Items.at(i)->EntryHandle==entry){found=true; break;}
if(!found)return; if(!found)return;
setCurrentItem(Items[i]); setCurrentItem(Items.at(i));
} }

@ -27,8 +27,9 @@
#include <QHeaderView> #include <QHeaderView>
#include <QTimer> #include <QTimer>
#include <QClipboard> #include <QClipboard>
#include <QVarLengthArray> #include <QBitArray>
#include "../StandardDatabase.h" #include <QList>
#include "../Kdb3Database.h"
#define NUM_COLUMNS 11 #define NUM_COLUMNS 11
@ -49,7 +50,7 @@ class KeepassEntryView:public QTreeWidget{
QList<EntryViewItem*>Items; QList<EntryViewItem*>Items;
QList<IEntryHandle*> SearchResults; QList<IEntryHandle*> SearchResults;
QMenu *ContextMenu; QMenu *ContextMenu;
QVarLengthArray<bool>Columns; QBitArray Columns;
void setCurrentEntry(IEntryHandle* entry); void setCurrentEntry(IEntryHandle* entry);
private: private:
void setEntry(IEntryHandle* entry); void setEntry(IEntryHandle* entry);
@ -68,8 +69,8 @@ class KeepassEntryView:public QTreeWidget{
IGroupHandle* CurrentGroup; IGroupHandle* CurrentGroup;
enum EntryViewMode {Normal, ShowSearchResults}; enum EntryViewMode {Normal, ShowSearchResults};
EntryViewMode ViewMode; EntryViewMode ViewMode;
QVarLengthArray<float>ColumnSizes; QList<int> ColumnSizes;
QVarLengthArray<int>ColumnOrder; QList<int> ColumnOrder;
float GroupColumnSize; float GroupColumnSize;
virtual void contextMenuEvent(QContextMenuEvent *event); virtual void contextMenuEvent(QContextMenuEvent *event);

@ -19,8 +19,8 @@
***************************************************************************/ ***************************************************************************/
#include <QDir> #include <QDir>
#include <QSettings>
#include "main.h" #include "main.h"
#include "KpxConfig.h"
#include "FileDialogs.h" #include "FileDialogs.h"
@ -32,52 +32,62 @@ void KpxFileDialogs::setPlugin(IFileDialog* plugin){
iFileDialog=plugin; iFileDialog=plugin;
} }
QString KpxFileDialogs::openExistingFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,const QString& Dir) QString KpxFileDialogs::openExistingFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,QString Dir,int SelectedFilter)
{ {
QString dir; if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
if(iFileDialog==NULL)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs); if(Dir==QString())
if(Dir==QString()) dir=fileDlgHistory.getDir(Name); Dir=fileDlgHistory.getDir(Name);
else dir=Dir; if(SelectedFilter==-1)
QString result = iFileDialog->openExistingFileDialog(Parent,Title,dir,Filters); SelectedFilter=fileDlgHistory.getFilter(Name);
if(result!=QString()){ QString result = iFileDialog->openExistingFileDialog(Parent,Title,Dir,Filters,SelectedFilter);
if(!result.isEmpty()){
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter()); fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
} }
return result; return result;
} }
QStringList KpxFileDialogs::openExistingFiles(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,const QString& Dir) QStringList KpxFileDialogs::openExistingFiles(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,QString Dir,int SelectedFilter)
{ {
if(iFileDialog==NULL)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs); if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
//Load History here! if(Dir==QString())
QStringList results=iFileDialog->openExistingFilesDialog(Parent,Title,QString(),Filters); Dir=fileDlgHistory.getDir(Name);
if(results.size()){ if(SelectedFilter==-1)
SelectedFilter=fileDlgHistory.getFilter(Name);
QStringList results=iFileDialog->openExistingFilesDialog(Parent,Title,QString(),Filters,SelectedFilter);
if(!results.isEmpty()){
fileDlgHistory.set(Name,results[0].left(results[0].lastIndexOf("/")+1),iFileDialog->getLastFilter()); fileDlgHistory.set(Name,results[0].left(results[0].lastIndexOf("/")+1),iFileDialog->getLastFilter());
} }
return results; return results;
} }
QString KpxFileDialogs::saveFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,bool OverWriteWarn, const QString& Dir) QString KpxFileDialogs::saveFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,bool OverWriteWarn,QString Dir,int SelectedFilter)
{ {
if(iFileDialog==NULL)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs); if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
//Load History here! if(Dir==QString())
QString result = iFileDialog->saveFileDialog(Parent,Title,QString(),Filters,OverWriteWarn); Dir=fileDlgHistory.getDir(Name);
if(result!=QString()){ if(SelectedFilter==-1)
SelectedFilter=fileDlgHistory.getFilter(Name);
QString result = iFileDialog->saveFileDialog(Parent,Title,QString(),Filters,SelectedFilter,OverWriteWarn);
if(!result.isEmpty()){
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter()); fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
} }
return result; return result;
} }
QString QtStandardFileDialogs::openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters){ QString QtStandardFileDialogs::openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter){
if(SelectedFilter >= Filters.size())
SelectedFilter=0;
QFileDialog FileDlg(parent,title,dir); QFileDialog FileDlg(parent,title,dir);
FileDlg.setFilters(Filters); FileDlg.setFilters(Filters);
FileDlg.setFileMode(QFileDialog::ExistingFile); FileDlg.setFileMode(QFileDialog::ExistingFile);
FileDlg.selectFilter(Filters[SelectedFilter]);
if(!FileDlg.exec())return QString(); if(!FileDlg.exec())return QString();
if(!FileDlg.selectedFiles().size())return QString(); if(!FileDlg.selectedFiles().size())return QString();
LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter()); LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter());
return FileDlg.selectedFiles()[0]; return FileDlg.selectedFiles()[0];
} }
QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters){ QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter){
QFileDialog FileDlg(parent,title,dir); QFileDialog FileDlg(parent,title,dir);
FileDlg.setFilters(Filters); FileDlg.setFilters(Filters);
FileDlg.setFileMode(QFileDialog::ExistingFiles); FileDlg.setFileMode(QFileDialog::ExistingFiles);
@ -86,7 +96,7 @@ QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QStri
return FileDlg.selectedFiles(); return FileDlg.selectedFiles();
} }
QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,bool ShowOverwriteWarning){ QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter, bool ShowOverwriteWarning){
QFileDialog FileDlg(parent,title,dir); QFileDialog FileDlg(parent,title,dir);
FileDlg.setFilters(Filters); FileDlg.setFilters(Filters);
FileDlg.setFileMode(QFileDialog::AnyFile); FileDlg.setFileMode(QFileDialog::AnyFile);
@ -94,7 +104,7 @@ QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QStr
FileDlg.setConfirmOverwrite(ShowOverwriteWarning); FileDlg.setConfirmOverwrite(ShowOverwriteWarning);
if(!FileDlg.exec())return QString(); if(!FileDlg.exec())return QString();
LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter()); LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter());
return FileDlg.selectedFiles()[0]; return FileDlg.selectedFiles().first();
} }
int QtStandardFileDialogs::getLastFilter(){ int QtStandardFileDialogs::getLastFilter(){
@ -124,34 +134,37 @@ void FileDlgHistory::set(const QString& name,const QString& dir, int filter){
History[name].Filter=filter; History[name].Filter=filter;
} }
void FileDlgHistory::save(){ void FileDlgHistory::save(){
if(settings->value("General/SaveFileDlgHistory",QVariant(true)).toBool()){ if(config->saveFileDlgHistory()){
settings->beginGroup("FileDlgHistory"); //settings->beginGroup("FileDlgHistory");
for(int i=0;i<History.size();i++){ for(unsigned i=0;i<static_cast<unsigned>(History.size());i++){
QStringList entry; QStringList entry;
entry << History.keys()[i] entry << History.keys().at(i)
<< History.values()[i].Dir << History.values().at(i).Dir
<< QString::number(History.values()[i].Filter); << QString::number(History.values().at(i).Filter);
settings->setValue(QString("ENTRY%1").arg(i),QVariant(entry)); //settings->setValue(QString("ENTRY%1").arg(i),QVariant(entry));
config->setFileDlgHistory(i,entry);
} }
settings->endGroup(); //settings->endGroup();
} }
} }
void FileDlgHistory::load(){ void FileDlgHistory::load(){
if(settings->value("General/SaveFileDlgHistory",QVariant(true)).toBool()){ if(config->saveFileDlgHistory()){
settings->beginGroup("FileDlgHistory"); //settings->beginGroup("FileDlgHistory");
QStringList keys=settings->childKeys(); //QStringList keys=settings->childKeys();
for(int i=0;i<keys.size();i++){ unsigned count=config->fileDlgHistorySize();
for(unsigned i=0;i</*keys.size()*/count;i++){
Entry entry; Entry entry;
QStringList value=settings->value(QString("ENTRY%1").arg(i)).toStringList(); QStringList value=config->fileDlgHistory(i);//settings->value(QString("ENTRY%1").arg(i)).toStringList();
entry.Dir=value[1]; entry.Dir=value[1];
entry.Filter=value[2].toInt(); entry.Filter=value[2].toInt();
History[value[0]]=entry; History[value[0]]=entry;
} }
settings->endGroup(); //settings->endGroup();
} }
else{ else{
settings->remove("FileDlgHistory"); config->clearFileDlgHistory();
//settings->remove("FileDlgHistory");
} }
} }

@ -55,17 +55,19 @@ class KpxFileDialogs{
static QString openExistingFile(QWidget* parent, const QString& Name, static QString openExistingFile(QWidget* parent, const QString& Name,
const QString& Title, const QString& Title,
const QStringList& Filters, const QStringList& Filters,
const QString& Dir=QString()); QString Dir=QString(),
int SelectedFilter=-1);
static QStringList openExistingFiles(QWidget* parent, const QString& Name, static QStringList openExistingFiles(QWidget* parent, const QString& Name,
const QString& Title, const QString& Title,
const QStringList& Filters, const QStringList& Filters,
const QString& Dir=QString()); const QString Dir=QString(),
int SelectedFilter=-1);
static QString saveFile(QWidget* parent, const QString& Name, static QString saveFile(QWidget* parent, const QString& Name,
const QString& Title, const QString& Title,
const QStringList& Filters, const QStringList& Filters,
bool ShowOverwriteWarning=true, bool ShowOverwriteWarning=true,
const QString& Dir=QString() QString Dir=QString(),
); int SelectedFilter=-1);
private: private:
static IFileDialog* iFileDialog; static IFileDialog* iFileDialog;
@ -77,9 +79,9 @@ class KpxFileDialogs{
class QtStandardFileDialogs:public QObject,public IFileDialog{ class QtStandardFileDialogs:public QObject,public IFileDialog{
Q_OBJECT Q_OBJECT
public: public:
QString openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters); QString openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters); QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
QString saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,bool ShowOverwriteWarning); QString saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter,bool ShowOverwriteWarning);
int getLastFilter(); int getLastFilter();
private: private:
int LastFilter; int LastFilter;

@ -33,6 +33,8 @@
#include <QPen> #include <QPen>
#include <QBrush> #include <QBrush>
#include <QMenu> #include <QMenu>
#include <QMessageBox>
#include "KpxConfig.h"
#include "main.h" #include "main.h"
#include "EntryView.h" #include "EntryView.h"
#include "GroupView.h" #include "GroupView.h"
@ -99,6 +101,12 @@ void KeepassGroupView::addChilds(GroupViewItem* item){
} }
void KeepassGroupView::OnDeleteGroup(){ void KeepassGroupView::OnDeleteGroup(){
if(config->askBeforeDelete()){
if(QMessageBox::question(this,tr("Delete?"),
tr("Are you sure you want to delete this group, all it's child groups and all their entries?"),
QMessageBox::Yes | QMessageBox::No,QMessageBox::No) == QMessageBox::No)
return;
}
GroupViewItem* item=(GroupViewItem*)currentItem(); GroupViewItem* item=(GroupViewItem*)currentItem();
if(item){ if(item){
db->deleteGroup(item->GroupHandle); db->deleteGroup(item->GroupHandle);
@ -204,6 +212,7 @@ void KeepassGroupView::dragEnterEvent ( QDragEnterEvent * event ){
void KeepassGroupView::dragLeaveEvent ( QDragLeaveEvent * event ){ void KeepassGroupView::dragLeaveEvent ( QDragLeaveEvent * event ){
if(LastHoverItem){ if(LastHoverItem){
LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base)); LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base));
LastHoverItem->setForeground(0,QBrush(QApplication::palette().color(QPalette::Text)));
} }
if(InsLinePos!=-1){ if(InsLinePos!=-1){
int RemoveLine=InsLinePos; int RemoveLine=InsLinePos;
@ -345,6 +354,15 @@ void KeepassGroupView::entryDragMoveEvent( QDragMoveEvent * event ){
event->ignore(); event->ignore();
return; return;
} }
if(Item==SearchResultItem){
if(LastHoverItem){
LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base));
LastHoverItem->setForeground(0,QBrush(QApplication::palette().color(QPalette::Text)));
LastHoverItem=NULL;
}
event->ignore();
return;
}
if(LastHoverItem != Item){ if(LastHoverItem != Item){
if(LastHoverItem){ if(LastHoverItem){
LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base)); LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base));
@ -354,7 +372,6 @@ void KeepassGroupView::entryDragMoveEvent( QDragMoveEvent * event ){
Item->setForeground(0,QBrush(QApplication::palette().color(QPalette::HighlightedText))); Item->setForeground(0,QBrush(QApplication::palette().color(QPalette::HighlightedText)));
LastHoverItem=Item; LastHoverItem=Item;
} }
event->accept(); event->accept();
return; return;

@ -23,7 +23,7 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QLine> #include <QLine>
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include "../StandardDatabase.h" #include "../Kdb3Database.h"
class GroupViewItem; class GroupViewItem;

@ -21,7 +21,6 @@
#include <math.h> #include <math.h>
#include <QPainter> #include <QPainter>
#include <QRectF> #include <QRectF>
#include "PwmConfig.h"
#include "main.h" #include "main.h"
#include "WaitAnimationWidget.h" #include "WaitAnimationWidget.h"

@ -41,8 +41,8 @@
#include "main.h" #include "main.h"
#include "lib/FileDialogs.h" #include "lib/FileDialogs.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include "StandardDatabase.h" #include "Kdb3Database.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "crypto/yarrow.h" #include "crypto/yarrow.h"
using namespace std; using namespace std;
@ -61,8 +61,7 @@ using namespace std;
QHash<QString,QPixmap*>PixmapCache; QHash<QString,QPixmap*>PixmapCache;
QHash<QString,QIcon*>IconCache; QHash<QString,QIcon*>IconCache;
CConfig config; KpxConfig *config;
QSettings* settings;
QString AppDir; QString AppDir;
QString PluginLoadError; QString PluginLoadError;
bool TrActive; bool TrActive;
@ -74,38 +73,58 @@ inline void loadImages();
inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang); inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang);
bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& LocaleCode,const QStringList& SearchPaths); bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& LocaleCode,const QStringList& SearchPaths);
void test_getAllWindowTitles(){
#ifdef Q_WS_X11
Display* pDisplay = XOpenDisplay( NULL );
Window r,p;
Window* c;
unsigned int num_ch=0;
XQueryTree(pDisplay,DefaultRootWindow(pDisplay),&r,&p,&c,&num_ch);
qDebug("%u",num_ch);
for(int i=0;i<num_ch;i++){
int num_prop=0;
Atom* atom=XListProperties(pDisplay,c[i],&num_prop);
for(int p=0;p<num_prop;p++){
qDebug("%i %i: %s",i,p,XGetAtomName(pDisplay,atom[p]));
}
XFree(atom);
}
#endif
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
//test_getAllWindowTitles();
//exit(0);
QString ArgFile,ArgCfg,ArgLang,IniFilename; QString ArgFile,ArgCfg,ArgLang,IniFilename;
QApplication* app=NULL; QApplication* app=NULL;
AppDir=QString(argv[0]); AppDir=QString(argv[0]);
AppDir.truncate(AppDir.lastIndexOf("/")); AppDir.truncate(AppDir.lastIndexOf("/"));
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg,ArgLang);
//Load Config //Load Config
if(ArgCfg==QString()){ if(ArgCfg.isEmpty()){
if(!QDir(QDir::homePath()+"/.keepass").exists()){ if(!QDir(QDir::homePath()+"/.keepassx").exists()){
QDir conf(QDir::homePath()); QDir conf(QDir::homePath());
if(!conf.mkdir(".keepass")){ if(!conf.mkdir(".keepassx")){
cout << "Warning: Could not create directory '~/.keepass'." << endl;} cout << "Warning: Could not create directory '~/.keepassx'." << endl;}
} }
IniFilename=QDir::homePath()+"/.keepass/config"; IniFilename=QDir::homePath()+"/.keepassx/config";
config.loadFromIni(IniFilename);
} }
else{ else
IniFilename=ArgCfg; IniFilename=ArgCfg;
config.loadFromIni(IniFilename);}
settings = new QSettings(QDir::homePath()+"/.keepassx/config",QSettings::IniFormat); config = new KpxConfig(IniFilename);
fileDlgHistory.load(); fileDlgHistory.load();
//Plugins //Plugins
if(config.IntegrPlugin!=CConfig::NONE){ if(config->integrPlugin()!=KpxConfig::NoIntegr){
QString LibName="libkeepassx-"; QString LibName="libkeepassx-";
if(config.IntegrPlugin==CConfig::KDE) if(config->integrPlugin()==KpxConfig::KDE)
LibName+="kde.so"; LibName+="kde.so";
else if(config.IntegrPlugin==CConfig::GNOME) else if(config->integrPlugin()==KpxConfig::Gnome)
LibName+="gnome.so"; LibName+="gnome.so";
QString filename=findPlugin(LibName); QString filename=findPlugin(LibName);
if(filename!=QString()){ if(filename!=QString()){
@ -118,12 +137,12 @@ int main(int argc, char **argv)
else{ else{
IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugin.instance()); IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugin.instance());
KpxFileDialogs::setPlugin(fdlg); KpxFileDialogs::setPlugin(fdlg);
if(config.IntegrPlugin==CConfig::KDE){ if(config->integrPlugin()==KpxConfig::KDE){
IKdeInit* kdeinit=qobject_cast<IKdeInit*>(plugin.instance()); IKdeInit* kdeinit=qobject_cast<IKdeInit*>(plugin.instance());
app=kdeinit->getMainAppObject(argc,argv); app=kdeinit->getMainAppObject(argc,argv);
if(!app)PluginLoadError=QObject::tr("Initialization failed."); if(!app)PluginLoadError=QObject::tr("Initialization failed.");
} }
if(config.IntegrPlugin==CConfig::GNOME){ if(config->integrPlugin()==KpxConfig::Gnome){
IGnomeInit* ginit=qobject_cast<IGnomeInit*>(plugin.instance()); IGnomeInit* ginit=qobject_cast<IGnomeInit*>(plugin.instance());
if(!ginit->init(argc,argv)){ if(!ginit->init(argc,argv)){
KpxFileDialogs::setPlugin(NULL); KpxFileDialogs::setPlugin(NULL);
@ -139,7 +158,6 @@ int main(int argc, char **argv)
} }
} }
if(!app) QApplication* app=new QApplication(argc,argv); if(!app) QApplication* app=new QApplication(argc,argv);
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg,ArgLang);
//Internationalization //Internationalization
@ -200,10 +218,6 @@ int main(int argc, char **argv)
r=app->exec(); r=app->exec();
} }
delete mainWin; delete mainWin;
if(!config.saveToIni(IniFilename))
QMessageBox::warning(NULL,QObject::tr("Warning"),
QObject::tr("Could not save configuration file.\nMake sure you have write access to '~/.keepass'."),
QObject::tr("OK"),"","",0.0);
if(templ.open(QIODevice::WriteOnly)){ if(templ.open(QIODevice::WriteOnly)){
templ.write(DetailViewTemplate.toUtf8()); templ.write(DetailViewTemplate.toUtf8());
@ -216,7 +230,7 @@ int main(int argc, char **argv)
fileDlgHistory.save(); fileDlgHistory.save();
delete app; delete app;
delete settings; delete config;
return r; return r;
} }
@ -243,14 +257,14 @@ void createBanner(QLabel *Banner,const QPixmap* symbol,QString text){
QPixmap Pixmap; QPixmap Pixmap;
createBanner(&Pixmap,symbol,text createBanner(&Pixmap,symbol,text
,Banner->width() ,Banner->width()
,config.BannerColor1 ,config->bannerColor1()
,config.BannerColor2 ,config->bannerColor2()
,config.BannerTextColor); ,config->bannerTextColor());
Banner->setPixmap(Pixmap); Banner->setPixmap(Pixmap);
} }
void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width){ void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width){
createBanner(Pixmap,IconAlpha,Text,Width,config.BannerColor1,config.BannerColor2,config.BannerTextColor); createBanner(Pixmap,IconAlpha,Text,Width,config->bannerColor1(),config->bannerColor2(),config->bannerTextColor());
} }
void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width, QColor Color1, QColor Color2, QColor TextColor){ void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width, QColor Color1, QColor Color2, QColor TextColor){
@ -299,11 +313,11 @@ void openBrowser(QString UrlString){
QUrl url(UrlString); QUrl url(UrlString);
if(url.scheme().isEmpty()) if(url.scheme().isEmpty())
url=QUrl("http://"+UrlString); url=QUrl("http://"+UrlString);
if(settings->value("BrowserCmd","<<default>>").toString() == "<<default>>"){ if(config->urlCmd().isEmpty()){
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);
} }
else{ else{
QStringList args=settings->value("BrowserCmd","<<default>>").toString().arg(url.toString()).split(' '); QStringList args=config->urlCmd().arg(url.toString()).split(' ');
QString cmd=args.takeFirst(); QString cmd=args.takeFirst();
QProcess::startDetached(cmd,args); QProcess::startDetached(cmd,args);
} }
@ -338,7 +352,7 @@ const QIcon& getIcon(const QString& name){
return *CachedIcon; return *CachedIcon;
QFileInfo IconFile(AppDir+"/../share/keepass/icons/"+name+".png"); QFileInfo IconFile(AppDir+"/../share/keepass/icons/"+name+".png");
if(!IconFile.isFile() || !IconFile.exists() || !IconFile.isReadable()){ if(!IconFile.isFile() || !IconFile.exists() || !IconFile.isReadable()){
//ERROR ///TODO 0.2.3 error handling
qWarning("%s",CSTR(name)); qWarning("%s",CSTR(name));
} }
QIcon* NewIcon=new QIcon(AppDir+"/../share/keepass/icons/"+name+".png"); QIcon* NewIcon=new QIcon(AppDir+"/../share/keepass/icons/"+name+".png");
@ -352,7 +366,7 @@ const QPixmap* getPixmap(const QString& name){
return CachedPixmap; return CachedPixmap;
QImage img; QImage img;
if(!img.load(AppDir+"/../share/keepass/icons/"+name+".png")){ if(!img.load(AppDir+"/../share/keepass/icons/"+name+".png")){
//ERROR ///TODO 0.2.3 error handling
qWarning("%s",CSTR(name)); qWarning("%s",CSTR(name));
} }
QPixmap* NewPixmap=new QPixmap(QPixmap::fromImage(img)); QPixmap* NewPixmap=new QPixmap(QPixmap::fromImage(img));

@ -26,13 +26,12 @@
#include <QColor> #include <QColor>
#include <QIcon> #include <QIcon>
#include <QFile> #include <QFile>
#include <QSettings>
#define KEEPASS_VERSION "0.2.3" #define KEEPASS_VERSION "0.2.3"
#define BUILTIN_ICONS 62 #define BUILTIN_ICONS 62
typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2}; typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2};
class CConfig; class KpxConfig;
void createBanner(QLabel *Banner,const QPixmap* symbol,QString text); void createBanner(QLabel *Banner,const QPixmap* symbol,QString text);
void createBanner(QPixmap* Pixmap, const QPixmap* IconAlpha,const QString& Text,int Width); void createBanner(QPixmap* Pixmap, const QPixmap* IconAlpha,const QString& Text,int Width);
@ -47,9 +46,8 @@ QString makePathRelative(const QString& Abs,const QString& Cur);
void loadDefaultDetailViewTemplate(); void loadDefaultDetailViewTemplate();
extern QString PluginLoadError; extern QString PluginLoadError;
extern CConfig config; extern KpxConfig *config;
extern QSettings *settings; extern QString AppDir;
extern QString AppDir;
extern bool TrActive; extern bool TrActive;
extern QString DetailViewTemplate; extern QString DetailViewTemplate;
extern QPixmap *EntryIcons; extern QPixmap *EntryIcons;

@ -40,7 +40,6 @@
#include "KpxFirefox.h" #include "KpxFirefox.h"
#include "lib/random.h" #include "lib/random.h"
#include "lib/IniReader.h"
#include "lib/AutoType.h" #include "lib/AutoType.h"
#include "lib/FileDialogs.h" #include "lib/FileDialogs.h"
#include "import/Import_PwManager.h" #include "import/Import_PwManager.h"
@ -59,6 +58,7 @@
#include "dialogs/CollectEntropyDlg.h" #include "dialogs/CollectEntropyDlg.h"
#include "dialogs/CustomizeDetailViewDlg.h" #include "dialogs/CustomizeDetailViewDlg.h"
#include "dialogs/ExpiredEntriesDlg.h" #include "dialogs/ExpiredEntriesDlg.h"
#include "dialogs/TrashCanDlg.h"
//#include <QtDBus/QtDBus> //#include <QtDBus/QtDBus>
#include <iostream> #include <iostream>
@ -77,11 +77,13 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
Start=true; Start=true;
ShutingDown=false; ShutingDown=false;
setupUi(this); setupUi(this);
#ifdef QT_WS_MAC
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
#endif
AutoType::MainWin=this; AutoType::MainWin=this;
setGeometry(settings->value("Ui/MainWindowGeometry",QVariant(geometry())).toRect()); setGeometry(config->mainWindowGeometry(geometry()));
VSplitter->restoreState(settings->value("Ui/VSplitterPos").toByteArray()); VSplitter->restoreState(config->vSplitterPos());
HSplitter->restoreState(settings->value("Ui/HSplitterPos").toByteArray()); HSplitter->restoreState(config->hSplitterPos());
SysTray=new QSystemTrayIcon(this); SysTray=new QSystemTrayIcon(this);
setupToolbar(); setupToolbar();
setupIcons(); setupIcons();
@ -91,18 +93,18 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
StatusBarSelection=new QLabel(statusBar()); StatusBarSelection=new QLabel(statusBar());
statusBar()->addWidget(StatusBarGeneral,15); statusBar()->addWidget(StatusBarGeneral,15);
statusBar()->addWidget(StatusBarSelection,85); statusBar()->addWidget(StatusBarSelection,85);
statusBar()->setVisible(config.ShowStatusbar); statusBar()->setVisible(config->showStatusbar());
setupConnections(); setupConnections();
FileOpen=false; FileOpen=false;
if(ArgFile!=QString()) if(!ArgFile.isEmpty())
openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(ArgFile)),false); openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(ArgFile)),false);
else if(settings->value("OpenLastFile",true).toBool() && (settings->value("LastFile","").toString()!=QString())){ else if(config->openLastFile() && !config->lastFile().isEmpty()){
QFileInfo file(settings->value("LastFile","").toString()); QFileInfo file(config->lastFile());
if(file.exists()) if(file.exists())
openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastFile","").toString())),true); openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastFile())),true);
else else
settings->setValue("LastFile",""); config->setLastFile(QString());
} }
// DBus Server of Qt 4.2 does not work - 4.3 snapshot seems to work fine // DBus Server of Qt 4.2 does not work - 4.3 snapshot seems to work fine
@ -162,6 +164,7 @@ void KeepassMainWindow::setupConnections(){
connect(ExtrasSettingsAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasSettings())); connect(ExtrasSettingsAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasSettings()));
connect(ExtrasPasswordGenAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasPasswordGen())); connect(ExtrasPasswordGenAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasPasswordGen()));
connect(ExtrasShowExpiredEntriesAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasShowExpiredEntries())); connect(ExtrasShowExpiredEntriesAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasShowExpiredEntries()));
connect(ExtrasTrashCanAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasTrashCan()));
connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook())); connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook()));
connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout())); connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout()));
@ -179,13 +182,13 @@ void KeepassMainWindow::setupConnections(){
connect(HideSearchResultsAction,SIGNAL(triggered()),GroupView,SLOT(OnHideSearchResults())); connect(HideSearchResultsAction,SIGNAL(triggered()),GroupView,SLOT(OnHideSearchResults()));
connect(SysTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason))); connect(SysTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));
connect(DetailView,SIGNAL(anchorClicked(const QUrl&)),this,SLOT(OnDetailViewUrlClicked(const QUrl&)));
} }
void KeepassMainWindow::setupToolbar(){ void KeepassMainWindow::setupToolbar(){
toolBar=new QToolBar(this); toolBar=new QToolBar(this);
addToolBar(toolBar); addToolBar(toolBar);
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize)); toolBar->setIconSize(QSize(config->toolbarIconSize(),config->toolbarIconSize()));
ViewShowToolbarAction=toolBar->toggleViewAction(); ViewShowToolbarAction=toolBar->toggleViewAction();
toolBar->addAction(FileNewAction); toolBar->addAction(FileNewAction);
toolBar->addAction(FileOpenAction); toolBar->addAction(FileOpenAction);
@ -228,11 +231,12 @@ void KeepassMainWindow::setupIcons(){
ExtrasSettingsAction->setIcon(getIcon("appsettings")); ExtrasSettingsAction->setIcon(getIcon("appsettings"));
ExtrasShowExpiredEntriesAction->setIcon(getIcon("expired")); ExtrasShowExpiredEntriesAction->setIcon(getIcon("expired"));
ExtrasPasswordGenAction->setIcon(getIcon("generator")); ExtrasPasswordGenAction->setIcon(getIcon("generator"));
ExtrasTrashCanAction->setIcon(getIcon("trashcan"));
EditAutoTypeAction->setIcon(getIcon("autotype")); EditAutoTypeAction->setIcon(getIcon("autotype"));
HelpHandbookAction->setIcon(getIcon("manual")); HelpHandbookAction->setIcon(getIcon("manual"));
HelpAboutAction->setIcon(getIcon("help")); HelpAboutAction->setIcon(getIcon("help"));
SysTray->setIcon(getIcon("keepassx_large")); SysTray->setIcon(getIcon("keepassx_large"));
if(config.ShowSysTrayIcon) if(config->showSysTrayIcon())
SysTray->show(); SysTray->show();
} }
@ -259,10 +263,10 @@ void KeepassMainWindow::setupMenus(){
ViewShowToolbarAction->setText(tr("Show Toolbar")); ViewShowToolbarAction->setText(tr("Show Toolbar"));
ViewMenu->insertAction(ViewShowEntryDetailsAction,ViewShowToolbarAction); ViewMenu->insertAction(ViewShowEntryDetailsAction,ViewShowToolbarAction);
ViewShowToolbarAction->setChecked(config.Toolbar); ViewShowToolbarAction->setChecked(config->showToolbar());
ViewShowEntryDetailsAction->setChecked(config.EntryDetails); ViewShowEntryDetailsAction->setChecked(config->showEntryDetails());
ViewHidePasswordsAction->setChecked(config.ListView_HidePasswords); ViewHidePasswordsAction->setChecked(config->hidePasswords());
ViewHideUsernamesAction->setChecked(config.ListView_HideUsernames); ViewHideUsernamesAction->setChecked(config->hideUsernames());
ViewColumnsTitleAction->setChecked(EntryView->Columns[0]); ViewColumnsTitleAction->setChecked(EntryView->Columns[0]);
ViewColumnsUsernameAction->setChecked(EntryView->Columns[1]); ViewColumnsUsernameAction->setChecked(EntryView->Columns[1]);
ViewColumnsUrlAction->setChecked(EntryView->Columns[2]); ViewColumnsUrlAction->setChecked(EntryView->Columns[2]);
@ -274,9 +278,9 @@ void KeepassMainWindow::setupMenus(){
ViewColumnsLastAccessAction->setChecked(EntryView->Columns[8]); ViewColumnsLastAccessAction->setChecked(EntryView->Columns[8]);
ViewColumnsAttachmentAction->setChecked(EntryView->Columns[9]); ViewColumnsAttachmentAction->setChecked(EntryView->Columns[9]);
ViewColumnsGroupAction->setChecked(EntryView->Columns[10]); ViewColumnsGroupAction->setChecked(EntryView->Columns[10]);
ViewShowStatusbarAction->setChecked(config.ShowStatusbar); ViewShowStatusbarAction->setChecked(config->showStatusbar());
switch(config.ToolbarIconSize){ switch(config->toolbarIconSize()){
case 16: ViewToolButtonSize16Action->setChecked(true); break; case 16: ViewToolButtonSize16Action->setChecked(true); break;
case 22: ViewToolButtonSize22Action->setChecked(true); break; case 22: ViewToolButtonSize22Action->setChecked(true); break;
case 28: ViewToolButtonSize28Action->setChecked(true); break; case 28: ViewToolButtonSize28Action->setChecked(true); break;
@ -322,6 +326,8 @@ void KeepassMainWindow::setupMenus(){
FileSaveAsAction->setShortcut(tr("Shift+Ctrl+S")); FileSaveAsAction->setShortcut(tr("Shift+Ctrl+S"));
EditGroupSearchAction->setShortcut(tr("Shift+Ctrl+F")); EditGroupSearchAction->setShortcut(tr("Shift+Ctrl+F"));
#endif #endif
ExtrasTrashCanAction->setVisible(false); //For KP 2.x only
} }
void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){ void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
@ -336,8 +342,8 @@ void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){ void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
if(!IsAuto){ if(!IsAuto){
config.LastKeyLocation=QString(); config->setLastKeyLocation(QString());
config.LastKeyType=PASSWORD;} config->setLastKeyType(PASSWORD);}
db=dynamic_cast<IDatabase*>(new Kdb3Database()); db=dynamic_cast<IDatabase*>(new Kdb3Database());
CPasswordDialog PasswordDlg(this,db,IsAuto,false); CPasswordDialog PasswordDlg(this,db,IsAuto,false);
PasswordDlg.setWindowTitle(filename); PasswordDlg.setWindowTitle(filename);
@ -542,9 +548,9 @@ void KeepassMainWindow::updateDetailView(){
templ.replace("%group%",entry->group()->title()); templ.replace("%group%",entry->group()->title());
templ.replace("%title%",entry->title()); templ.replace("%title%",entry->title());
if(config.ListView_HideUsernames)templ.replace("%username%","****"); if(config->hideUsernames())templ.replace("%username%","****");
else templ.replace("%username%",entry->username()); else templ.replace("%username%",entry->username());
if(!config.ListView_HidePasswords){ if(!config->hidePasswords()){
SecString password=entry->password(); SecString password=entry->password();
password.unlock(); password.unlock();
templ.replace("%password%",password.string()); templ.replace("%password%",password.string());
@ -818,12 +824,12 @@ void KeepassMainWindow::OnColumnVisibilityChanged(QAction* action){
EntryView->Columns[9]=ViewColumnsAttachmentAction->isChecked(); EntryView->Columns[9]=ViewColumnsAttachmentAction->isChecked();
EntryView->Columns[10]=ViewColumnsGroupAction->isChecked(); EntryView->Columns[10]=ViewColumnsGroupAction->isChecked();
EntryView->updateColumns(); EntryView->updateColumns();
//if(FileOpen) EntryView->updateItems(); if(FileOpen) EntryView->refreshItems();
} }
void KeepassMainWindow::OnUsernPasswVisibilityChanged(bool value){ void KeepassMainWindow::OnUsernPasswVisibilityChanged(bool value){
config.ListView_HidePasswords=ViewHidePasswordsAction->isChecked(); config->setHidePasswords(ViewHidePasswordsAction->isChecked());
config.ListView_HideUsernames=ViewHideUsernamesAction->isChecked(); config->setHideUsernames(ViewHideUsernamesAction->isChecked());
EntryView->refreshItems(); EntryView->refreshItems();
} }
@ -832,16 +838,16 @@ setStateFileModified(true);
} }
void KeepassMainWindow::closeEvent(QCloseEvent* e){ void KeepassMainWindow::closeEvent(QCloseEvent* e){
if(!ShutingDown && config.MinimizeToTray){ if(!ShutingDown && config->minimizeToTray()){
e->ignore(); e->ignore();
hide(); hide();
return; return;
} }
settings->setValue("Ui/MainWindowGeometry",QVariant(geometry())); config->setMainWindowGeometry(geometry());
settings->setValue("Ui/VSplitterPos",VSplitter->saveState()); config->setVSplitterPos(VSplitter->saveState());
settings->setValue("Ui/HSplitterPos",HSplitter->saveState()); config->setHSplitterPos(HSplitter->saveState());
config.ShowStatusbar=statusBar()->isVisible(); config->setShowStatusbar(statusBar()->isVisible());
if(FileOpen){ if(FileOpen){
if(!closeDatabase()){ if(!closeDatabase()){
@ -860,8 +866,8 @@ void KeepassMainWindow::closeEvent(QCloseEvent* e){
void KeepassMainWindow::OnExtrasSettings(){ void KeepassMainWindow::OnExtrasSettings(){
CSettingsDlg dlg(this); CSettingsDlg dlg(this);
if(dlg.exec()==QDialog::Accepted){ if(dlg.exec()==QDialog::Accepted){
EntryView->setAlternatingRowColors(config.AlternatingRowColors); EntryView->setAlternatingRowColors(config->alternatingRowColors());
SysTray->setVisible(config.ShowSysTrayIcon); SysTray->setVisible(config->showSysTrayIcon());
} }
} }
@ -875,13 +881,13 @@ openBrowser(AppDir+"/../share/doc/keepass/index.html");
} }
void KeepassMainWindow::OnViewShowToolbar(bool show){ void KeepassMainWindow::OnViewShowToolbar(bool show){
config.Toolbar=show; config->setShowToolbar(show);
toolBar->setVisible(config.Toolbar); toolBar->setVisible(show);
} }
void KeepassMainWindow::OnViewShowEntryDetails(bool show){ void KeepassMainWindow::OnViewShowEntryDetails(bool show){
config.EntryDetails=show; config->setShowEntryDetails(show);
DetailView->setVisible(config.EntryDetails); DetailView->setVisible(show);
} }
void KeepassMainWindow::OnItemExpanded(QTreeWidgetItem* item){ void KeepassMainWindow::OnItemExpanded(QTreeWidgetItem* item){
@ -913,24 +919,24 @@ void KeepassMainWindow::OnViewToolbarIconSize16(bool state){
if(!state)return; if(!state)return;
ViewToolButtonSize22Action->setChecked(false); ViewToolButtonSize22Action->setChecked(false);
ViewToolButtonSize28Action->setChecked(false); ViewToolButtonSize28Action->setChecked(false);
config.ToolbarIconSize=16; config->setToolbarIconSize(16);
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize)); toolBar->setIconSize(QSize(16,16));
} }
void KeepassMainWindow::OnViewToolbarIconSize22(bool state){ void KeepassMainWindow::OnViewToolbarIconSize22(bool state){
if(!state)return; if(!state)return;
ViewToolButtonSize16Action->setChecked(false); ViewToolButtonSize16Action->setChecked(false);
ViewToolButtonSize28Action->setChecked(false); ViewToolButtonSize28Action->setChecked(false);
config.ToolbarIconSize=22; config->setToolbarIconSize(22);
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize)); toolBar->setIconSize(QSize(22,22));
} }
void KeepassMainWindow::OnViewToolbarIconSize28(bool state){ void KeepassMainWindow::OnViewToolbarIconSize28(bool state){
if(!state)return; if(!state)return;
ViewToolButtonSize16Action->setChecked(false); ViewToolButtonSize16Action->setChecked(false);
ViewToolButtonSize22Action->setChecked(false); ViewToolButtonSize22Action->setChecked(false);
config.ToolbarIconSize=28; config->setToolbarIconSize(28);
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize)); toolBar->setIconSize(QSize(28,28));
} }
void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason){ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason){
@ -946,14 +952,14 @@ void KeepassMainWindow::OnExtrasPasswordGen(){
void KeepassMainWindow::saveLastFilename(const QString& filename){ void KeepassMainWindow::saveLastFilename(const QString& filename){
if(settings->value("OpenLastFile",true).toBool()){ if(config->openLastFile()){
if(settings->value("SaveRelativePath",true).toBool()){ if(config->saveRelativePaths()){
QString Path=filename.left(filename.lastIndexOf("/")); QString Path=filename.left(filename.lastIndexOf("/"));
Path=makePathRelative(Path,QDir::currentPath()); Path=makePathRelative(Path,QDir::currentPath());
settings->setValue("LastFile",Path+filename.right(filename.length()-filename.lastIndexOf("/")-1)); config->setLastFile(Path+filename.right(filename.length()-filename.lastIndexOf("/")-1));
} }
else else
settings->setValue("LastFile",filename); config->setLastFile(filename);
} }
} }
@ -965,3 +971,16 @@ void KeepassMainWindow::OnExtrasShowExpiredEntries(){
} }
} }
void KeepassMainWindow::OnExtrasTrashCan(){
TrashCanDialog dlg(this,db,db->expiredEntries());
if(dlg.exec()==QDialog::Accepted){
}
}
void KeepassMainWindow::OnDetailViewUrlClicked(const QUrl& url){
openBrowser(url.toString());
}

@ -38,9 +38,10 @@
#include <QTimer> #include <QTimer>
#include <QToolButton> #include <QToolButton>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QUrl>
#include "StandardDatabase.h" #include "Kdb3Database.h"
#include "PwmConfig.h" #include "KpxConfig.h"
#include "lib/EntryView.h" #include "lib/EntryView.h"
#include "lib/GroupView.h" #include "lib/GroupView.h"
#include "export/Export.h" #include "export/Export.h"
@ -82,6 +83,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void OnExtrasSettings(); void OnExtrasSettings();
void OnExtrasPasswordGen(); void OnExtrasPasswordGen();
void OnExtrasShowExpiredEntries(); void OnExtrasShowExpiredEntries();
void OnExtrasTrashCan();
void OnHelpAbout(); void OnHelpAbout();
void OnHelpHandbook(); void OnHelpHandbook();
void OnItemExpanded(QTreeWidgetItem*); void OnItemExpanded(QTreeWidgetItem*);
@ -91,6 +93,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void OnSysTrayActivated(QSystemTrayIcon::ActivationReason); void OnSysTrayActivated(QSystemTrayIcon::ActivationReason);
void OnImport(QAction*); void OnImport(QAction*);
void OnExport(QAction*); void OnExport(QAction*);
void OnDetailViewUrlClicked(const QUrl& url);
private: private:
void closeEvent(QCloseEvent* event); void closeEvent(QCloseEvent* event);

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2005-2006 by Tarek Saidi * * Copyright (C) 2005-2007 by Tarek Saidi *
* tarek.saidi@arcor.de * * tarek.saidi@arcor.de *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -27,12 +27,12 @@ class IFileDialog{
public: public:
virtual ~IFileDialog(){} virtual ~IFileDialog(){}
virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir, virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir,
QStringList Filters)=0; QStringList Filters,int SelectedFilter)=0;
virtual QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir, virtual QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,
QStringList Filters)=0; QStringList Filters,int SelectedFilter)=0;
virtual QString saveFileDialog(QWidget* parent,QString title,QString dir, virtual QString saveFileDialog(QWidget* parent,QString title,QString dir,
QStringList Filters,bool ShowOverwriteWarning=true)=0; QStringList Filters,int SelectedFilter, bool ShowOverwriteWarning=true)=0;
virtual int getLastFilter()=0; virtual int getLastFilter()=0;
}; };

@ -51,6 +51,7 @@ FORMS += forms/EditGroupDlg.ui \
forms/CollectEntropyDlg.ui \ forms/CollectEntropyDlg.ui \
forms/CustomizeDetailViewDlg.ui \ forms/CustomizeDetailViewDlg.ui \
forms/CalendarDlg.ui \ forms/CalendarDlg.ui \
forms/TrashCanDlg.ui \
forms/ExpiredEntriesDlg.ui forms/ExpiredEntriesDlg.ui
TRANSLATIONS += translations/keepass-de_DE.ts \ TRANSLATIONS += translations/keepass-de_DE.ts \
translations/keepass-ru_RU.ts \ translations/keepass-ru_RU.ts \
@ -61,7 +62,7 @@ TRANSLATIONS += translations/keepass-de_DE.ts \
HEADERS += lib/IniReader.h \ HEADERS += lib/IniReader.h \
lib/UrlLabel.h \ lib/UrlLabel.h \
mainwindow.h \ mainwindow.h \
StandardDatabase.h \ Kdb3Database.h \
lib/SecString.h \ lib/SecString.h \
crypto/twoclass.h \ crypto/twoclass.h \
crypto/twofish.h \ crypto/twofish.h \
@ -72,7 +73,6 @@ HEADERS += lib/IniReader.h \
export/Export_KeePassX_Xml.h \ export/Export_KeePassX_Xml.h \
export/Export.h \ export/Export.h \
import/Import_KWalletXml.h \ import/Import_KWalletXml.h \
PwmConfig.h \
dialogs/AboutDlg.h \ dialogs/AboutDlg.h \
dialogs/EditGroupDlg.h \ dialogs/EditGroupDlg.h \
dialogs/SearchDlg.h \ dialogs/SearchDlg.h \
@ -87,6 +87,7 @@ HEADERS += lib/IniReader.h \
dialogs/CustomizeDetailViewDlg.h \ dialogs/CustomizeDetailViewDlg.h \
dialogs/CalendarDlg.h \ dialogs/CalendarDlg.h \
dialogs/ExpiredEntriesDlg.h \ dialogs/ExpiredEntriesDlg.h \
dialogs/TrashCanDlg.h \
lib/random.h \ lib/random.h \
Database.h \ Database.h \
lib/KdePlugin.h \ lib/KdePlugin.h \
@ -112,12 +113,12 @@ HEADERS += lib/IniReader.h \
plugins/interfaces/IFileDialog.h \ plugins/interfaces/IFileDialog.h \
plugins/interfaces/IKdeInit.h \ plugins/interfaces/IKdeInit.h \
plugins/interfaces/IGnomeInit.h \ plugins/interfaces/IGnomeInit.h \
KpxConfig.h \
KpxFirefox.h KpxFirefox.h
SOURCES += lib/IniReader.cpp \ SOURCES += lib/UrlLabel.cpp \
lib/UrlLabel.cpp \
main.cpp \ main.cpp \
mainwindow.cpp \ mainwindow.cpp \
StandardDatabase.cpp \ Kdb3Database.cpp \
lib/SecString.cpp \ lib/SecString.cpp \
crypto/twoclass.cpp \ crypto/twoclass.cpp \
crypto/twofish.cpp \ crypto/twofish.cpp \
@ -130,7 +131,6 @@ SOURCES += lib/IniReader.cpp \
export/Export_KeePassX_Xml.cpp \ export/Export_KeePassX_Xml.cpp \
export/Export.cpp \ export/Export.cpp \
import/Import_KWalletXml.cpp \ import/Import_KWalletXml.cpp \
PwmConfig.cpp \
dialogs/AboutDlg.cpp \ dialogs/AboutDlg.cpp \
dialogs/EditGroupDlg.cpp \ dialogs/EditGroupDlg.cpp \
dialogs/SearchDlg.cpp \ dialogs/SearchDlg.cpp \
@ -145,6 +145,7 @@ SOURCES += lib/IniReader.cpp \
dialogs/CustomizeDetailViewDlg.cpp \ dialogs/CustomizeDetailViewDlg.cpp \
dialogs/CalendarDlg.cpp \ dialogs/CalendarDlg.cpp \
dialogs/ExpiredEntriesDlg.cpp \ dialogs/ExpiredEntriesDlg.cpp \
dialogs/TrashCanDlg.cpp \
lib/random.cpp \ lib/random.cpp \
Database.cpp \ Database.cpp \
lib/KdePlugin.cpp \ lib/KdePlugin.cpp \
@ -160,6 +161,7 @@ SOURCES += lib/IniReader.cpp \
crypto/sha256.cpp \ crypto/sha256.cpp \
crypto/yarrow.cpp \ crypto/yarrow.cpp \
lib/WaitAnimationWidget.cpp \ lib/WaitAnimationWidget.cpp \
KpxConfig.cpp \
KpxFirefox.cpp KpxFirefox.cpp
RESOURCES += res/resources.qrc RESOURCES += res/resources.qrc
MOC_DIR = ../build/moc MOC_DIR = ../build/moc