[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [smb4k] plasmoid/package/contents/ui: Add the compact representation of the plasmoid.
From: Alexander Reinholdt <null () kde ! org>
Date: 2017-06-30 20:00:28
Message-ID: E1dR25c-0003r6-8E () code ! kde ! org
[Download RAW message or body]
Git commit a6cc9dbca64ea063e349e2959511e4a147b7ed36 by Alexander Reinholdt.
Committed on 30/06/2017 at 19:59.
Pushed by areinholdt into branch 'master'.
Add the compact representation of the plasmoid.
C +55 -25 plasmoid/package/contents/ui/PanelIconWidget.qml [from: \
plasmoid/package/contents/ui/main.qml - 060% similarity] M +3 -3 \
plasmoid/package/contents/ui/main.qml
https://commits.kde.org/smb4k/a6cc9dbca64ea063e349e2959511e4a147b7ed36
diff --git a/plasmoid/package/contents/ui/main.qml \
b/plasmoid/package/contents/ui/PanelIconWidget.qml similarity index 60%
copy from plasmoid/package/contents/ui/main.qml
copy to plasmoid/package/contents/ui/PanelIconWidget.qml
index d7c3c19..45df450 100644
--- a/plasmoid/package/contents/ui/main.qml
+++ b/plasmoid/package/contents/ui/PanelIconWidget.qml
@@ -24,40 +24,70 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.smb4k.smb4kqmlplugin 2.0
-Item {
- id: root
+
+MouseArea {
+ id: panelIconWidget
+ anchors.fill: parent
- Plasmoid.toolTipMainText: i18n("Network Neighborhood")
-// Plasmoid.toolTipSubText: sinkModel.preferredSink ? i18n("Volume at %1%\n%2", \
volumePercent(sinkModel.preferredSink.volume), sinkModel.preferredSink.description) : \
""
-// Plasmoid.icon: "smb4k"
-// Plasmoid.switchWidth: units.gridUnit * 10
-// Plasmoid.switchHeight: units.gridUnit * 10
+ PlasmaCore.IconItem {
+ id: panelIcon
+ anchors.fill: parent
+ source: "smb4k"
+ colorGroup: PlasmaCore.ColorScope.colorGroup
+
+ //
+ // Busy indicator
+ //
+ PlasmaComponents.BusyIndicator {
+ id: busyIndicator
+ running: false
+ visible: false
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
- //
- // Smb4K interface
- //
- Interface {
- id: iface
+ onClicked: {
+ plasmoid.expanded = !plasmoid.expanded
+
+ if (!plasmoid.expanded && busyIndicator.running) {
+ busyIndicator.visible = false
+ busyIndicator.running = false
+ }
+ else {
+ // Do nothing
+ }
}
//
- // Plasmoid representations
+ // Connections
//
-// Plasmoid.compactRepresentation: {} // FIXME: Look at plasma-nm how this can be \
done
- Plasmoid.fullRepresentation: PopupDialog {
- id: main
- Layout.minimumWidth: units.iconSizes.medium * 10
- Layout.minimumHeight: units.gridUnit * 20
- anchors.fill: parent
- focus: true
+ Connections {
+ target: iface
+ onBusy: busy()
+ onIdle: idle()
}
//
- // Start interface
+ // Functions
//
- Component.onCompleted: {
- iface.startScanner();
- iface.startMounter();
- iface.startPrinter();
+ function busy() {
+ if (!plasmoid.expanded) {
+ busyIndicator.visible = true
+ busyIndicator.running = true
+ }
+ else {
+ // Do nothing
+ }
+ }
+
+ function idle() {
+ if (!plasmoid.expanded) {
+ busyIndicator.visible = false
+ busyIndicator.running = false
+ }
+ else {
+ // Do nothing
+ }
}
}
diff --git a/plasmoid/package/contents/ui/main.qml \
b/plasmoid/package/contents/ui/main.qml index d7c3c19..af0f854 100644
--- a/plasmoid/package/contents/ui/main.qml
+++ b/plasmoid/package/contents/ui/main.qml
@@ -30,8 +30,8 @@ Item {
Plasmoid.toolTipMainText: i18n("Network Neighborhood")
// Plasmoid.toolTipSubText: sinkModel.preferredSink ? i18n("Volume at %1%\n%2", \
volumePercent(sinkModel.preferredSink.volume), sinkModel.preferredSink.description) : \
"" // Plasmoid.icon: "smb4k"
-// Plasmoid.switchWidth: units.gridUnit * 10
-// Plasmoid.switchHeight: units.gridUnit * 10
+ Plasmoid.switchWidth: units.gridUnit * 10
+ Plasmoid.switchHeight: units.gridUnit * 10
//
// Smb4K interface
@@ -43,7 +43,7 @@ Item {
//
// Plasmoid representations
//
-// Plasmoid.compactRepresentation: {} // FIXME: Look at plasma-nm how this can be \
done + Plasmoid.compactRepresentation: PanelIconWidget {} // FIXME: Look at \
plasma-nm how this can be done Plasmoid.fullRepresentation: PopupDialog {
id: main
Layout.minimumWidth: units.iconSizes.medium * 10
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic