зеркало из https://github.com/nextcloud/desktop.git
Merge remote-tracking branch 'origin/1.8'
Conflicts: doc/installing.rst
This commit is contained in:
Коммит
dfd9d8725c
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $(basename $0) directory_relative_to_home [uid]"
|
||||
exit
|
||||
fi
|
||||
|
||||
useradd user -u ${2:-1000}
|
||||
su - user << EOF
|
||||
cd /home/user/$1
|
||||
rm -rf build-win32
|
||||
mkdir build-win32
|
||||
cd build-win32
|
||||
../admin/win/download_runtimes.sh
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../admin/win/Toolchain-mingw32-openSUSE.cmake -DWITH_CRASHREPORTER=ON
|
||||
make -j4
|
||||
make package
|
||||
ctest .
|
||||
EOF
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#VS2013
|
||||
base_url=http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3
|
||||
tmp_path=/tmp/.vcredist
|
||||
tmp_path=${1:-/tmp/.vcredist}
|
||||
|
||||
mkdir -p $tmp_path
|
||||
|
||||
|
|
|
@ -43,8 +43,10 @@ void AccountStateManager::setAccountState(AccountState *accountState)
|
|||
emit accountStateRemoved(_accountState);
|
||||
}
|
||||
_accountState = accountState;
|
||||
if (accountState) {
|
||||
emit accountStateAdded(accountState);
|
||||
}
|
||||
}
|
||||
|
||||
void AccountStateManager::slotAccountAdded(AccountPtr account)
|
||||
{
|
||||
|
|
|
@ -180,7 +180,8 @@ Application::Application(int &argc, char **argv) :
|
|||
|
||||
Application::~Application()
|
||||
{
|
||||
// qDebug() << "* OCC shutdown";
|
||||
// Remove the account from the account manager so it can be deleted.
|
||||
AccountManager::instance()->setAccount(AccountPtr());
|
||||
}
|
||||
|
||||
void Application::slotLogin()
|
||||
|
@ -403,7 +404,10 @@ void Application::parseOptions(const QStringList &options)
|
|||
} else if (option == QLatin1String("--confdir")) {
|
||||
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
|
||||
QString confDir = it.next();
|
||||
ConfigFile::setConfDir( confDir );
|
||||
if (!ConfigFile::setConfDir( confDir )) {
|
||||
std::cerr << "Invalid path passed to --confdir" << std::endl;
|
||||
std::exit(1);
|
||||
}
|
||||
} else {
|
||||
showHelp();
|
||||
}
|
||||
|
|
|
@ -873,6 +873,13 @@ void FolderMan::setDirtyProxy(bool value)
|
|||
foreach( Folder *f, _folderMap.values() ) {
|
||||
if(f) {
|
||||
f->setProxyDirty(value);
|
||||
|
||||
if (f->accountState() && f->accountState()->account()
|
||||
&& f->accountState()->account()->networkAccessManager()) {
|
||||
// Need to do this have us not use the old determined system proxy
|
||||
f->accountState()->account()->networkAccessManager()->setProxy(
|
||||
QNetworkProxy(QNetworkProxy::DefaultProxy));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,6 +246,12 @@ FolderWizardRemotePath::FolderWizardRemotePath(AccountPtr account)
|
|||
_lscolTimer.setInterval(500);
|
||||
_lscolTimer.setSingleShot(true);
|
||||
connect(&_lscolTimer, SIGNAL(timeout()), SLOT(slotLsColFolderEntry()));
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
_ui.folderTreeWidget->header()->setSectionResizeMode(0,QHeaderView::ResizeToContents);
|
||||
// Make sure that there will be a scrollbar when the contents is too wide
|
||||
_ui.folderTreeWidget->header()->setStretchLastSection(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void FolderWizardRemotePath::slotAddRemoteFolder()
|
||||
|
@ -291,6 +297,8 @@ void FolderWizardRemotePath::slotCreateRemoteFolderFinished(QNetworkReply::Netwo
|
|||
qDebug() << "** webdav mkdir request finished";
|
||||
showWarn(tr("Folder was successfully created on %1.").arg(Theme::instance()->appNameGUI()));
|
||||
slotRefreshFolders();
|
||||
_ui.folderEntry->setText(static_cast<MkColJob *>(sender())->path());
|
||||
slotLsColFolderEntry();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,9 @@ void OwncloudSetupWizard::slotDetermineAuthType(const QString &urlString)
|
|||
}
|
||||
AccountPtr account = _ocWizard->account();
|
||||
account->setUrl(url);
|
||||
// Reset the proxy which might had been determined previously in ConnectionValidator::checkServerAndAuth()
|
||||
// when there was a previous account.
|
||||
account->networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy));
|
||||
// Set fake credentials beforfe we check what credential it actually is.
|
||||
account->setCredentials(CredentialsFactory::create("dummy"));
|
||||
CheckServerJob *job = new CheckServerJob(_ocWizard->account(), this);
|
||||
|
|
|
@ -73,16 +73,10 @@ ProtocolWidget::ProtocolWidget(QWidget *parent) :
|
|||
_copyBtn->setToolTip( tr("Copy the activity list to the clipboard."));
|
||||
_copyBtn->setEnabled(false);
|
||||
connect(_copyBtn, SIGNAL(clicked()), SLOT(copyToClipboard()));
|
||||
|
||||
ConfigFile cfg;
|
||||
cfg.restoreGeometryHeader(_ui->_treeWidget->header());
|
||||
}
|
||||
|
||||
ProtocolWidget::~ProtocolWidget()
|
||||
{
|
||||
ConfigFile cfg;
|
||||
cfg.saveGeometryHeader(_ui->_treeWidget->header() );
|
||||
|
||||
delete _ui;
|
||||
}
|
||||
|
||||
|
@ -137,6 +131,20 @@ void ProtocolWidget::slotRetrySync()
|
|||
folderMan->slotScheduleAllFolders();
|
||||
}
|
||||
|
||||
void ProtocolWidget::showEvent(QShowEvent *ev)
|
||||
{
|
||||
ConfigFile cfg;
|
||||
cfg.restoreGeometryHeader(_ui->_treeWidget->header());
|
||||
QWidget::showEvent(ev);
|
||||
}
|
||||
|
||||
void ProtocolWidget::hideEvent(QHideEvent *ev)
|
||||
{
|
||||
ConfigFile cfg;
|
||||
cfg.saveGeometryHeader(_ui->_treeWidget->header() );
|
||||
QWidget::hideEvent(ev);
|
||||
}
|
||||
|
||||
void ProtocolWidget::cleanIgnoreItems(const QString& folder)
|
||||
{
|
||||
int itemCnt = _ui->_treeWidget->topLevelItemCount();
|
||||
|
|
|
@ -39,8 +39,6 @@ public:
|
|||
explicit ProtocolWidget(QWidget *parent = 0);
|
||||
~ProtocolWidget();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void slotProgressInfo( const QString& folder, const Progress::Info& progress );
|
||||
void slotOpenFile( QTreeWidgetItem* item, int );
|
||||
|
@ -49,6 +47,10 @@ protected slots:
|
|||
void copyToClipboard();
|
||||
void slotRetrySync();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
void hideEvent(QHideEvent *);
|
||||
|
||||
signals:
|
||||
void guiLog(const QString&, const QString&);
|
||||
|
||||
|
|
|
@ -421,13 +421,7 @@ void ShareDialog::slotCreateShareFetched(const QString &reply)
|
|||
bool success;
|
||||
QVariantMap json = QtJson::parse(reply, success).toMap();
|
||||
_public_share_id = json.value("ocs").toMap().values("data")[0].toMap().value("id").toULongLong();
|
||||
QString url = json.value("ocs").toMap().values("data")[0].toMap().value("url").toString();
|
||||
|
||||
setShareLink(url);
|
||||
|
||||
setShareCheckBoxTitle(true);
|
||||
|
||||
_ui->widget_shareLink->show();
|
||||
getShares();
|
||||
}
|
||||
|
||||
void ShareDialog::slotCheckBoxPasswordClicked()
|
||||
|
|
|
@ -31,6 +31,10 @@ SslButton::SslButton(QWidget *parent) :
|
|||
{
|
||||
setPopupMode(QToolButton::InstantPopup);
|
||||
setAutoRaise(true);
|
||||
|
||||
setMenu(new QMenu(this));
|
||||
QObject::connect(menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(slotUpdateMenu()));
|
||||
}
|
||||
|
||||
QString SslButton::protoToString(QSsl::SslProtocol proto)
|
||||
|
@ -178,19 +182,39 @@ void SslButton::updateAccountState(AccountState *accountState)
|
|||
} else {
|
||||
setVisible(true);
|
||||
}
|
||||
AccountPtr account = accountState->account();
|
||||
if(QMenu *oldMenu = menu()) {
|
||||
oldMenu->hide(); // Need to be hidden because the QToolButton would be left in invalid state if the menu is deleted while it is visible
|
||||
setMenu(0);
|
||||
oldMenu->deleteLater(); // setMenu do not delete the previous menu.
|
||||
}
|
||||
_accountState = accountState;
|
||||
|
||||
AccountPtr account = _accountState->account();
|
||||
if (account->url().scheme() == QLatin1String("https")) {
|
||||
setIcon(QIcon(QPixmap(Theme::hidpiFileName(":/client/resources/lock-https.png"))));
|
||||
QPixmap pm(Theme::hidpiFileName(":/client/resources/lock-https.png"));
|
||||
setIcon(QIcon(pm));
|
||||
QSslCipher cipher = account->sslConfiguration().sessionCipher();
|
||||
setToolTip(tr("This connection is encrypted using %1 bit %2.\n").arg(cipher.usedBits()).arg(cipher.name()));
|
||||
QMenu *menu = new QMenu(this);
|
||||
} else {
|
||||
setIcon(QIcon(QPixmap(Theme::hidpiFileName(":/client/resources/lock-http.png"))));
|
||||
setToolTip(tr("This connection is NOT secure as it is not encrypted.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
void SslButton::slotUpdateMenu() {
|
||||
menu()->clear();
|
||||
|
||||
if (!_accountState) {
|
||||
return;
|
||||
}
|
||||
|
||||
AccountPtr account = _accountState->account();
|
||||
|
||||
if (account->url().scheme() == QLatin1String("https")) {
|
||||
|
||||
QList<QSslCertificate> chain = account->sslConfiguration().peerCertificateChain();
|
||||
menu->addAction(tr("Certificate information:"))->setEnabled(false);
|
||||
|
||||
if (chain.isEmpty()) {
|
||||
qWarning() << "empty certificate chain";
|
||||
return;
|
||||
}
|
||||
|
||||
menu()->addAction(tr("Certificate information:"))->setEnabled(false);
|
||||
|
||||
QList<QSslCertificate> tmpChain;
|
||||
foreach(QSslCertificate cert, chain) {
|
||||
|
@ -213,13 +237,9 @@ void SslButton::updateAccountState(AccountState *accountState)
|
|||
it.toBack();
|
||||
int i = 0;
|
||||
while (it.hasPrevious()) {
|
||||
menu->addMenu(buildCertMenu(menu, it.previous(), account->approvedCerts(), i));
|
||||
menu()->addMenu(buildCertMenu(menu(), it.previous(), account->approvedCerts(), i));
|
||||
i++;
|
||||
}
|
||||
setMenu(menu);
|
||||
} else {
|
||||
setIcon(QIcon(QPixmap(Theme::hidpiFileName(":/client/resources/lock-http.png"))));
|
||||
setToolTip(tr("This connection is NOT secure as it is not encrypted.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ class QSslConfiguration;
|
|||
|
||||
namespace OCC {
|
||||
|
||||
class Account;
|
||||
class AccountState;
|
||||
|
||||
class SslButton : public QToolButton
|
||||
|
@ -35,9 +34,13 @@ public:
|
|||
QString protoToString(QSsl::SslProtocol proto);
|
||||
void updateAccountState(AccountState *accountState);
|
||||
|
||||
public slots:
|
||||
void slotUpdateMenu();
|
||||
|
||||
private:
|
||||
QMenu* buildCertMenu(QMenu *parent, const QSslCertificate& cert,
|
||||
const QList<QSslCertificate>& userApproved, int pos);
|
||||
QPointer<AccountState> _accountState;
|
||||
};
|
||||
|
||||
} // namespace OCC
|
||||
|
|
|
@ -63,8 +63,10 @@ void AccountManager::setAccount(AccountPtr account)
|
|||
emit accountRemoved(_account);
|
||||
}
|
||||
_account = account;
|
||||
if (account) {
|
||||
emit accountAdded(account);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Account::Account(QObject *parent)
|
||||
|
@ -129,6 +131,15 @@ void Account::save()
|
|||
if (!certs.isEmpty()) {
|
||||
settings->setValue( QLatin1String(caCertsKeyC), certs );
|
||||
}
|
||||
|
||||
// Save cookies.
|
||||
if (_am) {
|
||||
CookieJar* jar = qobject_cast<CookieJar*>(_am->cookieJar());
|
||||
if (jar) {
|
||||
qDebug() << "Saving cookies.";
|
||||
jar->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AccountPtr Account::restore()
|
||||
|
|
|
@ -186,7 +186,6 @@ private:
|
|||
QNetworkAccessManager *_am;
|
||||
AbstractCredentials* _credentials;
|
||||
bool _treatSslErrorsAsFailure;
|
||||
int _state;
|
||||
static QString _configFileName;
|
||||
QByteArray _pemCertificate;
|
||||
QString _pemPrivateKey;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "configfile.h"
|
||||
#include <QUrl>
|
||||
#include <QThreadPool>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
@ -23,7 +24,7 @@ ClientProxy::ClientProxy(QObject *parent) :
|
|||
{
|
||||
}
|
||||
|
||||
QNetworkProxy ClientProxy::proxyFromConfig(const ConfigFile& cfg)
|
||||
static QNetworkProxy proxyFromConfig(const ConfigFile& cfg)
|
||||
{
|
||||
QNetworkProxy proxy;
|
||||
|
||||
|
@ -39,6 +40,22 @@ QNetworkProxy ClientProxy::proxyFromConfig(const ConfigFile& cfg)
|
|||
return proxy;
|
||||
}
|
||||
|
||||
bool ClientProxy::isUsingSystemDefault() {
|
||||
OCC::ConfigFile cfg;
|
||||
|
||||
// if there is no config file, default to system proxy.
|
||||
if( cfg.exists() ) {
|
||||
return cfg.proxyType() == QNetworkProxy::DefaultProxy;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QString printQNetworkProxy(const QNetworkProxy &proxy)
|
||||
{
|
||||
return QString("%1://%2:%3").arg(proxy.type()).arg(proxy.hostName()).arg(proxy.port());
|
||||
}
|
||||
|
||||
void ClientProxy::setupQtProxyFromConfig()
|
||||
{
|
||||
OCC::ConfigFile cfg;
|
||||
|
@ -53,19 +70,23 @@ void ClientProxy::setupQtProxyFromConfig()
|
|||
|
||||
switch(proxyType) {
|
||||
case QNetworkProxy::NoProxy:
|
||||
qDebug() << "Set proxy configuration to use NO proxy";
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||
break;
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
qDebug() << "Set proxy configuration to use system configuration";
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||
break;
|
||||
case QNetworkProxy::Socks5Proxy:
|
||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||
qDebug() << "Set proxy configuration to SOCKS5" << printQNetworkProxy(proxy);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
break;
|
||||
case QNetworkProxy::HttpProxy:
|
||||
proxy.setType(QNetworkProxy::HttpProxy);
|
||||
qDebug() << "Set proxy configuration to HTTP" << printQNetworkProxy(proxy);
|
||||
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||
QNetworkProxy::setApplicationProxy(proxy);
|
||||
break;
|
||||
|
@ -96,6 +117,7 @@ const char* ClientProxy::proxyTypeToCStr(QNetworkProxy::ProxyType type)
|
|||
|
||||
void ClientProxy::setCSyncProxy( const QUrl& url, CSYNC *csync_ctx )
|
||||
{
|
||||
#ifdef USE_NEON
|
||||
/* Store proxy */
|
||||
QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QNetworkProxyQuery(url));
|
||||
// We set at least one in Application
|
||||
|
@ -118,7 +140,38 @@ void ClientProxy::setCSyncProxy( const QUrl& url, CSYNC *csync_ctx )
|
|||
csync_set_module_property( csync_ctx, "proxy_port", &proxy_port );
|
||||
csync_set_module_property( csync_ctx, "proxy_user", proxy.user().toUtf8().data());
|
||||
csync_set_module_property( csync_ctx, "proxy_pwd", proxy.password().toUtf8().data());
|
||||
#else
|
||||
Q_UNUSED(url);
|
||||
Q_UNUSED(csync_ctx);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ClientProxy::lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot)
|
||||
{
|
||||
SystemProxyRunnable *runnable = new SystemProxyRunnable(url);
|
||||
QObject::connect(runnable, SIGNAL(systemProxyLookedUp(QNetworkProxy)), dst, slot);
|
||||
QThreadPool::globalInstance()->start(runnable); // takes ownership and deletes
|
||||
}
|
||||
|
||||
SystemProxyRunnable::SystemProxyRunnable(const QUrl &url) : QObject(), QRunnable(), _url(url)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SystemProxyRunnable::run()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Starting system proxy lookup";
|
||||
QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(QNetworkProxyQuery(_url));
|
||||
|
||||
if (proxies.isEmpty()) {
|
||||
emit systemProxyLookedUp(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||
} else {
|
||||
emit systemProxyLookedUp(proxies.first());
|
||||
// FIXME Would we really ever return more?
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <QNetworkProxy>
|
||||
#include <QRunnable>
|
||||
#include <QUrl>
|
||||
|
||||
#include <csync.h>
|
||||
#include "utility.h"
|
||||
|
@ -30,17 +32,31 @@ class OWNCLOUDSYNC_EXPORT ClientProxy : public QObject
|
|||
public:
|
||||
explicit ClientProxy(QObject *parent = 0);
|
||||
|
||||
signals:
|
||||
static bool isUsingSystemDefault();
|
||||
static void lookupSystemProxyAsync(const QUrl &url, QObject *dst, const char *slot);
|
||||
|
||||
public slots:
|
||||
void setCSyncProxy( const QUrl& url, CSYNC *csync_ctx );
|
||||
void setupQtProxyFromConfig();
|
||||
|
||||
private:
|
||||
QNetworkProxy proxyFromConfig(const ConfigFile& cfg);
|
||||
const char* proxyTypeToCStr(QNetworkProxy::ProxyType type);
|
||||
};
|
||||
|
||||
class SystemProxyRunnable : public QObject, public QRunnable {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SystemProxyRunnable(const QUrl &url);
|
||||
void run();
|
||||
signals:
|
||||
void systemProxyLookedUp(const QNetworkProxy &url);
|
||||
private:
|
||||
QUrl _url;
|
||||
};
|
||||
|
||||
QString printQNetworkProxy(const QNetworkProxy &proxy);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // CLIENTPROXY_H
|
||||
|
|
|
@ -85,10 +85,10 @@ ConfigFile::ConfigFile()
|
|||
// qDebug() << Q_FUNC_INFO << "Loading config: " << config << " (URL is " << settings.value("url").toString() << ")";
|
||||
}
|
||||
|
||||
void ConfigFile::setConfDir(const QString &value)
|
||||
bool ConfigFile::setConfDir(const QString &value)
|
||||
{
|
||||
QString dirPath = value;
|
||||
if( dirPath.isEmpty() ) return;
|
||||
if( dirPath.isEmpty() ) return false;
|
||||
|
||||
QFileInfo fi(dirPath);
|
||||
if ( !fi.exists() && !fi.isAbsolute() ) {
|
||||
|
@ -101,7 +101,9 @@ void ConfigFile::setConfDir(const QString &value)
|
|||
dirPath = fi.absoluteFilePath();
|
||||
qDebug() << "** Using custom config dir " << dirPath;
|
||||
_confDir=dirPath;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConfigFile::optionalDesktopNotifications() const
|
||||
|
@ -145,7 +147,7 @@ void ConfigFile::saveGeometryHeader(QHeaderView *header)
|
|||
{
|
||||
#ifndef TOKEN_AUTH_ONLY
|
||||
if(!header) return;
|
||||
Q_ASSERT(!header->objectName().isNull());
|
||||
Q_ASSERT(!header->objectName().isEmpty());
|
||||
|
||||
QSettings settings(configFile(), QSettings::IniFormat);
|
||||
settings.beginGroup(header->objectName());
|
||||
|
@ -162,7 +164,7 @@ void ConfigFile::restoreGeometryHeader(QHeaderView *header)
|
|||
|
||||
QSettings settings(configFile(), QSettings::IniFormat);
|
||||
settings.beginGroup(header->objectName());
|
||||
header->restoreState(getValue(geometryC, header->objectName()).toByteArray());
|
||||
header->restoreState(settings.value(geometryC).toByteArray());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
void setUploadLimit(int kbytes);
|
||||
void setDownloadLimit(int kbytes);
|
||||
|
||||
static void setConfDir(const QString &value);
|
||||
static bool setConfDir(const QString &value);
|
||||
|
||||
bool optionalDesktopNotifications() const;
|
||||
void setOptionalDesktopNotifications(bool show);
|
||||
|
|
|
@ -13,11 +13,13 @@
|
|||
|
||||
#include <QtCore>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkProxyFactory>
|
||||
|
||||
#include "connectionvalidator.h"
|
||||
#include "theme.h"
|
||||
#include "account.h"
|
||||
#include "networkjobs.h"
|
||||
#include "clientproxy.h"
|
||||
#include <creds/abstractcredentials.h>
|
||||
|
||||
namespace OCC {
|
||||
|
@ -63,6 +65,36 @@ void ConnectionValidator::checkServerAndAuth()
|
|||
}
|
||||
_isCheckingServerAndAuth = true;
|
||||
|
||||
// Lookup system proxy in a thread https://github.com/owncloud/client/issues/2993
|
||||
if (ClientProxy::isUsingSystemDefault()) {
|
||||
qDebug() << "Trying to look up system proxy";
|
||||
ClientProxy::lookupSystemProxyAsync(_account->url(),
|
||||
this, SLOT(systemProxyLookupDone(QNetworkProxy)));
|
||||
} else {
|
||||
// We want to reset the QNAM proxy so that the global proxy settings are used (via ClientProxy settings)
|
||||
_account->networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy));
|
||||
// use a queued invocation so we're as asynchronous as with the other code path
|
||||
QMetaObject::invokeMethod(this, "slotCheckServerAndAuth", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionValidator::systemProxyLookupDone(const QNetworkProxy &proxy) {
|
||||
if (!_account) {
|
||||
qDebug() << "Bailing out, Account had been deleted";
|
||||
return;
|
||||
}
|
||||
|
||||
if (proxy.type() != QNetworkProxy::DefaultProxy) {
|
||||
qDebug() << Q_FUNC_INFO << "Setting QNAM proxy to be system proxy" << printQNetworkProxy(proxy);
|
||||
_account->networkAccessManager()->setProxy(proxy);
|
||||
}
|
||||
|
||||
slotCheckServerAndAuth();
|
||||
}
|
||||
|
||||
// The actual check
|
||||
void ConnectionValidator::slotCheckServerAndAuth()
|
||||
{
|
||||
CheckServerJob *checkJob = new CheckServerJob(_account, this);
|
||||
checkJob->setIgnoreCredentialFailure(true);
|
||||
connect(checkJob, SIGNAL(instanceFound(QUrl,QVariantMap)), SLOT(slotStatusFound(QUrl,QVariantMap)));
|
||||
|
@ -98,6 +130,9 @@ void ConnectionValidator::slotStatusFound(const QUrl&url, const QVariantMap &inf
|
|||
// Fetch them now! Once fetched, a new connectivity check will be
|
||||
// initiated anyway.
|
||||
creds->fetch();
|
||||
|
||||
// no result is reported
|
||||
deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace OCC {
|
|||
|
||||
|
||||
*---> checkServerAndAuth (check status.php)
|
||||
Will asynchronously check for system proxy (if using system proxy)
|
||||
And then invoke slotCheckServerAndAuth
|
||||
CheckServerJob
|
||||
|
|
||||
+-> slotNoStatusFound --> X
|
||||
|
@ -85,6 +87,7 @@ public:
|
|||
public slots:
|
||||
/// Checks the server and the authentication.
|
||||
void checkServerAndAuth();
|
||||
void systemProxyLookupDone(const QNetworkProxy &proxy);
|
||||
|
||||
/// Checks authentication only.
|
||||
void checkAuthentication();
|
||||
|
@ -93,6 +96,8 @@ signals:
|
|||
void connectionResult( ConnectionValidator::Status status, QStringList errors );
|
||||
|
||||
protected slots:
|
||||
void slotCheckServerAndAuth();
|
||||
|
||||
void slotStatusFound(const QUrl&url, const QVariantMap &info);
|
||||
void slotNoStatusFound(QNetworkReply *reply);
|
||||
void slotJobTimeout(const QUrl& url);
|
||||
|
|
|
@ -71,7 +71,6 @@ CookieJar::CookieJar(QObject *parent) :
|
|||
|
||||
CookieJar::~CookieJar()
|
||||
{
|
||||
save();
|
||||
}
|
||||
|
||||
bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url)
|
||||
|
|
|
@ -34,10 +34,11 @@ public:
|
|||
using QNetworkCookieJar::setAllCookies;
|
||||
using QNetworkCookieJar::allCookies;
|
||||
|
||||
void save();
|
||||
|
||||
signals:
|
||||
void newCookiesForUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url);
|
||||
private:
|
||||
void save();
|
||||
void restore();
|
||||
QList<QNetworkCookie> removeExpired(const QList<QNetworkCookie> &cookies);
|
||||
QString storagePath() const;
|
||||
|
|
|
@ -313,6 +313,9 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
|
|||
|
||||
void HttpCredentials::invalidateToken()
|
||||
{
|
||||
if (! _password.isEmpty()) {
|
||||
_previousPassword = _password;
|
||||
}
|
||||
_password = QString();
|
||||
_ready = false;
|
||||
|
||||
|
@ -333,6 +336,14 @@ void HttpCredentials::invalidateToken()
|
|||
job->setKey(kck);
|
||||
job->start();
|
||||
|
||||
// Also ensure the password is deleted from the deprecated place
|
||||
// otherwise we'd possibly read and use it again and again.
|
||||
DeletePasswordJob *job2 = new DeletePasswordJob(Theme::instance()->appName());
|
||||
// no job2->setSettings() call here, to make it use the deprecated location.
|
||||
job2->setInsecureFallback(true);
|
||||
job2->setKey(kck);
|
||||
job2->start();
|
||||
|
||||
_account->clearCookieJar();
|
||||
}
|
||||
|
||||
|
@ -387,7 +398,7 @@ QString HttpCredentialsGui::queryPassword(bool *ok)
|
|||
QString str = QInputDialog::getText(0, tr("Enter Password"),
|
||||
tr("Please enter %1 password for user '%2':")
|
||||
.arg(Theme::instance()->appNameGUI(), _user),
|
||||
QLineEdit::Password, QString(), ok);
|
||||
QLineEdit::Password, _previousPassword, ok);
|
||||
return str;
|
||||
} else {
|
||||
return QString();
|
||||
|
|
|
@ -64,6 +64,7 @@ private Q_SLOTS:
|
|||
protected:
|
||||
QString _user;
|
||||
QString _password;
|
||||
QString _previousPassword;
|
||||
|
||||
private:
|
||||
QString _certificatePath;
|
||||
|
|
|
@ -68,11 +68,12 @@ AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path,
|
|||
|
||||
void AbstractNetworkJob::setReply(QNetworkReply *reply)
|
||||
{
|
||||
if (_reply) {
|
||||
_reply->deleteLater();
|
||||
}
|
||||
if (reply)
|
||||
reply->setProperty("doNotHandleAuth", true);
|
||||
|
||||
QNetworkReply *old = _reply;
|
||||
_reply = reply;
|
||||
delete old;
|
||||
}
|
||||
|
||||
void AbstractNetworkJob::setTimeout(qint64 msec)
|
||||
|
@ -213,9 +214,7 @@ QByteArray AbstractNetworkJob::responseTimestamp()
|
|||
|
||||
AbstractNetworkJob::~AbstractNetworkJob()
|
||||
{
|
||||
if (_reply) {
|
||||
_reply->deleteLater();
|
||||
}
|
||||
setReply(0);
|
||||
}
|
||||
|
||||
void AbstractNetworkJob::start()
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#endif
|
||||
#include "configfile.h"
|
||||
#include "utility.h"
|
||||
#include "account.h"
|
||||
#include <json.h>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -43,6 +44,9 @@
|
|||
|
||||
namespace OCC {
|
||||
|
||||
OwncloudPropagator::~OwncloudPropagator()
|
||||
{}
|
||||
|
||||
/* The maximum number of active job in parallel */
|
||||
int OwncloudPropagator::maximumActiveJob()
|
||||
{
|
||||
|
@ -631,6 +635,9 @@ void PropagateDirectory::finalize()
|
|||
emit finished(_hasError == SyncFileItem::NoStatus ? SyncFileItem::Success : _hasError);
|
||||
}
|
||||
|
||||
CleanupPollsJob::~CleanupPollsJob()
|
||||
{}
|
||||
|
||||
void CleanupPollsJob::start()
|
||||
{
|
||||
if (_pollInfos.empty()) {
|
||||
|
|
|
@ -270,6 +270,8 @@ public:
|
|||
, _account(account)
|
||||
{ }
|
||||
|
||||
~OwncloudPropagator();
|
||||
|
||||
void start(const SyncFileItemVector &_syncedItems);
|
||||
|
||||
QAtomicInt _downloadLimit;
|
||||
|
@ -359,6 +361,8 @@ public:
|
|||
SyncJournalDb *journal, const QString &localPath, QObject* parent = 0)
|
||||
: QObject(parent), _pollInfos(pollInfos), _account(account), _journal(journal), _localPath(localPath) {}
|
||||
|
||||
~CleanupPollsJob();
|
||||
|
||||
void start();
|
||||
signals:
|
||||
void finished();
|
||||
|
|
|
@ -64,6 +64,12 @@ static qint64 chunkSize() {
|
|||
return chunkSize;
|
||||
}
|
||||
|
||||
PUTFileJob::~PUTFileJob()
|
||||
{
|
||||
// Make sure that we destroy the QNetworkReply before our _device of which it keeps an internal pointer.
|
||||
setReply(0);
|
||||
}
|
||||
|
||||
void PUTFileJob::start() {
|
||||
QNetworkRequest req;
|
||||
for(QMap<QByteArray, QByteArray>::const_iterator it = _headers.begin(); it != _headers.end(); ++it) {
|
||||
|
|
|
@ -74,6 +74,7 @@ public:
|
|||
explicit PUTFileJob(AccountPtr account, const QString& path, QIODevice *device,
|
||||
const QMap<QByteArray, QByteArray> &headers, int chunk, QObject* parent = 0)
|
||||
: AbstractNetworkJob(account, path, parent), _device(device), _headers(headers), _chunk(chunk) {}
|
||||
~PUTFileJob();
|
||||
|
||||
int _chunk;
|
||||
|
||||
|
|
|
@ -484,9 +484,11 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
|||
}
|
||||
|
||||
item._direction = dir;
|
||||
if (instruction != CSYNC_INSTRUCTION_NONE) {
|
||||
// check for blacklisting of this item.
|
||||
// if the item is on blacklist, the instruction was set to IGNORE
|
||||
// if the item is on blacklist, the instruction was set to ERROR
|
||||
checkErrorBlacklisting( &item );
|
||||
}
|
||||
|
||||
if (!item._isDirectory) {
|
||||
_progressInfo._totalFileCount++;
|
||||
|
|
|
@ -122,11 +122,14 @@ QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
|
|||
flavor = QLatin1String("colored");
|
||||
}
|
||||
|
||||
QIcon icon;
|
||||
if( QIcon::hasThemeIcon( name )) {
|
||||
// use from theme
|
||||
icon = QIcon::fromTheme( name );
|
||||
} else {
|
||||
return QIcon::fromTheme( name );
|
||||
}
|
||||
|
||||
QString key = name + "," + flavor;
|
||||
QIcon & cached = _iconCache[key];
|
||||
if (cached.isNull()) {
|
||||
QList<int> sizes;
|
||||
sizes <<16 << 22 << 32 << 48 << 64 << 128 << 256;
|
||||
foreach (int size, sizes) {
|
||||
|
@ -140,19 +143,20 @@ QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
|
|||
p.setPen(QColor("#dfdbd2"));
|
||||
p.drawPixmap(px.rect(), mask, mask.rect());
|
||||
}
|
||||
icon.addPixmap(px);
|
||||
cached.addPixmap(px);
|
||||
}
|
||||
}
|
||||
if (icon.isNull()) {
|
||||
if (cached.isNull()) {
|
||||
foreach (int size, sizes) {
|
||||
QString pixmapName = QString::fromLatin1(":/client/resources/%1-%2.png").arg(name).arg(size);
|
||||
if (QFile::exists(pixmapName)) {
|
||||
icon.addFile(pixmapName);
|
||||
cached.addFile(pixmapName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return icon;
|
||||
|
||||
return cached;
|
||||
}
|
||||
|
||||
QString Theme::hidpiFileName(const QString &fileName, QPaintDevice *dev)
|
||||
|
|
|
@ -208,7 +208,7 @@ private:
|
|||
|
||||
static Theme* _instance;
|
||||
bool _mono;
|
||||
|
||||
mutable QHash<QString, QIcon> _iconCache;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче