redirect also the constraintsUpdated(), contextActions() and showConfigurationInterface() methods to the scriptengine.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=781447
This commit is contained in:
parent
3c4a946af7
commit
ae6880bc15
@ -518,6 +518,9 @@ void Applet::constraintsUpdated(Plasma::Constraints constraints)
|
|||||||
// INSTEAD put such code into flushUpdatedConstraints
|
// INSTEAD put such code into flushUpdatedConstraints
|
||||||
Q_UNUSED(constraints)
|
Q_UNUSED(constraints)
|
||||||
//kDebug() << constraints << "constraints are FormFactor: " << formFactor() << ", Location: " << location();
|
//kDebug() << constraints << "constraints are FormFactor: " << formFactor() << ", Location: " << location();
|
||||||
|
if (d->script) {
|
||||||
|
d->script->constraintsUpdated(constraints);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Applet::name() const
|
QString Applet::name() const
|
||||||
@ -848,7 +851,7 @@ Qt::Orientations Applet::expandingDirections() const
|
|||||||
QList<QAction*> Applet::contextActions()
|
QList<QAction*> Applet::contextActions()
|
||||||
{
|
{
|
||||||
//kDebug() << "empty context actions";
|
//kDebug() << "empty context actions";
|
||||||
return QList<QAction*>();
|
return d->script ? d->script->contextActions() : QList<QAction*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor Applet::color() const
|
QColor Applet::color() const
|
||||||
@ -1274,6 +1277,9 @@ void Applet::showConfigurationInterface()
|
|||||||
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
|
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
else if(d->script) {
|
||||||
|
d->script->showConfigurationInterface();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KPluginInfo::List Applet::knownApplets(const QString &category,
|
KPluginInfo::List Applet::knownApplets(const QString &category,
|
||||||
|
@ -75,6 +75,20 @@ QSizeF AppletScript::size() const
|
|||||||
return QSizeF();
|
return QSizeF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppletScript::constraintsUpdated(Plasma::Constraints constraints)
|
||||||
|
{
|
||||||
|
Q_UNUSED(constraints);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QAction*> AppletScript::contextActions()
|
||||||
|
{
|
||||||
|
return QList<QAction*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppletScript::showConfigurationInterface()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
DataEngine* AppletScript::dataEngine(const QString &engine) const
|
DataEngine* AppletScript::dataEngine(const QString &engine) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(d->applet);
|
Q_ASSERT(d->applet);
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <plasma/plasma_export.h>
|
#include <plasma/plasma_export.h>
|
||||||
#include <plasma/scripting/scriptengine.h>
|
#include <plasma/scripting/scriptengine.h>
|
||||||
|
|
||||||
|
class QAction;
|
||||||
class QPainter;
|
class QPainter;
|
||||||
class QStyleOptionGraphicsItem;
|
class QStyleOptionGraphicsItem;
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param painter the QPainter to use
|
* @param painter the QPainter to use
|
||||||
* @param option the style option containing such flags as selection, level of detail, etc
|
* @param option the style option containing such flags as selection, level of detail, etc
|
||||||
**/
|
*/
|
||||||
virtual void paintInterface(QPainter* painter,
|
virtual void paintInterface(QPainter* painter,
|
||||||
const QStyleOptionGraphicsItem* option,
|
const QStyleOptionGraphicsItem* option,
|
||||||
const QRect &contentsRect);
|
const QRect &contentsRect);
|
||||||
@ -77,8 +78,39 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual QSizeF contentSizeHint() const;
|
virtual QSizeF contentSizeHint() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the area within which contents can be painted.
|
||||||
|
**/
|
||||||
Q_INVOKABLE QSizeF size() const;
|
Q_INVOKABLE QSizeF size() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when any of the geometry constraints have been updated.
|
||||||
|
*
|
||||||
|
* This is always called prior to painting and should be used as an
|
||||||
|
* opportunity to layout the widget, calculate sizings, etc.
|
||||||
|
*
|
||||||
|
* Do not call update() from this method; an update() will be triggered
|
||||||
|
* at the appropriate time for the applet.
|
||||||
|
*
|
||||||
|
* @param constraints the type of constraints that were updated
|
||||||
|
*/
|
||||||
|
virtual void constraintsUpdated(Plasma::Constraints constraints);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of context-related QAction instances.
|
||||||
|
*
|
||||||
|
* @return A list of actions. The default implementation returns an
|
||||||
|
* empty list.
|
||||||
|
*/
|
||||||
|
virtual QList<QAction*> contextActions();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a configuration dialog.
|
||||||
|
*/
|
||||||
|
virtual void showConfigurationInterface();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @arg engine name of the engine
|
* @arg engine name of the engine
|
||||||
@ -88,7 +120,7 @@ protected:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return absolute path to the main script file for this plasmoid
|
* @return absolute path to the main script file for this plasmoid
|
||||||
**/
|
*/
|
||||||
QString mainScript() const;
|
QString mainScript() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user