2021-11-25 20:27:58 +01:00
|
|
|
import QtQuick 2.2
|
2019-09-21 16:52:49 +02:00
|
|
|
import QtQuick.Layouts 1.1
|
2017-08-29 23:58:49 +02:00
|
|
|
import org.kde.plasma.plasmoid 2.0
|
|
|
|
import org.kde.kquickcontrolsaddons 2.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: syncthingApplet
|
|
|
|
|
2021-11-25 20:27:58 +01:00
|
|
|
Plasmoid.switchWidth: units.gridUnit * (plasmoid.nativeInterface.size.width + 1)
|
|
|
|
Plasmoid.switchHeight: units.gridUnit * (plasmoid.nativeInterface.size.height + 1)
|
2017-08-29 23:58:49 +02:00
|
|
|
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
2020-05-31 00:24:58 +02:00
|
|
|
Plasmoid.compactRepresentation: CompactRepresentation {}
|
2021-11-25 20:27:58 +01:00
|
|
|
Plasmoid.fullRepresentation: FullRepresentation {
|
|
|
|
Layout.minimumWidth: units.gridUnit * plasmoid.nativeInterface.size.width
|
|
|
|
Layout.minimumHeight: units.gridUnit * plasmoid.nativeInterface.size.height
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
|
|
|
Plasmoid.icon: "syncthingtray"
|
|
|
|
Plasmoid.toolTipMainText: plasmoid.nativeInterface.statusText
|
|
|
|
Plasmoid.toolTipSubText: plasmoid.nativeInterface.additionalStatusText
|
2022-05-05 20:51:53 +02:00
|
|
|
Plasmoid.toolTipItem: ToolTipView {}
|
2017-09-09 21:40:00 +02:00
|
|
|
|
2017-08-29 23:58:49 +02:00
|
|
|
Plasmoid.hideOnWindowDeactivate: true
|
|
|
|
|
|
|
|
function action_showWebUI() {
|
|
|
|
plasmoid.nativeInterface.showWebUI()
|
|
|
|
}
|
|
|
|
|
2021-11-25 20:27:58 +01:00
|
|
|
function action_configure() {
|
2017-09-08 16:59:53 +02:00
|
|
|
plasmoid.nativeInterface.showSettingsDlg()
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
|
|
|
|
2021-11-25 20:27:58 +01:00
|
|
|
function action_showOwnId() {
|
|
|
|
plasmoid.nativeInterface.showOwnDeviceId()
|
|
|
|
}
|
|
|
|
|
2017-08-29 23:58:49 +02:00
|
|
|
function action_rescanAllDirs() {
|
|
|
|
plasmoid.nativeInterface.connection.rescanAllDirs()
|
|
|
|
}
|
|
|
|
|
2018-02-19 01:38:41 +01:00
|
|
|
function action_restartSyncthing() {
|
|
|
|
plasmoid.nativeInterface.connection.restart()
|
|
|
|
}
|
|
|
|
|
2017-08-29 23:58:49 +02:00
|
|
|
function action_showLog() {
|
|
|
|
plasmoid.nativeInterface.showLog()
|
|
|
|
}
|
|
|
|
|
2017-09-08 16:59:53 +02:00
|
|
|
function action_showErrors() {
|
|
|
|
plasmoid.nativeInterface.showInternalErrorsDialog()
|
|
|
|
}
|
|
|
|
|
2017-08-29 23:58:49 +02:00
|
|
|
function action_showAboutDialog() {
|
2017-08-30 22:41:02 +02:00
|
|
|
plasmoid.nativeInterface.showAboutDialog()
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2021-10-15 22:18:30 +02:00
|
|
|
plasmoid.nativeInterface.initEngine(this)
|
2017-09-09 21:40:00 +02:00
|
|
|
plasmoid.removeAction("configure")
|
2022-03-20 17:01:48 +01:00
|
|
|
plasmoid.setAction("showWebUI", qsTr("Open Syncthing"), "syncthing")
|
2021-11-25 20:27:58 +01:00
|
|
|
plasmoid.setAction("configure", qsTr("Settings"), "configure")
|
2018-02-19 01:38:41 +01:00
|
|
|
plasmoid.setAction("rescanAllDirs", qsTr("Rescan all directories"),
|
|
|
|
"folder-sync")
|
2021-11-25 20:27:58 +01:00
|
|
|
plasmoid.setAction("showOwnId", qsTr("Show own device ID"),
|
|
|
|
"view-barcode-qr")
|
2018-02-19 01:38:41 +01:00
|
|
|
plasmoid.setAction("restartSyncthing", qsTr("Restart Syncthing"),
|
|
|
|
"system-reboot")
|
2021-11-25 20:27:58 +01:00
|
|
|
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 })
|
2017-09-09 21:40:00 +02:00
|
|
|
plasmoid.setAction("showAboutDialog", qsTr("About"), "help-about")
|
2017-08-29 23:58:49 +02:00
|
|
|
}
|
|
|
|
}
|