1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Get sync to update view

This commit is contained in:
Laurent Cozic
2017-01-07 10:40:13 +01:00
parent b1415056cb
commit fb63787d10
4 changed files with 65 additions and 19 deletions

View File

@ -131,28 +131,34 @@ void Synchronizer::api_requestDone(const QJsonObject& response, const QString& t
}
} else if (category == "download") {
if (action == "getSynchronizer") {
downloadsRemaining_ = 0;
QJsonArray items = response["items"].toArray();
foreach (QJsonValue item, items) {
QJsonObject obj = item.toObject();
QString itemId = obj["item_id"].toString();
QString itemType = obj["item_type"].toString();
QString operationType = obj["type"].toString();
QString revId = QString::number(obj["id"].toInt());
QString revId = obj["id"].toString();
QString path = itemType + "s";
if (operationType == "create") {
api_.get(path + "/" + itemId, QUrlQuery(), QUrlQuery(), "download:getFolder:" + itemId + ":" + revId);
api_.get(path + "/" + itemId, QUrlQuery(), QUrlQuery(), "download:createFolder:" + itemId + ":" + revId);
}
downloadsRemaining_++;
}
if (!downloadsRemaining_) {
qDebug() << "All download operations complete";
state_ = Idle;
}
} else {
downloadsRemaining_--;
Settings settings;
if (action == "getFolder") {
if (action == "createFolder") {
Folder folder;
folder.loadJsonObject(response);
folder.save(false);