@ -57,7 +57,6 @@
KeepassMainWindow : : KeepassMainWindow ( QWidget * parent , Qt : : WFlags flags ) : QMainWindow ( parent , flags ) {
KeepassMainWindow : : KeepassMainWindow ( QWidget * parent , Qt : : WFlags flags ) : QMainWindow ( parent , flags ) {
Start = true ;
Start = true ;
setupUi ( this ) ;
setupUi ( this ) ;
@ -250,9 +249,12 @@ void KeepassMainWindow::setupMenus(){
}
}
void KeepassMainWindow : : openDatabase ( QString filename , bool s ) {
void KeepassMainWindow : : openDatabase ( QString filename , bool I sAuto ) {
Q_ASSERT ( ! FileOpen ) ;
Q_ASSERT ( ! FileOpen ) ;
CPasswordDialog PasswordDlg ( this , " Password Dialog " , true , s ) ;
if ( ! IsAuto ) {
config . LastKeyLocation = QString ( ) ;
config . LastKeyType = PASSWORD ; }
CPasswordDialog PasswordDlg ( this , " Password Dialog " , true , IsAuto ) ;
PasswordDlg . setCaption ( filename ) ;
PasswordDlg . setCaption ( filename ) ;
int r = PasswordDlg . exec ( ) ;
int r = PasswordDlg . exec ( ) ;
if ( r = = 0 ) return ;
if ( r = = 0 ) return ;
@ -400,9 +402,18 @@ else{
void KeepassMainWindow : : editEntry ( CEntry * pEntry ) {
void KeepassMainWindow : : editEntry ( CEntry * pEntry ) {
CEditEntryDlg dlg ( db , pEntry , this , " EditEntryDialog " , true ) ;
CEditEntryDlg dlg ( db , pEntry , this , " EditEntryDialog " , true ) ;
dlg . exec ( ) ;
switch ( dlg . exec ( ) ) {
EntryView - > refreshItems ( ) ;
case 0 : //canceled or no changes
if ( dlg . ModFlag ) setStateFileModified ( true ) ;
break ;
case 1 : //modifications but same group
EntryView - > refreshItems ( ) ;
setStateFileModified ( true ) ;
break ;
case 2 : //entry moved to another group
EntryView - > updateItems ( currentGroup ( ) - > ID ) ;
setStateFileModified ( true ) ;
break ;
}
}
}
void KeepassMainWindow : : setStateFileModified ( bool mod ) {
void KeepassMainWindow : : setStateFileModified ( bool mod ) {
@ -554,6 +565,7 @@ else Q_ASSERT(false);
bool KeepassMainWindow : : OnFileSave ( ) {
bool KeepassMainWindow : : OnFileSave ( ) {
if ( db - > file - > fileName ( ) = = QString ( ) )
if ( db - > file - > fileName ( ) = = QString ( ) )
return OnFileSaveAs ( ) ;
return OnFileSaveAs ( ) ;
config . LastFile = db - > file - > fileName ( ) ;
if ( db - > saveDatabase ( ) )
if ( db - > saveDatabase ( ) )
setStateFileModified ( false ) ;
setStateFileModified ( false ) ;
else {
else {