give access to the standard config dialog to script engines that care to use it
svn path=/trunk/KDE/kdelibs/; revision=930708
This commit is contained in:
parent
d86a36efa1
commit
830a1d19dd
@ -181,6 +181,7 @@ Applet::~Applet()
|
||||
}
|
||||
}
|
||||
|
||||
// clean up our config dialog, if any
|
||||
delete d;
|
||||
}
|
||||
|
||||
@ -1548,7 +1549,7 @@ void Applet::showConfigurationInterface()
|
||||
} else if (d->script) {
|
||||
d->script->showConfigurationInterface();
|
||||
} else {
|
||||
d->generateGenericConfigDialog();
|
||||
d->generateGenericConfigDialog()->show();
|
||||
}
|
||||
|
||||
emit releaseVisualFocus();
|
||||
@ -1564,7 +1565,7 @@ QString AppletPrivate::configWindowTitle() const
|
||||
return i18nc("@title:window", "%1 Settings", q->name());
|
||||
}
|
||||
|
||||
void AppletPrivate::generateGenericConfigDialog()
|
||||
KConfigDialog *AppletPrivate::generateGenericConfigDialog()
|
||||
{
|
||||
KConfigSkeleton *nullManager = new KConfigSkeleton(0);
|
||||
KConfigDialog *dialog = new KConfigDialog(0, configDialogId(), nullManager);
|
||||
@ -1579,7 +1580,7 @@ void AppletPrivate::generateGenericConfigDialog()
|
||||
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()));
|
||||
QObject::connect(dialog, SIGNAL(finished()), q, SLOT(configDialogFinished()));
|
||||
QObject::connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
|
||||
dialog->show();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
||||
void clearShortcutEditorPtr();
|
||||
void configDialogFinished();
|
||||
void generateGenericConfigDialog();
|
||||
KConfigDialog *generateGenericConfigDialog();
|
||||
QString configDialogId() const;
|
||||
QString configWindowTitle() const;
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "scripting/appletscript.h"
|
||||
|
||||
#include "kconfigdialog.h"
|
||||
|
||||
#include "applet.h"
|
||||
#include "package.h"
|
||||
#include "private/applet_p.h"
|
||||
@ -125,10 +127,19 @@ void AppletScript::configNeedsSaving() const
|
||||
void AppletScript::showConfigurationInterface()
|
||||
{
|
||||
if (applet()) {
|
||||
applet()->d->generateGenericConfigDialog();
|
||||
applet()->d->generateGenericConfigDialog()->show();
|
||||
}
|
||||
}
|
||||
|
||||
KConfigDialog *AppletScript::standardConfigurationDialog()
|
||||
{
|
||||
if (applet()) {
|
||||
return applet()->d->generateGenericConfigDialog();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AppletScript::configChanged()
|
||||
{
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
class QAction;
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
class KConfigDialog;
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
@ -165,6 +166,14 @@ protected:
|
||||
*/
|
||||
const Package *package() const;
|
||||
|
||||
/**
|
||||
* @return a standard Plasma applet configuration dialog, ready
|
||||
* to have pages added to it.
|
||||
*
|
||||
* Note that the dialog returned is set to delete on close.
|
||||
*/
|
||||
KConfigDialog *standardConfigurationDialog();
|
||||
|
||||
private:
|
||||
AppletScriptPrivate *const d;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user