diff --git a/sources/plasmoid/plasmoid/contents/config/config.qml b/sources/plasmoid/plasmoid/contents/config/config.qml index 85b74e5..db4044b 100644 --- a/sources/plasmoid/plasmoid/contents/config/config.qml +++ b/sources/plasmoid/plasmoid/contents/config/config.qml @@ -18,14 +18,15 @@ import QtQuick 2.0 import org.kde.plasma.configuration 2.0 +import org.kde.plasma.plasmoid 2.0 ConfigModel { -// ConfigCategory { -// name: i18n("Netctl plasmoid") -// icon: Plasmoid.icon -// source: "appearance.qml" -// } + ConfigCategory { + name: i18n("Netctl plasmoid") + icon: "/usr/share/pixmaps/netctl-gui-widget.png" + source: "widget.qml" + } ConfigCategory { name: i18n("Appearance") diff --git a/sources/plasmoid/plasmoid/contents/config/main.xml b/sources/plasmoid/plasmoid/contents/config/main.xml index 890f015..75125e6 100644 --- a/sources/plasmoid/plasmoid/contents/config/main.xml +++ b/sources/plasmoid/plasmoid/contents/config/main.xml @@ -5,8 +5,45 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - + + + + 100 + + + /usr/bin/netctl-gui + + + /usr/bin/netctlgui-helper + + + /usr/bin/netctl + + + /usr/bin/netctl-auto + + + /usr/bin/kdesu + + + /usr/bin/netctl-gui -t 3 + + + true + + + true + + + false + + + $info\nIPv4: $intip4\nIPv6: $intip6 + + + + center diff --git a/sources/plasmoid/plasmoid/contents/ui/appearance.qml b/sources/plasmoid/plasmoid/contents/ui/appearance.qml index c2c132e..434f4b7 100644 --- a/sources/plasmoid/plasmoid/contents/ui/appearance.qml +++ b/sources/plasmoid/plasmoid/contents/ui/appearance.qml @@ -171,7 +171,7 @@ Item { QtDialogs.FileDialog { id: activeFileDialog - title: "Select a path" + title: i18n("Select a path") nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ] selectExisting: true onAccepted: activeIcon.text = activeFileDialog.fileUrl @@ -200,7 +200,7 @@ Item { QtDialogs.FileDialog { id: inactiveFileDialog - title: "Select a path" + title: i18n("Select a path") nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ] selectExisting: true onAccepted: inactiveIcon.text = inactiveFileDialog.fileUrl @@ -210,7 +210,7 @@ Item { QtDialogs.ColorDialog { id: colorDialog - title: "Select a color" + title: i18n("Select a color") color: selectColor.text onAccepted: { selectColor.text = colorDialog.color @@ -219,7 +219,7 @@ Item { QtDialogs.FontDialog { id: fontDialog - title: "Select a font" + title: i18n("Select a font") font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal }) onAccepted: { selectFont.text = fontDialog.font.family diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml index 86fd8fa..e952221 100644 --- a/sources/plasmoid/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -38,10 +38,10 @@ Item { } Text { id: iconPath - property string active: "/usr/share/icons/hicolor/64x64/apps/netctl-idle.png" - property string inactive: "/usr/share/icons/hicolor/64x64/apps/netctl-offline.png" + property string active: plasmoid.configuration.activeIconPath + property string inactive: plasmoid.configuration.inactiveIconPath } - property int interval: 1000 + property int interval: plasmoid.configuration.autoUpdateInterval property bool status: false // init diff --git a/sources/plasmoid/plasmoid/contents/ui/widget.qml b/sources/plasmoid/plasmoid/contents/ui/widget.qml new file mode 100644 index 0000000..c105a58 --- /dev/null +++ b/sources/plasmoid/plasmoid/contents/ui/widget.qml @@ -0,0 +1,215 @@ +/*************************************************************************** + * This file is part of netctl-gui * + * * + * netctl-gui is free software: you can redistribute it and/or * + * modify it under the terms of the GNU General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * netctl-gui is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with netctl-gui. If not, see http://www.gnu.org/licenses/ * + ***************************************************************************/ + +import QtQuick 2.0 +import QtQuick.Controls 1.0 as QtControls +import QtQuick.Dialogs 1.1 as QtDialogs +import QtQuick.Layouts 1.0 as QtLayouts + + +Item { + id: widgetPage + width: childrenRect.width + height: childrenRect.height + + property alias cfg_autoUpdateInterval: autoUpdate.value + property alias cfg_guiPath: guiPath.text + property alias cfg_useHelper: useHelper.checked + property alias cfg_helperPath: helperPath.text + property alias cfg_netctlPath: netctlPath.text + property alias cfg_netctlPathAuto: netctlAutoPath.text + property alias cfg_useSudo: useSudo.checked + property alias cfg_sudoPath: sudoPath.text + property alias cfg_useWifi: useWifi.checked + property alias cfg_wifiPath: wifiPath.text + property alias cfg_textPattern: textPattern.text + + + QtLayouts.ColumnLayout { + QtLayouts.RowLayout { + QtControls.Label { + text: i18n("Auto update interval, msec") + } + QtControls.SpinBox { + id: autoUpdate + minimumValue: 1000 + maximumValue: 10000 + stepSize: 500 + value: plasmoid.configuration.autoUpdateInterval + } + } + + QtLayouts.RowLayout { + QtControls.Label { + text: i18n("Path to GUI") + } + QtControls.TextField { + id: guiPath + QtLayouts.Layout.fillWidth: true + text: plasmoid.configuration.guiPath + } + QtControls.Button { + text: i18n("Browse") + onClicked: guiFileDialog.visible = true + } + + QtDialogs.FileDialog { + id: guiFileDialog + title: i18n("Select a path") + folder: "/usr/bin" + nameFilters: [ "All files (*)" ] + selectExisting: true + onAccepted: guiPath.text = guiFileDialog.fileUrl + } + } + + QtLayouts.RowLayout { + QtControls.CheckBox { + id: useHelper + text: i18n("Use helper") + } + QtControls.TextField { + id: helperPath + enabled: useHelper.checked + QtLayouts.Layout.fillWidth: true + text: plasmoid.configuration.helperPath + } + QtControls.Button { + enabled: useHelper.checked + text: i18n("Browse") + onClicked: helperFileDialog.visible = true + } + + QtDialogs.FileDialog { + id: helperFileDialog + title: i18n("Select a path") + folder: "/usr/bin" + nameFilters: [ "All files (*)" ] + selectExisting: true + onAccepted: helperPath.text = helperFileDialog.fileUrl + } + } + + QtLayouts.RowLayout { + QtControls.Label { + text: i18n("Path to netctl") + } + QtControls.TextField { + id: netctlPath + QtLayouts.Layout.fillWidth: true + text: plasmoid.configuration.netctlPath + } + QtControls.Button { + text: i18n("Browse") + onClicked: netctlFileDialog.visible = true + } + + QtDialogs.FileDialog { + id: netctlFileDialog + title: i18n("Select a path") + folder: "/usr/bin" + nameFilters: [ "All files (*)" ] + selectExisting: true + onAccepted: netctlPath.text = netctlFileDialog.fileUrl + } + } + + QtLayouts.RowLayout { + QtControls.Label { + text: i18n("Path to netctl-auto") + } + QtControls.TextField { + id: netctlAutoPath + QtLayouts.Layout.fillWidth: true + text: plasmoid.configuration.netctlAutoPath + } + QtControls.Button { + text: i18n("Browse") + onClicked: netctlAutoFileDialog.visible = true + } + + QtDialogs.FileDialog { + id: netctlAutoFileDialog + title: i18n("Select a path") + folder: "/usr/bin" + nameFilters: [ "All files (*)" ] + selectExisting: true + onAccepted: netctlAutoPath.text = netctlAutoFileDialog.fileUrl + } + } + + QtLayouts.RowLayout { + QtControls.CheckBox { + id: useSudo + text: i18n("Use sudo for netctl") + } + QtControls.TextField { + id: sudoPath + enabled: useSudo.checked + QtLayouts.Layout.fillWidth: true + text: plasmoid.configuration.sudoPath + } + QtControls.Button { + enabled: useSudo.checked + text: i18n("Browse") + onClicked: sudoFileDialog.visible = true + } + + QtDialogs.FileDialog { + id: sudoFileDialog + title: i18n("Select a path") + folder: "/usr/bin" + nameFilters: [ "All files (*)" ] + selectExisting: true + onAccepted: sudoPath.text = sudoFileDialog.fileUrl + } + } + + QtLayouts.RowLayout { + QtControls.CheckBox { + id: useWifi + text: i18n("Show 'Start WiFi menu'") + } + QtControls.TextField { + id: wifiPath + enabled: useWifi.checked + QtLayouts.Layout.fillWidth: true + text: plasmoid.configuration.wifiPath + } + QtControls.Button { + enabled: useWifi.checked + text: i18n("Browse") + onClicked: wifiFileDialog.visible = true + } + + QtDialogs.FileDialog { + id: wifiFileDialog + title: i18n("Select a path") + folder: "/usr/bin" + nameFilters: [ "All files (*)" ] + selectExisting: true + onAccepted: wifiPath.text = wifiFileDialog.fileUrl + } + } + + QtControls.TextArea { + id: textPattern + QtLayouts.Layout.fillWidth: true + text: plasmoid.configuration.textPattern + } + } +}