diff --git a/applet.cpp b/applet.cpp index 1be5b9b34..34734c4ea 100644 --- a/applet.cpp +++ b/applet.cpp @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -1805,7 +1804,7 @@ void Applet::showConfigurationInterface() QUiLoader loader; QWidget *w = loader.load(&f); if (w) { - dialog = new KConfigDialog(0, d->configDialogId(), d->configLoader); + dialog = new AppletConfigDialog(0, d->configDialogId(), d->configLoader); dialog->setWindowTitle(d->configWindowTitle()); dialog->setAttribute(Qt::WA_DeleteOnClose, true); dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name())); @@ -1881,7 +1880,7 @@ QSet AppletPrivate::knownCategories() KConfigDialog *AppletPrivate::generateGenericConfigDialog() { KConfigSkeleton *nullManager = new KConfigSkeleton(0); - KConfigDialog *dialog = new KConfigDialog(0, configDialogId(), nullManager); + KConfigDialog *dialog = new AppletConfigDialog(0, configDialogId(), nullManager); dialog->setFaceType(KPageDialog::Auto); dialog->setWindowTitle(configWindowTitle()); dialog->setAttribute(Qt::WA_DeleteOnClose, true); diff --git a/private/applet_p.h b/private/applet_p.h index 5a38a5a46..8020c7f6b 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -26,6 +26,7 @@ #include #include +#include #include "plasma/animator.h" #include "plasma/private/dataengineconsumer_p.h" @@ -47,6 +48,34 @@ class AppletScript; class Wallpaper; class BusyWidget; +class AppletConfigDialog : public KConfigDialog +{ + Q_OBJECT + +public: + AppletConfigDialog(QWidget* parent, const QString &id, KConfigSkeleton *s) + : KConfigDialog(parent, id, s), + m_changed(false) + { + } + +public Q_SLOTS: + void settingsModified(bool modified = true) + { + m_changed = modified; + updateButtons(); + } + +protected: + bool hasChanged() + { + return m_changed || KConfigDialog::hasChanged(); + } + +private: + bool m_changed; +}; + class AppletOverlayWidget : public QGraphicsWidget { Q_OBJECT