feat(wifi): add other network

pull/55/head
kateleet 4 years ago
parent 59686d9b7b
commit 7ea0515140

@ -58,6 +58,14 @@ ItemPage {
id: configuration
}
NewNetworkDialog {
id: newNetworkDialog
onConnect: {
wifiSettings.addOtherConnection(ssid, username, pwd, type)
}
}
Component.onCompleted: {
handler.requestScan()
}
@ -88,6 +96,12 @@ ItemPage {
}
}
StandardButton {
Layout.fillWidth: true
text: qsTr("Add other...")
onClicked: newNetworkDialog.show()
}
// Hotspot
//
// RoundedItem {

@ -0,0 +1,155 @@
/*
* Copyright (C) 2021 CutefishOS Team.
*
* Author: Kate Leet <kate@cutefishos.com>
*
* This program 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
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import FishUI 1.0 as FishUI
import Cutefish.NetworkManagement 1.0 as NM
FishUI.Window {
id: control
width: contentWidth
height: contentHeight
minimumWidth: contentWidth
minimumHeight: contentHeight
maximumWidth: contentWidth
maximumHeight: contentHeight
modality: Qt.WindowModal
property int contentWidth: _mainLayout.implicitWidth + header.height + FishUI.Units.largeSpacing * 2
property int contentHeight: _mainLayout.implicitHeight + header.height + FishUI.Units.largeSpacing * 2
visible: false
minimizeButtonVisible: false
background.color: FishUI.Theme.secondBackgroundColor
flags: Qt.Dialog | Qt.FramelessWindowHint
signal connect(var ssid, var username, var pwd, var type)
onVisibleChanged: {
if (visible) {
_userNameTextField.forceActiveFocus()
} else {
_nameTextField.clear()
_userNameTextField.clear()
_passwordTextField.clear()
securitybox.currentIndex = 2
}
}
ColumnLayout {
id: _mainLayout
anchors.fill: parent
anchors.margins: FishUI.Units.largeSpacing
anchors.topMargin: 0
spacing: FishUI.Units.largeSpacing
GridLayout {
columns: 2
columnSpacing: FishUI.Units.largeSpacing * 2
rowSpacing: FishUI.Units.largeSpacing
Label {
text: qsTr("Name")
}
TextField {
id: _nameTextField
placeholderText: qsTr("Network Name")
Layout.fillWidth: true
Keys.onEscapePressed: control.close()
}
Label {
text: qsTr("Security")
}
ComboBox {
id: securitybox
Layout.fillWidth: true
currentIndex: 2
model: [ qsTr("None"), "WEP", "WPA/WPA2", "WPA3" ]
}
Label {
visible: securitybox.currentIndex === 1
text: qsTr("UserName")
}
TextField {
id: _userNameTextField
visible: securitybox.currentIndex === 1
placeholderText: qsTr("Password")
focus: true
Layout.fillWidth: true
Keys.onEscapePressed: control.close()
}
Label {
visible: securitybox.currentIndex != 0
text: qsTr("Password")
}
TextField {
visible: securitybox.currentIndex != 0
id: _passwordTextField
placeholderText: qsTr("Password")
echoMode: TextInput.Password
Layout.fillWidth: true
Keys.onEscapePressed: control.close()
}
}
RowLayout {
spacing: FishUI.Units.largeSpacing
Button {
text: qsTr("Cancel")
Layout.fillWidth: true
onClicked: control.close()
}
Button {
enabled: _nameTextField.text != ""
& (_passwordTextField.text.length > 7 | securitybox.currentIndex === 0)
flat: true
text: qsTr("Join")
Layout.fillWidth: true
onClicked: {
var security_type = securitybox.currentText
if (security_type.currentIndex === 0)
type = "None"
control.connect(_nameTextField.text,
_userNameTextField.text,
_passwordTextField.text,
security_type)
control.close()
}
}
}
}
}

@ -20,6 +20,8 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../"
import FishUI 1.0 as FishUI
import Cutefish.NetworkManagement 1.0 as NM

@ -144,5 +144,6 @@
<file>qml/Notification/Main.qml</file>
<file>images/sidebar/dark/notifications.svg</file>
<file>qml/WLAN/ConnectDialog.qml</file>
<file>qml/WLAN/NewNetworkDialog.qml</file>
</qresource>
</RCC>

@ -544,6 +544,11 @@
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/WLAN/Main.qml" line="101"/>
<source>Add other...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Bluetooth/Main.qml" line="30"/>
<location filename="../src/qml/Bluetooth/Main.qml" line="93"/>
@ -656,6 +661,7 @@
</message>
<message>
<location filename="../src/qml/Hotspot/Main.qml" line="129"/>
<location filename="../src/qml/Proxy/Main.qml" line="267"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
@ -746,34 +752,34 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="116"/>
<location filename="../src/qml/Proxy/Main.qml" line="120"/>
<source>Select file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="130"/>
<location filename="../src/qml/Proxy/Main.qml" line="134"/>
<source>HTTP Proxy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="144"/>
<location filename="../src/qml/Proxy/Main.qml" line="200"/>
<location filename="../src/qml/Proxy/Main.qml" line="234"/>
<location filename="../src/qml/Proxy/Main.qml" line="148"/>
<location filename="../src/qml/Proxy/Main.qml" line="204"/>
<location filename="../src/qml/Proxy/Main.qml" line="238"/>
<source>Port</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="167"/>
<location filename="../src/qml/Proxy/Main.qml" line="171"/>
<source>Also use this proxy for FTP</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="185"/>
<location filename="../src/qml/Proxy/Main.qml" line="189"/>
<source>FTP Proxy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="219"/>
<location filename="../src/qml/Proxy/Main.qml" line="223"/>
<source>SOCKS Proxy</source>
<translation type="unfinished"></translation>
</message>
@ -828,6 +834,51 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewNetworkDialog</name>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="73"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="78"/>
<source>Network Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="84"/>
<source>Security</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="91"/>
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="96"/>
<source>UserName</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="102"/>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="110"/>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="116"/>
<source>Password</source>
<translation type="unfinished">Password</translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="127"/>
<source>Cancel</source>
<translation type="unfinished">Cancel</translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="136"/>
<source>Join</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PairDialog</name>
<message>
@ -1107,7 +1158,7 @@
<context>
<name>WifiView</name>
<message>
<location filename="../src/qml/WLAN/WifiView.qml" line="49"/>
<location filename="../src/qml/WLAN/WifiView.qml" line="51"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>

@ -544,6 +544,11 @@
<source>WLAN</source>
<translation>线</translation>
</message>
<message>
<location filename="../src/qml/WLAN/Main.qml" line="101"/>
<source>Add other...</source>
<translation>...</translation>
</message>
<message>
<location filename="../src/qml/Bluetooth/Main.qml" line="30"/>
<location filename="../src/qml/Bluetooth/Main.qml" line="93"/>
@ -656,6 +661,7 @@
</message>
<message>
<location filename="../src/qml/Hotspot/Main.qml" line="129"/>
<location filename="../src/qml/Proxy/Main.qml" line="267"/>
<source>Save</source>
<translation></translation>
</message>
@ -746,34 +752,34 @@
<translation>使</translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="116"/>
<location filename="../src/qml/Proxy/Main.qml" line="120"/>
<source>Select file</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="130"/>
<location filename="../src/qml/Proxy/Main.qml" line="134"/>
<source>HTTP Proxy</source>
<translation>HTTP </translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="144"/>
<location filename="../src/qml/Proxy/Main.qml" line="200"/>
<location filename="../src/qml/Proxy/Main.qml" line="234"/>
<location filename="../src/qml/Proxy/Main.qml" line="148"/>
<location filename="../src/qml/Proxy/Main.qml" line="204"/>
<location filename="../src/qml/Proxy/Main.qml" line="238"/>
<source>Port</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="167"/>
<location filename="../src/qml/Proxy/Main.qml" line="171"/>
<source>Also use this proxy for FTP</source>
<translation> FTP</translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="185"/>
<location filename="../src/qml/Proxy/Main.qml" line="189"/>
<source>FTP Proxy</source>
<translation>FTP </translation>
</message>
<message>
<location filename="../src/qml/Proxy/Main.qml" line="219"/>
<location filename="../src/qml/Proxy/Main.qml" line="223"/>
<source>SOCKS Proxy</source>
<translation>SOCKS </translation>
</message>
@ -828,6 +834,51 @@
<translation></translation>
</message>
</context>
<context>
<name>NewNetworkDialog</name>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="73"/>
<source>Name</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="78"/>
<source>Network Name</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="84"/>
<source>Security</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="91"/>
<source>None</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="96"/>
<source>UserName</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="102"/>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="110"/>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="116"/>
<source>Password</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="127"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../src/qml/WLAN/NewNetworkDialog.qml" line="136"/>
<source>Join</source>
<translation></translation>
</message>
</context>
<context>
<name>PairDialog</name>
<message>
@ -1107,7 +1158,7 @@
<context>
<name>WifiView</name>
<message>
<location filename="../src/qml/WLAN/WifiView.qml" line="49"/>
<location filename="../src/qml/WLAN/WifiView.qml" line="51"/>
<source>WLAN</source>
<translation>线</translation>
</message>

Loading…
Cancel
Save