Working cancel button in settings

This commit is contained in:
miruka 2019-12-13 10:14:54 -04:00
parent 0ab7a008cf
commit 8a4c160df6
3 changed files with 66 additions and 17 deletions

21
TODO.md
View File

@ -1,7 +1,8 @@
# TODO # TODO
- invite keybind & context menu - invite keybind & context menu
- better cancel for all boxes - better cancel for all boxes + disablewhileloading false
- use defaulttext/checked elsewhere
## Media ## Media
@ -30,6 +31,7 @@
- Use HBox for Profile - Use HBox for Profile
- Get rid of all `currentSpacing` stuff - Get rid of all `currentSpacing` stuff
- Banners - Banners
- Split `HScrollableTextArea`
- Composer - Composer
- Try gel for the models and stop being lazy in python - Try gel for the models and stop being lazy in python
@ -166,21 +168,22 @@
## Nio contributions ## Nio contributions
- Dedicated error for invalid password on key import - Running blocking DB function calls in executor (WIP)
- Running blocking DB function calls in executor - `AsyncClient.share_group_session`: send device batches concurrently (WIP)
- `AsyncClient.share_group_session`: send device batches concurrently
- Dedicated error for invalid password on key import
- `RoomMessageMedia` and `RoomAvatarEvent` info attributes
- Handle `m.room.aliases` events
- RoomMessageMedia and RoomAvatarEvent info attributes
- `m.room.aliases` events
- Left room events after client reboot
- `org.matrix.room.preview_urls` events
- Support "Empty room (was ...)" after peer left - Support "Empty room (was ...)" after peer left
- Left room events after client reboot
- Previewing room without joining - Previewing room without joining
- Get content repo config API - Get content repo config API
- Add the `resume()` account "login" method - Add the `resume()` account "login" method
- See if we can turn all the Error classes into actual exceptions - Turn all the Error and Response classes into exceptions and normal returns
once `HttpClient` is deprecated
## Distribution ## Distribution

View File

@ -69,7 +69,7 @@ HDrawer {
Item {} Item {}
Item {} Item {}
Item {} Item {}
SettingsView {} SettingsView { fillAvailableHeight: true }
} }
} }
} }

View File

@ -3,11 +3,55 @@ import QtQuick.Layouts 1.12
import "../../Base" import "../../Base"
import "../../utils.js" as Utils import "../../utils.js" as Utils
// TODO: hide roompane until room is loaded & expand if too small // TODO: expand pane if too small
HBox { HBox {
color: "transparent" color: "transparent"
Component.onCompleted: Utils.debug(this) // XXX // Component.onCompleted: Utils.debug(this) // XXX
buttonModel: [
{
name: "apply",
text: qsTr("Save"),
iconName: "apply",
enabled: anyChange,
loading: saveFuture !== null,
disableWhileLoading: false,
},
{
name: "cancel",
text: qsTr("Cancel"),
iconName: "cancel",
enabled: anyChange || saveFuture !== null,
},
]
buttonCallbacks: ({
apply: button => {
if (saveFuture) saveFuture.cancel()
},
cancel: button => {
if (saveFuture) {
saveFuture.cancel()
saveFuture = null
}
nameField.reset()
topicField.reset()
encryptCheckBox.reset()
requireInviteCheckbox.reset()
forbidGuestsCheckBox.reset()
},
})
property var saveFuture: null
readonly property bool anyChange:
nameField.changed || topicField.changed || encryptCheckBox.changed ||
requireInviteCheckbox.changed || forbidGuestsCheckBox.changed
HRoomAvatar { HRoomAvatar {
id: avatar id: avatar
@ -24,7 +68,7 @@ HBox {
id: nameField id: nameField
placeholderText: qsTr("Room name") placeholderText: qsTr("Room name")
maximumLength: 255 maximumLength: 255
text: chat.roomInfo.given_name defaultText: chat.roomInfo.given_name
enabled: chat.roomInfo.can_set_name enabled: chat.roomInfo.can_set_name
Layout.fillWidth: true Layout.fillWidth: true
@ -33,7 +77,7 @@ HBox {
HScrollableTextArea { HScrollableTextArea {
id: topicField id: topicField
placeholderText: qsTr("Room topic") placeholderText: qsTr("Room topic")
text: chat.roomInfo.plain_topic defaultText: chat.roomInfo.plain_topic
enabled: chat.roomInfo.can_set_topic enabled: chat.roomInfo.can_set_topic
Layout.fillWidth: true Layout.fillWidth: true
@ -53,7 +97,7 @@ HBox {
) + ) +
"</font>" "</font>"
subtitle.textFormat: Text.StyledText subtitle.textFormat: Text.StyledText
checked: chat.roomInfo.encrypted defaultChecked: chat.roomInfo.encrypted
enabled: chat.roomInfo.can_set_encryption && ! chat.roomInfo.encrypted enabled: chat.roomInfo.can_set_encryption && ! chat.roomInfo.encrypted
Layout.fillWidth: true Layout.fillWidth: true
@ -63,16 +107,17 @@ HBox {
id: requireInviteCheckbox id: requireInviteCheckbox
text: qsTr("Require being invited") text: qsTr("Require being invited")
subtitle.text: qsTr("Users will need an invite to join the room") subtitle.text: qsTr("Users will need an invite to join the room")
checked: chat.roomInfo.invite_required defaultChecked: chat.roomInfo.invite_required
enabled: chat.roomInfo.can_set_join_rules enabled: chat.roomInfo.can_set_join_rules
Layout.fillWidth: true Layout.fillWidth: true
} }
HCheckBox { HCheckBox {
id: forbidGuestsCheckBox
text: qsTr("Forbid guests") text: qsTr("Forbid guests")
subtitle.text: qsTr("Users without an account won't be able to join") subtitle.text: qsTr("Users without an account won't be able to join")
checked: ! chat.roomInfo.guests_allowed defaultChecked: ! chat.roomInfo.guests_allowed
enabled: chat.roomInfo.can_set_guest_access enabled: chat.roomInfo.can_set_guest_access
Layout.fillWidth: true Layout.fillWidth: true
@ -85,4 +130,5 @@ HBox {
// Layout.fillWidth: true // Layout.fillWidth: true
// } // }
HSpacer {}
} }