mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-04 13:07:38 +03:00
Add ability to expire entries from context menus (#8731)
Closes #1972 Add ability to immediately expire an entry from the context menu --------- Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
parent
832340e209
commit
29ac4da240
16 changed files with 154 additions and 22 deletions
|
@ -374,6 +374,11 @@ void ReportsWidgetHibp::customMenuRequested(QPoint pos)
|
|||
});
|
||||
}
|
||||
|
||||
// Create the "Expire entry" menu item
|
||||
const auto expEntry = new QAction(icons()->icon("entry-expire"), tr("Expire Entry(s)…", "", selected.size()), this);
|
||||
menu->addAction(expEntry);
|
||||
connect(expEntry, &QAction::triggered, this, &ReportsWidgetHibp::expireSelectedEntries);
|
||||
|
||||
// Create the "delete entry" menu item
|
||||
const auto delEntry = new QAction(icons()->icon("entry-delete"), tr("Delete Entry(s)…", "", selected.size()), this);
|
||||
menu->addAction(delEntry);
|
||||
|
@ -411,7 +416,7 @@ void ReportsWidgetHibp::customMenuRequested(QPoint pos)
|
|||
menu->popup(m_ui->hibpTableView->viewport()->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void ReportsWidgetHibp::deleteSelectedEntries()
|
||||
QList<Entry*> ReportsWidgetHibp::getSelectedEntries()
|
||||
{
|
||||
QList<Entry*> selectedEntries;
|
||||
for (auto index : m_ui->hibpTableView->selectionModel()->selectedRows()) {
|
||||
|
@ -421,7 +426,21 @@ void ReportsWidgetHibp::deleteSelectedEntries()
|
|||
selectedEntries << entry;
|
||||
}
|
||||
}
|
||||
return selectedEntries;
|
||||
}
|
||||
|
||||
void ReportsWidgetHibp::expireSelectedEntries()
|
||||
{
|
||||
for (auto entry : getSelectedEntries()) {
|
||||
entry->expireNow();
|
||||
}
|
||||
|
||||
makeHibpTable();
|
||||
}
|
||||
|
||||
void ReportsWidgetHibp::deleteSelectedEntries()
|
||||
{
|
||||
QList<Entry*> selectedEntries = getSelectedEntries();
|
||||
bool permanent = !m_db->metadata()->recycleBinEnabled();
|
||||
if (GuiTools::confirmDeleteEntries(this, selectedEntries, permanent)) {
|
||||
GuiTools::deleteEntriesResolveReferences(this, selectedEntries, permanent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue