diff --git a/src/dialogs/EditEntryDlg.cpp b/src/dialogs/EditEntryDlg.cpp index 76fc34a..c4ab1ba 100644 --- a/src/dialogs/EditEntryDlg.cpp +++ b/src/dialogs/EditEntryDlg.cpp @@ -23,7 +23,10 @@ #include "PasswordGenDlg.h" #include "EditEntryDlg.h" #include "CalendarDlg.h" + +#ifdef GLOBAL_AUTOTYPE #include "TargetWindowDlg.h" +#endif CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent, bool modal, bool newEntry) : QDialog(parent) @@ -200,9 +203,10 @@ void CEditEntryDlg::OnButtonOK() ModFlag=true; if(ModFlag){ + QDateTime now = QDateTime::currentDateTime(); entry->setExpire(DateTime_Expire->dateTime()); - entry->setLastAccess(QDateTime::currentDateTime()); - entry->setLastMod(QDateTime::currentDateTime()); + entry->setLastAccess(now); + entry->setLastMod(now); entry->setTitle(Edit_Title->text()); entry->setUsername(Edit_UserName->text()); entry->setUrl(Edit_URL->text()); @@ -449,7 +453,7 @@ void CEditEntryDlg::OnSelectTarget(){ QString text = Edit_Comment->toPlainText(); if (!text.isEmpty()) text.append("\n"); - Edit_Comment->setPlainText(text.append(dlg.windowTitle())); + Edit_Comment->setPlainText(text.append("Auto-Type-Window: "+dlg.windowTitle())); } #endif } diff --git a/src/lib/EntryView.cpp b/src/lib/EntryView.cpp index 6bef2d9..4e95daf 100644 --- a/src/lib/EntryView.cpp +++ b/src/lib/EntryView.cpp @@ -146,11 +146,24 @@ void KeepassEntryView::OnDeleteEntry(){ else text=tr("Are you sure you want to delete these %1 entries?").arg(entries.size()); if(QMessageBox::question(this,tr("Delete?"),text,QMessageBox::Yes | QMessageBox::No,QMessageBox::No)==QMessageBox::No) - return; + return; } + bool backup = false; + IGroupHandle* bGroup; + if (config->backup() && ((EntryViewItem*)entries[0])->EntryHandle->group() != (bGroup=db->backupGroup())) + backup = true; for(int i=0; ideleteEntry(((EntryViewItem*)entries[i])->EntryHandle); + IEntryHandle* entryHandle = ((EntryViewItem*)entries[i])->EntryHandle; + if (backup){ + db->moveEntry(entryHandle, bGroup); + QDateTime now = QDateTime::currentDateTime(); + entryHandle->setLastAccess(now); + entryHandle->setLastMod(now); + } + else{ + db->deleteEntry(entryHandle); + } Items.removeAt(Items.indexOf((EntryViewItem*)entries[i])); delete entries[i]; } @@ -221,10 +234,10 @@ void KeepassEntryView::editEntry(EntryViewItem* item){ break; } - if ((result==1 || result==2) && config->backup()){ + IGroupHandle* bGroup; + if ((result==1 || result==2) && config->backup() && item->EntryHandle->group() != (bGroup=db->backupGroup())){ old.LastAccess = QDateTime::currentDateTime(); - old.LastMod = QDateTime::currentDateTime(); - IGroupHandle* bGroup = db->backupGroup(); + old.LastMod = old.LastAccess; if (bGroup==NULL) emit requestCreateGroup("Backup", 4, NULL); if ((bGroup = db->backupGroup())!=NULL) diff --git a/src/lib/random.cpp b/src/lib/random.cpp index 4602191..98334f0 100644 --- a/src/lib/random.cpp +++ b/src/lib/random.cpp @@ -25,6 +25,7 @@ #include #elif defined(Q_WS_WIN) #include + #include #include #endif @@ -93,7 +94,7 @@ extern void initStdRand(){ stream << QDateTime::currentDateTime().toTime_t(); stream << QTime::currentTime().msec(); #ifdef Q_WS_WIN - stream << GetCurrentProcessId(); + stream << (quint32) GetCurrentProcessId(); #else stream << getpid(); #endif