mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Allow configuring keyboard shortcuts (#9643)
Closes #2689 The design of the respective code is loosely based on KDE's KActionCollection. The ActionCollection manages all actions that can be shortcut configured. These actions are then exposed in the config and a user can assign a different shortcut. Actions inside the MainWindow have been added to the ActionCollection. --------- Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "ui_ApplicationSettingsWidgetSecurity.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QToolTip>
|
||||
|
||||
#include "config-keepassx.h"
|
||||
|
||||
@@ -138,6 +139,22 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
|
||||
m_secUi->lockDatabaseMinimizeCheckBox->setEnabled(!state);
|
||||
});
|
||||
|
||||
// Set Auto-Type shortcut when changed
|
||||
connect(
|
||||
m_generalUi->autoTypeShortcutWidget, &ShortcutWidget::shortcutChanged, this, [this](auto key, auto modifiers) {
|
||||
QString error;
|
||||
if (autoType()->registerGlobalShortcut(key, modifiers, &error)) {
|
||||
m_generalUi->autoTypeShortcutWidget->setStyleSheet("");
|
||||
} else {
|
||||
QToolTip::showText(mapToGlobal(rect().bottomLeft()), error);
|
||||
m_generalUi->autoTypeShortcutWidget->setStyleSheet("background-color: #FF9696;");
|
||||
}
|
||||
});
|
||||
connect(m_generalUi->autoTypeShortcutWidget, &ShortcutWidget::shortcutReset, this, [this] {
|
||||
autoType()->unregisterGlobalShortcut();
|
||||
m_generalUi->autoTypeShortcutWidget->setStyleSheet("");
|
||||
});
|
||||
|
||||
// Disable mouse wheel grab when scrolling
|
||||
// This prevents combo box and spinner values from changing without explicit focus
|
||||
auto mouseWheelFilter = new MouseWheelEventFilter(this);
|
||||
|
||||
Reference in New Issue
Block a user