diff --git a/src/apps/qml/ActiveChat.qml b/src/apps/qml/ActiveChat.qml index 3954650f..f6dd5c51 100644 --- a/src/apps/qml/ActiveChat.qml +++ b/src/apps/qml/ActiveChat.qml @@ -1,162 +1,167 @@ /* Copyright (c) 2017-2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import org.kde.kirigami 2.7 as Kirigami ListView { id: activeChat clip: true signal openDirectChannel(string userName) signal openChannel(string channel) signal jitsiCallConfActivated() signal deleteMessage(string messageId) signal reportMessage(string messageId) signal downloadAttachment(string url) signal editMessage(string messageId, string messageStr) signal copyMessage(string messageId, string messageStr) signal replyMessage(string messageId) signal setFavoriteMessage(string messageId, bool starred) signal displayImage(url imageUrl, string title, bool isAnimatedImage) signal deleteReaction(string messageId, string emoji) signal addReaction(string messageId, string emoji) signal ignoreUser(string userId, bool ignored) signal pinMessage(string messageId, bool pinned) signal createDiscussion(string messageId) signal openDiscussion(string discussionRoomId) signal openThread(string threadMessageId) + signal replyInThread(string messageId) property QtObject rcAccount property string roomId: "" property bool enableEditingMode: false spacing: Kirigami.Units.smallSpacing highlightRangeMode: ListView.ApplyRange preferredHighlightBegin: currentItem === null ? parent.height : parent.height - currentItem.height preferredHighlightEnd: parent.height onCountChanged: { //if (atYEnd) { currentIndex = count - 1 //} } Component.onCompleted: positionViewAtEnd() visible: count > 0 onDragEnded : { if (roomId !== "") { rcAccount.loadHistory(roomId) } } delegate: FancyMessageDelegate { anchors.left: parent.left anchors.right: parent.right anchors.rightMargin: Kirigami.Units.largeSpacing anchors.leftMargin: Kirigami.Units.largeSpacing i_originalMessage: originalMessage i_messageText: messageConverted i_username: username i_usernameurl: usernameurl i_aliasname: alias i_systemMessageType: type i_timestamp: timestamp i_messageID: messageID i_messageType: messagetype i_avatar: avatar == "" ? rcAccount.avatarUrl(userID) : avatar i_urls: urls i_attachments: attachments i_reactions: reactions i_roles: roles i_date: date i_own_username: rcAccount.userName i_can_editing_message: canEditingMessage i_starred: starred i_pinned: pinned i_editedByUserName: editedByUsername i_user_ignored: userIsIgnored i_dcount: discussionCount i_drid: discussionRoomId i_tcount: threadCount i_tmid: threadMessageId i_groupable: groupable onOpenChannel: { activeChat.openChannel(channel) } onPinMessage: { activeChat.pinMessage(messageId, pinned) } onOpenDirectChannel: { if (rcAccount.userName !== userName) { activeChat.openDirectChannel(userName) } } onJitsiCallConfActivated: { activeChat.jitsiCallConfActivated() } onDeleteMessage: { activeChat.deleteMessage(messageId) } onReportMessage: { activeChat.reportMessage(messageId) } onDownloadAttachment: { activeChat.downloadAttachment(url) } onEditMessage: { activeChat.editMessage(messageId, messageStr) } onCopyMessage: { activeChat.copyMessage(messageId, messageStr) } onReplyMessage: { activeChat.replyMessage(messageId) } onSetFavoriteMessage: { activeChat.setFavoriteMessage(messageId, starred) } onDisplayImage: { activeChat.displayImage(imageUrl, title, isAnimatedImage) } onDeleteReaction: { activeChat.deleteReaction(messageId, emoji) } onAddReaction: { activeChat.addReaction(messageId, emoji) } onIgnoreUser: { activeChat.ignoreUser(userID, ignored) } onCreateDiscussion: { activeChat.createDiscussion(messageId) } onOpenDiscussion: { activeChat.openDiscussion(discussionRoomId) } onOpenThread: { activeChat.openThread(threadMessageId) } + onReplyInThread: { + activeChat.replyInThread(messageId) + console.log("Reply in thread " + messageId) + } } } diff --git a/src/apps/qml/FancyMessageDelegate.qml b/src/apps/qml/FancyMessageDelegate.qml index 2e536185..1418c5b3 100644 --- a/src/apps/qml/FancyMessageDelegate.qml +++ b/src/apps/qml/FancyMessageDelegate.qml @@ -1,318 +1,323 @@ /* * Copyright 2016 Riccardo Iaconelli * Copyright (c) 2017-2019 Montel Laurent * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.9 import KDE.Ruqola.RuqolaUtils 1.0 import KDE.Ruqola.Message 1.0 import QtQuick.Controls 2.2 import org.kde.kirigami 2.7 as Kirigami import KDE.Ruqola.ExtraColors 1.0 import QtQuick.Layouts 1.12 import KDE.Ruqola.RocketChatAccount 1.0 import KDE.Ruqola.DebugCategory 1.0 Rectangle { id: messageMain property string i_messageID property string i_originalMessage property string i_messageText property string i_username property string i_usernameurl property bool i_systemMessage property string i_systemMessageType property string i_avatar property string i_aliasname property string i_editedByUserName property var i_timestamp property var i_messageType property var i_urls property var i_attachments property var i_reactions property var i_roles property string i_date property string i_own_username property bool i_can_editing_message property bool i_starred property bool i_user_ignored property bool i_pinned property int i_dcount property string i_drid property string i_tmid property int i_tcount property bool i_groupable color: RuqolaSingleton.backgroundColor implicitHeight: 4*Kirigami.Units.smallSpacing + loaded.item.implicitHeight implicitWidth: 150 signal openDirectChannel(string userName) signal openChannel(string channel) signal jitsiCallConfActivated() signal deleteMessage(string messageId) signal reportMessage(string messageId) signal downloadAttachment(string url) signal editMessage(string messageId, string messageStr) signal copyMessage(string messageId, string messageStr) signal replyMessage(string messageId) signal setFavoriteMessage(string messageId, bool starred) signal displayImage(url imageUrl, string title, bool isAnimatedImage) signal deleteReaction(string messageId, string emoji) signal addReaction(string messageId, string emoji) signal ignoreUser(bool ignored) signal pinMessage(string messageId, bool pinned) signal createDiscussion(string messageId) signal openDiscussion(string discussionRoomId) signal openThread(string threadMessageId) + signal replyInThread(string messageId) Loader { id: loaded anchors.fill: parent Component.onCompleted: { if (i_messageType === Message.System) { if (i_systemMessageType === "jitsi_call_started") { console.log(RuqolaDebugCategorySingleton.category, "Jitsi"); setSource("messages/JitsiVideoMessage.qml", { i_messageText: i_messageText, i_username: i_username, i_aliasname: i_aliasname, i_timestamp: i_timestamp, i_systemMessageType: i_systemMessageType, i_messageID: i_messageID, i_avatar: i_avatar, i_date: i_date, rcAccount: appid.rocketChatAccount } ) } else { console.log(RuqolaDebugCategorySingleton.category, "System Message"); setSource("messages/SystemMessage.qml", { i_messageText: i_messageText, i_username: i_username, i_aliasname: i_aliasname, i_timestamp: i_timestamp, i_systemMessageType: i_systemMessageType, i_messageID: i_messageID, i_date: i_date, rcAccount: appid.rocketChatAccount, i_dcount: i_dcount, i_drid: i_drid, i_tcount: i_tcount, i_groupable: i_groupable, i_tmid: i_tmid } ) } } else if (i_messageType === Message.NormalText || i_messageType === Message.File) { console.log(RuqolaDebugCategorySingleton.category, "User Message"); setSource("messages/UserMessage.qml", { i_originalMessage: i_originalMessage, i_messageText: i_messageText, i_username: i_username, i_usernameurl: i_usernameurl, i_aliasname: i_aliasname, i_timestamp: i_timestamp, i_messageID: i_messageID, i_avatar: i_avatar, i_urls: i_urls, i_reactions: i_reactions, i_roles: i_roles, i_attachments: i_attachments, i_date: i_date, i_own_username: i_own_username, rcAccount: appid.rocketChatAccount, i_can_editing_message: i_can_editing_message, i_editedByUserName: i_editedByUserName, i_starred: i_starred, i_pinned: i_pinned, i_user_ignored : i_user_ignored, i_dcount: i_dcount, i_drid: i_drid, i_tcount: i_tcount, i_groupable: i_groupable, i_tmid: i_tmid } ) } else if (i_messageType === Message.Audio) { console.log(RuqolaDebugCategorySingleton.category, "Audio"); setSource("messages/AttachmentMessageAudio.qml", { i_messageText: i_messageText, i_username: i_username, i_usernameurl: i_usernameurl, i_aliasname: i_aliasname, i_timestamp: i_timestamp, i_messageID: i_messageID, i_avatar: i_avatar, i_reactions: i_reactions, i_roles: i_roles, i_urls: i_urls, i_attachments: i_attachments, i_date: i_date, i_editedByUserName: i_editedByUserName, rcAccount: appid.rocketChatAccount, i_editedByUserName: i_editedByUserName, i_starred: i_starred, i_pinned: i_pinned, i_dcount: i_dcount, i_drid: i_drid, i_tcount: i_tcount, i_groupable: i_groupable, i_tmid: i_tmid }) } else if (i_messageType === Message.Video) { console.log(RuqolaDebugCategorySingleton.category, "Video"); setSource("messages/AttachmentMessageVideo.qml", { i_messageText: i_messageText, i_username: i_username, i_usernameurl: i_usernameurl, i_aliasname: i_aliasname, i_timestamp: i_timestamp, i_messageID: i_messageID, i_avatar: i_avatar, i_reactions: i_reactions, i_roles: i_roles, i_urls: i_urls, i_attachments: i_attachments, i_date: i_date, i_editedByUserName: i_editedByUserName, rcAccount: appid.rocketChatAccount, i_editedByUserName: i_editedByUserName, i_starred: i_starred, i_pinned: i_pinned, i_dcount: i_dcount, i_drid: i_drid, i_tcount: i_tcount, i_groupable: i_groupable, i_tmid: i_tmid }) } else if (i_messageType === Message.Image) { console.log(RuqolaDebugCategorySingleton.category, "Image"); setSource("messages/AttachmentMessageImage.qml", { i_messageText: i_messageText, i_username: i_username, i_usernameurl: i_usernameurl, i_aliasname: i_aliasname, i_timestamp: i_timestamp, i_messageID: i_messageID, i_avatar: i_avatar, i_reactions: i_reactions, i_roles: i_roles, i_urls: i_urls, i_attachments: i_attachments, i_date: i_date, i_editedByUserName: i_editedByUserName, rcAccount: appid.rocketChatAccount, i_editedByUserName: i_editedByUserName, i_starred: i_starred, i_pinned: i_pinned, i_dcount: i_dcount, i_drid: i_drid, i_tcount: i_tcount, i_groupable: i_groupable, i_tmid: i_tmid }) } else { console.log(RuqolaDebugCategorySingleton.category, "Unknown message type: " + i_messageType) } } } Connections { target: loaded.item onLinkActivated: { var username = RuqolaUtils.extractRoomUserFromUrl(link); if (link.startsWith("ruqola:/room/")) { messageMain.openChannel(username) } else if (link.startsWith("ruqola:/user/")) { if (username !== appid.rocketChatAccount.userName) { messageMain.openDirectChannel(username) } } else { RuqolaUtils.openUrl(link); } } onJitsiCallConfActivated: { messageMain.jitsiCallConfActivated() } onPinMessage: { messageMain.pinMessage(messageId, pinned) } onReportMessage: { messageMain.reportMessage(messageId) } onDeleteMessage: { messageMain.deleteMessage(messageId) } onDownloadAttachment: { messageMain.downloadAttachment(url) } onEditMessage: { console.log(RuqolaDebugCategorySingleton.category, "i_messageText " + i_messageText); messageMain.editMessage(messageId, messageStr) } onCopyMessage: { console.log(RuqolaDebugCategorySingleton.category, "i_messageText " + i_messageText); messageMain.copyMessage(messageId, messageStr) } onReplyMessage: { messageMain.replyMessage(messageId) } onSetFavoriteMessage: { messageMain.setFavoriteMessage(messageId, starred) } onDisplayImage: { messageMain.displayImage(imageUrl, title, isAnimatedImage) } onDeleteReaction: { messageMain.deleteReaction(messageId, emoji) } onAddReaction: { messageMain.addReaction(messageId, emoji) } onIgnoreUser: { messageMain.ignoreUser(ignored) } onCreateDiscussion: { messageMain.createDiscussion(messageId) } onOpenDiscussion: { messageMain.openDiscussion(discussionRoomId) } onOpenThread: { messageMain.openThread(threadMessageId) } + onReplyInThread: { + console.log("onReplyInThread: { " + messageId) + messageMain.replyInThread(messageId) + } } } diff --git a/src/apps/qml/MainComponent.qml b/src/apps/qml/MainComponent.qml index 70789ddb..decaaf39 100644 --- a/src/apps/qml/MainComponent.qml +++ b/src/apps/qml/MainComponent.qml @@ -1,569 +1,574 @@ /* * Copyright 2016 Riccardo Iaconelli * Copyright (C) 2017-2019 Laurent Montel * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved * by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.9 import QtQuick.Window 2.2 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.12 import QtQuick.Controls 2.5 as QQC2 import KDE.Ruqola.RuqolaUtils 1.0 import KDE.Ruqola.Ruqola 1.0 import KDE.Ruqola.Clipboard 1.0 import KDE.Ruqola.RoomFilterProxyModel 1.0 import org.kde.kirigami 2.7 as Kirigami import KDE.Ruqola.DebugCategory 1.0 import KDE.Ruqola.ReceiveTypingNotificationManager 1.0 import KDE.Ruqola.DebugCategory 1.0 Component { id: mainComponent Kirigami.Page { id: mainWidget title: appid.selectedRoom ? appid.selectedRoom.displayRoomName : "" leftPadding: 0 rightPadding: 0 topPadding: 0 bottomPadding: 0 actions { left: Kirigami.Action { icon.name: "preferences-desktop-notification" icon.color: "transparent" visible: appid.selectedRoom onTriggered: { notificationsDialog.roomInfo = appid.selectedRoom notificationsDialog.initializeAndOpen() } } main: Kirigami.Action { id: showUsersAction icon.name: "system-users" visible: appid.selectedRoom checkable: true } right: Kirigami.Action { icon.name: "edit-find" visible: appid.selectedRoom onTriggered: { searchMessageDialog.roomId = appid.selectedRoomID searchMessageDialog.initializeAndOpen(); } } contextualActions: [ Kirigami.Action { visible: appid.selectedRoom text: i18n("Channel Info") onTriggered: { var channelType = appid.selectedRoom.channelType; if (channelType === "c" || channelType === "p") { //Only for debug // if (channelType === "c") { // appid.rocketChatAccount.channelInfo(appid.selectedRoom.rid); // } else { // appid.rocketChatAccount.groupInfo(appid.selectedRoom.rid); // } //For testing channelInfoDialog.roomInfo = appid.selectedRoom channelInfoDialog.initializeAndOpen() } else if (channelType === "d") { privateChannelInfoDialog.roomInfo = appid.selectedRoom privateChannelInfoDialog.initializeAndOpen() } else { console.log(RuqolaDebugCategorySingleton.category,"channel type " + appid.selectedRoom.channelType) } } }, Kirigami.Action { visible: appid.selectedRoom text: i18n("Mentions") onTriggered: { appid.rocketChatAccount.channelGetAllUserMentions(appid.selectedRoomID); showMentionsInRoomDialog.initializeAndOpen() } }, Kirigami.Action { visible: appid.selectedRoom && appid.rocketChatAccount.discussionEnabled() text: i18n("Discussions") onTriggered: { appid.rocketChatAccount.discussionsInRoom(appid.selectedRoomID); showDiscussionsInRoomDialog.initializeAndOpen() } }, Kirigami.Action { visible: appid.selectedRoom && appid.rocketChatAccount.threadsEnabled() text: i18n("Threads") onTriggered: { appid.rocketChatAccount.threadsInRoom(appid.selectedRoomID); showThreadsInRoomDialog.initializeAndOpen() } }, Kirigami.Action { id: menuVideoChatAction property bool shouldBeVisible: false visible: shouldBeVisible && appid.selectedRoom text: i18n("Video Chat") onTriggered: { appid.rocketChatAccount.createJitsiConfCall(appid.selectedRoomID); } }, Kirigami.Action { text: i18n("Add User In Room") visible: appid.selectedRoom ? appid.selectedRoom.canBeModify : false onTriggered: { var channelType = appid.selectedRoom.channelType; if (channelType === "c" || channelType === "p") { addUserDialog.roomInfo = appid.selectedRoom addUserDialog.roomId = appid.selectedRoomID addUserDialog.initializeAndOpen() } } }, Kirigami.Action { visible: appid.selectedRoom text: i18n("Take a Video Message") onTriggered: { takeVideoMessage.open(); } }, Kirigami.Action { visible: appid.selectedRoom text: i18n("Load Recent History") onTriggered: { appid.rocketChatAccount.loadHistory(appid.selectedRoomID); } }, Kirigami.Action { visible: appid.selectedRoom text: i18n("Show Files Attachment In Room") onTriggered: { appid.rocketChatAccount.roomFiles(appid.selectedRoomID, appid.selectedRoom.channelType); showFilesInRoomDialog.initializeAndOpen() } } ] } onContextualActionsAboutToShow: { menuVideoChatAction.shouldBeVisible = appid.rocketChatAccount.jitsiEnabled() } globalToolBarStyle: Kirigami.ApplicationHeaderStyle.ToolBar titleDelegate: RowLayout { QQC2.ToolButton { icon.name: "favorite" checkable: true visible: appid.selectedRoom && !appid.selectedRoom.isDiscussionRoom Binding on checked { value: appid.selectedRoom && appid.selectedRoom.favorite } onToggled: { appid.rocketChatAccount.changeFavorite(appid.selectedRoomID, checked) } } QQC2.ToolButton { icon.name: "draw-arrow-back" visible: appid.selectedRoom && appid.selectedRoom.isDiscussionRoom onClicked: { appid.switchToRoom(appid.selectedRoom.parentRid) } } Kirigami.Icon { source: "encrypted" //FIXME height: Kirigami.Units.iconSizes.medium width: height visible: appid.selectedRoom && appid.selectedRoom.encrypted } Kirigami.Heading { text: appid.selectedRoom ? appid.selectedRoom.displayRoomName : "" level: 3 font.bold: true } Item { Layout.fillWidth: true } } header: Column { spacing: Kirigami.Units.smallSpacing QQC2.Label { visible: appid.selectedRoom && (appid.selectedRoom.topic !== "") text: appid.selectedRoom ? appid.selectedRoom.topic : "" font.italic: true anchors.right: parent.right anchors.left: parent.left anchors.margins: 2*Kirigami.Units.smallSpacing wrapMode: QQC2.Label.Wrap } QQC2.Label { visible: appid.selectedRoom && (appid.selectedRoom.announcement !== "") text: appid.selectedRoom ? appid.selectedRoom.announcement : "" anchors.right: parent.right anchors.left: parent.left anchors.margins: 2*Kirigami.Units.smallSpacing wrapMode: QQC2.Label.Wrap onLinkActivated: { RuqolaUtils.openUrl(link); } } QQC2.Label { visible: appid.selectedRoom && (appid.selectedRoom.description !== "") text: appid.selectedRoom ? appid.selectedRoom.description : "" font.italic: true anchors.right: parent.right anchors.left: parent.left anchors.margins: 2*Kirigami.Units.smallSpacing wrapMode: QQC2.Label.Wrap } Kirigami.Separator { anchors.right: parent.right anchors.left: parent.left visible: appid.selectedRoom } Flow { id: topBarUserList readonly property bool isActive: showUsersAction.checked anchors { left: parent.left right: parent.right margins: Kirigami.Units.smallSpacing } opacity: topBarUserList.isActive ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 650; easing.type: Easing.InOutQuad } } Repeater { model: parent.opacity > 0.5 ? appid.userModel : 0 RowLayout { Kirigami.Icon { source: model.iconstatus //FIXME height: Kirigami.Units.iconSizes.small width: height } UserMenu { id: userMenu userId: model.userid can_manage_users: appid.selectedRoom.canChangeRoles ownUserId: appid.rocketChatAccount.userID isAdirectChannel: appid.selectedRoom.channelType === "d" onKickUser: { appid.rocketChatAccount.kickUser(appid.selectedRoomID, userId, appid.selectedRoom.channelType) } onChangeRole: { appid.rocketChatAccount.changeRoles(appid.selectedRoomID, userId, appid.selectedRoom.channelType, type) } onIgnoreUser: { //TODO verify ignored //appid.rocketChatAccount.ignoreUser(appid.selectedRoomID, userId, ignored) } onOpenConversation: { //TODO } onAboutToShow: { hasLeaderRole = appid.selectedRoom.userHasLeaderRole(model.userid) hasModeratorRole = appid.selectedRoom.userHasModeratorRole(model.userid) hasOwnerRole = appid.selectedRoom.userHasOwnerRole(model.userid) } } QQC2.Label { text: model.displayname onLinkActivated: { if (model.userid !== appid.rocketChatAccount.userID) { openDirectChannelDialog.username = link; openDirectChannelDialog.open() } } MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton onClicked: { if (mouse.button === Qt.RightButton) { userMenu.x = mouse.x userMenu.y = mouse.y userMenu.open(); } } } } } } Item { width: parent.width height: topBarUserList.isActive ? 1 : 0 Kirigami.Separator { height: parent.height width: height > 0 ? parent.width : 0 anchors.centerIn: parent Behavior on width { NumberAnimation { duration: 650; easing.type: Easing.InOutQuad } } } } } } Clipboard { id: clipboard } ActiveChat { id: activeChat model: appid.messageModel rcAccount: appid.rocketChatAccount roomId: appid.selectedRoomID anchors.fill: parent clip: true QQC2.ScrollBar.vertical: QQC2.ScrollBar { } onPinMessage: { appid.rocketChatAccount.pinMessage(messageId, pinned) } onEditMessage: { userInputMessage.messageId = messageId; userInputMessage.setOriginalMessage(messageStr) //console.log(RuqolaDebugCategorySingleton.category, "edit! messageId : " + messageId + " messageStr " + messageStr) } onCopyMessage: { clipboard.text = messageStr //console.log(RuqolaDebugCategorySingleton.category, "copy! messageId : " + messageId + " messageStr " + messageStr) } onReplyMessage: { console.log(RuqolaDebugCategorySingleton.category, "Not implemented reply message : " + messageId) } onSetFavoriteMessage: { appid.rocketChatAccount.starMessage(messageId, starred) } onIgnoreUser: { appid.rocketChatAccount.ignoreUser(roomId, userId, ignored) } onCreateDiscussion: { createDiscussionDialog.clearAndOpen() createDiscussionDialog.roomName = appid.selectedRoom.displayRoomName createDiscussionDialog.roomId = roomId createDiscussionDialog.messageId = messageId //TODO add message text too } onOpenChannel: { openChannelDialog.channelName = channel openChannelDialog.open() } onOpenDirectChannel: { openDirectChannelDialog.username = userName; openDirectChannelDialog.open() } onJitsiCallConfActivated: { appid.rocketChatAccount.joinJitsiConfCall(roomId) } onReportMessage: { reportMessageDialog.msgId = messageId reportMessageDialog.open(); } onDeleteMessage: { deleteMessageDialog.msgId = messageId deleteMessageDialog.open() } onDownloadAttachment: { downloadFileDialog.fileToSaveUrl = url downloadFileDialog.open() } onDisplayImage: { displayImageDialog.iUrl = imageUrl displayImageDialog.title = title displayImageDialog.isAnimatedImage = isAnimatedImage displayImageDialog.clearScaleAndOpen(); } onDeleteReaction: { appid.rocketChatAccount.reactOnMessage(messageId, emoji, false) } onAddReaction: { appid.rocketChatAccount.reactOnMessage(messageId, emoji, true) } onOpenThread: { console.log("Open thread messageid" + threadMessageId) appid.rocketChatAccount.getThreadMessages(threadMessageId) } onOpenDiscussion: { console.log("Open discussion " + discussionRoomId) appid.switchToRoom(discussionRoomId) } + //Laurent it crashs... +// onReplyInThread: { +// console.log("reply in thread " + messageId) +// } + OpenChannelDialog { id: openChannelDialog onOpenChannel: { appid.rocketChatAccount.openChannel(channelName); } } OpenDirectChannelDialog { id: openDirectChannelDialog onOpenDirectChannel: { if (appid.rocketChatAccount.userName !== userName) { appid.rocketChatAccount.openDirectChannel(userName); } } } CreateDiscussionDialog { id: createDiscussionDialog onCreateNewDiscussion: { appid.rocketChatAccount.createDiscussion(parentRoomName, discussionTitle, replyMessage, msgId); } } ReportMessageDialog { id: reportMessageDialog onReportMessage: { appid.rocketChatAccount.deleteMessage(messageId, message) } } DeleteMessageDialog { id: deleteMessageDialog onDeleteMessage: { appid.rocketChatAccount.deleteMessage(messageId, appid.selectedRoomID) } } DownloadFileDialog { id: downloadFileDialog onAccepted: { if (fileUrl != "") { console.log(RuqolaDebugCategorySingleton.category, "You chose: " + fileUrl) appid.rocketChatAccount.downloadFile(fileToSaveUrl, fileUrl) } else { console.log(RuqolaDebugCategorySingleton.category, "No file selected"); } } } DisplayImageDialog { id: displayImageDialog } UploadFileDialog { id: uploadFileDialog onUploadFile: { appid.rocketChatAccount.uploadFile(appid.selectedRoomID, description, messageText, filename) } } ShowMentionsInRoomDialog { id: showMentionsInRoomDialog mentionsModel: appid.mentionsModel onGoToMessage: { console.log("Go to Message not implemented yet") } } ShowDiscussionsInRoomDialog { id: showDiscussionsInRoomDialog discussionsModel: appid.discussionsModel onOpenDiscussion: { appid.switchToRoom(discussionId) } } ShowThreadsInRoomDialog { id: showThreadsInRoomDialog } ShowFilesInRoomDialog { id: showFilesInRoomDialog filesModel: appid.filesModel onDownloadFile: { downloadFileDialog.fileToSaveUrl = file downloadFileDialog.open() } onDeleteFile: { appid.rocketChatAccount.deleteFileMessage(appid.selectedRoomID, fileid, appid.selectedRoom.channelType) } } } Keys.onEscapePressed: { appid.rocketChatAccount.clearUnreadMessages(appid.selectedRoomID); } footer: QQC2.ToolBar { position: QQC2.ToolBar.Footer visible: appid.selectedRoom ColumnLayout { anchors.fill: parent QQC2.Label { id: channelInfo font.bold: true Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft //FIXME visible: appid.selectedRoom && ((appid.selectedRoom.readOnly === true && !appid.selectedRoom.canChangeRoles) || (appid.selectedRoom.blocker === true) || (appid.selectedRoom.blocked === true)) text: appid.selectedRoom ? appid.selectedRoom.roomMessageInfo : "" } QQC2.Label { id: typingInfo visible: text.length > 0 } UserInput { id: userInputMessage rcAccount: appid.rocketChatAccount visible: appid.selectedRoom && (appid.selectedRoom.readOnly === false) && (appid.selectedRoom.blocker === false) && (appid.selectedRoom.blocked === false) messageLineText: rcAccount.getUserCurrentMessage(appid.selectedRoomID) onTextEditing: { rcAccount.textEditing(appid.selectedRoomID, str) appid.userInputMessageText = str; } onClearUnreadMessages: { rcAccount.clearUnreadMessages(appid.selectedRoomID) } onUploadFile: { uploadFileDialog.initializeAndOpen() } } Connections { target: appid.rocketChatAccount.receiveTypingNotificationManager() onNotificationChanged: { //console.log(RuqolaDebugCategorySingleton.category, "Typing in roomId: " + roomId + " str " + notificationStr); if (appid.selectedRoomID === roomId) { typingInfo.text = notificationStr; } } onClearNotification: { typingInfo.text = ""; } } } } }// mainWidget Item } diff --git a/src/apps/qml/messages/MessageBase.qml b/src/apps/qml/messages/MessageBase.qml index c39a9f25..4a2634ef 100644 --- a/src/apps/qml/messages/MessageBase.qml +++ b/src/apps/qml/messages/MessageBase.qml @@ -1,75 +1,75 @@ /* Copyright (c) 2017-2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import QtQuick.Layouts 1.12 ColumnLayout { signal linkActivated(string link) signal jitsiCallConfActivated() signal deleteMessage(string messageId) signal reportMessage(string messageId) signal copyMessage(string messageId, string messageStr) signal editMessage(string messageId, string messageStr) signal replyMessage(string messageId) signal setFavoriteMessage(string messageId, bool starred) signal downloadAttachment(string url) signal displayImage(url imageUrl, string title, bool isAnimatedImage) signal deleteReaction(string messageId, string emoji) signal addReaction(string messageId, string emoji) signal ignoreUser(bool ignored) signal pinMessage(string messageId, bool pinned) signal createDiscussion(string messageId) signal openDiscussion(string discussionRoomId) signal openThread(string threadMessageId) - + signal replyInThread(string messageId) property string i_date property string i_username property string i_usernameurl property string i_aliasname property string i_avatar property var i_timestamp property string i_messageText property string i_originalMessage property var i_urls property var i_attachments property var i_reactions property var i_roles property string i_editedByUserName property bool i_starred property bool i_can_editing_message property bool i_user_ignored property bool i_pinned property int i_dcount property string i_drid property int i_tcount property string i_tmid property bool i_groupable property QtObject rcAccount NewDateLabel { id: newDateRect date: i_date } } diff --git a/src/apps/qml/messages/MessageMenu.qml b/src/apps/qml/messages/MessageMenu.qml index da5afb33..c2eb7523 100644 --- a/src/apps/qml/messages/MessageMenu.qml +++ b/src/apps/qml/messages/MessageMenu.qml @@ -1,171 +1,171 @@ /* Copyright (c) 2017-2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import org.kde.kirigami 2.7 as Kirigami import QtQuick.Controls 2.5 as QQC2 import QtQuick.Layouts 1.12 import KDE.Ruqola.DebugCategory 1.0 QQC2.Menu { id: menu property bool can_editing_message property bool user_ignored property bool starred property bool pinned_message function updateFavoriteLabelText() { return (starred === true) ? i18n("Remove as Favorite") : i18n("Set as Favorite") } function updateIgnoreLabelText() { return (user_ignored === true) ? i18n("Unignore") : i18n("Ignore") } function updatePinnedMessageLabelText() { return (pinned_message === true) ? i18n("Unpin Message") : i18n("Pin Message") } //Need to hidding them when server is not 1.0.0 QQC2.MenuItem { id: startADiscussionItem visible: rcAccount.discussionEnabled() contentItem: QQC2.Label { text: i18n("Start a Discussion") } onTriggered: { messageMain.createDiscussion(i_messageID); console.log(RuqolaDebugCategorySingleton.category, "Create discussion: messageId: ", i_messageID); } } QQC2.MenuItem { id: startAThreadItem visible: rcAccount.threadsEnabled() contentItem: QQC2.Label { text: i18n("Reply in Thread") } onTriggered: { -// messageMain.copyMessage(i_messageID, i_originalMessage); -// console.log(RuqolaDebugCategorySingleton.category, "Copy", i_messageID, i_originalMessage); + messageMain.replyInThread(i_messageID); + console.log(RuqolaDebugCategorySingleton.category, "Reply in thread ", i_messageID); } } QQC2.MenuItem { id: copyMessageItem contentItem: QQC2.Label { text: i18n("Copy") } onTriggered: { messageMain.copyMessage(i_messageID, i_originalMessage); console.log(RuqolaDebugCategorySingleton.category, "Copy", i_messageID, i_originalMessage); } } QQC2.MenuItem { id: editMessageItem contentItem: QQC2.Label { text: i18n("Edit") } onTriggered: { messageMain.editMessage(i_messageID, i_originalMessage); console.log(RuqolaDebugCategorySingleton.category, "Edit", i_messageID, i_originalMessage); console.log(RuqolaDebugCategorySingleton.category, "User", i_own_username, i_username); } } QQC2.MenuItem { contentItem: QQC2.Label { text: i18n("Reply") } onTriggered: { console.log(RuqolaDebugCategorySingleton.category, "Reply to", i_messageID); messageMain.replyMessage(i_messageID); } } QQC2.MenuItem { id: starredMessageItem contentItem: QQC2.Label { id: favoriteLabel text: updateFavoriteLabelText() } onTriggered: { console.log(RuqolaDebugCategorySingleton.category, "Set as favorite", i_messageID); messageMain.setFavoriteMessage(i_messageID, !starred); } } QQC2.MenuItem { id: pinnedMessageItem contentItem: QQC2.Label { id: pinnedMessageLabel text: updatePinnedMessageLabelText() } onTriggered: { messageMain.pinMessage(i_messageID, !pinned_message); } } QQC2.MenuItem { id: deleteMessageItem visible: i_username === i_own_username && rcAccount.allowMessageDeletingEnabled() contentItem: QQC2.Label { text: i18n("Delete") } onTriggered: { messageMain.deleteMessage(i_messageID); } } QQC2.MenuItem { id: reportMessageItem contentItem: QQC2.Label { text: i18n("Report Message") } onTriggered: { messageMain.reportMessage(i_messageID); } } QQC2.MenuItem { id: ignoreUserItem contentItem: QQC2.Label { id: ignoreLabel text: updateIgnoreLabelText() } onTriggered: { console.log(RuqolaDebugCategorySingleton.category, "Ignore", i_messageID); messageMain.ignoreUser(!user_ignored); } } onAboutToShow: { starredMessageItem.visible = rcAccount.allowMessageStarringEnabled() if (starredMessageItem.visible) { favoriteLabel.text = updateFavoriteLabelText() } pinnedMessageItem.visible = rcAccount.allowMessagePinningEnabled() if (pinnedMessageItem.visible) { pinnedMessageLabel.text = updatePinnedMessageLabelText(); } editMessageItem.visible = (i_username === i_own_username) && rcAccount.allowEditingMessages() && can_editing_message ignoreLabel.text = updateIgnoreLabelText() ignoreUserItem.visible = (i_username != i_own_username) } }