Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>2020-01-16 19:09:34 +0300
committerDominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>2020-01-16 19:09:34 +0300
commit1bc8ec59aa3ab129bbd6ec010db78bb003b8ab5b (patch)
tree686ff129c534dae667b753623a88171808e42a2c
parentb9a350e201e4d69e7ae832158977f1c260465b64 (diff)
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>
-rw-r--r--client.qrc3
-rw-r--r--resources/add-color.svg1
-rw-r--r--resources/change.svg1
-rw-r--r--resources/delete-color.svg1
-rw-r--r--src/gui/tray/ActivityListModel.cpp10
-rw-r--r--src/gui/tray/UserModel.cpp25
6 files changed, 37 insertions, 4 deletions
diff --git a/client.qrc b/client.qrc
index de385dfb2..bb284644a 100644
--- a/client.qrc
+++ b/client.qrc
@@ -30,7 +30,10 @@
<file>resources/copy.svg</file>
<file>resources/state-sync.svg</file>
<file>resources/add.png</file>
+ <file>resources/add-color.svg</file>
<file>resources/state-info.svg</file>
+ <file>resources/change.svg</file>
+ <file>resources/delete-color.svg</file>
</qresource>
<qresource prefix="/"/>
<qresource prefix="/qml">
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 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewbox="0 0 16 16"><path fill="#00d400" d="M9.02 13.98h-2v-5h-5v-2h5v-5h2v5l5-.028V8.98h-5z"/></svg>
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 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" version="1.1" height="16"><path d="m8 2c-2.142 0-4.125 1.145-5.196 3l1.948 1.125c0.671-1.162 1.906-1.875 3.2476-1.875 1.1906 0 2.297 0.56157 3 1.5l-1.5 1.5h4.5v-4.5l-1.406 1.406c-1.129-1.348-2.802-2.1563-4.594-2.1563z"/><path d="m2 8.75v4.5l1.408-1.41c1.116 1.334 2.817 2.145 4.592 2.16 2.16 0.01827 4.116-1.132 5.196-3.002l-1.948-1.125c-0.677 1.171-1.9005 1.886-3.248 1.875-1.18-0.01-2.3047-0.572-3-1.5l1.5-1.5z"/></svg>
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 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.1" viewBox="0 0 16 16"><path d="m3.0503 4.4645 3.5355 3.5355-3.5355 3.536 1.4142 1.414 3.5355-3.5358 3.536 3.5358 1.414-1.414-3.5358-3.536 3.5358-3.5355-1.414-1.4142-3.536 3.5355-3.5355-3.5355-1.4142 1.4142z" fill="#d40000"/></svg>
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;