1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-21 21:52:03 +02:00

settingsview: homogenize ModalTextEdit usage

GitLab: #986
GitLab: #1004

Change-Id: Iea441cba4c258a82b9a553c93c81e4d76f0baa1c
This commit is contained in:
Aline Gondim Santos 2023-02-24 10:18:06 -03:00
parent 05beb246e8
commit 42a46fe165
24 changed files with 148 additions and 287 deletions

View file

@ -26,7 +26,7 @@ TextField {
// We need to remove focus when another widget takes activeFocus,
// except the context menu.
property bool isActive: activeFocus || contextMenu.active || root.text.toString() !== ''
property bool isActive: activeFocus || contextMenu.active
onActiveFocusChanged: {
if (!activeFocus && !contextMenu.active) {
root.focus = false
@ -76,11 +76,10 @@ TextField {
bottomPadding: 20
topPadding: 2
onIsActiveChanged: if (!isActive && !readOnly) text = ''
Keys.onPressed: function (event) {
if (event.key === Qt.Key_Enter
|| event.key === Qt.Key_Return) {
if (inputIsValid) {
if (inputIsValid && acceptableInput) {
root.accepted()
}
event.accepted = true
@ -94,6 +93,7 @@ TextField {
lineEditObj: root
selectOnly: readOnly
}
onReleased: function (event) {
if (event.button === Qt.RightButton)
contextMenu.openMenuAt(event)
@ -107,7 +107,7 @@ TextField {
anchors.horizontalCenter: root.horizontalCenter
text: root.placeholderText
color: root.baseColor
visible: !root.isActive && !readOnly
visible: !root.isActive && !readOnly && root.text.toString() === ""
}
Rectangle {
@ -150,7 +150,7 @@ TextField {
color: root.baseColor
// Show the alternate placeholder while the user types.
visible: root.text.toString() !== '' && !readOnly
visible: root.isActive && !readOnly
}
TextFieldIcon {

View file

@ -40,6 +40,7 @@ Loader {
property bool fontBold: false
property int echoMode: TextInput.Normal
property QtObject textValidator: RegularExpressionValidator { id: defaultValidator }
// Always start with the static text component displayed first.
property bool editMode: true
@ -47,6 +48,8 @@ Loader {
// Emitted when the editor has been accepted.
signal accepted
signal activeChanged(bool active)
// Always give up focus when accepted.
onAccepted: focus = false
@ -59,10 +62,10 @@ Loader {
// This is used when the user is not editing the text.
Component {
id: displayComp
MaterialTextField {
MaterialTextField {
id: displayCompField
font.pointSize: root.fontPointSize
readOnly: true
text: staticText
@ -75,7 +78,6 @@ Loader {
id: editComp
MaterialTextField {
id: editCompField
focus: true
@ -92,19 +94,24 @@ Loader {
placeholderText: root.placeholderText
onAccepted: root.accepted()
onTextChanged: dynamicText = text
onVisibleChanged: text = dynamicText
text: staticText
inputIsValid: root.inputIsValid
onFocusChanged: if (!focus) root.editMode = false
onFocusChanged: {
if (!focus) {
root.editMode = false
}
activeChanged(root.editMode)
}
onIsActiveChanged: activeChanged(isActive)
validator: root.textValidator
}
}
// We use a loader to switch between the two components depending on the
// editMode property.
sourceComponent: {
editMode || isPersistent
? editComp
: displayComp
}
}

View file

@ -88,7 +88,7 @@ BaseModalDialog {
btnConfirm.enabled = currentPasswordEdit.dynamicText.length > 0
break
case PasswordDialog.SetPassword:
btnConfirm.enabled = passwordEdit.length > 0 &&
btnConfirm.enabled = passwordEdit.dynamicText.length > 0 &&
passwordEdit.dynamicText === confirmPasswordEdit.dynamicText
break
default:

View file

@ -1,128 +0,0 @@
/*
* Copyright (C) 2021-2023 Savoir-faire Linux Inc.
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.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
* (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 Qt5Compat.GraphicalEffects
import net.jami.Adapters 1.1
import net.jami.Models 1.1
import net.jami.Constants 1.1
EditableLineEdit {
id: root
placeholderText: JamiStrings.chooseYourUserName
firstIco: readOnly? "" : JamiResources.person_24dp_svg
firstIcoColor: "#03B9E9"
secondIco: readOnly? "" : JamiResources.outline_info_24dp_svg
secondIcoColor: "#005699"
informationToolTip: JamiStrings.usernameToolTip
enum NameRegistrationState {
BLANK,
INVALID,
TAKEN,
FREE,
SEARCHING
}
property int nameRegistrationState: UsernameLineEdit.NameRegistrationState.BLANK
property string accountId: CurrentAccount.id
selectByMouse: true
font.pointSize: JamiTheme.usernameLineEditPointSize
font.kerning: true
validator: RegularExpressionValidator { regularExpression: /[A-z0-9_]{0,32}/ }
Connections {
id: registeredNameFoundConnection
target: NameDirectory
enabled: root.text.length !== 0
function onRegisteredNameFound(status, address, name) {
if (text === name) {
switch(status) {
case NameDirectory.LookupStatus.NOT_FOUND:
nameRegistrationState = UsernameLineEdit.NameRegistrationState.FREE
break
case NameDirectory.LookupStatus.ERROR:
case NameDirectory.LookupStatus.INVALID_NAME:
case NameDirectory.LookupStatus.INVALID:
nameRegistrationState = UsernameLineEdit.NameRegistrationState.INVALID
break
case NameDirectory.LookupStatus.SUCCESS:
nameRegistrationState = UsernameLineEdit.NameRegistrationState.TAKEN
break
}
}
}
}
Timer {
id: lookupTimer
repeat: false
interval: JamiTheme.usernameLineEditlookupInterval
onTriggered: {
if (text.length !== 0 && readOnly === false) {
nameRegistrationState = UsernameLineEdit.NameRegistrationState.SEARCHING
NameDirectory.lookupName(root.accountId, text)
} else {
nameRegistrationState = UsernameLineEdit.NameRegistrationState.BLANK
}
}
}
onNameRegistrationStateChanged: {
if (readOnly || !enabled)
borderColor = "transparent"
switch(nameRegistrationState){
case UsernameLineEdit.NameRegistrationState.BLANK:
firstIco=""
borderColor = "transparent"
error = false
validated = false
break
case UsernameLineEdit.NameRegistrationState.FREE:
firstIco = JamiResources.circled_green_check_svg
borderColor = validatedColor
firstIcoColor = "transparent"
validated = true
error = false
break
case UsernameLineEdit.NameRegistrationState.INVALID:
case UsernameLineEdit.NameRegistrationState.TAKEN:
firstIco = JamiResources.circled_red_cross_svg
borderColor = errorColor
firstIcoColor = "transparent"
error = true
validated = false
break
}
}
onTextChanged: lookupTimer.restart()
}

View file

@ -26,24 +26,24 @@ ModalTextEdit {
prefixIconSrc: {
switch(nameRegistrationState){
case UsernameLineEdit.NameRegistrationState.FREE:
case UsernameTextEdit.NameRegistrationState.FREE:
return JamiResources.circled_green_check_svg
case UsernameLineEdit.NameRegistrationState.INVALID:
case UsernameLineEdit.NameRegistrationState.TAKEN:
case UsernameTextEdit.NameRegistrationState.INVALID:
case UsernameTextEdit.NameRegistrationState.TAKEN:
return JamiResources.circled_red_cross_svg
case UsernameLineEdit.NameRegistrationState.BLANK:
case UsernameTextEdit.NameRegistrationState.BLANK:
default:
return JamiResources.person_24dp_svg
}
}
prefixIconColor: {
switch(nameRegistrationState){
case UsernameLineEdit.NameRegistrationState.FREE:
case UsernameTextEdit.NameRegistrationState.FREE:
return "#009980"
case UsernameLineEdit.NameRegistrationState.INVALID:
case UsernameLineEdit.NameRegistrationState.TAKEN:
case UsernameTextEdit.NameRegistrationState.INVALID:
case UsernameTextEdit.NameRegistrationState.TAKEN:
return "#CC0022"
case UsernameLineEdit.NameRegistrationState.BLANK:
case UsernameTextEdit.NameRegistrationState.BLANK:
default:
return JamiTheme.editLineColor
}
@ -51,18 +51,25 @@ ModalTextEdit {
suffixIconSrc: JamiResources.outline_info_24dp_svg
suffixIconColor: JamiTheme.buttonTintedBlue
property bool isActive: false
property string infohash: CurrentAccount.uri
property string registeredName: CurrentAccount.registeredName
property bool hasRegisteredName: registeredName !== ''
staticText: root.isActive ? registeredName : (registeredName ? registeredName : infohash)
infoTipText: JamiStrings.usernameToolTip
placeholderText: JamiStrings.chooseAUsername
textValidator: RegularExpressionValidator { regularExpression: /[A-Za-z0-9-]{0,32}/ }
enum NameRegistrationState { BLANK, INVALID, TAKEN, FREE, SEARCHING }
property int nameRegistrationState: UsernameLineEdit.NameRegistrationState.BLANK
property int nameRegistrationState: UsernameTextEdit.NameRegistrationState.BLANK
inputIsValid: dynamicText.length === 0
|| nameRegistrationState === UsernameLineEdit.NameRegistrationState.FREE
|| nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE
onActiveChanged: function(active) {
root.isActive = active
}
Connections {
target: CurrentAccount
@ -82,15 +89,15 @@ ModalTextEdit {
if (dynamicText === name) {
switch(status) {
case NameDirectory.LookupStatus.NOT_FOUND:
nameRegistrationState = UsernameLineEdit.NameRegistrationState.FREE
nameRegistrationState = UsernameTextEdit.NameRegistrationState.FREE
break
case NameDirectory.LookupStatus.ERROR:
case NameDirectory.LookupStatus.INVALID_NAME:
case NameDirectory.LookupStatus.INVALID:
nameRegistrationState = UsernameLineEdit.NameRegistrationState.INVALID
nameRegistrationState = UsernameTextEdit.NameRegistrationState.INVALID
break
case NameDirectory.LookupStatus.SUCCESS:
nameRegistrationState = UsernameLineEdit.NameRegistrationState.TAKEN
nameRegistrationState = UsernameTextEdit.NameRegistrationState.TAKEN
break
}
}
@ -101,24 +108,25 @@ ModalTextEdit {
id: lookupTimer
repeat: false
interval: JamiTheme.usernameLineEditlookupInterval
interval: JamiTheme.usernameTextEditlookupInterval
onTriggered: {
if (dynamicText.length !== 0) {
nameRegistrationState = UsernameLineEdit.NameRegistrationState.SEARCHING
nameRegistrationState = UsernameTextEdit.NameRegistrationState.SEARCHING
NameDirectory.lookupName(CurrentAccount.id, dynamicText)
} else {
nameRegistrationState = UsernameLineEdit.NameRegistrationState.BLANK
nameRegistrationState = UsernameTextEdit.NameRegistrationState.BLANK
}
}
}
onDynamicTextChanged: lookupTimer.restart()
function startEditing() {
if (!hasRegisteredName) {
if (!registeredName) {
root.editMode = true
forceActiveFocus()
nameRegistrationState = UsernameLineEdit.NameRegistrationState.BLANK
nameRegistrationState = UsernameTextEdit.NameRegistrationState.BLANK
}
}
}

View file

@ -390,7 +390,6 @@ Item {
property string chooseUsernameForAccount: qsTr("You can choose a username to help others more easily find and reach you on Jami.")
property string chooseUsernameForRV: qsTr("Choose a name for your rendezvous point")
property string chooseAName: qsTr("Choose a name")
property string chooseYourUserName: qsTr("Choose username")
property string invalidName: qsTr("Invalid name")
property string invalidUsername: qsTr("Invalid username")
property string nameAlreadyTaken: qsTr("Name already taken")

View file

@ -518,9 +518,9 @@ Item {
//MaterialButton
property real buttontextPadding: 10
// UsernameLineEdit
property real usernameLineEditPointSize:calcSize(9 + fontSizeOffset)
property real usernameLineEditlookupInterval: 200
// UsernameTextEdit
property real usernameTextEditPointSize:calcSize(9 + fontSizeOffset)
property real usernameTextEditlookupInterval: 200
// JamiScrollBar
property int scrollBarHandleSize: 6

View file

@ -95,8 +95,7 @@ ColumnLayout {
}
EditableLineEdit {
ModalTextEdit {
id: displayNameLineEdit
visible: opened
@ -105,16 +104,10 @@ ColumnLayout {
Layout.preferredWidth: root.width - 32
Layout.topMargin: -10
text: CurrentAccount.alias
staticText: CurrentAccount.alias
placeholderText: JamiStrings.enterNickname
color: JamiTheme.textColor
fontSize: JamiTheme.tipBoxContentFontSize
onEditingFinished: {
AccountAdapter.setCurrAccDisplayName(text)
}
onAccepted: AccountAdapter.setCurrAccDisplayName(dynamicText)
}
Text {

View file

@ -101,12 +101,12 @@ Item {
if (!usernameTextEdit.editMode)
return true
switch(usernameTextEdit.nameRegistrationState) {
case UsernameLineEdit.NameRegistrationState.BLANK:
case UsernameLineEdit.NameRegistrationState.FREE:
case UsernameTextEdit.NameRegistrationState.BLANK:
case UsernameTextEdit.NameRegistrationState.FREE:
return true
case UsernameLineEdit.NameRegistrationState.SEARCHING:
case UsernameLineEdit.NameRegistrationState.INVALID:
case UsernameLineEdit.NameRegistrationState.TAKEN:
case UsernameTextEdit.NameRegistrationState.SEARCHING:
case UsernameTextEdit.NameRegistrationState.INVALID:
case UsernameTextEdit.NameRegistrationState.TAKEN:
return false
}
}
@ -149,7 +149,6 @@ Item {
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.rightMargin: JamiTheme.preferredMarginSize
fontPointSize: JamiTheme.textFontSize + 1
staticText: hasRegisteredName ? registeredName : infohash
editMode: false
isPersistent: false
@ -162,8 +161,8 @@ Item {
"settingsview/components/NameRegistrationDialog.qml",
{ registeredName: dynamicText })
dlg.accepted.connect(function() {
currentRegisteredID.nameRegistrationState =
UsernameLineEdit.NameRegistrationState.BLANK
usernameTextEdit.nameRegistrationState =
UsernameTextEdit.NameRegistrationState.BLANK
})
}
}

View file

@ -70,24 +70,16 @@ ColumnLayout {
buttonSize: JamiTheme.smartListAvatarSize
}
MaterialLineEdit {
ModalTextEdit {
id: displayNameLineEdit
Layout.alignment: Qt.AlignCenter
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.preferredHeight: JamiTheme.preferredFieldHeight + 8
Layout.preferredWidth: JamiTheme.preferredFieldWidth
font.pointSize: JamiTheme.textFontSize
font.kerning: true
text: CurrentAccount.alias
staticText: CurrentAccount.alias
placeholderText: JamiStrings.enterNickname
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
padding: 8
loseFocusWhenEnterPressed: true
onEditingFinished: AccountAdapter.setCurrAccDisplayName(text)
onAccepted: AccountAdapter.setCurrAccDisplayName(dynamicText)
}
}

View file

@ -114,7 +114,7 @@ ColumnLayout {
onSwitchToggled: CurrentAccount.enable_TURN = checked
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditTurnAddress
Layout.fillWidth: true
@ -130,7 +130,7 @@ ColumnLayout {
onEditFinished: CurrentAccount.server_TURN = dynamicText
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditTurnUsername
Layout.fillWidth: true
@ -146,7 +146,7 @@ ColumnLayout {
onEditFinished: CurrentAccount.username_TURN = dynamicText
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditTurnPassword
Layout.fillWidth: true
@ -162,7 +162,7 @@ ColumnLayout {
onEditFinished: CurrentAccount.password_TURN = dynamicText
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditTurnRealmSIP
Layout.fillWidth: true
@ -192,7 +192,7 @@ ColumnLayout {
onSwitchToggled: CurrentAccount.enable_STUN = checked
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditSTUNAddress
Layout.fillWidth: true

View file

@ -122,7 +122,7 @@ ColumnLayout {
})
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditCertPassword
Layout.fillWidth: true

View file

@ -45,7 +45,7 @@ ColumnLayout {
elide: Text.ElideRight
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditNameServer
Layout.fillWidth: true

View file

@ -74,7 +74,7 @@ ColumnLayout {
onSwitchToggled: CurrentAccount.proxyEnabled = checked
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditProxy
Layout.fillWidth: true
@ -90,7 +90,7 @@ ColumnLayout {
onEditFinished: CurrentAccount.proxyServer = dynamicText
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditBootstrap
Layout.fillWidth: true

View file

@ -71,7 +71,7 @@ ColumnLayout {
onSwitchToggled: CurrentAccount.publishedSameAsLocal = checked
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditSIPCustomAddress
Layout.fillWidth: true

View file

@ -178,11 +178,10 @@ ColumnLayout {
}
// Private key password
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditSIPCertPassword
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
@ -262,7 +261,7 @@ ColumnLayout {
parseInt(comboModel.get(modelIndex).secondArg)
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: outgoingTLSServerNameLineEdit
Layout.fillWidth: true

View file

@ -40,7 +40,7 @@ ColumnLayout {
maxWidth: width
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: lineEditVoiceMailDialCode
Layout.fillWidth: true

View file

@ -109,65 +109,33 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter
}
UsernameLineEdit {
UsernameTextEdit {
id: currentRegisteredID
anchors.verticalCenter: parent.verticalCenter
height: JamiTheme.preferredFieldHeight
width: JamiTheme.preferredFieldWidth
height: JamiTheme.preferredFieldHeight + 16
padding: 8
horizontalAlignment: CurrentAccount.registeredName === "" ? Text.AlignLeft :
Text.AlignRight
verticalAlignment: Text.AlignVCenter
wrapMode: Text.NoWrap
placeholderText: CurrentAccount.registeredName === "" ?
JamiStrings.registerAUsername : ""
text: CurrentAccount.registeredName
readOnly: CurrentAccount.registeredName !== ""
font.bold: CurrentAccount.registeredName !== ""
anchors.margins: 8
loseFocusWhenEnterPressed: btnRegisterName.visible
fontPointSize: JamiTheme.textFontSize + 1
staticText: CurrentAccount.registeredName
placeholderText: JamiStrings.chooseUsername
editMode: !CurrentAccount.registeredName
isPersistent: !CurrentAccount.registeredName
onEditingFinished: {
if (btnRegisterName.visible)
btnRegisterName.clicked()
onAccepted: {
if (dynamicText === '') {
return
}
var dlg = viewCoordinator.presentDialog(
appWindow,
"settingsview/components/NameRegistrationDialog.qml",
{ registeredName: dynamicText })
dlg.accepted.connect(function() {
currentRegisteredID.nameRegistrationState =
UsernameTextEdit.NameRegistrationState.BLANK
})
}
}
}
MaterialButton {
id: btnRegisterName
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.rightMargin: currentRegisteredID.width / 2 - width / 2
preferredWidth: 120
preferredHeight: 30
visible: CurrentAccount.registeredName === "" &&
currentRegisteredID.nameRegistrationState ===
UsernameLineEdit.NameRegistrationState.FREE
text: JamiStrings.register
toolTipText: JamiStrings.registerUsername
color: JamiTheme.buttonTintedGrey
hoveredColor: JamiTheme.buttonTintedGreyHovered
pressedColor: JamiTheme.buttonTintedGreyPressed
onClicked: {
if (currentRegisteredID.text === '') {
return
}
var dlg = viewCoordinator.presentDialog(
appWindow,
"settingsview/components/NameRegistrationDialog.qml",
{ registeredName: currentRegisteredID.text })
dlg.accepted.connect(function() {
currentRegisteredID.nameRegistrationState =
UsernameLineEdit.NameRegistrationState.BLANK
})
}
}
}

View file

@ -30,7 +30,7 @@ ColumnLayout {
property int itemWidth
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: usernameSIP
Layout.fillWidth: true
@ -44,7 +44,7 @@ ColumnLayout {
onEditFinished: CurrentAccount.username = dynamicText
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: hostnameSIP
Layout.fillWidth: true
@ -58,7 +58,7 @@ ColumnLayout {
onEditFinished: CurrentAccount.hostname = dynamicText
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: proxySIP
Layout.fillWidth: true
@ -72,17 +72,17 @@ ColumnLayout {
onEditFinished: CurrentAccount.routeset = dynamicText
}
SettingsMaterialLineEdit {
SettingsMaterialTextEdit {
id: passSIPlineEdit
staticText: CurrentAccount.password
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
titleField: JamiStrings.password
staticText: CurrentAccount.password
titleField: JamiStrings.password
itemWidth: root.itemWidth
isPassword: true
onEditFinished: CurrentAccount.password = dynamicText
}

View file

@ -29,10 +29,11 @@ RowLayout {
id: root
property alias titleField: title.text
property alias staticText: modalTextEdit.staticText
property alias placeholderText: modalTextEdit.placeholderText
property alias enabled: modalTextEdit.enabled
property alias dynamicText: modalTextEdit.dynamicText
property string staticText
property string placeholderText
property string dynamicText
property bool isPassword: false
property int itemWidth
@ -56,13 +57,35 @@ RowLayout {
ModalTextEdit {
id: modalTextEdit
visible: !root.isPassword
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: itemWidth
Layout.maximumHeight: 40
staticText: staticText
placeholderText: ""
staticText: root.staticText
placeholderText: root.placeholderText ? root.placeholderText : root.titleField
onAccepted: {
root.dynamicText = dynamicText
editFinished()
}
}
PasswordTextEdit {
id: passwordTextEdit
visible: root.isPassword
Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: itemWidth
Layout.maximumHeight: 40
staticText: root.staticText
placeholderText: root.placeholderText ? root.placeholderText : root.titleField
onAccepted: {
root.dynamicText = dynamicText
editFinished()
}

View file

@ -545,8 +545,10 @@ Rectangle {
preferredWidth: Math.min(JamiTheme.wizardButtonWidth, root.width - JamiTheme.preferredMarginSize * 2)
text: JamiStrings.optionSave
onClicked: { root.saveButtonClicked()
root.alias = displayNameLineEdit.dynamicText}
onClicked: {
root.saveButtonClicked()
root.alias = displayNameLineEdit.dynamicText
}
}
}

View file

@ -136,7 +136,7 @@ Rectangle {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: Math.min(440, root.width - JamiTheme.preferredMarginSize * 2)
placeholderText: root.isRendezVous ? JamiStrings.chooseAName :
JamiStrings.chooseYourUserName
JamiStrings.chooseUsername
staticText: ""
editMode: true
focus: visible
@ -162,16 +162,16 @@ Rectangle {
text: {
switch(usernameEdit.nameRegistrationState){
case UsernameLineEdit.NameRegistrationState.BLANK:
case UsernameTextEdit.NameRegistrationState.BLANK:
return " "
case UsernameLineEdit.NameRegistrationState.SEARCHING:
case UsernameTextEdit.NameRegistrationState.SEARCHING:
return " "
case UsernameLineEdit.NameRegistrationState.FREE:
case UsernameTextEdit.NameRegistrationState.FREE:
return " "
case UsernameLineEdit.NameRegistrationState.INVALID:
case UsernameTextEdit.NameRegistrationState.INVALID:
return root.isRendezVous ? JamiStrings.invalidName :
JamiStrings.invalidUsername
case UsernameLineEdit.NameRegistrationState.TAKEN:
case UsernameTextEdit.NameRegistrationState.TAKEN:
return root.isRendezVous ? JamiStrings.nameAlreadyTaken :
JamiStrings.usernameAlreadyTaken
}
@ -194,8 +194,8 @@ Rectangle {
color: enabled? JamiTheme.buttonTintedBlue : JamiTheme.buttonTintedGrey
text: !enabled ? JamiStrings.creatingAccount :
root.isRendezVous ? JamiStrings.chooseName : JamiStrings.joinJami
enabled: usernameEdit.nameRegistrationState === UsernameLineEdit.NameRegistrationState.FREE
|| usernameEdit.nameRegistrationState === UsernameLineEdit.NameRegistrationState.BLANK
enabled: usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE
|| usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.BLANK
KeyNavigation.tab: showAdvancedButton
@ -212,13 +212,13 @@ Rectangle {
avatar: UtilsAdapter.tempCreationImage(),
isRendezVous: root.isRendezVous
})
if (usernameEdit.nameRegistrationState === UsernameLineEdit.NameRegistrationState.FREE) {
if (usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.FREE) {
enabled = false
showAdvancedButton.enabled = false
WizardViewStepModel.nextStep()
}
if(usernameEdit.nameRegistrationState === UsernameLineEdit.NameRegistrationState.BLANK)
if(usernameEdit.nameRegistrationState === UsernameTextEdit.NameRegistrationState.BLANK)
popup.visible = true
}

View file

@ -265,7 +265,6 @@ Rectangle {
}
ModalTextEdit {
id: displayNameLineEdit
Layout.alignment: Qt.AlignCenter

View file

@ -704,7 +704,7 @@ WizardView {
// With username
usernameEdit.nameRegistrationState =
UsernameLineEdit.NameRegistrationState.FREE
UsernameTextEdit.NameRegistrationState.FREE
keyClick(Qt.Key_Tab)
compare(chooseUsernameButton.focus, true)