mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-02 11:19:30 -05: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
1
COPYING
1
COPYING
@ -178,6 +178,7 @@ Files: share/icons/application/scalable/actions/application-exit.svg
|
||||
share/icons/application/scalable/actions/entry-delete.svg
|
||||
share/icons/application/scalable/actions/entry-restore.svg
|
||||
share/icons/application/scalable/actions/entry-edit.svg
|
||||
share/icons/application/scalable/actions/entry-expire.svg
|
||||
share/icons/application/scalable/actions/entry-new.svg
|
||||
share/icons/application/scalable/actions/favicon-download.svg
|
||||
share/icons/application/scalable/actions/fingerprint.svg
|
||||
|
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9 8H11V14H9V8M13 1H7V3H13V1M17.03 7.39C18.26 8.93 19 10.88 19 13C19 17.97 15 22 10 22C5.03 22 1 17.97 1 13S5.03 4 10 4C12.12 4 14.07 4.74 15.62 6L17.04 4.56C17.55 5 18 5.46 18.45 5.97L17.03 7.39M17 13C17 9.13 13.87 6 10 6S3 9.13 3 13 6.13 20 10 20 17 16.87 17 13M21 7V13H23V7H21M21 17H23V15H21V17Z" /></svg>
|
After Width: | Height: | Size: 377 B |
@ -40,6 +40,7 @@
|
||||
<file>application/scalable/actions/edit-clear-locationbar-rtl.svg</file>
|
||||
<file>application/scalable/actions/entry-clone.svg</file>
|
||||
<file>application/scalable/actions/entry-delete.svg</file>
|
||||
<file>application/scalable/actions/entry-expire.svg</file>
|
||||
<file>application/scalable/actions/entry-restore.svg</file>
|
||||
<file>application/scalable/actions/entry-edit.svg</file>
|
||||
<file>application/scalable/actions/entry-new.svg</file>
|
||||
|
@ -5950,6 +5950,10 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
|
||||
<source>Import Passkey</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remote S&ync…</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quit Application</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -6054,6 +6058,10 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
|
||||
<source>Show Password Generator</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remove Passkey From Entry</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Perform Auto-Type: {USERNAME}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -6198,18 +6206,6 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
|
||||
<source>Toggle Allow Screen Capture</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remote S&ync…</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Remove Passkey From Entry</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Setup Remote Sync…</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show Group Panel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -6218,10 +6214,18 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
|
||||
<source>Toggle Show Group Panel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Setup Remote Sync…</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Password Generator</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>E&xpire Entry…</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ManageDatabase</name>
|
||||
@ -9281,6 +9285,13 @@ This option is deprecated, use --set-key-file instead.</source>
|
||||
<source>Exclude from reports</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Expire Entry(s)…</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Only show entries that have a URL</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -9307,6 +9318,14 @@ This option is deprecated, use --set-key-file instead.</source>
|
||||
</context>
|
||||
<context>
|
||||
<name>ReportsWidgetHealthcheck</name>
|
||||
<message>
|
||||
<source>Show expired entries</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (Expired)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Hover over reason to show additional details. Double-click entries to edit.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
@ -9370,18 +9389,17 @@ This option is deprecated, use --set-key-file instead.</source>
|
||||
<source>Exclude from reports</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show expired entries</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<message numerus="yes">
|
||||
<source>Expire Entry(s)…</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show entries that have been excluded from reports</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source> (Expired)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ReportsWidgetHibp</name>
|
||||
@ -9480,6 +9498,13 @@ This option is deprecated, use --set-key-file instead.</source>
|
||||
<source>Exclude from reports</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message numerus="yes">
|
||||
<source>Expire Entry(s)…</source>
|
||||
<translation type="unfinished">
|
||||
<numerusform></numerusform>
|
||||
<numerusform></numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ReportsWidgetPasskeys</name>
|
||||
|
@ -460,6 +460,12 @@ bool Entry::willExpireInDays(int days) const
|
||||
return m_data.timeInfo.expires() && m_data.timeInfo.expiryTime() < Clock::currentDateTime().addDays(days);
|
||||
}
|
||||
|
||||
void Entry::expireNow()
|
||||
{
|
||||
setExpiryTime(Clock::currentDateTimeUtc());
|
||||
setExpires(true);
|
||||
}
|
||||
|
||||
bool Entry::isRecycled() const
|
||||
{
|
||||
const Database* db = database();
|
||||
|
@ -126,6 +126,7 @@ public:
|
||||
bool hasTotp() const;
|
||||
bool isExpired() const;
|
||||
bool willExpireInDays(int days) const;
|
||||
void expireNow();
|
||||
bool isRecycled() const;
|
||||
bool isAttributeReference(const QString& key) const;
|
||||
bool isAttributeReferenceOf(const QString& key, const QUuid& uuid) const;
|
||||
|
@ -569,6 +569,17 @@ void DatabaseWidget::setupTotp()
|
||||
setupTotpDialog->open();
|
||||
}
|
||||
|
||||
void DatabaseWidget::expireSelectedEntries()
|
||||
{
|
||||
const QModelIndexList selected = m_entryView->selectionModel()->selectedRows();
|
||||
for (const auto& index : selected) {
|
||||
auto entry = m_entryView->entryFromIndex(index);
|
||||
if (entry) {
|
||||
entry->expireNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseWidget::deleteSelectedEntries()
|
||||
{
|
||||
const QModelIndexList selected = m_entryView->selectionModel()->selectedRows();
|
||||
|
@ -180,6 +180,7 @@ public slots:
|
||||
void replaceDatabase(QSharedPointer<Database> db);
|
||||
void createEntry();
|
||||
void cloneEntry();
|
||||
void expireSelectedEntries();
|
||||
void deleteSelectedEntries();
|
||||
void restoreSelectedEntries();
|
||||
void deleteEntries(QList<Entry*> entries, bool confirm = true);
|
||||
|
@ -144,6 +144,7 @@ MainWindow::MainWindow()
|
||||
m_entryContextMenu->addSeparator();
|
||||
#endif
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryEdit);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryExpire);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryClone);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryDelete);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryNew);
|
||||
@ -276,6 +277,7 @@ MainWindow::MainWindow()
|
||||
// Unfortunately, Qt::AA_DontShowShortcutsInContextMenus is broken, have to manually enable them
|
||||
m_ui->actionEntryNew->setShortcutVisibleInContextMenu(true);
|
||||
m_ui->actionEntryEdit->setShortcutVisibleInContextMenu(true);
|
||||
m_ui->actionEntryExpire->setShortcutVisibleInContextMenu(true);
|
||||
m_ui->actionEntryDelete->setShortcutVisibleInContextMenu(true);
|
||||
m_ui->actionEntryRestore->setShortcutVisibleInContextMenu(true);
|
||||
m_ui->actionEntryClone->setShortcutVisibleInContextMenu(true);
|
||||
@ -372,6 +374,7 @@ MainWindow::MainWindow()
|
||||
m_ui->actionEntryNew->setIcon(icons()->icon("entry-new"));
|
||||
m_ui->actionEntryClone->setIcon(icons()->icon("entry-clone"));
|
||||
m_ui->actionEntryEdit->setIcon(icons()->icon("entry-edit"));
|
||||
m_ui->actionEntryExpire->setIcon(icons()->icon("entry-expire"));
|
||||
m_ui->actionEntryDelete->setIcon(icons()->icon("entry-delete"));
|
||||
m_ui->actionEntryRestore->setIcon(icons()->icon("entry-restore"));
|
||||
m_ui->actionEntryAutoType->setIcon(icons()->icon("auto-type"));
|
||||
@ -489,8 +492,9 @@ MainWindow::MainWindow()
|
||||
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(appExit()));
|
||||
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryNew, SIGNAL(triggered()), SLOT(createEntry()));
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryClone, SIGNAL(triggered()), SLOT(cloneEntry()));
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryEdit, SIGNAL(triggered()), SLOT(switchToEntryEdit()));
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryExpire, SIGNAL(triggered()), SLOT(expireSelectedEntries()));
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryClone, SIGNAL(triggered()), SLOT(cloneEntry()));
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryDelete, SIGNAL(triggered()), SLOT(deleteSelectedEntries()));
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryRestore, SIGNAL(triggered()), SLOT(restoreSelectedEntries()));
|
||||
|
||||
@ -912,6 +916,7 @@ void MainWindow::updateMenuActionState()
|
||||
m_ui->actionEntryNew->setEnabled(inDatabase && !inRecycleBin);
|
||||
m_ui->actionEntryClone->setEnabled(singleEntrySelected && !inRecycleBin);
|
||||
m_ui->actionEntryEdit->setEnabled(singleEntrySelected);
|
||||
m_ui->actionEntryExpire->setEnabled(multiEntrySelected);
|
||||
m_ui->actionEntryDelete->setEnabled(multiEntrySelected);
|
||||
m_ui->actionEntryRestore->setVisible(multiEntrySelected && inRecycleBin);
|
||||
m_ui->actionEntryRestore->setEnabled(multiEntrySelected && inRecycleBin);
|
||||
|
@ -321,6 +321,7 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEntryNew"/>
|
||||
<addaction name="actionEntryEdit"/>
|
||||
<addaction name="actionEntryExpire"/>
|
||||
<addaction name="actionEntryClone"/>
|
||||
<addaction name="actionEntryDelete"/>
|
||||
<addaction name="separator"/>
|
||||
@ -544,6 +545,14 @@
|
||||
<string notr="true">Ctrl+E</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEntryExpire">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>E&xpire Entry…</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEntryDelete">
|
||||
<property name="text">
|
||||
<string>&Delete Entry…</string>
|
||||
|
@ -275,6 +275,11 @@ void ReportsWidgetBrowserStatistics::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, &ReportsWidgetBrowserStatistics::expireSelectedEntries);
|
||||
|
||||
// Create the "delete entry" menu item
|
||||
const auto deleteEntry =
|
||||
new QAction(icons()->icon("entry-delete"), tr("Delete Entry(s)…", "", selected.size()), this);
|
||||
@ -327,6 +332,28 @@ void ReportsWidgetBrowserStatistics::saveSettings()
|
||||
// Nothing to do - the tab is passive
|
||||
}
|
||||
|
||||
QList<Entry*> ReportsWidgetBrowserStatistics::getSelectedEntries()
|
||||
{
|
||||
QList<Entry*> selectedEntries;
|
||||
for (auto index : m_ui->browserStatisticsTableView->selectionModel()->selectedRows()) {
|
||||
auto row = m_modelProxy->mapToSource(index).row();
|
||||
auto entry = m_rowToEntry[row].second;
|
||||
if (entry) {
|
||||
selectedEntries << entry;
|
||||
}
|
||||
}
|
||||
return selectedEntries;
|
||||
}
|
||||
|
||||
void ReportsWidgetBrowserStatistics::expireSelectedEntries()
|
||||
{
|
||||
for (auto entry : getSelectedEntries()) {
|
||||
entry->expireNow();
|
||||
}
|
||||
|
||||
calculateBrowserStatistics();
|
||||
}
|
||||
|
||||
void ReportsWidgetBrowserStatistics::deleteSelectedEntries()
|
||||
{
|
||||
const auto& selectedEntries = getSelectedEntries();
|
||||
|
@ -53,6 +53,8 @@ public slots:
|
||||
void calculateBrowserStatistics();
|
||||
void emitEntryActivated(const QModelIndex& index);
|
||||
void customMenuRequested(QPoint);
|
||||
QList<Entry*> getSelectedEntries();
|
||||
void expireSelectedEntries();
|
||||
void deleteSelectedEntries();
|
||||
void deletePluginDataFromSelectedEntries();
|
||||
|
||||
|
@ -323,6 +323,11 @@ void ReportsWidgetHealthcheck::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, &ReportsWidgetHealthcheck::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);
|
||||
@ -365,7 +370,7 @@ void ReportsWidgetHealthcheck::saveSettings()
|
||||
// nothing to do - the tab is passive
|
||||
}
|
||||
|
||||
void ReportsWidgetHealthcheck::deleteSelectedEntries()
|
||||
QList<Entry*> ReportsWidgetHealthcheck::getSelectedEntries()
|
||||
{
|
||||
QList<Entry*> selectedEntries;
|
||||
for (auto index : m_ui->healthcheckTableView->selectionModel()->selectedRows()) {
|
||||
@ -375,7 +380,21 @@ void ReportsWidgetHealthcheck::deleteSelectedEntries()
|
||||
selectedEntries << entry;
|
||||
}
|
||||
}
|
||||
return selectedEntries;
|
||||
}
|
||||
|
||||
void ReportsWidgetHealthcheck::expireSelectedEntries()
|
||||
{
|
||||
for (auto entry : getSelectedEntries()) {
|
||||
entry->expireNow();
|
||||
}
|
||||
|
||||
calculateHealth();
|
||||
}
|
||||
|
||||
void ReportsWidgetHealthcheck::deleteSelectedEntries()
|
||||
{
|
||||
QList<Entry*> selectedEntries = getSelectedEntries();
|
||||
bool permanent = !m_db->metadata()->recycleBinEnabled();
|
||||
if (GuiTools::confirmDeleteEntries(this, selectedEntries, permanent)) {
|
||||
GuiTools::deleteEntriesResolveReferences(this, selectedEntries, permanent);
|
||||
|
@ -53,6 +53,8 @@ public slots:
|
||||
void calculateHealth();
|
||||
void emitEntryActivated(const QModelIndex& index);
|
||||
void customMenuRequested(QPoint);
|
||||
QList<Entry*> getSelectedEntries();
|
||||
void expireSelectedEntries();
|
||||
void deleteSelectedEntries();
|
||||
|
||||
private:
|
||||
|
@ -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);
|
||||
|
@ -58,6 +58,8 @@ public slots:
|
||||
void fetchFailed(const QString& error);
|
||||
void makeHibpTable();
|
||||
void customMenuRequested(QPoint);
|
||||
QList<Entry*> getSelectedEntries();
|
||||
void expireSelectedEntries();
|
||||
void deleteSelectedEntries();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user