added 'relative path' option,

fixed missing browser start function,
added option for using the system's default browser.

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@129 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 17 years ago
parent 2b54ded391
commit 88f42dfe6b
  1. 1
      src/StandardDatabase.cpp
  2. 37
      src/dialogs/PasswordDlg.cpp
  3. 134
      src/dialogs/SettingsDlg.cpp
  4. 3
      src/dialogs/SettingsDlg.h
  5. 41
      src/forms/SettingsDlg.ui
  6. 16
      src/lib/EntryView.cpp
  7. 1
      src/lib/EntryView.h
  8. 34
      src/main.cpp
  9. 1
      src/main.h
  10. 67
      src/mainwindow.cpp
  11. 2
      src/mainwindow.h

@ -27,6 +27,7 @@
#include <qdatetime.h>
#include <QSysInfo>
#include <QBuffer>
#include <QDir>
#include "crypto/twoclass.h"
#include "crypto/aescpp.h"
#include "crypto/sha256.h"

@ -51,17 +51,18 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
}
Combo_Dirs->setEditText(QString());
if(config.RememberLastKey && !ChangeKeyMode){
switch(config.LastKeyType){
//case PASSWORD: setStatePasswordOnly(); break; //Password-Only is already the default
case KEYFILE: setStateKeyFileOnly();
Combo_Dirs->setEditText(config.LastKeyLocation);
break;
case BOTH: setStateBoth();
CheckBox_Both->setChecked(true);
Combo_Dirs->setEditText(config.LastKeyLocation);
break;
if(settings->value("RememberLastKey",true).toBool() && !ChangeKeyMode){
QString LastKeyType=settings->value("LastKeyType","").toString();
if(LastKeyType=="KeyFile"){
setStateKeyFileOnly();
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString())));
}
else if(LastKeyType=="Composite"){
setStateBoth();
CheckBox_Both->setChecked(true);
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString())));
}
// if(LastKeyType==Password){... is not required because it is already the default state.
}
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
@ -277,9 +278,19 @@ bool CPasswordDialog::doAuth(){
if(!DbAuth->authByFile(keyfile))return false;
}
if(config.RememberLastKey){
config.LastKeyLocation=keyfile;
config.LastKeyType=KeyType;
if(settings->value("RememberLastKey",true).toBool()){
QString KeyLocation=keyfile;
if(settings->value("SaveRelativePaths",true).toBool()){
KeyLocation=KeyLocation.left(KeyLocation.lastIndexOf("/"));
KeyLocation=makePathRelative(KeyLocation,QDir::currentPath())+keyfile.right(keyfile.length()-keyfile.lastIndexOf("/")-1);
}
settings->setValue("LastKeyFile",KeyLocation);
if(KeyType==PASSWORD)
settings->setValue("LastKeyType","Password");
if(KeyType==KEYFILE)
settings->setValue("LastKeyType","KeyFile");
if(KeyType==BOTH)
settings->setValue("LastKeyType","Composite");
}
return true;

@ -43,18 +43,41 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
connect(ButtonColor1, SIGNAL( clicked() ), this, SLOT( OnColor1() ) );
connect(ButtonColor2, SIGNAL( clicked() ), this, SLOT( OnColor2() ) );
connect(ButtonTextColor, SIGNAL( clicked() ), this, SLOT( OnTextColor() ) );
connect(CheckBox_OpenLast,SIGNAL(stateChanged(int)),this,SLOT(OnCeckBoxOpenLastChanged(int)));
connect(CheckBox_OpenLast,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxOpenLastChanged(int)));
connect(Button_MountDirBrowse,SIGNAL(clicked()),this,SLOT(OnMountDirBrowse()));
connect(Radio_IntPlugin_None,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginNone(bool)));
connect(Radio_IntPlugin_Gnome,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginGnome(bool)));
connect(Radio_IntPlugin_Kde,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginKde(bool)));
connect(CheckBox_BrowserDefault,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxBrowserDefaultChanged(int)));
createBanner(&BannerPixmap,Icon_Settings32x32,tr("Settings"),width());
CheckBox_OpenLast->setChecked(config.OpenLast);
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
//General
CheckBox_OpenLast->setChecked(settings->value("OpenLastFile",true).toBool());
CheckBox_RememberLastKey->setChecked(settings->value("RememberLastKey",true).toBool());
checkBox_ShowSysTrayIcon->setChecked(config.ShowSysTrayIcon);
checkBox_MinimizeToTray->setChecked(config.MinimizeToTray);
checkBox_SaveFileDlgHistory->setChecked(config.SaveFileDlgHistory);
switch(config.GroupTreeRestore){
case 1:
Radio_GroupTreeRestore->setChecked(true);
break;
case 2:
Radio_GroupTreeExpand->setChecked(true);
break;
case 3:
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
QPixmap *pxt=new QPixmap(pixmTextColor->width(),pixmTextColor->height());
pxt->fill(config.BannerTextColor);
pixmTextColor->clear();
@ -68,33 +91,21 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
QPixmap *px2=new QPixmap(pixmColor2->width(),pixmColor2->height());
px2->fill(config.BannerColor2);
pixmColor2->clear();
pixmColor2->setPixmap(*px2);
pixmColor2->setPixmap(*px2);
color1=config.BannerColor1;
color2=config.BannerColor2;
textcolor=config.BannerTextColor;
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
//Security
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
CheckBox_ShowPasswords_PasswordDlg->setChecked(config.ShowPasswordsPasswordDlg);
checkBox_ShowSysTrayIcon->setChecked(config.ShowSysTrayIcon);
checkBox_MinimizeToTray->setChecked(config.MinimizeToTray);
checkBox_SaveFileDlgHistory->setChecked(config.SaveFileDlgHistory);
Edit_BrowserCmd->setText(config.OpenUrlCommand);
switch(config.GroupTreeRestore){
case 1:
Radio_GroupTreeRestore->setChecked(true);
break;
case 2:
Radio_GroupTreeExpand->setChecked(true);
break;
case 3:
Radio_GroupTreeDoNothing->setChecked(true);
}
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
Edit_MountDir->setText(config.MountDir);
CheckBox_RememberLastKey->setChecked(config.RememberLastKey);
//Desktop Integration
if(PluginLoadError==QString())
Label_IntPlugin_Error->hide();
else
@ -106,13 +117,24 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
case CConfig::GNOME: Radio_IntPlugin_Gnome->setChecked(true); break;
case CConfig::KDE: Radio_IntPlugin_Kde->setChecked(true); break;
}
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);
if(!PluginsModified)
Label_IntPlugin_Info->hide();
//Advanced
QString BrowserCmd=settings->value("BrowserCmd","<<default>>").toString();
if(BrowserCmd=="<<default>>"){
CheckBox_BrowserDefault->setChecked(true);
Edit_BrowserCmd->setDisabled(true);
}
else{
Edit_BrowserCmd->setText(BrowserCmd);
CheckBox_BrowserDefault->setChecked(false);
}
Edit_MountDir->setText(config.MountDir);
CheckBox_SaveRelativePaths->setChecked(settings->value("SaveRelativePaths",true).toBool());
}
CSettingsDlg::~CSettingsDlg()
@ -126,7 +148,15 @@ void CSettingsDlg::paintEvent(QPaintEvent *event){
painter.drawPixmap(QPoint(0,0),BannerPixmap);
}
void CSettingsDlg::OnCheckBoxBrowserDefaultChanged(int state){
if(state==Qt::Checked){
Edit_BrowserCmd->setDisabled(true);
Edit_BrowserCmd->setText("");
}
else{
Edit_BrowserCmd->setDisabled(false);
}
}
void CSettingsDlg::OnOK()
{
@ -145,36 +175,46 @@ void CSettingsDlg::OnOtherButton(QAbstractButton* button){
}
void CSettingsDlg::apply(){
config.OpenLast=CheckBox_OpenLast->isChecked();
config.ClipboardTimeOut=SpinBox_ClipboardTime->value();
config.BannerColor1=color1;
config.BannerColor2=color2;
config.BannerTextColor=textcolor;
config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
config.ShowPasswordsPasswordDlg=CheckBox_ShowPasswords_PasswordDlg->isChecked();
config.OpenUrlCommand=Edit_BrowserCmd->text();
config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
config.MountDir=Edit_MountDir->text();
//General
config.ShowSysTrayIcon=checkBox_ShowSysTrayIcon->isChecked();
config.MinimizeToTray=checkBox_MinimizeToTray->isChecked();
config.SaveFileDlgHistory=checkBox_SaveFileDlgHistory->isChecked();
config.EnableBookmarkMenu=checkBox_EnableBookmarkMenu->isChecked();
config.EnableBookmarkMenu=checkBox_EnableBookmarkMenu->isChecked();
if(Radio_GroupTreeRestore->isChecked())config.GroupTreeRestore=0;
if(Radio_GroupTreeExpand->isChecked())config.GroupTreeRestore=1;
if(Radio_GroupTreeDoNothing->isChecked())config.GroupTreeRestore=2;
settings->setValue("OpenLastFile",CheckBox_OpenLast->isChecked());
settings->setValue("RememberLastKey",CheckBox_RememberLastKey->isChecked());
if(Radio_GroupTreeExpand->isChecked())settings->setValue("GroupTreeState","ExpandAll");
if(Radio_GroupTreeDoNothing->isChecked())settings->setValue("GroupTreeState","ExpandNone");
if(Radio_GroupTreeRestore->isChecked())settings->setValue("GroupTreeState","Restore");
if(config.MountDir!="" && config.MountDir.right(1)!="/")
config.MountDir+="/";
config.RememberLastKey=CheckBox_RememberLastKey->isChecked();
//Appearence
config.BannerColor1=color1;
config.BannerColor2=color2;
config.BannerTextColor=textcolor;
config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
//Security
config.ClipboardTimeOut=SpinBox_ClipboardTime->value();
config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
config.ShowPasswordsPasswordDlg=CheckBox_ShowPasswords_PasswordDlg->isChecked();
//Desktop Integration
PluginsModified=Label_IntPlugin_Info->isVisible();
if(Radio_IntPlugin_None->isChecked())config.IntegrPlugin=CConfig::NONE;
if(Radio_IntPlugin_Gnome->isChecked())config.IntegrPlugin=CConfig::GNOME;
if(Radio_IntPlugin_Kde->isChecked())config.IntegrPlugin=CConfig::KDE;
if(Radio_GroupTreeExpand->isChecked())settings->setValue("GroupTreeState","ExpandAll");
if(Radio_GroupTreeDoNothing->isChecked())settings->setValue("GroupTreeState","ExpandNone");
if(Radio_GroupTreeRestore->isChecked())settings->setValue("GroupTreeState","Restore");
//Advanced
config.OpenUrlCommand=Edit_BrowserCmd->text();
config.MountDir=Edit_MountDir->text();
if(config.MountDir!="" && config.MountDir.right(1)!="/")
config.MountDir+="/";
if(CheckBox_BrowserDefault->isChecked())settings->setValue("BrowserCmd","<<default>>");
else settings->setValue("BrowserCmd",Edit_BrowserCmd->text());
settings->setValue("SaveRelativePaths",CheckBox_SaveRelativePaths->isChecked());
}
@ -219,7 +259,7 @@ void CSettingsDlg::OnColor1()
}
}
void CSettingsDlg::OnCeckBoxOpenLastChanged(int state){
void CSettingsDlg::OnCheckBoxOpenLastChanged(int state){
if(state==Qt::Checked){
CheckBox_RememberLastKey->setEnabled(true);
}else{

@ -45,7 +45,8 @@ class CSettingsDlg : public QDialog, public Ui_SettingsDialog
void OnIntPluginNone(bool);
void OnIntPluginGnome(bool);
void OnIntPluginKde(bool);
void OnCeckBoxOpenLastChanged(int state);
void OnCheckBoxOpenLastChanged(int state);
void OnCheckBoxBrowserDefaultChanged(int state);
void OnMountDirBrowse();
private:

@ -893,6 +893,9 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="Edit_MountDir" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
@ -907,18 +910,46 @@
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="Edit_MountDir" />
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="Edit_BrowserCmd" />
</item>
<item row="1" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2" >
<widget class="QCheckBox" name="CheckBox_BrowserDefault" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>System Default</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox_VerifyAfterSaving" >
<widget class="QCheckBox" name="CheckBox_SaveRelativePaths" >
<property name="text" >
<string>Verify database content and structure after saving</string>
<string>Save relative paths</string>
</property>
</widget>
</item>

@ -264,19 +264,12 @@ void KeepassEntryView::OnNewEntry(){
}
void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item,int Column){
int i=0;
int c=-1;
for(i;i<NUM_COLUMNS;i++){
if(config.Columns[i])c++;
if(c==Column)break;
}
if(c==-1)return;
switch(i){
switch(columnListIndex(Column)){
case 0: editEntry((EntryViewItem*)item);
break;
case 1: OnUsernameToClipboard();
break;
case 2: //OnEditOpenUrl();
case 2: OnEditOpenUrl();
break;
case 3: OnPasswordToClipboard();
break;
@ -289,6 +282,11 @@ void KeepassEntryView::OnEditEntry(){
editEntry((EntryViewItem*)selectedItems()[0]);
}
void KeepassEntryView::OnEditOpenUrl(){
Q_ASSERT(selectedItems().size()==1);
openBrowser(((EntryViewItem*)selectedItems()[0])->text(logicalColIndex(2)));
}
void KeepassEntryView::OnUsernameToClipboard(){
Clipboard->setText(((EntryViewItem*)selectedItems()[0])->EntryHandle->username(), QClipboard::Clipboard);
ClipboardTimer.setSingleShot(true);

@ -94,6 +94,7 @@ class KeepassEntryView:public QTreeWidget{
void OnAutoType();
void removeDragItems();
void OnColumnMoved(int LogIndex,int OldVisIndex,int NewVisIndex);
void OnEditOpenUrl();
signals:
void fileModified();
void selectionChanged(SelectionState);

@ -31,6 +31,8 @@
#include <QProcess>
#include <QLibraryInfo>
#include <QPluginLoader>
#include <QDesktopServices>
#include <QUrl>
#include "plugins/interfaces/IFileDialog.h"
#include "plugins/interfaces/IKdeInit.h"
@ -280,10 +282,18 @@ QString decodeFileError(QFile::FileError Code){
}
}
void openBrowser(QString url){
QStringList args=config.OpenUrlCommand.arg(url).split(' ');
QString cmd=args.takeFirst();
QProcess::startDetached(cmd,args);
void openBrowser(QString UrlString){
QUrl url(UrlString);
if(url.scheme().isEmpty())
url=QUrl("http://"+UrlString);
if(settings->value("BrowserCmd","<<default>>").toString() == "<<default>>"){
QDesktopServices::openUrl(url);
}
else{
QStringList args=settings->value("BrowserCmd","<<default>>").toString().arg(url.toString()).split(' ');
QString cmd=args.takeFirst();
QProcess::startDetached(cmd,args);
}
}
@ -427,3 +437,19 @@ QString findPlugin(const QString& filename){
return QString();
}
QString makePathRelative(const QString& AbsDir,const QString& CurDir){
QStringList abs=AbsDir.split('/');
QStringList cur=CurDir.split('/');
QString rel="./";
int common=0;
for(common; common < abs.size() && common < cur.size(); common++){
if(abs[common]!=cur[common])break;
}
for(int i=0;i<cur.size()-common;i++)
rel.append("../");
for(int i=common;i<abs.size();i++)
rel.append(abs[i]+"/");
return rel;
}

@ -41,6 +41,7 @@ void openBrowser(QString url);
void showErrMsg(const QString& msg,QWidget* parent=NULL);
QString decodeFileError(QFile::FileError Code);
QString findPlugin(const QString& filename);
QString makePathRelative(const QString& Abs,const QString& Cur);
extern QString PluginLoadError;
extern CConfig config;

@ -91,16 +91,16 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
setupConnections();
FileOpen=false;
if(ArgFile!=QString())
openDatabase(ArgFile,false);
else if(config.OpenLast && (config.LastFile!=QString()) ){
QFileInfo file(config.LastFile);
openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(ArgFile)),false);
else if(settings->value("OpenLastFile",true).toBool() && (settings->value("LastFile","").toString()!=QString())){
QFileInfo file(settings->value("LastFile","").toString());
if(file.exists())
openDatabase(config.LastFile,true);
openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastFile","").toString())),true);
else
config.LastFile=QString();
settings->setValue("LastFile","");
}
/*
//dbusServer=new QDBusServer("unix:path=/tmp/KpxBus",this);
//qDebug("DBUS: %s",dbusServer->lastError().message().toAscii().data());
//QDBusConnection::connectToBus("unix:path=/tmp/KpxBus","MyKpxConnection");
@ -111,6 +111,7 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
QDBusConnection::sessionBus().registerService("org.keepassx.firefoxservice");
QDBusConnection::sessionBus().registerObject("/KpxFirefox",fox);
qDebug("DBUS: %s",QDBusConnection::sessionBus().lastError().message().toAscii().data());
*/
}
@ -135,7 +136,7 @@ void KeepassMainWindow::setupConnections(){
connect(EditDeleteEntryAction, SIGNAL(triggered()), EntryView, SLOT(OnDeleteEntry()));
connect(EditUsernameToClipboardAction, SIGNAL(triggered()), EntryView, SLOT(OnUsernameToClipboard()));
connect(EditPasswordToClipboardAction, SIGNAL(triggered()), EntryView, SLOT(OnPasswordToClipboard()));
connect(EditOpenUrlAction, SIGNAL(triggered()), this, SLOT(OnEditOpenUrl()));
connect(EditOpenUrlAction, SIGNAL(triggered()), EntryView, SLOT(OnEditOpenUrl()));
connect(EditSaveAttachmentAction, SIGNAL(triggered()),EntryView, SLOT(OnSaveAttachment()));
connect(EditSearchAction, SIGNAL(triggered()), this, SLOT(OnSearch()));
connect(EditGroupSearchAction, SIGNAL(triggered()), this, SLOT(OnGroupSearch()));
@ -340,7 +341,7 @@ void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
QString err;
StatusBarGeneral->setText(tr("Loading Database..."));
if(db->load(filename)==true){
if(config.OpenLast)config.LastFile=filename;
saveLastFilename(filename);
setWindowTitle(tr("%1 - KeePassX").arg(filename));
GroupView->createItems();
EntryView->showGroup(NULL);
@ -639,7 +640,7 @@ else Q_ASSERT(false);
bool KeepassMainWindow::OnFileSave(){
if(!db->file())
return OnFileSaveAs();
config.LastFile=db->file()->fileName();
saveLastFilename(db->file()->fileName());
if(db->save())
setStateFileModified(false);
else{
@ -724,10 +725,6 @@ for(int i=0; i<SearchResults.size();i++){
}
void KeepassMainWindow::OnEditOpenUrl(){
//openBrowser(currentEntry()->URL);
}
void KeepassMainWindow::search(IGroupHandle* group){
CSearchDlg dlg(db,group,this,"SearchDialog",false);
if(dlg.exec()){
@ -854,27 +851,27 @@ void KeepassMainWindow::OnShowSearchResults(){
void KeepassMainWindow::OnViewToolbarIconSize16(bool state){
if(!state)return;
ViewToolButtonSize22Action->setChecked(false);
ViewToolButtonSize28Action->setChecked(false);
config.ToolbarIconSize=16;
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
if(!state)return;
ViewToolButtonSize22Action->setChecked(false);
ViewToolButtonSize28Action->setChecked(false);
config.ToolbarIconSize=16;
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
}
void KeepassMainWindow::OnViewToolbarIconSize22(bool state){
if(!state)return;
ViewToolButtonSize16Action->setChecked(false);
ViewToolButtonSize28Action->setChecked(false);
config.ToolbarIconSize=22;
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
if(!state)return;
ViewToolButtonSize16Action->setChecked(false);
ViewToolButtonSize28Action->setChecked(false);
config.ToolbarIconSize=22;
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
}
void KeepassMainWindow::OnViewToolbarIconSize28(bool state){
if(!state)return;
ViewToolButtonSize16Action->setChecked(false);
ViewToolButtonSize22Action->setChecked(false);
config.ToolbarIconSize=28;
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
if(!state)return;
ViewToolButtonSize16Action->setChecked(false);
ViewToolButtonSize22Action->setChecked(false);
config.ToolbarIconSize=28;
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
}
void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason){
@ -886,3 +883,17 @@ void KeepassMainWindow::OnExtrasPasswordGen(){
CGenPwDialog dlg(this,true);
dlg.exec();
}
void KeepassMainWindow::saveLastFilename(const QString& filename){
if(settings->value("OpenLastFile",true).toBool()){
if(settings->value("SaveRelativePath",true).toBool()){
QString Path=filename.left(filename.lastIndexOf("/"));
Path=makePathRelative(Path,QDir::currentPath());
settings->setValue("LastFile",Path+filename.right(filename.length()-filename.lastIndexOf("/")-1));
}
else
settings->setValue("LastFile",filename);
}
}

@ -67,7 +67,6 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void OnFileSettings();
void OnFileChangeKey();
void OnFileExit();
void OnEditOpenUrl();
void OnSearch();
void OnGroupSearch();
void OnViewShowToolbar(bool);
@ -113,6 +112,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void removeFromSearchResults(int sID);
void updateDetailView();
void exportDatabase(IExport* exporter,QStringList filters);
void saveLastFilename(const QString& filename);
QLineEdit* QuickSearchEdit;
QLabel* StatusBarGeneral;
QLabel* StatusBarSelection;