From 0890a78262d89ccdf69ca2541411178e8efa597e Mon Sep 17 00:00:00 2001 From: Camila Date: Thu, 24 Mar 2022 20:17:11 +0100 Subject: [PATCH] Display input once user clicked on Reply. Signed-off-by: Camila --- src/gui/tray/ActivityItem.qml | 13 +++++++++++-- src/gui/tray/ActivityItemContent.qml | 3 ++- src/gui/tray/activitylistmodel.cpp | 9 ++++++--- src/gui/tray/activitylistmodel.h | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml index b9bc78b26..e7bff5fe3 100644 --- a/src/gui/tray/ActivityItem.qml +++ b/src/gui/tray/ActivityItem.qml @@ -15,6 +15,16 @@ MouseArea { property bool isChatActivity: model.objectType === "chat" || model.objectType === "room" || model.objectType === "call" property bool isTalkReplyPossible: model.conversationToken !== "" + property bool displayTalkReplyOptions: false + Connections { + target: activityModel + function onDisplayTalkReplyOptions(activityIndex) { + if (model.index === activityIndex) { + displayTalkReplyOptions = true; + } + } + } + signal fileActivityButtonClicked(string absolutePath) enabled: (model.path !== "" || model.link !== "" || model.isCurrentUserFileActivity === true) @@ -73,13 +83,12 @@ MouseArea { ActivityItemActions { id: activityActions - visible: !root.isFileActivityList && model.linksForActionButtons.length > 0 + visible: !root.isFileActivityList && model.linksForActionButtons.length > 0 && !displayTalkReplyOptions Layout.preferredHeight: Style.trayWindowHeaderHeight * 0.85 Layout.fillWidth: true Layout.leftMargin: 40 Layout.bottomMargin: model.links.length > 1 ? 5 : 0 - Layout.topMargin: isTalkReplyPossible? 48 : 0 displayActions: model.displayActions objectType: model.objectType diff --git a/src/gui/tray/ActivityItemContent.qml b/src/gui/tray/ActivityItemContent.qml index 4d779a524..8c091c324 100644 --- a/src/gui/tray/ActivityItemContent.qml +++ b/src/gui/tray/ActivityItemContent.qml @@ -133,7 +133,8 @@ RowLayout { Loader { id: talkReplyTextFieldLoader - active: isChatActivity && isTalkReplyPossible + active: isChatActivity && isTalkReplyPossible && displayTalkReplyOptions + visible: displayTalkReplyOptions anchors.top: activityTextDateTime.bottom anchors.topMargin: 10 diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index dc5363cfd..c92dfdb7e 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -611,6 +611,12 @@ void ActivityListModel::slotTriggerAction(const int activityIndex, const int act const auto action = activity._links[actionIndex]; + // TODO this will change with https://github.com/nextcloud/desktop/issues/4159 + if (action._verb == "WEB" && action._label == tr("View chat")) { + emit displayTalkReplyOptions(activityIndex); + return; + } + if (action._verb == "WEB") { Utility::openBrowser(QUrl(action._link)); return; @@ -832,7 +838,4 @@ QString ActivityListModel::talkReplyMessageSent(const int activityIndex) const return _finalList[activityIndex]._talkNotificationData.messageSent; } - - } - diff --git a/src/gui/tray/activitylistmodel.h b/src/gui/tray/activitylistmodel.h index 19e54ac9f..f786ba856 100644 --- a/src/gui/tray/activitylistmodel.h +++ b/src/gui/tray/activitylistmodel.h @@ -120,7 +120,7 @@ signals: void activityJobStatusCode(int statusCode); void sendNotificationRequest(const QString &accountName, const QString &link, const QByteArray &verb, int row); void messageSent(); - + void displayTalkReplyOptions(const int activityIndex); protected: void setup();