Prevent context menu options from disabling with keyboard navigation
* Fixes #2838 * When navigating the entry context menu with up/down arrow the options would disable due to losing focus on the EntryView. This change preserves the "focus" during this event.
This commit is contained in:
@@ -253,6 +253,9 @@ MainWindow::MainWindow()
|
||||
m_ui->actionEntryCopyURL->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
|
||||
connect(m_ui->menuEntries, SIGNAL(aboutToHide()), SLOT(releaseContextFocusLock()));
|
||||
connect(m_ui->menuGroups, SIGNAL(aboutToHide()), SLOT(releaseContextFocusLock()));
|
||||
|
||||
// Control window state
|
||||
new QShortcut(Qt::CTRL + Qt::Key_M, this, SLOT(showMinimized()));
|
||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_M, this, SLOT(hideWindow()));
|
||||
@@ -543,8 +546,8 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
switch (mode) {
|
||||
case DatabaseWidget::Mode::ViewMode: {
|
||||
// bool inSearch = dbWidget->isInSearchMode();
|
||||
bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1 && dbWidget->currentEntryHasFocus();
|
||||
bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0 && dbWidget->currentEntryHasFocus();
|
||||
bool singleEntrySelected = dbWidget->numberOfSelectedEntries() == 1 && (m_contextMenuFocusLock || dbWidget->currentEntryHasFocus());
|
||||
bool entriesSelected = dbWidget->numberOfSelectedEntries() > 0 && (m_contextMenuFocusLock || dbWidget->currentEntryHasFocus());
|
||||
bool groupSelected = dbWidget->isGroupSelected();
|
||||
bool recycleBinSelected = dbWidget->isRecycleBinSelected();
|
||||
|
||||
@@ -985,13 +988,20 @@ void MainWindow::updateTrayIcon()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::releaseContextFocusLock()
|
||||
{
|
||||
m_contextMenuFocusLock = false;
|
||||
}
|
||||
|
||||
void MainWindow::showEntryContextMenu(const QPoint& globalPos)
|
||||
{
|
||||
m_contextMenuFocusLock = true;
|
||||
m_ui->menuEntries->popup(globalPos);
|
||||
}
|
||||
|
||||
void MainWindow::showGroupContextMenu(const QPoint& globalPos)
|
||||
{
|
||||
m_contextMenuFocusLock = true;
|
||||
m_ui->menuGroups->popup(globalPos);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user