[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kde-workspace] plasma/generic/applets/devicenotifier/package/contents/ui: Make
From: Sebastian_Kügler <sebas () kde ! org>
Date: 2013-11-19 16:29:17
Message-ID: E1VioAv-0003Xe-ER () scm ! kde ! org
[Download RAW message or body]
Git commit a7b0166b8f0389c9fd43b16ee5835251b72af725 by Sebastian Kügler.
Committed on 19/11/2013 at 02:41.
Pushed by sebas into branch 'master'.
Make devicenotifier "mostly" work
This makes the devicenotifier work, including showing removable devices,
changing the config, changing status accordingly, reacting on newly
plugged in and removed devices.
- plasmoid.configuration seems broken in the systray, hardcode and warn
for now
- add compactRepresentation Component
- use PlasmaCore.IconItem inside that
- wire up setPopupIconByName to this using a property
A few things need to be fixed elsewhere first, but this makes it mostly
functional, and is a nice step forward.
screenshot: http://i.imgur.com/EaAH5in.png
DIGEST:Make device notifier work in Plasma 2
M +46 -21 plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml
http://commits.kde.org/kde-workspace/a7b0166b8f0389c9fd43b16ee5835251b72af725
diff --git a/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml \
b/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml index \
31c471d..3db5fef 100644
--- a/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml
+++ b/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml
@@ -29,6 +29,7 @@ Item {
property int minimumHeight: 340
property string devicesType: "removable"
property string expandedDevice
+ property string popupIcon: "device-notifier"
PlasmaCore.DataSource {
id: hpSource
@@ -37,6 +38,16 @@ Item {
interval: 0
}
+ property Component compactRepresentation: PlasmaCore.IconItem {
+ source: devicenotifier.popupIcon
+ width: 22;
+ height: 22;
+ MouseArea {
+ anchors.fill: parent
+ onClicked: plasmoid.expanded = !plasmoid.expanded
+ }
+ }
+
PlasmaCore.DataSource {
id: sdSource
engine: "soliddevice"
@@ -90,6 +101,13 @@ Item {
}
}
+ Connections {
+ target: plasmoid
+ onExpandedChanged: {
+ popupEventSlot(plasmoid.expanded);
+ }
+ }
+
PlasmaCore.DataSource {
id: statusSource
engine: "devicenotifications"
@@ -108,9 +126,7 @@ Item {
}
Component.onCompleted: {
- plasmoid.addEventListener ('ConfigChanged', configChanged);
- plasmoid.popupEvent.connect(popupEventSlot);
-
+ //plasmoid.addEventListener ('ConfigChanged', configChanged);
if (notifierDialog.count == 0) {
plasmoid.status = PlasmaCore.Types.PassiveStatus;
}
@@ -145,7 +161,7 @@ Item {
// (versus only hovered) for autohide purposes
notifierDialog.itemClicked = false;
- plasmoid.setPopupIconByName("preferences-desktop-notification")
+ devicenotifier.popupIcon = "preferences-desktop-notification";
plasmoid.expanded = true;
popupIconTimer.restart()
}
@@ -161,13 +177,13 @@ Item {
tooltip["mainText"] = i18n("Most recent device")
tooltip["subText"] = sdSource.data[sdSource.last]["Description"]
}
- plasmoid.popupIconToolTip = tooltip
+ //plasmoid.popupIconToolTip = tooltip // FIXME
}
Timer {
id: popupIconTimer
interval: 2500
- onTriggered: plasmoid.setPopupIconByName("device-notifier");
+ onTriggered: devicenotifier.popupIcon = "device-notifier";
}
Timer {
@@ -207,7 +223,6 @@ Item {
}
height: lineSvg.elementSize("horizontal-line").height
}
-
PlasmaExtras.ScrollArea {
anchors {
top : headerSeparator.bottom
@@ -216,6 +231,7 @@ Item {
left: parent.left
right: parent.right
}
+
ListView {
id: notifierDialog
@@ -226,19 +242,27 @@ Item {
}
filterRole: "Removable"
filterRegExp: {
- var all = plasmoid.configuration.allDevices;
- var removable = plasmoid.configuration.removableDevices;
- if (all == true) {
- devicesType = "all";
- return "";
- } else if (removable == true) {
- devicesType = "removable";
- return "true";
- } else {
- devicesType = "nonRemovable";
- return "false";
- }
- }
+ // FIXME: This crashes
+ //var all = plasmoid.configuration.allDevices;
+ //var removable = plasmoid.configuration.removableDevices;
+ print("FIXME: Disabled reading from config due to crash");
+ var all = true;
+ var removable = true;
+
+ if (all == true) {
+ devicesType = "all";
+ print("ST2P all");
+ return "";
+ } else if (removable == true) {
+ print("ST2P rem true");
+ devicesType = "removable";
+ return "true";
+ } else {
+ print("ST2P nonRemovable");
+ devicesType = "nonRemovable";
+ return "false";
+ }
+ }
sortRole: "Timestamp"
sortOrder: Qt.DescendingOrder
}
@@ -258,7 +282,7 @@ Item {
passiveTimer.restart()
} else {
passiveTimer.stop()
- plasmoid.status = "ActiveStatus"
+ plasmoid.status = PlasmaCore.Types.ActiveStatus
}
}
@@ -311,6 +335,7 @@ Item {
Component.onCompleted: currentIndex=-1
}
+
}
Component {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic