Display warning when opening a database that is already opened

Improve tab order in many dialogs (closes #2130397)

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@222 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 16 years ago
parent c182df6c31
commit e5e9cebc8a
  1. 14
      src/dialogs/PasswordDlg.cpp
  2. 43
      src/forms/AboutDlg.ui
  3. 11
      src/forms/AddBookmarkDlg.ui
  4. 36
      src/forms/CustomizeDetailViewDlg.ui
  5. 10
      src/forms/DatabaseSettingsDlg.ui
  6. 11
      src/forms/EditGroupDlg.ui
  7. 15
      src/forms/ManageBookmarksDlg.ui
  8. 53
      src/forms/PasswordDlg.ui
  9. 109
      src/forms/SettingsDlg.ui
  10. 7
      src/forms/SimplePasswordDlg.ui
  11. 38
      src/mainwindow.cpp

@ -61,30 +61,36 @@ PasswordDialog::PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const
Check_Password->setChecked(true);
Check_KeyFile->setChecked(false);
Combo_KeyFile->setEditText("");
Edit_Password->setFocus(Qt::OtherFocusReason);
break;
case KEYFILE:
Check_Password->setChecked(false);
Check_KeyFile->setChecked(true);
Combo_KeyFile->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
Combo_KeyFile->setFocus(Qt::OtherFocusReason);
break;
case BOTH:
Check_Password->setChecked(true);
Check_KeyFile->setChecked(true);
Combo_KeyFile->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
Edit_Password->setFocus(Qt::OtherFocusReason);
break;
}
}
else{
Edit_Password->setFocus(Qt::OtherFocusReason);
}
if(Mode!=Mode_Set && Mode!=Mode_Change){
Button_GenKeyFile->hide();
}
if(flags & Flag_Auto){
/*
/*if(flags & Flag_Auto){
/ *
QPushButton* Button_Quit = buttonBox->addButton(tr("Quit"),QDialogButtonBox::DestructiveRole);
connect(Button_Quit,SIGNAL(clicked()),this,SLOT(OnButtonQuit()));
*/
* /
if(config->rememberLastKey()){
switch(config->lastKeyType()){
case PASSWORD:
@ -103,7 +109,7 @@ PasswordDialog::PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const
break;
}
}
}
}*/
// Setting up the bookmark button
if(Mode==Mode_Ask && config->featureBookmarks()){

@ -42,7 +42,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>50</height>
@ -56,6 +56,14 @@
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>171</height>
</rect>
</property>
<attribute name="title" >
<string>About</string>
</attribute>
@ -121,7 +129,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>10</width>
<height>20</height>
@ -161,6 +169,14 @@ General Public License (GPL) version 2.</string>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>171</height>
</rect>
</property>
<attribute name="title" >
<string>Credits</string>
</attribute>
@ -178,6 +194,14 @@ General Public License (GPL) version 2.</string>
</layout>
</widget>
<widget class="QWidget" name="tab_4" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>171</height>
</rect>
</property>
<attribute name="title" >
<string>Translation</string>
</attribute>
@ -195,6 +219,14 @@ General Public License (GPL) version 2.</string>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>171</height>
</rect>
</property>
<attribute name="title" >
<string>License</string>
</attribute>
@ -230,6 +262,13 @@ General Public License (GPL) version 2.</string>
<header>../../src/lib/UrlLabel.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>Edit_Thanks</tabstop>
<tabstop>Edit_Translation</tabstop>
<tabstop>Edit_License</tabstop>
<tabstop>ButtonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -40,7 +40,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>50</height>
@ -89,13 +89,18 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<includes/>
<tabstops>
<tabstop>Edit_Title</tabstop>
<tabstop>Edit_Filename</tabstop>
<tabstop>Button_Browse</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -22,6 +22,14 @@
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>509</width>
<height>324</height>
</rect>
</property>
<attribute name="title" >
<string>Rich Text Editor</string>
</attribute>
@ -262,7 +270,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -278,6 +286,14 @@
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>509</width>
<height>324</height>
</rect>
</property>
<attribute name="title" >
<string>HTML</string>
</attribute>
@ -299,12 +315,28 @@
<item>
<widget class="QDialogButtonBox" name="ButtonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>TabWidget</tabstop>
<tabstop>BtnBold</tabstop>
<tabstop>BtnItalic</tabstop>
<tabstop>BtnUnderline</tabstop>
<tabstop>BtnAlignLeft</tabstop>
<tabstop>BtnAlignCenter</tabstop>
<tabstop>BtnAlignRight</tabstop>
<tabstop>BtnAlignBlock</tabstop>
<tabstop>BtnColor</tabstop>
<tabstop>FontSize</tabstop>
<tabstop>BtnTemplates</tabstop>
<tabstop>RichEdit</tabstop>
<tabstop>HtmlEdit</tabstop>
<tabstop>ButtonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -33,7 +33,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>50</height>
@ -96,13 +96,19 @@
<item>
<widget class="QDialogButtonBox" name="ButtonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<tabstops>
<tabstop>ComboAlgo</tabstop>
<tabstop>EditRounds</tabstop>
<tabstop>ButtonBench</tabstop>
<tabstop>ButtonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -25,10 +25,7 @@
</property>
<item>
<layout class="QGridLayout" >
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" >
@ -53,7 +50,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>172</width>
<height>20</height>
@ -89,7 +86,7 @@
<item>
<widget class="QDialogButtonBox" name="ButtonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@ -99,6 +96,8 @@
<tabstops>
<tabstop>EditTitle</tabstop>
<tabstop>ComboIconPicker</tabstop>
<tabstop>Button_Icon</tabstop>
<tabstop>ButtonBox</tabstop>
</tabstops>
<resources/>
<connections/>

@ -27,7 +27,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>50</height>
@ -80,7 +80,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>10</height>
@ -113,7 +113,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>161</height>
@ -137,6 +137,15 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>ListWidget</tabstop>
<tabstop>Button_Add</tabstop>
<tabstop>Button_Edit</tabstop>
<tabstop>Button_Delete</tabstop>
<tabstop>Button_Up</tabstop>
<tabstop>Button_Down</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>578</width>
<height>255</height>
<height>273</height>
</rect>
</property>
<property name="sizePolicy" >
@ -44,7 +44,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>50</height>
@ -57,7 +57,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -113,16 +113,7 @@
<string>Key</string>
</property>
<layout class="QVBoxLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="margin" >
<number>0</number>
</property>
<item>
@ -131,6 +122,14 @@
<number>0</number>
</property>
<widget class="QWidget" name="pw_entry" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>556</width>
<height>116</height>
</rect>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QCheckBox" name="Check_Password" >
@ -204,7 +203,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -215,6 +214,14 @@
</layout>
</widget>
<widget class="QWidget" name="pw_repeat" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>556</width>
<height>116</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="label" >
@ -240,7 +247,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -272,7 +279,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -290,7 +297,7 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@ -298,17 +305,17 @@
</widget>
<layoutdefault spacing="6" margin="11" />
<tabstops>
<tabstop>Edit_Password</tabstop>
<tabstop>Combo_KeyFile</tabstop>
<tabstop>Button_Bookmarks</tabstop>
<tabstop>Check_Password</tabstop>
<tabstop>Check_KeyFile</tabstop>
<tabstop>Edit_Password</tabstop>
<tabstop>ButtonChangeEchoMode</tabstop>
<tabstop>Check_KeyFile</tabstop>
<tabstop>Combo_KeyFile</tabstop>
<tabstop>Button_Browse</tabstop>
<tabstop>Button_Bookmarks</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>Button_GenKeyFile</tabstop>
<tabstop>Button_Back</tabstop>
<tabstop>Edit_PwRepeat</tabstop>
<tabstop>Button_Back</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections/>

@ -27,7 +27,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>50</height>
@ -47,6 +47,14 @@
<number>0</number>
</property>
<widget class="QWidget" name="TabGeneral" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>341</height>
</rect>
</property>
<property name="whatsThis" >
<string>The integration plugins provide features like usage of the native file dialogs and message boxes of the particular desktop environments.</string>
</property>
@ -71,7 +79,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>25</width>
<height>10</height>
@ -101,7 +109,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>25</width>
<height>10</height>
@ -143,7 +151,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>25</width>
<height>10</height>
@ -173,7 +181,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>25</width>
<height>10</height>
@ -203,7 +211,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>25</width>
<height>10</height>
@ -245,7 +253,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>10</width>
<height>20</height>
@ -265,7 +273,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -294,7 +302,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
@ -305,6 +313,14 @@
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>341</height>
</rect>
</property>
<attribute name="title" >
<string>Appea&amp;rance</string>
</attribute>
@ -323,10 +339,7 @@
</property>
<item>
<layout class="QGridLayout" >
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" >
@ -344,7 +357,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -551,7 +564,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -588,7 +601,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -602,10 +615,7 @@
<layout class="QHBoxLayout" >
<item>
<layout class="QGridLayout" >
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
@ -643,7 +653,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -658,7 +668,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
@ -669,6 +679,14 @@
</layout>
</widget>
<widget class="QWidget" name="tabSecurity" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>341</height>
</rect>
</property>
<attribute name="title" >
<string>Security</string>
</attribute>
@ -812,7 +830,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
@ -823,6 +841,14 @@
</layout>
</widget>
<widget class="QWidget" name="tabFeatures" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>341</height>
</rect>
</property>
<attribute name="title" >
<string>Features</string>
</attribute>
@ -849,7 +875,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
@ -860,6 +886,14 @@
</layout>
</widget>
<widget class="QWidget" name="tabIntegration" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>341</height>
</rect>
</property>
<attribute name="title" >
<string>Desktop Integration</string>
</attribute>
@ -939,7 +973,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -961,7 +995,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
@ -972,6 +1006,14 @@
</layout>
</widget>
<widget class="QWidget" name="TabAdvanced" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>584</width>
<height>341</height>
</rect>
</property>
<attribute name="title" >
<string>Advanced</string>
</attribute>
@ -1045,10 +1087,7 @@
<string>Auto-Type Fine Tuning</string>
</property>
<layout class="QGridLayout" >
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="1" >
@ -1079,7 +1118,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -1134,7 +1173,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -1156,7 +1195,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>0</height>
@ -1174,7 +1213,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@ -1213,6 +1252,8 @@
<tabstop>CheckBox_ShowPasswords_PasswordDlg</tabstop>
<tabstop>SpinBox_ClipboardTime</tabstop>
<tabstop>CheckBox_LockMinimize</tabstop>
<tabstop>CheckBox_InactivityLock</tabstop>
<tabstop>SpinBox_InacitivtyTime</tabstop>
<tabstop>CheckBox_FeatureBookmarks</tabstop>
<tabstop>Radio_IntPlugin_None</tabstop>
<tabstop>Radio_IntPlugin_Gnome</tabstop>

@ -94,13 +94,18 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<tabstops>
<tabstop>EditPassword</tabstop>
<tabstop>Button_HidePassword</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

@ -385,10 +385,25 @@ void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
if (!QFile::exists(filename)){
QMessageBox::critical(this,tr("Error")
,tr("The database file does not exist."));
QMessageBox::critical(this, tr("Error"), tr("The database file does not exist."));
return false;
}
if (QFile::exists(filename+".lock")){
QMessageBox::StandardButton buttonPressed = QMessageBox::question(
this,
tr("Database locked"),
tr("The database you are trying to open is locked.\n"
"This means that either someone else has opened the file or KeePassX crashed last time it opened the database.\n\n"
"Do you want to open it anyway?"
),
QMessageBox::Yes|QMessageBox::No,
QMessageBox::No
);
if (buttonPressed != QMessageBox::Yes)
return false;
}
if(!IsAuto){
config->setLastKeyLocation(QString());
config->setLastKeyType(PASSWORD);
@ -418,6 +433,14 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
StatusBarGeneral->setText(tr("Loading Database..."));
db->setKey(dlg.password(),dlg.keyFile());
if(db->load(filename)){
if (!QFile::exists(filename+".lock")){
QFile lock(filename+".lock");
if (!lock.open(QIODevice::WriteOnly)){
QMessageBox::critical(this, tr("Error"), tr("Couldn't create database lock file."));
return false;
}
}
if (IsLocked)
resetLock();
saveLastFilename(filename);
@ -446,13 +469,13 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
}
StatusBarGeneral->setText(tr("Ready"));
inactivityCounter = 0;
return true;
}
void KeepassMainWindow::fakeOpenDatabase(const QString& filename){
if (!QFile::exists(filename)){
QMessageBox::critical(this,tr("Error")
,tr("The database file does not exist."));
QMessageBox::critical(this, tr("Error"), tr("The database file does not exist."));
return;
}
@ -473,13 +496,18 @@ bool KeepassMainWindow::closeDatabase(bool lock){
tr("The current file was modified. Do you want\nto save the changes?"),
QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes);
if(r==QMessageBox::Cancel) return false; //Cancel
if(r==QMessageBox::Yes) //Yes (Save file)
if(r==QMessageBox::Yes){ //Yes (Save file)
if(!OnFileSave()) return false;
}
}
}
db->close();
delete db;
db=NULL;
if (QFile::exists(currentFile+".lock")){
if (!QFile::remove(currentFile+".lock"))
QMessageBox::critical(this, tr("Error"), tr("Couldn't remove database lock file."));
}
EntryView->db=NULL;
EntryView->clear();
EntryView->Items.clear();