mirror of
https://github.com/Bismuth-Forge/bismuth.git
synced 2024-10-05 12:37:47 +03:00
fix(shortcuts_migration): don't override the existing shortcuts
This commit is contained in:
parent
ca5a5e24dd
commit
d2d3cfd89b
@ -9,7 +9,6 @@
|
||||
#include <KConfigGroup>
|
||||
#include <KGlobalAccel>
|
||||
#include <KSharedConfig>
|
||||
#include <qdebug.h>
|
||||
|
||||
namespace Bismuth
|
||||
{
|
||||
@ -30,13 +29,22 @@ void KConfUpdate::moveOldKWinShortcutsToNewBismuthComponent()
|
||||
auto action = QAction();
|
||||
action.setObjectName(oldEntryName);
|
||||
action.setProperty("componentName", QStringLiteral("kwin"));
|
||||
|
||||
globAccel->setShortcut(&action, {});
|
||||
globAccel->removeAllShortcuts(&action);
|
||||
|
||||
auto newAction = QAction();
|
||||
action.setObjectName(newEntryName);
|
||||
action.setProperty("componentName", QStringLiteral("bismuth"));
|
||||
globAccel->setShortcut(&action, oldKeysequence, KGlobalAccel::NoAutoloading);
|
||||
|
||||
auto existingKeysequence = globAccel->globalShortcut(QStringLiteral("bismuth"), newEntryName);
|
||||
|
||||
// Only override the shortcut if it's empty
|
||||
// For some reason KGlobalAccel leaves the empty entries sometimes
|
||||
// Therefore we cannot rely on Autoloading
|
||||
if (existingKeysequence.empty()) {
|
||||
globAccel->setShortcut(&action, oldKeysequence, KGlobalAccel::NoAutoloading);
|
||||
}
|
||||
};
|
||||
|
||||
auto shortcutsrc = KSharedConfig::openConfig("kglobalshortcutsrc");
|
||||
|
Loading…
Reference in New Issue
Block a user