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: plas= moid/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/conte= nts/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.preferredS= ink.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 =3D !plasmoid.expanded + = + if (!plasmoid.expanded && busyIndicator.running) { + busyIndicator.visible =3D false + busyIndicator.running =3D false + } + else { + // Do nothing + } } = // - // Plasmoid representations + // Connections // -// Plasmoid.compactRepresentation: {} // FIXME: Look at plasma-nm how th= is 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 =3D true + busyIndicator.running =3D true + } + else { + // Do nothing + } + } + = + function idle() { + if (!plasmoid.expanded) { + busyIndicator.visible =3D false + busyIndicator.running =3D false + } + else { + // Do nothing + } } } diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/conte= nts/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.preferredS= ink.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 th= is can be done + Plasmoid.compactRepresentation: PanelIconWidget {} // FIXME: Look at pla= sma-nm how this can be done Plasmoid.fullRepresentation: PopupDialog { id: main Layout.minimumWidth: units.iconSizes.medium * 10