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
|
||||
Q_UNUSED(constraints)
|
||||
//kDebug() << constraints << "constraints are FormFactor: " << formFactor() << ", Location: " << location();
|
||||
if (d->script) {
|
||||
d->script->constraintsUpdated(constraints);
|
||||
}
|
||||
}
|
||||
|
||||
QString Applet::name() const
|
||||
@ -848,7 +851,7 @@ Qt::Orientations Applet::expandingDirections() const
|
||||
QList<QAction*> Applet::contextActions()
|
||||
{
|
||||
//kDebug() << "empty context actions";
|
||||
return QList<QAction*>();
|
||||
return d->script ? d->script->contextActions() : QList<QAction*>();
|
||||
}
|
||||
|
||||
QColor Applet::color() const
|
||||
@ -1274,6 +1277,9 @@ void Applet::showConfigurationInterface()
|
||||
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
|
||||
dialog->show();
|
||||
}
|
||||
else if(d->script) {
|
||||
d->script->showConfigurationInterface();
|
||||
}
|
||||
}
|
||||
|
||||
KPluginInfo::List Applet::knownApplets(const QString &category,
|
||||
|
@ -75,6 +75,20 @@ QSizeF AppletScript::size() const
|
||||
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
|
||||
{
|
||||
Q_ASSERT(d->applet);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <plasma/plasma_export.h>
|
||||
#include <plasma/scripting/scriptengine.h>
|
||||
|
||||
class QAction;
|
||||
class QPainter;
|
||||
class QStyleOptionGraphicsItem;
|
||||
|
||||
@ -66,7 +67,7 @@ public:
|
||||
*
|
||||
* @param painter the QPainter to use
|
||||
* @param option the style option containing such flags as selection, level of detail, etc
|
||||
**/
|
||||
*/
|
||||
virtual void paintInterface(QPainter* painter,
|
||||
const QStyleOptionGraphicsItem* option,
|
||||
const QRect &contentsRect);
|
||||
@ -77,8 +78,39 @@ public:
|
||||
*/
|
||||
virtual QSizeF contentSizeHint() const;
|
||||
|
||||
/**
|
||||
* Returns the area within which contents can be painted.
|
||||
**/
|
||||
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:
|
||||
/**
|
||||
* @arg engine name of the engine
|
||||
@ -88,7 +120,7 @@ protected:
|
||||
|
||||
/**
|
||||
* @return absolute path to the main script file for this plasmoid
|
||||
**/
|
||||
*/
|
||||
QString mainScript() const;
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user