diff --git a/src/app/accountadapter.cpp b/src/app/accountadapter.cpp index c48aac2f87d4995d1fec2314a6185c78d97835db..74eb9210058bfbaeefc3f4fe7c319b26c59afba7 100644 --- a/src/app/accountadapter.cpp +++ b/src/app/accountadapter.cpp @@ -183,7 +183,8 @@ AccountAdapter::createSIPAccount(const QVariantMap& settings) confProps.hostname = settings["hostname"].toString(); confProps.username = settings["username"].toString(); confProps.password = settings["password"].toString(); - confProps.routeset = settings["proxy"].toString(); + confProps.TLS.enable = settings["tls"].toBool(); + #ifdef Q_OS_WIN confProps.Ringtone.ringtonePath = Utils::GetRingtonePath(); #endif diff --git a/src/app/commoncomponents/MaterialRadioButton.qml b/src/app/commoncomponents/MaterialRadioButton.qml new file mode 100644 index 0000000000000000000000000000000000000000..42c0635d72e830ffd44d640c7dcc79e585b0c2da --- /dev/null +++ b/src/app/commoncomponents/MaterialRadioButton.qml @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2023 Savoir-faire Linux Inc. + * + * 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 + * (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 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 <https://www.gnu.org/licenses/>. + */ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Qt5Compat.GraphicalEffects + +import net.jami.Constants 1.1 +import net.jami.Models 1.1 + +RadioButton { + id: root + + property string color: JamiTheme.textColor + + font.pointSize: JamiTheme.textFontSize + + indicator: Rectangle { + id: rect + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + + border { + id: border + color: JamiTheme.buttonTintedBlue + width: 2 + } + + implicitWidth: 20 + implicitHeight: 20 + radius: 10 + + Rectangle { + + id: innerRect + + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + width: 10 + height: 10 + radius: 10 + visible : checked || hovered + + color: JamiTheme.buttonTintedBlue + + HoverHandler { + target: parent + } + } + } + + contentItem: Text { + text: root.text + color: "white" + leftPadding: root.indicator.width + root.spacing + verticalAlignment: Text.AlignVCenter + } + + Keys.onPressed: function (event) { + if (event.key === Qt.Key_Enter + || event.key === Qt.Key_Return) { + root.checked = true + } + } + + onActiveFocusChanged: { + if (focus && !root.checked) { + border.width = 2.5 + } else { + border.width = 2 + } + } + +} diff --git a/src/app/commoncomponents/ModalTextEdit.qml b/src/app/commoncomponents/ModalTextEdit.qml index 3fcced54d6fbe4c39581628a9ca44f87953e625d..48357244f3912a9081b0df7c4a65585c81652814 100644 --- a/src/app/commoncomponents/ModalTextEdit.qml +++ b/src/app/commoncomponents/ModalTextEdit.qml @@ -77,6 +77,7 @@ Loader { Component { id: editComp + MaterialTextField { id: editCompField @@ -97,7 +98,7 @@ Loader { text: staticText inputIsValid: root.inputIsValid onFocusChanged: { - if (!focus) { + if (!focus && root.editMode) { root.editMode = false root.accepted() } diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index ba669948a5089be1de4cca2f103beceae3d41357..65b28b99db0996fb044057ab8eab6f7e741b7ac4 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -415,6 +415,10 @@ Item { property string configureExistingSIP: qsTr("Configure an existing SIP account") property string personalizeAccount: qsTr("Personalize account") property string addSip: qsTr("Add SIP account") + property string tls: qsTr("TLS") + property string udp: qsTr("UDP") + property string displayName: qsTr("Display Name") + // CurrentAccountSettings && AdvancedSettings property string backupSuccessful: qsTr("Backup successful") diff --git a/src/app/settingsview/components/CurrentAccountSettings.qml b/src/app/settingsview/components/CurrentAccountSettings.qml index 219daace01b32c8dfcc90cd3f306989cb6af9ea6..bfea23ea0436a8ad5c0a1b35316201e0d1818f7f 100644 --- a/src/app/settingsview/components/CurrentAccountSettings.qml +++ b/src/app/settingsview/components/CurrentAccountSettings.qml @@ -184,6 +184,7 @@ Rectangle { MaterialButton { Layout.alignment: Qt.AlignHCenter + Layout.topMargin: CurrentAccount.type === Profile.Type.SIP ? JamiTheme.preferredMarginSize : 0 Layout.leftMargin: JamiTheme.preferredMarginSize Layout.rightMargin: JamiTheme.preferredMarginSize diff --git a/src/app/settingsview/components/SIPUserIdentity.qml b/src/app/settingsview/components/SIPUserIdentity.qml index 1ee75e16e5fe592ac794b04e136ca074254ad07f..4c11a2dfaa13ff146c3680f65dcc5e587e857fc3 100644 --- a/src/app/settingsview/components/SIPUserIdentity.qml +++ b/src/app/settingsview/components/SIPUserIdentity.qml @@ -59,31 +59,30 @@ ColumnLayout { } SettingsMaterialTextEdit { - id: proxySIP + id: passSIPlineEdit Layout.fillWidth: true Layout.preferredHeight: JamiTheme.preferredFieldHeight - staticText: CurrentAccount.routeset + staticText: CurrentAccount.password - titleField: JamiStrings.proxy + titleField: JamiStrings.password itemWidth: root.itemWidth - - onEditFinished: CurrentAccount.routeset = dynamicText + isPassword: true } SettingsMaterialTextEdit { - id: passSIPlineEdit + id: proxySIP Layout.fillWidth: true Layout.preferredHeight: JamiTheme.preferredFieldHeight - staticText: CurrentAccount.password + staticText: CurrentAccount.routeset - titleField: JamiStrings.password + titleField: JamiStrings.proxy itemWidth: root.itemWidth - isPassword: true - onEditFinished: CurrentAccount.password = dynamicText + onEditFinished: CurrentAccount.routeset = dynamicText } + } diff --git a/src/app/wizardview/components/CreateSIPAccountPage.qml b/src/app/wizardview/components/CreateSIPAccountPage.qml index 00da8430b2041e90b4519e99ae4093968ec89b6e..6c97b9254c827592f1b5d4646eb5eff38d71c0b5 100644 --- a/src/app/wizardview/components/CreateSIPAccountPage.qml +++ b/src/app/wizardview/components/CreateSIPAccountPage.qml @@ -47,6 +47,7 @@ Rectangle { WizardViewStepModel.AccountCreationOption.CreateSipAccount) { clearAllTextFields() root.showThisPage() + sipServernameEdit.focus = true } } } @@ -109,33 +110,13 @@ Rectangle { Layout.alignment: Qt.AlignCenter Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2) - focus: visible placeholderText: JamiStrings.server - KeyNavigation.up: backButton - KeyNavigation.down: sipProxyEdit KeyNavigation.tab: KeyNavigation.down - - onAccepted: sipProxyEdit.forceActiveFocus() - - } - - ModalTextEdit { - id: sipProxyEdit - - objectName: "sipProxyEdit" - - Layout.alignment: Qt.AlignCenter - Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2) - - placeholderText: JamiStrings.proxy - - KeyNavigation.up: sipServernameEdit + KeyNavigation.up: backButton KeyNavigation.down: sipUsernameEdit - KeyNavigation.tab: KeyNavigation.down onAccepted: sipUsernameEdit.forceActiveFocus() - } ModalTextEdit { @@ -148,9 +129,9 @@ Rectangle { placeholderText: JamiStrings.username - KeyNavigation.up: sipProxyEdit - KeyNavigation.down: sipPasswordEdit KeyNavigation.tab: KeyNavigation.down + KeyNavigation.up: sipServernameEdit + KeyNavigation.down: sipPasswordEdit onAccepted: sipPasswordEdit.forceActiveFocus() } @@ -165,12 +146,45 @@ Rectangle { placeholderText: JamiStrings.password - KeyNavigation.up: sipUsernameEdit - KeyNavigation.down: createAccountButton KeyNavigation.tab: KeyNavigation.down + KeyNavigation.up: sipUsernameEdit + KeyNavigation.down: tlsRadioButton + + onAccepted: tlsRadioButton.forceActiveFocus() + } + + ButtonGroup { id: optionsB } + + RowLayout{ - onAccepted: createAccountButton.forceActiveFocus() + Layout.alignment: Qt.AlignHCenter + Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2) + + MaterialRadioButton { + id: tlsRadioButton + Layout.alignment: Qt.AlignHCenter + text: JamiStrings.tls + ButtonGroup.group: optionsB + checked: true + + KeyNavigation.up: sipPasswordEdit + KeyNavigation.down: udpRadioButton + KeyNavigation.tab: KeyNavigation.down + + } + + MaterialRadioButton { + id: udpRadioButton + Layout.alignment: Qt.AlignHCenter + text: JamiStrings.udp + ButtonGroup.group: optionsB + color: JamiTheme.textColor + KeyNavigation.up: tlsRadioButton + KeyNavigation.down: createAccountButton + KeyNavigation.tab: KeyNavigation.down + + } } MaterialButton { @@ -185,7 +199,7 @@ Rectangle { text: JamiStrings.addSip - KeyNavigation.up: sipPasswordEdit + KeyNavigation.up: udpRadioButton KeyNavigation.down: personalizeAccount KeyNavigation.tab: KeyNavigation.down @@ -196,7 +210,7 @@ Rectangle { alias: displayNameLineEdit.dynamicText, username : sipUsernameEdit.dynamicText, password : sipPasswordEdit.dynamicText, - proxy : sipProxyEdit.dynamicText, + tls: tlsRadioButton.checked, avatar: UtilsAdapter.tempCreationImage()}) WizardViewStepModel.nextStep() }