Move deleted entries to recycle bin if enabled.

This commit is contained in:
Florian Geyer 2012-04-18 21:59:00 +02:00 committed by Felix Geyer
parent 5661f29f7d
commit 8735a4846c
5 changed files with 45 additions and 1 deletions

View file

@ -20,13 +20,16 @@
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QSplitter>
#include <QtGui/QMessageBox>
#include "core/Metadata.h"
#include "gui/ChangeMasterKeyWidget.h"
#include "gui/EditEntryWidget.h"
#include "gui/EditGroupWidget.h"
#include "gui/EntryView.h"
#include "gui/GroupView.h"
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
: QStackedWidget(parent)
, m_db(db)
@ -104,7 +107,20 @@ void DatabaseWidget::createEntry()
void DatabaseWidget::deleteEntry()
{
delete m_entryView->currentEntry();
if (!m_db->metadata()->recycleBinEnabled()) {
QMessageBox::StandardButton result = QMessageBox::question(
this, tr("Question"), tr("Do you really want to delete this entry for good?"),
QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) {
delete m_entryView->currentEntry();
}
else {
return;
}
}
else {
m_db->recycleEntry(m_entryView->currentEntry());
}
}
void DatabaseWidget::createGroup()