diff --git a/applet.cpp b/applet.cpp index 2f070b2ca..dcec55a58 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1584,13 +1584,14 @@ void Applet::showConfigurationInterface() } d->addGlobalShortcutsPage(dialog); - connect(dialog, SIGNAL(applyClicked()), this, SLOT(configDialogFinished())); - connect(dialog, SIGNAL(okClicked()), this, SLOT(configDialogFinished())); dialog->show(); } else if (d->script) { d->script->showConfigurationInterface(); } else { - d->generateGenericConfigDialog()->show(); + KConfigDialog *dialog = d->generateGenericConfigDialog(); + createConfigurationInterface(dialog); + d->addGlobalShortcutsPage(dialog); + dialog->show(); } emit releaseVisualFocus(); @@ -1640,12 +1641,6 @@ KConfigDialog *AppletPrivate::generateGenericConfigDialog() dialog->setFaceType(KPageDialog::Auto); dialog->setWindowTitle(configWindowTitle()); dialog->setAttribute(Qt::WA_DeleteOnClose, true); - q->createConfigurationInterface(dialog); - addGlobalShortcutsPage(dialog); - //TODO: Apply button does not correctly work for now, so do not show it - dialog->showButton(KDialog::Apply, false); - QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished())); - QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished())); QObject::connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater())); return dialog; } @@ -1668,6 +1663,11 @@ void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog) layout->addWidget(shortcutEditor); layout->addStretch(); dialog->addPage(page, i18n("Keyboard Shortcut"), "preferences-desktop-keyboard"); + + //TODO: Apply button does not correctly work for now, so do not show it + dialog->showButton(KDialog::Apply, false); + QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished())); + QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished())); } void AppletPrivate::clearShortcutEditorPtr() diff --git a/scripting/appletscript.cpp b/scripting/appletscript.cpp index 0016c40d0..1ede3e02c 100644 --- a/scripting/appletscript.cpp +++ b/scripting/appletscript.cpp @@ -140,6 +140,15 @@ KConfigDialog *AppletScript::standardConfigurationDialog() return 0; } +void AppletScript::addStandardConfigurationPages(KConfigDialog *dialog) +{ + if (applet()) { + return applet()->d->addGlobalShortcutsPage(dialog); + } + + return; +} + void AppletScript::configChanged() { } diff --git a/scripting/appletscript.h b/scripting/appletscript.h index 33f920d93..c2a750795 100644 --- a/scripting/appletscript.h +++ b/scripting/appletscript.h @@ -180,6 +180,12 @@ protected: */ KConfigDialog *standardConfigurationDialog(); + /** + * This method should be called after a scripting applet has added + * its own pages to a configuration dialog + */ + void addStandardConfigurationPages(KConfigDialog *dialog); + private: AppletScriptPrivate *const d; };