Merge branch '2.0'

This commit is contained in:
Olivier Goffart 2015-09-01 17:57:56 +02:00
commit 3ba5e27d02
15 changed files with 124 additions and 293 deletions

View File

@ -1,6 +1,6 @@
set( MIRALL_VERSION_MAJOR 2 )
set( MIRALL_VERSION_MINOR 0 )
set( MIRALL_VERSION_PATCH 1 )
set( MIRALL_VERSION_PATCH 2 )
set( MIRALL_SOVERSION 0 )
if ( NOT DEFINED MIRALL_VERSION_SUFFIX )

View File

@ -268,23 +268,23 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
c_strlist_t *path_components = c_strlist_new(32);
char *path_split = strdup(path);
size_t len = strlen(path_split);
for (int j = len; ; --j) {
for (i = len; ; --i) {
// read backwards until a path separator is found
if (j != 0 && path_split[j-1] != '/') {
if (i != 0 && path_split[i-1] != '/') {
continue;
}
// check 'basename', i.e. for "/foo/bar/fi" we'd check 'fi', 'bar', 'foo'
if (path_split[j] != 0) {
c_strlist_add_grow(&path_components, path_split + j);
if (path_split[i] != 0) {
c_strlist_add_grow(&path_components, path_split + i);
}
if (j == 0 || !check_leading_dirs) {
if (i == 0 || !check_leading_dirs) {
break;
}
// check 'dirname', i.e. for "/foo/bar/fi" we'd check '/foo/bar', '/foo'
path_split[j-1] = '\0';
path_split[i-1] = '\0';
c_strlist_add_grow(&path_components, path_split);
}
SAFE_FREE(path_split);

View File

@ -1,5 +1,6 @@
.. _building-label:
===============================
Appendix A: Building the Client
===============================
@ -23,7 +24,7 @@ Linux
* openSUSE: ``zypper ref; zypper si -d owncloud-client``
* Fedora/CentOS: ``yum install yum-utils; yum-builddep owncloud-client``
3. Follow the `generic build instructions`_.
3. Follow the :ref:`generic-build-instructions`.
4. (Optional) Call ``make install`` to install the client to the ``/usr/local/bin`` directory.
@ -43,7 +44,7 @@ The tested and preferred way to develop in this environment is through the use
of HomeBrew_. The ownCloud team has its own repository containing non-standard
recipes.
To set up your build enviroment for development using HomeBrew_:
To set up your build environment for development using HomeBrew_:
1. Add the ownCloud repository using the following command::
@ -60,7 +61,7 @@ To set up your build enviroment for development using HomeBrew_:
Where ``x.z`` is the current version of Qt 5 that brew has installed
on your machine.
5. For compilation of the client, follow the `generic build instructions`_.
5. For compilation of the client, follow the :ref:`generic-build-instructions`.
6. In the build directory, run ``admin/osx/create_mac.sh <build_dir>
<install_dir>``. If you have a developer signing certificate, you can specify
@ -118,14 +119,14 @@ follow `Windows Installer Build (Cross-Compile)`_ instead.
cmake -G "MinGW Makefiles" ../client
mingw32-make
.. note:: You can try using ninja to build parallelly using
.. note:: You can try using ninja to build in parallel using
``cmake -G Ninja ../client`` and ``ninja`` instead.
.. note:: Refer to the `generic build instructions`_ section for additional options.
.. note:: Refer to the :ref:`generic-build-instructions` section for additional options.
The owncloud binary will appear in the ``bin`` directory.
The ownCloud binary will appear in the ``bin`` directory.
Windows Installer Build (Cross-Compile)
-----------------------
---------------------------------------
Due to the large number of dependencies, building the client installer for Windows
is **currently only officially supported on openSUSE**, by using the MinGW cross compiler.
@ -149,7 +150,7 @@ To cross-compile:
zypper install mingw32-cross-nsis mingw32-cross-nsis-plugin-uac mingw32-cross-nsis-plugin-nsprocess
4. Follow the `generic build instructions`_
4. Follow the :ref:`generic-build-instructions`
.. note:: When building for Windows platforms, you must specify a special
toolchain file that enables cmake to locate the platform-specific tools. To add
@ -179,7 +180,8 @@ To cross-compile:
you may use the official Microsoft ``signtool`` utility on Microsoft Windows.
.. _`generic build instructions`:
.. _generic-build-instructions:
Generic Build Instructions
--------------------------

View File

@ -7,3 +7,4 @@ Comment=@APPLICATION_NAME@ desktop synchronization client
GenericName=Folder Sync
Icon=@APPLICATION_EXECUTABLE@
Keywords=@APPLICATION_NAME@;syncing;file;sharing;
X-GNOME-Autostart-Delay=3

View File

@ -62,7 +62,6 @@ set(client_SRCS
sslerrordialog.cpp
syncrunfilelog.cpp
systray.cpp
accountmigrator.cpp
quotainfo.cpp
accountstate.cpp
addcertificatedialog.cpp

View File

@ -1,89 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "accountmigrator.h"
#include "configfile.h"
#include "folderman.h"
#include "theme.h"
#include <QSettings>
#include <QStringList>
#include <QDir>
#include <QFileInfo>
#include <QDebug>
namespace OCC {
// The purpose of this class is to migrate an existing account that
// was set up with an unbranded client to an branded one.
// The usecase is: Usually people try first with the community client,
// later they maybe switch to a branded client. When they install the
// branded client first, it should automatically pick the information
// from the already configured account.
AccountMigrator::AccountMigrator()
{
}
// the list of folder definitions which are files in the directory "folders"
// underneath the ownCloud configPath (with ownCloud as a last segment)
// need to be copied to the themed path and adjusted.
QStringList AccountMigrator::migrateFolderDefinitons()
{
ConfigFile cfg;
QStringList re;
QString themePath = cfg.configPath();
// create the original ownCloud config path out of the theme path
// by removing the theme folder and append ownCloud.
QString oCPath = themePath;
if( oCPath.endsWith(QLatin1Char('/')) ) {
oCPath.truncate( oCPath.length()-1 );
}
oCPath = oCPath.left( oCPath.lastIndexOf('/'));
themePath += QLatin1String( "folders");
oCPath += QLatin1String( "/ownCloud/folders" );
qDebug() << "Migrator: theme-path: " << themePath;
qDebug() << "Migrator: ownCloud path: " << oCPath;
// get a dir listing of the ownCloud folder definitions and copy
// them over to the theme dir
QDir oCDir(oCPath);
oCDir.setFilter( QDir::Files );
QStringList files = oCDir.entryList();
foreach( const QString& file, files ) {
QString escapedAlias = FolderMan::instance()->escapeAlias(file);
QString themeFile = themePath + QDir::separator() + file;
QString oCFile = oCPath+QDir::separator()+file;
if( QFile::copy( oCFile, themeFile ) ) {
re.append(file);
qDebug() << "Migrator: Folder definition migrated: " << file;
// fix the connection entry of the folder definition
QSettings settings(themeFile, QSettings::IniFormat);
settings.beginGroup( escapedAlias );
settings.setValue(QLatin1String("connection"), Theme::instance()->appName());
settings.sync();
}
}
return re;
}
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef ACCOUNTMIGRATOR_H
#define ACCOUNTMIGRATOR_H
#include <QStringList>
namespace OCC {
/**
* @brief The AccountSettings class
* @ingroup gui
*/
class AccountMigrator {
public:
explicit AccountMigrator();
/**
* @brief migrateFolderDefinitons - migrate the folder definition files
* @return the list of migrated folder definitions
*/
QStringList migrateFolderDefinitons();
};
}
#endif // ACCOUNTMIGRATOR_H

View File

@ -121,7 +121,6 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
this, SLOT(slotUpdateQuota(qint64,qint64)));
connect(ui->deleteButton, SIGNAL(clicked()) , this, SLOT(slotDeleteAccount()));
}
void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
@ -287,9 +286,10 @@ void AccountSettings::slotResetCurrentFolder()
QMessageBox::Yes|QMessageBox::No );
if( ret == QMessageBox::Yes ) {
FolderMan *folderMan = FolderMan::instance();
Folder *f = folderMan->folder(alias);
f->slotTerminateSync();
f->wipe();
if(Folder *f = folderMan->folder(alias)) {
f->slotTerminateSync();
f->wipe();
}
folderMan->slotScheduleAllFolders();
}
}
@ -409,16 +409,18 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used)
ui->quotaProgressBar->setVisible(true);
ui->quotaProgressBar->setEnabled(true);
// workaround the label only accepting ints (which may be only 32 bit wide)
ui->quotaProgressBar->setMaximum(100);
const double percent = used/(double)total*100;
const int percentInt = qMin(qRound(percent), 100);
ui->quotaProgressBar->setValue(percentInt);
QString usedStr = Utility::octetsToString(used);
QString totalStr = Utility::octetsToString(total);
QString percentStr = Utility::compactFormatDouble(percent, 1);
ui->quotaInfoLabel->setText(tr("Storage space: %1 (%3%) of %2 in use").arg(usedStr, totalStr, percentStr));
QString toolTip = tr("%1 (%3%) of %2 in use. Some folders, including network mounted or shared folders, might have different limits.").arg(usedStr, totalStr, percentStr);
ui->quotaInfoLabel->setText(tr("%1 of %2 in use").arg(usedStr, totalStr));
ui->quotaInfoLabel->setToolTip(toolTip);
ui->quotaProgressBar->setToolTip(toolTip);
} else {
ui->quotaProgressBar->setMaximum(0);
ui->quotaProgressBar->setVisible(false);
ui->quotaInfoLabel->setText(tr("Currently there is no storage usage information available."));
}
}

