From: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
Date: Thu, 16 Jan 2020 16:09:34 +0000 (+0100)
Subject: Streamlining local sync notification/activity icons with server ones. Added fileActio...
X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~413^2~18
X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1bc8ec59aa3ab129bbd6ec010db78bb003b8ab5b;p=nextcloud-desktop.git
Streamlining local sync notification/activity icons with server ones. Added fileAction logic for local sync activities
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
---
diff --git a/client.qrc b/client.qrc
index de385dfb2..bb284644a 100644
--- a/client.qrc
+++ b/client.qrc
@@ -30,7 +30,10 @@
resources/copy.svg
resources/state-sync.svg
resources/add.png
+ resources/add-color.svg
resources/state-info.svg
+ resources/change.svg
+ resources/delete-color.svg
diff --git a/resources/add-color.svg b/resources/add-color.svg
new file mode 100644
index 000000000..cb4596ac1
--- /dev/null
+++ b/resources/add-color.svg
@@ -0,0 +1 @@
+
diff --git a/resources/change.svg b/resources/change.svg
new file mode 100644
index 000000000..12071422b
--- /dev/null
+++ b/resources/change.svg
@@ -0,0 +1 @@
+
diff --git a/resources/delete-color.svg b/resources/delete-color.svg
new file mode 100644
index 000000000..72aed6b93
--- /dev/null
+++ b/resources/delete-color.svg
@@ -0,0 +1 @@
+
diff --git a/src/gui/tray/ActivityListModel.cpp b/src/gui/tray/ActivityListModel.cpp
index 88f967f6d..dd724acb0 100644
--- a/src/gui/tray/ActivityListModel.cpp
+++ b/src/gui/tray/ActivityListModel.cpp
@@ -133,7 +133,14 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
} else if (a._status == SyncFileItem::FileIgnored) {
return "qrc:///client/theme/black/state-info.svg";
} else {
- return "qrc:///client/theme/black/state-sync.svg";
+ // File sync successful
+ if (a._fileAction == "file_created") {
+ return "qrc:///client/resources/add-color.svg";
+ } else if (a._fileAction == "file_deleted") {
+ return "qrc:///client/resources/delete-color.svg";
+ } else {
+ return "qrc:///client/resources/change.svg";
+ }
}
} else {
// We have an activity
@@ -209,7 +216,6 @@ void ActivityListModel::startFetchJob()
if (!_accountState->isConnected()) {
return;
}
- //JsonApiJob *job = new JsonApiJob(_accountState->account(), QLatin1String("ocs/v2.php/cloud/activity"), this);
JsonApiJob *job = new JsonApiJob(_accountState->account(), QLatin1String("ocs/v2.php/apps/activity/api/v2/activity"), this);
QObject::connect(job, &JsonApiJob::jsonReceived,
this, &ActivityListModel::slotActivitiesReceived);
diff --git a/src/gui/tray/UserModel.cpp b/src/gui/tray/UserModel.cpp
index ae9b42653..c0163876c 100644
--- a/src/gui/tray/UserModel.cpp
+++ b/src/gui/tray/UserModel.cpp
@@ -341,11 +341,32 @@ void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
activity._accName = folderInstance->accountState()->account()->displayName();
activity._file = item->_file;
activity._folder = folder;
+ activity._fileAction = "";
+
+ if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
+ activity._fileAction = "file_deleted";
+ } else if (item->_instruction == CSYNC_INSTRUCTION_NEW) {
+ activity._fileAction = "file_created";
+ } else if (item->_instruction == CSYNC_INSTRUCTION_RENAME) {
+ activity._fileAction = "file_renamed";
+ } else {
+ activity._fileAction = "file_changed";
+ }
+
if (item->_status == SyncFileItem::NoStatus || item->_status == SyncFileItem::Success) {
qCWarning(lcActivity) << "Item " << item->_file << " retrieved successfully.";
- activity._message.prepend(" ");
- activity._message.prepend(tr("Synced"));
+
+ if (activity._fileAction == "file_renamed") {
+ activity._message.prepend(tr("You renamed") + " ");
+ } else if (activity._fileAction == "file_deleted") {
+ activity._message.prepend(tr("You deleted") + " ");
+ } else if (activity._fileAction == "file_created") {
+ activity._message.prepend(tr("You created") + " ");
+ } else {
+ activity._message.prepend(tr("You changed") + " ");
+ }
+
_activityModel->addSyncFileItemToActivityList(activity);
} else {
qCWarning(lcActivity) << "Item " << item->_file << " retrieved resulted in error " << item->_errorString;