Fix shortcut saving on KDE, and use the system dialog for Frameworks
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 16 Feb 2015 20:56:48 +0000 (21:56 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 16 Feb 2015 20:56:48 +0000 (21:56 +0100)
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
src/uisupport/CMakeLists.txt
src/uisupport/actioncollection.cpp
src/uisupport/actioncollection.h

index 7915c23..b7b1469 100644 (file)
@@ -41,6 +41,7 @@
 #ifdef HAVE_KF5
 #  include <KConfigWidgets/KStandardAction>
 #  include <KXmlGui/KHelpMenu>
 #ifdef HAVE_KF5
 #  include <KConfigWidgets/KStandardAction>
 #  include <KXmlGui/KHelpMenu>
+#  include <KXmlGui/KShortcutsDialog>
 #endif
 
 #ifdef Q_WS_X11
 #endif
 
 #ifdef Q_WS_X11
 #include "settingspages/notificationssettingspage.h"
 #include "settingspages/topicwidgetsettingspage.h"
 
 #include "settingspages/notificationssettingspage.h"
 #include "settingspages/topicwidgetsettingspage.h"
 
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
 #  include "settingspages/shortcutssettingspage.h"
 #endif
 
 #  include "settingspages/shortcutssettingspage.h"
 #endif
 
@@ -1368,11 +1369,11 @@ void MainWin::showAboutDlg()
 
 void MainWin::showShortcutsDlg()
 {
 
 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());
     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();
 #else
     SettingsPageDlg dlg(new ShortcutsSettingsPage(QtUi::actionCollections(), this), this);
     dlg.exec();
index 0b78acc..37ea311 100644 (file)
@@ -59,5 +59,5 @@ if (WITH_KDE4)
 endif()
 
 if (WITH_KF5)
 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()
 endif()
index b862ae8..593b236 100644 (file)
@@ -20,7 +20,7 @@
  * Parts of this implementation are based on KDE's KActionCollection.      *
  ***************************************************************************/
 
  * Parts of this implementation are based on KDE's KActionCollection.      *
  ***************************************************************************/
 
-#ifndef HAVE_KDE4
+#ifndef HAVE_KDE
 
 #include <QAction>
 #include <QDebug>
 
 #include <QAction>
 #include <QDebug>
@@ -305,4 +305,4 @@ bool ActionCollection::unlistAction(QAction *action)
 }
 
 
 }
 
 
-#endif /* HAVE_KDE4 */
+#endif /* HAVE_KDE */
index a76fc04..c920adc 100644 (file)
  * This is a subset of the API of KDE's KActionCollection.                 *
  ***************************************************************************/
 
  * 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 <QDebug>
 #include <QList>
 
 #include <QDebug>
 #include <QList>
@@ -123,9 +122,12 @@ private:
 int ActionCollection::count() const { return actions().count(); }
 bool ActionCollection::isEmpty() const { return actions().count(); }
 
 int ActionCollection::count() const { return actions().count(); }
 bool ActionCollection::isEmpty() const { return actions().count(); }
 
-#else /* HAVE_KDE4 */
-
-#include <KActionCollection>
+#else /* HAVE_KDE */
+#  ifdef HAVE_KDE4
+#    include <KActionCollection>
+#  else
+#    include <KXmlGui/KActionCollection>
+#  endif
 
 class ActionCollection : public KActionCollection
 {
 
 class ActionCollection : public KActionCollection
 {
@@ -135,7 +137,4 @@ public:
     explicit ActionCollection(QObject *parent) : KActionCollection(parent) {};
 };
 
     explicit ActionCollection(QObject *parent) : KActionCollection(parent) {};
 };
 
-
-#endif
-
-#endif
+#endif /* HAVE_KDE */