View File

@ -92,7 +92,6 @@ private:
QUrl _OCUrl;
bool _wasDisabledBefore;
AccountState *_accountState;
QLabel *_quotaLabel;
QuotaInfo _quotaInfo;
};

View File

@ -15,23 +15,8 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="storageGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="title">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<widget class="QWidget" name="accountStatus" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
@ -45,73 +30,39 @@
<number>0</number>
</property>
<item>
<widget class="QWidget" name="accountStatus" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="SslButton" name="sslButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="connectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Connected with &lt;server&gt; as &lt;user&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Remove the account configuration from the client</string>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
<widget class="SslButton" name="sslButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="quotaInfoLabel">
<widget class="QLabel" name="connectLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Connected with &lt;server&gt; as &lt;user&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -119,41 +70,67 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Some folders, including network mounted or shared folders, might have different limits.</string>
<string>Remove the account configuration from the client</string>
</property>
<property name="text">
<string>Storage space: ...</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="quotaProgressBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>7</height>
</size>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="value">
<number>-1</number>
</property>
<property name="textVisible">
<bool>false</bool>
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="storageGroupBox">
<item>
<widget class="QLabel" name="quotaInfoLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Storage space: ...</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="quotaProgressBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>7</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>-1</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeView" name="_folderList">
<property name="sizePolicy">

