Просмотр исходного кода

Display input once user clicked on Reply.

Signed-off-by: Camila <hello@camila.codes>
Camila 3 лет назад
Родитель
Сommit
0890a78262

+ 11 - 2
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

+ 2 - 1
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

+ 6 - 3
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;
 }
-
-
 }
-

+ 1 - 1
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();