From 3210980a0aa2657b598d57ce1c2c5648b45a333b Mon Sep 17 00:00:00 2001 From: Anindya Roy Date: Fri, 5 Apr 2024 12:32:53 +0530 Subject: [PATCH] NXDRIVE-2912: Display Drive notification for document review --05/04 01 --- nxdrive/data/qml/Systray.qml | 10 +--------- nxdrive/data/qml/SystrayMenu.qml | 9 --------- nxdrive/gui/api.py | 8 ++++---- nxdrive/gui/application.py | 1 - nxdrive/gui/view.py | 2 +- 5 files changed, 6 insertions(+), 24 deletions(-) diff --git a/nxdrive/data/qml/Systray.qml b/nxdrive/data/qml/Systray.qml index 2c3aec5f3c..6644102006 100755 --- a/nxdrive/data/qml/Systray.qml +++ b/nxdrive/data/qml/Systray.qml @@ -37,14 +37,6 @@ Rectangle { } } - Connections { - target: TasksModel - - function onEngineChanged() { - taskState.pendingTasksCount = api.tasks_remaining(accountSelect.getRole("uid")) - } - } - Connections { target: EngineModel @@ -411,8 +403,8 @@ Rectangle { target: taskState text: qsTr("PENDING_DOCUMENT_REVIEWS").arg(pendingTasksCount) + tl.tr onClicked: { + tasks_model.loadList(api.get_Tasks_list(accountSelect.getRole("uid"))) api.open_tasks_window(accountSelect.getRole("uid")) - tasks_model.loadList(api.get_Tasks_list(accountSelect.getRole("uid"))); } } } diff --git a/nxdrive/data/qml/SystrayMenu.qml b/nxdrive/data/qml/SystrayMenu.qml index 98b6aded83..3685bb8685 100755 --- a/nxdrive/data/qml/SystrayMenu.qml +++ b/nxdrive/data/qml/SystrayMenu.qml @@ -15,15 +15,6 @@ ShadowRectangle { id: menuContent spacing: 0 - /*SystrayMenuItem { - text: qsTr("Tasks") - onClicked: { - api.show_tasks() - tasks_model.loadList(); - control.visible = false - } - }*/ - SystrayMenuItem { text: qsTr("SETTINGS") + tl.tr onClicked: { diff --git a/nxdrive/gui/api.py b/nxdrive/gui/api.py index 4d36502e8f..f31d097881 100644 --- a/nxdrive/gui/api.py +++ b/nxdrive/gui/api.py @@ -492,12 +492,12 @@ def get_Tasks_list(self, engine_uid: str, /) -> list: doc_id = task.targetDocumentIds[0]["id"] doc_name = self.get_document_details(engine_uid, doc_id) task.name = doc_name.title - type = task.directive - if "chooseParticipants" in type or "pleaseSelect" in type: + type_of_task = task.directive + if "chooseParticipants" in type_of_task or "pleaseSelect" in type_of_task: task.workflowModelName = Translator.get("CHOOSE_PARTICIPANTS") - elif "give_opinion" in type: + elif "give_opinion" in type_of_task: task.workflowModelName = Translator.get("GIVE_OPINION") - elif "AcceptReject" in type: + elif "AcceptReject" in type_of_task: task.workflowModelName = Translator.get("VALIDATE_DOCUMENT") return tasks_list diff --git a/nxdrive/gui/application.py b/nxdrive/gui/application.py index 936908477a..d40fa5843e 100644 --- a/nxdrive/gui/application.py +++ b/nxdrive/gui/application.py @@ -1873,7 +1873,6 @@ def fetch_pending_tasks(self, engine: Engine, /) -> list: except Exception: log.info("Unable to fetch tasks") tasks = [] - self.tasks_model.loadList(tasks) return tasks def update_status(self, engine: Engine, /) -> None: diff --git a/nxdrive/gui/view.py b/nxdrive/gui/view.py index f4e7c57b40..dafed4f66a 100755 --- a/nxdrive/gui/view.py +++ b/nxdrive/gui/view.py @@ -855,7 +855,7 @@ def get_model(self): model = pyqtProperty(QObject, fget=get_model, constant=True) - @pyqtSlot(list, str) + @pyqtSlot(list) def loadList(self, tasks_list: list, /) -> None: self.taskmodel.clear() for task in tasks_list: