2020-08-03 13:27:42 -04:00
|
|
|
/*
|
2022-01-06 11:24:13 -05:00
|
|
|
* Copyright (C) 2021-2022 Savoir-faire Linux Inc.
|
2020-08-03 13:27:42 -04:00
|
|
|
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
|
2021-07-16 10:34:50 -04:00
|
|
|
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
|
2020-08-03 13:27:42 -04:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2021-09-08 10:31:38 -04:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
2021-03-17 14:23:21 -04:00
|
|
|
|
2021-08-23 13:24:08 -04:00
|
|
|
import net.jami.Models 1.1
|
|
|
|
import net.jami.Constants 1.1
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
import "../../commoncomponents"
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2020-09-17 16:09:06 -04:00
|
|
|
property int preferredHeight: createSIPAccountPageColumnLayout.implicitHeight
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
signal showThisPage
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
function clearAllTextFields() {
|
|
|
|
sipUsernameEdit.clear()
|
|
|
|
sipPasswordEdit.clear()
|
|
|
|
sipServernameEdit.clear()
|
|
|
|
sipProxyEdit.clear()
|
|
|
|
}
|
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
Connections {
|
|
|
|
target: WizardViewStepModel
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
function onMainStepChanged() {
|
|
|
|
if (WizardViewStepModel.mainStep === WizardViewStepModel.MainSteps.AccountCreation &&
|
|
|
|
WizardViewStepModel.accountCreationOption ===
|
|
|
|
WizardViewStepModel.AccountCreationOption.CreateSipAccount) {
|
|
|
|
clearAllTextFields()
|
|
|
|
root.showThisPage()
|
|
|
|
}
|
|
|
|
}
|
2020-09-04 14:57:36 -04:00
|
|
|
}
|
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
color: JamiTheme.backgroundColor
|
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
ColumnLayout {
|
2020-09-17 16:09:06 -04:00
|
|
|
id: createSIPAccountPageColumnLayout
|
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
spacing: JamiTheme.wizardViewPageLayoutSpacing
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2020-09-03 09:58:01 -04:00
|
|
|
anchors.centerIn: parent
|
2020-08-04 20:54:02 -04:00
|
|
|
|
|
|
|
RowLayout {
|
2021-07-16 10:34:50 -04:00
|
|
|
spacing: JamiTheme.wizardViewPageLayoutSpacing
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
2021-07-16 10:34:50 -04:00
|
|
|
Layout.topMargin: JamiTheme.wizardViewPageBackButtonMargins
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.preferredWidth: createAccountButton.width
|
2020-08-04 20:54:02 -04:00
|
|
|
|
|
|
|
Label {
|
2020-09-11 17:30:46 -04:00
|
|
|
text: JamiStrings.configureExistingSIP
|
2020-11-28 16:14:25 -05:00
|
|
|
color: JamiTheme.textColor
|
2020-09-03 09:58:01 -04:00
|
|
|
font.pointSize: JamiTheme.textFontSize + 3
|
2020-08-04 20:54:02 -04:00
|
|
|
}
|
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
BubbleLabel {
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
text: JamiStrings.optional
|
2021-07-16 10:34:50 -04:00
|
|
|
bubbleColor: JamiTheme.wizardBlueButtons
|
2020-08-04 20:54:02 -04:00
|
|
|
}
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
MaterialLineEdit {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: sipServernameEdit
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-22 19:01:41 -04:00
|
|
|
objectName: "sipServernameEdit"
|
|
|
|
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredHeight: fieldLayoutHeight
|
|
|
|
Layout.preferredWidth: createAccountButton.width
|
2020-08-03 13:27:42 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
focus: visible
|
|
|
|
|
2020-08-03 13:27:42 -04:00
|
|
|
selectByMouse: true
|
2020-09-11 17:30:46 -04:00
|
|
|
placeholderText: JamiStrings.server
|
2021-07-16 10:34:50 -04:00
|
|
|
font.pointSize: JamiTheme.textFontSize
|
2020-08-03 13:27:42 -04:00
|
|
|
font.kerning: true
|
2021-08-02 14:52:08 -04:00
|
|
|
|
|
|
|
KeyNavigation.tab: sipProxyEdit
|
|
|
|
KeyNavigation.up: backButton
|
|
|
|
KeyNavigation.down: KeyNavigation.tab
|
2021-08-09 15:14:10 -04:00
|
|
|
|
|
|
|
onAccepted: sipProxyEdit.forceActiveFocus()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
MaterialLineEdit {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: sipProxyEdit
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-22 19:01:41 -04:00
|
|
|
objectName: "sipProxyEdit"
|
|
|
|
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredHeight: fieldLayoutHeight
|
|
|
|
Layout.preferredWidth: createAccountButton.width
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
selectByMouse: true
|
2020-09-11 17:30:46 -04:00
|
|
|
placeholderText: JamiStrings.proxy
|
2021-07-16 10:34:50 -04:00
|
|
|
font.pointSize: JamiTheme.textFontSize
|
2020-08-03 13:27:42 -04:00
|
|
|
font.kerning: true
|
2021-08-02 14:52:08 -04:00
|
|
|
|
|
|
|
KeyNavigation.tab: sipUsernameEdit
|
|
|
|
KeyNavigation.up: sipServernameEdit
|
|
|
|
KeyNavigation.down: KeyNavigation.tab
|
2021-08-09 15:14:10 -04:00
|
|
|
|
|
|
|
onAccepted: sipUsernameEdit.forceActiveFocus()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
MaterialLineEdit {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: sipUsernameEdit
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-22 19:01:41 -04:00
|
|
|
objectName: "sipUsernameEdit"
|
|
|
|
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredHeight: fieldLayoutHeight
|
|
|
|
Layout.preferredWidth: createAccountButton.width
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
selectByMouse: true
|
2020-09-11 17:30:46 -04:00
|
|
|
placeholderText: JamiStrings.username
|
2021-07-16 10:34:50 -04:00
|
|
|
font.pointSize: JamiTheme.textFontSize
|
2020-08-03 13:27:42 -04:00
|
|
|
font.kerning: true
|
2021-08-02 14:52:08 -04:00
|
|
|
|
|
|
|
KeyNavigation.tab: sipPasswordEdit
|
|
|
|
KeyNavigation.up: sipProxyEdit
|
|
|
|
KeyNavigation.down: KeyNavigation.tab
|
2021-08-09 15:14:10 -04:00
|
|
|
|
|
|
|
onAccepted: sipPasswordEdit.forceActiveFocus()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
MaterialLineEdit {
|
2020-08-03 13:27:42 -04:00
|
|
|
id: sipPasswordEdit
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-22 19:01:41 -04:00
|
|
|
objectName: "sipPasswordEdit"
|
|
|
|
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
|
|
|
Layout.preferredHeight: fieldLayoutHeight
|
|
|
|
Layout.preferredWidth: createAccountButton.width
|
2020-08-03 13:27:42 -04:00
|
|
|
|
|
|
|
selectByMouse: true
|
|
|
|
echoMode: TextInput.Password
|
2020-09-11 17:30:46 -04:00
|
|
|
placeholderText: JamiStrings.password
|
2021-07-16 10:34:50 -04:00
|
|
|
font.pointSize: JamiTheme.textFontSize
|
2020-08-03 13:27:42 -04:00
|
|
|
font.kerning: true
|
2021-08-02 14:52:08 -04:00
|
|
|
|
|
|
|
KeyNavigation.tab: createAccountButton
|
|
|
|
KeyNavigation.up: sipUsernameEdit
|
|
|
|
KeyNavigation.down: KeyNavigation.tab
|
2021-08-09 15:14:10 -04:00
|
|
|
|
|
|
|
onAccepted: createAccountButton.clicked()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
2020-08-04 20:54:02 -04:00
|
|
|
|
|
|
|
MaterialButton {
|
|
|
|
id: createAccountButton
|
2020-09-03 09:58:01 -04:00
|
|
|
|
2021-08-02 17:31:46 -04:00
|
|
|
objectName: "createSIPAccountButton"
|
2021-07-22 19:01:41 -04:00
|
|
|
|
2020-09-03 09:58:01 -04:00
|
|
|
Layout.alignment: Qt.AlignCenter
|
2021-07-16 10:34:50 -04:00
|
|
|
Layout.bottomMargin: JamiTheme.wizardViewPageBackButtonMargins
|
2021-08-09 14:00:23 -04:00
|
|
|
|
|
|
|
preferredWidth: JamiTheme.wizardButtonWidth
|
2020-09-03 09:58:01 -04:00
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
text: JamiStrings.createSIPAccount
|
2020-08-04 20:54:02 -04:00
|
|
|
color: JamiTheme.wizardBlueButtons
|
2020-08-25 21:12:14 -04:00
|
|
|
hoveredColor: JamiTheme.buttonTintedBlueHovered
|
|
|
|
pressedColor: JamiTheme.buttonTintedBluePressed
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-08-02 14:52:08 -04:00
|
|
|
KeyNavigation.tab: backButton
|
|
|
|
KeyNavigation.up: sipPasswordEdit
|
|
|
|
KeyNavigation.down: KeyNavigation.tab
|
|
|
|
|
2020-08-04 20:54:02 -04:00
|
|
|
onClicked: {
|
2021-07-16 10:34:50 -04:00
|
|
|
WizardViewStepModel.accountCreationInfo =
|
|
|
|
JamiQmlUtils.setUpAccountCreationInputPara(
|
|
|
|
{hostname : sipServernameEdit.text,
|
|
|
|
username : sipUsernameEdit.text,
|
|
|
|
password : sipPasswordEdit.text,
|
|
|
|
proxy : sipProxyEdit.text})
|
|
|
|
WizardViewStepModel.nextStep()
|
2020-08-04 20:54:02 -04:00
|
|
|
}
|
|
|
|
}
|
2020-09-04 14:57:36 -04:00
|
|
|
}
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
BackButton {
|
2020-09-04 14:57:36 -04:00
|
|
|
id: backButton
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-08-02 17:31:46 -04:00
|
|
|
objectName: "createSIPAccountPageBackButton"
|
|
|
|
|
2020-09-04 14:57:36 -04:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.margins: 20
|
2020-08-04 20:54:02 -04:00
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
preferredSize: JamiTheme.wizardViewPageBackButtonSize
|
2020-09-04 14:57:36 -04:00
|
|
|
|
2021-08-02 14:52:08 -04:00
|
|
|
KeyNavigation.tab: sipServernameEdit
|
|
|
|
KeyNavigation.up: createAccountButton
|
|
|
|
KeyNavigation.down: KeyNavigation.tab
|
|
|
|
|
2021-07-16 10:34:50 -04:00
|
|
|
onClicked: WizardViewStepModel.previousStep()
|
2020-08-03 13:27:42 -04:00
|
|
|
}
|
|
|
|
}
|