Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.8'
Browse files Browse the repository at this point in the history
Conflicts:
	doc/installing.rst
  • Loading branch information
ckamm committed Mar 27, 2015
2 parents d55d8c0 + 2578832 commit dfd9d87
Show file tree
Hide file tree
Showing 33 changed files with 3,297 additions and 65 deletions.
19 changes: 19 additions & 0 deletions admin/win/docker/build.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion admin/win/download_runtimes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/gui/accountstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ void AccountStateManager::setAccountState(AccountState *accountState)
emit accountStateRemoved(_accountState);
}
_accountState = accountState;
emit accountStateAdded(accountState);
if (accountState) {
emit accountStateAdded(accountState);
}
}

void AccountStateManager::slotAccountAdded(AccountPtr account)
Expand Down
8 changes: 6 additions & 2 deletions src/gui/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
}
Expand Down
7 changes: 7 additions & 0 deletions src/gui/folderman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/gui/folderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/gui/owncloudsetupwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 14 additions & 6 deletions src/gui/protocolwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
Expand Down
6 changes: 4 additions & 2 deletions src/gui/protocolwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class ProtocolWidget : public QWidget
explicit ProtocolWidget(QWidget *parent = 0);
~ProtocolWidget();

signals:

public slots:
void slotProgressInfo( const QString& folder, const Progress::Info& progress );
void slotOpenFile( QTreeWidgetItem* item, int );
Expand All @@ -49,6 +47,10 @@ protected slots:
void copyToClipboard();
void slotRetrySync();

protected:
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);

signals:
void guiLog(const QString&, const QString&);

Expand Down
8 changes: 1 addition & 7 deletions src/gui/sharedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
48 changes: 34 additions & 14 deletions src/gui/sslbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand All @@ -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"));
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/gui/sslbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class QSslConfiguration;

namespace OCC {

class Account;
class AccountState;

class SslButton : public QToolButton
Expand All @@ -35,9 +34,13 @@ class SslButton : public QToolButton
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
Expand Down
13 changes: 12 additions & 1 deletion src/libsync/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ void AccountManager::setAccount(AccountPtr account)
emit accountRemoved(_account);
}
_account = account;
emit accountAdded(account);
if (account) {
emit accountAdded(account);
}
}


Expand Down Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion src/libsync/account.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ protected Q_SLOTS:
QNetworkAccessManager *_am;
AbstractCredentials* _credentials;
bool _treatSslErrorsAsFailure;
int _state;
static QString _configFileName;
QByteArray _pemCertificate;
QString _pemPrivateKey;
Expand Down
Loading

0 comments on commit dfd9d87

Please sign in to comment.