From 56f70df273886f020699d296bcb7e3fbea237c09 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Mon, 16 Feb 2015 21:56:48 +0100 Subject: [PATCH] Fix shortcut saving on KDE, and use the system dialog for Frameworks While re-enabling the system dialog for shortcut editing for KF5, I finally figured out why shortcuts where never saved when using KDE; a long standing bug we've had. Turns out QDialog::exec() does not actually save things. All this time I was looking into completely different directions; but it never occured to me that I need to explicitly save after the dialog is accepted (our own dialog does this automatically). This is not a complaint; it was being stupid on my end :) Fixes #1057. --- src/qtui/mainwin.cpp | 7 ++++--- src/uisupport/CMakeLists.txt | 2 +- src/uisupport/actioncollection.cpp | 4 ++-- src/uisupport/actioncollection.h | 19 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 7915c233..b7b1469d 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -41,6 +41,7 @@ #ifdef HAVE_KF5 # include # include +# include #endif #ifdef Q_WS_X11 @@ -145,7 +146,7 @@ #include "settingspages/notificationssettingspage.h" #include "settingspages/topicwidgetsettingspage.h" -#ifndef HAVE_KDE4 +#ifndef HAVE_KDE # include "settingspages/shortcutssettingspage.h" #endif @@ -1368,11 +1369,11 @@ void MainWin::showAboutDlg() void MainWin::showShortcutsDlg() { -#ifdef HAVE_KDE4 +#ifdef HAVE_KDE KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsDisallowed, this); foreach(KActionCollection *coll, QtUi::actionCollections()) dlg.addCollection(coll, coll->property("Category").toString()); - dlg.exec(); + dlg.configure(true); #else SettingsPageDlg dlg(new ShortcutsSettingsPage(QtUi::actionCollections(), this), this); dlg.exec(); diff --git a/src/uisupport/CMakeLists.txt b/src/uisupport/CMakeLists.txt index 0b78acc9..37ea3114 100644 --- a/src/uisupport/CMakeLists.txt +++ b/src/uisupport/CMakeLists.txt @@ -59,5 +59,5 @@ if (WITH_KDE4) endif() if (WITH_KF5) - target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets) + target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets KF5::XmlGui) endif() diff --git a/src/uisupport/actioncollection.cpp b/src/uisupport/actioncollection.cpp index b862ae85..593b236e 100644 --- a/src/uisupport/actioncollection.cpp +++ b/src/uisupport/actioncollection.cpp @@ -20,7 +20,7 @@ * Parts of this implementation are based on KDE's KActionCollection. * ***************************************************************************/ -#ifndef HAVE_KDE4 +#ifndef HAVE_KDE #include #include @@ -305,4 +305,4 @@ bool ActionCollection::unlistAction(QAction *action) } -#endif /* HAVE_KDE4 */ +#endif /* HAVE_KDE */ diff --git a/src/uisupport/actioncollection.h b/src/uisupport/actioncollection.h index a76fc04a..c920adc5 100644 --- a/src/uisupport/actioncollection.h +++ b/src/uisupport/actioncollection.h @@ -20,10 +20,9 @@ * This is a subset of the API of KDE's KActionCollection. * ***************************************************************************/ -#ifndef ACTIONCOLLECTION_H_ -#define ACTIONCOLLECTION_H_ +#pragma once -#ifndef HAVE_KDE4 +#ifndef HAVE_KDE #include #include @@ -123,9 +122,12 @@ private: int ActionCollection::count() const { return actions().count(); } bool ActionCollection::isEmpty() const { return actions().count(); } -#else /* HAVE_KDE4 */ - -#include +#else /* HAVE_KDE */ +# ifdef HAVE_KDE4 +# include +# else +# include +# endif class ActionCollection : public KActionCollection { @@ -135,7 +137,4 @@ public: explicit ActionCollection(QObject *parent) : KActionCollection(parent) {}; }; - -#endif - -#endif +#endif /* HAVE_KDE */ -- 2.20.1