From 4e0496f74d9847a18421e0bd3352d76c4e8eb5a1 Mon Sep 17 00:00:00 2001 From: hefee Date: Tue, 31 Dec 2013 02:10:44 +0100 Subject: [PATCH 1/3] respect XDG_CONFIG_HOME for getting user config dir. Under linux the XDG Base Directory Specification define different enviroment variables where to store what. --- src/mirall/utility_unix.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/mirall/utility_unix.cpp b/src/mirall/utility_unix.cpp index 9ad786f5fa..62d6d37bd5 100644 --- a/src/mirall/utility_unix.cpp +++ b/src/mirall/utility_unix.cpp @@ -26,17 +26,30 @@ static void setupFavLink_private(const QString &folder) { } } +// returns the autostart directory the linux way +// and respects the XDG_CONFIG_HOME env variable +// can be replaces for qt5 with QStandardPaths +QString getUserAutostartDir_private() +{ + QString config = QLatin1String(qgetenv("XDG_CONFIG_HOME")); + + if (config.isEmpty()) { + config = QDir::homePath()+QLatin1String("/.config"); + } + config += QLatin1String("/autostart/"); + return config; +} + bool hasLaunchOnStartup_private(const QString &appName) { - QString userAutoStartPath = QDir::homePath()+QLatin1String("/.config/autostart/"); - QString desktopFileLocation = userAutoStartPath+appName+QLatin1String(".desktop"); + QString desktopFileLocation = getUserAutostartDir_private()+appName+QLatin1String(".desktop"); return QFile::exists(desktopFileLocation); } void setLaunchOnStartup_private(const QString &appName, const QString& guiName, bool enable) { - QString userAutoStartPath = QDir::homePath()+QLatin1String("/.config/autostart/"); + QString userAutoStartPath = getUserAutostartDir_private(); QString desktopFileLocation = userAutoStartPath+appName+QLatin1String(".desktop"); if (enable) { if (!QDir().exists(userAutoStartPath) && !QDir().mkdir(userAutoStartPath)) { From f72e1cc8375b72c97d6566c6875f7214415cea9c Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Fri, 21 Mar 2014 13:52:35 +0100 Subject: [PATCH 2/3] Log: Don't override level for csync The level shall be set from Folder or owncloudCmd only. --- src/mirall/csyncthread.cpp | 2 -- src/owncloudcmd/owncloudcmd.cpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp index 25263a5c8e..46d2b33f73 100644 --- a/src/mirall/csyncthread.cpp +++ b/src/mirall/csyncthread.cpp @@ -490,8 +490,6 @@ void CSyncThread::startSync() // } // csync_set_auth_callback( _csync_ctx, getauth ); - csync_set_log_callback( csyncLogCatcher ); - csync_set_log_level( 11 ); _syncTime.start(); diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp index d24b04107b..46d979b132 100644 --- a/src/owncloudcmd/owncloudcmd.cpp +++ b/src/owncloudcmd/owncloudcmd.cpp @@ -126,6 +126,7 @@ int main(int argc, char **argv) { qFatal("ne_sock_init failed!"); } + csync_set_log_callback( csyncLogCatcher ); csync_set_log_level(11); csync_enable_conflictcopys(_csync_ctx); Logger::instance()->setLogFile("-"); From 08dd9796d10e3eb3964288c49885969d5c507fb9 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Fri, 4 Apr 2014 10:50:40 +0200 Subject: [PATCH 3/3] HACK to avoid continuation: See task #1448 We do not know the _modtime from the server, at this point, so just set the current one. (rather than the one locally) --- src/mirall/owncloudpropagator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index ccf22a4402..75af58517c 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -122,6 +122,10 @@ bool PropagateItemJob::checkForProblemsWithShared(const QString& msg) } else if (downloadItem._instruction == CSYNC_INSTRUCTION_SYNC) { // we modified the file locally, jsut create a conflict then downloadItem._instruction = CSYNC_INSTRUCTION_CONFLICT; + + // HACK to avoid continuation: See task #1448: We do not know the _modtime from the + // server, at this point, so just set the current one. (rather than the one locally) + downloadItem._modtime = Utility::qDateTimeToTime_t(QDateTime::currentDateTime()); } else { // the file was removed or renamed, just recover the old one downloadItem._instruction = CSYNC_INSTRUCTION_SYNC;