View File

@ -441,9 +441,11 @@ void Folder::bubbleUpSyncResult()
break;
case CSYNC_INSTRUCTION_CONFLICT:
case CSYNC_INSTRUCTION_SYNC:
updatedItems++;
if (!firstItemUpdated)
firstItemUpdated = item;
if (!item->_isDirectory) {
updatedItems++;
if (!firstItemUpdated)
firstItemUpdated = item;
}
break;
case CSYNC_INSTRUCTION_ERROR:
qDebug() << "Got Instruction ERROR. " << _syncResult.errorString();

View File

@ -19,7 +19,6 @@
#include "theme.h"
#include "socketapi.h"
#include "account.h"
#include "accountmigrator.h"
#include "accountstate.h"
#include "accountmanager.h"
#include "filesystem.h"

View File

@ -172,7 +172,10 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
case FolderStatusDelegate::FolderSyncPaused : return f->syncPaused();
case FolderStatusDelegate::FolderAccountConnected : return accountConnected;
case Qt::ToolTipRole:
return Theme::instance()->statusHeaderText(f->syncResult().status());
if ( accountConnected )
return Theme::instance()->statusHeaderText(f->syncResult().status());
else
return tr("Signed out");
case FolderStatusDelegate::FolderStatusIconRole:
if ( accountConnected ) {
auto theme = Theme::instance();

View File

@ -111,9 +111,6 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
QTimer::singleShot(1, this, SLOT(showFirstPage()));
QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
connect(closeButton, SIGNAL(clicked()), SLOT(accept()));
QAction *showLogWindow = new QAction(this);
showLogWindow->setShortcut(QKeySequence("F12"));
connect(showLogWindow, SIGNAL(triggered()), gui, SLOT(slotToggleLogBrowser()));

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>457</height>
<width>488</width>
<height>342</height>
</rect>
</property>
<property name="windowTitle">
@ -29,28 +29,6 @@
<property name="spacing">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QStackedWidget" name="stack"/>
</item>