From kde-commits Sat Feb 28 22:52:18 2009 From: Artur Duque de Souza Date: Sat, 28 Feb 2009 22:52:18 +0000 To: kde-commits Subject: KDE/kdelibs/plasma Message-Id: <1235861538.002016.32560.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123586154802034 SVN commit 933444 by asouza: Changes inside Plasma::Applet to test if we have a popup and if this is true, if we should use widget() or graphicsWidget() to show the BusyWidget. M +40 -7 applet.cpp M +3 -0 private/applet_p.h --- trunk/KDE/kdelibs/plasma/applet.cpp #933443:933444 @@ -523,8 +523,6 @@ void AppletPrivate::destroyMessageOverlay() { //TODO: fade out? =) - QGraphicsWidget *w = messageOverlay; - messageOverlay->destroy(); messageOverlay = 0; @@ -663,19 +661,53 @@ void Applet::setBusy(bool busy) { if (busy) { + PopupApplet *popup = qobject_cast(this); + if (!d->busyWidget) { - d->busyWidget = new Plasma::BusyWidget(this); + if (popup && popup->widget()) { + d->popupBusyWidgetProxy = new QGraphicsProxyWidget(this); + d->popupBusyWidgetProxy->setWidget(popup->widget()); + d->busyWidget = new Plasma::BusyWidget(d->popupBusyWidgetProxy); + } else if (popup && popup->graphicsWidget()) { + d->busyWidget = new Plasma::BusyWidget(popup->graphicsWidget()); + } else { + d->busyWidget = new Plasma::BusyWidget(this); + } } else { d->busyWidget->show(); } - int busySize = qMin(size().width(), size().height())/3; - QRect busyRect(0, 0, busySize, busySize); - busyRect.moveCenter(boundingRect().center().toPoint()); - d->busyWidget->setGeometry(busyRect); + + if (popup && popup->widget()) { + // popupapplet with widget() + int busySize = qMin(popup->widget()->size().width(), + popup->widget()->size().height())/3; + QRect busyRect(0, 0, busySize, busySize); + busyRect.moveCenter(popup->widget()->contentsRect().center()); + d->busyWidget->setGeometry(busyRect); + } else if (popup && popup->graphicsWidget()) { + // popupapplet with graphicsWidget() + int busySize = qMin(popup->graphicsWidget()->size().width(), + popup->graphicsWidget()->size().height())/3; + QRect busyRect(0, 0, busySize, busySize); + busyRect.moveCenter(popup->graphicsWidget()->boundingRect().center().toPoint()); + d->busyWidget->setGeometry(busyRect); + } else { + // normal applet + int busySize = qMin(size().width(), size().height())/3; + QRect busyRect(0, 0, busySize, busySize); + busyRect.moveCenter(boundingRect().center().toPoint()); + d->busyWidget->setGeometry(busyRect); + } + } else if (d->busyWidget) { d->busyWidget->hide(); d->busyWidget->deleteLater(); d->busyWidget = 0; + + if (d->popupBusyWidgetProxy) { + delete d->popupBusyWidgetProxy; + d->popupBusyWidgetProxy = 0; + } } } @@ -1995,6 +2027,7 @@ actions(applet), activationAction(0), shortcutEditor(0), + popupBusyWidgetProxy(0), constraintsTimerId(0), modificationsTimerId(-1), hasConfigurationInterface(false), --- trunk/KDE/kdelibs/plasma/private/applet_p.h #933443:933444 @@ -22,6 +22,8 @@ #ifndef PLASMA_APPLET_P_H #define PLASMA_APPLET_P_H +#include + #include class KKeySequenceWidget; @@ -116,6 +118,7 @@ KActionCollection actions; KAction *activationAction; KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there + QGraphicsProxyWidget *popupBusyWidgetProxy; int constraintsTimerId; int modificationsTimerId; bool hasConfigurationInterface : 1;