From 23f52bcd564b0426dbf25e5e1abf0602fdc49627 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 17 Dec 2013 10:16:25 +0100 Subject: [PATCH 1/9] Fix open the explorer code. --- src/mirall/protocolwidget.cpp | 3 ++- src/mirall/utility.cpp | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/mirall/protocolwidget.cpp b/src/mirall/protocolwidget.cpp index 638ab845b..25ef6109b 100644 --- a/src/mirall/protocolwidget.cpp +++ b/src/mirall/protocolwidget.cpp @@ -247,7 +247,8 @@ void ProtocolWidget::slotOpenFile( QTreeWidgetItem *item, int ) Folder *folder = FolderMan::instance()->folder(folderName); if (folder) { - QString fullPath = folder->path() + '/' + fileName; + // folder->path() always comes back with trailing path + QString fullPath = folder->path() + fileName; if (QFile(fullPath).exists()) { Utility::showInFileManager(fullPath); } diff --git a/src/mirall/utility.cpp b/src/mirall/utility.cpp index 9365dc44b..4716ee1e3 100644 --- a/src/mirall/utility.cpp +++ b/src/mirall/utility.cpp @@ -314,13 +314,21 @@ static bool checkDolphinCanSelect() // inspired by Qt Creator's showInGraphicalShell(); void Utility::showInFileManager(const QString &localPath) { + const QString sillyQuote("\"\"\""); if (isWindows()) { - const QString explorer = "explorer.exe"; // FIXME: we trust it's in PATH - QString param; - if (!QFileInfo(localPath).isDir()) - param += QLatin1String("/select,"); - param += QDir::toNativeSeparators(localPath); - QProcess::startDetached(explorer, QStringList(param)); + QString explorer = "explorer.exe "; // FIXME: we trust it's in PATH + + if (!QFileInfo(localPath).isDir()) { + explorer += QLatin1String("/select,"); + } + explorer += sillyQuote; + explorer += QDir::toNativeSeparators(localPath); + explorer += sillyQuote; + + qDebug() << "OO Open explorer commandline:" << explorer; + QProcess p; + p.start(explorer); + p.waitForFinished(5000); } else if (isMac()) { QStringList scriptArgs; scriptArgs << QLatin1String("-e") From 66c0a3b448c7c9f0eb921f1940a29a58c98c22f4 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 17 Dec 2013 12:56:01 +0100 Subject: [PATCH 2/9] Read password from old settings if exist. --- src/creds/httpcredentials.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp index 00d140f66..af4e1c7a9 100644 --- a/src/creds/httpcredentials.cpp +++ b/src/creds/httpcredentials.cpp @@ -180,7 +180,9 @@ void HttpCredentials::fetch(Account *account) Q_EMIT fetched(); } else { ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); - job->setSettings(account->settingsWithGroup(Theme::instance()->appName())); + if( ! account->property("fetch_from_old_place").isValid() ) { + job->setSettings(account->settingsWithGroup(Theme::instance()->appName())); + } job->setInsecureFallback(true); job->setKey(keychainKey(account->url().toString(), _user)); connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*))); @@ -212,20 +214,30 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job) ReadPasswordJob *readJob = static_cast(job); delete readJob->settings(); _password = readJob->textData(); + Account *account = qvariant_cast(readJob->property("account")); + QKeychain::Error error = job->error(); switch (error) { case NoError: _ready = true; + account->setProperty("fetch_from_old_place", QVariant()); Q_EMIT fetched(); break; default: if (!_user.isEmpty()) { bool ok; + // In case we haven't tried at the old place yet, do! + if( !account->property("fetch_from_old_place").isValid() ) { + account->setProperty("fetch_from_old_place", QVariant(true) ); + + fetch(account); + return; + } QString pwd = queryPassword(&ok); if (ok) { _password = pwd; _ready = true; - persist(qvariant_cast(readJob->property("account"))); + persist(account); Q_EMIT fetched(); break; } From c50b0a995b3fe43fd6c8e45c34a427b4fbbb9cf5 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Tue, 17 Dec 2013 14:16:25 +0100 Subject: [PATCH 3/9] Commented opening of files from the activity view as it does not work. See https://github.com/owncloud/mirall/issues/1295 --- src/mirall/protocolwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mirall/protocolwidget.cpp b/src/mirall/protocolwidget.cpp index 25ef6109b..7be1dec92 100644 --- a/src/mirall/protocolwidget.cpp +++ b/src/mirall/protocolwidget.cpp @@ -250,7 +250,7 @@ void ProtocolWidget::slotOpenFile( QTreeWidgetItem *item, int ) // folder->path() always comes back with trailing path QString fullPath = folder->path() + fileName; if (QFile(fullPath).exists()) { - Utility::showInFileManager(fullPath); + // Utility::showInFileManager(fullPath); } } } From d17be6f1ff14f214623848ae0c0f2580b393d8cd Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 19 Dec 2013 13:33:31 +0100 Subject: [PATCH 4/9] Do the neon ssl initialization. This fixes bug #1298 and also probably #1297. More tests needed. --- src/owncloudcmd/owncloudcmd.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp index b7a2f7da9..c36f05acb 100644 --- a/src/owncloudcmd/owncloudcmd.cpp +++ b/src/owncloudcmd/owncloudcmd.cpp @@ -20,6 +20,8 @@ #include #include +#include + #include "csyncthread.h" #include #include "logger.h" @@ -119,6 +121,10 @@ int main(int argc, char **argv) { qFatal("Unable to create csync-context!"); return EXIT_FAILURE; } + int rc = ne_sock_init(); + if (rc < 0) { + qFatal("ne_sock_init failed!"); + } csync_set_log_level(11); csync_enable_conflictcopys(_csync_ctx); @@ -143,5 +149,7 @@ int main(int argc, char **argv) { csync_destroy(_csync_ctx); + ne_sock_exit(); + return 0; } From 72b479c1e0f2f0ae02338011fcf88aaa7b91e521 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Thu, 19 Dec 2013 16:48:10 +0100 Subject: [PATCH 5/9] Added proxy support to owncloudcmd. --- src/owncloudcmd/owncloudcmd.cpp | 45 ++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp index c36f05acb..487642f22 100644 --- a/src/owncloudcmd/owncloudcmd.cpp +++ b/src/owncloudcmd/owncloudcmd.cpp @@ -38,26 +38,11 @@ int getauth(const char* prompt, char* buf, size_t len, int echo, int verify, voi return 0; } -struct ProxyInfo { - const char *proxyType; - const char *proxyHost; - int proxyPort; - const char *proxyUser; - const char *proxyPwd; - - ProxyInfo() { - proxyType = 0; - proxyHost = 0; - proxyPort = 0; - proxyUser = 0; - proxyPwd = 0; - } -}; - struct CmdOptions { QString source_dir; QString target_url; QString config_directory; + QString proxy; }; void help() @@ -68,6 +53,8 @@ void help() std::cout << "" << std::endl; std::cout << "Options:" << std::endl; std::cout << " --confdir = configdir: Read config from there." << std::endl; + std::cout << " --httpproxy = proxy: Specify a http proxy to use." << std::endl; + std::cout << " Proxy is http://server:port" << std::endl; std::cout << "" << std::endl; exit(1); @@ -97,6 +84,8 @@ void parseOptions( const QStringList& app_args, CmdOptions *options ) if( option == "--confdir" && !it.peekNext().startsWith("-") ) { options->config_directory = it.next(); + } else if( option == "--httpproxy" && !it.peekNext().startsWith("-")) { + options->proxy = it.next(); } else { help(); } @@ -110,7 +99,6 @@ void parseOptions( const QStringList& app_args, CmdOptions *options ) int main(int argc, char **argv) { QCoreApplication app(argc, argv); - ProxyInfo proxyInfo; CmdOptions options; parseOptions( app.arguments(), &options ); @@ -139,6 +127,29 @@ int main(int argc, char **argv) { } csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx); + if( !options.proxy.isNull() ) { + QString host; + int port = 0; + bool ok; + + QStringList pList = options.proxy.split(':'); + if(pList.count() == 3) { + // http: //192.168.178.23 : 8080 + // 0 1 2 + host = pList.at(1); + if( host.startsWith("//") ) host.remove(0, 2); + + port = pList.at(2).toInt(&ok); + + if( !host.isNull() ) { + csync_set_module_property(_csync_ctx, "proxy_type", (void*) "HttpProxy"); + csync_set_module_property(_csync_ctx, "proxy_host", host.toUtf8().data()); + if( ok && port ) { + csync_set_module_property(_csync_ctx, "proxy_port", (void*) &port); + } + } + } + } SyncJournalDb db(options.source_dir); CSyncThread csyncthread(_csync_ctx, options.source_dir, QUrl(options.target_url).path(), &db); From 900397c05ea49d6b8f348a6b85ad273552d2f9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 20 Dec 2013 10:02:30 +0100 Subject: [PATCH 6/9] fixes #1305 Installer will fallback to English in case there are no translations available for the current system language --- cmake/modules/NSIS.template.in | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/modules/NSIS.template.in b/cmake/modules/NSIS.template.in index fc691e68a..320e1a736 100644 --- a/cmake/modules/NSIS.template.in +++ b/cmake/modules/NSIS.template.in @@ -545,7 +545,7 @@ Function .onInit ;!insertmacro MUI_LANGDLL_DISPLAY # load the selected language file - StrCmp $LANGUAGE ${LANG_ENGLISH} English 0 + !include "${source_path}/admin/win/nsi/l10n\English.nsh" StrCmp $LANGUAGE ${LANG_GERMAN} German 0 StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0 StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0 @@ -560,9 +560,6 @@ Function .onInit StrCmp $LANGUAGE ${LANG_GREEK} Slovak 0 StrCmp $LANGUAGE ${LANG_GREEK} Turkish 0 StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp - English: - !include "${source_path}/admin/win/nsi/l10n\English.nsh" - Goto EndLanguageCmp German: !include "${source_path}/admin/win/nsi/l10n\German.nsh" Goto EndLanguageCmp From 4006e490f3a6d316ddd834050aaa1b6eb4346755 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Jan 2014 12:51:42 +0100 Subject: [PATCH 7/9] Do not write the removed folder on the DB Should fix #1329 --- src/mirall/owncloudpropagator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index f047b9683..f0b396a99 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -1114,7 +1114,7 @@ void PropagateDirectory::proceedNext(SyncFileItem::Status status) _item._file = _item._renameTarget; } - if (_item._should_update_etag) { + if (_item._should_update_etag && _item._instruction != CSYNC_INSTRUCTION_REMOVE) { SyncJournalFileRecord record(_item, _propagator->_localDir + _item._file); _propagator->_journal->setFileRecord(record); } From b7b06a8795101c10e0e7d171e1949a0b9636a8b6 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Jan 2014 13:17:35 +0100 Subject: [PATCH 8/9] Preserve the permission of the file we download Related to issue #820 --- src/mirall/owncloudpropagator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index f0b396a99..005fbbd3c 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -811,6 +811,11 @@ void PropagateDownloadFile::start() } } + QFileInfo existingFile(fn); + if(existingFile.exists() && existingFile.permissions() != tmpFile.permissions()) { + tmpFile.setPermissions(existingFile.permissions()); + } + csync_win32_set_file_hidden(tmpFileName.toUtf8().constData(), false); #ifndef Q_OS_WIN From 1bc4089d95f799dca3eae180a6b13dbc0d596b0f Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Jan 2014 13:32:48 +0100 Subject: [PATCH 9/9] Fix hiding temporary files on windows tmpFileName is a relative path, and we need an absolute path to pass to the function that hides the files --- src/mirall/owncloudpropagator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index 005fbbd3c..bf344dd95 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -706,7 +706,7 @@ void PropagateDownloadFile::start() return; } - csync_win32_set_file_hidden(tmpFileName.toUtf8().constData(), true); + csync_win32_set_file_hidden(tmpFile.fileName().toUtf8().constData(), true); { SyncJournalDb::DownloadInfo pi; @@ -816,7 +816,7 @@ void PropagateDownloadFile::start() tmpFile.setPermissions(existingFile.permissions()); } - csync_win32_set_file_hidden(tmpFileName.toUtf8().constData(), false); + csync_win32_set_file_hidden(tmpFile.fileName().toUtf8().constData(), false); #ifndef Q_OS_WIN bool success;