* Use header (with integrated buttons when shown as part of the system tray Plasmoid) * Use less space so it fits into the system tray plasmoid (at least on a full HD screen with 96 dpi) * Show action for internal errors only if there are internal errors (like in the Qt Widgets based GUI) * Port away from deprecated tab bar (which is not used in official Plasmoids anymore as well) * Simplify code for ensuring the minimum size as configured (still does not work within the system tray Plasmoid)
80 lines
2.9 KiB
QML
80 lines
2.9 KiB
QML
import QtQuick 2.2
|
|
import QtQuick.Layouts 1.1
|
|
import org.kde.plasma.plasmoid 2.0
|
|
import org.kde.kquickcontrolsaddons 2.0
|
|
|
|
Item {
|
|
id: syncthingApplet
|
|
|
|
Plasmoid.switchWidth: units.gridUnit * (plasmoid.nativeInterface.size.width + 1)
|
|
Plasmoid.switchHeight: units.gridUnit * (plasmoid.nativeInterface.size.height + 1)
|
|
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
|
Plasmoid.compactRepresentation: CompactRepresentation {}
|
|
Plasmoid.fullRepresentation: FullRepresentation {
|
|
Layout.minimumWidth: units.gridUnit * plasmoid.nativeInterface.size.width
|
|
Layout.minimumHeight: units.gridUnit * plasmoid.nativeInterface.size.height
|
|
}
|
|
Plasmoid.icon: "syncthingtray"
|
|
Plasmoid.toolTipMainText: plasmoid.nativeInterface.statusText
|
|
Plasmoid.toolTipSubText: plasmoid.nativeInterface.additionalStatusText
|
|
Plasmoid.toolTipItem: ToolTipView {
|
|
Layout.minimumWidth: item ? item.width : 0
|
|
Layout.maximumWidth: item ? item.width : 0
|
|
Layout.minimumHeight: item ? item.height : 0
|
|
Layout.maximumHeight: item ? item.height : 0
|
|
}
|
|
|
|
Plasmoid.hideOnWindowDeactivate: true
|
|
|
|
function action_showWebUI() {
|
|
plasmoid.nativeInterface.showWebUI()
|
|
}
|
|
|
|
function action_configure() {
|
|
plasmoid.nativeInterface.showSettingsDlg()
|
|
}
|
|
|
|
function action_showOwnId() {
|
|
plasmoid.nativeInterface.showOwnDeviceId()
|
|
}
|
|
|
|
function action_rescanAllDirs() {
|
|
plasmoid.nativeInterface.connection.rescanAllDirs()
|
|
}
|
|
|
|
function action_restartSyncthing() {
|
|
plasmoid.nativeInterface.connection.restart()
|
|
}
|
|
|
|
function action_showLog() {
|
|
plasmoid.nativeInterface.showLog()
|
|
}
|
|
|
|
function action_showErrors() {
|
|
plasmoid.nativeInterface.showInternalErrorsDialog()
|
|
}
|
|
|
|
function action_showAboutDialog() {
|
|
plasmoid.nativeInterface.showAboutDialog()
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
plasmoid.nativeInterface.initEngine(this)
|
|
plasmoid.removeAction("configure")
|
|
plasmoid.setAction(
|
|
"showWebUI", qsTr("Open Syncthing"),
|
|
":/icons/hicolor/scalable/status/syncthing-default.svg")
|
|
plasmoid.setAction("configure", qsTr("Settings"), "configure")
|
|
plasmoid.setAction("rescanAllDirs", qsTr("Rescan all directories"),
|
|
"folder-sync")
|
|
plasmoid.setAction("showOwnId", qsTr("Show own device ID"),
|
|
"view-barcode-qr")
|
|
plasmoid.setAction("restartSyncthing", qsTr("Restart Syncthing"),
|
|
"system-reboot")
|
|
plasmoid.setAction("showLog", qsTr("Log"), "text-x-generic")
|
|
plasmoid.setAction("showErrors", qsTr("Internal errors"), "data-error")
|
|
plasmoid.action("showErrors").visible = Qt.binding(() => { return plasmoid.nativeInterface.hasInternalErrors })
|
|
plasmoid.setAction("showAboutDialog", qsTr("About"), "help-about")
|
|
}
|
|
}
|