From 30b7b935585addf5c2b651e117cbf69faa08b24d Mon Sep 17 00:00:00 2001 From: swetayadav1 Date: Wed, 20 Mar 2024 14:46:30 +0530 Subject: [PATCH] NXDRIVE-2912: Display Drive notification for document review --- nxdrive/data/qml/Systray.qml | 21 +++++++++++++++++++++ nxdrive/gui/api.py | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/nxdrive/data/qml/Systray.qml b/nxdrive/data/qml/Systray.qml index 804a611dee..c1907455cf 100755 --- a/nxdrive/data/qml/Systray.qml +++ b/nxdrive/data/qml/Systray.qml @@ -376,6 +376,27 @@ Rectangle { } ] } + + // Pending Tasks + SystrayStatus { + id: pendingTasks + state: "pending_tasks" + visible: (state == "pending_tasks") + color: progressFilledLight + textColor: lightTheme + icon: MdiFont.Icon.bell + + states: [ + State { + name: "pending_tasks" + PropertyChanges { + target: updateState + text: qsTr("PENDING_DOCUMENT_REVIEWS").arg(api.fetch_pending_tasks(accountSelect.getRole("uid"))) + tl.tr + // onClicked: updatePopup.open() + } + } + ] + } } // Different systray contents when there is no accounts diff --git a/nxdrive/gui/api.py b/nxdrive/gui/api.py index 0a88cee734..c445a527e9 100644 --- a/nxdrive/gui/api.py +++ b/nxdrive/gui/api.py @@ -236,6 +236,15 @@ def get_completed_sessions_count(self, uid: str, /) -> int: ) return 0 + @pyqtSlot(str, result=int) + def fetch_pending_tasks(self, uid: str, /) -> str: + """Return pending tasks count for Drive notification.""" + """engine = self._manager.engines.get(uid) + if engine: + workflow = self.application.workflow + workflow.get_pending_tasks(uid, engine)""" + return 2 + @pyqtSlot(str, str, int, float, bool) def pause_transfer( self,