[Kde-bindings] branches/KDE/4.3/kdelibs/plasma
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Fri Jul 17 12:32:14 UTC 2009
SVN commit 998324 by rdale:
Add getters and setters for PopupApplet::widget() and PopupApplet::graphicsWidget()
for use in scripting languages. Add a initScriptingExtenderItem() signal for script
engines to connect to and call their versions of Applet::initExtenderItem()
CCMAIL: kde-bindings at kde.org
M +9 -5 applet.cpp
M +5 -0 applet.h
M +18 -2 popupapplet.cpp
M +2 -0 popupapplet.h
M +2 -0 private/popupapplet_p.h
--- branches/KDE/4.3/kdelibs/plasma/applet.cpp #998323:998324
@@ -666,11 +666,15 @@
void Applet::initExtenderItem(ExtenderItem *item)
{
- kWarning() << "Missing implementation of initExtenderItem in the applet "
- << item->config().readEntry("SourceAppletPluginName", "")
- << "!\n Any applet that uses extenders should implement initExtenderItem to "
- << "instantiate a widget. Destroying the item...";
- item->destroy();
+ if (d->script) {
+ emit initScriptExtenderItem(item);
+ } else {
+ kWarning() << "Missing implementation of initExtenderItem in the applet "
+ << item->config().readEntry("SourceAppletPluginName", "")
+ << "!\n Any applet that uses extenders should implement initExtenderItem to "
+ << "instantiate a widget. Destroying the item...";
+ item->destroy();
+ }
}
Extender *Applet::extender() const
--- branches/KDE/4.3/kdelibs/plasma/applet.h #998323:998324
@@ -688,6 +688,11 @@
void appletDestroyed(Plasma::Applet *applet);
+ /**
+ * Emitted when an ExtenderItem in a scripting applet needs to be initialized
+ */
+ void initScriptExtenderItem(Plasma::ExtenderItem *item);
+
public Q_SLOTS:
/**
* Sets the immutability type for this applet (not immutable,
--- branches/KDE/4.3/kdelibs/plasma/popupapplet.cpp #998323:998324
@@ -112,14 +112,28 @@
QWidget *PopupApplet::widget()
{
- return 0;
+ return d->widget;
}
+void PopupApplet::setWidget(QWidget * widget)
+{
+ d->widget = widget;
+}
+
QGraphicsWidget *PopupApplet::graphicsWidget()
{
- return static_cast<Applet*>(this)->d->extender;
+ if (d->graphicsWidget != 0) {
+ return d->graphicsWidget;
+ } else {
+ return static_cast<Applet*>(this)->d->extender;
+ }
}
+void PopupApplet::setGraphicsWidget(QGraphicsWidget * graphicsWidget)
+{
+ d->graphicsWidget = graphicsWidget;
+}
+
void PopupAppletPrivate::checkExtenderAppearance(Plasma::FormFactor f)
{
Extender *extender = qobject_cast<Extender*>(q->graphicsWidget());
@@ -486,6 +500,8 @@
icon(0),
dialog(0),
proxy(0),
+ widget(0),
+ graphicsWidget(0),
popupPlacement(Plasma::FloatingPopup),
savedAspectRatio(Plasma::InvalidAspectRatioMode),
timer(0),
--- branches/KDE/4.3/kdelibs/plasma/popupapplet.h #998323:998324
@@ -76,6 +76,7 @@
* depending on the form factor of the applet.
*/
virtual QWidget *widget();
+ void setWidget(QWidget * widget);
/**
* Implement either this function or widget().
@@ -83,6 +84,7 @@
* depending on the form factor of the applet.
*/
virtual QGraphicsWidget *graphicsWidget();
+ void setGraphicsWidget(QGraphicsWidget * widget);
/**
* @return the placement of the popup relating to the icon
--- branches/KDE/4.3/kdelibs/plasma/private/popupapplet_p.h #998323:998324
@@ -42,6 +42,8 @@
Plasma::IconWidget *icon;
QPointer<Plasma::Dialog> dialog;
QGraphicsProxyWidget *proxy;
+ QWidget *widget;
+ QGraphicsWidget *graphicsWidget;
Plasma::PopupPlacement popupPlacement;
Plasma::AspectRatioMode savedAspectRatio;
QTimer *timer;
More information about the Kde-bindings
mailing list