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.
#ifdef HAVE_KF5
# include <KConfigWidgets/KStandardAction>
# include <KXmlGui/KHelpMenu>
#ifdef HAVE_KF5
# include <KConfigWidgets/KStandardAction>
# include <KXmlGui/KHelpMenu>
+# include <KXmlGui/KShortcutsDialog>
#include "settingspages/notificationssettingspage.h"
#include "settingspages/topicwidgetsettingspage.h"
#include "settingspages/notificationssettingspage.h"
#include "settingspages/topicwidgetsettingspage.h"
# include "settingspages/shortcutssettingspage.h"
#endif
# include "settingspages/shortcutssettingspage.h"
#endif
void MainWin::showShortcutsDlg()
{
void MainWin::showShortcutsDlg()
{
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());
#else
SettingsPageDlg dlg(new ShortcutsSettingsPage(QtUi::actionCollections(), this), this);
dlg.exec();
#else
SettingsPageDlg dlg(new ShortcutsSettingsPage(QtUi::actionCollections(), this), this);
dlg.exec();
- target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets)
+ target_link_libraries(mod_uisupport KF5::CoreAddons KF5::TextWidgets KF5::XmlGui)
* Parts of this implementation are based on KDE's KActionCollection. *
***************************************************************************/
* Parts of this implementation are based on KDE's KActionCollection. *
***************************************************************************/
#include <QAction>
#include <QDebug>
#include <QAction>
#include <QDebug>
* 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_
#include <QDebug>
#include <QList>
#include <QDebug>
#include <QList>
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
{
explicit ActionCollection(QObject *parent) : KActionCollection(parent) {};
};
explicit ActionCollection(QObject *parent) : KActionCollection(parent) {};
};