Changeset View
Changeset View
Standalone View
Standalone View
src/contents/ui/CreateRoomPage.qml
| Show All 14 Lines | |||||
| import moe.kazv.mxc.kazv 0.0 as MK | import moe.kazv.mxc.kazv 0.0 as MK | ||||
| Kazv.ClosableScrollablePage { | Kazv.ClosableScrollablePage { | ||||
| id: createRoomPage | id: createRoomPage | ||||
| title: l10n.get('create-room-page-title') | title: l10n.get('create-room-page-title') | ||||
| property var creatingRoom: false | property var creatingRoom: false | ||||
| property var inviteUserIds: [] | property var inviteUserIds: [] | ||||
| property var encryptedChangedOnce: false | |||||
| ButtonGroup { | ButtonGroup { | ||||
| id: roomTypeButtons | id: roomTypeButtons | ||||
| } | } | ||||
| Kirigami.FormLayout { | Kirigami.FormLayout { | ||||
| anchors.fill: parent | anchors.fill: parent | ||||
| ColumnLayout { | ColumnLayout { | ||||
| Kirigami.FormData.label: l10n.get('create-room-page-type-prompt') | Kirigami.FormData.label: l10n.get('create-room-page-type-prompt') | ||||
| RadioButton { | RadioButton { | ||||
| id: typePublic | id: typePublic | ||||
| objectName: 'typePublicRadio' | objectName: 'typePublicRadio' | ||||
| checked: true | checked: true | ||||
| onCheckedChanged: { | |||||
| if (!createRoomPage.encryptedChangedOnce) { | |||||
| encrypted.checked = !checked; | |||||
| } | |||||
| } | |||||
| text: l10n.get('create-room-page-type-public') | text: l10n.get('create-room-page-type-public') | ||||
| ButtonGroup.group: roomTypeButtons | ButtonGroup.group: roomTypeButtons | ||||
| } | } | ||||
| RadioButton { | RadioButton { | ||||
| id: typePrivate | id: typePrivate | ||||
| objectName: 'typePrivateRadio' | objectName: 'typePrivateRadio' | ||||
| text: l10n.get('create-room-page-type-private') | text: l10n.get('create-room-page-type-private') | ||||
| ButtonGroup.group: roomTypeButtons | ButtonGroup.group: roomTypeButtons | ||||
| Show All 32 Lines | Kirigami.FormLayout { | ||||
| CheckBox { | CheckBox { | ||||
| id: allowFederate | id: allowFederate | ||||
| checked: true | checked: true | ||||
| text: l10n.get('create-room-page-allow-federate-prompt') | text: l10n.get('create-room-page-allow-federate-prompt') | ||||
| Layout.fillWidth: true | Layout.fillWidth: true | ||||
| } | } | ||||
| CheckBox { | |||||
| id: encrypted | |||||
| objectName: 'encryptedInput' | |||||
| text: l10n.get('create-room-page-encrypted-prompt') | |||||
| Layout.fillWidth: true | |||||
| onToggled: createRoomPage.encryptedChangedOnce = true | |||||
| } | |||||
| Item { | Item { | ||||
| Kirigami.FormData.isSection: true | Kirigami.FormData.isSection: true | ||||
| Kirigami.FormData.label: l10n.get('create-room-invite-userids-prompt') | Kirigami.FormData.label: l10n.get('create-room-invite-userids-prompt') | ||||
| } | } | ||||
| ColumnLayout { | ColumnLayout { | ||||
| Repeater { | Repeater { | ||||
| model: createRoomPage.inviteUserIds.length | model: createRoomPage.inviteUserIds.length | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | trigger: () => matrixSdk.createRoom( | ||||
| /* isDirect = */ typeDirect.checked && createRoomPage.inviteUserIds.length === 1, | /* isDirect = */ typeDirect.checked && createRoomPage.inviteUserIds.length === 1, | ||||
| /* allowFederate = */ allowFederate.checked, | /* allowFederate = */ allowFederate.checked, | ||||
| roomTopic.text, | roomTopic.text, | ||||
| /* powerLevelContentOverride = */ {}, | /* powerLevelContentOverride = */ {}, | ||||
| /* preset = */ typeDirect.checked | /* preset = */ typeDirect.checked | ||||
| ? MK.MatrixSdk.TrustedPrivateChat | ? MK.MatrixSdk.TrustedPrivateChat | ||||
| : typePrivate.checked | : typePrivate.checked | ||||
| ? MK.MatrixSdk.PrivateChat | ? MK.MatrixSdk.PrivateChat | ||||
| : MK.MatrixSdk.PublicChat | : MK.MatrixSdk.PublicChat, | ||||
| /* encrypted = */ encrypted.checked, | |||||
| ) | ) | ||||
| onResolved: { | onResolved: { | ||||
| if (success) { | if (success) { | ||||
| showPassiveNotification(l10n.get('create-room-page-success-prompt')); | showPassiveNotification(l10n.get('create-room-page-success-prompt')); | ||||
| pageStack.removePage(createRoomPage); | pageStack.removePage(createRoomPage); | ||||
| } else { | } else { | ||||
| showPassiveNotification(l10n.get('create-room-page-failed-prompt', { errorCode: data.errorCode, errorMsg: data.error })); | showPassiveNotification(l10n.get('create-room-page-failed-prompt', { errorCode: data.errorCode, errorMsg: data.error })); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||