Backup deleted entries

Fixed compilation errors on win32

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@233 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 16 years ago
parent f88ca3f4c0
commit bb80c9616a
  1. 10
      src/dialogs/EditEntryDlg.cpp
  2. 23
      src/lib/EntryView.cpp
  3. 3
      src/lib/random.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
}

@ -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; i<entries.size();i++){
db->deleteEntry(((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)

@ -25,6 +25,7 @@
#include <QFile>
#elif defined(Q_WS_WIN)
#include <windows.h>
#include <wincrypt.h>
#include <QSysInfo>
#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