Add tray UI: main.qml + ShareItem.qml
PlasmoidItem with a system-tray icon (active when a share is mounted) and a popup grouping shares per host. ExpandableListItem rows toggle mount/unmount and open the mounted folder; empty-state placeholder links to config. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import org.kde.plasma.extras as PlasmaExtras
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
/*
|
||||
* One share row in the popup: title = share name, primary button toggles
|
||||
* mount/unmount, context menu opens the mounted folder. Purely presentational —
|
||||
* it emits signals; main.qml owns the mount logic.
|
||||
*/
|
||||
PlasmaExtras.ExpandableListItem {
|
||||
id: item
|
||||
|
||||
property string shareName: ""
|
||||
property string hostLabel: ""
|
||||
property string comment: ""
|
||||
property string mountpoint: ""
|
||||
property bool mounted: false
|
||||
property bool busy: false
|
||||
|
||||
signal mountToggled()
|
||||
signal openRequested()
|
||||
|
||||
icon: "folder-network"
|
||||
iconEmblem: mounted ? "emblem-mounted" : ""
|
||||
title: shareName
|
||||
subtitle: {
|
||||
if (busy)
|
||||
return mounted ? i18n("Unmounting…") : i18n("Mounting…");
|
||||
if (mounted)
|
||||
return mountpoint;
|
||||
if (comment.length > 0)
|
||||
return comment;
|
||||
return i18n("Not mounted");
|
||||
}
|
||||
isBusy: busy
|
||||
enabled: !busy
|
||||
|
||||
defaultActionButtonAction: QQC2.Action {
|
||||
text: item.mounted ? i18n("Unmount") : i18n("Mount")
|
||||
icon.name: item.mounted ? "media-eject" : "drive-harddisk"
|
||||
onTriggered: item.mountToggled()
|
||||
}
|
||||
|
||||
contextualActions: [
|
||||
QQC2.Action {
|
||||
text: i18n("Open in File Manager")
|
||||
icon.name: "document-open-folder"
|
||||
enabled: item.mounted
|
||||
onTriggered: item.openRequested()
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user