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
This commit is contained in:
parent
f88ca3f4c0
commit
bb80c9616a
|
@ -23,7 +23,10 @@
|
||||||
#include "PasswordGenDlg.h"
|
#include "PasswordGenDlg.h"
|
||||||
#include "EditEntryDlg.h"
|
#include "EditEntryDlg.h"
|
||||||
#include "CalendarDlg.h"
|
#include "CalendarDlg.h"
|
||||||
|
|
||||||
|
#ifdef GLOBAL_AUTOTYPE
|
||||||
#include "TargetWindowDlg.h"
|
#include "TargetWindowDlg.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent, bool modal, bool newEntry)
|
CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* parent, bool modal, bool newEntry)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
|
@ -200,9 +203,10 @@ void CEditEntryDlg::OnButtonOK()
|
||||||
ModFlag=true;
|
ModFlag=true;
|
||||||
|
|
||||||
if(ModFlag){
|
if(ModFlag){
|
||||||
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
entry->setExpire(DateTime_Expire->dateTime());
|
entry->setExpire(DateTime_Expire->dateTime());
|
||||||
entry->setLastAccess(QDateTime::currentDateTime());
|
entry->setLastAccess(now);
|
||||||
entry->setLastMod(QDateTime::currentDateTime());
|
entry->setLastMod(now);
|
||||||
entry->setTitle(Edit_Title->text());
|
entry->setTitle(Edit_Title->text());
|
||||||
entry->setUsername(Edit_UserName->text());
|
entry->setUsername(Edit_UserName->text());
|
||||||
entry->setUrl(Edit_URL->text());
|
entry->setUrl(Edit_URL->text());
|
||||||
|
@ -449,7 +453,7 @@ void CEditEntryDlg::OnSelectTarget(){
|
||||||
QString text = Edit_Comment->toPlainText();
|
QString text = Edit_Comment->toPlainText();
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
text.append("\n");
|
text.append("\n");
|
||||||
Edit_Comment->setPlainText(text.append(dlg.windowTitle()));
|
Edit_Comment->setPlainText(text.append("Auto-Type-Window: "+dlg.windowTitle()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,11 +146,24 @@ void KeepassEntryView::OnDeleteEntry(){
|
||||||
else
|
else
|
||||||
text=tr("Are you sure you want to delete these %1 entries?").arg(entries.size());
|
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)
|
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++){
|
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]));
|
Items.removeAt(Items.indexOf((EntryViewItem*)entries[i]));
|
||||||
delete entries[i];
|
delete entries[i];
|
||||||
}
|
}
|
||||||
|
@ -221,10 +234,10 @@ void KeepassEntryView::editEntry(EntryViewItem* item){
|
||||||
break;
|
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.LastAccess = QDateTime::currentDateTime();
|
||||||
old.LastMod = QDateTime::currentDateTime();
|
old.LastMod = old.LastAccess;
|
||||||
IGroupHandle* bGroup = db->backupGroup();
|
|
||||||
if (bGroup==NULL)
|
if (bGroup==NULL)
|
||||||
emit requestCreateGroup("Backup", 4, NULL);
|
emit requestCreateGroup("Backup", 4, NULL);
|
||||||
if ((bGroup = db->backupGroup())!=NULL)
|
if ((bGroup = db->backupGroup())!=NULL)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#elif defined(Q_WS_WIN)
|
#elif defined(Q_WS_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <wincrypt.h>
|
||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ extern void initStdRand(){
|
||||||
stream << QDateTime::currentDateTime().toTime_t();
|
stream << QDateTime::currentDateTime().toTime_t();
|
||||||
stream << QTime::currentTime().msec();
|
stream << QTime::currentTime().msec();
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
stream << GetCurrentProcessId();
|
stream << (quint32) GetCurrentProcessId();
|
||||||
#else
|
#else
|
||||||
stream << getpid();
|
stream << getpid();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue