[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/plasma
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2009-09-12 0:19:45
Message-ID: 1252714785.631738.12968.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1022543 by aseigo:
if the applet is a popup applet and is in the panel and has a dialog then show \
messages in a popup as well
M +60 -10 applet.cpp
M +2 -0 private/applet_p.h
--- trunk/KDE/kdelibs/plasma/applet.cpp #1022542:1022543
@@ -69,6 +69,7 @@
#include "containment.h"
#include "corona.h"
#include "dataenginemanager.h"
+#include "dialog.h"
#include "extenders/extender.h"
#include "extenders/extenderitem.h"
#include "package.h"
@@ -577,7 +578,12 @@
void AppletPrivate::destroyMessageOverlay()
{
- //TODO: fade out? =)
+ if (messageDialog) {
+ messageDialog->animatedHide(Plasma::locationToInverseDirection(q->location()));
+ //messageDialog->deleteLater();
+ messageDialog = 0;
+ }
+
if (!messageOverlay) {
return;
}
@@ -998,9 +1004,39 @@
return;
}
- d->createMessageOverlay();
- d->messageOverlay->opacity = 0.8;
- QGraphicsLinearLayout *mainLayout = new \
QGraphicsLinearLayout(d->messageOverlay); + Corona *corona = qobject_cast<Corona \
*>(scene()); + PopupApplet *popup = qobject_cast<Plasma::PopupApplet*>(this);
+ QGraphicsWidget *parent = 0;
+ FormFactor f = formFactor();
+
+ if (popup && popup->d->dialog &&
+ (f == Plasma::Horizontal || f == Plasma::Vertical)) {
+ // we are a popup applet, and we are collapsed to an icon, so show it in a \
dialog + // associated with ourselves
+ parent = new QGraphicsWidget;
+ if (corona) {
+ corona->addOffscreenWidget(parent);
+ }
+
+ if (d->messageDialog) {
+ delete d->messageDialog->graphicsWidget();
+ } else {
+ d->messageDialog = new Plasma::Dialog;
+ }
+
+ ToolTipManager::self()->hide(this);
+ KWindowSystem::setOnAllDesktops(d->messageDialog->winId(), true);
+ KWindowSystem::setState(d->messageDialog->winId(), NET::SkipTaskbar | \
NET::SkipPager); +
+ connect(d->messageDialog, SIGNAL(destroyed(QObject*)), parent, \
SLOT(deleteLater())); + } else {
+ delete d->messageDialog;
+ d->createMessageOverlay();
+ d->messageOverlay->opacity = 0.8;
+ parent = d->messageOverlay;
+ }
+
+ QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(parent);
mainLayout->setOrientation(Qt::Vertical);
mainLayout->addStretch();
@@ -1026,7 +1062,6 @@
messageIcon->setIcon(icon);
messageText->setText(message);
-
buttonLayout->addStretch();
if (buttons & ButtonOk) {
@@ -1035,18 +1070,21 @@
buttonLayout->addItem(ok);
connect(ok, SIGNAL(clicked()), this, SLOT(destroyMessageOverlay()));
}
+
if (buttons & ButtonYes) {
PushButton *yes = new PushButton(this);
yes->setText(i18n("Yes"));
buttonLayout->addItem(yes);
connect(yes, SIGNAL(clicked()), this, SLOT(destroyMessageOverlay()));
}
+
if (buttons & ButtonNo) {
PushButton *no = new PushButton(this);
no->setText(i18n("No"));
buttonLayout->addItem(no);
connect(no, SIGNAL(clicked()), this, SLOT(destroyMessageOverlay()));
}
+
if (buttons & ButtonCancel) {
PushButton *cancel = new PushButton(this);
cancel->setText(i18n("Cancel"));
@@ -1055,9 +1093,21 @@
}
buttonLayout->addStretch();
+ if (d->messageDialog) {
+ parent->adjustSize();
+ d->messageDialog->setGraphicsWidget(parent);
- d->messageOverlay->show();
+ QPoint pos = geometry().topLeft().toPoint();
+ if (corona) {
+ pos = corona->popupPosition(this, d->messageDialog->size());
+ }
+ d->messageDialog->move(pos);
+ kDebug() << location() << locationToDirection(location()) << LeftEdge << \
Right; + d->messageDialog->animatedShow(locationToDirection(location()));
+ } else {
+ d->messageOverlay->show();
+ }
}
QVariantList Applet::startupArguments() const
@@ -1655,9 +1705,7 @@
}
d->addGlobalShortcutsPage(dialog);
-#ifdef ENABLE_REMOTE_WIDGETS
d->addPublishPage(dialog);
-#endif
dialog->show();
} else if (d->script) {
d->script->showConfigurationInterface();
@@ -1716,9 +1764,7 @@
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
q->createConfigurationInterface(dialog);
addGlobalShortcutsPage(dialog);
-#ifdef ENABLE_REMOTE_WIDGETS
addPublishPage(dialog);
-#endif
//TODO: Apply button does not correctly work for now, so do not show it
dialog->showButton(KDialog::Apply, false);
QObject::connect(dialog, SIGNAL(applyClicked()), q, \
SLOT(configDialogFinished())); @@ -1754,6 +1800,7 @@
void AppletPrivate::addPublishPage(KConfigDialog *dialog)
{
+#ifdef ENABLE_REMOTE_WIDGETS
QWidget *page = new QWidget;
publishUI.setupUi(page);
publishUI.publishCheckbox->setChecked(q->isPublished());
@@ -1771,6 +1818,7 @@
q->connect(publishUI.publishCheckbox, SIGNAL(stateChanged(int)),
q, SLOT(publishCheckboxStateChanged(int)));
dialog->addPage(page, i18n("Publish"), "applications-internet");
+#endif
}
void AppletPrivate::publishCheckboxStateChanged(int state)
@@ -1799,6 +1847,7 @@
q->config().writeEntry("Publish", publishUI.publishCheckbox->isChecked());
+#ifdef ENABLE_REMOTE_WIDGETS
if (publishUI.publishCheckbox->isChecked()) {
QString resourceName =
i18nc("%1 is the name of a plasmoid, %2 the name of the machine that \
plasmoid is published on", @@ -1821,6 +1870,7 @@
} else {
q->unpublish();
}
+#endif
if (!configLoader) {
// the config loader will trigger this for us, so we don't need to.
--- trunk/KDE/kdelibs/plasma/private/applet_p.h #1022542:1022543
@@ -35,6 +35,7 @@
namespace Plasma
{
+class Dialog;
class FrameSvg;
class AppletScript;
class Wallpaper;
@@ -134,6 +135,7 @@
Plasma::Constraints pendingConstraints;
// overlays and messages
+ QPointer<Plasma::Dialog> messageDialog;
AppletOverlayWidget *messageOverlay;
QGraphicsProxyWidget *messageOverlayProxy;
Plasma::BusyWidget *busyWidget;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic