now message overlays are in popup of popupapplets :)
duplication with spinner code still has to be merged svn path=/trunk/KDE/kdelibs/; revision=934846
This commit is contained in:
parent
ca820f5770
commit
5a2a47f473
88
applet.cpp
88
applet.cpp
@ -499,25 +499,44 @@ void AppletPrivate::cleanUpAndDelete()
|
|||||||
|
|
||||||
void AppletPrivate::createMessageOverlay()
|
void AppletPrivate::createMessageOverlay()
|
||||||
{
|
{
|
||||||
if (!messageOverlay) {
|
if (messageOverlay) {
|
||||||
messageOverlay = new AppletOverlayWidget(q);
|
|
||||||
} else {
|
|
||||||
qDeleteAll(messageOverlay->children());
|
qDeleteAll(messageOverlay->children());
|
||||||
messageOverlay->setLayout(0);
|
messageOverlay->setLayout(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
messageOverlay->resize(q->contentsRect().size());
|
PopupApplet *popup = qobject_cast<Plasma::PopupApplet*>(q);
|
||||||
messageOverlay->setPos(q->contentsRect().topLeft());
|
|
||||||
|
|
||||||
// raise the overlay above all the other children!
|
if (!messageOverlay) {
|
||||||
int zValue = 100;
|
if (popup && popup->widget()) {
|
||||||
foreach (QGraphicsItem *child, q->QGraphicsItem::children()) {
|
messageOverlayProxy = new QGraphicsProxyWidget(q);
|
||||||
if (child->zValue() > zValue) {
|
messageOverlayProxy->setWidget(popup->widget());
|
||||||
zValue = child->zValue() + 1;
|
messageOverlay = new AppletOverlayWidget(messageOverlayProxy);
|
||||||
|
} else if (popup && popup->graphicsWidget()) {
|
||||||
|
messageOverlay = new AppletOverlayWidget(popup->graphicsWidget());
|
||||||
|
} else {
|
||||||
|
messageOverlay = new AppletOverlayWidget(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageOverlay->setZValue(zValue);
|
if (popup && popup->widget()) {
|
||||||
|
// popupapplet with widget()
|
||||||
|
messageOverlay->setGeometry(popup->widget()->contentsRect());
|
||||||
|
} else if (popup && popup->graphicsWidget()) {
|
||||||
|
// popupapplet with graphicsWidget()
|
||||||
|
messageOverlay->setGeometry(popup->graphicsWidget()->boundingRect());
|
||||||
|
} else {
|
||||||
|
// normal applet
|
||||||
|
messageOverlay->setGeometry(q->contentsRect());
|
||||||
|
|
||||||
|
// raise the overlay above all the other children!
|
||||||
|
int zValue = 100;
|
||||||
|
foreach (QGraphicsItem *child, q->QGraphicsItem::children()) {
|
||||||
|
if (child->zValue() > zValue) {
|
||||||
|
zValue = child->zValue() + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
messageOverlay->setZValue(zValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletPrivate::destroyMessageOverlay()
|
void AppletPrivate::destroyMessageOverlay()
|
||||||
@ -665,9 +684,9 @@ void Applet::setBusy(bool busy)
|
|||||||
|
|
||||||
if (!d->busyWidget) {
|
if (!d->busyWidget) {
|
||||||
if (popup && popup->widget()) {
|
if (popup && popup->widget()) {
|
||||||
d->popupBusyWidgetProxy = new QGraphicsProxyWidget(this);
|
d->messageOverlayProxy = new QGraphicsProxyWidget(this);
|
||||||
d->popupBusyWidgetProxy->setWidget(popup->widget());
|
d->messageOverlayProxy->setWidget(popup->widget());
|
||||||
d->busyWidget = new Plasma::BusyWidget(d->popupBusyWidgetProxy);
|
d->busyWidget = new Plasma::BusyWidget(d->messageOverlayProxy);
|
||||||
} else if (popup && popup->graphicsWidget()) {
|
} else if (popup && popup->graphicsWidget()) {
|
||||||
d->busyWidget = new Plasma::BusyWidget(popup->graphicsWidget());
|
d->busyWidget = new Plasma::BusyWidget(popup->graphicsWidget());
|
||||||
} else {
|
} else {
|
||||||
@ -704,9 +723,9 @@ void Applet::setBusy(bool busy)
|
|||||||
d->busyWidget->deleteLater();
|
d->busyWidget->deleteLater();
|
||||||
d->busyWidget = 0;
|
d->busyWidget = 0;
|
||||||
|
|
||||||
if (d->popupBusyWidgetProxy) {
|
if (d->messageOverlayProxy) {
|
||||||
delete d->popupBusyWidgetProxy;
|
delete d->messageOverlayProxy;
|
||||||
d->popupBusyWidgetProxy = 0;
|
d->messageOverlayProxy = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -934,28 +953,10 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason)
|
|||||||
//configLayout->setAlignment(explanation, Qt::AlignBottom | Qt::AlignCenter);
|
//configLayout->setAlignment(explanation, Qt::AlignBottom | Qt::AlignCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
//popupapplets in panels just show an icon, otherwise the button is too large
|
PushButton *configWidget = new PushButton(d->messageOverlay);
|
||||||
Plasma::FormFactor f = formFactor();
|
configWidget->setText(i18n("Configure..."));
|
||||||
if (f == Plasma::Horizontal || f == Plasma::Vertical) {
|
connect(configWidget, SIGNAL(clicked()), this, SLOT(showConfigurationInterface()));
|
||||||
IconWidget *configWidget = new IconWidget(d->messageOverlay);
|
configLayout->addItem(configWidget, row, 1);
|
||||||
configWidget->setSvg("widgets/configuration-icons", "configure");
|
|
||||||
configWidget->setDrawBackground(true);
|
|
||||||
connect(configWidget, SIGNAL(clicked()), this, SLOT(showConfigurationInterface()));
|
|
||||||
configLayout->addItem(configWidget, row, 1);
|
|
||||||
// raise the overlay above all the other children!
|
|
||||||
int zValue = 100;
|
|
||||||
foreach (QGraphicsItem *child, QGraphicsItem::children()) {
|
|
||||||
if (child->zValue() > zValue) {
|
|
||||||
zValue = child->zValue() + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
configWidget->setZValue(zValue);
|
|
||||||
} else {
|
|
||||||
PushButton *configWidget = new PushButton(d->messageOverlay);
|
|
||||||
configWidget->setText(i18n("Configure..."));
|
|
||||||
connect(configWidget, SIGNAL(clicked()), this, SLOT(showConfigurationInterface()));
|
|
||||||
configLayout->addItem(configWidget, row, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//configLayout->setAlignment(configWidget, Qt::AlignTop | Qt::AlignCenter);
|
//configLayout->setAlignment(configWidget, Qt::AlignTop | Qt::AlignCenter);
|
||||||
//configLayout->addStretch();
|
//configLayout->addStretch();
|
||||||
@ -2027,7 +2028,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet
|
|||||||
actions(applet),
|
actions(applet),
|
||||||
activationAction(0),
|
activationAction(0),
|
||||||
shortcutEditor(0),
|
shortcutEditor(0),
|
||||||
popupBusyWidgetProxy(0),
|
messageOverlayProxy(0),
|
||||||
constraintsTimerId(0),
|
constraintsTimerId(0),
|
||||||
modificationsTimerId(-1),
|
modificationsTimerId(-1),
|
||||||
hasConfigurationInterface(false),
|
hasConfigurationInterface(false),
|
||||||
@ -2353,8 +2354,13 @@ void AppletOverlayWidget::paint(QPainter *painter,
|
|||||||
|
|
||||||
Applet *applet = qobject_cast<Applet *>(parentWidget());
|
Applet *applet = qobject_cast<Applet *>(parentWidget());
|
||||||
|
|
||||||
|
|
||||||
QPainterPath backgroundShape;
|
QPainterPath backgroundShape;
|
||||||
if (applet->backgroundHints() & Applet::StandardBackground) {
|
if (!applet || applet->backgroundHints() & Applet::StandardBackground) {
|
||||||
|
//FIXME: a resize here is nasty, but perhaps still better than an eventfilter just for that..
|
||||||
|
if (parentWidget()->size() != size()) {
|
||||||
|
resize(parentWidget()->size());
|
||||||
|
}
|
||||||
backgroundShape = PaintUtils::roundedRectangle(parentWidget()->contentsRect(), 5);
|
backgroundShape = PaintUtils::roundedRectangle(parentWidget()->contentsRect(), 5);
|
||||||
} else {
|
} else {
|
||||||
backgroundShape = parentItem()->shape();
|
backgroundShape = parentItem()->shape();
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
KActionCollection actions;
|
KActionCollection actions;
|
||||||
KAction *activationAction;
|
KAction *activationAction;
|
||||||
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
||||||
QGraphicsProxyWidget *popupBusyWidgetProxy;
|
QGraphicsProxyWidget *messageOverlayProxy;
|
||||||
int constraintsTimerId;
|
int constraintsTimerId;
|
||||||
int modificationsTimerId;
|
int modificationsTimerId;
|
||||||
bool hasConfigurationInterface : 1;
|
bool hasConfigurationInterface : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user