"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/message-poller.cpp" between
seafile-client-9.0.1.tar.gz and seafile-client-9.0.2.tar.gz

About: Seafile (client) for the Seafile cloud storage system.

message-poller.cpp  (seafile-client-9.0.1):message-poller.cpp  (seafile-client-9.0.2)
#include <QTimer> #include <QTimer>
#include <QDateTime> #include <QDateTime>
#include <QJsonDocument> #include <QJsonDocument>
#include <QRegularExpression>
#include <QJsonObject>
#include "utils/utils.h" #include "utils/utils.h"
#include "utils/translate-commit-desc.h" #include "utils/translate-commit-desc.h"
#include "utils/json-utils.h" #include "utils/json-utils.h"
#include "utils/file-utils.h" #include "utils/file-utils.h"
#include "seafile-applet.h" #include "seafile-applet.h"
#include "daemon-mgr.h" #include "daemon-mgr.h"
#include "settings-mgr.h" #include "settings-mgr.h"
#include "rpc/rpc-client.h" #include "rpc/rpc-client.h"
#include "rpc/sync-error.h" #include "rpc/sync-error.h"
#include "ui/tray-icon.h" #include "ui/tray-icon.h"
#include "sync-error-service.h"
#include "message-poller.h" #include "message-poller.h"
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include "include/seafile-error.h" #include "include/seafile-error.h"
#else #else
#include <seafile/seafile-error.h> #include <seafile/seafile-error.h>
#endif #endif
namespace { namespace {
skipping to change at line 141 skipping to change at line 144
json_t *object = json_loads(toCStr(content), 0, &error); json_t *object = json_loads(toCStr(content), 0, &error);
if (!object) { if (!object) {
qWarning("Failed to parse json: %s", error.text); qWarning("Failed to parse json: %s", error.text);
return; return;
} }
QString repo_id = QString::fromUtf8(json_string_value(json_object_get(ob ject, "repo_id"))); QString repo_id = QString::fromUtf8(json_string_value(json_object_get(ob ject, "repo_id")));
QString title = QString::fromUtf8(json_string_value(json_object_get(obje ct, "repo_name"))); QString title = QString::fromUtf8(json_string_value(json_object_get(obje ct, "repo_name")));
QString path = QString::fromUtf8(json_string_value(json_object_get(objec t, "path"))); QString path = QString::fromUtf8(json_string_value(json_object_get(objec t, "path")));
int err_id = json_integer_value(json_object_get(object, "err_id")); int err_id = json_integer_value(json_object_get(object, "err_id"));
switch (err_id) {
case SYNC_ERROR_ID_FILE_LOCKED_BY_APP:
case SYNC_ERROR_ID_INDEX_ERROR:
case SYNC_ERROR_ID_PATH_END_SPACE_PERIOD:
case SYNC_ERROR_ID_PATH_INVALID_CHARACTER:
case SYNC_ERROR_ID_UPDATE_TO_READ_ONLY_REPO:
case SYNC_ERROR_ID_REMOVE_UNCOMMITTED_FOLDER:
#if !defined(Q_OS_WIN32)
case SYNC_ERROR_ID_INVALID_PATH_ON_WINDOWS:
#endif
LastSyncError::instance()->flagRepoSyncError(repo_id, err_id);
break;
}
QString msg; QString msg;
switch (err_id) { switch (err_id) {
case SYNC_ERROR_ID_FILE_LOCKED_BY_APP: case SYNC_ERROR_ID_FILE_LOCKED_BY_APP:
msg = tr("Failed to sync file %1\nFile is locked by other applicatio n. This file will be updated when you close the application.").arg(path); msg = tr("Failed to sync file %1\nFile is locked by other applicatio n. This file will be updated when you close the application.").arg(path);
break; break;
case SYNC_ERROR_ID_FOLDER_LOCKED_BY_APP: case SYNC_ERROR_ID_FOLDER_LOCKED_BY_APP:
msg = tr("Failed to sync folder %1\nSome file in this folder is lock ed by other application. This folder will be updated when you close the applicat ion.").arg(path); msg = tr("Failed to sync folder %1\nSome file in this folder is lock ed by other application. This folder will be updated when you close the applicat ion.").arg(path);
break; break;
case SYNC_ERROR_ID_FILE_LOCKED: case SYNC_ERROR_ID_FILE_LOCKED:
msg = tr("Failed to sync file %1\nFile is locked by another user. Up date to this file is not uploaded.").arg(path); msg = tr("Failed to sync file %1\nFile is locked by another user. Up date to this file is not uploaded.").arg(path);
skipping to change at line 220 skipping to change at line 238
if (doc.isNull()) { if (doc.isNull()) {
qWarning() << "Failed to parse json:" << error.errorString(); qWarning() << "Failed to parse json:" << error.errorString();
return; return;
} else if (!doc.isObject()) { } else if (!doc.isObject()) {
qWarning() << "Malformed json string:" << content; qWarning() << "Malformed json string:" << content;
return; return;
} }
QString text; QString text;
QRegularExpression re("Deleted \"(.+)\" and (.+) more files."); QRegularExpression re("Deleted \"(.+)\" and (.+) more files.");
auto match = re.match(doc["delete_files"].toString().trimmed()); auto match = re.match(doc.object().value("delete_files").toString().trim med());
if (match.hasMatch()) { if (match.hasMatch()) {
text = tr("Deleted \"%1\" and %2 more files.") text = tr("Deleted \"%1\" and %2 more files.")
.arg(match.captured(1)).arg(match.captured(2)); .arg(match.captured(1)).arg(match.captured(2));
} }
QString info = tr("Confirm to bulk delete files in library \"%1\" ?") QString info = tr("Do you want to delete files in library \"%1\" ?")
.arg(doc["repo_name"].toString().trimmed()); .arg(doc.object().value("repo_name").toString().trimme
d());
if (seafApplet->bulkDeletingMessageBox(text, info)) { if (seafApplet->deletingConfirmationBox(text, info)) {
rpc_client_->addDelConfirmation(doc["confirmation_id"].toString(), f rpc_client_->addDelConfirmation(doc.object().value("confirmation_id"
alse); ).toString(), false);
} else { } else {
rpc_client_->addDelConfirmation(doc["confirmation_id"].toString(), t rue); rpc_client_->addDelConfirmation(doc.object().value("confirmation_id" ).toString(), true);
} }
} }
} }
 End of changes. 7 change blocks. 
7 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)