[Pkg-owncloud-commits] [owncloud-client] 62/115: Merge branch 'master' into selective_sync
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri Aug 29 22:04:01 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 936252765aee06b6347c2979dd590d0feb7545cc
Merge: 9575271 b62b87e
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Mon Aug 18 14:44:43 2014 +0200
Merge branch 'master' into selective_sync
Conflicts:
src/mirall/syncengine.cpp
src/mirall/syncengine.h
.gitignore | 2 +-
admin/osx/macosx.pkgproj | 4 +-
admin/win/nsi/l10n/Polish.nsh | 4 +-
csync/src/csync.h | 20 +-
csync/src/csync_owncloud.c | 9 +
csync/src/csync_owncloud_recursive_propfind.c | 14 +
csync/src/csync_private.h | 2 +
csync/src/vio/csync_vio.c | 3 +
mirall.qrc | 1 -
shell_integration/MacOSX/CMakeLists.txt | 8 +-
.../contents.xcworkspacedata | 10 -
.../xcdebugger/Breakpoints.xcbkptlist | 20 -
.../LiferayNativityFinder/ContextMenuHandlers.h | 28 -
.../LiferayNativityFinder/English.lproj/.DS_Store | Bin 6148 -> 0 bytes
.../MacOSX/LiferayNativityFinder/Finder/.DS_Store | Bin 6148 -> 0 bytes
.../MacOSX/LiferayNativityFinder/FinderHook.m | 125 --
.../LiferayNativityFinder.xcodeproj/svp.mode1v3 | 1542 ----------------
.../LiferayNativityFinder.xcodeproj/svp.pbxuser | 1899 --------------------
.../LiferayNativityInjector.sdef | 9 -
.../OwnCloud.xcworkspace/contents.xcworkspacedata | 10 +
.../xcshareddata/OwnCloud.xccheckout | 41 +
.../ContentManager.h | 0
.../ContentManager.m | 2 +-
.../MacOSX/OwnCloudFinder/ContextMenuHandlers.h | 28 +
.../ContextMenuHandlers.m | 8 +-
.../ContextMenuHandlers.m.unc | 0
.../English.lproj/InfoPlist.strings | 0
.../Finder/Finder.h | 0
.../FinderHook.h | 0
.../MacOSX/OwnCloudFinder/FinderHook.m | 125 ++
.../GCDAsyncSocket.h | 0
.../GCDAsyncSocket.m | 0
.../IconCache.h | 0
.../IconCache.m | 0
.../IconOverlayHandlers.h | 6 +-
.../IconOverlayHandlers.m | 20 +-
.../Info.plist | 6 +-
.../JSONKit.h | 0
.../JSONKit.m | 0
.../MenuManager.h | 0
.../MenuManager.m | 0
.../OwnCloudFinder.xcodeproj}/project.pbxproj | 32 +-
.../project.xcworkspace/contents.xcworkspacedata | 2 +-
.../xcschemes/xcschememanagement.plist | 0
.../RequestManager.h | 0
.../RequestManager.m | 2 +-
.../English.lproj/InfoPlist.strings | 0
.../Info.plist | 32 +-
.../LNStandardVersionComparator.h | 0
.../LNStandardVersionComparator.m | 0
.../LNVersionComparisonProtocol.h | 0
.../OwnCloudInjector.m} | 24 +-
.../MacOSX/OwnCloudInjector/OwnCloudInjector.sdef | 9 +
.../OwnCloudInjector.xcodeproj}/project.pbxproj | 48 +-
.../project.xcworkspace/contents.xcworkspacedata | 2 +-
.../xcschemes/OwnCloudFinder.osax.xcscheme} | 12 +-
.../xcschemes/xcschememanagement.plist | 0
.../license.txt | 0
shell_integration/MacOSX/deploy.sh | 10 +-
shell_integration/nautilus/ownCloud.py | 17 +-
src/mirall/accountsettings.cpp | 78 +-
src/mirall/accountsettings.h | 2 +
src/mirall/application.cpp | 1 -
src/mirall/discoveryphase.cpp | 25 +
src/mirall/discoveryphase.h | 7 +
src/mirall/folder.cpp | 12 +-
src/mirall/folder.h | 1 +
src/mirall/folderman.cpp | 10 -
src/mirall/folderstatusmodel.cpp | 2 +-
src/mirall/owncloudgui.cpp | 16 +-
src/mirall/owncloudtheme.cpp | 33 +-
src/mirall/owncloudtheme.h | 1 -
src/mirall/progressdispatcher.cpp | 8 +-
src/mirall/progressdispatcher.h | 3 +
src/mirall/settingsdialog.cpp | 28 +-
src/mirall/settingsdialog.h | 4 +-
src/mirall/socketapi.cpp | 2 +-
src/mirall/syncengine.cpp | 6 +
src/mirall/syncengine.h | 8 +-
src/mirall/syncresult.cpp | 3 -
src/mirall/syncresult.h | 3 +-
src/mirall/theme.cpp | 40 +-
src/mirall/theme.h | 8 +-
src/mirall/utility_unix.cpp | 10 +-
test/testcsyncsqlite.h | 8 +
translations/mirall_ca.ts | 228 +--
translations/mirall_cs.ts | 228 +--
translations/mirall_de.ts | 232 +--
translations/mirall_el.ts | 228 +--
translations/mirall_en.ts | 228 +--
translations/mirall_es.ts | 230 +--
translations/mirall_es_AR.ts | 228 +--
translations/mirall_et.ts | 228 +--
translations/mirall_eu.ts | 230 +--
translations/mirall_fa.ts | 228 +--
translations/mirall_fi.ts | 228 +--
translations/mirall_fr.ts | 228 +--
translations/mirall_gl.ts | 230 +--
translations/mirall_hu.ts | 228 +--
translations/mirall_it.ts | 232 +--
translations/mirall_ja.ts | 228 +--
translations/mirall_nl.ts | 254 +--
translations/mirall_pl.ts | 232 +--
translations/mirall_pt.ts | 228 +--
translations/mirall_pt_BR.ts | 230 +--
translations/mirall_ru.ts | 228 +--
translations/mirall_sk.ts | 228 +--
translations/mirall_sl.ts | 228 +--
translations/mirall_sv.ts | 228 +--
translations/mirall_th.ts | 228 +--
translations/mirall_tr.ts | 230 +--
translations/mirall_uk.ts | 228 +--
translations/mirall_zh_CN.ts | 228 +--
translations/mirall_zh_TW.ts | 228 +--
114 files changed, 3909 insertions(+), 7206 deletions(-)
diff --cc src/mirall/discoveryphase.cpp
index 1b9c754,0000000..507e5ba
mode 100644,000000..100644
--- a/src/mirall/discoveryphase.cpp
+++ b/src/mirall/discoveryphase.cpp
@@@ -1,61 -1,0 +1,86 @@@
+/*
+ * Copyright (C) by Olivier Goffart <ogoffart at woboq.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "discoveryphase.h"
+#include <csync_private.h>
+#include <qdebug.h>
+
+bool DiscoveryJob::isInBlackList(const QString& path) const
+{
+ if (_selectiveSyncBlackList.isEmpty()) {
+ // If there is no black list, everything is allowed
+ return false;
+ }
+
+ // If one of the item in the black list is a prefix of the path, it means this path need not to
+ // be synced.
+ //
+ // We know the list is sorted (for it is done in DiscoveryJob::start)
+ // So we can do a binary search. If the path is a prefix if another item or right after in the lexical order.
+
+ QString pathSlash = path + QLatin1Char('/');
+
+ auto it = std::lower_bound(_selectiveSyncBlackList.begin(), _selectiveSyncBlackList.end(), pathSlash);
+
+ if (it == _selectiveSyncBlackList.begin()) {
+ return false;
+ }
+ --it;
+ if (pathSlash.startsWith(*it + QLatin1Char('/'))) {
+ return true;
+ }
+ return false;
+}
+
+int DiscoveryJob::isInWhiteListCallBack(void *data, const char *path)
+{
+ return static_cast<DiscoveryJob*>(data)->isInBlackList(QString::fromUtf8(path));
+}
+
++void DiscoveryJob::update_job_update_callback (bool local,
++ const char *dirUrl,
++ void *userdata)
++{
++ DiscoveryJob *updateJob = static_cast<DiscoveryJob*>(userdata);
++ if (updateJob) {
++ // Don't wanna overload the UI
++ if (!updateJob->lastUpdateProgressCallbackCall.isValid()) {
++ updateJob->lastUpdateProgressCallbackCall.restart(); // first call
++ } else if (updateJob->lastUpdateProgressCallbackCall.elapsed() < 200) {
++ return;
++ } else {
++ updateJob->lastUpdateProgressCallbackCall.restart();
++ }
++
++ QString path = QString::fromUtf8(dirUrl).section('/', -1);
++ emit updateJob->folderDiscovered(local, path);
++ }
++}
+
+void DiscoveryJob::start() {
+ _selectiveSyncBlackList.sort();
+ _csync_ctx->checkBlackListHook = isInWhiteListCallBack;
+ _csync_ctx->checkBlackListData = this;
++
++ _csync_ctx->callbacks.update_callback = update_job_update_callback;
++ _csync_ctx->callbacks.update_callback_userdata = this;
++
++
+ csync_set_log_callback(_log_callback);
+ csync_set_log_level(_log_level);
+ csync_set_log_userdata(_log_userdata);
++ lastUpdateProgressCallbackCall.invalidate();
+ emit finished(csync_update(_csync_ctx));
+ deleteLater();
+}
diff --cc src/mirall/discoveryphase.h
index 88b5581,0000000..7e4c0e3
mode 100644,000000..100644
--- a/src/mirall/discoveryphase.h
+++ b/src/mirall/discoveryphase.h
@@@ -1,55 -1,0 +1,62 @@@
+/*
+ * Copyright (C) by Olivier Goffart <ogoffart at woboq.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#pragma once
+
+#include <QObject>
++#include <QElapsedTimer>
+#include <QStringList>
+#include <csync.h>
+
+/**
+ * The Discovery Phase was once called "update" phase in csync therms.
+ * Its goal is to look at the files in one of the remote and check comared to the db
+ * if the files are new, or changed.
+ */
+
+class DiscoveryJob : public QObject {
+ Q_OBJECT
+ CSYNC *_csync_ctx;
+ csync_log_callback _log_callback;
+ int _log_level;
+ void* _log_userdata;
++ QElapsedTimer lastUpdateProgressCallbackCall;
+
+ /**
+ * return true if the given path should be synced,
+ * false if the path should be ignored
+ */
+ bool isInBlackList(const QString &path) const;
+ static int isInWhiteListCallBack(void *, const char *);
+
++ static void update_job_update_callback (bool local,
++ const char *dirname,
++ void *userdata);
+public:
+ explicit DiscoveryJob(CSYNC *ctx, QObject* parent = 0)
+ : QObject(parent), _csync_ctx(ctx) {
+ // We need to forward the log property as csync uses thread local
+ // and updates run in another thread
+ _log_callback = csync_get_log_callback();
+ _log_level = csync_get_log_level();
+ _log_userdata = csync_get_log_userdata();
+ }
+
+ QStringList _selectiveSyncBlackList;
+ Q_INVOKABLE void start();
+signals:
+ void finished(int result);
++ void folderDiscovered(bool local, QString folderUrl);
+};
++
diff --cc src/mirall/syncengine.cpp
index 5f2e278,4c5ad4d..2879bf3
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@@ -530,18 -550,22 +531,23 @@@ void SyncEngine::startSync(
_stopWatch.start();
- qDebug() << "#### Update start #################################################### >>";
+ qDebug() << "#### Discovery start #################################################### >>";
- UpdateJob *job = new UpdateJob(_csync_ctx);
+ DiscoveryJob *job = new DiscoveryJob(_csync_ctx);
+ job->_selectiveSyncBlackList = _selectiveSyncWhiteList;
job->moveToThread(&_thread);
- connect(job, SIGNAL(finished(int)), this, SLOT(slotUpdateFinished(int)));
+ connect(job, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int)));
+ connect(job, SIGNAL(folderDiscovered(bool,QString)),
+ this, SIGNAL(folderDiscovered(bool,QString)));
QMetaObject::invokeMethod(job, "start", Qt::QueuedConnection);
}
-void SyncEngine::slotUpdateFinished(int updateResult)
+void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
{
+ // To clean the progress info
+ emit folderDiscovered(false, QString());
+
- if (updateResult < 0 ) {
+ if (discoveryResult < 0 ) {
handleSyncError(_csync_ctx, "csync_update");
return;
}
diff --cc src/mirall/syncengine.h
index 292ba35,88a5638..a6e9c63
--- a/src/mirall/syncengine.h
+++ b/src/mirall/syncengine.h
@@@ -23,8 -23,7 +23,7 @@@
#include <QString>
#include <QSet>
#include <QMap>
- #include <qelapsedtimer.h>
-#include <QElapsedTimer>
+#include <QStringList>
#include <csync.h>
@@@ -143,11 -145,43 +148,10 @@@ private
// hash containing the permissions on the remote directory
QHash<QString, QByteArray> _remotePerms;
-};
-class UpdateJob : public QObject {
- Q_OBJECT
- CSYNC *_csync_ctx;
- csync_log_callback _log_callback;
- int _log_level;
- void* _log_userdata;
- QElapsedTimer lastUpdateProgressCallbackCall;
- Q_INVOKABLE void start() {
- csync_set_log_callback(_log_callback);
- csync_set_log_level(_log_level);
- csync_set_log_userdata(_log_userdata);
- _csync_ctx->callbacks.update_callback = update_job_update_callback;
- _csync_ctx->callbacks.update_callback_userdata = this;
- lastUpdateProgressCallbackCall.invalidate();
- emit finished(csync_update(_csync_ctx));
- deleteLater();
- }
- static void update_job_update_callback (bool local,
- const char *dirname,
- void *userdata);
-public:
- explicit UpdateJob(CSYNC *ctx, QObject* parent = 0)
- : QObject(parent), _csync_ctx(ctx) {
- // We need to forward the log property as csync uses thread local
- // and updates run in another thread
- _log_callback = csync_get_log_callback();
- _log_level = csync_get_log_level();
- _log_userdata = csync_get_log_userdata();
- }
-signals:
- void folderDiscovered(bool local, QString folderUrl);
- void finished(int result);
+ QStringList _selectiveSyncWhiteList;
};
--
}
#endif // CSYNCTHREAD_H
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list