[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 the biggest
From: Marco Martin <notmart () gmail ! com>
Date: 2013-12-27 14:01:33
Message-ID: E1VwXyn-0000Uk-CP () scm ! kde ! org
[Download RAW message or body]
Git commit 4e904bbc9f03a899de360e8240fb636234e5dad2 by Marco Martin.
Committed on 27/12/2013 at 10:54.
Pushed by mart into branch 'master'.
make the biggest area load on demand
when the popup opens
M +205 -198 plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml
http://commits.kde.org/kde-workspace/4e904bbc9f03a899de360e8240fb636234e5dad2
diff --git a/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml \
b/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml index \
9510c03..a56656d 100644
--- a/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml
+++ b/plasma/generic/applets/devicenotifier/package/contents/ui/devicenotifier.qml
@@ -192,233 +192,240 @@ Item {
onTriggered: plasmoid.status = PlasmaCore.Types.PassiveStatus
}
- MouseArea {
- hoverEnabled: true
+ PlasmaExtras.ConditionalLoader {
anchors.fill: parent
+ when: plasmoid.expanded
- onEntered: notifierDialog.itemHovered()
- onExited: notifierDialog.itemUnhovered()
-
- PlasmaComponents.Label {
- id: header
- text: filterModel.count>0 ? i18n("Available Devices") : i18n("No Devices \
Available")
- anchors { top: parent.top; topMargin: 3; left: parent.left; right: \
parent.right }
- horizontalAlignment: Text.AlignHCenter
- }
+ source: Component {
+ MouseArea {
+ hoverEnabled: true
+ anchors.fill: parent
+ onEntered: notifierDialog.itemHovered()
+ onExited: notifierDialog.itemUnhovered()
- PlasmaCore.Svg {
- id: lineSvg
- imagePath: "widgets/line"
- }
- PlasmaCore.SvgItem {
- id: headerSeparator
- svg: lineSvg
- elementId: "horizontal-line"
- anchors {
- top: header.bottom
- left: parent.left
- right: parent.right
- topMargin: 3
- }
- height: lineSvg.elementSize("horizontal-line").height
- }
- PlasmaExtras.ScrollArea {
- anchors {
- top : headerSeparator.bottom
- topMargin: 10
- bottom: statusBarSeparator.top
- left: parent.left
- right: parent.right
- }
+ PlasmaComponents.Label {
+ id: header
+ text: filterModel.count>0 ? i18n("Available Devices") : i18n("No \
Devices Available") + anchors { top: parent.top; topMargin: 3; \
left: parent.left; right: parent.right } + horizontalAlignment: \
Text.AlignHCenter + }
- ListView {
- id: notifierDialog
- model: PlasmaCore.SortFilterModel {
- id: filterModel
- sourceModel: PlasmaCore.DataModel {
- dataSource: sdSource
- }
- filterRole: "Removable"
- filterRegExp: {
- // FIXME: This crashes
- //var all = plasmoid.configuration.allDevices;
- //var removable = plasmoid.configuration.removableDevices;
- print("FIXME: Disabled reading from config due to crash");
- var all = false;
- 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
+ PlasmaCore.Svg {
+ id: lineSvg
+ imagePath: "widgets/line"
}
-
- property int currentExpanded: -1
- property bool itemClicked: true
- delegate: deviceItem
- highlight: PlasmaComponents.Highlight{}
-
- //this is needed to make SectionScroller actually work
- //acceptable since one doesn't have a billion of devices
- cacheBuffer: 1000
-
- onCountChanged: {
- if (count == 0) {
- updateTooltip();
- passiveTimer.restart()
- } else {
- passiveTimer.stop()
- plasmoid.status = PlasmaCore.Types.ActiveStatus
+ PlasmaCore.SvgItem {
+ id: headerSeparator
+ svg: lineSvg
+ elementId: "horizontal-line"
+ anchors {
+ top: header.bottom
+ left: parent.left
+ right: parent.right
+ topMargin: 3
}
+ height: lineSvg.elementSize("horizontal-line").height
}
+ PlasmaExtras.ScrollArea {
+ anchors {
+ top : headerSeparator.bottom
+ topMargin: 10
+ bottom: statusBarSeparator.top
+ left: parent.left
+ right: parent.right
+ }
- function itemHovered()
- {
- // prevent autohide from catching us!
- plasmoid.expanded = true;
- }
+ ListView {
+ id: notifierDialog
- function itemUnhovered()
- {
- if (!itemClicked) {
- plasmoid.expanded = true;
- }
- }
+ model: PlasmaCore.SortFilterModel {
+ id: filterModel
+ sourceModel: PlasmaCore.DataModel {
+ dataSource: sdSource
+ }
+ filterRole: "Removable"
+ filterRegExp: {
+ // FIXME: This crashes
+ //var all = plasmoid.configuration.allDevices;
+ //var removable = \
plasmoid.configuration.removableDevices; + \
print("FIXME: Disabled reading from config due to crash"); + \
var all = false; + 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
+ }
- function itemFocused()
- {
- if (!itemClicked) {
- // prevent autohide from catching us!
- itemClicked = true;
- plasmoid.expanded = true;
- }
- }
+ property int currentExpanded: -1
+ property bool itemClicked: true
+ delegate: deviceItem
+ highlight: PlasmaComponents.Highlight{}
+
+ //this is needed to make SectionScroller actually work
+ //acceptable since one doesn't have a billion of devices
+ cacheBuffer: 1000
+
+ onCountChanged: {
+ if (count == 0) {
+ updateTooltip();
+ passiveTimer.restart()
+ } else {
+ passiveTimer.stop()
+ plasmoid.status = PlasmaCore.Types.ActiveStatus
+ }
+ }
- section {
- property: "Type Description"
- delegate: Item {
- height: childrenRect.height
- width: notifierDialog.width
- PlasmaCore.SvgItem {
- visible: parent.y > 0
- svg: lineSvg
- elementId: "horizontal-line"
- anchors {
- left: parent.left
- right: parent.right
+ function itemHovered()
+ {
+ // prevent autohide from catching us!
+ plasmoid.expanded = true;
+ }
+
+ function itemUnhovered()
+ {
+ if (!itemClicked) {
+ plasmoid.expanded = true;
+ }
+ }
+
+ function itemFocused()
+ {
+ if (!itemClicked) {
+ // prevent autohide from catching us!
+ itemClicked = true;
+ plasmoid.expanded = true;
}
- height: lineSvg.elementSize("horizontal-line").height
}
- PlasmaComponents.Label {
- x: 8
- y: 8
- opacity: 0.6
- text: section
- color: theme.textColor
+
+ section {
+ property: "Type Description"
+ delegate: Item {
+ height: childrenRect.height
+ width: notifierDialog.width
+ PlasmaCore.SvgItem {
+ visible: parent.y > 0
+ svg: lineSvg
+ elementId: "horizontal-line"
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+ height: \
lineSvg.elementSize("horizontal-line").height + }
+ PlasmaComponents.Label {
+ x: 8
+ y: 8
+ opacity: 0.6
+ text: section
+ color: theme.textColor
+ }
+ }
}
+
+ Component.onCompleted: currentIndex=-1
}
+
}
- Component.onCompleted: currentIndex=-1
- }
+ Component {
+ id: deviceItem
- }
+ DeviceItem {
+ id: wrapper
+ width: notifierDialog.width
+ udi: DataEngineSource
+ icon: sdSource.data[udi]["Icon"]
+ deviceName: sdSource.data[udi]["Description"]
+ emblemIcon: Emblems[0]
+ state: model["State"]
+
+ percentUsage: {
+ var freeSpace = new Number(sdSource.data[udi]["Free \
Space"]); + var size = new Number(model["Size"]);
+ var used = size-freeSpace;
+ return used*100/size;
+ }
+ leftActionIcon: {
+ if (mounted) {
+ return "media-eject";
+ } else {
+ return "emblem-mounted";
+ }
+ }
+ mounted: model["Accessible"]
- Component {
- id: deviceItem
-
- DeviceItem {
- id: wrapper
- width: notifierDialog.width
- udi: DataEngineSource
- icon: sdSource.data[udi]["Icon"]
- deviceName: sdSource.data[udi]["Description"]
- emblemIcon: Emblems[0]
- state: model["State"]
-
- percentUsage: {
- var freeSpace = new Number(sdSource.data[udi]["Free Space"]);
- var size = new Number(model["Size"]);
- var used = size-freeSpace;
- return used*100/size;
- }
- leftActionIcon: {
- if (mounted) {
- return "media-eject";
- } else {
- return "emblem-mounted";
- }
- }
- mounted: model["Accessible"]
+ onLeftActionTriggered: {
+ var operationName = mounted ? "unmount" : "mount";
+ var service = sdSource.serviceForSource(udi);
+ var operation = \
service.operationDescription(operationName); + \
service.startOperationCall(operation); + }
+ property bool isLast: (expandedDevice == udi)
+ property int operationResult: (model["Operation result"])
- onLeftActionTriggered: {
- var operationName = mounted ? "unmount" : "mount";
- var service = sdSource.serviceForSource(udi);
- var operation = service.operationDescription(operationName);
- service.startOperationCall(operation);
+ onIsLastChanged: {
+ if (isLast) {
+ notifierDialog.currentExpanded = index
+ makeCurrent();
+ }
+ }
+ onOperationResultChanged: {
+ if (operationResult == 1) {
+ plasmoid.setPopupIconByName("dialog-ok")
+ popupIconTimer.restart()
+ } else if (operationResult == 2) {
+ plasmoid.setPopupIconByName("dialog-error")
+ popupIconTimer.restart()
+ }
+ }
+ Behavior on height { NumberAnimation { duration: 150 } }
+ }
}
- property bool isLast: (expandedDevice == udi)
- property int operationResult: (model["Operation result"])
- onIsLastChanged: {
- if (isLast) {
- notifierDialog.currentExpanded = index
- makeCurrent();
+ PlasmaCore.SvgItem {
+ id: statusBarSeparator
+ svg: lineSvg
+ elementId: "horizontal-line"
+ height: lineSvg.elementSize("horizontal-line").height
+ anchors {
+ bottom: statusBar.top
+ bottomMargin: statusBar.visible ? 3:0
+ left: parent.left
+ right: parent.right
}
+ visible: statusBar.height>0
}
- onOperationResultChanged: {
- if (operationResult == 1) {
- plasmoid.setPopupIconByName("dialog-ok")
- popupIconTimer.restart()
- } else if (operationResult == 2) {
- plasmoid.setPopupIconByName("dialog-error")
- popupIconTimer.restart()
+
+ StatusBar {
+ id: statusBar
+ anchors {
+ left: parent.left
+ leftMargin: 5
+ right: parent.right
+ rightMargin: 5
+ bottom: parent.bottom
+ bottomMargin: 5
}
}
- Behavior on height { NumberAnimation { duration: 150 } }
- }
+ } // MouseArea
}
-
- PlasmaCore.SvgItem {
- id: statusBarSeparator
- svg: lineSvg
- elementId: "horizontal-line"
- height: lineSvg.elementSize("horizontal-line").height
- anchors {
- bottom: statusBar.top
- bottomMargin: statusBar.visible ? 3:0
- left: parent.left
- right: parent.right
- }
- visible: statusBar.height>0
- }
-
- StatusBar {
- id: statusBar
- anchors {
- left: parent.left
- leftMargin: 5
- right: parent.right
- rightMargin: 5
- bottom: parent.bottom
- bottomMargin: 5
- }
- }
- } // MouseArea
+ }
function isMounted (udi) {
var types = sdSource.data[udi]["Device Types"];
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic