[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/generic/applets/battery
From: Aurélien Gâteau <agateau () kde ! org>
Date: 2011-01-05 22:03:48
Message-ID: 20110105220348.49903AC8B0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1212140 by gateau:
Turn the extender into a regular popup applet
Prevents weird drag'n'drop behavior
CCBUG: 258044
M +12 -14 battery.cpp
M +1 -1 battery.h
--- trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.cpp \
#1212139:1212140 @@ -166,11 +166,8 @@
dataUpdated("AC Adapter", dataEngine("powermanagement")->query("AC Adapter"));
- if (!m_isEmbedded && extender() && !extender()->hasItem("powermanagement")) {
- Plasma::ExtenderItem *eItem = new Plasma::ExtenderItem(extender());
- eItem->setName("powermanagement");
- initExtenderItem(eItem);
- extender()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ if (!m_isEmbedded) {
+ initPopupWidget();
}
if (m_acAdapterPlugged) {
@@ -481,16 +478,17 @@
return button;
}
-void Battery::initExtenderItem(Plasma::ExtenderItem *item)
+void Battery::initPopupWidget()
{
- // We only show the extender for applets that are not embedded, as
- // that would create infinitve loops, you really don't want an applet
- // extender when the applet is embedded into another applet, such
- // as the battery applet is also embedded into the battery's extender.
- if (!m_isEmbedded && item->name() == "powermanagement") {
+ // We only show the popup widget for applets that are not embedded, as that
+ // would create infinitve loops, you really don't want a popup widget when
+ // the applet is embedded into another applet, such as the battery applet
+ // is also embedded into the battery's popup widget.
+ if (!m_isEmbedded) {
int row = 0;
- m_controls = new QGraphicsWidget(item);
+ m_controls = new QGraphicsWidget(this);
+ setGraphicsWidget(m_controls);
m_controlsLayout = new QGraphicsGridLayout(m_controls);
m_controlsLayout->setColumnStretchFactor(1, 3);
// Do not call QGraphicsWidget::setMinimumWidth() here: for some reason
@@ -540,6 +538,7 @@
m_extenderApplet->init();
m_extenderApplet->setShowBatteryLabel(false);
m_extenderApplet->updateConstraints(Plasma::StartupCompletedConstraint);
+ m_extenderApplet->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_controlsLayout->addItem(m_extenderApplet, 1, 2, 2, 1);
m_profileLabel = createBuddyLabel(m_controls);
@@ -619,8 +618,6 @@
m_controlsLayout->addItem(buttonLayout, row, 0, 1, 3);
m_controls->setLayout(m_controlsLayout);
- item->setWidget(m_controls);
- item->setTitle(i18n("Power Management"));
setupFonts();
@@ -638,6 +635,7 @@
m_extenderApplet->setGeometry(QRectF(QPoint(m_controls->geometry().width()-s, \
0), QSizeF(s, s))); }
updateStatus();
+ PopupApplet::popupEvent(show);
}
void Battery::setupFonts()
--- trunk/KDE/kdebase/workspace/plasma/generic/applets/battery/battery.h \
#1212139:1212140 @@ -103,7 +103,7 @@
private:
void connectSources();
- void initExtenderItem(Plasma::ExtenderItem *item);
+ void initPopupWidget();
void updateStatus();
bool isConstrained();
QString stringForState(const QHash<QString, QVariant> &batteryData, bool \
*chargeChanging = 0);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic