Have labels for text fields
This commit is contained in:
parent
8452bdd5e7
commit
d96304dc33
|
@ -37,7 +37,7 @@ HFileDialogOpener {
|
||||||
|
|
||||||
PasswordPopup {
|
PasswordPopup {
|
||||||
id: exportPasswordPopup
|
id: exportPasswordPopup
|
||||||
details.text: qsTr("Please enter a passphrase to protect this file:")
|
details.text: qsTr("Passphrase to protect this file:")
|
||||||
okText: qsTr("Export")
|
okText: qsTr("Export")
|
||||||
|
|
||||||
onAcceptedPasswordChanged: exportKeys(file, acceptedPassword)
|
onAcceptedPasswordChanged: exportKeys(file, acceptedPassword)
|
||||||
|
|
|
@ -19,9 +19,7 @@ HFileDialogOpener {
|
||||||
|
|
||||||
PasswordPopup {
|
PasswordPopup {
|
||||||
id: importPasswordPopup
|
id: importPasswordPopup
|
||||||
details.text: qsTr(
|
details.text: qsTr("Passphrase used to protect this file:")
|
||||||
"Please enter the passphrase that was used to protect this file:"
|
|
||||||
)
|
|
||||||
okText: qsTr("Import")
|
okText: qsTr("Import")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ HBox {
|
||||||
id: signInBox
|
id: signInBox
|
||||||
clickButtonOnEnter: "apply"
|
clickButtonOnEnter: "apply"
|
||||||
|
|
||||||
onFocusChanged: idField.forceActiveFocus()
|
onFocusChanged: idField.field.forceActiveFocus()
|
||||||
|
|
||||||
buttonModel: [
|
buttonModel: [
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,8 @@ HBox {
|
||||||
errorMessage.text = ""
|
errorMessage.text = ""
|
||||||
|
|
||||||
const args = [
|
const args = [
|
||||||
idField.text.trim(), passwordField.text,
|
idField.field.text.trim(), passwordField.field.text,
|
||||||
undefined, serverField.text.trim(),
|
undefined, serverField.field.text.trim(),
|
||||||
]
|
]
|
||||||
|
|
||||||
loginFuture = py.callCoro("login_client", args, userId => {
|
loginFuture = py.callCoro("login_client", args, userId => {
|
||||||
|
@ -82,8 +82,8 @@ HBox {
|
||||||
property string signInWith: "username"
|
property string signInWith: "username"
|
||||||
|
|
||||||
readonly property bool canSignIn:
|
readonly property bool canSignIn:
|
||||||
serverField.text.trim() && idField.text.trim() && passwordField.text &&
|
serverField.field.text.trim() && idField.field.text.trim() &&
|
||||||
! serverField.error
|
passwordField.field.text && ! serverField.field.error
|
||||||
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
|
@ -124,35 +124,35 @@ HBox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: idField
|
id: idField
|
||||||
placeholderText: qsTr(
|
label.text: qsTr(
|
||||||
signInWith === "email" ? "Email" :
|
signInWith === "email" ? "Email:" :
|
||||||
signInWith === "phone" ? "Phone" :
|
signInWith === "phone" ? "Phone:" :
|
||||||
"Username"
|
"Username:"
|
||||||
)
|
)
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: passwordField
|
id: passwordField
|
||||||
placeholderText: qsTr("Password")
|
label.text: qsTr("Password:")
|
||||||
echoMode: HTextField.Password
|
field.echoMode: HTextField.Password
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: serverField
|
id: serverField
|
||||||
placeholderText: qsTr("Homeserver URL")
|
label.text: qsTr("Homeserver:")
|
||||||
text: "https://matrix.org"
|
field.text: "https://matrix.org"
|
||||||
error: ! /.+:\/\/.+/.test(cleanText)
|
field.error: ! /.+:\/\/.+/.test(cleanText)
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
|
||||||
readonly property string cleanText: text.toLowerCase().trim()
|
readonly property string cleanText: field.text.toLowerCase().trim()
|
||||||
|
|
||||||
// 2019-11-11 https://www.hello-matrix.net/public_servers.php
|
// 2019-11-11 https://www.hello-matrix.net/public_servers.php
|
||||||
readonly property var knownServers: [
|
readonly property var knownServers: [
|
||||||
|
@ -186,6 +186,8 @@ HBox {
|
||||||
)
|
)
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
Layout.topMargin: theme.spacing / 2
|
||||||
|
Layout.bottomMargin: Layout.topMargin
|
||||||
}
|
}
|
||||||
|
|
||||||
HLabel {
|
HLabel {
|
||||||
|
|
|
@ -8,7 +8,7 @@ HBox {
|
||||||
id: addChatBox
|
id: addChatBox
|
||||||
clickButtonOnEnter: "apply"
|
clickButtonOnEnter: "apply"
|
||||||
|
|
||||||
onFocusChanged: nameField.forceActiveFocus()
|
onFocusChanged: nameField.field.forceActiveFocus()
|
||||||
|
|
||||||
buttonModel: [
|
buttonModel: [
|
||||||
{ name: "apply", text: qsTr("Create"), iconName: "room-create" },
|
{ name: "apply", text: qsTr("Create"), iconName: "room-create" },
|
||||||
|
@ -21,8 +21,8 @@ HBox {
|
||||||
errorMessage.text = ""
|
errorMessage.text = ""
|
||||||
|
|
||||||
const args = [
|
const args = [
|
||||||
nameField.text,
|
nameField.field.text,
|
||||||
topicField.text,
|
topicField.field.text,
|
||||||
publicCheckBox.checked,
|
publicCheckBox.checked,
|
||||||
encryptCheckBox.checked,
|
encryptCheckBox.checked,
|
||||||
! blockOtherServersCheckBox.checked,
|
! blockOtherServersCheckBox.checked,
|
||||||
|
@ -40,8 +40,8 @@ HBox {
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: button => {
|
cancel: button => {
|
||||||
nameField.text = ""
|
nameField.field.text = ""
|
||||||
topicField.text = ""
|
topicField.field.text = ""
|
||||||
publicCheckBox.checked = false
|
publicCheckBox.checked = false
|
||||||
encryptCheckBox.checked = false
|
encryptCheckBox.checked = false
|
||||||
blockOtherServersCheckBox.checked = false
|
blockOtherServersCheckBox.checked = false
|
||||||
|
@ -57,7 +57,7 @@ HBox {
|
||||||
HRoomAvatar {
|
HRoomAvatar {
|
||||||
id: avatar
|
id: avatar
|
||||||
roomId: ""
|
roomId: ""
|
||||||
displayName: nameField.text
|
displayName: nameField.field.text
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
Layout.preferredWidth: 128
|
Layout.preferredWidth: 128
|
||||||
|
@ -66,24 +66,25 @@ HBox {
|
||||||
CurrentUserAvatar {
|
CurrentUserAvatar {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
z: 10
|
z: 10
|
||||||
opacity: nameField.text ? 0 : 1
|
opacity: nameField.field.text ? 0 : 1
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
|
|
||||||
Behavior on opacity { HNumberAnimation {} }
|
Behavior on opacity { HNumberAnimation {} }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: nameField
|
id: nameField
|
||||||
placeholderText: qsTr("Name")
|
label.text: qsTr("Name:")
|
||||||
maximumLength: 255
|
field.maximumLength: 255
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: topicField
|
id: topicField
|
||||||
placeholderText: qsTr("Topic (optional)")
|
label.text: qsTr("Topic:")
|
||||||
|
field.placeholderText: qsTr("This room is about...")
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,14 @@ HBox {
|
||||||
id: addChatBox
|
id: addChatBox
|
||||||
clickButtonOnEnter: "apply"
|
clickButtonOnEnter: "apply"
|
||||||
|
|
||||||
onFocusChanged: userField.forceActiveFocus()
|
onFocusChanged: userField.field.forceActiveFocus()
|
||||||
|
|
||||||
buttonModel: [
|
buttonModel: [
|
||||||
{
|
{
|
||||||
name: "apply",
|
name: "apply",
|
||||||
text: qsTr("Start chat"),
|
text: qsTr("Start chat"),
|
||||||
iconName: "start-direct-chat",
|
iconName: "start-direct-chat",
|
||||||
enabled: Boolean(userField.text.trim())
|
enabled: Boolean(userField.field.text.trim())
|
||||||
},
|
},
|
||||||
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
||||||
]
|
]
|
||||||
|
@ -25,7 +25,7 @@ HBox {
|
||||||
button.loading = true
|
button.loading = true
|
||||||
errorMessage.text = ""
|
errorMessage.text = ""
|
||||||
|
|
||||||
const args = [userField.text.trim(), encryptCheckBox.checked]
|
const args = [userField.field.text.trim(), encryptCheckBox.checked]
|
||||||
|
|
||||||
py.callClientCoro(userId, "new_direct_chat", args, roomId => {
|
py.callClientCoro(userId, "new_direct_chat", args, roomId => {
|
||||||
button.loading = false
|
button.loading = false
|
||||||
|
@ -52,7 +52,7 @@ HBox {
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: button => {
|
cancel: button => {
|
||||||
userField.text = ""
|
userField.field.text = ""
|
||||||
errorMessage.text = ""
|
errorMessage.text = ""
|
||||||
pageLoader.showPrevious()
|
pageLoader.showPrevious()
|
||||||
}
|
}
|
||||||
|
@ -68,10 +68,11 @@ HBox {
|
||||||
Layout.preferredHeight: Layout.preferredWidth
|
Layout.preferredHeight: Layout.preferredWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: userField
|
id: userField
|
||||||
placeholderText: qsTr("Peer user ID (e.g. @bob:matrix.org)")
|
label.text: qsTr("Peer user ID:")
|
||||||
error: Boolean(errorMessage.text)
|
field.placeholderText: qsTr("@example:matrix.org")
|
||||||
|
field.error: Boolean(errorMessage.text)
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,14 @@ HBox {
|
||||||
id: addChatBox
|
id: addChatBox
|
||||||
clickButtonOnEnter: "apply"
|
clickButtonOnEnter: "apply"
|
||||||
|
|
||||||
onFocusChanged: roomField.forceActiveFocus()
|
onFocusChanged: roomField.field.forceActiveFocus()
|
||||||
|
|
||||||
buttonModel: [
|
buttonModel: [
|
||||||
{
|
{
|
||||||
name: "apply",
|
name: "apply",
|
||||||
text: qsTr("Join"),
|
text: qsTr("Join"),
|
||||||
iconName: "room-join",
|
iconName: "room-join",
|
||||||
enabled: Boolean(roomField.text.trim()),
|
enabled: Boolean(roomField.field.text.trim()),
|
||||||
},
|
},
|
||||||
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
|
||||||
]
|
]
|
||||||
|
@ -25,7 +25,7 @@ HBox {
|
||||||
button.loading = true
|
button.loading = true
|
||||||
errorMessage.text = ""
|
errorMessage.text = ""
|
||||||
|
|
||||||
const args = [roomField.text.trim()]
|
const args = [roomField.field.text.trim()]
|
||||||
|
|
||||||
py.callClientCoro(userId, "room_join", args, roomId => {
|
py.callClientCoro(userId, "room_join", args, roomId => {
|
||||||
button.loading = false
|
button.loading = false
|
||||||
|
@ -51,7 +51,7 @@ HBox {
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: button => {
|
cancel: button => {
|
||||||
roomField.text = ""
|
roomField.field.text = ""
|
||||||
errorMessage.text = ""
|
errorMessage.text = ""
|
||||||
pageLoader.showPrevious()
|
pageLoader.showPrevious()
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,11 @@ HBox {
|
||||||
Layout.preferredHeight: Layout.preferredWidth
|
Layout.preferredHeight: Layout.preferredWidth
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: roomField
|
id: roomField
|
||||||
placeholderText: qsTr("Alias (e.g. #example:matrix.org), URL or ID")
|
label.text: qsTr("Alias, URL or room ID:")
|
||||||
error: Boolean(errorMessage.text)
|
field.placeholderText: qsTr("#example:matrix.org")
|
||||||
|
field.error: Boolean(errorMessage.text)
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ HBox {
|
||||||
saveFuture = null
|
saveFuture = null
|
||||||
}
|
}
|
||||||
|
|
||||||
nameField.reset()
|
nameField.field.reset()
|
||||||
topicField.reset()
|
topicField.field.reset()
|
||||||
encryptCheckBox.reset()
|
encryptCheckBox.reset()
|
||||||
requireInviteCheckbox.reset()
|
requireInviteCheckbox.reset()
|
||||||
forbidGuestsCheckBox.reset()
|
forbidGuestsCheckBox.reset()
|
||||||
|
@ -49,8 +49,9 @@ HBox {
|
||||||
property var saveFuture: null
|
property var saveFuture: null
|
||||||
|
|
||||||
readonly property bool anyChange:
|
readonly property bool anyChange:
|
||||||
nameField.changed || topicField.changed || encryptCheckBox.changed ||
|
nameField.field.changed || topicField.field.changed ||
|
||||||
requireInviteCheckbox.changed || forbidGuestsCheckBox.changed
|
encryptCheckBox.changed || requireInviteCheckbox.changed ||
|
||||||
|
forbidGuestsCheckBox.changed
|
||||||
|
|
||||||
|
|
||||||
HRoomAvatar {
|
HRoomAvatar {
|
||||||
|
@ -65,21 +66,22 @@ HBox {
|
||||||
Layout.maximumWidth: 256 * theme.uiScale
|
Layout.maximumWidth: 256 * theme.uiScale
|
||||||
}
|
}
|
||||||
|
|
||||||
HTextField {
|
HLabeledTextField {
|
||||||
id: nameField
|
id: nameField
|
||||||
placeholderText: qsTr("Room name")
|
label.text: qsTr("Name:")
|
||||||
maximumLength: 255
|
field.maximumLength: 255
|
||||||
defaultText: chat.roomInfo.given_name
|
field.defaultText: chat.roomInfo.given_name
|
||||||
enabled: chat.roomInfo.can_set_name
|
field.enabled: chat.roomInfo.can_set_name
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
HScrollableTextArea {
|
HLabeledTextField {
|
||||||
id: topicField
|
id: topicField
|
||||||
placeholderText: qsTr("Room topic")
|
label.text: qsTr("Topic:")
|
||||||
defaultText: chat.roomInfo.plain_topic
|
field.placeholderText: qsTr("This room is about...")
|
||||||
enabled: chat.roomInfo.can_set_topic
|
field.defaultText: chat.roomInfo.plain_topic
|
||||||
|
field.enabled: chat.roomInfo.can_set_topic
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,6 @@ BoxPopup {
|
||||||
|
|
||||||
HTextField {
|
HTextField {
|
||||||
id: passwordField
|
id: passwordField
|
||||||
placeholderText: qsTr("Passphrase")
|
|
||||||
echoMode: TextInput.Password
|
echoMode: TextInput.Password
|
||||||
focus: true
|
focus: true
|
||||||
error: passwordValid === false
|
error: passwordValid === false
|
||||||
|
|
Loading…
Reference in New Issue
Block a user