Improve room setting
* Port away from OverlaySheet * Use Kirigami.CategorizedSettings * Add join rules (read only for now)
This commit is contained in:
@@ -1,203 +0,0 @@
|
|||||||
// SPDX-FileCopyrightText: 2019-2020 Black Hat <bhat@encom.eu.org>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
|
||||||
|
|
||||||
import QtQuick 2.15
|
|
||||||
import QtQuick.Controls 2.15
|
|
||||||
import QtQuick.Layouts 1.15
|
|
||||||
import org.kde.kirigami 2.15 as Kirigami
|
|
||||||
|
|
||||||
import org.kde.neochat 1.0
|
|
||||||
import NeoChat.Component 1.0
|
|
||||||
|
|
||||||
Kirigami.OverlaySheet {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property var room
|
|
||||||
|
|
||||||
readonly property bool canChangeAvatar: room.canSendState("m.room.avatar")
|
|
||||||
readonly property bool canChangeName: room.canSendState("m.room.name")
|
|
||||||
readonly property bool canChangeTopic: room.canSendState("m.room.topic")
|
|
||||||
readonly property bool canChangeCanonicalAlias: room.canSendState("m.room.canonical_alias")
|
|
||||||
|
|
||||||
parent: applicationWindow().overlay
|
|
||||||
|
|
||||||
|
|
||||||
title: i18nc("%1 is the room name", "Room Settings - %1", room.displayName)
|
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
spacing: 16
|
|
||||||
|
|
||||||
Kirigami.Avatar {
|
|
||||||
Layout.preferredWidth: 72
|
|
||||||
Layout.preferredHeight: 72
|
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
|
|
||||||
name: room.name
|
|
||||||
source: room.avatarMediaId ? ("image://mxc/" + room.avatarMediaId) : ""
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
enabled: canChangeAvatar
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
var fileDialog = openFileDialog.createObject(ApplicationWindow.overlay)
|
|
||||||
|
|
||||||
fileDialog.chosen.connect(function(path) {
|
|
||||||
if (!path) return
|
|
||||||
|
|
||||||
room.changeAvatar(path)
|
|
||||||
})
|
|
||||||
|
|
||||||
fileDialog.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.FormLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: roomNameField
|
|
||||||
text: room.name
|
|
||||||
Kirigami.FormData.label: i18n("Room Name:")
|
|
||||||
enabled: canChangeName
|
|
||||||
}
|
|
||||||
|
|
||||||
TextArea {
|
|
||||||
id: roomTopicField
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: room.topic
|
|
||||||
Kirigami.FormData.label: i18n("Room topic:")
|
|
||||||
enabled: canChangeTopic
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
|
|
||||||
visible: canChangeName || canChangeTopic
|
|
||||||
|
|
||||||
text: i18n("Save")
|
|
||||||
highlighted: true
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
if (room.name != roomNameField.text) {
|
|
||||||
room.setName(roomNameField.text)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (room.topic != roomTopicField.text) {
|
|
||||||
room.setTopic(roomTopicField.text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Separator {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
visible: canonicalAliasComboBox.visible || altAlias.visible
|
|
||||||
}
|
|
||||||
|
|
||||||
ComboBox {
|
|
||||||
id: canonicalAliasComboBox
|
|
||||||
visible: room.aliases && room.aliases.length
|
|
||||||
Kirigami.FormData.label: i18n("Canonical Alias:")
|
|
||||||
popup.z: 999; // HACK This is an absolute hack, but combos inside OverlaySheets have their popups show up underneath, because of fun z ordering stuff
|
|
||||||
|
|
||||||
enabled: canChangeCanonicalAlias
|
|
||||||
|
|
||||||
model: room.aliases
|
|
||||||
|
|
||||||
currentIndex: room.aliases.indexOf(room.canonicalAlias)
|
|
||||||
onCurrentIndexChanged: {
|
|
||||||
if (room.canonicalAlias != room.aliases[currentIndex]) {
|
|
||||||
room.setCanonicalAlias(room.aliases[currentIndex])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: altAlias
|
|
||||||
Kirigami.FormData.label: i18n("Other Aliases:")
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
visible: room.altAliases && room.altAliases.length
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: room.altAliases
|
|
||||||
|
|
||||||
delegate: RowLayout {
|
|
||||||
Layout.maximumWidth: parent.width
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: modelData
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolButton {
|
|
||||||
icon.name: ""
|
|
||||||
onClicked: room.removeLocalAlias(modelData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Kirigami.Separator {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
visible: next.visible || prev.visible
|
|
||||||
}
|
|
||||||
|
|
||||||
Control {
|
|
||||||
id: next
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
visible: room.predecessorId && room.connection.room(room.predecessorId)
|
|
||||||
|
|
||||||
padding: Kirigami.Units.largeSpacing
|
|
||||||
|
|
||||||
contentItem: Kirigami.InlineMessage {
|
|
||||||
text: i18n("This room continues another conversation.")
|
|
||||||
actions: Kirigami.Action {
|
|
||||||
text: i18n("See older messages...")
|
|
||||||
onTriggered: {
|
|
||||||
roomListForm.enteredRoom = Controller.activeConnection.room(room.predecessorId)
|
|
||||||
root.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Control {
|
|
||||||
id: prev
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
visible: room.successorId && room.connection.room(room.successorId)
|
|
||||||
|
|
||||||
padding: Kirigami.Units.largeSpacing
|
|
||||||
|
|
||||||
contentItem: Kirigami.InlineMessage {
|
|
||||||
text: i18n("This room has been replaced.")
|
|
||||||
actions: Kirigami.Action {
|
|
||||||
text: i18n("See new room...")
|
|
||||||
onTriggered: {
|
|
||||||
roomListForm.enteredRoom = Controller.activeConnection.room(room.successorId)
|
|
||||||
root.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
|
||||||
id: openFileDialog
|
|
||||||
|
|
||||||
OpenFileDialog {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
module NeoChat.Dialog
|
module NeoChat.Dialog
|
||||||
RoomSettingsDialog 1.0 RoomSettingsDialog.qml
|
|
||||||
UserDetailDialog 1.0 UserDetailDialog.qml
|
UserDetailDialog 1.0 UserDetailDialog.qml
|
||||||
LoginDialog 1.0 LoginDialog.qml
|
LoginDialog 1.0 LoginDialog.qml
|
||||||
CreateRoomDialog 1.0 CreateRoomDialog.qml
|
CreateRoomDialog 1.0 CreateRoomDialog.qml
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ Kirigami.OverlayDrawer {
|
|||||||
icon.name: "list-add-user"
|
icon.name: "list-add-user"
|
||||||
text: i18n("Invite")
|
text: i18n("Invite")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
applicationWindow().pageStack.layers.push("qrc:/imports/NeoChat/Page/InviteUserPage.qml", {"room": room})
|
applicationWindow().pageStack.layers.push("qrc:/imports/NeoChat/Page/InviteUserPage.qml", {room: room})
|
||||||
roomDrawer.close();
|
roomDrawer.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,12 +69,7 @@ Kirigami.OverlayDrawer {
|
|||||||
ToolButton {
|
ToolButton {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
icon.name: 'settings-configure'
|
icon.name: 'settings-configure'
|
||||||
onClicked: {
|
onClicked: ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/imports/NeoChat/RoomSettings/Categories.qml', {room: room})
|
||||||
roomSettingDialog.createObject(ApplicationWindow.overlay, {"room": room}).open()
|
|
||||||
if (!wideScreen) {
|
|
||||||
roomDrawer.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolTip {
|
ToolTip {
|
||||||
text: i18n("Room settings")
|
text: i18n("Room settings")
|
||||||
@@ -161,6 +156,8 @@ Kirigami.OverlayDrawer {
|
|||||||
padding: Kirigami.Units.smallSpacing
|
padding: Kirigami.Units.smallSpacing
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
z: 2
|
z: 2
|
||||||
|
Kirigami.Theme.inherit: false
|
||||||
|
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
||||||
contentItem: Kirigami.SearchField {
|
contentItem: Kirigami.SearchField {
|
||||||
id: userListSearchField
|
id: userListSearchField
|
||||||
onAccepted: sortedMessageEventModel.filterString = text;
|
onAccepted: sortedMessageEventModel.filterString = text;
|
||||||
@@ -255,12 +252,6 @@ Kirigami.OverlayDrawer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: roomSettingDialog
|
|
||||||
|
|
||||||
RoomSettingsDialog {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: userDetailDialog
|
id: userDetailDialog
|
||||||
|
|
||||||
|
|||||||
35
imports/NeoChat/RoomSettings/Categories.qml
Normal file
35
imports/NeoChat/RoomSettings/Categories.qml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
|
||||||
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
import org.kde.kirigami 2.18 as Kirigami
|
||||||
|
import QtQuick.Controls 2.15 as Controls
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
|
Kirigami.CategorizedSettings {
|
||||||
|
id: root
|
||||||
|
required property var room
|
||||||
|
objectName: "settingsPage"
|
||||||
|
actions: [
|
||||||
|
Kirigami.SettingAction {
|
||||||
|
text: i18n("General")
|
||||||
|
icon.name: "settings-configure"
|
||||||
|
page: Qt.resolvedUrl("General.qml")
|
||||||
|
initialProperties: {
|
||||||
|
return {
|
||||||
|
room: root.room
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Kirigami.SettingAction {
|
||||||
|
text: i18n("Security")
|
||||||
|
icon.name: "security-low"
|
||||||
|
page: Qt.resolvedUrl("Security.qml")
|
||||||
|
initialProperties: {
|
||||||
|
return {
|
||||||
|
room: root.room
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
202
imports/NeoChat/RoomSettings/General.qml
Normal file
202
imports/NeoChat/RoomSettings/General.qml
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2019-2020 Black Hat <bhat@encom.eu.org>
|
||||||
|
// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
|
import org.kde.kirigami 2.15 as Kirigami
|
||||||
|
|
||||||
|
import org.kde.neochat 1.0
|
||||||
|
import NeoChat.Component 1.0
|
||||||
|
import NeoChat.Dialog 1.0
|
||||||
|
|
||||||
|
Kirigami.ScrollablePage {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property var room
|
||||||
|
|
||||||
|
readonly property bool canChangeAvatar: room.canSendState("m.room.avatar")
|
||||||
|
readonly property bool canChangeName: room.canSendState("m.room.name")
|
||||||
|
readonly property bool canChangeTopic: room.canSendState("m.room.topic")
|
||||||
|
readonly property bool canChangeCanonicalAlias: room.canSendState("m.room.canonical_alias")
|
||||||
|
|
||||||
|
title: i18n('General')
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Kirigami.FormLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
Kirigami.Avatar {
|
||||||
|
Layout.bottomMargin: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
|
name: room.name
|
||||||
|
source: room.avatarMediaId ? ("image://mxc/" + room.avatarMediaId) : ""
|
||||||
|
|
||||||
|
RoundButton {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
height: Kirigami.Units.gridUnits
|
||||||
|
width: Kirigami.Units.gridUnits
|
||||||
|
icon.name: 'cloud-upload'
|
||||||
|
Accessible.name: i18n("Update avatar")
|
||||||
|
enabled: canChangeAvatar
|
||||||
|
onClicked: {
|
||||||
|
const fileDialog = openFileDialog.createObject(ApplicationWindow.overlay)
|
||||||
|
|
||||||
|
fileDialog.chosen.connect(function(path) {
|
||||||
|
if (!path) return
|
||||||
|
|
||||||
|
room.changeAvatar(path)
|
||||||
|
})
|
||||||
|
|
||||||
|
fileDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TextField {
|
||||||
|
id: roomNameField
|
||||||
|
text: room.name
|
||||||
|
Kirigami.FormData.label: i18n("Room Name:")
|
||||||
|
enabled: canChangeName
|
||||||
|
}
|
||||||
|
|
||||||
|
TextArea {
|
||||||
|
id: roomTopicField
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: room.topic
|
||||||
|
Kirigami.FormData.label: i18n("Room topic:")
|
||||||
|
enabled: canChangeTopic
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Kirigami.Separator {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: canonicalAliasComboBox.visible || altAlias.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBox {
|
||||||
|
id: canonicalAliasComboBox
|
||||||
|
visible: room.aliases && room.aliases.length
|
||||||
|
Kirigami.FormData.label: i18n("Canonical Alias:")
|
||||||
|
popup.z: 999; // HACK This is an absolute hack, but combos inside OverlaySheets have their popups show up underneath, because of fun z ordering stuff
|
||||||
|
|
||||||
|
enabled: canChangeCanonicalAlias
|
||||||
|
|
||||||
|
model: room.aliases
|
||||||
|
|
||||||
|
currentIndex: room.aliases.indexOf(room.canonicalAlias)
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
if (room.canonicalAlias != room.aliases[currentIndex]) {
|
||||||
|
room.setCanonicalAlias(room.aliases[currentIndex])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: altAlias
|
||||||
|
Kirigami.FormData.label: i18n("Other Aliases:")
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
visible: room.altAliases && room.altAliases.length
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: room.altAliases
|
||||||
|
|
||||||
|
delegate: RowLayout {
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: modelData
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolButton {
|
||||||
|
icon.name: ""
|
||||||
|
onClicked: room.removeLocalAlias(modelData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Kirigami.Separator {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: next.visible || prev.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
Control {
|
||||||
|
id: next
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
visible: room.predecessorId && room.connection.room(room.predecessorId)
|
||||||
|
|
||||||
|
padding: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
|
contentItem: Kirigami.InlineMessage {
|
||||||
|
text: i18n("This room continues another conversation.")
|
||||||
|
actions: Kirigami.Action {
|
||||||
|
text: i18n("See older messages...")
|
||||||
|
onTriggered: {
|
||||||
|
roomListForm.enteredRoom = Controller.activeConnection.room(room.predecessorId)
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Control {
|
||||||
|
id: prev
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
visible: room.successorId && room.connection.room(room.successorId)
|
||||||
|
|
||||||
|
padding: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
|
contentItem: Kirigami.InlineMessage {
|
||||||
|
text: i18n("This room has been replaced.")
|
||||||
|
actions: Kirigami.Action {
|
||||||
|
text: i18n("See new room...")
|
||||||
|
onTriggered: {
|
||||||
|
roomListForm.enteredRoom = Controller.activeConnection.room(room.successorId)
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: openFileDialog
|
||||||
|
|
||||||
|
OpenFileDialog {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer: ToolBar {
|
||||||
|
contentItem: RowLayout {
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
enabled: room.name !== roomNameField.text || room.topic !== roomTopicField.text
|
||||||
|
text: i18n("Apply")
|
||||||
|
onClicked: {
|
||||||
|
if (room.name != roomNameField.text) {
|
||||||
|
room.setName(roomNameField.text)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (room.topic != roomTopicField.text) {
|
||||||
|
room.setTopic(roomTopicField.text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
69
imports/NeoChat/RoomSettings/Security.qml
Normal file
69
imports/NeoChat/RoomSettings/Security.qml
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2019-2020 Black Hat <bhat@encom.eu.org>
|
||||||
|
// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Layouts 1.15
|
||||||
|
import org.kde.kirigami 2.15 as Kirigami
|
||||||
|
|
||||||
|
import org.kde.neochat 1.0
|
||||||
|
import NeoChat.Component 1.0
|
||||||
|
import NeoChat.Dialog 1.0
|
||||||
|
|
||||||
|
Kirigami.ScrollablePage {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property var room
|
||||||
|
|
||||||
|
title: i18n('Security')
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Kirigami.FormLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
text: i18nc("@option:check", "Private (invite only)")
|
||||||
|
Kirigami.FormData.label: i18nc("@option:check", "Access:")
|
||||||
|
checked: room.joinRule === "invite"
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: i18n("Only invited people can join.")
|
||||||
|
font: Kirigami.Theme.smallFont
|
||||||
|
}
|
||||||
|
CheckBox {
|
||||||
|
text: i18nc("@option:check", "Space members")
|
||||||
|
checked: room.joinRule === "restricted"
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: i18n("Anyone in a space can find and join.")
|
||||||
|
font: Kirigami.Theme.smallFont
|
||||||
|
}
|
||||||
|
CheckBox {
|
||||||
|
text: i18nc("@option:check", "Public")
|
||||||
|
checked: room.joinRule === "public"
|
||||||
|
enabled: false
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: i18nc("@option:check", "Anyone can find and join.") + room.joinRule
|
||||||
|
font: Kirigami.Theme.smallFont
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
footer: ToolBar {
|
||||||
|
contentItem: RowLayout {
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
enabled: false
|
||||||
|
text: i18n("Apply")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
4
res.qrc
4
res.qrc
@@ -11,6 +11,9 @@
|
|||||||
<file>imports/NeoChat/Page/StartChatPage.qml</file>
|
<file>imports/NeoChat/Page/StartChatPage.qml</file>
|
||||||
<file>imports/NeoChat/Page/ImageEditorPage.qml</file>
|
<file>imports/NeoChat/Page/ImageEditorPage.qml</file>
|
||||||
<file>imports/NeoChat/Page/WelcomePage.qml</file>
|
<file>imports/NeoChat/Page/WelcomePage.qml</file>
|
||||||
|
<file>imports/NeoChat/RoomSettings/General.qml</file>
|
||||||
|
<file>imports/NeoChat/RoomSettings/Security.qml</file>
|
||||||
|
<file>imports/NeoChat/RoomSettings/Categories.qml</file>
|
||||||
<file>imports/NeoChat/Component/qmldir</file>
|
<file>imports/NeoChat/Component/qmldir</file>
|
||||||
<file>imports/NeoChat/Component/FullScreenImage.qml</file>
|
<file>imports/NeoChat/Component/FullScreenImage.qml</file>
|
||||||
<file>imports/NeoChat/Component/FancyEffectsContainer.qml</file>
|
<file>imports/NeoChat/Component/FancyEffectsContainer.qml</file>
|
||||||
@@ -54,7 +57,6 @@
|
|||||||
<file>imports/NeoChat/Panel/qmldir</file>
|
<file>imports/NeoChat/Panel/qmldir</file>
|
||||||
<file>imports/NeoChat/Panel/RoomDrawer.qml</file>
|
<file>imports/NeoChat/Panel/RoomDrawer.qml</file>
|
||||||
<file>imports/NeoChat/Dialog/qmldir</file>
|
<file>imports/NeoChat/Dialog/qmldir</file>
|
||||||
<file>imports/NeoChat/Dialog/RoomSettingsDialog.qml</file>
|
|
||||||
<file>imports/NeoChat/Dialog/UserDetailDialog.qml</file>
|
<file>imports/NeoChat/Dialog/UserDetailDialog.qml</file>
|
||||||
<file>imports/NeoChat/Dialog/CreateRoomDialog.qml</file>
|
<file>imports/NeoChat/Dialog/CreateRoomDialog.qml</file>
|
||||||
<file>imports/NeoChat/Dialog/EmojiDialog.qml</file>
|
<file>imports/NeoChat/Dialog/EmojiDialog.qml</file>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ add_executable(neochat
|
|||||||
spellcheckhighlighter.cpp
|
spellcheckhighlighter.cpp
|
||||||
blurhash.cpp
|
blurhash.cpp
|
||||||
blurhashimageprovider.cpp
|
blurhashimageprovider.cpp
|
||||||
|
joinrulesevent.cpp
|
||||||
../res.qrc
|
../res.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
16
src/joinrulesevent.cpp
Normal file
16
src/joinrulesevent.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2019 Kitsune Ral <Kitsune-Ral@users.sf.net>
|
||||||
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
|
#include "joinrulesevent.h"
|
||||||
|
|
||||||
|
using namespace Quotient;
|
||||||
|
|
||||||
|
QString JoinRulesEvent::joinRule() const
|
||||||
|
{
|
||||||
|
return fromJson<QString>(contentJson()["join_rule"_ls]);
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonArray JoinRulesEvent::allow() const
|
||||||
|
{
|
||||||
|
return contentJson()["allow"_ls].toArray();
|
||||||
|
}
|
||||||
29
src/joinrulesevent.h
Normal file
29
src/joinrulesevent.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
|
||||||
|
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <events/stateevent.h>
|
||||||
|
#include <quotient_common.h>
|
||||||
|
|
||||||
|
namespace Quotient
|
||||||
|
{
|
||||||
|
class JoinRulesEvent : public StateEventBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DEFINE_EVENT_TYPEID("m.room.join_rules", JoinRulesEvent)
|
||||||
|
|
||||||
|
explicit JoinRulesEvent()
|
||||||
|
: StateEventBase(typeId(), matrixTypeId())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
explicit JoinRulesEvent(const QJsonObject &obj)
|
||||||
|
: StateEventBase(typeId(), obj)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString joinRule() const;
|
||||||
|
QJsonArray allow() const;
|
||||||
|
};
|
||||||
|
REGISTER_EVENT_TYPE(JoinRulesEvent)
|
||||||
|
} // namespace Quotient
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
#include "devicesmodel.h"
|
#include "devicesmodel.h"
|
||||||
#include "emojimodel.h"
|
#include "emojimodel.h"
|
||||||
#include "filetypesingleton.h"
|
#include "filetypesingleton.h"
|
||||||
|
#include "joinrulesevent.h"
|
||||||
#include "login.h"
|
#include "login.h"
|
||||||
#include "matriximageprovider.h"
|
#include "matriximageprovider.h"
|
||||||
#include "messageeventmodel.h"
|
#include "messageeventmodel.h"
|
||||||
|
|||||||
@@ -735,6 +735,11 @@ void NeoChatRoom::deleteMessagesByUser(const QString &user)
|
|||||||
doDeleteMessagesByUser(user);
|
doDeleteMessagesByUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString NeoChatRoom::joinRule() const
|
||||||
|
{
|
||||||
|
return getCurrentState<JoinRulesEvent>()->joinRule();
|
||||||
|
}
|
||||||
|
|
||||||
QCoro::Task<void> NeoChatRoom::doDeleteMessagesByUser(const QString &user)
|
QCoro::Task<void> NeoChatRoom::doDeleteMessagesByUser(const QString &user)
|
||||||
{
|
{
|
||||||
QStringList events;
|
QStringList events;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "joinrulesevent.h"
|
||||||
#include <events/encryptionevent.h>
|
#include <events/encryptionevent.h>
|
||||||
#include <events/redactionevent.h>
|
#include <events/redactionevent.h>
|
||||||
#include <events/roomavatarevent.h>
|
#include <events/roomavatarevent.h>
|
||||||
@@ -33,6 +34,7 @@ class NeoChatRoom : public Room
|
|||||||
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
Q_PROPERTY(bool readMarkerLoaded READ readMarkerLoaded NOTIFY readMarkerLoadedChanged)
|
||||||
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
Q_PROPERTY(QDateTime lastActiveTime READ lastActiveTime NOTIFY lastActiveTimeChanged)
|
||||||
Q_PROPERTY(bool isInvite READ isInvite NOTIFY isInviteChanged)
|
Q_PROPERTY(bool isInvite READ isInvite NOTIFY isInviteChanged)
|
||||||
|
Q_PROPERTY(QString joinRule READ joinRule CONSTANT)
|
||||||
Q_PROPERTY(QString htmlSafeDisplayName READ htmlSafeDisplayName NOTIFY displayNameChanged)
|
Q_PROPERTY(QString htmlSafeDisplayName READ htmlSafeDisplayName NOTIFY displayNameChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -66,6 +68,8 @@ public:
|
|||||||
|
|
||||||
bool isEventHighlighted(const Quotient::RoomEvent *e) const;
|
bool isEventHighlighted(const Quotient::RoomEvent *e) const;
|
||||||
|
|
||||||
|
[[nodiscard]] QString joinRule() const;
|
||||||
|
|
||||||
[[nodiscard]] bool hasFileUploading() const
|
[[nodiscard]] bool hasFileUploading() const
|
||||||
{
|
{
|
||||||
return m_hasFileUploading;
|
return m_hasFileUploading;
|
||||||
|
|||||||
Reference in New Issue
Block a user