provide a (rather hidden, unfortunately) slot for applets and containments to attach custom widgets to to enable/disable a Apply button with. welcome the settingsModified() slot
svn path=/trunk/KDE/kdelibs/; revision=1129003
This commit is contained in:
parent
530c3fe70a
commit
aa5e85e3fa
@ -53,7 +53,6 @@
|
|||||||
#include <kactioncollection.h>
|
#include <kactioncollection.h>
|
||||||
#include <kauthorized.h>
|
#include <kauthorized.h>
|
||||||
#include <kcolorscheme.h>
|
#include <kcolorscheme.h>
|
||||||
#include <kconfigdialog.h>
|
|
||||||
#include <kdialog.h>
|
#include <kdialog.h>
|
||||||
#include <kicon.h>
|
#include <kicon.h>
|
||||||
#include <kiconloader.h>
|
#include <kiconloader.h>
|
||||||
@ -1805,7 +1804,7 @@ void Applet::showConfigurationInterface()
|
|||||||
QUiLoader loader;
|
QUiLoader loader;
|
||||||
QWidget *w = loader.load(&f);
|
QWidget *w = loader.load(&f);
|
||||||
if (w) {
|
if (w) {
|
||||||
dialog = new KConfigDialog(0, d->configDialogId(), d->configLoader);
|
dialog = new AppletConfigDialog(0, d->configDialogId(), d->configLoader);
|
||||||
dialog->setWindowTitle(d->configWindowTitle());
|
dialog->setWindowTitle(d->configWindowTitle());
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
|
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
|
||||||
@ -1881,7 +1880,7 @@ QSet<QString> AppletPrivate::knownCategories()
|
|||||||
KConfigDialog *AppletPrivate::generateGenericConfigDialog()
|
KConfigDialog *AppletPrivate::generateGenericConfigDialog()
|
||||||
{
|
{
|
||||||
KConfigSkeleton *nullManager = new KConfigSkeleton(0);
|
KConfigSkeleton *nullManager = new KConfigSkeleton(0);
|
||||||
KConfigDialog *dialog = new KConfigDialog(0, configDialogId(), nullManager);
|
KConfigDialog *dialog = new AppletConfigDialog(0, configDialogId(), nullManager);
|
||||||
dialog->setFaceType(KPageDialog::Auto);
|
dialog->setFaceType(KPageDialog::Auto);
|
||||||
dialog->setWindowTitle(configWindowTitle());
|
dialog->setWindowTitle(configWindowTitle());
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <QGraphicsProxyWidget>
|
#include <QGraphicsProxyWidget>
|
||||||
|
|
||||||
#include <kactioncollection.h>
|
#include <kactioncollection.h>
|
||||||
|
#include <kconfigdialog.h>
|
||||||
|
|
||||||
#include "plasma/animator.h"
|
#include "plasma/animator.h"
|
||||||
#include "plasma/private/dataengineconsumer_p.h"
|
#include "plasma/private/dataengineconsumer_p.h"
|
||||||
@ -47,6 +48,34 @@ class AppletScript;
|
|||||||
class Wallpaper;
|
class Wallpaper;
|
||||||
class BusyWidget;
|
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
|
class AppletOverlayWidget : public QGraphicsWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user