add configChanged to Applet and AppletScript
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=860299
This commit is contained in:
parent
b4818c5cac
commit
11317e0d7e
20
applet.cpp
20
applet.cpp
@ -190,7 +190,7 @@ void Applet::save(KConfigGroup &g) const
|
||||
//which isn't very nice.
|
||||
foreach (ExtenderItem *item, extender()->attachedItems()) {
|
||||
if (!item->isDetached() || item->autoExpireDelay()) {
|
||||
//destroy temporary extender items, or items that aren't detached, so their
|
||||
//destroy temporary extender items, or items that aren't detached, so their
|
||||
//configuration won't linger after a plasma restart.
|
||||
item->destroy();
|
||||
}
|
||||
@ -443,7 +443,7 @@ QGraphicsView *Applet::view() const
|
||||
QGraphicsView *found = 0;
|
||||
QGraphicsView *possibleFind = 0;
|
||||
foreach (QGraphicsView *view, scene()->views()) {
|
||||
kDebug() << "checking" << view->sceneRect() << "against" << sceneBoundingRect()
|
||||
kDebug() << "checking" << view->sceneRect() << "against" << sceneBoundingRect()
|
||||
<< scenePos();
|
||||
if (view->sceneRect().intersects(sceneBoundingRect()) ||
|
||||
view->sceneRect().contains(scenePos())) {
|
||||
@ -651,9 +651,9 @@ bool Applet::hasFailedToLaunch() const
|
||||
|
||||
void Applet::paintWindowFrame(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
|
||||
{
|
||||
Q_UNUSED( painter );
|
||||
Q_UNUSED( option );
|
||||
Q_UNUSED( widget );
|
||||
Q_UNUSED(painter)
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
//Here come the code for the window frame
|
||||
//kDebug() << windowFrameGeometry();
|
||||
//painter->drawRoundedRect(windowFrameGeometry(), 5, 5);
|
||||
@ -1241,12 +1241,21 @@ void Applet::showConfigurationInterface()
|
||||
connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
|
||||
//TODO: Apply button does not correctly work for now, so do not show it
|
||||
dialog->showButton( KDialog::Apply, false );
|
||||
connect(dialog, SIGNAL(applyClicked()), this, SLOT(configChanged()));
|
||||
connect(dialog, SIGNAL(okClicked()), this, SLOT(configChanged()));
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
emit releaseVisualFocus();
|
||||
}
|
||||
|
||||
void Applet::configChanged()
|
||||
{
|
||||
if (d->script) {
|
||||
d->script->configChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
@ -1645,6 +1654,7 @@ void AppletPrivate::setupScriptSupport()
|
||||
// FIXME: KConfigSkeleton doesn't play well with KConfigGroup =/
|
||||
KConfigGroup config = q->config();
|
||||
configXml = new ConfigXml(&config, &file);
|
||||
QObject::connect(configXml, SIGNAL(configChanged()), q, SLOT(configChanged()));
|
||||
}
|
||||
|
||||
if (!package->filePath("mainconfigui").isEmpty()) {
|
||||
|
5
applet.h
5
applet.h
@ -593,6 +593,11 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
||||
**/
|
||||
virtual void init();
|
||||
|
||||
/**
|
||||
* Called when applet configuration values has changed.
|
||||
*/
|
||||
virtual void configChanged();
|
||||
|
||||
/**
|
||||
* Get's called when and extender item has to be initialized after a plasma restart. If you
|
||||
* create ExtenderItems in your applet, you should implement this function to again create
|
||||
|
@ -93,6 +93,7 @@ QPainterPath AppletScript::shape() const
|
||||
|
||||
void AppletScript::setHasConfigurationInterface(bool hasInterface)
|
||||
{
|
||||
Q_UNUSED(hasInterface)
|
||||
if (applet()) {
|
||||
applet()->setHasConfigurationInterface(true);
|
||||
}
|
||||
@ -102,6 +103,10 @@ void AppletScript::showConfigurationInterface()
|
||||
{
|
||||
}
|
||||
|
||||
void AppletScript::configChanged()
|
||||
{
|
||||
}
|
||||
|
||||
DataEngine* AppletScript::dataEngine(const QString &engine) const
|
||||
{
|
||||
Q_ASSERT(d->applet);
|
||||
|
@ -125,6 +125,11 @@ public Q_SLOTS:
|
||||
*/
|
||||
virtual void showConfigurationInterface();
|
||||
|
||||
/**
|
||||
* Configure was changed.
|
||||
*/
|
||||
virtual void configChanged();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @arg engine name of the engine
|
||||
|
Loading…
Reference in New Issue
Block a user