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;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1548,7 +1549,7 @@ void Applet::showConfigurationInterface()
|
|||||||
} else if (d->script) {
|
} else if (d->script) {
|
||||||
d->script->showConfigurationInterface();
|
d->script->showConfigurationInterface();
|
||||||
} else {
|
} else {
|
||||||
d->generateGenericConfigDialog();
|
d->generateGenericConfigDialog()->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit releaseVisualFocus();
|
emit releaseVisualFocus();
|
||||||
@ -1564,7 +1565,7 @@ QString AppletPrivate::configWindowTitle() const
|
|||||||
return i18nc("@title:window", "%1 Settings", q->name());
|
return i18nc("@title:window", "%1 Settings", q->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
void 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 KConfigDialog(0, configDialogId(), nullManager);
|
||||||
@ -1579,7 +1580,7 @@ void AppletPrivate::generateGenericConfigDialog()
|
|||||||
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()));
|
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()));
|
||||||
QObject::connect(dialog, SIGNAL(finished()), q, SLOT(configDialogFinished()));
|
QObject::connect(dialog, SIGNAL(finished()), q, SLOT(configDialogFinished()));
|
||||||
QObject::connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
|
QObject::connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
|
||||||
dialog->show();
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
|
void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
||||||
void clearShortcutEditorPtr();
|
void clearShortcutEditorPtr();
|
||||||
void configDialogFinished();
|
void configDialogFinished();
|
||||||
void generateGenericConfigDialog();
|
KConfigDialog *generateGenericConfigDialog();
|
||||||
QString configDialogId() const;
|
QString configDialogId() const;
|
||||||
QString configWindowTitle() const;
|
QString configWindowTitle() const;
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "scripting/appletscript.h"
|
#include "scripting/appletscript.h"
|
||||||
|
|
||||||
|
#include "kconfigdialog.h"
|
||||||
|
|
||||||
#include "applet.h"
|
#include "applet.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "private/applet_p.h"
|
#include "private/applet_p.h"
|
||||||
@ -125,10 +127,19 @@ void AppletScript::configNeedsSaving() const
|
|||||||
void AppletScript::showConfigurationInterface()
|
void AppletScript::showConfigurationInterface()
|
||||||
{
|
{
|
||||||
if (applet()) {
|
if (applet()) {
|
||||||
applet()->d->generateGenericConfigDialog();
|
applet()->d->generateGenericConfigDialog()->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KConfigDialog *AppletScript::standardConfigurationDialog()
|
||||||
|
{
|
||||||
|
if (applet()) {
|
||||||
|
return applet()->d->generateGenericConfigDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void AppletScript::configChanged()
|
void AppletScript::configChanged()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
class QAction;
|
class QAction;
|
||||||
class QPainter;
|
class QPainter;
|
||||||
class QStyleOptionGraphicsItem;
|
class QStyleOptionGraphicsItem;
|
||||||
|
class KConfigDialog;
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
@ -165,6 +166,14 @@ protected:
|
|||||||
*/
|
*/
|
||||||
const Package *package() const;
|
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:
|
private:
|
||||||
AppletScriptPrivate *const d;
|
AppletScriptPrivate *const d;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user