mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add special context menu for entries
* Fixes #2813 Added special context menu for entries to move the most-used actions to the top. Re-ordered actions in the entry menu to be more user friendly.
This commit is contained in:
parent
56a3e4d680
commit
936bda8f71
@ -168,6 +168,21 @@ MainWindow::MainWindow()
|
||||
|
||||
m_countDefaultAttributes = m_ui->menuEntryCopyAttribute->actions().size();
|
||||
|
||||
m_entryContextMenu = new QMenu(this);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryCopyUsername);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryCopyPassword);
|
||||
m_entryContextMenu->addAction(m_ui->menuEntryCopyAttribute->menuAction());
|
||||
m_entryContextMenu->addAction(m_ui->menuEntryTotp->menuAction());
|
||||
m_entryContextMenu->addSeparator();
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryAutoType);
|
||||
m_entryContextMenu->addSeparator();
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryEdit);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryClone);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryDelete);
|
||||
m_entryContextMenu->addSeparator();
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryOpenUrl);
|
||||
m_entryContextMenu->addAction(m_ui->actionEntryDownloadIcon);
|
||||
|
||||
restoreGeometry(config()->get("GUI/MainWindowGeometry").toByteArray());
|
||||
restoreState(config()->get("GUI/MainWindowState").toByteArray());
|
||||
#ifdef WITH_XC_BROWSER
|
||||
@ -639,6 +654,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
case DatabaseWidget::Mode::EditMode:
|
||||
case DatabaseWidget::Mode::ImportMode:
|
||||
case DatabaseWidget::Mode::LockedMode: {
|
||||
// Enable select actions when editing an entry
|
||||
bool editEntryActive = dbWidget->isEntryEditActive();
|
||||
const auto editEntryActionsMask = QList<QAction*>({m_ui->actionEntryCopyUsername,
|
||||
m_ui->actionEntryCopyPassword,
|
||||
@ -656,7 +672,6 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
entryActions << m_ui->menuEntryCopyAttribute->actions();
|
||||
entryActions << m_ui->menuEntryTotp->actions();
|
||||
for (auto action : entryActions) {
|
||||
// Enable select actions when editing an entry
|
||||
bool enabled = editEntryActive && editEntryActionsMask.contains(action);
|
||||
if (action->menu()) {
|
||||
action->menu()->setEnabled(enabled);
|
||||
@ -1110,7 +1125,7 @@ void MainWindow::releaseContextFocusLock()
|
||||
|
||||
void MainWindow::showEntryContextMenu(const QPoint& globalPos)
|
||||
{
|
||||
m_ui->menuEntries->popup(globalPos);
|
||||
m_entryContextMenu->popup(globalPos);
|
||||
}
|
||||
|
||||
void MainWindow::showGroupContextMenu(const QPoint& globalPos)
|
||||
|
@ -146,6 +146,7 @@ private:
|
||||
SignalMultiplexer m_actionMultiplexer;
|
||||
QAction* m_clearHistoryAction;
|
||||
QAction* m_searchWidgetAction;
|
||||
QMenu* m_entryContextMenu;
|
||||
QActionGroup* m_lastDatabasesActions;
|
||||
QActionGroup* m_copyAdditionalAttributeActions;
|
||||
InactivityTimer* m_inactivityTimer;
|
||||
|
@ -195,7 +195,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>20</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
@ -298,11 +298,11 @@
|
||||
<addaction name="actionEntryCopyUsername"/>
|
||||
<addaction name="actionEntryCopyPassword"/>
|
||||
<addaction name="menuEntryCopyAttribute"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuEntryTotp"/>
|
||||
<addaction name="actionEntryOpenUrl"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEntryAutoType"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEntryOpenUrl"/>
|
||||
<addaction name="actionEntryDownloadIcon"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuGroups">
|
||||
|
Loading…
Reference in New Issue
Block a user