[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace/KDE/4.8] plasma/generic/applets/devicenotifier/package/contents/ui: fix eject button
From:       Marco Martin <notmart () gmail ! com>
Date:       2012-01-16 20:58:08
Message-ID: 20120116205808.E018AA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 20a656059c0bb82453b7d279697e5a0476c99b1b by Marco Martin.
Committed on 16/01/2012 at 21:56.
Pushed by mart into branch 'KDE/4.8'.

fix eject button

BUG:288827

M  +30   -40   plasma/generic/applets/devicenotifier/package/contents/ui/DeviceItem.qml


http://commits.kde.org/kde-workspace/20a656059c0bb82453b7d279697e5a0476c99b1b

diff --git a/plasma/generic/applets/devicenotifier/package/contents/ui/DeviceItem.qml \
b/plasma/generic/applets/devicenotifier/package/contents/ui/DeviceItem.qml index \
                cf575bd..4daeb27 100644
--- a/plasma/generic/applets/devicenotifier/package/contents/ui/DeviceItem.qml
+++ b/plasma/generic/applets/devicenotifier/package/contents/ui/DeviceItem.qml
@@ -44,7 +44,7 @@ Item {
         opacity: 0
         anchors.fill: parent
     }
-    Item {
+    MouseArea {
         id: container
         anchors {
             fill: parent
@@ -53,6 +53,34 @@ Item {
             rightMargin: padding.margins.right
             bottomMargin: padding.margins.bottom
         }
+        hoverEnabled: true
+        onEntered: {
+            notifierDialog.currentIndex = index;
+            notifierDialog.highlightItem.opacity = 1;
+        }
+        onExited: {
+            notifierDialog.highlightItem.opacity = expanded ? 1 : 0;
+        }
+        onClicked: {
+            if (leftAction.visible
+            && mouse.x>=leftAction.x && mouse.x<=leftAction.x+leftAction.width
+            && mouse.y>=leftAction.y && mouse.y<=leftAction.y+leftAction.height)
+            {
+                leftActionTriggered();
+            }
+            else {
+                var actions = hpSource.data[udi]["actions"];
+                if (actions.length==1) {
+                    service = hpSource.serviceForSource(udi);
+                    operation = service.operationDescription("invokeAction");
+                    operation.predicate = actions[0]["predicate"];
+                    service.startOperationCall(operation);
+                } else {
+                    notifierDialog.currentExpanded = expanded ? -1 : index;
+                }
+            }
+        }
+
         // FIXME: Device item loses focus on mounting/unmounting it,
         // or specifically, when some UI element changes.
         QIconItem {
@@ -105,7 +133,7 @@ Item {
                 font.italic: true
                 font.pointSize: theme.smallestFont.pointSize
                 color: "#99"+(theme.textColor.toString().substr(1))
-                opacity: mouseArea.containsMouse || expanded ? 1 : 0;
+                opacity: container.containsMouse || expanded ? 1 : 0;
 
                 Behavior on opacity { NumberAnimation { duration: 150 } }
             }
@@ -201,44 +229,6 @@ Item {
             visible: deviceItem.state != 0
         }
 
-        MouseArea {
-            id: mouseArea
-            anchors {
-                top: parent.top
-                left: parent.left
-                right: parent.right
-                bottom: labelsColumn.bottom
-                // to remove the gap between device items
-            }
-            hoverEnabled: true
-            onEntered: {
-                notifierDialog.currentIndex = index;
-                notifierDialog.highlightItem.opacity = 1;
-            }
-            onExited: {
-                notifierDialog.highlightItem.opacity = expanded ? 1 : 0;
-            }
-            onClicked: {
-                if (leftAction.visible
-                && mouse.x>=leftAction.x && mouse.x<=leftAction.x+leftAction.width
-                && mouse.y>=leftAction.y && mouse.y<=leftAction.y+leftAction.height)
-                {
-                    leftActionTriggered();
-                }
-                else {
-                    var actions = hpSource.data[udi]["actions"];
-                    if (actions.length==1) {
-                        service = hpSource.serviceForSource(udi);
-                        operation = service.operationDescription("invokeAction");
-                        operation.predicate = actions[0]["predicate"];
-                        service.startOperationCall(operation);
-                    } else {
-                        notifierDialog.currentExpanded = expanded ? -1 : index;
-                    }
-                }
-            }
-        }
-
         ListView {
             id: actionsList
             anchors {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic