update ChangeLog

update CmakeLists
update PKGBUILDs
fix GUI building
This commit is contained in:
arcan1s
2015-01-12 01:14:40 +03:00
parent 582459d174
commit cf12b3627e
44 changed files with 354 additions and 246 deletions

View File

@ -0,0 +1,97 @@
/***************************************************************************
* 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.3 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts
import org.kde.plasma.private.netctl 1.0
Item {
id: aboutPage
width: childrenRect.width
height: childrenRect.height
implicitWidth: pageColumn.implicitWidth
implicitHeight: pageColumn.implicitHeight
property bool debug: NetctlAdds.isDebugEnabled()
Column {
id: pageColumn
width: units.gridUnit * 25
QtControls.TabView {
height: parent.height
width: parent.width
QtControls.Tab {
title: i18n("About")
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: NetctlAdds.getAboutText("header")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
text: NetctlAdds.getAboutText("description")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: NetctlAdds.getAboutText("links")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
font.capitalization: Font.SmallCaps
horizontalAlignment: Text.AlignHCenter
textFormat: Text.RichText
text: NetctlAdds.getAboutText("copy")
}
}
}
QtControls.Tab {
title: i18n("Acknowledgment")
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
text: NetctlAdds.getAboutText("translators")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
textFormat: Text.RichText
text: NetctlAdds.getAboutText("3rdparty")
}
}
}
}
}
Component.onCompleted: {
if (debug) console.log("[about::onCompleted]")
}
}

View File

@ -0,0 +1,331 @@
/***************************************************************************
* 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.3 as QtControls
import QtQuick.Controls.Styles 1.3 as QtStyles
import QtQuick.Dialogs 1.1 as QtDialogs
import QtQuick.Layouts 1.0 as QtLayouts
import org.kde.plasma.private.netctl 1.0
Item {
id: appearancePage
width: childrenRect.width
height: childrenRect.height
implicitWidth: pageColumn.implicitWidth
implicitHeight: pageColumn.implicitHeight
property bool debug: NetctlAdds.isDebugEnabled()
property variant weight: {
25: 0,
50: 1,
63: 3,
75: 4,
87: 5
}
property string cfg_textAlign: textAlign.currentText
property alias cfg_fontFamily: selectFont.text
property alias cfg_fontSize: fontSize.value
property string cfg_fontWeight: fontWeight.currentText
property string cfg_fontStyle: fontStyle.currentText
property alias cfg_fontColor: selectColor.text
property alias cfg_activeIconPath: activeIcon.text
property alias cfg_inactiveIconPath: inactiveIcon.text
Column {
id: pageColumn
width: units.gridUnit * 25
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Text align")
}
QtControls.ComboBox {
id: textAlign
width: parent.width * 2 / 3
textRole: "label"
model: [
{
'label': i18n("center"),
'name': "center"
},
{
'label': i18n("right"),
'name': "right"
},
{
'label': i18n("left"),
'name': "left"
},
{
'label': i18n("justify"),
'name': "justify"
}
]
onCurrentIndexChanged: cfg_textAlign = model[currentIndex]["name"]
Component.onCompleted: {
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.textAlign) {
textAlign.currentIndex = i;
}
}
}
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font")
}
QtControls.Button {
id: selectFont
width: parent.width * 2 / 3
text: plasmoid.configuration.fontFamily
onClicked: fontDialog.visible = true
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font size")
}
QtControls.SpinBox {
id: fontSize
width: parent.width * 2 / 3
minimumValue: 8
maximumValue: 32
stepSize: 1
value: plasmoid.configuration.fontSize
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font weight")
}
QtControls.ComboBox {
id: fontWeight
width: parent.width * 2 / 3
textRole: "label"
model: [
{
'label': i18n("light"),
'name': "light"
},
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("demi bold"),
'name': "demibold"
},
{
'label': i18n("bold"),
'name': "bold"
},
{
'label': i18n("black"),
'name': "black"
}
]
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
Component.onCompleted: {
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
fontWeight.currentIndex = i;
}
}
}
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font style")
}
QtControls.ComboBox {
id: fontStyle
width: parent.width * 2 / 3
textRole: "label"
model: [
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("italic"),
'name': "italic"
}
]
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
Component.onCompleted: {
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
fontStyle.currentIndex = i;
}
}
}
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font color")
}
QtControls.Button {
id: selectColor
width: parent.width * 2 / 3
style: QtStyles.ButtonStyle {
background: Rectangle {
color: plasmoid.configuration.fontColor
}
}
text: plasmoid.configuration.fontColor
onClicked: colorDialog.visible = true
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Active icon")
}
QtControls.TextField {
id: activeIcon
height: parent.height
width: parent.width * 2 / 3 - activeIconButton.width
text: plasmoid.configuration.activeIconPath
}
QtControls.Button {
id: activeIconButton
text: i18n("Browse")
onClicked: activeFileDialog.visible = true
}
QtDialogs.FileDialog {
id: activeFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
selectExisting: true
onAccepted: activeIcon.text = activeFileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Inactive icon")
}
QtControls.TextField {
id: inactiveIcon
height: parent.height
width: parent.width * 2 / 3 - inactiveIconButton.width
text: plasmoid.configuration.inactiveIconPath
}
QtControls.Button {
id: inactiveIconButton
text: i18n("Browse")
onClicked: inactiveFileDialog.visible = true
}
QtDialogs.FileDialog {
id: inactiveFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
selectExisting: true
onAccepted: inactiveIcon.text = inactiveFileDialog.fileUrl
}
}
}
QtDialogs.ColorDialog {
id: colorDialog
title: i18n("Select a color")
color: selectColor.text
onAccepted: {
selectColor.text = colorDialog.color
}
}
QtDialogs.FontDialog {
id: fontDialog
title: i18n("Select a font")
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
onAccepted: {
selectFont.text = fontDialog.font.family
fontSize.value = fontDialog.font.pointSize
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
fontWeight.currentIndex = weight[fontDialog.font.weight]
}
}
Component.onCompleted: {
if (debug) console.log("[about::onCompleted]")
}
}

View File

@ -0,0 +1,233 @@
/***************************************************************************
* 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
import QtQuick.Controls.Styles 1.3 as QtStyles
import org.kde.plasma.private.netctl 1.0
Item {
id: dataenginePage
width: childrenRect.width
height: childrenRect.height
implicitWidth: pageColumn.implicitWidth
implicitHeight: pageColumn.implicitHeight
property bool debug: NetctlAdds.isDebugEnabled()
property variant cfg_dataengine: NetctlAdds.readDataEngineConfiguration()
Column {
id: pageColumn
width: units.gridUnit * 25
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Path to netctl")
}
QtControls.TextField {
id: netctlPath
height: parent.height
width: parent.width * 3 / 5 - netctlPathButton.width
text: cfg_dataengine["NETCTLCMD"]
}
QtControls.Button {
id: netctlPathButton
text: i18n("Browse")
onClicked: netctlFileDialog.visible = true
}
QtDialogs.FileDialog {
id: netctlFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: netctlPath.text = netctlFileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Path to netctl-auto")
}
QtControls.TextField {
id: netctlAutoPath
height: parent.height
width: parent.width * 3 / 5 - netctlAutoPathButton.width
text: cfg_dataengine["NETCTLAUTOCMD"]
}
QtControls.Button {
id: netctlAutoPathButton
text: i18n("Browse")
onClicked: netctlAutoFileDialog.visible = true
}
QtDialogs.FileDialog {
id: netctlAutoFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: netctlAutoPath.text = netctlAutoFileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5 - extIp4.width
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Check external IPv4")
}
QtControls.CheckBox {
id: extIp4
height: parent.height
width: implicitWidth
checked: cfg_dataengine["EXTIP4"] == "true"
style: QtStyles.CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 3
border.width: 1
border.color: control.activeFocus ? "darkblue" : "gray"
Rectangle {
visible: control.checked
radius: 1
anchors.fill: parent
anchors.margins: 4
color: "#555555"
border.color: "#333333"
}
}
}
}
QtControls.TextField {
id: extIp4Path
enabled: extIp4.checked
height: parent.height
width: parent.width * 3 / 5 - extIp4PathButton.width
text: cfg_dataengine["EXTIP4CMD"]
}
QtControls.Button {
id: extIp4PathButton
enabled: extIp4.checked
text: i18n("Browse")
onClicked: extIp4FileDialog.visible = true
}
QtDialogs.FileDialog {
id: extIp4FileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: extIp4Path.text = extIp4FileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5 - extIp6.width
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Check external IPv6")
}
QtControls.CheckBox {
id: extIp6
height: parent.height
width: implicitWidth
checked: cfg_dataengine["EXTIP6"] == "true"
style: QtStyles.CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 3
border.width: 1
border.color: control.activeFocus ? "darkblue" : "gray"
Rectangle {
visible: control.checked
radius: 1
anchors.fill: parent
anchors.margins: 4
color: "#555555"
border.color: "#333333"
}
}
}
}
QtControls.TextField {
id: extIp6Path
enabled: extIp6.checked
height: parent.height
width: parent.width * 3 / 5 - extIp6PathButton.width
text: cfg_dataengine["EXTIP6CMD"]
}
QtControls.Button {
id: extIp6PathButton
enabled: extIp6.checked
text: i18n("Browse")
onClicked: extIp6FileDialog.visible = true
}
QtDialogs.FileDialog {
id: extIp6FileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: extIp6Path.text = extIp6FileDialog.fileUrl
}
}
}
Component.onCompleted: {
if (debug) console.log("[about::onCompleted]")
}
Component.onDestruction: {
cfg_dataengine["EXTIP4"] = extIp4.checked ? "true" : "false"
cfg_dataengine["EXTIP6"] = extIp6.checked ? "true" : "false"
NetctlAdds.writeDataEngineConfiguration(cfg_dataengine)
}
}

View File

@ -0,0 +1,276 @@
/***************************************************************************
* 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.4
import QtQuick.Controls 1.3 as QtControls
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.private.netctl 1.0
Item {
id: main
// variables
// internal
property bool debug: NetctlAdds.isDebugEnabled()
property variant fontWeight: {
"light": Font.Light,
"normal": Font.Normal,
"demibold": Font.DemiBold,
"bold": Font.Bold,
"black": Font.Black
}
property variant align: {
"left": Text.AlignLeft,
"center": Text.AlignHCenter,
"right": Text.AlignRight,
"justify": Text.AlignJustify
}
// external
property variant iconPath: {
"true": plasmoid.configuration.activeIconPath,
"false": plasmoid.configuration.inactiveIconPath
}
property variant info: {
"active": "false",
"current": "N\\A",
"extip4": "127.0.0.1",
"extip6": "::1",
"info": "N\\A",
"intip4": "127.0.0.1",
"intip6": "::1",
"interfaces": "lo",
"profiles": "",
"status": "N\\A"
}
property string pattern: plasmoid.configuration.textPattern
property bool status: false
property string sudoPath: plasmoid.configuration.useSudo ? plasmoid.configuration.sudoPath : ""
// signals
signal needUpdate
signal netctlStateChanged
// init
Plasmoid.icon: iconPath["false"]
Plasmoid.backgroundHints: "DefaultBackground"
Plasmoid.toolTipMainText: "Netctl"
Plasmoid.associatedApplication: plasmoid.configuration.guiPath
PlasmaCore.DataSource {
id: mainData
engine: "netctl"
connectedSources: ["active", "current", "extip4", "extip6", "interfaces", "intip4", "intip6", "profiles", "status"]
interval: plasmoid.configuration.autoUpdateInterval
onNewData: {
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
var needToBeUpdated = false
if (data.value == "N\\A") return
if (info[sourceName] != data.value) needToBeUpdated = true
if (sourceName == "active") {
if (info[sourceName] != data.value)
// inverterd status
NetctlAdds.sendNotification("Info", i18n("Network status has been changed to '%1'",
status ? i18n("inactive") : i18n("active")))
status = data.value == "true"
} else if (sourceName == "current") {
info["info"] = NetctlAdds.getInfo(data.value, info["status"])
}
// update
info[sourceName] = data.value
if (needToBeUpdated) needUpdate()
}
}
// ui
Grid {
id: mainGrid
columns: 2
Image {
id: icon
source: iconPath["false"]
}
Text {
id: text
color: plasmoid.configuration.fontColor
font.family: plasmoid.configuration.fontFamily
font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
font.pointSize: plasmoid.configuration.fontSize
font.weight: fontWeight[plasmoid.configuration.fontWeight]
horizontalAlignment: align[plasmoid.configuration.textAlign]
textFormat: Text.RichText
text: "N\\A"
}
}
Component.onCompleted: {
if (debug) console.log("[main::onCompleted]")
// actions
plasmoid.setAction("titleAction", "netctl-gui", plasmoid.icon)
plasmoid.setAction("startProfile", i18n("Start profile"), "dialog-apply")
plasmoid.setAction("stopProfile", i18n("Stop profile"), "dialog-close")
plasmoid.setAction("stopAllProfiles", i18n("Stop all profiles"), "dialog-close")
plasmoid.setAction("switchToProfile", i18n("Switch to profile"))
plasmoid.setAction("restartProfile", i18n("Restart profile"), "stock-refresh")
plasmoid.setAction("enableProfile", i18n("Enable profile"))
plasmoid.setAction("startWifi", i18n("Show WiFi menu"), "image://netctl/wifi.png")
// helper
if (plasmoid.configuration.useHelper) {
NetctlAdds.runCmd(plasmoid.configuration.helperPath)
plasmoid.configuration.useHelper = NetctlAdds.checkHelperStatus()
}
}
onNeedUpdate: {
if (debug) console.log("[main::onNeedUpdate]")
icon.source = iconPath[info["active"]]
Plasmoid.icon = iconPath[info["active"]]
text.text = NetctlAdds.parsePattern(pattern, info)
Plasmoid.toolTipSubText = info["info"]
netctlStateChanged()
// updae geometry
text.update()
icon.height = text.contentHeight
icon.width = text.contentHeight
icon.update()
height = text.contentHeight
width = icon.paintedWidth + text.contentWidth
update()
}
onNetctlStateChanged: {
if (debug) console.log("[main::onNetctlStateChanged]")
var titleAction = plasmoid.action("titleAction")
var startAction = plasmoid.action("startProfile")
var stopAction = plasmoid.action("stopProfile")
var stopAllAction = plasmoid.action("stopAllProfiles")
var switchToAction = plasmoid.action("switchToProfile")
var restartAction = plasmoid.action("restartProfile")
var enableAction = plasmoid.action("enableProfile")
var wifiAction = plasmoid.action("startWifi")
titleAction.iconSource = plasmoid.icon
titleAction.text = info["current"] + " " + info["status"]
if (info["status"] == "(netctl-auto)") {
startAction.visible = false
stopAction.visible = false
stopAllAction.visible = false
switchToAction.visible = true
restartAction.visible = false
enableAction.visible = false
} else {
if (info["current"].indexOf("|") > -1) {
startAction.visible = true
stopAction.visible = false
stopAllAction.visible = true
switchToAction.visible = false
restartAction.visible = false
enableAction.visible = false
} else {
startAction.visible = true
stopAction.visible = status
stopAllAction.visible = false
switchToAction.visible = false
restartAction.visible = status
enableAction.visible = status
}
if (status) {
startAction.text = i18n("Start another profile")
stopAction.text = i18n("Stop %1", info["current"])
restartAction.text = i18n("Restart %1", info["current"])
if (info["status"].indexOf("enabled") > -1)
enableAction.text = i18n("Disable %1", info["current"])
else
enableAction.text = i18n("Enable %1", info["current"])
} else
startAction.text = i18n("Start profile")
}
wifiAction.visible = plasmoid.configuration.useWifi
}
function action_titleAction() {
if (debug) console.log("[main::action_titleAction]")
NetctlAdds.runCmd(plasmoid.configuration.guiPath)
}
function action_startProfile() {
if (debug) console.log("[main::action_startProfile]")
NetctlAdds.startProfileSlot(info["profiles"].split(","), status,
plasmoid.configuration.useHelper,
plasmoid.configuration.netctlPath,
sudoPath)
}
function action_stopProfile() {
if (debug) console.log("[main::action_stopProfile]")
NetctlAdds.stopProfileSlot(info, plasmoid.configuration.useHelper,
plasmoid.configuration.netctlPath,
sudoPath)
}
function action_stopAllProfiles() {
if (debug) console.log("[main::action_stopAllProfiles]")
NetctlAdds.stopAllProfilesSlot(plasmoid.configuration.useHelper,
plasmoid.configuration.netctlPath,
sudoPath)
}
function action_switchToProfile() {
if (debug) console.log("[main::action_switchToProfile]")
NetctlAdds.switchToProfileSlot(info["profiles"].split(","),
plasmoid.configuration.useHelper,
plasmoid.configuration.netctlAutoPath)
}
function action_restartProfile() {
if (debug) console.log("[main::action_restartProfile]")
NetctlAdds.restartProfileSlot(info, plasmoid.configuration.useHelper,
plasmoid.configuration.netctlPath,
sudoPath)
}
function action_enableProfile() {
if (debug) console.log("[main::action_enableProfile]")
NetctlAdds.enableProfileSlot(info, plasmoid.configuration.useHelper,
plasmoid.configuration.netctlPath,
sudoPath)
}
function action_startWifi() {
if (debug) console.log("[main::action_startWifi]")
NetctlAdds.runCmd(plasmoid.configuration.wifiPath)
}
}

View File

@ -0,0 +1,355 @@
/***************************************************************************
* 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.3 as QtControls
import QtQuick.Dialogs 1.1 as QtDialogs
import QtQuick.Layouts 1.0 as QtLayouts
import QtQuick.Controls.Styles 1.3 as QtStyles
import org.kde.plasma.private.netctl 1.0
Item {
id: widgetPage
width: childrenRect.width
height: childrenRect.height
implicitWidth: pageColumn.implicitWidth
implicitHeight: pageColumn.implicitHeight
property bool debug: NetctlAdds.isDebugEnabled()
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
Column {
id: pageColumn
width: units.gridUnit * 25
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Auto update interval, msec")
}
QtControls.SpinBox {
id: autoUpdate
width: parent.width * 3 / 5
minimumValue: 1000
maximumValue: 10000
stepSize: 500
value: plasmoid.configuration.autoUpdateInterval
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Path to GUI")
}
QtControls.TextField {
id: guiPath
height: parent.height
width: parent.width * 3 / 5 - guiPathButton.width
text: plasmoid.configuration.guiPath
}
QtControls.Button {
id: guiPathButton
text: i18n("Browse")
onClicked: guiFileDialog.visible = true
}
QtDialogs.FileDialog {
id: guiFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: guiPath.text = guiFileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5 - useHelper.width
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Use helper")
}
QtControls.CheckBox {
id: useHelper
height: parent.height
width: implicitWidth
style: QtStyles.CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 3
border.width: 1
border.color: control.activeFocus ? "darkblue" : "gray"
Rectangle {
visible: control.checked
radius: 1
anchors.fill: parent
anchors.margins: 4
color: "#555555"
border.color: "#333333"
}
}
}
}
QtControls.TextField {
id: helperPath
enabled: useHelper.checked
height: parent.height
width: parent.width * 3 / 5 - helperPathButton.width
text: plasmoid.configuration.helperPath
}
QtControls.Button {
id: helperPathButton
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
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Path to netctl")
}
QtControls.TextField {
id: netctlPath
enabled: !useHelper.checked
height: parent.height
width: parent.width * 3 / 5 - netctlPathButton.width
text: plasmoid.configuration.netctlPath
}
QtControls.Button {
id: netctlPathButton
enabled: !useHelper.checked
text: i18n("Browse")
onClicked: netctlFileDialog.visible = true
}
QtDialogs.FileDialog {
id: netctlFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: netctlPath.text = netctlFileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Path to netctl-auto")
}
QtControls.TextField {
id: netctlAutoPath
enabled: !useHelper.checked
height: parent.height
width: parent.width * 3 / 5 - netctlAutoPathButton.width
text: plasmoid.configuration.netctlAutoPath
}
QtControls.Button {
id: netctlAutoPathButton
enabled: !useHelper.checked
text: i18n("Browse")
onClicked: netctlAutoFileDialog.visible = true
}
QtDialogs.FileDialog {
id: netctlAutoFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: netctlAutoPath.text = netctlAutoFileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5 - useSudo.width
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Use sudo for netctl")
}
QtControls.CheckBox {
id: useSudo
height: parent.height
width: implicitWidth
style: QtStyles.CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 3
border.width: 1
border.color: control.activeFocus ? "darkblue" : "gray"
Rectangle {
visible: control.checked
radius: 1
anchors.fill: parent
anchors.margins: 4
color: "#555555"
border.color: "#333333"
}
}
}
}
QtControls.TextField {
id: sudoPath
enabled: useSudo.checked
height: parent.height
width: parent.width * 3 / 5 - sudoPathButton.width
text: plasmoid.configuration.sudoPath
}
QtControls.Button {
id: sudoPathButton
enabled: useSudo.checked
text: i18n("Browse")
onClicked: sudoFileDialog.visible = true
}
QtDialogs.FileDialog {
id: sudoFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: sudoPath.text = sudoFileDialog.fileUrl
}
}
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5 - useWifi.width
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Show 'Start WiFi menu'")
}
QtControls.CheckBox {
id: useWifi
height: parent.height
width: implicitWidth
style: QtStyles.CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 3
border.width: 1
border.color: control.activeFocus ? "darkblue" : "gray"
Rectangle {
visible: control.checked
radius: 1
anchors.fill: parent
anchors.margins: 4
color: "#555555"
border.color: "#333333"
}
}
}
}
QtControls.TextField {
id: wifiPath
enabled: useWifi.checked
height: parent.height
width: parent.width * 3 / 5 - wifiPathButton.width
text: plasmoid.configuration.wifiPath
}
QtControls.Button {
id: wifiPathButton
enabled: useWifi.checked
text: i18n("Browse")
onClicked: wifiFileDialog.visible = true
}
QtDialogs.FileDialog {
id: wifiFileDialog
modality: Qt.NonModal
title: i18n("Select a path")
folder: "/usr/bin"
nameFilters: [ "All files (*)" ]
selectExisting: true
onAccepted: wifiPath.text = wifiFileDialog.fileUrl
}
}
QtControls.TextArea {
id: textPattern
width: parent.width
text: plasmoid.configuration.textPattern
}
}
Component.onCompleted: {
if (debug) console.log("[about::onCompleted]")
}
}