mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-06-07 06:22:44 -04:00
Add requested source code changes
This commit is contained in:
parent
dea65b637c
commit
75c16d1cbb
6 changed files with 34 additions and 30 deletions
|
@ -308,6 +308,22 @@ void Database::recycleGroup(Group* group)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Database::emptyRecycleBin()
|
||||||
|
{
|
||||||
|
if (m_metadata->recycleBinEnabled() && m_metadata->recycleBin()) {
|
||||||
|
// destroying direct entries of the recycle bin
|
||||||
|
QList<Entry*> subEntries = m_metadata->recycleBin()->entries();
|
||||||
|
for (Entry* entry : subEntries) {
|
||||||
|
delete entry;
|
||||||
|
}
|
||||||
|
// destroying direct subgroups of the recycle bin
|
||||||
|
QList<Group*> subGroups = m_metadata->recycleBin()->children();
|
||||||
|
for (Group* group : subGroups) {
|
||||||
|
delete group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Database::merge(const Database* other)
|
void Database::merge(const Database* other)
|
||||||
{
|
{
|
||||||
m_rootGroup->merge(other->rootGroup());
|
m_rootGroup->merge(other->rootGroup());
|
||||||
|
|
|
@ -108,6 +108,7 @@ public:
|
||||||
bool verifyKey(const CompositeKey& key) const;
|
bool verifyKey(const CompositeKey& key) const;
|
||||||
void recycleEntry(Entry* entry);
|
void recycleEntry(Entry* entry);
|
||||||
void recycleGroup(Group* group);
|
void recycleGroup(Group* group);
|
||||||
|
void emptyRecycleBin();
|
||||||
void setEmitModified(bool value);
|
void setEmitModified(bool value);
|
||||||
void copyAttributesFrom(const Database* other);
|
void copyAttributesFrom(const Database* other);
|
||||||
void merge(const Database* other);
|
void merge(const Database* other);
|
||||||
|
|
|
@ -1273,32 +1273,19 @@ bool DatabaseWidget::isRecycleBinSelected() const
|
||||||
return m_groupView->currentGroup() && m_groupView->currentGroup() == m_db->metadata()->recycleBin();
|
return m_groupView->currentGroup() && m_groupView->currentGroup() == m_db->metadata()->recycleBin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseWidget::emptyTrash()
|
void DatabaseWidget::emptyRecycleBin()
|
||||||
{
|
{
|
||||||
Group* currentGroup = m_groupView->currentGroup();
|
if(!isRecycleBinSelected()) {
|
||||||
if (!currentGroup) {
|
|
||||||
Q_ASSERT(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentGroup == m_db->metadata()->recycleBin()) {
|
QMessageBox::StandardButton result = MessageBox::question(
|
||||||
QMessageBox::StandardButton result = MessageBox::question(
|
this, tr("Empty recycle bin?"),
|
||||||
this, tr("Empty recycle bin?"),
|
tr("Are you sure you want to permanently delete everything from your recycle bin?"),
|
||||||
tr("Are you sure you want to permanently delete everytning from your recycle bin?"),
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
|
||||||
|
|
||||||
if (result == QMessageBox::Yes) {
|
if (result == QMessageBox::Yes) {
|
||||||
// destroying direct entries of the recycle bin
|
m_db->emptyRecycleBin();
|
||||||
QList<Entry*> subEntries = currentGroup->entries();
|
refreshSearch();
|
||||||
for (Entry* entry : subEntries) {
|
|
||||||
delete entry;
|
|
||||||
}
|
|
||||||
// destroying direct subgroups of the recycle bin
|
|
||||||
QList<Group*> subGroups = currentGroup->children();
|
|
||||||
for (Group* group : subGroups) {
|
|
||||||
delete group;
|
|
||||||
}
|
|
||||||
refreshSearch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ public slots:
|
||||||
void switchToImportKeepass1(const QString& fileName);
|
void switchToImportKeepass1(const QString& fileName);
|
||||||
void databaseModified();
|
void databaseModified();
|
||||||
void databaseSaved();
|
void databaseSaved();
|
||||||
void emptyTrash();
|
void emptyRecycleBin();
|
||||||
|
|
||||||
// Search related slots
|
// Search related slots
|
||||||
void search(const QString& searchtext);
|
void search(const QString& searchtext);
|
||||||
|
|
|
@ -197,7 +197,7 @@ MainWindow::MainWindow()
|
||||||
m_ui->actionGroupNew->setIcon(filePath()->icon("actions", "group-new", false));
|
m_ui->actionGroupNew->setIcon(filePath()->icon("actions", "group-new", false));
|
||||||
m_ui->actionGroupEdit->setIcon(filePath()->icon("actions", "group-edit", false));
|
m_ui->actionGroupEdit->setIcon(filePath()->icon("actions", "group-edit", false));
|
||||||
m_ui->actionGroupDelete->setIcon(filePath()->icon("actions", "group-delete", false));
|
m_ui->actionGroupDelete->setIcon(filePath()->icon("actions", "group-delete", false));
|
||||||
m_ui->actionGroupEmptyTrash->setIcon(filePath()->icon("actions", "group-empty-trash", false));
|
m_ui->actionGroupEmptyRecycleBin->setIcon(filePath()->icon("actions", "group-empty-trash", false));
|
||||||
|
|
||||||
m_ui->actionSettings->setIcon(filePath()->icon("actions", "configure"));
|
m_ui->actionSettings->setIcon(filePath()->icon("actions", "configure"));
|
||||||
m_ui->actionSettings->setMenuRole(QAction::PreferencesRole);
|
m_ui->actionSettings->setMenuRole(QAction::PreferencesRole);
|
||||||
|
@ -296,8 +296,8 @@ MainWindow::MainWindow()
|
||||||
SLOT(switchToGroupEdit()));
|
SLOT(switchToGroupEdit()));
|
||||||
m_actionMultiplexer.connect(m_ui->actionGroupDelete, SIGNAL(triggered()),
|
m_actionMultiplexer.connect(m_ui->actionGroupDelete, SIGNAL(triggered()),
|
||||||
SLOT(deleteGroup()));
|
SLOT(deleteGroup()));
|
||||||
m_actionMultiplexer.connect(m_ui->actionGroupEmptyTrash, SIGNAL(triggered()),
|
m_actionMultiplexer.connect(m_ui->actionGroupEmptyRecycleBin, SIGNAL(triggered()),
|
||||||
SLOT(emptyTrash()));
|
SLOT(emptyRecycleBin()));
|
||||||
|
|
||||||
connect(m_ui->actionSettings, SIGNAL(triggered()), SLOT(switchToSettings()));
|
connect(m_ui->actionSettings, SIGNAL(triggered()), SLOT(switchToSettings()));
|
||||||
connect(m_ui->actionPasswordGenerator, SIGNAL(toggled(bool)), SLOT(switchToPasswordGen(bool)));
|
connect(m_ui->actionPasswordGenerator, SIGNAL(toggled(bool)), SLOT(switchToPasswordGen(bool)));
|
||||||
|
@ -433,8 +433,8 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||||
m_ui->actionGroupNew->setEnabled(groupSelected);
|
m_ui->actionGroupNew->setEnabled(groupSelected);
|
||||||
m_ui->actionGroupEdit->setEnabled(groupSelected);
|
m_ui->actionGroupEdit->setEnabled(groupSelected);
|
||||||
m_ui->actionGroupDelete->setEnabled(groupSelected && dbWidget->canDeleteCurrentGroup());
|
m_ui->actionGroupDelete->setEnabled(groupSelected && dbWidget->canDeleteCurrentGroup());
|
||||||
m_ui->actionGroupEmptyTrash->setVisible(recycleBinSelected);
|
m_ui->actionGroupEmptyRecycleBin->setVisible(recycleBinSelected);
|
||||||
m_ui->actionGroupEmptyTrash->setEnabled(recycleBinSelected);
|
m_ui->actionGroupEmptyRecycleBin->setEnabled(recycleBinSelected);
|
||||||
m_ui->actionChangeMasterKey->setEnabled(true);
|
m_ui->actionChangeMasterKey->setEnabled(true);
|
||||||
m_ui->actionChangeDatabaseSettings->setEnabled(true);
|
m_ui->actionChangeDatabaseSettings->setEnabled(true);
|
||||||
m_ui->actionDatabaseSave->setEnabled(true);
|
m_ui->actionDatabaseSave->setEnabled(true);
|
||||||
|
|
|
@ -238,7 +238,7 @@
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionGroupEdit"/>
|
<addaction name="actionGroupEdit"/>
|
||||||
<addaction name="actionGroupDelete"/>
|
<addaction name="actionGroupDelete"/>
|
||||||
<addaction name="actionGroupEmptyTrash"/>
|
<addaction name="actionGroupEmptyRecycleBin"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuTools">
|
<widget class="QMenu" name="menuTools">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -523,7 +523,7 @@
|
||||||
<string>Re&pair database</string>
|
<string>Re&pair database</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionGroupEmptyTrash">
|
<action name="actionGroupEmptyRecycleBin">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Empty recycle bin</string>
|
<string>Empty recycle bin</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue