Cleanup connection handling in QML
Consistently pass connection objects to files that need them instead of randomly using Controller.activeConnection in some of them
This commit is contained in:
committed by
Carl Schwan
parent
6439fa48f9
commit
5e80715898
@@ -46,6 +46,8 @@ QQC2.Control {
|
|||||||
*/
|
*/
|
||||||
property alias textField: textField
|
property alias textField: textField
|
||||||
|
|
||||||
|
property NeoChatConnection connection
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The list of actions in the ChatBar.
|
* @brief The list of actions in the ChatBar.
|
||||||
*
|
*
|
||||||
@@ -414,6 +416,7 @@ QQC2.Control {
|
|||||||
y: -height - 5
|
y: -height - 5
|
||||||
z: 1
|
z: 1
|
||||||
chatDocumentHandler: documentHandler
|
chatDocumentHandler: documentHandler
|
||||||
|
connection: root.connection
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
property: "height"
|
property: "height"
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ ColumnLayout {
|
|||||||
*/
|
*/
|
||||||
required property NeoChatRoom currentRoom
|
required property NeoChatRoom currentRoom
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A message has been sent from the chat bar.
|
* @brief A message has been sent from the chat bar.
|
||||||
*/
|
*/
|
||||||
@@ -62,6 +64,8 @@ ColumnLayout {
|
|||||||
ChatBar {
|
ChatBar {
|
||||||
id: chatBar
|
id: chatBar
|
||||||
|
|
||||||
|
connection: root.connection
|
||||||
|
|
||||||
visible: root.currentRoom.canSendEvent("m.room.message")
|
visible: root.currentRoom.canSendEvent("m.room.message")
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ QQC2.Popup {
|
|||||||
id: root
|
id: root
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
visible: completions.count > 0
|
visible: completions.count > 0
|
||||||
|
|
||||||
RoomListModel {
|
RoomListModel {
|
||||||
id: roomListModel
|
id: roomListModel
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
property var chatDocumentHandler
|
property var chatDocumentHandler
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ ColumnLayout {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatRoom room
|
required property NeoChatRoom room
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
title: i18nc("@title", "Choose Room")
|
title: i18nc("@title", "Choose Room")
|
||||||
@@ -26,7 +27,7 @@ ColumnLayout {
|
|||||||
valueRole: "roomId"
|
valueRole: "roomId"
|
||||||
model: RoomListModel {
|
model: RoomListModel {
|
||||||
id: roomListModel
|
id: roomListModel
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
currentIndex: -1
|
currentIndex: -1
|
||||||
Component.onCompleted: currentIndex = roomListModel.rowForRoom(root.room)
|
Component.onCompleted: currentIndex = roomListModel.rowForRoom(root.room)
|
||||||
|
|||||||
@@ -12,13 +12,17 @@ import org.kde.kitemmodels 1.0
|
|||||||
import org.kde.neochat 1.0
|
import org.kde.neochat 1.0
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
title: i18n("Server Capabilities")
|
title: i18n("Server Capabilities")
|
||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
FormCard.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
text: i18n("Can change password")
|
text: i18n("Can change password")
|
||||||
description: Controller.activeConnection.canChangePassword
|
description: root.connection.canChangePassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
@@ -26,7 +30,7 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
FormCard.FormCard {
|
FormCard.FormCard {
|
||||||
FormCard.FormTextDelegate {
|
FormCard.FormTextDelegate {
|
||||||
text: Controller.activeConnection.defaultRoomVersion
|
text: root.connection.defaultRoomVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import './RoomList' as RoomList
|
|||||||
QQC2.Dialog {
|
QQC2.Dialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
parent: applicationWindow().overlay
|
parent: applicationWindow().overlay
|
||||||
width: Math.min(700, parent.width)
|
width: Math.min(700, parent.width)
|
||||||
height: 400
|
height: 400
|
||||||
@@ -84,13 +86,15 @@ QQC2.Dialog {
|
|||||||
filterText: searchField.text
|
filterText: searchField.text
|
||||||
sourceModel: RoomListModel {
|
sourceModel: RoomListModel {
|
||||||
id: roomListModel
|
id: roomListModel
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: RoomList.RoomDelegate {
|
delegate: RoomList.RoomDelegate {
|
||||||
filterText: searchField.text
|
filterText: searchField.text
|
||||||
|
|
||||||
|
connection: root.connection
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
RoomManager.enterRoom(currentRoom);
|
RoomManager.enterRoom(currentRoom);
|
||||||
root.close()
|
root.close()
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ import org.kde.neochat 1.0
|
|||||||
|
|
||||||
DelegateChooser {
|
DelegateChooser {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
role: "delegateType"
|
role: "delegateType"
|
||||||
property var room
|
property var room
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.State
|
roleValue: DelegateType.State
|
||||||
@@ -20,22 +22,30 @@ DelegateChooser {
|
|||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Emote
|
roleValue: DelegateType.Emote
|
||||||
delegate: MessageDelegate {}
|
delegate: MessageDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Message
|
roleValue: DelegateType.Message
|
||||||
delegate: MessageDelegate {}
|
delegate: MessageDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Notice
|
roleValue: DelegateType.Notice
|
||||||
delegate: MessageDelegate {}
|
delegate: MessageDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Image
|
roleValue: DelegateType.Image
|
||||||
delegate: ImageDelegate {}
|
delegate: ImageDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
@@ -45,22 +55,30 @@ DelegateChooser {
|
|||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Audio
|
roleValue: DelegateType.Audio
|
||||||
delegate: AudioDelegate {}
|
delegate: AudioDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Video
|
roleValue: DelegateType.Video
|
||||||
delegate: VideoDelegate {}
|
delegate: VideoDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.File
|
roleValue: DelegateType.File
|
||||||
delegate: FileDelegate {}
|
delegate: FileDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Encrypted
|
roleValue: DelegateType.Encrypted
|
||||||
delegate: EncryptedDelegate {}
|
delegate: EncryptedDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
@@ -70,17 +88,22 @@ DelegateChooser {
|
|||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Poll
|
roleValue: DelegateType.Poll
|
||||||
delegate: PollDelegate {}
|
delegate: PollDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.Location
|
roleValue: DelegateType.Location
|
||||||
delegate: LocationDelegate {}
|
delegate: LocationDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
roleValue: DelegateType.LiveLocation
|
roleValue: DelegateType.LiveLocation
|
||||||
delegate: LiveLocationDelegate {
|
delegate: LiveLocationDelegate {
|
||||||
room: root.room
|
room: root.room
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ QQC2.TextArea {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NeoChatRoom room
|
property NeoChatRoom room
|
||||||
|
required property NeoChatConnection connection
|
||||||
onRoomChanged: room.chatBoxEditIdChanged.connect(updateEditText)
|
onRoomChanged: room.chatBoxEditIdChanged.connect(updateEditText)
|
||||||
|
|
||||||
property string messageId
|
property string messageId
|
||||||
@@ -101,6 +102,7 @@ QQC2.TextArea {
|
|||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
y: -height - 5
|
y: -height - 5
|
||||||
z: 10
|
z: 10
|
||||||
|
connection: root.connection
|
||||||
chatDocumentHandler: documentHandler
|
chatDocumentHandler: documentHandler
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|||||||
@@ -243,6 +243,8 @@ ColumnLayout {
|
|||||||
*/
|
*/
|
||||||
readonly property alias hovered: bubble.hovered
|
readonly property alias hovered: bubble.hovered
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Open the context menu for the message.
|
* @brief Open the context menu for the message.
|
||||||
*/
|
*/
|
||||||
@@ -612,6 +614,7 @@ ColumnLayout {
|
|||||||
file: file,
|
file: file,
|
||||||
progressInfo: root.progressInfo,
|
progressInfo: root.progressInfo,
|
||||||
plainText: root.plainText,
|
plainText: root.plainText,
|
||||||
|
connection: root.connection,
|
||||||
});
|
});
|
||||||
contextMenu.open();
|
contextMenu.open();
|
||||||
}
|
}
|
||||||
@@ -626,6 +629,7 @@ ColumnLayout {
|
|||||||
eventType: root.delegateType,
|
eventType: root.delegateType,
|
||||||
plainText: root.plainText,
|
plainText: root.plainText,
|
||||||
htmlText: root.display,
|
htmlText: root.display,
|
||||||
|
connection: root.connection,
|
||||||
});
|
});
|
||||||
contextMenu.open();
|
contextMenu.open();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ QQC2.ScrollView {
|
|||||||
|
|
||||||
delegate: EventDelegate {
|
delegate: EventDelegate {
|
||||||
room: root.currentRoom
|
room: root.currentRoom
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.RoundButton {
|
QQC2.RoundButton {
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import QtQuick.Layouts 1.10
|
|||||||
import org.kde.neochat 1.0
|
import org.kde.neochat 1.0
|
||||||
|
|
||||||
Labs.MenuBar {
|
Labs.MenuBar {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
Labs.Menu {
|
Labs.Menu {
|
||||||
title: i18nc("menu", "NeoChat")
|
title: i18nc("menu", "NeoChat")
|
||||||
|
|
||||||
@@ -23,7 +27,7 @@ Labs.MenuBar {
|
|||||||
|
|
||||||
shortcut: StandardKey.Preferences
|
shortcut: StandardKey.Preferences
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Configure")
|
title: i18n("Configure")
|
||||||
})
|
})
|
||||||
@@ -41,7 +45,7 @@ Labs.MenuBar {
|
|||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
text: i18nc("menu", "New Private Chat…")
|
text: i18nc("menu", "New Private Chat…")
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && AccountRegistry.accountCount > 0
|
enabled: pageStack.layers.currentItem.title !== i18n("Start a Chat") && AccountRegistry.accountCount > 0
|
||||||
onTriggered: pushReplaceLayer("qrc:/StartChatPage.qml", {connection: Controller.activeConnection})
|
onTriggered: pushReplaceLayer("qrc:/StartChatPage.qml", {connection: root.connection})
|
||||||
}
|
}
|
||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
text: i18nc("menu", "New Group…")
|
text: i18nc("menu", "New Group…")
|
||||||
@@ -55,10 +59,10 @@ Labs.MenuBar {
|
|||||||
Labs.MenuItem {
|
Labs.MenuItem {
|
||||||
text: i18nc("menu", "Browse Chats…")
|
text: i18nc("menu", "Browse Chats…")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let dialog = pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: Controller.activeConnection}, {title: i18nc("@title", "Explore Rooms")})
|
let dialog = pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")})
|
||||||
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
||||||
if (isJoined) {
|
if (isJoined) {
|
||||||
RoomManager.enterRoom(Controller.activeConnection.room(roomId))
|
RoomManager.enterRoom(root.connection.room(roomId))
|
||||||
} else {
|
} else {
|
||||||
Controller.joinRoom(roomId)
|
Controller.joinRoom(roomId)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ Loader {
|
|||||||
required property string plainText
|
required property string plainText
|
||||||
property string htmlText: undefined
|
property string htmlText: undefined
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
property list<Kirigami.Action> nestedActions
|
property list<Kirigami.Action> nestedActions
|
||||||
|
|
||||||
property list<Kirigami.Action> actions: [
|
property list<Kirigami.Action> actions: [
|
||||||
@@ -31,7 +33,7 @@ Loader {
|
|||||||
currentRoom.chatBoxEditId = eventId;
|
currentRoom.chatBoxEditId = eventId;
|
||||||
currentRoom.chatBoxReplyId = "";
|
currentRoom.chatBoxReplyId = "";
|
||||||
}
|
}
|
||||||
visible: author.id === Controller.activeConnection.localUserId && (root.eventType === DelegateType.Emote || root.eventType === DelegateType.Message)
|
visible: author.id === root.connection.localUserId && (root.eventType === DelegateType.Emote || root.eventType === DelegateType.Message)
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Reply")
|
text: i18n("Reply")
|
||||||
@@ -45,12 +47,14 @@ Loader {
|
|||||||
text: i18nc("@action:inmenu As in 'Forward this message'", "Forward")
|
text: i18nc("@action:inmenu As in 'Forward this message'", "Forward")
|
||||||
icon.name: "mail-forward-symbolic"
|
icon.name: "mail-forward-symbolic"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let page = applicationWindow().pageStack.pushDialogLayer("qrc:/ChooseRoomDialog.qml", {}, {
|
let page = applicationWindow().pageStack.pushDialogLayer("qrc:/ChooseRoomDialog.qml", {
|
||||||
|
connection: root.connection
|
||||||
|
}, {
|
||||||
title: i18nc("@title", "Forward Message"),
|
title: i18nc("@title", "Forward Message"),
|
||||||
width: Kirigami.Units.gridUnit * 25
|
width: Kirigami.Units.gridUnit * 25
|
||||||
})
|
})
|
||||||
page.chosen.connect(function(targetRoomId) {
|
page.chosen.connect(function(targetRoomId) {
|
||||||
Controller.activeConnection.room(targetRoomId).postHtmlMessage(root.plainText, root.htmlText ? root.htmlText : root.plainText)
|
root.connection.room(targetRoomId).postHtmlMessage(root.plainText, root.htmlText ? root.htmlText : root.plainText)
|
||||||
page.closeDialog()
|
page.closeDialog()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ Kirigami.ScrollablePage {
|
|||||||
|
|
||||||
signal chosen(string roomId)
|
signal chosen(string roomId)
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
header: Kirigami.SearchField {
|
header: Kirigami.SearchField {
|
||||||
onTextChanged: sortModel.filterText = text
|
onTextChanged: sortModel.filterText = text
|
||||||
}
|
}
|
||||||
@@ -25,7 +27,7 @@ Kirigami.ScrollablePage {
|
|||||||
model: SortFilterRoomListModel {
|
model: SortFilterRoomListModel {
|
||||||
id: sortModel
|
id: sortModel
|
||||||
sourceModel: RoomListModel {
|
sourceModel: RoomListModel {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delegate: RoomDelegate {
|
delegate: RoomDelegate {
|
||||||
@@ -34,6 +36,7 @@ Kirigami.ScrollablePage {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
root.chosen(roomDelegate.currentRoom.id)
|
root.chosen(roomDelegate.currentRoom.id)
|
||||||
}
|
}
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ FormCard.FormCardPage {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NeoChatRoom room
|
property NeoChatRoom room
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
title: i18n("Developer Tools")
|
title: i18n("Developer Tools")
|
||||||
|
|
||||||
@@ -37,7 +38,10 @@ FormCard.FormCardPage {
|
|||||||
|
|
||||||
RoomData {
|
RoomData {
|
||||||
room: root.room
|
room: root.room
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
|
ServerData {
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
ServerData {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,6 @@ Kirigami.ScrollablePage {
|
|||||||
publicRoomListModel.next();
|
publicRoomListModel.next();
|
||||||
}
|
}
|
||||||
delegate: ExplorerDelegate {
|
delegate: ExplorerDelegate {
|
||||||
connection: root.connection
|
|
||||||
onRoomSelected: (roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
onRoomSelected: (roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
||||||
root.roomSelected(roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined);
|
root.roomSelected(roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined);
|
||||||
root.closeDialog();
|
root.closeDialog();
|
||||||
|
|||||||
@@ -12,13 +12,16 @@ import '../Dialog' as Dialog
|
|||||||
|
|
||||||
QQC2.Menu {
|
QQC2.Menu {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
margins: Kirigami.Units.smallSpacing
|
margins: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Edit this account")
|
text: i18n("Edit this account")
|
||||||
icon.name: "document-edit"
|
icon.name: "document-edit"
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/AccountEditorPage.qml", {
|
onTriggered: pageStack.pushDialogLayer("qrc:/AccountEditorPage.qml", {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Account editor")
|
title: i18n("Account editor")
|
||||||
});
|
});
|
||||||
@@ -28,7 +31,7 @@ QQC2.Menu {
|
|||||||
icon.name: "notifications"
|
icon.name: "notifications"
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
||||||
defaultPage: "notifications",
|
defaultPage: "notifications",
|
||||||
connection: Controller.activeConnection,
|
connection: root.connection,
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Configure")
|
title: i18n("Configure")
|
||||||
});
|
});
|
||||||
@@ -38,7 +41,7 @@ QQC2.Menu {
|
|||||||
icon.name: "computer-symbolic"
|
icon.name: "computer-symbolic"
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
onTriggered: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {
|
||||||
defaultPage: "devices",
|
defaultPage: "devices",
|
||||||
connection: Controller.activeConnection,
|
connection: root.connection,
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Configure")
|
title: i18n("Configure")
|
||||||
})
|
})
|
||||||
@@ -52,7 +55,7 @@ QQC2.Menu {
|
|||||||
Component {
|
Component {
|
||||||
id: confirmLogoutDialogComponent
|
id: confirmLogoutDialogComponent
|
||||||
Dialog.ConfirmLogout {
|
Dialog.ConfirmLogout {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ import org.kde.neochat 1.0
|
|||||||
*/
|
*/
|
||||||
Loader {
|
Loader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NeoChatRoom room
|
property NeoChatRoom room
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
signal closed()
|
signal closed()
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
@@ -116,7 +119,7 @@ Loader {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Room Settings")
|
text: i18n("Room Settings")
|
||||||
icon.name: "configure"
|
icon.name: "configure"
|
||||||
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room}, { title: i18n("Room Settings") })
|
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: connection}, { title: i18n("Room Settings") })
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.MenuSeparator {}
|
QQC2.MenuSeparator {}
|
||||||
@@ -183,7 +186,7 @@ Loader {
|
|||||||
QQC2.ToolButton {
|
QQC2.ToolButton {
|
||||||
icon.name: 'settings-configure'
|
icon.name: 'settings-configure'
|
||||||
onClicked: {
|
onClicked: {
|
||||||
QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room}, { title: i18n("Room Settings") })
|
QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") })
|
||||||
drawer.close()
|
drawer.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ RowLayout {
|
|||||||
text: i18n("Explore rooms")
|
text: i18n("Explore rooms")
|
||||||
icon.name: "compass"
|
icon.name: "compass"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let dialog = pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: Controller.activeConnection}, {title: i18nc("@title", "Explore Rooms")})
|
let dialog = pageStack.pushDialogLayer("qrc:/JoinRoomPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")})
|
||||||
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
||||||
if (isJoined) {
|
if (isJoined) {
|
||||||
RoomManager.enterRoom(Controller.activeConnection.room(roomId))
|
RoomManager.enterRoom(root.connection.room(roomId))
|
||||||
} else {
|
} else {
|
||||||
Controller.joinRoom(roomId)
|
Controller.joinRoom(roomId)
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ RowLayout {
|
|||||||
property Kirigami.Action chatAction: Kirigami.Action {
|
property Kirigami.Action chatAction: Kirigami.Action {
|
||||||
text: i18n("Start a Chat")
|
text: i18n("Start a Chat")
|
||||||
icon.name: "list-add-user"
|
icon.name: "list-add-user"
|
||||||
onTriggered: pageStack.pushDialogLayer("qrc:/StartChatPage.qml", {connection: Controller.activeConnection}, {title: i18nc("@title", "Start a Chat")})
|
onTriggered: pageStack.pushDialogLayer("qrc:/StartChatPage.qml", {connection: root.connection}, {title: i18nc("@title", "Start a Chat")})
|
||||||
}
|
}
|
||||||
property Kirigami.Action roomAction: Kirigami.Action {
|
property Kirigami.Action roomAction: Kirigami.Action {
|
||||||
text: i18n("Create a Room")
|
text: i18n("Create a Room")
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ Kirigami.Page {
|
|||||||
id: spaceDrawer
|
id: spaceDrawer
|
||||||
Layout.preferredWidth: spaceDrawer.enabled ? Kirigami.Units.gridUnit * 3 : 0
|
Layout.preferredWidth: spaceDrawer.enabled ? Kirigami.Units.gridUnit * 3 : 0
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Separator {
|
Kirigami.Separator {
|
||||||
@@ -161,14 +163,14 @@ Kirigami.Page {
|
|||||||
text: sortFilterRoomListModel.filterText.length > 0 ? i18n("Search in room directory") : i18n("Explore rooms")
|
text: sortFilterRoomListModel.filterText.length > 0 ? i18n("Search in room directory") : i18n("Explore rooms")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let dialog = pageStack.layers.push("qrc:/JoinRoomPage.qml", {
|
let dialog = pageStack.layers.push("qrc:/JoinRoomPage.qml", {
|
||||||
connection: Controller.activeConnection,
|
connection: root.connection,
|
||||||
keyword: sortFilterRoomListModel.filterText
|
keyword: sortFilterRoomListModel.filterText
|
||||||
}, {
|
}, {
|
||||||
title: i18nc("@title", "Explore Rooms")
|
title: i18nc("@title", "Explore Rooms")
|
||||||
})
|
})
|
||||||
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
||||||
if (isJoined) {
|
if (isJoined) {
|
||||||
RoomManager.enterRoom(Controller.activeConnection.room(roomId))
|
RoomManager.enterRoom(root.connection.room(roomId))
|
||||||
} else {
|
} else {
|
||||||
Controller.joinRoom(roomId)
|
Controller.joinRoom(roomId)
|
||||||
}
|
}
|
||||||
@@ -265,6 +267,8 @@ Kirigami.Page {
|
|||||||
RoomList.RoomDelegate {
|
RoomList.RoomDelegate {
|
||||||
filterText: sortFilterRoomListModel.filterText
|
filterText: sortFilterRoomListModel.filterText
|
||||||
|
|
||||||
|
connection: root.connection
|
||||||
|
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
|
|
||||||
visible: categoryVisible || filterText.length > 0 || Config.mergeRoomList
|
visible: categoryVisible || filterText.length > 0 || Config.mergeRoomList
|
||||||
@@ -282,6 +286,7 @@ Kirigami.Page {
|
|||||||
footer: UserInfo {
|
footer: UserInfo {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
visible: !root.collapsed
|
visible: !root.collapsed
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ Delegates.RoundedItemDelegate {
|
|||||||
required property int notificationCount
|
required property int notificationCount
|
||||||
required property int highlightCount
|
required property int highlightCount
|
||||||
required property NeoChatRoom currentRoom
|
required property NeoChatRoom currentRoom
|
||||||
|
required property NeoChatConnection connection
|
||||||
required property bool categoryVisible
|
required property bool categoryVisible
|
||||||
required property string filterText
|
required property string filterText
|
||||||
required property string avatar
|
required property string avatar
|
||||||
@@ -138,6 +139,7 @@ Delegates.RoundedItemDelegate {
|
|||||||
const component = Qt.createComponent(Qt.resolvedUrl("./ContextMenu.qml"))
|
const component = Qt.createComponent(Qt.resolvedUrl("./ContextMenu.qml"))
|
||||||
const menu = component.createObject(root, {
|
const menu = component.createObject(root, {
|
||||||
room: root.currentRoom,
|
room: root.currentRoom,
|
||||||
|
connection: root.connection,
|
||||||
});
|
});
|
||||||
if (!Kirigami.Settings.isMobile && !Config.compactRoomList) {
|
if (!Kirigami.Settings.isMobile && !Config.compactRoomList) {
|
||||||
configButton.visible = true;
|
configButton.visible = true;
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ QQC2.Control {
|
|||||||
readonly property real pinnedWidth: Kirigami.Units.gridUnit * 6
|
readonly property real pinnedWidth: Kirigami.Units.gridUnit * 6
|
||||||
property bool drawerEnabled: true
|
property bool drawerEnabled: true
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
leftPadding: 0
|
leftPadding: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
topPadding: 0
|
topPadding: 0
|
||||||
@@ -73,12 +75,12 @@ QQC2.Control {
|
|||||||
Repeater {
|
Repeater {
|
||||||
model: SortFilterSpaceListModel {
|
model: SortFilterSpaceListModel {
|
||||||
sourceModel: RoomListModel {
|
sourceModel: RoomListModel {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
root.enabled = count > 0
|
root.enabled = count > 0
|
||||||
if (!Controller.activeConnection.room(root.selectedSpaceId)) {
|
if (!root.connection.room(root.selectedSpaceId)) {
|
||||||
root.selectedSpaceId = ""
|
root.selectedSpaceId = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +113,8 @@ QQC2.Control {
|
|||||||
|
|
||||||
function createContextMenu(room) {
|
function createContextMenu(room) {
|
||||||
let context = spaceListContextMenu.createObject(root, {
|
let context = spaceListContextMenu.createObject(root, {
|
||||||
room: room
|
room: room,
|
||||||
|
connection: root.connection
|
||||||
});
|
});
|
||||||
context.open()
|
context.open()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ import org.kde.neochat 1.0
|
|||||||
*/
|
*/
|
||||||
Loader {
|
Loader {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NeoChatRoom room
|
property NeoChatRoom room
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
signal closed()
|
signal closed()
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
@@ -41,7 +44,7 @@ Loader {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18nc("'Space' is a matrix space", "Space Settings")
|
text: i18nc("'Space' is a matrix space", "Space Settings")
|
||||||
icon.name: 'settings-configure'
|
icon.name: 'settings-configure'
|
||||||
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room}, { title: i18n("Space Settings") })
|
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: connection}, { title: i18n("Space Settings") })
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.MenuSeparator {}
|
QQC2.MenuSeparator {}
|
||||||
@@ -99,7 +102,7 @@ Loader {
|
|||||||
|
|
||||||
QQC2.ToolButton {
|
QQC2.ToolButton {
|
||||||
icon.name: 'settings-configure'
|
icon.name: 'settings-configure'
|
||||||
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room}, { title: i18n("Space Settings") })
|
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Space Settings") })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.BasicListItem {
|
Kirigami.BasicListItem {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ QQC2.ToolBar {
|
|||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
property var addAccount
|
property var addAccount
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
@@ -126,7 +128,7 @@ QQC2.ToolBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Controller.activeConnection = userDelegate.connection
|
root.connection = userDelegate.connection
|
||||||
if (switchUserButton.checked) {
|
if (switchUserButton.checked) {
|
||||||
switchUserButton.checked = false
|
switchUserButton.checked = false
|
||||||
}
|
}
|
||||||
@@ -164,7 +166,7 @@ QQC2.ToolBar {
|
|||||||
accountMenu.open();
|
accountMenu.open();
|
||||||
} else {
|
} else {
|
||||||
pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/AccountEditorPage.qml'), {
|
pageStack.pushDialogLayer(Qt.resolvedUrl('qrc:/AccountEditorPage.qml'), {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18n("Account editor")
|
title: i18n("Account editor")
|
||||||
});
|
});
|
||||||
@@ -175,10 +177,10 @@ QQC2.ToolBar {
|
|||||||
text: i18n("Edit this account")
|
text: i18n("Edit this account")
|
||||||
|
|
||||||
contentItem: KirigamiComponents.Avatar {
|
contentItem: KirigamiComponents.Avatar {
|
||||||
readonly property string mediaId: Controller.activeConnection.localUser.avatarMediaId
|
readonly property string mediaId: root.connection.localUser.avatarMediaId
|
||||||
|
|
||||||
source: mediaId ? ("image://mxc/" + mediaId) : ""
|
source: mediaId ? ("image://mxc/" + mediaId) : ""
|
||||||
name: Controller.activeConnection.localUser.displayName ?? Controller.activeConnection.localUser.id
|
name: root.connection.localUser.displayName ?? root.connection.localUser.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,13 +189,13 @@ QQC2.ToolBar {
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
id: displayNameLabel
|
id: displayNameLabel
|
||||||
text: Controller.activeConnection.localUser.displayName
|
text: root.connection.localUser.displayName
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
QQC2.Label {
|
QQC2.Label {
|
||||||
text: (Controller.activeConnection.label.length > 0 ? (Controller.activeConnection.label + " ") : "") + Controller.activeConnection.localUser.id
|
text: (root.connection.label.length > 0 ? (root.connection.label + " ") : "") + root.connection.localUser.id
|
||||||
font.pointSize: displayNameLabel.font.pointSize * 0.8
|
font.pointSize: displayNameLabel.font.pointSize * 0.8
|
||||||
opacity: 0.7
|
opacity: 0.7
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
@@ -232,7 +234,7 @@ QQC2.ToolBar {
|
|||||||
}
|
}
|
||||||
QQC2.ToolButton {
|
QQC2.ToolButton {
|
||||||
icon.name: "settings-configure"
|
icon.name: "settings-configure"
|
||||||
onClicked: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {connection: Controller.activeConnection}, { title: i18n("Configure") })
|
onClicked: pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") })
|
||||||
text: i18n("Open Settings")
|
text: i18n("Open Settings")
|
||||||
display: QQC2.AbstractButton.IconOnly
|
display: QQC2.AbstractButton.IconOnly
|
||||||
Layout.minimumWidth: Layout.preferredWidth
|
Layout.minimumWidth: Layout.preferredWidth
|
||||||
@@ -249,6 +251,7 @@ QQC2.ToolBar {
|
|||||||
AccountMenu {
|
AccountMenu {
|
||||||
id: accountMenu
|
id: accountMenu
|
||||||
y: -height
|
y: -height
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ Kirigami.Page {
|
|||||||
|
|
||||||
/// Not readonly because of the separate window view.
|
/// Not readonly because of the separate window view.
|
||||||
property NeoChatRoom currentRoom: RoomManager.currentRoom
|
property NeoChatRoom currentRoom: RoomManager.currentRoom
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
property bool loading: !root.currentRoom || (root.currentRoom.timelineSize === 0 && !root.currentRoom.allHistoryLoaded)
|
property bool loading: !root.currentRoom || (root.currentRoom.timelineSize === 0 && !root.currentRoom.allHistoryLoaded)
|
||||||
|
|
||||||
/// Disable cancel shortcut. Used by the separate window since it provides its own cancel implementation.
|
/// Disable cancel shortcut. Used by the separate window since it provides its own cancel implementation.
|
||||||
@@ -109,6 +111,7 @@ Kirigami.Page {
|
|||||||
id: chatBox
|
id: chatBox
|
||||||
width: parent.width
|
width: parent.width
|
||||||
currentRoom: root.currentRoom
|
currentRoom: root.currentRoom
|
||||||
|
connection: root.connection
|
||||||
onMessageSent: {
|
onMessageSent: {
|
||||||
if (!timelineViewLoader.item.atYEnd) {
|
if (!timelineViewLoader.item.atYEnd) {
|
||||||
timelineViewLoader.item.goToLastMessage();
|
timelineViewLoader.item.goToLastMessage();
|
||||||
@@ -153,7 +156,7 @@ Kirigami.Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Controller.activeConnection
|
target: root.connection
|
||||||
function onJoinedRoom(room, invited) {
|
function onJoinedRoom(room, invited) {
|
||||||
if(root.currentRoom.id === invited.id) {
|
if(root.currentRoom.id === invited.id) {
|
||||||
RoomManager.enterRoom(room);
|
RoomManager.enterRoom(room);
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ Kirigami.ApplicationWindow {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property NeoChatRoom currentRoom
|
required property NeoChatRoom currentRoom
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
minimumWidth: Kirigami.Units.gridUnit * 10
|
minimumWidth: Kirigami.Units.gridUnit * 10
|
||||||
minimumHeight: Kirigami.Units.gridUnit * 15
|
minimumHeight: Kirigami.Units.gridUnit * 15
|
||||||
|
|
||||||
@@ -24,6 +26,7 @@ Kirigami.ApplicationWindow {
|
|||||||
visible: true
|
visible: true
|
||||||
currentRoom: root.currentRoom
|
currentRoom: root.currentRoom
|
||||||
disableCancelShortcut: true
|
disableCancelShortcut: true
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentRoomChanged: if (!currentRoom) {
|
onCurrentRoomChanged: if (!currentRoom) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Kirigami.ScrollablePage {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NeoChatRoom currentRoom
|
property NeoChatRoom currentRoom
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
title: i18nc("@action:title", "Search Messages")
|
title: i18nc("@action:title", "Search Messages")
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ Kirigami.ScrollablePage {
|
|||||||
|
|
||||||
SearchModel {
|
SearchModel {
|
||||||
id: searchModel
|
id: searchModel
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
searchText: searchField.text
|
searchText: searchField.text
|
||||||
room: root.currentRoom
|
room: root.currentRoom
|
||||||
}
|
}
|
||||||
@@ -71,6 +72,8 @@ Kirigami.ScrollablePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model: searchModel
|
model: searchModel
|
||||||
delegate: EventDelegate {}
|
delegate: EventDelegate {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import org.kde.neochat 1.0
|
|||||||
|
|
||||||
Kirigami.OverlayDrawer {
|
Kirigami.OverlayDrawer {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property NeoChatRoom room: RoomManager.currentRoom
|
readonly property NeoChatRoom room: RoomManager.currentRoom
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
width: actualWidth
|
width: actualWidth
|
||||||
|
|
||||||
@@ -98,7 +100,7 @@ Kirigami.OverlayDrawer {
|
|||||||
text: i18n("Room settings")
|
text: i18n("Room settings")
|
||||||
display: QQC2.AbstractButton.IconOnly
|
display: QQC2.AbstractButton.IconOnly
|
||||||
|
|
||||||
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room}, { title: i18n("Room Settings") })
|
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") })
|
||||||
|
|
||||||
QQC2.ToolTip.text: text
|
QQC2.ToolTip.text: text
|
||||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
@@ -118,6 +120,7 @@ Kirigami.OverlayDrawer {
|
|||||||
id: roomInformation
|
id: roomInformation
|
||||||
RoomInformation {
|
RoomInformation {
|
||||||
room: root.room
|
room: root.room
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +128,7 @@ Kirigami.OverlayDrawer {
|
|||||||
id: roomMedia
|
id: roomMedia
|
||||||
RoomMedia {
|
RoomMedia {
|
||||||
currentRoom: root.room
|
currentRoom: root.room
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Kirigami.Page {
|
|||||||
* @brief The current room that user is viewing.
|
* @brief The current room that user is viewing.
|
||||||
*/
|
*/
|
||||||
readonly property NeoChatRoom room: RoomManager.currentRoom
|
readonly property NeoChatRoom room: RoomManager.currentRoom
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
title: drawerItemLoader.item ? drawerItemLoader.item.title : ""
|
title: drawerItemLoader.item ? drawerItemLoader.item.title : ""
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ Kirigami.Page {
|
|||||||
displayHint: Kirigami.DisplayHint.IconOnly
|
displayHint: Kirigami.DisplayHint.IconOnly
|
||||||
text: i18n("Settings")
|
text: i18n("Settings")
|
||||||
icon.name: "settings-configure"
|
icon.name: "settings-configure"
|
||||||
onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/Categories.qml', {room: root.room}, { title: i18n("Room Settings") })
|
onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/Categories.qml', {room: root.room, connection: root.connection}, { title: i18n("Room Settings") })
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@ Kirigami.Page {
|
|||||||
id: roomInformation
|
id: roomInformation
|
||||||
RoomInformation {
|
RoomInformation {
|
||||||
room: root.room
|
room: root.room
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +67,7 @@ Kirigami.Page {
|
|||||||
id: roomMedia
|
id: roomMedia
|
||||||
RoomMedia {
|
RoomMedia {
|
||||||
currentRoom: root.room
|
currentRoom: root.room
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ QQC2.ScrollView {
|
|||||||
*/
|
*/
|
||||||
required property NeoChatRoom room
|
required property NeoChatRoom room
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The title that should be displayed for this component if available.
|
* @brief The title that should be displayed for this component if available.
|
||||||
*/
|
*/
|
||||||
@@ -77,7 +79,7 @@ QQC2.ScrollView {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
applicationWindow().pageStack.pushDialogLayer("qrc:/DevtoolsPage.qml", {room: root.room}, {title: i18n("Developer Tools")})
|
applicationWindow().pageStack.pushDialogLayer("qrc:/DevtoolsPage.qml", {room: root.room, connection: root.connection}, {title: i18n("Developer Tools")})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +93,8 @@ QQC2.ScrollView {
|
|||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pageStack.pushDialogLayer("qrc:/SearchPage.qml", {
|
pageStack.pushDialogLayer("qrc:/SearchPage.qml", {
|
||||||
currentRoom: root.room
|
currentRoom: root.room,
|
||||||
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18nc("@action:title", "Search")
|
title: i18nc("@action:title", "Search")
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ QQC2.ScrollView {
|
|||||||
*/
|
*/
|
||||||
required property NeoChatRoom currentRoom
|
required property NeoChatRoom currentRoom
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
|
// HACK: Hide unnecessary horizontal scrollbar (https://bugreports.qt.io/browse/QTBUG-83890)
|
||||||
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
||||||
|
|
||||||
@@ -54,6 +56,7 @@ QQC2.ScrollView {
|
|||||||
alwaysShowAuthor: true
|
alwaysShowAuthor: true
|
||||||
alwaysMaxWidth: true
|
alwaysMaxWidth: true
|
||||||
cardBackground: false
|
cardBackground: false
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +66,7 @@ QQC2.ScrollView {
|
|||||||
alwaysShowAuthor: true
|
alwaysShowAuthor: true
|
||||||
alwaysMaxWidth: true
|
alwaysMaxWidth: true
|
||||||
cardBackground: false
|
cardBackground: false
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ import org.kde.neochat 1.0
|
|||||||
|
|
||||||
KirigamiSettings.CategorizedSettings {
|
KirigamiSettings.CategorizedSettings {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NeoChatRoom room
|
property NeoChatRoom room
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
objectName: "settingsPage"
|
objectName: "settingsPage"
|
||||||
actions: [
|
actions: [
|
||||||
@@ -21,7 +23,8 @@ KirigamiSettings.CategorizedSettings {
|
|||||||
page: Qt.resolvedUrl("General.qml")
|
page: Qt.resolvedUrl("General.qml")
|
||||||
initialProperties: {
|
initialProperties: {
|
||||||
return {
|
return {
|
||||||
room: root.room
|
room: root.room,
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ FormCard.FormCardPage {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property NeoChatRoom room
|
property NeoChatRoom room
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
title: i18n("General")
|
title: i18n("General")
|
||||||
|
|
||||||
@@ -287,7 +288,7 @@ FormCard.FormCardPage {
|
|||||||
actions: Kirigami.Action {
|
actions: Kirigami.Action {
|
||||||
text: i18n("See older messages…")
|
text: i18n("See older messages…")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
RoomManager.enterRoom(Controller.activeConnection.room(room.predecessorId));
|
RoomManager.enterRoom(root.connection.room(room.predecessorId));
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,7 +302,7 @@ FormCard.FormCardPage {
|
|||||||
actions: Kirigami.Action {
|
actions: Kirigami.Action {
|
||||||
text: i18n("See new room…")
|
text: i18n("See new room…")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
RoomManager.enterRoom(Controller.activeConnection.room(room.successorId));
|
RoomManager.enterRoom(root.connection.room(room.successorId));
|
||||||
root.close();
|
root.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ FormCard.FormCardPage {
|
|||||||
|
|
||||||
FormCard.AbstractFormDelegate {
|
FormCard.AbstractFormDelegate {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: Controller.activeConnection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device
|
visible: root.connection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device
|
||||||
contentItem: Kirigami.LoadingPlaceholder { }
|
contentItem: Kirigami.LoadingPlaceholder { }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ FormCard.FormCardPage {
|
|||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: i18n("Please login to view the signed-in devices for your account.")
|
text: i18n("Please login to view the signed-in devices for your account.")
|
||||||
type: Kirigami.MessageType.Information
|
type: Kirigami.MessageType.Information
|
||||||
visible: !Controller.activeConnection
|
visible: !root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
property Kirigami.OverlaySheet passwordSheet: Kirigami.OverlaySheet {
|
property Kirigami.OverlaySheet passwordSheet: Kirigami.OverlaySheet {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ FormCard.FormCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property var emoticonType
|
property var emoticonType
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
Flow {
|
Flow {
|
||||||
id: stickerFlow
|
id: stickerFlow
|
||||||
@@ -28,7 +29,7 @@ FormCard.FormCard {
|
|||||||
id: emoticonFilterModel
|
id: emoticonFilterModel
|
||||||
sourceModel: AccountEmoticonModel {
|
sourceModel: AccountEmoticonModel {
|
||||||
id: stickerModel
|
id: stickerModel
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
showStickers: root.emoticonType === EmoticonFormCard.Stickers
|
showStickers: root.emoticonType === EmoticonFormCard.Stickers
|
||||||
showEmojis: root.emoticonType === EmoticonFormCard.Emojis
|
showEmojis: root.emoticonType === EmoticonFormCard.Emojis
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import org.kde.neochat 1.0
|
|||||||
FormCard.FormCardPage {
|
FormCard.FormCardPage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
title: i18nc("@title", "Stickers & Emojis")
|
title: i18nc("@title", "Stickers & Emojis")
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
@@ -18,6 +20,7 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
EmoticonFormCard {
|
EmoticonFormCard {
|
||||||
emoticonType: EmoticonFormCard.Emojis
|
emoticonType: EmoticonFormCard.Emojis
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormHeader {
|
FormCard.FormHeader {
|
||||||
@@ -25,6 +28,7 @@ FormCard.FormCardPage {
|
|||||||
}
|
}
|
||||||
EmoticonFormCard {
|
EmoticonFormCard {
|
||||||
emoticonType: EmoticonFormCard.Stickers
|
emoticonType: EmoticonFormCard.Stickers
|
||||||
|
connection: root.connection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ KirigamiSettings.CategorizedSettings {
|
|||||||
text: i18n("Stickers & Emojis")
|
text: i18n("Stickers & Emojis")
|
||||||
icon.name: "preferences-desktop-emoticons"
|
icon.name: "preferences-desktop-emoticons"
|
||||||
page: Qt.resolvedUrl("EmoticonsPage.qml")
|
page: Qt.resolvedUrl("EmoticonsPage.qml")
|
||||||
|
initialProperties: {
|
||||||
|
return {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
KirigamiSettings.SettingAction {
|
KirigamiSettings.SettingAction {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
property RoomPage roomPage
|
property RoomPage roomPage
|
||||||
|
|
||||||
|
property NeoChatConnection connection: Controller.activeConnection
|
||||||
|
|
||||||
minimumWidth: Kirigami.Units.gridUnit * 20
|
minimumWidth: Kirigami.Units.gridUnit * 20
|
||||||
minimumHeight: Kirigami.Units.gridUnit * 15
|
minimumHeight: Kirigami.Units.gridUnit * 15
|
||||||
|
|
||||||
@@ -47,7 +49,9 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: Kirigami.Settings.hasPlatformMenuBar && !Kirigami.Settings.isMobile
|
active: Kirigami.Settings.hasPlatformMenuBar && !Kirigami.Settings.isMobile
|
||||||
source: Qt.resolvedUrl("qrc:/GlobalMenu.qml")
|
sourceComponent: GlobalMenu {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This timer allows to batch update the window size change to reduce
|
// This timer allows to batch update the window size change to reduce
|
||||||
@@ -76,14 +80,16 @@ Kirigami.ApplicationWindow {
|
|||||||
Loader {
|
Loader {
|
||||||
id: quickView
|
id: quickView
|
||||||
active: !Kirigami.Settings.isMobile
|
active: !Kirigami.Settings.isMobile
|
||||||
sourceComponent: QuickSwitcher { }
|
sourceComponent: QuickSwitcher {
|
||||||
|
connection: root.connection
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: RoomManager
|
target: RoomManager
|
||||||
|
|
||||||
function onPushRoom(room, event) {
|
function onPushRoom(room, event) {
|
||||||
root.roomPage = pageStack.push("qrc:/RoomPage.qml");
|
root.roomPage = pageStack.push("qrc:/RoomPage.qml", {connection: root.connection});
|
||||||
root.roomPage.forceActiveFocus();
|
root.roomPage.forceActiveFocus();
|
||||||
if (event.length > 0) {
|
if (event.length > 0) {
|
||||||
roomPage.goToEvent(event);
|
roomPage.goToEvent(event);
|
||||||
@@ -107,7 +113,7 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onOpenRoomInNewWindow(room) {
|
function onOpenRoomInNewWindow(room) {
|
||||||
const secondaryWindow = roomWindow.createObject(undefined, {currentRoom: room});
|
const secondaryWindow = roomWindow.createObject(undefined, {currentRoom: room, connection: root.connection});
|
||||||
secondaryWindow.width = root.width - pageStack.get(0).width;
|
secondaryWindow.width = root.width - pageStack.get(0).width;
|
||||||
secondaryWindow.show();
|
secondaryWindow.show();
|
||||||
}
|
}
|
||||||
@@ -128,7 +134,9 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openRoomDrawer() {
|
function openRoomDrawer() {
|
||||||
pageStack.push("qrc:/RoomDrawerPage.qml")
|
pageStack.push("qrc:/RoomDrawerPage.qml", {
|
||||||
|
connection: root.connection
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
contextDrawer: RoomDrawer {
|
contextDrawer: RoomDrawer {
|
||||||
@@ -138,6 +146,8 @@ Kirigami.ApplicationWindow {
|
|||||||
// It is used to ensure that user choice is remembered when changing pages and expanding and contracting the window width
|
// It is used to ensure that user choice is remembered when changing pages and expanding and contracting the window width
|
||||||
property bool drawerUserState: Config.autoRoomInfoDrawer
|
property bool drawerUserState: Config.autoRoomInfoDrawer
|
||||||
|
|
||||||
|
connection: root.connection
|
||||||
|
|
||||||
// Connect to the onClicked function of the RoomDrawer handle button
|
// Connect to the onClicked function of the RoomDrawer handle button
|
||||||
Connections {
|
Connections {
|
||||||
target: contextDrawer.handle.children[0]
|
target: contextDrawer.handle.children[0]
|
||||||
@@ -190,7 +200,7 @@ Kirigami.ApplicationWindow {
|
|||||||
RoomList.Page {
|
RoomList.Page {
|
||||||
id: roomList
|
id: roomList
|
||||||
|
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequences: ["Ctrl+PgUp", "Ctrl+Backtab", "Alt+Up"]
|
sequences: ["Ctrl+PgUp", "Ctrl+Backtab", "Alt+Up"]
|
||||||
@@ -280,10 +290,10 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Controller.activeConnection
|
target: root.connection
|
||||||
|
|
||||||
function onDirectChatAvailable(directChat) {
|
function onDirectChatAvailable(directChat) {
|
||||||
RoomManager.enterRoom(Controller.activeConnection.room(directChat.id));
|
RoomManager.enterRoom(root.connection.room(directChat.id));
|
||||||
}
|
}
|
||||||
function onNewKeyVerificationSession(session) {
|
function onNewKeyVerificationSession(session) {
|
||||||
applicationWindow().pageStack.pushDialogLayer(keyVerificationDialogComponent, {
|
applicationWindow().pageStack.pushDialogLayer(keyVerificationDialogComponent, {
|
||||||
@@ -321,14 +331,14 @@ Kirigami.ApplicationWindow {
|
|||||||
id: createRoomDialog
|
id: createRoomDialog
|
||||||
|
|
||||||
CreateRoomDialog {
|
CreateRoomDialog {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: createSpaceDialog
|
id: createSpaceDialog
|
||||||
CreateSpaceDialog {
|
CreateSpaceDialog {
|
||||||
connection: Controller.activeConnection
|
connection: root.connection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +392,7 @@ Kirigami.ApplicationWindow {
|
|||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: "Ctrl+Shift+,"
|
sequence: "Ctrl+Shift+,"
|
||||||
onActivated: {
|
onActivated: {
|
||||||
pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {connection: Controller.activeConnection}, { title: i18n("Configure") })
|
pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user