[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.6/kdebase/workspace/plasma/generic/applets/devicenotifier
From: Jacopo De Simoi <wilderkde () gmail ! com>
Date: 2011-01-18 21:43:25
Message-ID: 20110118214326.02EF7AC8B7 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1215487 by jacopods:
Be smarter when deciding if we should leave the popup open forever
BUG: 262184
FIXED-IN: 4.6.0
M +24 -2 devicenotifier.cpp
M +14 -0 devicenotifier.h
M +13 -5 notifierdialog.cpp
--- branches/KDE/4.6/kdebase/workspace/plasma/generic/applets/devicenotifier/devicenotifier.cpp \
#1215486:1215487 @@ -163,6 +163,7 @@
m_globalVisibility(false),
m_checkHiddenDevices(true),
m_triggeringPopupInternally(false),
+ m_poppedUpInternally(false),
m_autoMountingWidget(0),
m_deviceActionsWidget(0)
{
@@ -290,11 +291,27 @@
m_dialog->collapseDevices();
}
+ if (m_triggeringPopupInternally && show) {
+ m_poppedUpInternally = true;
+ } else if (!show) {
+ m_poppedUpInternally = false;
+ }
+
if (!m_triggeringPopupInternally) {
changeNotifierIcon();
}
+ m_triggeringPopupInternally = false;
}
+void DeviceNotifier::keepPopupOpen()
+{
+ if (!m_poppedUpInternally) {
+ m_poppedUpInternally = false;
+ kDebug() << "ping";
+ showPopup();
+ }
+}
+
void DeviceNotifier::notifyDevice(const QString &udi)
{
m_lastPlugged << udi;
@@ -303,8 +320,8 @@
emit activate();
changeNotifierIcon("preferences-desktop-notification", \
LONG_NOTIFICATION_TIMEOUT); m_triggeringPopupInternally = true;
+ kDebug() << "pong";
showPopup(LONG_NOTIFICATION_TIMEOUT);
- m_triggeringPopupInternally = false;
update();
setStatus(Plasma::NeedsAttentionStatus);
} else {
@@ -528,8 +545,8 @@
{
if (!isPopupShowing()) {
m_triggeringPopupInternally = true;
+ kDebug() << "pang";
showPopup(LONG_NOTIFICATION_TIMEOUT);
- m_triggeringPopupInternally = false;
}
m_dialog->showStatusBarMessage(message, details, udi);
@@ -542,6 +559,11 @@
return (m_hiddenDevices.count() > 0);
}
+bool DeviceNotifier::poppedUpInternally()
+{
+ return m_poppedUpInternally;
+}
+
void DeviceNotifier::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
m_dialog->setMenuActionsAt(event->scenePos());
--- branches/KDE/4.6/kdebase/workspace/plasma/generic/applets/devicenotifier/devicenotifier.h \
#1215486:1215487 @@ -124,6 +124,17 @@
*/
QGraphicsWidget *graphicsWidget();
+ /**
+ * Return true if the applet has been opened for internal reasons (i.e. has been \
shown + * with no user interaction);
+ **/
+ bool poppedUpInternally();
+
+ /**
+ * Force to keep the applet open until the user closes it manually
+ */
+ void keepPopupOpen();
+
QList<QAction *> contextualActions();
static const int LONG_NOTIFICATION_TIMEOUT = 7500;
@@ -292,6 +303,9 @@
///if true we are triggering the popup internally
bool m_triggeringPopupInternally : 1;
+ ///if true the applet popped up without user interaction (e.g. new device inserted)
+ bool m_poppedUpInternally : 1;
+
///embedded KCM modules in the configuration dialog
KCModuleProxy *m_autoMountingWidget;
KCModuleProxy *m_deviceActionsWidget;
--- branches/KDE/4.6/kdebase/workspace/plasma/generic/applets/devicenotifier/notifierdialog.cpp \
#1215486:1215487 @@ -212,10 +212,6 @@
void NotifierDialog::itemHoverEnter(DeviceItem *item)
{
- // make sure the popup is not only shown, but doesn't automatically retract on \
us when we're
- // mousing around in it
- m_notifier->showPopup(0);
-
item->setHovered(true);
if (item->isCollapsed()) {
m_clearItemBackgroundTargetTimer.stop();
@@ -255,6 +251,16 @@
case QEvent::GraphicsSceneHoverEnter:
itemHoverEnter(item);
break;
+ case QEvent::GraphicsSceneHoverMove:
+ if (m_notifier->poppedUpInternally()) {
+ \
m_notifier->showPopup(DeviceNotifier::LONG_NOTIFICATION_TIMEOUT); + \
kDebug() << "mouse move - keep it up"; + }
+ break;
+ case QEvent::GraphicsSceneMousePress:
+ m_notifier->keepPopupOpen();
+ kDebug() << "keeping open \
**************************************************"; + break;
default:
break;
}
@@ -664,7 +670,8 @@
}
delete svg;
- emit activated();
+ kDebug() << "here";
+// emit activated();
}
void NotifierDialog::storageTeardownDone(Solid::ErrorType error, QVariant errorData, \
const QString & udi) @@ -848,6 +855,7 @@
m_itemBackground->setTargetItem(0);
+ kDebug() << "there";
emit activated();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic