diff --git a/mobile/CMakeLists.txt b/mobile/CMakeLists.txt index 5d1e0e72..1f87762f 100644 --- a/mobile/CMakeLists.txt +++ b/mobile/CMakeLists.txt @@ -1,3 +1,2 @@ - install(FILES wifi.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -kpackage_install_package(package wifi kcms ) +kpackage_install_package(package wifi kcms) diff --git a/mobile/package/contents/ui/ConnectionEditorDialog.qml b/mobile/package/contents/ui/ConnectionEditorDialog.qml index ecd2038d..f79f011f 100644 --- a/mobile/package/contents/ui/ConnectionEditorDialog.qml +++ b/mobile/package/contents/ui/ConnectionEditorDialog.qml @@ -1,78 +1,75 @@ - /* - * - * Copyright 2017 Martin Kacej <> + * Copyright 2017 Martin Kacej * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Controls 1.4 as Controls import QtQuick.Layouts 1.2 -import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras PlasmaExtras.ScrollArea { property var details property var str: 0 ColumnLayout{ id: columnlayout //anchors.fill: parent PlasmaComponents.Label { text: i18n("SSID") } PlasmaComponents.TextField { Layout.fillWidth: true placeholderText: i18n("None") } PlasmaComponents.Label { text: i18n("Security") } Controls.ComboBox { id: combobox Layout.fillWidth: true model: [i18n("None"), i18n("WEP Key"), i18n("Dynamic WEP"), i18n("WPA/WPA2 Personal"), i18n("WPA/WPA2 Enterprise")] } RowLayout { anchors.top: combobox.bottom PlasmaComponents.Label { anchors.left: parent.left text: i18n("Advanced options") } PlasmaComponents.Switch { id: advancedOptionsSwitch checked: false } } - IPDetailsSection{ + IPDetailsSection { visible: advancedOptionsSwitch.checked } - ProxyDetailsSection{ + ProxyDetailsSection { visible: advancedOptionsSwitch.checked } } - function save(){ + function save() { console.info('Connection saved') } } diff --git a/mobile/package/contents/ui/IPDetailsSection.qml b/mobile/package/contents/ui/IPDetailsSection.qml index 63c04583..952a488f 100644 --- a/mobile/package/contents/ui/IPDetailsSection.qml +++ b/mobile/package/contents/ui/IPDetailsSection.qml @@ -1,63 +1,80 @@ +/* + * Copyright 2017 Martin Kacej + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 or + * (at your option) any later version. + * + * This program 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 Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + import QtQuick 2.2 import QtQuick.Controls 1.4 as Controls import QtQuick.Layouts 1.2 -import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.plasma.extras 2.0 as PlasmaExtras ColumnLayout{ property var adress: "" property var gateway: "" spacing: units.gridUnit - PlasmaComponents.Label{ + PlasmaComponents.Label { text: i18n("IP Settings") } - PlasmaComponents.Switch{ + PlasmaComponents.Switch { id: manualIPCheckbox checked: false onCheckedChanged: { manuaIPSettings.visible = checked } } - ColumnLayout{ + ColumnLayout { id: manuaIPSettings anchors.top: manualIPCheckbox.bottom visible: false - PlasmaComponents.Label{ + PlasmaComponents.Label { text: i18n("IP Address") } - Controls.TextField{ + Controls.TextField { placeholderText: i18n("193.168.1.128") text: adress } - PlasmaComponents.Label{ + PlasmaComponents.Label { text: i18n("Gateway") } - Controls.TextField{ + Controls.TextField { placeholderText: i18n("192.168.1.1") } - PlasmaComponents.Label{ + PlasmaComponents.Label { text: i18n("Network prefix length") } - Controls.TextField{ + Controls.TextField { placeholderText: i18n("24") } PlasmaComponents.Label{ text: i18n("DNS") } - Controls.TextField{ + Controls.TextField { placeholderText: i18n("8.8.8.8") } } } diff --git a/mobile/package/contents/ui/NetworkDetailsView.qml b/mobile/package/contents/ui/NetworkDetailsView.qml index ff752759..5a45e84d 100644 --- a/mobile/package/contents/ui/NetworkDetailsView.qml +++ b/mobile/package/contents/ui/NetworkDetailsView.qml @@ -1,93 +1,130 @@ /* - * - * Copyright 2017 Martin Kacej <> + * Copyright 2017 Martin Kacej * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.2 import QtQuick.Controls 1.4 as Controls import QtQuick.Layouts 1.2 -import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras PlasmaExtras.ScrollArea{ property var details - property var signal_strength: 0 - property var signal_speed: 0 - property var ip_address: 0 - property var security: "Unknown" + property alias signal_strength: signalStrengthLabel.text + property alias signal_speed: linkSpeedLabel.text + property alias ip_address: securityLabel.text + property alias security: ipAddressLabel.text Column { - Column{ + Column { id: staticInfo anchors.bottomMargin: units.gridUnit - PlasmaComponents.Label { - text: i18n("Strength: " + signal_strength) + Row { + spacing: units.gridUnit / 2 + + PlasmaComponents.Label { + font.weight: Font.Bold + text: i18n("Strength:") + } + + PlasmaComponents.Label { + id: signalStrengthLabel + } } - PlasmaComponents.Label{ - text: i18n("Link Speed: " + signal_speed) + + Row { + spacing: units.gridUnit / 2 + + PlasmaComponents.Label { + font.weight: Font.Bold + text: i18n("Link Speed:") + } + + PlasmaComponents.Label { + id: linkSpeedLabel + } } - PlasmaComponents.Label{ - text: i18n("Security: " +security) + + Row { + spacing: units.gridUnit / 2 + + PlasmaComponents.Label { + font.weight: Font.Bold + text: i18n("Security:") + } + + PlasmaComponents.Label { + id: securityLabel + } } - PlasmaComponents.Label{ - text: i18n("IP Address: " + ip_address) + + Row { + spacing: units.gridUnit / 2 + + PlasmaComponents.Label { + font.weight: Font.Bold + text: i18n("IP Address:") + } + + PlasmaComponents.Label { + id: ipAddressLabel + } } } RowLayout { PlasmaComponents.Label { anchors.left: parent.left text: i18n("Advanced options") } PlasmaComponents.Switch { id: advancedOptionsSwitch checked: false } } - IPDetailsSection{ + IPDetailsSection { id: detailsIP visible: advancedOptionsSwitch.checked } - - ProxyDetailsSection{ - visible: advancedOptionsSwitch.checked - } } function fillDetails() { var d = {} for (var i = 0; i < (details.length / 2); i++){ console.info(details[i]) d[details[(i * 2)]] = details[(i * 2) + 1] } - if(d['Access point (SSID)']) detailsDialog.titleText = d['Access point (SSID)'] + if (d['Access point (SSID)']) + detailsDialog.titleText = d['Access point (SSID)'] signal_strength = d['Signal strength'] - if (d['IPv4 Address']) ip_address = detailsIP.adress = d['IPv4 Address'] - if (d['Security type']) security = d['Security type'] - if (d['Connection speed']) signal_speed = d['Connection speed'] + if (d['IPv4 Address']) + ip_address = detailsIP.adress = d['IPv4 Address'] + if (d['Security type']) + security = d['Security type'] + if (d['Connection speed']) + signal_speed = d['Connection speed'] } - function clearDetails(){ + function clearDetails() { signal_speed = signal_strength = ip_address = 0 security = "Unknown" detailsIP.adress = detailsIP.gateway = '' } } diff --git a/mobile/package/contents/ui/ProxyDetailsSection.qml b/mobile/package/contents/ui/ProxyDetailsSection.qml deleted file mode 100644 index 71dced26..00000000 --- a/mobile/package/contents/ui/ProxyDetailsSection.qml +++ /dev/null @@ -1,51 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.4 as Controls -import QtQuick.Layouts 1.2 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.components 2.0 as PlasmaComponents -import org.kde.plasma.extras 2.0 as PlasmaExtras -ColumnLayout{ - spacing: units.gridUnit - - PlasmaComponents.Label{ - text: i18n("Proxy settings") - } - - PlasmaComponents.CheckBox{ - id: manualProxyCheck - checked: false - onCheckedChanged: { - manuaProxySettings.visible = checked - } - } - - ColumnLayout{ - id: manuaProxySettings - anchors.top: manualProxyCheck.bottom - visible: false - - PlasmaComponents.Label{ - text: i18n("Proxy hostname") - } - - Controls.TextField{ - placeholderText: i18n("my.proxy.com") - } - - PlasmaComponents.Label{ - text: i18n("Proxy port") - } - - Controls.TextField{ - placeholderText: i18n("8080") - } - - PlasmaComponents.Label{ - text: i18n("Bypass proxy for") - } - - Controls.TextField{ - placeholderText: i18n("example.com,mytest.com") - } - } -} diff --git a/mobile/package/contents/ui/RowItemDelegate.qml b/mobile/package/contents/ui/RowItemDelegate.qml index 71c7da39..8b3e51cc 100644 --- a/mobile/package/contents/ui/RowItemDelegate.qml +++ b/mobile/package/contents/ui/RowItemDelegate.qml @@ -1,111 +1,111 @@ /* - * - * Copyright 2017 Martin Kacej <> + * Copyright 2017 Martin Kacej * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import QtQuick.Controls 1.4 as Controls import QtQuick.Layouts 1.2 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.kirigami 1.0 as Kirigami -Kirigami.SwipeListItem{ +Kirigami.SwipeListItem { width: parent.width enabled: true backgroundColor: theme.backgroundColor - Item{ + Item { height: connectionSvgIcon.height width: parent.width PlasmaCore.SvgItem { id: connectionSvgIcon anchors { left: parent.left rightMargin: 10 } elementId: ConnectionIcon //height: units.iconSizes.big; width: height svg: PlasmaCore.Svg { multipleImages: true imagePath: "icons/network" colorGroup: PlasmaCore.ColorScope.colorGroup } } PlasmaComponents.BusyIndicator { id: connectingIndicator anchors { left: parent.left horizontalCenter: connectionSvgIcon.horizontalCenter verticalCenter: connectionSvgIcon.verticalCenter } height: units.iconSizes.medium; width: height running: ConnectionState == PlasmaNM.Enums.Activating visible: running } PlasmaComponents.Label { id: connectionNameLabel anchors { left: connectionSvgIcon.right leftMargin: units.gridUnit verticalCenter: connectionSvgIcon.verticalCenter } height: paintedHeight elide: Text.ElideRight font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal font.italic: ConnectionState == PlasmaNM.Enums.Activating ? true : false text: ItemUniqueName textFormat: Text.PlainText } } actions: [ Kirigami.Action { iconName: "configure-small" onTriggered: { - if (ConnectionDetails) networkDetailsViewContent.details = ConnectionDetails + if (ConnectionDetails) + networkDetailsViewContent.details = ConnectionDetails if (ConnectionDetails[1] !== "") { detailsDialog.titleText = ItemUniqueName } else { detailsDialog.titleText = i18n("Network details") } networkDetailsViewContent.fillDetails() detailsDialog.open() } }, Kirigami.Action { iconName: "remove" onTriggered: { forgetNetwork() } } ] - function connect(){ + function connect() { console.info(ConnectionDetails[1]+' trying to connect') } - function forgetNetwork(){ + function forgetNetwork() { console.info(ConnectionDetails[1]+' trying to forget') } } diff --git a/mobile/package/contents/ui/Wifi.qml b/mobile/package/contents/ui/Wifi.qml index 08b37832..ad78526f 100644 --- a/mobile/package/contents/ui/Wifi.qml +++ b/mobile/package/contents/ui/Wifi.qml @@ -1,200 +1,197 @@ /* - * - * Copyright 2017 Martin Kacej <> + * Copyright 2017 Martin Kacej * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program 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 Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import QtQuick.Controls 1.4 as Controls import QtQuick.Layouts 1.2 -import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras -import org.kde.active.settings 2.0 as ActiveSettings import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.kirigami 1.0 as Kirigami Item { id: main objectName: "wifiMain" width: units.gridUnit * 30 height: width * 1.5 PlasmaNM.Handler { id: handler } PlasmaNM.EnabledConnections { id: enabledConnections onWirelessEnabledChanged: { wifiSwitchButton.checked = wifiSwitchButton.enabled && enabled } } PlasmaNM.NetworkModel { id: connectionModel } PlasmaNM.MobileAppletProxyModel { id: mobileappletProxyModel sourceModel: connectionModel } Item { id: formLayout anchors { fill: parent margins: units.gridUnit leftMargin: units.gridUnit / 2 } RowLayout { id: layoutrow width: parent.width PlasmaComponents.Label { anchors.left: parent.left text: i18n("Wifi") Layout.fillWidth: true } - Controls.Switch{ + Controls.Switch { id: wifiSwitchButton checked: enabled && enabledConnections.wirelessEnabled enabled: enabledConnections.wirelessHwEnabled onClicked: { handler.enableWireless(checked); } } } Rectangle { id: separator anchors.top: layoutrow.bottom anchors.topMargin: 10 width: parent.width height: units.gridUnit / 8 border.color: "grey" } Controls.Label { id: label anchors { left: parent.left top: separator.bottom } text: i18n("Available wifi networks") font.bold: true Layout.fillWidth: true } PlasmaExtras.ScrollArea { id: wifiarea anchors { top: label.bottom bottomMargin: units.gridUnit*2 bottom: parent.bottom left: parent.left right: parent.right } ListView { id: view anchors.fill: parent clip: true width: parent.width currentIndex: -1 boundsBehavior: Flickable.StopAtBounds model: mobileappletProxyModel delegate: RowItemDelegate { onClicked: { connect() } } } } PlasmaComponents.Button { id: customConnectionButton anchors.top: wifiarea.bottom anchors.topMargin: units.gridUnit text: i18n("Add custom connection") onClicked: connectionEditorDialog.open() } } PlasmaComponents.Dialog { id: connectionEditorDialog title: i18n("Connection Editor") buttons: RowLayout { width: parent.width PlasmaComponents.Button { text: 'Save' onClicked:{ connectionEditorDialogContent.save() connectionEditorDialog.close() } } - PlasmaComponents.Button{ + PlasmaComponents.Button { anchors.right: parent.right text: 'Cancel' onClicked: connectionEditorDialog.close() } } content: ConnectionEditorDialog { id: connectionEditorDialogContent width: units.gridUnit * 22 height: units.gridUnit * 25 Component.onDestruction: { console.info("Destroyed editor content") } } Component.onDestruction: { console.info("Destroyed editor") connectionEditorDialogContent.destroy() } } PlasmaComponents.CommonDialog { id: detailsDialog titleText: i18n("Network Details") buttonTexts: [i18n("Close")] onButtonClicked: { networkDetailsViewContent.clearDetails() close() } content: NetworkDetailsView { id: networkDetailsViewContent width: units.gridUnit * 22 height: units.gridUnit * 25 Component.onDestruction: { console.info("Destroyed details content") } } Component.onDestruction: { console.info("Destroyed details") networkDetailsViewContent.destroy() } } Component.onDestruction: { console.error("Destroyed main") connectionEditorDialog.destroy() detailsDialog.destroy() //connectionEditorDialog.connectionEditorDialogContent.destroy() } } diff --git a/mobile/package/metadata.desktop b/mobile/package/metadata.desktop index 1f67ceb9..d467cfdf 100644 --- a/mobile/package/metadata.desktop +++ b/mobile/package/metadata.desktop @@ -1,19 +1,18 @@ [Desktop Entry] -Name=Wifi settings -Comment=Network settings - +Name=Wi-Fi +Comment=Wireless network setting Encoding=UTF-8 Type=Service Icon=network-wireless-symbolic X-KDE-ServiceTypes=Active/SettingsModule X-KDE-PluginInfo-Author=Martin Kacej X-KDE-PluginInfo-Email=m.kacej@atlas.sk X-KDE-PluginInfo-Name=wifi X-KDE-PluginInfo-Version=0.1 -X-KDE-PluginInfo-Website=http://plasma-active.org -X-KDE-PluginInfo-Category=Online Services +X-KDE-PluginInfo-Website=https://plasma-mobile.org/ +X-KDE-PluginInfo-Category=System Information X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true X-KDE-FormFactors=handset,tablet,mediacenter X-Plasma-MainScript=ui/Wifi.qml diff --git a/mobile/wifi.desktop b/mobile/wifi.desktop index 6f5a2466..8769879e 100755 --- a/mobile/wifi.desktop +++ b/mobile/wifi.desktop @@ -1,20 +1,19 @@ [Desktop Entry] -Name=Network Settings -Comment=Wifi, Bluetooth, Mobile Networks Settings +Name=Wi-Fi +Comment=Wireless network setting Icon=network-wireless-symbolic Exec=plasma-settings -m wifi Type=Service X-KDE-ServiceTypes=KCModule -#X-KDE-Library=kcm_mobile_power X-KDE-ParentApp=kcontrol X-KDE-FormFactors=handset,tablet,mediacenter X-KDE-System-Settings-Parent-Category=display X-KDE-Weight=70 X-KDE-Keywords=wifi,network Categories=Qt;KDE;X-KDE-settings-system;