From d0d362664be9f9cd2d406163af582b1cffc03712 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Mon, 14 Oct 2013 16:11:15 +0200 Subject: Handle proxy on folder level, not folderman level. --- src/mirall/application.cpp | 2 +- src/mirall/folder.cpp | 17 +++++++++++++++-- src/mirall/folder.h | 4 ++++ src/mirall/folderman.cpp | 11 +++++++++-- src/mirall/folderman.h | 3 +-- src/mirall/folderwatcher_inotify.cpp | 11 ++++++++++- 6 files changed, 40 insertions(+), 8 deletions(-) (limited to 'src/mirall') diff --git a/src/mirall/application.cpp b/src/mirall/application.cpp index 6b0f5ecf9..048663c87 100644 --- a/src/mirall/application.cpp +++ b/src/mirall/application.cpp @@ -164,9 +164,9 @@ Application::Application(int &argc, char **argv) : setupActions(); setupSystemTray(); - slotSetupProxy(); folderMan->setupFolders(); + slotSetupProxy(); // folders have to be defined first. // startup procedure. QTimer::singleShot( 0, this, SLOT( slotCheckConnection() )); diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp index e60278802..82cc504ec 100644 --- a/src/mirall/folder.cpp +++ b/src/mirall/folder.cpp @@ -54,6 +54,8 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP , _csync(0) , _csyncError(false) , _csyncUnavail(false) + , _wipeDb(false) + , _proxyDirty(true) , _csync_ctx(0) { qsrand(QTime::currentTime().msec()); @@ -501,10 +503,21 @@ void Folder::setProxy() csync_set_module_property(_csync_ctx, "proxy_user", proxy.user().toUtf8().data() ); csync_set_module_property(_csync_ctx, "proxy_pwd" , proxy.password().toUtf8().data() ); - FolderMan::instance()->setDirtyProxy(false); + setProxyDirty(false); + } else { + qDebug() << "WRN: Unable to set Proxy without csync-ctx!"; } } +void Folder::setProxyDirty(bool value) +{ + _proxyDirty = value; +} + +bool Folder::proxyDirty() +{ + return _proxyDirty; +} const char* Folder::proxyTypeToCStr(QNetworkProxy::ProxyType type) { @@ -540,7 +553,7 @@ void Folder::startSync(const QStringList &pathList) QMetaObject::invokeMethod(this, "slotCSyncFinished", Qt::QueuedConnection); return; } - } else if (FolderMan::instance()->isDirtyProxy()) { + } else if (proxyDirty()) { setProxy(); } diff --git a/src/mirall/folder.h b/src/mirall/folder.h index d2bc20050..caf4b576c 100644 --- a/src/mirall/folder.h +++ b/src/mirall/folder.h @@ -150,6 +150,9 @@ public slots: */ void startSync(const QStringList &pathList = QStringList()); + void setProxyDirty(bool value); + bool proxyDirty(); + private slots: void slotCSyncStarted(); void slotCSyncError(const QString& ); @@ -202,6 +205,7 @@ protected: bool _csyncError; bool _csyncUnavail; bool _wipeDb; + bool _proxyDirty; Progress::Kind _progressKind; QTimer _pollTimer; QString _lastEtag; diff --git a/src/mirall/folderman.cpp b/src/mirall/folderman.cpp index 381db8651..caf05ac28 100644 --- a/src/mirall/folderman.cpp +++ b/src/mirall/folderman.cpp @@ -37,8 +37,7 @@ FolderMan* FolderMan::_instance = 0; FolderMan::FolderMan(QObject *parent) : QObject(parent), - _syncEnabled( true ), - _dirtyProxy( true ) + _syncEnabled( true ) { // if QDir::mkpath would not be so stupid, I would not need to have this // duplication of folderConfigPath() here @@ -521,6 +520,14 @@ bool FolderMan::startFromScratch( const QString& localFolder ) return false; } +void FolderMan::setDirtyProxy(bool value) +{ + foreach( Folder *f, _folderMap.values() ) { + f->setProxyDirty(value); + } +} + + SyncResult FolderMan::accountStatus(const QList &folders) { SyncResult overallResult(SyncResult::Undefined); diff --git a/src/mirall/folderman.h b/src/mirall/folderman.h index 8051d0c46..7625b18c2 100644 --- a/src/mirall/folderman.h +++ b/src/mirall/folderman.h @@ -109,8 +109,7 @@ public slots: void slotScheduleAllFolders(); - bool isDirtyProxy() { return _dirtyProxy; } - void setDirtyProxy(bool value = true) { _dirtyProxy = value; } + void setDirtyProxy(bool value = true); private slots: // slot to add a folder to the syncing queue diff --git a/src/mirall/folderwatcher_inotify.cpp b/src/mirall/folderwatcher_inotify.cpp index f650b0fe7..a58fe332e 100644 --- a/src/mirall/folderwatcher_inotify.cpp +++ b/src/mirall/folderwatcher_inotify.cpp @@ -132,7 +132,16 @@ void FolderWatcherPrivate::slotINotifyEvent(int mask, int /*cookie*/, const QStr //qDebug() << cookie << " OTHER " << mask << " :" << path; } - foreach (const QString& pattern, _parent->ignores()) { + QStringList ignores = _parent->ignores(); + + if( path.endsWith(".csync_journal.db.ctmp") || + path.endsWith(".csync_journal.db.ctmp-journal") || + path.endsWith(".csync_journal.db")) { + qDebug() << " ** Inotify ignored for " <