mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
Merge branch '1.5'
This commit is contained in:
commit
ebee52ea8a
6 changed files with 76 additions and 34 deletions
|
@ -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
|
||||
|
|
|
@ -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<ReadPasswordJob*>(job);
|
||||
delete readJob->settings();
|
||||
_password = readJob->textData();
|
||||
Account *account = qvariant_cast<Account*>(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<Account*>(readJob->property("account")));
|
||||
persist(account);
|
||||
Q_EMIT fetched();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -726,7 +726,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;
|
||||
|
@ -831,7 +831,12 @@ void PropagateDownloadFile::start()
|
|||
}
|
||||
}
|
||||
|
||||
csync_win32_set_file_hidden(tmpFileName.toUtf8().constData(), false);
|
||||
QFileInfo existingFile(fn);
|
||||
if(existingFile.exists() && existingFile.permissions() != tmpFile.permissions()) {
|
||||
tmpFile.setPermissions(existingFile.permissions());
|
||||
}
|
||||
|
||||
csync_win32_set_file_hidden(tmpFile.fileName().toUtf8().constData(), false);
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
bool success;
|
||||
|
@ -1139,7 +1144,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);
|
||||
}
|
||||
|
|
|
@ -247,9 +247,10 @@ 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);
|
||||
// Utility::showInFileManager(fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -340,13 +340,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")
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <QFile>
|
||||
#include <qdebug.h>
|
||||
|
||||
#include <neon/ne_socket.h>
|
||||
|
||||
#include "csyncthread.h"
|
||||
#include <syncjournaldb.h>
|
||||
#include "logger.h"
|
||||
|
@ -36,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()
|
||||
|
@ -66,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);
|
||||
|
||||
|
@ -95,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();
|
||||
}
|
||||
|
@ -108,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 );
|
||||
|
@ -119,6 +109,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);
|
||||
|
@ -133,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);
|
||||
|
@ -143,5 +160,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
csync_destroy(_csync_ctx);
|
||||
|
||||
ne_sock_exit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue