Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 3bb364980c |
@@ -2,7 +2,7 @@
|
|||||||
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostrar las notas de la versión"
|
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostrar las notas de la versión"
|
||||||
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "El/los proceso/s ${APPLICATION_EXECUTABLE} debe/n ser detenidos.$\n¿Quiere que el instalador lo haga por usted?"
|
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "El/los proceso/s ${APPLICATION_EXECUTABLE} debe/n ser detenidos.$\n¿Quiere que el instalador lo haga por usted?"
|
||||||
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Deteniendo el/los proceso/s ${APPLICATION_EXECUTABLE}."
|
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Deteniendo el/los proceso/s ${APPLICATION_EXECUTABLE}."
|
||||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "¡Proceso a finalizar no encontrado!"
|
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "¡Proceso para finalizar no encontrado!"
|
||||||
StrCpy $PageReinstall_NEW_Field_1 "Una versión anterior de ${APPLICATION_NAME} se encuentra instalada en el sistema. Se recomienda de instalar la versión actual antes de instalar la nueva. Seleccione la operacion deseada y haga click en Siguiente para continuar."
|
StrCpy $PageReinstall_NEW_Field_1 "Una versión anterior de ${APPLICATION_NAME} se encuentra instalada en el sistema. Se recomienda de instalar la versión actual antes de instalar la nueva. Seleccione la operacion deseada y haga click en Siguiente para continuar."
|
||||||
StrCpy $PageReinstall_NEW_Field_2 "Desinstalar antes de instalar"
|
StrCpy $PageReinstall_NEW_Field_2 "Desinstalar antes de instalar"
|
||||||
StrCpy $PageReinstall_NEW_Field_3 "No desinstalar"
|
StrCpy $PageReinstall_NEW_Field_3 "No desinstalar"
|
||||||
|
|||||||
+1
-2
@@ -42,8 +42,7 @@ repositories`_ to see all the Linux client repos.
|
|||||||
echo 'deb-src
|
echo 'deb-src
|
||||||
http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Debian_8.0/ /' >> /etc/apt/sources.list.d/owncloud-client.list
|
http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Debian_8.0/ /' >> /etc/apt/sources.list.d/owncloud-client.list
|
||||||
|
|
||||||
2. Install the dependencies using the following commands for your specific Linux
|
2. Install the dependencies using the following commands for your specific Linux distribution:
|
||||||
distribution. Make sure the repositories for source packages are enabled.
|
|
||||||
|
|
||||||
* Debian/Ubuntu: ``apt-get update; apt-get build-dep owncloud-client``
|
* Debian/Ubuntu: ``apt-get update; apt-get build-dep owncloud-client``
|
||||||
* openSUSE/SLES: ``zypper ref; zypper si -d owncloud-client``
|
* openSUSE/SLES: ``zypper ref; zypper si -d owncloud-client``
|
||||||
|
|||||||
@@ -355,66 +355,6 @@ X-GNOME-Autostart-Delay=3
|
|||||||
# Translations
|
# Translations
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
Comment[oc]=@APPLICATION_NAME@ sincronizacion del client
|
Comment[oc]=@APPLICATION_NAME@ sincronizacion del client
|
||||||
GenericName[oc]=Dorsièr de Sincronizacion
|
GenericName[oc]=Dorsièr de Sincronizacion
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ if( UNIX AND NOT APPLE )
|
|||||||
|
|
||||||
configure_file(syncstate.py syncstate.py COPYONLY)
|
configure_file(syncstate.py syncstate.py COPYONLY)
|
||||||
configure_file(syncstate.py syncstate_nemo.py COPYONLY)
|
configure_file(syncstate.py syncstate_nemo.py COPYONLY)
|
||||||
configure_file(syncstate.py syncstate_caja.py COPYONLY)
|
|
||||||
|
|
||||||
# Call the setupappname.sh script to set the custom app name.
|
# Call the setupappname.sh script to set the custom app name.
|
||||||
set (cmd "${CMAKE_CURRENT_SOURCE_DIR}/setappname.sh")
|
set (cmd "${CMAKE_CURRENT_SOURCE_DIR}/setappname.sh")
|
||||||
@@ -19,17 +18,9 @@ if( UNIX AND NOT APPLE )
|
|||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
ERROR_VARIABLE errors OUTPUT_VARIABLE out)
|
ERROR_VARIABLE errors OUTPUT_VARIABLE out)
|
||||||
|
|
||||||
# Create a caja plugin script from the nautilus one.
|
|
||||||
# cajacmd copies the syncstate.py and performs string replacement.
|
|
||||||
set (cajacmd "${CMAKE_CURRENT_SOURCE_DIR}/createcajaplugin.sh")
|
|
||||||
execute_process(COMMAND ${cajacmd}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
ERROR_VARIABLE errors OUTPUT_VARIABLE out)
|
|
||||||
|
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/syncstate.py DESTINATION ${DATADIR}/nautilus-python/extensions RENAME syncstate-${APPLICATION_SHORTNAME}.py)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/syncstate.py DESTINATION ${DATADIR}/nautilus-python/extensions RENAME syncstate-${APPLICATION_SHORTNAME}.py)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/syncstate_nemo.py DESTINATION ${DATADIR}/nemo-python/extensions RENAME syncstate-${APPLICATION_SHORTNAME}.py)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/syncstate_nemo.py DESTINATION ${DATADIR}/nemo-python/extensions RENAME syncstate-${APPLICATION_SHORTNAME}.py)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/syncstate_caja.py DESTINATION ${DATADIR}/caja-python/extensions RENAME syncstate-${APPLICATION_SHORTNAME}.py)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# this script creates a plugin for caja, just by replacing
|
|
||||||
# all occurences of Nautilus with Caja (case sensitive).
|
|
||||||
|
|
||||||
sed -i.org -e 's/Nautilus/Caja/g' syncstate_caja.py
|
|
||||||
sed -i.org -e 's/nautilus/caja/g' syncstate_caja.py
|
|
||||||
+161
-17
@@ -1,21 +1,165 @@
|
|||||||
The MIT License (MIT)
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (c) 2011 Morgan Leborgne
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
This version of the GNU Lesser General Public License incorporates
|
||||||
copies or substantial portions of the Software.
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
0. Additional Definitions.
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
General Public License.
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|||||||
+20
-23
@@ -1,27 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* The MIT License (MIT)
|
*
|
||||||
*
|
* This file is part of QProgressIndicator,
|
||||||
* Copyright (c) 2011 Morgan Leborgne
|
* an open-source recent files menu widget
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Copyright (C) 2009 - 2010 Morgan Leborgne
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
*
|
||||||
* in the Software without restriction, including without limitation the rights
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* furnished to do so, subject to the following conditions:
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
* This program is distributed in the hope that it will be useful,
|
||||||
* copies or substantial portions of the Software.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
*
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* GNU Lesser General Public License for more details.
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
*
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
*
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
*/
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "QProgressIndicator.h"
|
#include "QProgressIndicator.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|||||||
+24
-27
@@ -1,27 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* The MIT License (MIT)
|
*
|
||||||
*
|
* This file is part of QProgressIndicator,
|
||||||
* Copyright (c) 2011 Morgan Leborgne
|
* an open-source recent files menu widget
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Copyright (C) 2009 - 2010 Morgan Leborgne
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
*
|
||||||
* in the Software without restriction, including without limitation the rights
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* furnished to do so, subject to the following conditions:
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
* This program is distributed in the hope that it will be useful,
|
||||||
* copies or substantial portions of the Software.
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
*
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* GNU Lesser General Public License for more details.
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
*
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
*
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
*/
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef QPROGRESSINDICATOR_H
|
#ifndef QPROGRESSINDICATOR_H
|
||||||
#define QPROGRESSINDICATOR_H
|
#define QPROGRESSINDICATOR_H
|
||||||
|
|
||||||
@@ -67,8 +64,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
const QColor & color() const { return m_color; }
|
const QColor & color() const { return m_color; }
|
||||||
|
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||||
int heightForWidth(int w) const;
|
int heightForWidth(int w) const Q_DECL_OVERRIDE;
|
||||||
public slots:
|
public slots:
|
||||||
/*! Starts the spin animation.
|
/*! Starts the spin animation.
|
||||||
\sa stopAnimation isAnimated
|
\sa stopAnimation isAnimated
|
||||||
@@ -98,8 +95,8 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void setColor(const QColor & color);
|
void setColor(const QColor & color);
|
||||||
protected:
|
protected:
|
||||||
virtual void timerEvent(QTimerEvent * event);
|
virtual void timerEvent(QTimerEvent * event) Q_DECL_OVERRIDE;
|
||||||
virtual void paintEvent(QPaintEvent * event);
|
virtual void paintEvent(QPaintEvent * event) Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
int m_angle;
|
int m_angle;
|
||||||
int m_timerId;
|
int m_timerId;
|
||||||
|
|||||||
+1
-1
@@ -11,4 +11,4 @@ Qt 4.4.x.
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT
|
LGPL
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ struct CmdOptions {
|
|||||||
QString password;
|
QString password;
|
||||||
QString proxy;
|
QString proxy;
|
||||||
bool silent;
|
bool silent;
|
||||||
bool bundleRequests;
|
|
||||||
bool trustSSL;
|
bool trustSSL;
|
||||||
bool useNetrc;
|
bool useNetrc;
|
||||||
bool interactive;
|
bool interactive;
|
||||||
@@ -158,7 +157,6 @@ void help()
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
std::cout << "Options:" << std::endl;
|
std::cout << "Options:" << std::endl;
|
||||||
std::cout << " --silent, -s Don't be so verbose" << std::endl;
|
std::cout << " --silent, -s Don't be so verbose" << std::endl;
|
||||||
std::cout << " --bundle-requests, -b Bundle Requests if supported" << std::endl;
|
|
||||||
std::cout << " --httpproxy [proxy] Specify a http proxy to use." << 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 << " Proxy is http://server:port" << std::endl;
|
||||||
std::cout << " --trust Trust the SSL certification." << std::endl;
|
std::cout << " --trust Trust the SSL certification." << std::endl;
|
||||||
@@ -226,8 +224,6 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
|
|||||||
options->silent = true;
|
options->silent = true;
|
||||||
} else if( option == "--trust") {
|
} else if( option == "--trust") {
|
||||||
options->trustSSL = true;
|
options->trustSSL = true;
|
||||||
} else if( option == "-b" || option == "--bundle-requests") {
|
|
||||||
options->bundleRequests = true;
|
|
||||||
} else if( option == "-n") {
|
} else if( option == "-n") {
|
||||||
options->useNetrc = true;
|
options->useNetrc = true;
|
||||||
} else if( option == "-h") {
|
} else if( option == "-h") {
|
||||||
@@ -296,7 +292,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
CmdOptions options;
|
CmdOptions options;
|
||||||
options.silent = false;
|
options.silent = false;
|
||||||
options.bundleRequests = false;
|
|
||||||
options.trustSSL = false;
|
options.trustSSL = false;
|
||||||
options.useNetrc = false;
|
options.useNetrc = false;
|
||||||
options.interactive = true;
|
options.interactive = true;
|
||||||
@@ -421,7 +416,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
loop.exec();
|
loop.exec();
|
||||||
#endif
|
#endif
|
||||||
account->setBundleRequestsIfCapable(options.bundleRequests);
|
|
||||||
|
|
||||||
// much lower age than the default since this utility is usually made to be run right after a change in the tests
|
// much lower age than the default since this utility is usually made to be run right after a change in the tests
|
||||||
SyncEngine::minimumFileAgeForUpload = 0;
|
SyncEngine::minimumFileAgeForUpload = 0;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ AccountManager *AccountManager::instance()
|
|||||||
|
|
||||||
bool AccountManager::restore()
|
bool AccountManager::restore()
|
||||||
{
|
{
|
||||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||||
|
|
||||||
// If there are no accounts, check the old format.
|
// If there are no accounts, check the old format.
|
||||||
if (settings->childGroups().isEmpty()
|
if (settings->childGroups().isEmpty()
|
||||||
@@ -69,7 +69,9 @@ bool AccountManager::restore()
|
|||||||
bool AccountManager::restoreFromLegacySettings()
|
bool AccountManager::restoreFromLegacySettings()
|
||||||
{
|
{
|
||||||
// try to open the correctly themed settings
|
// try to open the correctly themed settings
|
||||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
auto settings = Account::settingsWithGroup(Theme::instance()->appName());
|
||||||
|
|
||||||
|
bool migratedCreds = false;
|
||||||
|
|
||||||
// if the settings file could not be opened, the childKeys list is empty
|
// if the settings file could not be opened, the childKeys list is empty
|
||||||
// then try to load settings from a very old place
|
// then try to load settings from a very old place
|
||||||
@@ -100,6 +102,7 @@ bool AccountManager::restoreFromLegacySettings()
|
|||||||
qDebug() << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":"
|
qDebug() << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":"
|
||||||
<< (oCUrl == overrideUrl ? "Yes" : "No");
|
<< (oCUrl == overrideUrl ? "Yes" : "No");
|
||||||
if( oCUrl == overrideUrl ) {
|
if( oCUrl == overrideUrl ) {
|
||||||
|
migratedCreds = true;
|
||||||
settings.reset( oCSettings );
|
settings.reset( oCSettings );
|
||||||
} else {
|
} else {
|
||||||
delete oCSettings;
|
delete oCSettings;
|
||||||
@@ -111,6 +114,9 @@ bool AccountManager::restoreFromLegacySettings()
|
|||||||
// Try to load the single account.
|
// Try to load the single account.
|
||||||
if (!settings->childKeys().isEmpty()) {
|
if (!settings->childKeys().isEmpty()) {
|
||||||
if (auto acc = loadAccountHelper(*settings)) {
|
if (auto acc = loadAccountHelper(*settings)) {
|
||||||
|
if (migratedCreds) {
|
||||||
|
acc->setMigrated(true);
|
||||||
|
}
|
||||||
addAccount(acc);
|
addAccount(acc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -120,7 +126,7 @@ bool AccountManager::restoreFromLegacySettings()
|
|||||||
|
|
||||||
void AccountManager::save(bool saveCredentials)
|
void AccountManager::save(bool saveCredentials)
|
||||||
{
|
{
|
||||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||||
settings->setValue(QLatin1String(versionC), 2);
|
settings->setValue(QLatin1String(versionC), 2);
|
||||||
foreach (const auto &acc, _accounts) {
|
foreach (const auto &acc, _accounts) {
|
||||||
settings->beginGroup(acc->account()->id());
|
settings->beginGroup(acc->account()->id());
|
||||||
@@ -136,7 +142,7 @@ void AccountManager::save(bool saveCredentials)
|
|||||||
void AccountManager::saveAccount(Account* a)
|
void AccountManager::saveAccount(Account* a)
|
||||||
{
|
{
|
||||||
qDebug() << "Saving account" << a->url().toString();
|
qDebug() << "Saving account" << a->url().toString();
|
||||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||||
settings->beginGroup(a->id());
|
settings->beginGroup(a->id());
|
||||||
saveAccountHelper(a, *settings, false); // don't save credentials they might not have been loaded yet
|
saveAccountHelper(a, *settings, false); // don't save credentials they might not have been loaded yet
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
@@ -148,7 +154,7 @@ void AccountManager::saveAccount(Account* a)
|
|||||||
void AccountManager::saveAccountState(AccountState* a)
|
void AccountManager::saveAccountState(AccountState* a)
|
||||||
{
|
{
|
||||||
qDebug() << "Saving account state" << a->account()->url().toString();
|
qDebug() << "Saving account state" << a->account()->url().toString();
|
||||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||||
settings->beginGroup(a->account()->id());
|
settings->beginGroup(a->account()->id());
|
||||||
a->writeToSettings(*settings);
|
a->writeToSettings(*settings);
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
@@ -274,7 +280,7 @@ void AccountManager::deleteAccount(AccountState* account)
|
|||||||
auto copy = *it; // keep a reference to the shared pointer so it does not delete it just yet
|
auto copy = *it; // keep a reference to the shared pointer so it does not delete it just yet
|
||||||
_accounts.erase(it);
|
_accounts.erase(it);
|
||||||
|
|
||||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||||
settings->remove(account->account()->id());
|
settings->remove(account->account()->id());
|
||||||
|
|
||||||
emit accountRemoved(account);
|
emit accountRemoved(account);
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ void AccountSettings::slotFolderWizardAccepted()
|
|||||||
// The user already accepted the selective sync dialog. everything is in the white list
|
// The user already accepted the selective sync dialog. everything is in the white list
|
||||||
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList,
|
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList,
|
||||||
QStringList() << QLatin1String("/"));
|
QStringList() << QLatin1String("/"));
|
||||||
folderMan->scheduleAllFolders();
|
folderMan->slotScheduleAllFolders();
|
||||||
emit folderChanged();
|
emit folderChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ void AccountSettings::slotRemoveCurrentFolder()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
folderMan->removeFolder( folderMan->folder(alias) );
|
folderMan->slotRemoveFolder( folderMan->folder(alias) );
|
||||||
_model->removeRow(row);
|
_model->removeRow(row);
|
||||||
|
|
||||||
// single folder fix to show add-button and hide remove-button
|
// single folder fix to show add-button and hide remove-button
|
||||||
@@ -468,7 +468,7 @@ void AccountSettings::slotSyncCurrentFolderNow()
|
|||||||
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
|
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
|
||||||
FolderMan *folderMan = FolderMan::instance();
|
FolderMan *folderMan = FolderMan::instance();
|
||||||
|
|
||||||
folderMan->scheduleFolder(folderMan->folder(alias));
|
folderMan->slotScheduleSync(folderMan->folder(alias));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountSettings::slotOpenOC()
|
void AccountSettings::slotOpenOC()
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ void AccountState::slotCredentialsAsked(AbstractCredentials* credentials)
|
|||||||
|
|
||||||
std::unique_ptr<QSettings> AccountState::settings()
|
std::unique_ptr<QSettings> AccountState::settings()
|
||||||
{
|
{
|
||||||
auto s = Utility::settingsWithGroup(QLatin1String("Accounts"));
|
auto s = _account->settingsWithGroup(QLatin1String("Accounts"));
|
||||||
s->beginGroup(_account->id());
|
s->beginGroup(_account->id());
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ void Application::slotownCloudWizardDone( int res )
|
|||||||
shouldSetAutoStart = shouldSetAutoStart
|
shouldSetAutoStart = shouldSetAutoStart
|
||||||
&& QCoreApplication::applicationDirPath().startsWith("/Applications/");
|
&& QCoreApplication::applicationDirPath().startsWith("/Applications/");
|
||||||
#endif
|
#endif
|
||||||
Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), shouldSetAutoStart);
|
Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,21 @@ void ShibbolethCredentials::setAccount(Account* account)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ShibbolethCredentials::changed(AbstractCredentials* credentials) const
|
||||||
|
{
|
||||||
|
ShibbolethCredentials* other(qobject_cast< ShibbolethCredentials* >(credentials));
|
||||||
|
|
||||||
|
if (!other) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_shibCookie != other->_shibCookie || _user != other->_user) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString ShibbolethCredentials::authType() const
|
QString ShibbolethCredentials::authType() const
|
||||||
{
|
{
|
||||||
return QString::fromLatin1("shibboleth");
|
return QString::fromLatin1("shibboleth");
|
||||||
@@ -127,7 +142,7 @@ void ShibbolethCredentials::fetchFromKeychain()
|
|||||||
} else {
|
} else {
|
||||||
_url = _account->url();
|
_url = _account->url();
|
||||||
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
|
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
|
||||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||||
job->setInsecureFallback(false);
|
job->setInsecureFallback(false);
|
||||||
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
||||||
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
|
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
|
||||||
@@ -246,7 +261,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
|
|||||||
addToCookieJar(_shibCookie);
|
addToCookieJar(_shibCookie);
|
||||||
}
|
}
|
||||||
// access
|
// access
|
||||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||||
|
|
||||||
_ready = true;
|
_ready = true;
|
||||||
_stillValid = true;
|
_stillValid = true;
|
||||||
@@ -305,7 +320,7 @@ QByteArray ShibbolethCredentials::shibCookieName()
|
|||||||
void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
|
void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
|
||||||
{
|
{
|
||||||
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
|
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
|
||||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||||
// we don't really care if it works...
|
// we don't really care if it works...
|
||||||
//connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*)));
|
//connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*)));
|
||||||
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
||||||
@@ -316,7 +331,7 @@ void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
|
|||||||
void ShibbolethCredentials::removeShibCookie()
|
void ShibbolethCredentials::removeShibCookie()
|
||||||
{
|
{
|
||||||
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
|
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
|
||||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||||
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
||||||
job->start();
|
job->start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public:
|
|||||||
ShibbolethCredentials(const QNetworkCookie &cookie);
|
ShibbolethCredentials(const QNetworkCookie &cookie);
|
||||||
|
|
||||||
void setAccount(Account* account) Q_DECL_OVERRIDE;
|
void setAccount(Account* account) Q_DECL_OVERRIDE;
|
||||||
|
bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
|
||||||
QString authType() const Q_DECL_OVERRIDE;
|
QString authType() const Q_DECL_OVERRIDE;
|
||||||
QString user() const Q_DECL_OVERRIDE;
|
QString user() const Q_DECL_OVERRIDE;
|
||||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||||
|
|||||||
+59
-36
@@ -58,6 +58,7 @@ Folder::Folder(const FolderDefinition& definition,
|
|||||||
, _wipeDb(false)
|
, _wipeDb(false)
|
||||||
, _proxyDirty(true)
|
, _proxyDirty(true)
|
||||||
, _lastSyncDuration(0)
|
, _lastSyncDuration(0)
|
||||||
|
, _forceSyncOnPollTimeout(false)
|
||||||
, _consecutiveFailingSyncs(0)
|
, _consecutiveFailingSyncs(0)
|
||||||
, _consecutiveFollowUpSyncs(0)
|
, _consecutiveFollowUpSyncs(0)
|
||||||
, _journal(definition.localPath)
|
, _journal(definition.localPath)
|
||||||
@@ -111,11 +112,6 @@ Folder::Folder(const FolderDefinition& definition,
|
|||||||
connect(_engine.data(), SIGNAL(seenLockedFile(QString)), FolderMan::instance(), SLOT(slotSyncOnceFileUnlocks(QString)));
|
connect(_engine.data(), SIGNAL(seenLockedFile(QString)), FolderMan::instance(), SLOT(slotSyncOnceFileUnlocks(QString)));
|
||||||
connect(_engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector&)),
|
connect(_engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector&)),
|
||||||
SLOT(slotLogPropagationStart()));
|
SLOT(slotLogPropagationStart()));
|
||||||
|
|
||||||
_scheduleSelfTimer.setSingleShot(true);
|
|
||||||
_scheduleSelfTimer.setInterval(SyncEngine::minimumFileAgeForUpload);
|
|
||||||
connect(&_scheduleSelfTimer, SIGNAL(timeout()),
|
|
||||||
SLOT(slotScheduleThisFolder()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Folder::~Folder()
|
Folder::~Folder()
|
||||||
@@ -192,7 +188,7 @@ QString Folder::shortGuiLocalPath() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Folder::ignoreHiddenFiles()
|
bool Folder::ignoreHiddenFiles() const
|
||||||
{
|
{
|
||||||
bool re(_definition.ignoreHiddenFiles);
|
bool re(_definition.ignoreHiddenFiles);
|
||||||
return re;
|
return re;
|
||||||
@@ -225,7 +221,7 @@ QString Folder::remotePath() const
|
|||||||
|
|
||||||
QUrl Folder::remoteUrl() const
|
QUrl Folder::remoteUrl() const
|
||||||
{
|
{
|
||||||
return Utility::concatUrlPath(_accountState->account()->davUrl(), remotePath());
|
return Account::concatUrlPath(_accountState->account()->davUrl(), remotePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Folder::syncPaused() const
|
bool Folder::syncPaused() const
|
||||||
@@ -279,7 +275,7 @@ void Folder::slotRunEtagJob()
|
|||||||
|
|
||||||
AccountPtr account = _accountState->account();
|
AccountPtr account = _accountState->account();
|
||||||
|
|
||||||
if (_requestEtagJob) {
|
if (!_requestEtagJob.isNull()) {
|
||||||
qDebug() << Q_FUNC_INFO << remoteUrl().toString() << "has ETag job queued, not trying to sync";
|
qDebug() << Q_FUNC_INFO << remoteUrl().toString() << "has ETag job queued, not trying to sync";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -289,15 +285,47 @@ void Folder::slotRunEtagJob()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the ordinary etag check for the root folder and schedule a
|
bool forceSyncIntervalExpired =
|
||||||
// sync if it's different.
|
quint64(_timeSinceLastSyncDone.elapsed()) > ConfigFile().forceSyncInterval();
|
||||||
|
bool syncAgainAfterFail = _consecutiveFailingSyncs > 0 && _consecutiveFailingSyncs < 3;
|
||||||
|
|
||||||
_requestEtagJob = new RequestEtagJob(account, remotePath(), this);
|
// There are several conditions under which we trigger a full-discovery sync:
|
||||||
_requestEtagJob->setTimeout(60*1000);
|
// * When a suitably long time has passed since the last sync finished
|
||||||
// check if the etag is different when retrieved
|
// * When the last sync failed (only a couple of times)
|
||||||
QObject::connect(_requestEtagJob, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
|
// * When the last sync requested another sync to be done (only a couple of times)
|
||||||
FolderMan::instance()->slotScheduleETagJob(alias(), _requestEtagJob);
|
//
|
||||||
// The _requestEtagJob is auto deleting itself on finish. Our guard pointer _requestEtagJob will then be null.
|
// Note that the etag check (see below) and the file watcher may also trigger
|
||||||
|
// syncs.
|
||||||
|
if (forceSyncIntervalExpired
|
||||||
|
|| _forceSyncOnPollTimeout
|
||||||
|
|| syncAgainAfterFail) {
|
||||||
|
|
||||||
|
if (forceSyncIntervalExpired) {
|
||||||
|
qDebug() << "** Force Sync, because it has been " << _timeSinceLastSyncDone.elapsed() << "ms "
|
||||||
|
<< "since the last sync";
|
||||||
|
}
|
||||||
|
if (_forceSyncOnPollTimeout) {
|
||||||
|
qDebug() << "** Force Sync, because it was requested";
|
||||||
|
}
|
||||||
|
if (syncAgainAfterFail) {
|
||||||
|
qDebug() << "** Force Sync, because the last"
|
||||||
|
<< _consecutiveFailingSyncs << "syncs failed, last status:"
|
||||||
|
<< _syncResult.statusString();
|
||||||
|
}
|
||||||
|
_forceSyncOnPollTimeout = false;
|
||||||
|
emit scheduleToSync(this);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Do the ordinary etag check for the root folder and only schedule a real
|
||||||
|
// sync if it's different.
|
||||||
|
|
||||||
|
_requestEtagJob = new RequestEtagJob(account, remotePath(), this);
|
||||||
|
_requestEtagJob->setTimeout(60*1000);
|
||||||
|
// check if the etag is different
|
||||||
|
QObject::connect(_requestEtagJob, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
|
||||||
|
FolderMan::instance()->slotScheduleETagJob(alias(), _requestEtagJob);
|
||||||
|
// The _requestEtagJob is auto deleting itself on finish. Our guard pointer _requestEtagJob will then be null.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Folder::etagRetreived(const QString& etag)
|
void Folder::etagRetreived(const QString& etag)
|
||||||
@@ -310,7 +338,7 @@ void Folder::etagRetreived(const QString& etag)
|
|||||||
if (_lastEtag != etag) {
|
if (_lastEtag != etag) {
|
||||||
qDebug() << "* Compare etag with previous etag: last:" << _lastEtag << ", received:" << etag << "-> CHANGED";
|
qDebug() << "* Compare etag with previous etag: last:" << _lastEtag << ", received:" << etag << "-> CHANGED";
|
||||||
_lastEtag = etag;
|
_lastEtag = etag;
|
||||||
slotScheduleThisFolder();
|
emit scheduleToSync(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
_accountState->tagLastSuccessfullETagRequest();
|
_accountState->tagLastSuccessfullETagRequest();
|
||||||
@@ -570,10 +598,7 @@ void Folder::slotWatchedPathChanged(const QString& path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
emit watchedFileChangedExternally(path);
|
emit watchedFileChangedExternally(path);
|
||||||
|
emit scheduleToSync(this);
|
||||||
// Also schedule this folder for a sync, but only after some delay:
|
|
||||||
// The sync will not upload files that were changed too recently.
|
|
||||||
scheduleThisFolderSoon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Folder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
|
void Folder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
|
||||||
@@ -733,6 +758,8 @@ void Folder::startSync(const QStringList &pathList)
|
|||||||
|
|
||||||
QMetaObject::invokeMethod(_engine.data(), "startSync", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(_engine.data(), "startSync", Qt::QueuedConnection);
|
||||||
|
|
||||||
|
// disable events until syncing is done
|
||||||
|
// _watcher->setEventsEnabled(false);
|
||||||
emit syncStarted();
|
emit syncStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -796,6 +823,9 @@ void Folder::slotSyncFinished(bool success)
|
|||||||
bubbleUpSyncResult();
|
bubbleUpSyncResult();
|
||||||
|
|
||||||
bool anotherSyncNeeded = _engine->isAnotherSyncNeeded();
|
bool anotherSyncNeeded = _engine->isAnotherSyncNeeded();
|
||||||
|
// _watcher->setEventsEnabledDelayed(2000);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_csyncError) {
|
if (_csyncError) {
|
||||||
_syncResult.setStatus(SyncResult::Error);
|
_syncResult.setStatus(SyncResult::Error);
|
||||||
@@ -854,10 +884,11 @@ void Folder::slotSyncFinished(bool success)
|
|||||||
// Maybe force a follow-up sync to take place, but only a couple of times.
|
// Maybe force a follow-up sync to take place, but only a couple of times.
|
||||||
if (anotherSyncNeeded && _consecutiveFollowUpSyncs <= 3)
|
if (anotherSyncNeeded && _consecutiveFollowUpSyncs <= 3)
|
||||||
{
|
{
|
||||||
// Sometimes another sync is requested because a local file is still
|
_forceSyncOnPollTimeout = true;
|
||||||
// changing, so wait at least a small amount of time before syncing
|
// We will make sure that the poll timer occurs soon enough.
|
||||||
// the folder again.
|
// delay 1s, 4s, 9s
|
||||||
scheduleThisFolderSoon();
|
int c = _consecutiveFollowUpSyncs;
|
||||||
|
QTimer::singleShot(c*c * 1000, this, SLOT(slotRunEtagJob() ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,17 +969,7 @@ void Folder::slotLogPropagationStart()
|
|||||||
_fileLog->logLap("Propagation starts");
|
_fileLog->logLap("Propagation starts");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Folder::slotScheduleThisFolder()
|
|
||||||
{
|
|
||||||
FolderMan::instance()->scheduleFolder(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Folder::scheduleThisFolderSoon()
|
|
||||||
{
|
|
||||||
if (!_scheduleSelfTimer.isActive()) {
|
|
||||||
_scheduleSelfTimer.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
|
void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
|
||||||
{
|
{
|
||||||
@@ -972,8 +993,10 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
|
|||||||
*cancel = msgBox.clickedButton() == keepBtn;
|
*cancel = msgBox.clickedButton() == keepBtn;
|
||||||
if (*cancel) {
|
if (*cancel) {
|
||||||
wipe();
|
wipe();
|
||||||
|
// speed up next sync
|
||||||
_lastEtag.clear();
|
_lastEtag.clear();
|
||||||
slotScheduleThisFolder();
|
_forceSyncOnPollTimeout = true;
|
||||||
|
QTimer::singleShot(50, this, SLOT(slotRunEtagJob()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-20
@@ -167,7 +167,7 @@ public:
|
|||||||
* Ignore syncing of hidden files or not. This is defined in the
|
* Ignore syncing of hidden files or not. This is defined in the
|
||||||
* folder definition
|
* folder definition
|
||||||
*/
|
*/
|
||||||
bool ignoreHiddenFiles();
|
bool ignoreHiddenFiles() const;
|
||||||
void setIgnoreHiddenFiles(bool ignore);
|
void setIgnoreHiddenFiles(bool ignore);
|
||||||
|
|
||||||
// Used by the Socket API
|
// Used by the Socket API
|
||||||
@@ -178,7 +178,6 @@ public:
|
|||||||
qint64 msecSinceLastSync() const { return _timeSinceLastSyncDone.elapsed(); }
|
qint64 msecSinceLastSync() const { return _timeSinceLastSyncDone.elapsed(); }
|
||||||
qint64 msecLastSyncDuration() const { return _lastSyncDuration; }
|
qint64 msecLastSyncDuration() const { return _lastSyncDuration; }
|
||||||
int consecutiveFollowUpSyncs() const { return _consecutiveFollowUpSyncs; }
|
int consecutiveFollowUpSyncs() const { return _consecutiveFollowUpSyncs; }
|
||||||
int consecutiveFailingSyncs() const { return _consecutiveFailingSyncs; }
|
|
||||||
|
|
||||||
/// Saves the folder data in the account's settings.
|
/// Saves the folder data in the account's settings.
|
||||||
void saveToSettings() const;
|
void saveToSettings() const;
|
||||||
@@ -195,21 +194,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isFileExcludedRelative(const QString& relativePath) const;
|
bool isFileExcludedRelative(const QString& relativePath) const;
|
||||||
|
|
||||||
/** Calls schedules this folder on the FolderMan after a short delay.
|
|
||||||
*
|
|
||||||
* This should be used in situations where a sync should be triggered
|
|
||||||
* because a local file was modified. Syncs don't upload files that were
|
|
||||||
* modified too recently, and this delay ensures the modification is
|
|
||||||
* far enough in the past.
|
|
||||||
*
|
|
||||||
* The delay doesn't reset with subsequent calls.
|
|
||||||
*/
|
|
||||||
void scheduleThisFolderSoon();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void syncStateChange();
|
void syncStateChange();
|
||||||
void syncStarted();
|
void syncStarted();
|
||||||
void syncFinished(const SyncResult &result);
|
void syncFinished(const SyncResult &result);
|
||||||
|
void scheduleToSync(Folder*);
|
||||||
void progressInfo(const ProgressInfo& progress);
|
void progressInfo(const ProgressInfo& progress);
|
||||||
void newBigFolderDiscovered(const QString &); // A new folder bigger than the threshold was discovered
|
void newBigFolderDiscovered(const QString &); // A new folder bigger than the threshold was discovered
|
||||||
void syncPausedChanged(Folder*, bool paused);
|
void syncPausedChanged(Folder*, bool paused);
|
||||||
@@ -277,11 +266,6 @@ private slots:
|
|||||||
|
|
||||||
void slotLogPropagationStart();
|
void slotLogPropagationStart();
|
||||||
|
|
||||||
/** Adds this folder to the list of scheduled folders in the
|
|
||||||
* FolderMan.
|
|
||||||
*/
|
|
||||||
void slotScheduleThisFolder();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool setIgnoredFiles();
|
bool setIgnoredFiles();
|
||||||
|
|
||||||
@@ -318,6 +302,7 @@ private:
|
|||||||
QElapsedTimer _timeSinceLastSyncDone;
|
QElapsedTimer _timeSinceLastSyncDone;
|
||||||
QElapsedTimer _timeSinceLastSyncStart;
|
QElapsedTimer _timeSinceLastSyncStart;
|
||||||
qint64 _lastSyncDuration;
|
qint64 _lastSyncDuration;
|
||||||
|
bool _forceSyncOnPollTimeout;
|
||||||
|
|
||||||
/// The number of syncs that failed in a row.
|
/// The number of syncs that failed in a row.
|
||||||
/// Reset when a sync is successful.
|
/// Reset when a sync is successful.
|
||||||
@@ -332,8 +317,6 @@ private:
|
|||||||
ClientProxy _clientProxy;
|
ClientProxy _clientProxy;
|
||||||
|
|
||||||
QScopedPointer<SyncRunFileLog> _fileLog;
|
QScopedPointer<SyncRunFileLog> _fileLog;
|
||||||
|
|
||||||
QTimer _scheduleSelfTimer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-79
@@ -64,17 +64,11 @@ FolderMan::FolderMan(QObject *parent) :
|
|||||||
connect(&_startScheduledSyncTimer, SIGNAL(timeout()),
|
connect(&_startScheduledSyncTimer, SIGNAL(timeout()),
|
||||||
SLOT(slotStartScheduledFolderSync()));
|
SLOT(slotStartScheduledFolderSync()));
|
||||||
|
|
||||||
_timeScheduler.setInterval(5000);
|
|
||||||
_timeScheduler.setSingleShot(false);
|
|
||||||
connect(&_timeScheduler, SIGNAL(timeout()),
|
|
||||||
SLOT(slotScheduleFolderByTime()));
|
|
||||||
_timeScheduler.start();
|
|
||||||
|
|
||||||
connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)),
|
connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)),
|
||||||
SLOT(slotRemoveFoldersForAccount(AccountState*)));
|
SLOT(slotRemoveFoldersForAccount(AccountState*)));
|
||||||
|
|
||||||
connect(_lockWatcher.data(), SIGNAL(fileUnlocked(QString)),
|
connect(_lockWatcher.data(), SIGNAL(fileUnlocked(QString)),
|
||||||
SLOT(slotWatchedFileUnlocked(QString)));
|
SLOT(slotScheduleFolderOwningFile(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderMan *FolderMan::instance()
|
FolderMan *FolderMan::instance()
|
||||||
@@ -106,6 +100,8 @@ void FolderMan::unloadFolder( Folder *f )
|
|||||||
}
|
}
|
||||||
_folderMap.remove( f->alias() );
|
_folderMap.remove( f->alias() );
|
||||||
|
|
||||||
|
disconnect(f, SIGNAL(scheduleToSync(Folder*)),
|
||||||
|
this, SLOT(slotScheduleSync(Folder*)));
|
||||||
disconnect(f, SIGNAL(syncStarted()),
|
disconnect(f, SIGNAL(syncStarted()),
|
||||||
this, SLOT(slotFolderSyncStarted()));
|
this, SLOT(slotFolderSyncStarted()));
|
||||||
disconnect(f, SIGNAL(syncFinished(SyncResult)),
|
disconnect(f, SIGNAL(syncFinished(SyncResult)),
|
||||||
@@ -135,7 +131,7 @@ int FolderMan::unloadAndDeleteAllFolders()
|
|||||||
}
|
}
|
||||||
_lastSyncFolder = 0;
|
_lastSyncFolder = 0;
|
||||||
_currentSyncFolder = 0;
|
_currentSyncFolder = 0;
|
||||||
_scheduledFolders.clear();
|
_scheduleQueue.clear();
|
||||||
emit scheduleQueueChanged();
|
emit scheduleQueueChanged();
|
||||||
|
|
||||||
Q_ASSERT(_folderMap.count() == 0);
|
Q_ASSERT(_folderMap.count() == 0);
|
||||||
@@ -191,7 +187,7 @@ int FolderMan::setupFolders()
|
|||||||
{
|
{
|
||||||
unloadAndDeleteAllFolders();
|
unloadAndDeleteAllFolders();
|
||||||
|
|
||||||
auto settings = Utility::settingsWithGroup(QLatin1String("Accounts"));
|
auto settings = Account::settingsWithGroup(QLatin1String("Accounts"));
|
||||||
const auto accountsWithSettings = settings->childGroups();
|
const auto accountsWithSettings = settings->childGroups();
|
||||||
if (accountsWithSettings.isEmpty()) {
|
if (accountsWithSettings.isEmpty()) {
|
||||||
int r = setupFoldersMigration();
|
int r = setupFoldersMigration();
|
||||||
@@ -215,7 +211,7 @@ int FolderMan::setupFolders()
|
|||||||
if (FolderDefinition::load(*settings, folderAlias, &folderDefinition)) {
|
if (FolderDefinition::load(*settings, folderAlias, &folderDefinition)) {
|
||||||
Folder* f = addFolderInternal(std::move(folderDefinition), account.data());
|
Folder* f = addFolderInternal(std::move(folderDefinition), account.data());
|
||||||
if (f) {
|
if (f) {
|
||||||
scheduleFolder(f);
|
slotScheduleSync(f);
|
||||||
emit folderSyncStateChange(f);
|
emit folderSyncStateChange(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,7 +244,7 @@ int FolderMan::setupFoldersMigration()
|
|||||||
foreach ( const QString& alias, list ) {
|
foreach ( const QString& alias, list ) {
|
||||||
Folder *f = setupFolderFromOldConfigFile( alias, accountState );
|
Folder *f = setupFolderFromOldConfigFile( alias, accountState );
|
||||||
if( f ) {
|
if( f ) {
|
||||||
scheduleFolder(f);
|
slotScheduleSync(f);
|
||||||
emit folderSyncStateChange(f);
|
emit folderSyncStateChange(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,7 +422,7 @@ void FolderMan::slotFolderSyncPaused( Folder *f, bool paused )
|
|||||||
|
|
||||||
if (!paused) {
|
if (!paused) {
|
||||||
_disabledFolders.remove(f);
|
_disabledFolders.remove(f);
|
||||||
scheduleFolder(f);
|
slotScheduleSync(f);
|
||||||
} else {
|
} else {
|
||||||
_disabledFolders.insert(f);
|
_disabledFolders.insert(f);
|
||||||
}
|
}
|
||||||
@@ -466,11 +462,11 @@ Folder *FolderMan::folder( const QString& alias )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderMan::scheduleAllFolders()
|
void FolderMan::slotScheduleAllFolders()
|
||||||
{
|
{
|
||||||
foreach( Folder *f, _folderMap.values() ) {
|
foreach( Folder *f, _folderMap.values() ) {
|
||||||
if (f && f->canSync()) {
|
if (f && f->canSync()) {
|
||||||
scheduleFolder( f );
|
slotScheduleSync( f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -490,7 +486,7 @@ void FolderMan::slotSyncOnceFileUnlocks(const QString& path)
|
|||||||
* if a folder wants to be synced, it calls this slot and is added
|
* if a folder wants to be synced, it calls this slot and is added
|
||||||
* to the queue. The slot to actually start a sync is called afterwards.
|
* to the queue. The slot to actually start a sync is called afterwards.
|
||||||
*/
|
*/
|
||||||
void FolderMan::scheduleFolder( Folder *f )
|
void FolderMan::slotScheduleSync( Folder *f )
|
||||||
{
|
{
|
||||||
if( !f ) {
|
if( !f ) {
|
||||||
qWarning() << "slotScheduleSync called with null folder";
|
qWarning() << "slotScheduleSync called with null folder";
|
||||||
@@ -500,7 +496,7 @@ void FolderMan::scheduleFolder( Folder *f )
|
|||||||
|
|
||||||
qDebug() << "Schedule folder " << alias << " to sync!";
|
qDebug() << "Schedule folder " << alias << " to sync!";
|
||||||
|
|
||||||
if( ! _scheduledFolders.contains(f) ) {
|
if( ! _scheduleQueue.contains(f) ) {
|
||||||
if( !f->canSync() ) {
|
if( !f->canSync() ) {
|
||||||
qDebug() << "Folder is not ready to sync, not scheduled!";
|
qDebug() << "Folder is not ready to sync, not scheduled!";
|
||||||
_socketApi->slotUpdateFolderView(f);
|
_socketApi->slotUpdateFolderView(f);
|
||||||
@@ -508,7 +504,7 @@ void FolderMan::scheduleFolder( Folder *f )
|
|||||||
}
|
}
|
||||||
f->prepareToSync();
|
f->prepareToSync();
|
||||||
emit folderSyncStateChange(f);
|
emit folderSyncStateChange(f);
|
||||||
_scheduledFolders.enqueue(f);
|
_scheduleQueue.enqueue(f);
|
||||||
emit scheduleQueueChanged();
|
emit scheduleQueueChanged();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
|
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
|
||||||
@@ -572,7 +568,7 @@ void FolderMan::slotAccountStateChanged()
|
|||||||
if (f
|
if (f
|
||||||
&& f->canSync()
|
&& f->canSync()
|
||||||
&& f->accountState() == accountState) {
|
&& f->accountState() == accountState) {
|
||||||
scheduleFolder(f);
|
slotScheduleSync(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -584,7 +580,7 @@ void FolderMan::slotAccountStateChanged()
|
|||||||
_currentSyncFolder->slotTerminateSync();
|
_currentSyncFolder->slotTerminateSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
QMutableListIterator<Folder*> it(_scheduledFolders);
|
QMutableListIterator<Folder*> it(_scheduleQueue);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Folder* f = it.next();
|
Folder* f = it.next();
|
||||||
if (f->accountState() == accountState) {
|
if (f->accountState() == accountState) {
|
||||||
@@ -599,7 +595,7 @@ void FolderMan::slotAccountStateChanged()
|
|||||||
// this is not the same as Pause and Resume of folders.
|
// this is not the same as Pause and Resume of folders.
|
||||||
void FolderMan::setSyncEnabled( bool enabled )
|
void FolderMan::setSyncEnabled( bool enabled )
|
||||||
{
|
{
|
||||||
if (!_syncEnabled && enabled && !_scheduledFolders.isEmpty()) {
|
if (!_syncEnabled && enabled && !_scheduleQueue.isEmpty()) {
|
||||||
// We have things in our queue that were waiting for the connection to come back on.
|
// We have things in our queue that were waiting for the connection to come back on.
|
||||||
startScheduledSyncSoon();
|
startScheduledSyncSoon();
|
||||||
}
|
}
|
||||||
@@ -608,19 +604,19 @@ void FolderMan::setSyncEnabled( bool enabled )
|
|||||||
emit( folderSyncStateChange(0) );
|
emit( folderSyncStateChange(0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderMan::startScheduledSyncSoon()
|
void FolderMan::startScheduledSyncSoon(qint64 msMinimumDelay)
|
||||||
{
|
{
|
||||||
if (_startScheduledSyncTimer.isActive()) {
|
if (_startScheduledSyncTimer.isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_scheduledFolders.empty()) {
|
if (_scheduleQueue.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_currentSyncFolder) {
|
if (_currentSyncFolder) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 msDelay = 100; // 100ms minimum delay
|
qint64 msDelay = msMinimumDelay;
|
||||||
qint64 msSinceLastSync = 0;
|
qint64 msSinceLastSync = 0;
|
||||||
|
|
||||||
// Require a pause based on the duration of the last sync run.
|
// Require a pause based on the duration of the last sync run.
|
||||||
@@ -635,6 +631,15 @@ void FolderMan::startScheduledSyncSoon()
|
|||||||
msDelay = qMax(msDelay, pause);
|
msDelay = qMax(msDelay, pause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Punish consecutive follow-up syncs with longer delays.
|
||||||
|
if (Folder* nextFolder = _scheduleQueue.head()) {
|
||||||
|
int followUps = nextFolder->consecutiveFollowUpSyncs();
|
||||||
|
if (followUps >= 2) {
|
||||||
|
// This is okay due to the 1min maximum delay limit below.
|
||||||
|
msDelay *= qPow(followUps, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delays beyond one minute seem too big, particularly since there
|
// Delays beyond one minute seem too big, particularly since there
|
||||||
// could be things later in the queue that shouldn't be punished by a
|
// could be things later in the queue that shouldn't be punished by a
|
||||||
// long delay!
|
// long delay!
|
||||||
@@ -643,7 +648,11 @@ void FolderMan::startScheduledSyncSoon()
|
|||||||
// Time since the last sync run counts against the delay
|
// Time since the last sync run counts against the delay
|
||||||
msDelay = qMax(1ll, msDelay - msSinceLastSync);
|
msDelay = qMax(1ll, msDelay - msSinceLastSync);
|
||||||
|
|
||||||
qDebug() << "Starting the next scheduled sync in" << (msDelay/1000) << "seconds";
|
// A minimum of delay here is essential as the sync will not upload
|
||||||
|
// files that were changed too recently.
|
||||||
|
msDelay = qMax(SyncEngine::minimumFileAgeForUpload, msDelay);
|
||||||
|
|
||||||
|
qDebug() << "Scheduling a sync in" << (msDelay/1000) << "seconds";
|
||||||
_startScheduledSyncTimer.start(msDelay);
|
_startScheduledSyncTimer.start(msDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -664,15 +673,15 @@ void FolderMan::slotStartScheduledFolderSync()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduledFolders.count();
|
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduleQueue.count();
|
||||||
if( _scheduledFolders.isEmpty() ) {
|
if( _scheduleQueue.isEmpty() ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the first folder in the queue that can be synced.
|
// Find the first folder in the queue that can be synced.
|
||||||
Folder* f = 0;
|
Folder* f = 0;
|
||||||
while( !_scheduledFolders.isEmpty() ) {
|
while( !_scheduleQueue.isEmpty() ) {
|
||||||
f = _scheduledFolders.dequeue();
|
f = _scheduleQueue.dequeue();
|
||||||
Q_ASSERT(f);
|
Q_ASSERT(f);
|
||||||
|
|
||||||
if( f->canSync() ) {
|
if( f->canSync() ) {
|
||||||
@@ -702,7 +711,7 @@ void FolderMan::slotEtagPollTimerTimeout()
|
|||||||
if (_currentSyncFolder == f) {
|
if (_currentSyncFolder == f) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (_scheduledFolders.contains(f)) {
|
if (_scheduleQueue.contains(f)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (_disabledFolders.contains(f)) {
|
if (_disabledFolders.contains(f)) {
|
||||||
@@ -731,7 +740,7 @@ void FolderMan::slotRemoveFoldersForAccount(AccountState* accountState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (const auto &f, foldersToRemove) {
|
foreach (const auto &f, foldersToRemove) {
|
||||||
removeFolder(f);
|
slotRemoveFolder(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,54 +766,10 @@ void FolderMan::slotServerVersionChanged(Account *account)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderMan::slotWatchedFileUnlocked(const QString& path)
|
void FolderMan::slotScheduleFolderOwningFile(const QString& path)
|
||||||
{
|
{
|
||||||
if (Folder* f = folderForPath(path)) {
|
if (Folder* f = folderForPath(path)) {
|
||||||
f->scheduleThisFolderSoon();
|
slotScheduleSync(f);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FolderMan::slotScheduleFolderByTime()
|
|
||||||
{
|
|
||||||
foreach (auto& f, _folderMap) {
|
|
||||||
// Never schedule if syncing is disabled or when we're currently
|
|
||||||
// querying the server for etags
|
|
||||||
if (!f->canSync() || f->etagJob()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto msecsSinceSync = f->msecSinceLastSync();
|
|
||||||
|
|
||||||
// Possibly it's just time for a new sync run
|
|
||||||
bool forceSyncIntervalExpired =
|
|
||||||
quint64(msecsSinceSync) > ConfigFile().forceSyncInterval();
|
|
||||||
if (forceSyncIntervalExpired) {
|
|
||||||
qDebug() << "** scheduling folder" << f->alias()
|
|
||||||
<< "because it has been" << msecsSinceSync << "ms "
|
|
||||||
<< "since the last sync";
|
|
||||||
|
|
||||||
scheduleFolder(f);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retry a couple of times after failure
|
|
||||||
bool syncAgainAfterFail = f->consecutiveFailingSyncs() > 0 && f->consecutiveFailingSyncs() < 3;
|
|
||||||
qint64 syncAgainAfterFailDelay = 10 * 1000; // 10s for the first retry-after-fail
|
|
||||||
if (f->consecutiveFailingSyncs() > 1)
|
|
||||||
syncAgainAfterFailDelay = 60 * 1000; // 60s for each further attempt
|
|
||||||
if (syncAgainAfterFail
|
|
||||||
&& msecsSinceSync > syncAgainAfterFailDelay) {
|
|
||||||
qDebug() << "** scheduling folder" << f->alias()
|
|
||||||
<< "because the last"
|
|
||||||
<< f->consecutiveFailingSyncs() << "syncs failed, last status:"
|
|
||||||
<< f->syncResult().statusString()
|
|
||||||
<< "time since last sync:" << msecsSinceSync;
|
|
||||||
|
|
||||||
scheduleFolder(f);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do we want to retry failing syncs or another-sync-needed runs more often?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -862,6 +827,7 @@ Folder* FolderMan::addFolderInternal(FolderDefinition folderDefinition, AccountS
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See matching disconnects in unloadFolder().
|
// See matching disconnects in unloadFolder().
|
||||||
|
connect(folder, SIGNAL(scheduleToSync(Folder*)), SLOT(slotScheduleSync(Folder*)));
|
||||||
connect(folder, SIGNAL(syncStarted()), SLOT(slotFolderSyncStarted()));
|
connect(folder, SIGNAL(syncStarted()), SLOT(slotFolderSyncStarted()));
|
||||||
connect(folder, SIGNAL(syncFinished(SyncResult)), SLOT(slotFolderSyncFinished(SyncResult)));
|
connect(folder, SIGNAL(syncFinished(SyncResult)), SLOT(slotFolderSyncFinished(SyncResult)));
|
||||||
connect(folder, SIGNAL(syncStateChange()), SLOT(slotForwardFolderSyncStateChange()));
|
connect(folder, SIGNAL(syncStateChange()), SLOT(slotForwardFolderSyncStateChange()));
|
||||||
@@ -914,7 +880,7 @@ QStringList FolderMan::findFileInLocalFolders( const QString& relPath, const Acc
|
|||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderMan::removeFolder( Folder *f )
|
void FolderMan::slotRemoveFolder( Folder *f )
|
||||||
{
|
{
|
||||||
if( !f ) {
|
if( !f ) {
|
||||||
qWarning() << "!! Can not remove null folder";
|
qWarning() << "!! Can not remove null folder";
|
||||||
@@ -929,7 +895,7 @@ void FolderMan::removeFolder( Folder *f )
|
|||||||
terminateSyncProcess();
|
terminateSyncProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_scheduledFolders.removeAll(f) > 0) {
|
if (_scheduleQueue.removeAll(f) > 0) {
|
||||||
emit scheduleQueueChanged();
|
emit scheduleQueueChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1296,7 +1262,7 @@ void FolderMan::setIgnoreHiddenFiles(bool ignore)
|
|||||||
|
|
||||||
QQueue<Folder*> FolderMan::scheduleQueue() const
|
QQueue<Folder*> FolderMan::scheduleQueue() const
|
||||||
{
|
{
|
||||||
return _scheduledFolders;
|
return _scheduleQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Folder *FolderMan::currentSyncFolder() const
|
Folder *FolderMan::currentSyncFolder() const
|
||||||
|
|||||||
+43
-94
@@ -37,26 +37,6 @@ class LockWatcher;
|
|||||||
/**
|
/**
|
||||||
* @brief The FolderMan class
|
* @brief The FolderMan class
|
||||||
* @ingroup gui
|
* @ingroup gui
|
||||||
*
|
|
||||||
* The FolderMan knows about all loaded folders and is responsible for
|
|
||||||
* scheduling them when necessary.
|
|
||||||
*
|
|
||||||
* A folder is scheduled if:
|
|
||||||
* - The configured force-sync-interval has expired
|
|
||||||
* (_timeScheduler and slotScheduleFolderByTime())
|
|
||||||
*
|
|
||||||
* - A folder watcher receives a notification about a file change
|
|
||||||
* (_folderWatchers and Folder::slotWatchedPathChanged())
|
|
||||||
*
|
|
||||||
* - The folder etag on the server has changed
|
|
||||||
* (_etagPollTimer)
|
|
||||||
*
|
|
||||||
* - The locks of a monitored file are released
|
|
||||||
* (_lockWatcher and slotWatchedFileUnlocked())
|
|
||||||
*
|
|
||||||
* - There was a sync error or a follow-up sync is requested
|
|
||||||
* (_timeScheduler and slotScheduleFolderByTime()
|
|
||||||
* and Folder::slotSyncFinished())
|
|
||||||
*/
|
*/
|
||||||
class FolderMan : public QObject
|
class FolderMan : public QObject
|
||||||
{
|
{
|
||||||
@@ -74,9 +54,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Folder* addFolder(AccountState* accountState, const FolderDefinition& folderDefinition);
|
Folder* addFolder(AccountState* accountState, const FolderDefinition& folderDefinition);
|
||||||
|
|
||||||
/** Removes a folder */
|
|
||||||
void removeFolder( Folder* );
|
|
||||||
|
|
||||||
/** Returns the folder which the file or directory stored in path is in */
|
/** Returns the folder which the file or directory stored in path is in */
|
||||||
Folder* folderForPath(const QString& path);
|
Folder* folderForPath(const QString& path);
|
||||||
|
|
||||||
@@ -149,24 +126,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Folder* currentSyncFolder() const;
|
Folder* currentSyncFolder() const;
|
||||||
|
|
||||||
/** Removes all folders */
|
|
||||||
int unloadAndDeleteAllFolders();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If enabled is set to false, no new folders will start to sync.
|
|
||||||
* The current one will finish.
|
|
||||||
*/
|
|
||||||
void setSyncEnabled( bool );
|
|
||||||
|
|
||||||
/** Queues a folder for syncing. */
|
|
||||||
void scheduleFolder(Folder*);
|
|
||||||
|
|
||||||
/** Queues all folders for syncing. */
|
|
||||||
void scheduleAllFolders();
|
|
||||||
|
|
||||||
void setDirtyProxy(bool value = true);
|
|
||||||
void setDirtyNetworkLimits();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* signal to indicate a folder has changed its sync state.
|
* signal to indicate a folder has changed its sync state.
|
||||||
@@ -180,12 +139,41 @@ signals:
|
|||||||
*/
|
*/
|
||||||
void scheduleQueueChanged();
|
void scheduleQueueChanged();
|
||||||
|
|
||||||
/**
|
|
||||||
* Emitted whenever the list of configured folders changes.
|
|
||||||
*/
|
|
||||||
void folderListChanged(const Folder::Map &);
|
void folderListChanged(const Folder::Map &);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void slotRemoveFolder( Folder* );
|
||||||
|
void slotFolderSyncPaused(Folder *, bool paused);
|
||||||
|
void slotFolderCanSyncChanged();
|
||||||
|
|
||||||
|
void slotFolderSyncStarted();
|
||||||
|
void slotFolderSyncFinished( const SyncResult& );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Terminates the current folder sync.
|
||||||
|
*
|
||||||
|
* It does not switch the folder to paused state.
|
||||||
|
*/
|
||||||
|
void terminateSyncProcess();
|
||||||
|
|
||||||
|
/* delete all folder objects */
|
||||||
|
int unloadAndDeleteAllFolders();
|
||||||
|
|
||||||
|
// if enabled is set to false, no new folders will start to sync.
|
||||||
|
// the current one will finish.
|
||||||
|
void setSyncEnabled( bool );
|
||||||
|
|
||||||
|
void slotScheduleAllFolders();
|
||||||
|
|
||||||
|
void setDirtyProxy(bool value = true);
|
||||||
|
void setDirtyNetworkLimits();
|
||||||
|
|
||||||
|
// slot to add a folder to the syncing queue
|
||||||
|
void slotScheduleSync(Folder*);
|
||||||
|
// slot to schedule an ETag job
|
||||||
|
void slotScheduleETagJob ( const QString &alias, RequestEtagJob *job);
|
||||||
|
void slotEtagJobDestroyed (QObject*);
|
||||||
|
void slotRunOneEtagJob();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules folders of newly connected accounts, terminates and
|
* Schedules folders of newly connected accounts, terminates and
|
||||||
@@ -202,22 +190,10 @@ public slots:
|
|||||||
* Triggers a sync run once the lock on the given file is removed.
|
* Triggers a sync run once the lock on the given file is removed.
|
||||||
*
|
*
|
||||||
* Automatically detemines the folder that's responsible for the file.
|
* Automatically detemines the folder that's responsible for the file.
|
||||||
* See slotWatchedFileUnlocked().
|
|
||||||
*/
|
*/
|
||||||
void slotSyncOnceFileUnlocks(const QString& path);
|
void slotSyncOnceFileUnlocks(const QString& path);
|
||||||
|
|
||||||
// slot to schedule an ETag job (from Folder only)
|
|
||||||
void slotScheduleETagJob ( const QString &alias, RequestEtagJob *job);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotFolderSyncPaused(Folder *, bool paused);
|
|
||||||
void slotFolderCanSyncChanged();
|
|
||||||
void slotFolderSyncStarted();
|
|
||||||
void slotFolderSyncFinished( const SyncResult& );
|
|
||||||
|
|
||||||
void slotRunOneEtagJob();
|
|
||||||
void slotEtagJobDestroyed (QObject*);
|
|
||||||
|
|
||||||
// slot to take the next folder from queue and start syncing.
|
// slot to take the next folder from queue and start syncing.
|
||||||
void slotStartScheduledFolderSync();
|
void slotStartScheduledFolderSync();
|
||||||
void slotEtagPollTimerTimeout();
|
void slotEtagPollTimerTimeout();
|
||||||
@@ -231,29 +207,12 @@ private slots:
|
|||||||
void slotServerVersionChanged(Account* account);
|
void slotServerVersionChanged(Account* account);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A file whose locks were being monitored has become unlocked.
|
* Schedules the folder for synchronization that contains
|
||||||
*
|
|
||||||
* This schedules the folder for synchronization that contains
|
|
||||||
* the file with the given path.
|
* the file with the given path.
|
||||||
*/
|
*/
|
||||||
void slotWatchedFileUnlocked(const QString& path);
|
void slotScheduleFolderOwningFile(const QString& path);
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedules folders whose time to sync has come.
|
|
||||||
*
|
|
||||||
* Either because a long time has passed since the last sync or
|
|
||||||
* because of previous failures.
|
|
||||||
*/
|
|
||||||
void slotScheduleFolderByTime();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
|
||||||
* Terminates the current folder sync.
|
|
||||||
*
|
|
||||||
* It does not switch the folder to paused state.
|
|
||||||
*/
|
|
||||||
void terminateSyncProcess();
|
|
||||||
|
|
||||||
/** Adds a new folder, does not add it to the account settings and
|
/** Adds a new folder, does not add it to the account settings and
|
||||||
* does not set an account on the new folder.
|
* does not set an account on the new folder.
|
||||||
*/
|
*/
|
||||||
@@ -263,7 +222,7 @@ private:
|
|||||||
void unloadFolder( Folder * );
|
void unloadFolder( Folder * );
|
||||||
|
|
||||||
/** Will start a sync after a bit of delay. */
|
/** Will start a sync after a bit of delay. */
|
||||||
void startScheduledSyncSoon();
|
void startScheduledSyncSoon(qint64 msMinimumDelay = 0);
|
||||||
|
|
||||||
// finds all folder configuration files
|
// finds all folder configuration files
|
||||||
// and create the folders
|
// and create the folders
|
||||||
@@ -279,29 +238,19 @@ private:
|
|||||||
Folder *_currentSyncFolder;
|
Folder *_currentSyncFolder;
|
||||||
QPointer<Folder> _lastSyncFolder;
|
QPointer<Folder> _lastSyncFolder;
|
||||||
bool _syncEnabled;
|
bool _syncEnabled;
|
||||||
|
QTimer _etagPollTimer;
|
||||||
|
QPointer<RequestEtagJob> _currentEtagJob; // alias of Folder running the current RequestEtagJob
|
||||||
|
|
||||||
/// Watching for file changes in folders
|
|
||||||
QMap<QString, FolderWatcher*> _folderWatchers;
|
QMap<QString, FolderWatcher*> _folderWatchers;
|
||||||
|
|
||||||
/// Starts regular etag query jobs
|
|
||||||
QTimer _etagPollTimer;
|
|
||||||
/// The currently running etag query
|
|
||||||
QPointer<RequestEtagJob> _currentEtagJob;
|
|
||||||
|
|
||||||
/// Watches files that couldn't be synced due to locks
|
|
||||||
QScopedPointer<LockWatcher> _lockWatcher;
|
QScopedPointer<LockWatcher> _lockWatcher;
|
||||||
|
|
||||||
/// Occasionally schedules folders
|
|
||||||
QTimer _timeScheduler;
|
|
||||||
|
|
||||||
/// Scheduled folders that should be synced as soon as possible
|
|
||||||
QQueue<Folder*> _scheduledFolders;
|
|
||||||
|
|
||||||
/// Picks the next scheduled folder and starts the sync
|
|
||||||
QTimer _startScheduledSyncTimer;
|
|
||||||
|
|
||||||
QScopedPointer<SocketApi> _socketApi;
|
QScopedPointer<SocketApi> _socketApi;
|
||||||
|
|
||||||
|
/** The aliases of folders that shall be synced. */
|
||||||
|
QQueue<Folder*> _scheduleQueue;
|
||||||
|
|
||||||
|
/** When the timer expires one of the scheduled syncs will be started. */
|
||||||
|
QTimer _startScheduledSyncTimer;
|
||||||
|
|
||||||
bool _appRestartRequired;
|
bool _appRestartRequired;
|
||||||
|
|
||||||
static FolderMan *_instance;
|
static FolderMan *_instance;
|
||||||
|
|||||||
@@ -785,7 +785,7 @@ void FolderStatusModel::slotApplySelectiveSync()
|
|||||||
foreach(const auto &it, changes) {
|
foreach(const auto &it, changes) {
|
||||||
folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
||||||
}
|
}
|
||||||
FolderMan::instance()->scheduleFolder(folder);
|
FolderMan::instance()->slotScheduleSync(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1099,7 +1099,7 @@ void FolderStatusModel::slotSyncAllPendingBigFolders()
|
|||||||
foreach (const auto &it, undecidedList) {
|
foreach (const auto &it, undecidedList) {
|
||||||
folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
||||||
}
|
}
|
||||||
FolderMan::instance()->scheduleFolder(folder);
|
FolderMan::instance()->slotScheduleSync(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFolders();
|
resetFolders();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QVarLengthArray>
|
#include <QVarLengthArray>
|
||||||
|
#include <syncengine.h>
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
@@ -48,31 +49,6 @@ FolderWatcherPrivate::~FolderWatcherPrivate()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// attention: result list passed by reference!
|
|
||||||
bool FolderWatcherPrivate::findFoldersBelow( const QDir& dir, QStringList& fullList )
|
|
||||||
{
|
|
||||||
bool ok = true;
|
|
||||||
if( !(dir.exists() && dir.isReadable()) ) {
|
|
||||||
qDebug() << "Non existing path coming in: " << dir.absolutePath();
|
|
||||||
ok = false;
|
|
||||||
} else {
|
|
||||||
QStringList nameFilter;
|
|
||||||
nameFilter << QLatin1String("*");
|
|
||||||
QDir::Filters filter = QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks | QDir::Hidden;
|
|
||||||
const QStringList pathes = dir.entryList(nameFilter, filter);
|
|
||||||
|
|
||||||
QStringList::const_iterator constIterator;
|
|
||||||
for (constIterator = pathes.constBegin(); constIterator != pathes.constEnd();
|
|
||||||
++constIterator) {
|
|
||||||
const QString fullPath(dir.path()+QLatin1String("/")+(*constIterator));
|
|
||||||
fullList.append(fullPath);
|
|
||||||
ok = findFoldersBelow(QDir(fullPath), fullList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FolderWatcherPrivate::inotifyRegisterPath(const QString& path)
|
void FolderWatcherPrivate::inotifyRegisterPath(const QString& path)
|
||||||
{
|
{
|
||||||
if( !path.isEmpty()) {
|
if( !path.isEmpty()) {
|
||||||
@@ -88,41 +64,47 @@ void FolderWatcherPrivate::inotifyRegisterPath(const QString& path)
|
|||||||
|
|
||||||
void FolderWatcherPrivate::slotAddFolderRecursive(const QString &path)
|
void FolderWatcherPrivate::slotAddFolderRecursive(const QString &path)
|
||||||
{
|
{
|
||||||
int subdirs = 0;
|
|
||||||
qDebug() << "(+) Watcher:" << path;
|
qDebug() << "(+) Watcher:" << path;
|
||||||
|
|
||||||
QDir inPath(path);
|
|
||||||
inotifyRegisterPath(inPath.absolutePath());
|
|
||||||
|
|
||||||
const QStringList watchedFolders = _watches.values();
|
const QStringList watchedFolders = _watches.values();
|
||||||
|
int subdirs = addFolderRecursiveHelper(path, watchedFolders.toSet());
|
||||||
QStringList allSubfolders;
|
|
||||||
if( !findFoldersBelow(QDir(path), allSubfolders)) {
|
|
||||||
qDebug() << "Could not traverse all sub folders";
|
|
||||||
}
|
|
||||||
// qDebug() << "currently watching " << watchedFolders;
|
|
||||||
QStringListIterator subfoldersIt(allSubfolders);
|
|
||||||
while (subfoldersIt.hasNext()) {
|
|
||||||
QString subfolder = subfoldersIt.next();
|
|
||||||
// qDebug() << " (**) subfolder: " << subfolder;
|
|
||||||
QDir folder (subfolder);
|
|
||||||
if (folder.exists() && !watchedFolders.contains(folder.absolutePath())) {
|
|
||||||
subdirs++;
|
|
||||||
if( _parent->pathIsIgnored(subfolder) ) {
|
|
||||||
qDebug() << "* Not adding" << folder.path();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
inotifyRegisterPath(folder.absolutePath());
|
|
||||||
} else {
|
|
||||||
qDebug() << " `-> discarded:" << folder.path();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subdirs >0) {
|
if (subdirs >0) {
|
||||||
qDebug() << " `-> and" << subdirs << "subdirectories";
|
qDebug() << " `-> and" << subdirs << "subdirectories";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FolderWatcherPrivate::addFolderRecursiveHelper(const QString &path, const QSet<QString> &watchedFolders)
|
||||||
|
{
|
||||||
|
QDir dir(path);
|
||||||
|
if( !(dir.exists() && dir.isReadable()) ) {
|
||||||
|
qDebug() << "Non existing path coming in: " << dir.absolutePath();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int subdirs = 1;
|
||||||
|
|
||||||
|
inotifyRegisterPath(dir.absolutePath());
|
||||||
|
|
||||||
|
QDir::Filters filter = QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks | QDir::Hidden;
|
||||||
|
const QStringList pathes = dir.entryList(filter);
|
||||||
|
for (auto constIterator = pathes.constBegin(); constIterator != pathes.constEnd(); ++constIterator) {
|
||||||
|
const QString subfolder = path + QLatin1String("/") + (*constIterator);
|
||||||
|
QDir folder(subfolder);
|
||||||
|
if (folder.exists() && !watchedFolders.contains(subfolder)) {
|
||||||
|
#ifndef OWNCLOUD_TEST // InotifyWatcherTest is not interested in ignored files and does not link against the folder
|
||||||
|
if( _parent->_folder->syncEngine().excludedFiles().isExcluded(
|
||||||
|
subfolder, path, _parent->_folder->ignoreHiddenFiles())) {
|
||||||
|
qDebug() << "* Not adding" << folder.path();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
subdirs += addFolderRecursiveHelper(subfolder, watchedFolders);
|
||||||
|
} else {
|
||||||
|
qDebug() << " `-> discarded:" << folder.path();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return subdirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void FolderWatcherPrivate::slotReceivedNotification(int fd)
|
void FolderWatcherPrivate::slotReceivedNotification(int fd)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class FolderWatcherPrivate : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FolderWatcherPrivate() { }
|
|
||||||
FolderWatcherPrivate(FolderWatcher *p, const QString &path);
|
FolderWatcherPrivate(FolderWatcher *p, const QString &path);
|
||||||
~FolderWatcherPrivate();
|
~FolderWatcherPrivate();
|
||||||
|
|
||||||
@@ -45,10 +44,9 @@ protected slots:
|
|||||||
void slotAddFolderRecursive(const QString &path);
|
void slotAddFolderRecursive(const QString &path);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool findFoldersBelow( const QDir& dir, QStringList& fullList );
|
int addFolderRecursiveHelper(const QString &path, const QSet<QString> &watchedFolders);
|
||||||
void inotifyRegisterPath(const QString& path);
|
void inotifyRegisterPath(const QString& path);
|
||||||
|
|
||||||
private:
|
|
||||||
FolderWatcher *_parent;
|
FolderWatcher *_parent;
|
||||||
|
|
||||||
QString _folder;
|
QString _folder;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ void IgnoreListEditor::slotUpdateLocalIgnoreList()
|
|||||||
// ignored (because the remote etag did not change) (issue #3172)
|
// ignored (because the remote etag did not change) (issue #3172)
|
||||||
foreach (Folder* folder, folderMan->map()) {
|
foreach (Folder* folder, folderMan->map()) {
|
||||||
folder->journalDb()->forceRemoteDiscoveryNextSync();
|
folder->journalDb()->forceRemoteDiscoveryNextSync();
|
||||||
folderMan->scheduleFolder(folder);
|
folderMan->slotScheduleSync(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExcludedFiles::instance().reloadExcludes();
|
ExcludedFiles::instance().reloadExcludes();
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void OcsJob::start()
|
|||||||
req.setRawHeader("Ocs-APIREQUEST", "true");
|
req.setRawHeader("Ocs-APIREQUEST", "true");
|
||||||
req.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
|
req.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
|
||||||
QUrl url = Utility::concatUrlPath(account()->url(), path());
|
QUrl url = Account::concatUrlPath(account()->url(), path());
|
||||||
QBuffer *buffer = new QBuffer;
|
QBuffer *buffer = new QBuffer;
|
||||||
|
|
||||||
if (_verb == "GET") {
|
if (_verb == "GET") {
|
||||||
@@ -107,7 +107,7 @@ bool OcsJob::finished()
|
|||||||
if (!success) {
|
if (!success) {
|
||||||
qDebug() << "Could not parse reply to"
|
qDebug() << "Could not parse reply to"
|
||||||
<< _verb
|
<< _verb
|
||||||
<< Utility::concatUrlPath(account()->url(), path())
|
<< Account::concatUrlPath(account()->url(), path())
|
||||||
<< _params
|
<< _params
|
||||||
<< ":" << replyData;
|
<< ":" << replyData;
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ bool OcsJob::finished()
|
|||||||
if (!_passStatusCodes.contains(statusCode)) {
|
if (!_passStatusCodes.contains(statusCode)) {
|
||||||
qDebug() << "Reply to"
|
qDebug() << "Reply to"
|
||||||
<< _verb
|
<< _verb
|
||||||
<< Utility::concatUrlPath(account()->url(), path())
|
<< Account::concatUrlPath(account()->url(), path())
|
||||||
<< _params
|
<< _params
|
||||||
<< "has unexpected status code:" << statusCode << replyData;
|
<< "has unexpected status code:" << statusCode << replyData;
|
||||||
emit ocsError(statusCode, message);
|
emit ocsError(statusCode, message);
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ void SelectiveSyncDialog::accept()
|
|||||||
_folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
_folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
folderMan->scheduleFolder(_folder);
|
folderMan->slotScheduleSync(_folder);
|
||||||
}
|
}
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,12 +344,12 @@ QSharedPointer<LinkShare> ShareManager::parseLinkShare(const QVariantMap &data)
|
|||||||
url = QUrl(data.value("url").toString());
|
url = QUrl(data.value("url").toString());
|
||||||
} else if (_account->serverVersionInt() >= (8 << 16)) {
|
} else if (_account->serverVersionInt() >= (8 << 16)) {
|
||||||
// From ownCloud server version 8 on, a different share link scheme is used.
|
// From ownCloud server version 8 on, a different share link scheme is used.
|
||||||
url = QUrl(Utility::concatUrlPath(_account->url(), QString("index.php/s/%1").arg(data.value("token").toString())).toString());
|
url = QUrl(Account::concatUrlPath(_account->url(), QString("index.php/s/%1").arg(data.value("token").toString())).toString());
|
||||||
} else {
|
} else {
|
||||||
QList<QPair<QString, QString>> queryArgs;
|
QList<QPair<QString, QString>> queryArgs;
|
||||||
queryArgs.append(qMakePair(QString("service"), QString("files")));
|
queryArgs.append(qMakePair(QString("service"), QString("files")));
|
||||||
queryArgs.append(qMakePair(QString("t"), data.value("token").toString()));
|
queryArgs.append(qMakePair(QString("t"), data.value("token").toString()));
|
||||||
url = QUrl(Utility::concatUrlPath(_account->url(), QLatin1String("public.php"), queryArgs).toString());
|
url = QUrl(Account::concatUrlPath(_account->url(), QLatin1String("public.php"), queryArgs).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QDate expireDate;
|
QDate expireDate;
|
||||||
|
|||||||
@@ -128,11 +128,6 @@ QNetworkReply *AbstractNetworkJob::davRequest(const QByteArray &verb, const QUrl
|
|||||||
return addTimer(_account->davRequest(verb, url, req, data));
|
return addTimer(_account->davRequest(verb, url, req, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply *AbstractNetworkJob::multipartRequest(const QString &relPath, QNetworkRequest req, QHttpMultiPart *multiPart)
|
|
||||||
{
|
|
||||||
return addTimer(_account->multipartRequest(relPath, req, multiPart));
|
|
||||||
}
|
|
||||||
|
|
||||||
QNetworkReply* AbstractNetworkJob::getRequest(const QString &relPath)
|
QNetworkReply* AbstractNetworkJob::getRequest(const QString &relPath)
|
||||||
{
|
{
|
||||||
return addTimer(_account->getRequest(relPath));
|
return addTimer(_account->getRequest(relPath));
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "accountfwd.h"
|
#include "accountfwd.h"
|
||||||
|
|
||||||
class QUrl;
|
class QUrl;
|
||||||
class QHttpMultiPart;
|
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
@@ -79,7 +78,6 @@ protected:
|
|||||||
QNetworkReply* headRequest(const QString &relPath);
|
QNetworkReply* headRequest(const QString &relPath);
|
||||||
QNetworkReply* headRequest(const QUrl &url);
|
QNetworkReply* headRequest(const QUrl &url);
|
||||||
QNetworkReply* deleteRequest(const QUrl &url);
|
QNetworkReply* deleteRequest(const QUrl &url);
|
||||||
QNetworkReply* multipartRequest(const QString &relPath, QNetworkRequest req, QHttpMultiPart *multiPart);
|
|
||||||
|
|
||||||
int maxRedirects() const { return 10; }
|
int maxRedirects() const { return 10; }
|
||||||
virtual bool finished() = 0;
|
virtual bool finished() = 0;
|
||||||
|
|||||||
+80
-33
@@ -40,7 +40,6 @@ Account::Account(QObject *parent)
|
|||||||
, _capabilities(QVariantMap())
|
, _capabilities(QVariantMap())
|
||||||
, _davPath( Theme::instance()->webDavPath() )
|
, _davPath( Theme::instance()->webDavPath() )
|
||||||
, _wasMigrated(false)
|
, _wasMigrated(false)
|
||||||
, _bundleRequests(true)
|
|
||||||
{
|
{
|
||||||
qRegisterMetaType<AccountPtr>("AccountPtr");
|
qRegisterMetaType<AccountPtr>("AccountPtr");
|
||||||
}
|
}
|
||||||
@@ -77,13 +76,6 @@ AccountPtr Account::sharedFromThis()
|
|||||||
return _sharedThis.toStrongRef();
|
return _sharedThis.toStrongRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Account::davFilesPath() const
|
|
||||||
{
|
|
||||||
//TODO DO NOT HARCODE PATH, GET IT FROM THE SERVER!!!!
|
|
||||||
QString dfp("remote.php/dav/files/");
|
|
||||||
dfp.append(_credentials->user());
|
|
||||||
return dfp;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Account::displayName() const
|
QString Account::displayName() const
|
||||||
{
|
{
|
||||||
@@ -102,6 +94,30 @@ QString Account::id() const
|
|||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isEqualExceptProtocol(const QUrl &url1, const QUrl &url2)
|
||||||
|
{
|
||||||
|
return (url1.host() != url2.host() ||
|
||||||
|
url1.port() != url2.port() ||
|
||||||
|
url1.path() != url2.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Account::changed(AccountPtr other, bool ignoreUrlProtocol) const
|
||||||
|
{
|
||||||
|
if (!other) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool changes = false;
|
||||||
|
if (ignoreUrlProtocol) {
|
||||||
|
changes = isEqualExceptProtocol(_url, other->_url);
|
||||||
|
} else {
|
||||||
|
changes = (_url == other->_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
changes |= _credentials->changed(other->credentials());
|
||||||
|
|
||||||
|
return changes;
|
||||||
|
}
|
||||||
|
|
||||||
AbstractCredentials *Account::credentials() const
|
AbstractCredentials *Account::credentials() const
|
||||||
{
|
{
|
||||||
return _credentials.data();
|
return _credentials.data();
|
||||||
@@ -141,7 +157,12 @@ void Account::setCredentials(AbstractCredentials *cred)
|
|||||||
|
|
||||||
QUrl Account::davUrl() const
|
QUrl Account::davUrl() const
|
||||||
{
|
{
|
||||||
return Utility::concatUrlPath(url(), davPath());
|
return concatUrlPath(url(), davPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QNetworkCookie> Account::lastAuthCookies() const
|
||||||
|
{
|
||||||
|
return _am->cookieJar()->cookiesForUrl(_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Account::clearCookieJar()
|
void Account::clearCookieJar()
|
||||||
@@ -188,7 +209,7 @@ QNetworkAccessManager *Account::networkAccessManager()
|
|||||||
|
|
||||||
QNetworkReply *Account::headRequest(const QString &relPath)
|
QNetworkReply *Account::headRequest(const QString &relPath)
|
||||||
{
|
{
|
||||||
return headRequest(Utility::concatUrlPath(url(), relPath));
|
return headRequest(concatUrlPath(url(), relPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply *Account::headRequest(const QUrl &url)
|
QNetworkReply *Account::headRequest(const QUrl &url)
|
||||||
@@ -202,7 +223,7 @@ QNetworkReply *Account::headRequest(const QUrl &url)
|
|||||||
|
|
||||||
QNetworkReply *Account::getRequest(const QString &relPath)
|
QNetworkReply *Account::getRequest(const QString &relPath)
|
||||||
{
|
{
|
||||||
return getRequest(Utility::concatUrlPath(url(), relPath));
|
return getRequest(concatUrlPath(url(), relPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply *Account::getRequest(const QUrl &url)
|
QNetworkReply *Account::getRequest(const QUrl &url)
|
||||||
@@ -225,7 +246,7 @@ QNetworkReply *Account::deleteRequest( const QUrl &url)
|
|||||||
|
|
||||||
QNetworkReply *Account::davRequest(const QByteArray &verb, const QString &relPath, QNetworkRequest req, QIODevice *data)
|
QNetworkReply *Account::davRequest(const QByteArray &verb, const QString &relPath, QNetworkRequest req, QIODevice *data)
|
||||||
{
|
{
|
||||||
return davRequest(verb, Utility::concatUrlPath(davUrl(), relPath), req, data);
|
return davRequest(verb, concatUrlPath(davUrl(), relPath), req, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply *Account::davRequest(const QByteArray &verb, const QUrl &url, QNetworkRequest req, QIODevice *data)
|
QNetworkReply *Account::davRequest(const QByteArray &verb, const QUrl &url, QNetworkRequest req, QIODevice *data)
|
||||||
@@ -237,20 +258,6 @@ QNetworkReply *Account::davRequest(const QByteArray &verb, const QUrl &url, QNet
|
|||||||
return _am->sendCustomRequest(req, verb, data);
|
return _am->sendCustomRequest(req, verb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkReply *Account::multipartRequest(const QString &relPath, QNetworkRequest req, QHttpMultiPart *multiPart)
|
|
||||||
{
|
|
||||||
return multipartRequest(Utility::concatUrlPath(url(), relPath), req, multiPart);
|
|
||||||
}
|
|
||||||
|
|
||||||
QNetworkReply *Account::multipartRequest(const QUrl &url, QNetworkRequest req, QHttpMultiPart *multiPart)
|
|
||||||
{
|
|
||||||
req.setUrl(url);
|
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(4, 8, 4)
|
|
||||||
req.setSslConfiguration(this->getOrCreateSslConfig());
|
|
||||||
#endif
|
|
||||||
return _am->post(req, multiPart);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Account::setCertificate(const QByteArray certficate, const QString privateKey)
|
void Account::setCertificate(const QByteArray certficate, const QString privateKey)
|
||||||
{
|
{
|
||||||
_pemCertificate=certficate;
|
_pemCertificate=certficate;
|
||||||
@@ -333,6 +340,43 @@ void Account::setUrl(const QUrl &url)
|
|||||||
_url = url;
|
_url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUrl Account::concatUrlPath(const QUrl &url, const QString &concatPath,
|
||||||
|
const QList< QPair<QString, QString> > &queryItems)
|
||||||
|
{
|
||||||
|
QString path = url.path();
|
||||||
|
if (! concatPath.isEmpty()) {
|
||||||
|
// avoid '//'
|
||||||
|
if (path.endsWith('/') && concatPath.startsWith('/')) {
|
||||||
|
path.chop(1);
|
||||||
|
} // avoid missing '/'
|
||||||
|
else if (!path.endsWith('/') && !concatPath.startsWith('/')) {
|
||||||
|
path += QLatin1Char('/');
|
||||||
|
}
|
||||||
|
path += concatPath; // put the complete path together
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl tmpUrl = url;
|
||||||
|
tmpUrl.setPath(path);
|
||||||
|
if( queryItems.size() > 0 ) {
|
||||||
|
tmpUrl.setQueryItems(queryItems);
|
||||||
|
}
|
||||||
|
return tmpUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Account::_configFileName;
|
||||||
|
|
||||||
|
std::unique_ptr<QSettings> Account::settingsWithGroup(const QString& group, QObject *parent)
|
||||||
|
{
|
||||||
|
if (_configFileName.isEmpty()) {
|
||||||
|
// cache file name
|
||||||
|
ConfigFile cfg;
|
||||||
|
_configFileName = cfg.configFile();
|
||||||
|
}
|
||||||
|
std::unique_ptr<QSettings> settings(new QSettings(_configFileName, QSettings::IniFormat, parent));
|
||||||
|
settings->beginGroup(group);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
QVariant Account::credentialSetting(const QString &key) const
|
QVariant Account::credentialSetting(const QString &key) const
|
||||||
{
|
{
|
||||||
if (_credentials) {
|
if (_credentials) {
|
||||||
@@ -431,6 +475,16 @@ void Account::handleInvalidCredentials()
|
|||||||
emit invalidCredentials();
|
emit invalidCredentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Account::wasMigrated()
|
||||||
|
{
|
||||||
|
return _wasMigrated;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Account::setMigrated(bool mig)
|
||||||
|
{
|
||||||
|
_wasMigrated = mig;
|
||||||
|
}
|
||||||
|
|
||||||
const Capabilities &Account::capabilities() const
|
const Capabilities &Account::capabilities() const
|
||||||
{
|
{
|
||||||
return _capabilities;
|
return _capabilities;
|
||||||
@@ -489,13 +543,6 @@ void Account::setNonShib(bool nonShib)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Account::setBundleRequestsIfCapable(bool bundleRequests){
|
|
||||||
_bundleRequests = bundleRequests;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Account::bundledRequestsEnabled()
|
|
||||||
{
|
|
||||||
return (_bundleRequests && _capabilities.bundledRequest()) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace OCC
|
} // namespace OCC
|
||||||
|
|||||||
+30
-37
@@ -33,7 +33,6 @@ class QSettings;
|
|||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
class QUrl;
|
class QUrl;
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
class QHttpMultiPart;
|
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
@@ -57,9 +56,6 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief The Account class represents an account on an ownCloud Server
|
* @brief The Account class represents an account on an ownCloud Server
|
||||||
* @ingroup libsync
|
* @ingroup libsync
|
||||||
*
|
|
||||||
* The Account has a name and url. It also has information about credentials,
|
|
||||||
* SSL errors and certificates.
|
|
||||||
*/
|
*/
|
||||||
class OWNCLOUDSYNC_EXPORT Account : public QObject {
|
class OWNCLOUDSYNC_EXPORT Account : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -70,23 +66,13 @@ public:
|
|||||||
* @returns the (themeable) dav path for the account.
|
* @returns the (themeable) dav path for the account.
|
||||||
*/
|
*/
|
||||||
QString davPath() const;
|
QString davPath() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The possibly themed files dav path for the account. It has
|
|
||||||
* a trailing slash.
|
|
||||||
* @returns the (themeable) files dav path for the account.
|
|
||||||
*/
|
|
||||||
QString davFilesPath() const;
|
|
||||||
void setDavPath(const QString&s) { _davPath = s; }
|
void setDavPath(const QString&s) { _davPath = s; }
|
||||||
void setNonShib(bool nonShib);
|
void setNonShib(bool nonShib);
|
||||||
|
|
||||||
/// Functions for bundle support
|
|
||||||
void setBundleRequestsIfCapable(bool bundleRequests);
|
|
||||||
bool bundledRequestsEnabled();
|
|
||||||
|
|
||||||
static AccountPtr create();
|
static AccountPtr create();
|
||||||
~Account();
|
~Account();
|
||||||
|
|
||||||
|
void setSharedThis(AccountPtr sharedThis);
|
||||||
AccountPtr sharedFromThis();
|
AccountPtr sharedFromThis();
|
||||||
|
|
||||||
/// The name of the account as shown in the toolbar
|
/// The name of the account as shown in the toolbar
|
||||||
@@ -95,6 +81,17 @@ public:
|
|||||||
/// The internal id of the account.
|
/// The internal id of the account.
|
||||||
QString id() const;
|
QString id() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the Account instance is different from @param other
|
||||||
|
*
|
||||||
|
* @returns true, if credentials or url have changed, false otherwise
|
||||||
|
*/
|
||||||
|
bool changed(AccountPtr other, bool ignoreUrlProtocol) const;
|
||||||
|
|
||||||
|
/** Holds the accounts credentials */
|
||||||
|
AbstractCredentials* credentials() const;
|
||||||
|
void setCredentials(AbstractCredentials *cred);
|
||||||
|
|
||||||
/** Server url of the account */
|
/** Server url of the account */
|
||||||
void setUrl(const QUrl &url);
|
void setUrl(const QUrl &url);
|
||||||
QUrl url() const { return _url; }
|
QUrl url() const { return _url; }
|
||||||
@@ -102,12 +99,14 @@ public:
|
|||||||
/** Returns webdav entry URL, based on url() */
|
/** Returns webdav entry URL, based on url() */
|
||||||
QUrl davUrl() const;
|
QUrl davUrl() const;
|
||||||
|
|
||||||
/** Holds the accounts credentials */
|
/** set and retrieve the migration flag: if an account of a branded
|
||||||
AbstractCredentials* credentials() const;
|
* client was migrated from a former ownCloud Account, this is true
|
||||||
void setCredentials(AbstractCredentials *cred);
|
*/
|
||||||
|
void setMigrated(bool mig);
|
||||||
|
bool wasMigrated();
|
||||||
|
|
||||||
|
QList<QNetworkCookie> lastAuthCookies() const;
|
||||||
|
|
||||||
// For creating various network requests
|
|
||||||
QNetworkReply* headRequest(const QString &relPath);
|
QNetworkReply* headRequest(const QString &relPath);
|
||||||
QNetworkReply* headRequest(const QUrl &url);
|
QNetworkReply* headRequest(const QUrl &url);
|
||||||
QNetworkReply* getRequest(const QString &relPath);
|
QNetworkReply* getRequest(const QString &relPath);
|
||||||
@@ -115,9 +114,6 @@ public:
|
|||||||
QNetworkReply* deleteRequest( const QUrl &url);
|
QNetworkReply* deleteRequest( const QUrl &url);
|
||||||
QNetworkReply* davRequest(const QByteArray &verb, const QString &relPath, QNetworkRequest req, QIODevice *data = 0);
|
QNetworkReply* davRequest(const QByteArray &verb, const QString &relPath, QNetworkRequest req, QIODevice *data = 0);
|
||||||
QNetworkReply* davRequest(const QByteArray &verb, const QUrl &url, QNetworkRequest req, QIODevice *data = 0);
|
QNetworkReply* davRequest(const QByteArray &verb, const QUrl &url, QNetworkRequest req, QIODevice *data = 0);
|
||||||
QNetworkReply* multipartRequest(const QString &relPath, QNetworkRequest req, QHttpMultiPart *multiPart);
|
|
||||||
QNetworkReply* multipartRequest(const QUrl &url, QNetworkRequest req, QHttpMultiPart *multiPart);
|
|
||||||
|
|
||||||
|
|
||||||
/** The ssl configuration during the first connection */
|
/** The ssl configuration during the first connection */
|
||||||
QSslConfiguration getOrCreateSslConfig();
|
QSslConfiguration getOrCreateSslConfig();
|
||||||
@@ -142,21 +138,25 @@ public:
|
|||||||
// pluggable handler
|
// pluggable handler
|
||||||
void setSslErrorHandler(AbstractSslErrorHandler *handler);
|
void setSslErrorHandler(AbstractSslErrorHandler *handler);
|
||||||
|
|
||||||
// To be called by credentials only, for storing username and the like
|
// static helper function
|
||||||
|
static QUrl concatUrlPath(const QUrl &url, const QString &concatPath,
|
||||||
|
const QList< QPair<QString, QString> > &queryItems = (QList<QPair<QString, QString>>()));
|
||||||
|
|
||||||
|
/** Returns a new settings pre-set in a specific group. The Settings will be created
|
||||||
|
with the given parent. If no parent is specified, the caller must destroy the settings */
|
||||||
|
static std::unique_ptr<QSettings> settingsWithGroup(const QString& group, QObject* parent = 0);
|
||||||
|
|
||||||
|
// to be called by credentials only
|
||||||
QVariant credentialSetting(const QString& key) const;
|
QVariant credentialSetting(const QString& key) const;
|
||||||
void setCredentialSetting(const QString& key, const QVariant &value);
|
void setCredentialSetting(const QString& key, const QVariant &value);
|
||||||
|
|
||||||
/** Assign a client certificate */
|
|
||||||
void setCertificate(const QByteArray certficate = QByteArray(), const QString privateKey = QString());
|
void setCertificate(const QByteArray certficate = QByteArray(), const QString privateKey = QString());
|
||||||
|
|
||||||
/** Access the server capabilities */
|
|
||||||
const Capabilities &capabilities() const;
|
|
||||||
void setCapabilities(const QVariantMap &caps);
|
void setCapabilities(const QVariantMap &caps);
|
||||||
|
const Capabilities &capabilities() const;
|
||||||
/** Access the server version */
|
void setServerVersion(const QString &version);
|
||||||
QString serverVersion() const;
|
QString serverVersion() const;
|
||||||
int serverVersionInt() const;
|
int serverVersionInt() const;
|
||||||
void setServerVersion(const QString &version);
|
|
||||||
|
|
||||||
/** Whether the server is too old.
|
/** Whether the server is too old.
|
||||||
*
|
*
|
||||||
@@ -171,7 +171,6 @@ public:
|
|||||||
bool serverVersionUnsupported() const;
|
bool serverVersionUnsupported() const;
|
||||||
|
|
||||||
// Fixed from 8.1 https://github.com/owncloud/client/issues/3730
|
// Fixed from 8.1 https://github.com/owncloud/client/issues/3730
|
||||||
/** Detects a specific bug in older server versions */
|
|
||||||
bool rootEtagChangesNotOnlySubFolderEtags();
|
bool rootEtagChangesNotOnlySubFolderEtags();
|
||||||
|
|
||||||
void clearCookieJar();
|
void clearCookieJar();
|
||||||
@@ -180,16 +179,12 @@ public:
|
|||||||
void resetNetworkAccessManager();
|
void resetNetworkAccessManager();
|
||||||
QNetworkAccessManager* networkAccessManager();
|
QNetworkAccessManager* networkAccessManager();
|
||||||
|
|
||||||
/// Called by network jobs on credential errors, emits invalidCredentials()
|
/// Called by network jobs on credential errors.
|
||||||
void handleInvalidCredentials();
|
void handleInvalidCredentials();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// Emitted whenever there's network activity
|
|
||||||
void propagatorNetworkActivity();
|
void propagatorNetworkActivity();
|
||||||
|
|
||||||
/// Triggered by handleInvalidCredentials()
|
|
||||||
void invalidCredentials();
|
void invalidCredentials();
|
||||||
|
|
||||||
void credentialsFetched(AbstractCredentials* credentials);
|
void credentialsFetched(AbstractCredentials* credentials);
|
||||||
void credentialsAsked(AbstractCredentials* credentials);
|
void credentialsAsked(AbstractCredentials* credentials);
|
||||||
|
|
||||||
@@ -208,7 +203,6 @@ protected Q_SLOTS:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Account(QObject *parent = 0);
|
Account(QObject *parent = 0);
|
||||||
void setSharedThis(AccountPtr sharedThis);
|
|
||||||
|
|
||||||
QWeakPointer<Account> _sharedThis;
|
QWeakPointer<Account> _sharedThis;
|
||||||
QString _id;
|
QString _id;
|
||||||
@@ -231,7 +225,6 @@ private:
|
|||||||
QString _pemPrivateKey;
|
QString _pemPrivateKey;
|
||||||
QString _davPath; // defaults to value from theme, might be overwritten in brandings
|
QString _davPath; // defaults to value from theme, might be overwritten in brandings
|
||||||
bool _wasMigrated;
|
bool _wasMigrated;
|
||||||
bool _bundleRequests;
|
|
||||||
friend class AccountManager;
|
friend class AccountManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -46,12 +46,6 @@ bool Capabilities::sharePublicLink() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Capabilities::bundledRequest() const
|
|
||||||
{
|
|
||||||
bool bundle = _capabilities["dav"].toMap()["bundlerequest"].toBool();
|
|
||||||
return bundle;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Capabilities::sharePublicLinkAllowUpload() const
|
bool Capabilities::sharePublicLinkAllowUpload() const
|
||||||
{
|
{
|
||||||
return _capabilities["files_sharing"].toMap()["public"].toMap()["upload"].toBool();
|
return _capabilities["files_sharing"].toMap()["public"].toMap()["upload"].toBool();
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public:
|
|||||||
bool sharePublicLinkEnforceExpireDate() const;
|
bool sharePublicLinkEnforceExpireDate() const;
|
||||||
int sharePublicLinkExpireDateDays() const;
|
int sharePublicLinkExpireDateDays() const;
|
||||||
bool shareResharing() const;
|
bool shareResharing() const;
|
||||||
bool bundledRequest() const;
|
|
||||||
|
|
||||||
/// returns true if the capabilities report notifications
|
/// returns true if the capabilities report notifications
|
||||||
bool notificationsAvailable() const;
|
bool notificationsAvailable() const;
|
||||||
|
|||||||
@@ -611,12 +611,7 @@ void ConfigFile::setPromptDeleteFiles(bool promptDeleteFiles)
|
|||||||
bool ConfigFile::monoIcons() const
|
bool ConfigFile::monoIcons() const
|
||||||
{
|
{
|
||||||
QSettings settings(configFile(), QSettings::IniFormat);
|
QSettings settings(configFile(), QSettings::IniFormat);
|
||||||
bool monoDefault = false; // On Mac we want bw by default
|
return settings.value(QLatin1String(monoIconsC), false).toBool();
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
// OEM themes are not obliged to ship mono icons
|
|
||||||
monoDefault = (0 == (strcmp("ownCloud",APPLICATION_NAME)));
|
|
||||||
#endif
|
|
||||||
return settings.value(QLatin1String(monoIconsC), monoDefault).toBool();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigFile::setMonoIcons(bool useMonoIcons)
|
void ConfigFile::setMonoIcons(bool useMonoIcons)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void setAccount(Account* account);
|
virtual void setAccount(Account* account);
|
||||||
|
|
||||||
|
virtual bool changed(AbstractCredentials* credentials) const = 0;
|
||||||
virtual QString authType() const = 0;
|
virtual QString authType() const = 0;
|
||||||
virtual QString user() const = 0;
|
virtual QString user() const = 0;
|
||||||
virtual QNetworkAccessManager* getQNAM() const = 0;
|
virtual QNetworkAccessManager* getQNAM() const = 0;
|
||||||
|
|||||||
@@ -17,6 +17,13 @@
|
|||||||
namespace OCC
|
namespace OCC
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool DummyCredentials::changed(AbstractCredentials* credentials) const
|
||||||
|
{
|
||||||
|
DummyCredentials* dummy(dynamic_cast< DummyCredentials* >(credentials));
|
||||||
|
|
||||||
|
return dummy == 0;
|
||||||
|
}
|
||||||
|
|
||||||
QString DummyCredentials::authType() const
|
QString DummyCredentials::authType() const
|
||||||
{
|
{
|
||||||
return QString::fromLatin1("dummy");
|
return QString::fromLatin1("dummy");
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public:
|
|||||||
|
|
||||||
QString _user;
|
QString _user;
|
||||||
QString _password;
|
QString _password;
|
||||||
|
bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
|
||||||
QString authType() const Q_DECL_OVERRIDE;
|
QString authType() const Q_DECL_OVERRIDE;
|
||||||
QString user() const Q_DECL_OVERRIDE;
|
QString user() const Q_DECL_OVERRIDE;
|
||||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||||
|
|||||||
@@ -71,6 +71,21 @@ HttpCredentials::HttpCredentials(const QString& user, const QString& password, c
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HttpCredentials::changed(AbstractCredentials* credentials) const
|
||||||
|
{
|
||||||
|
HttpCredentials* other(qobject_cast< HttpCredentials* >(credentials));
|
||||||
|
|
||||||
|
if (!other) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!other || (other->user() != this->user())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString HttpCredentials::authType() const
|
QString HttpCredentials::authType() const
|
||||||
{
|
{
|
||||||
return QString::fromLatin1("http");
|
return QString::fromLatin1("http");
|
||||||
@@ -132,7 +147,7 @@ void HttpCredentials::fetchFromKeychain()
|
|||||||
_certificatePath = _account->credentialSetting(QLatin1String(certifPathC)).toString();
|
_certificatePath = _account->credentialSetting(QLatin1String(certifPathC)).toString();
|
||||||
_certificatePasswd = _account->credentialSetting(QLatin1String(certifPasswdC)).toString();
|
_certificatePasswd = _account->credentialSetting(QLatin1String(certifPasswdC)).toString();
|
||||||
|
|
||||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
auto settings = _account->settingsWithGroup(Theme::instance()->appName());
|
||||||
const QString kck = keychainKey(_account->url().toString(), _user );
|
const QString kck = keychainKey(_account->url().toString(), _user );
|
||||||
|
|
||||||
QString key = QString::fromLatin1( "%1/data" ).arg( kck );
|
QString key = QString::fromLatin1( "%1/data" ).arg( kck );
|
||||||
@@ -214,7 +229,7 @@ void HttpCredentials::invalidateToken()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
|
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
|
||||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
auto settings = _account->settingsWithGroup(Theme::instance()->appName());
|
||||||
settings->setParent(job); // make the job parent to make setting deleted properly
|
settings->setParent(job); // make the job parent to make setting deleted properly
|
||||||
job->setSettings(settings.release());
|
job->setSettings(settings.release());
|
||||||
job->setInsecureFallback(true);
|
job->setInsecureFallback(true);
|
||||||
@@ -265,7 +280,7 @@ void HttpCredentials::persist()
|
|||||||
_account->setCredentialSetting(QLatin1String(certifPathC), _certificatePath);
|
_account->setCredentialSetting(QLatin1String(certifPathC), _certificatePath);
|
||||||
_account->setCredentialSetting(QLatin1String(certifPasswdC), _certificatePasswd);
|
_account->setCredentialSetting(QLatin1String(certifPasswdC), _certificatePasswd);
|
||||||
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
|
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
|
||||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
auto settings = _account->settingsWithGroup(Theme::instance()->appName());
|
||||||
settings->setParent(job); // make the job parent to make setting deleted properly
|
settings->setParent(job); // make the job parent to make setting deleted properly
|
||||||
job->setSettings(settings.release());
|
job->setSettings(settings.release());
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
explicit HttpCredentials();
|
explicit HttpCredentials();
|
||||||
HttpCredentials(const QString& user, const QString& password, const QString& certificatePath, const QString& certificatePasswd);
|
HttpCredentials(const QString& user, const QString& password, const QString& certificatePath, const QString& certificatePasswd);
|
||||||
|
|
||||||
|
bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
|
||||||
QString authType() const Q_DECL_OVERRIDE;
|
QString authType() const Q_DECL_OVERRIDE;
|
||||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||||
bool ready() const Q_DECL_OVERRIDE;
|
bool ready() const Q_DECL_OVERRIDE;
|
||||||
|
|||||||
@@ -80,6 +80,17 @@ TokenCredentials::TokenCredentials(const QString& user, const QString& password,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TokenCredentials::changed(AbstractCredentials* credentials) const
|
||||||
|
{
|
||||||
|
TokenCredentials* other(dynamic_cast< TokenCredentials* >(credentials));
|
||||||
|
|
||||||
|
if (!other || (other->user() != this->user())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString TokenCredentials::authType() const
|
QString TokenCredentials::authType() const
|
||||||
{
|
{
|
||||||
return QString::fromLatin1("token");
|
return QString::fromLatin1("token");
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public:
|
|||||||
TokenCredentials();
|
TokenCredentials();
|
||||||
TokenCredentials(const QString& user, const QString& password, const QString &token);
|
TokenCredentials(const QString& user, const QString& password, const QString &token);
|
||||||
|
|
||||||
|
bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
|
||||||
QString authType() const Q_DECL_OVERRIDE;
|
QString authType() const Q_DECL_OVERRIDE;
|
||||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||||
bool ready() const Q_DECL_OVERRIDE;
|
bool ready() const Q_DECL_OVERRIDE;
|
||||||
|
|||||||
@@ -680,7 +680,7 @@ void JsonApiJob::start()
|
|||||||
{
|
{
|
||||||
QNetworkRequest req;
|
QNetworkRequest req;
|
||||||
req.setRawHeader("OCS-APIREQUEST", "true");
|
req.setRawHeader("OCS-APIREQUEST", "true");
|
||||||
QUrl url = Utility::concatUrlPath(account()->url(), path());
|
QUrl url = Account::concatUrlPath(account()->url(), path());
|
||||||
QList<QPair<QString, QString> > params = _additionalParams;
|
QList<QPair<QString, QString> > params = _additionalParams;
|
||||||
params << qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json"));
|
params << qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json"));
|
||||||
url.setQueryItems(params);
|
url.setQueryItems(params);
|
||||||
|
|||||||
@@ -303,13 +303,6 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
|
|||||||
directories.push(qMakePair(QString(), _rootJob.data()));
|
directories.push(qMakePair(QString(), _rootJob.data()));
|
||||||
QVector<PropagatorJob*> directoriesToRemove;
|
QVector<PropagatorJob*> directoriesToRemove;
|
||||||
QString removedDirectory;
|
QString removedDirectory;
|
||||||
|
|
||||||
PropagateBundle *bundledUploadRequestsJob = new PropagateBundle(this);
|
|
||||||
quint64 chunkSize = OwncloudPropagator::chunkSize();
|
|
||||||
|
|
||||||
// TODO: here we should also check somehow if bundle is not broken for specific sync - bug recovery to standard PUTs
|
|
||||||
bool bundledRequestsEnabled = _account->bundledRequestsEnabled();
|
|
||||||
|
|
||||||
foreach(const SyncFileItemPtr &item, items) {
|
foreach(const SyncFileItemPtr &item, items) {
|
||||||
|
|
||||||
if (!removedDirectory.isEmpty() && item->_file.startsWith(removedDirectory)) {
|
if (!removedDirectory.isEmpty() && item->_file.startsWith(removedDirectory)) {
|
||||||
@@ -386,12 +379,6 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
|
|||||||
currentDirJob->append(dir);
|
currentDirJob->append(dir);
|
||||||
}
|
}
|
||||||
directories.push(qMakePair(item->destination() + "/" , dir));
|
directories.push(qMakePair(item->destination() + "/" , dir));
|
||||||
} else if (bundledRequestsEnabled
|
|
||||||
&& (item->_instruction == CSYNC_INSTRUCTION_NEW)
|
|
||||||
&& (item->_direction == SyncFileItem::Up)
|
|
||||||
&& (item->_size < chunkSize)) {
|
|
||||||
//this will create list of bundle files to sync for that bundlejob
|
|
||||||
bundledUploadRequestsJob->append(item);
|
|
||||||
} else if (PropagateItemJob* current = createJob(item)) {
|
} else if (PropagateItemJob* current = createJob(item)) {
|
||||||
if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE) {
|
if (item->_instruction == CSYNC_INSTRUCTION_TYPE_CHANGE) {
|
||||||
// will delete directories, so defer execution
|
// will delete directories, so defer execution
|
||||||
@@ -407,21 +394,6 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
|
|||||||
_rootJob->append(it);
|
_rootJob->append(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Root job is DirectoryJob with FullParallelizm, so we need to halt bundle till all other jobs are finished.
|
|
||||||
// If there are no running jobs in root folder it means we can start with sending the bundle
|
|
||||||
// If there are running jobs, we halt and wait for finish of the other job to trigger sending
|
|
||||||
if (bundledRequestsEnabled && !bundledUploadRequestsJob->empty()) {
|
|
||||||
bundledUploadRequestsJob->_item->_direction = SyncFileItem::Direction::Up;
|
|
||||||
bundledUploadRequestsJob->_item->_type = SyncFileItem::Type::RequestsContainer;
|
|
||||||
bundledUploadRequestsJob->_item->_instruction = CSYNC_INSTRUCTION_NEW;
|
|
||||||
bundledUploadRequestsJob->_item->_size = bundledUploadRequestsJob->syncItemsSize();
|
|
||||||
bundledUploadRequestsJob->_item->_originalFile = tr("%1 file(s)").arg(bundledUploadRequestsJob->syncItemsNumber());
|
|
||||||
_rootJob->append(bundledUploadRequestsJob);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
delete bundledUploadRequestsJob;
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(_rootJob.data(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)),
|
connect(_rootJob.data(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)),
|
||||||
this, SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
this, SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
||||||
connect(_rootJob.data(), SIGNAL(progress(const SyncFileItem &,quint64)), this, SIGNAL(progress(const SyncFileItem &,quint64)));
|
connect(_rootJob.data(), SIGNAL(progress(const SyncFileItem &,quint64)), this, SIGNAL(progress(const SyncFileItem &,quint64)));
|
||||||
@@ -557,7 +529,7 @@ void OwncloudPropagator::scheduleNextJob()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_activeJobList.count() < maximumActiveJob() + likelyFinishedQuicklyCount) {
|
if (_activeJobList.count() < maximumActiveJob() + likelyFinishedQuicklyCount) {
|
||||||
qDebug() << "Can pump in another request! activeJobs =" << _activeJobList.count();
|
qDebug() << "Can pump in another request!";
|
||||||
if (_rootJob->scheduleNextJob()) {
|
if (_rootJob->scheduleNextJob()) {
|
||||||
QTimer::singleShot(0, this, SLOT(scheduleNextJob()));
|
QTimer::singleShot(0, this, SLOT(scheduleNextJob()));
|
||||||
}
|
}
|
||||||
@@ -652,7 +624,6 @@ bool PropagateDirectory::scheduleNextJob()
|
|||||||
Q_ASSERT(_subJobs.at(i)->_state == Running);
|
Q_ASSERT(_subJobs.at(i)->_state == Running);
|
||||||
|
|
||||||
auto paral = _subJobs.at(i)->parallelism();
|
auto paral = _subJobs.at(i)->parallelism();
|
||||||
|
|
||||||
if (paral == WaitForFinished) {
|
if (paral == WaitForFinished) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -324,10 +324,6 @@ public:
|
|||||||
emitFinished(SyncFileItem::NormalError);
|
emitFinished(SyncFileItem::NormalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
int runningNowAtRootJob() const {
|
|
||||||
return _rootJob->_runningNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
// timeout in seconds
|
// timeout in seconds
|
||||||
static int httpTimeout();
|
static int httpTimeout();
|
||||||
|
|
||||||
@@ -387,7 +383,6 @@ private:
|
|||||||
friend class PropagateLocalMkdir;
|
friend class PropagateLocalMkdir;
|
||||||
friend class PropagateLocalRename;
|
friend class PropagateLocalRename;
|
||||||
friend class PropagateRemoteMove;
|
friend class PropagateRemoteMove;
|
||||||
friend class PropagateBundle;
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,11 @@ QString Progress::asResultString( const SyncFileItem& item)
|
|||||||
case CSYNC_INSTRUCTION_SYNC:
|
case CSYNC_INSTRUCTION_SYNC:
|
||||||
case CSYNC_INSTRUCTION_NEW:
|
case CSYNC_INSTRUCTION_NEW:
|
||||||
case CSYNC_INSTRUCTION_TYPE_CHANGE:
|
case CSYNC_INSTRUCTION_TYPE_CHANGE:
|
||||||
if (item._type != SyncFileItem::Type::RequestsContainer) {
|
if (item._direction != SyncFileItem::Up) {
|
||||||
if (item._direction != SyncFileItem::Up) {
|
return QCoreApplication::translate( "progress", "Downloaded");
|
||||||
return QCoreApplication::translate( "progress", "Downloaded");
|
} else {
|
||||||
} else
|
return QCoreApplication::translate( "progress", "Uploaded");
|
||||||
return QCoreApplication::translate( "progress", "Uploaded");
|
}
|
||||||
}
|
|
||||||
return QCoreApplication::translate( "progress", "Processed Bundle");
|
|
||||||
case CSYNC_INSTRUCTION_CONFLICT:
|
case CSYNC_INSTRUCTION_CONFLICT:
|
||||||
return QCoreApplication::translate( "progress", "Server version downloaded, copied changed local file into conflict file");
|
return QCoreApplication::translate( "progress", "Server version downloaded, copied changed local file into conflict file");
|
||||||
case CSYNC_INSTRUCTION_REMOVE:
|
case CSYNC_INSTRUCTION_REMOVE:
|
||||||
@@ -149,7 +147,6 @@ void ProgressInfo::reset()
|
|||||||
_maxBytesPerSecond = 100000.0;
|
_maxBytesPerSecond = 100000.0;
|
||||||
_maxFilesPerSecond = 2.0;
|
_maxFilesPerSecond = 2.0;
|
||||||
_updateEstimatesTimer.stop();
|
_updateEstimatesTimer.stop();
|
||||||
_lastCompletedItem = SyncFileItem();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressInfo::startEstimateUpdates()
|
void ProgressInfo::startEstimateUpdates()
|
||||||
|
|||||||
@@ -28,12 +28,10 @@
|
|||||||
|
|
||||||
#include <json.h>
|
#include <json.h>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QHttpMultiPart>
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <QXmlStreamReader>
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
|
||||||
namespace {
|
namespace {
|
||||||
@@ -896,601 +894,5 @@ void PropagateUploadFile::abortWithError(SyncFileItem::Status status, const QStr
|
|||||||
done(status, error);
|
done(status, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropagateBundle::start()
|
|
||||||
{
|
|
||||||
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_itemsToChecksum.isEmpty()) {
|
|
||||||
//this will add checksums and remove itself from activeJobList after is completed
|
|
||||||
_preparingBundle = true;
|
|
||||||
_propagator->_activeJobList.append(this);
|
|
||||||
return slotComputeTransmissionChecksum();
|
|
||||||
}
|
|
||||||
|
|
||||||
//this can generate itemDone(), dont add to activeJobList
|
|
||||||
startBundle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::slotComputeTransmissionChecksum()
|
|
||||||
{
|
|
||||||
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SyncFileItemPtr item = _itemsToChecksum.first();
|
|
||||||
const QString filePath = _propagator->getFilePath(item->_file);
|
|
||||||
|
|
||||||
// remember the modtime before checksumming to be able to detect a file
|
|
||||||
// change during the checksum calculation
|
|
||||||
item->_modtime = FileSystem::getModTime(filePath);
|
|
||||||
|
|
||||||
QByteArray checksumType = contentChecksumType();
|
|
||||||
|
|
||||||
// Maybe the discovery already computed the checksum?
|
|
||||||
if (item->_contentChecksumType == checksumType
|
|
||||||
&& !item->_contentChecksum.isEmpty()) {
|
|
||||||
// Reuse the content checksum as the transmission checksum if possible
|
|
||||||
const auto supportedTransmissionChecksums =
|
|
||||||
_propagator->account()->capabilities().supportedChecksumTypes();
|
|
||||||
if (supportedTransmissionChecksums.contains(checksumType)) {
|
|
||||||
slotStartUpload(checksumType, item->_contentChecksum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute the transmission checksum.
|
|
||||||
auto computeChecksum = new ComputeChecksum(this);
|
|
||||||
if (uploadChecksumEnabled()) {
|
|
||||||
computeChecksum->setChecksumType(_propagator->account()->capabilities().uploadChecksumType());
|
|
||||||
} else {
|
|
||||||
computeChecksum->setChecksumType(QByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
|
|
||||||
SLOT(slotStartUpload(QByteArray,QByteArray)));
|
|
||||||
computeChecksum->start(filePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::slotStartUpload(const QByteArray& transmissionChecksumType, const QByteArray& transmissionChecksum)
|
|
||||||
{
|
|
||||||
SyncFileItemPtr item = _itemsToChecksum.takeFirst();
|
|
||||||
|
|
||||||
item->_contentChecksum = transmissionChecksum;
|
|
||||||
item->_contentChecksumType = transmissionChecksumType;
|
|
||||||
|
|
||||||
// add this item to sync list, as it now has checksum computed
|
|
||||||
_itemsToSync.append(item);
|
|
||||||
|
|
||||||
_currentBundleSize += item->_size;
|
|
||||||
_currentRequestsNumber++;
|
|
||||||
|
|
||||||
// Remove ourselfs from the list of active job, before any posible call to itemDone()
|
|
||||||
_propagator->_activeJobList.removeOne(this);
|
|
||||||
|
|
||||||
// check if we have anything to add to our bundle
|
|
||||||
if (!_itemsToChecksum.empty()){
|
|
||||||
SyncFileItemPtr nextItem = _itemsToChecksum.first();
|
|
||||||
|
|
||||||
// if next item will exceed bundle size, send the bundle now
|
|
||||||
// otherwise, compute next checksum
|
|
||||||
if (((_currentBundleSize + nextItem->_size) >= chunkSize())
|
|
||||||
|| (_currentRequestsNumber >= checkBundledRequestsLimits())){
|
|
||||||
_currentBundleSize = 0;
|
|
||||||
_currentRequestsNumber = 0;
|
|
||||||
startBundle();
|
|
||||||
} else {
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//_itemsToChecksum is already empty, send what is left in _itemsToSync.
|
|
||||||
startBundle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::startBundle()
|
|
||||||
{
|
|
||||||
if (_propagator->_abortRequested.fetchAndAddRelaxed(0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: use QHttpMultiPartIODevice as as Upload Device
|
|
||||||
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::MixedType);
|
|
||||||
|
|
||||||
QVector<SyncFileItemPtr> syncItems;
|
|
||||||
while (!_itemsToSync.isEmpty()){
|
|
||||||
SyncFileItemPtr item = _itemsToSync.takeFirst();
|
|
||||||
const QString fullFilePath = _propagator->getFilePath(item->_file);
|
|
||||||
|
|
||||||
if (!FileSystem::fileExists(fullFilePath)) {
|
|
||||||
itemDone(item, SyncFileItem::SoftError, tr("File Removed"));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
time_t prevModtime = item->_modtime; // the _item value was set in PropagateUploadFileQNAM::start()
|
|
||||||
// but a potential checksum calculation could have taken some time during which the file could
|
|
||||||
// have been changed again, so better check again here.
|
|
||||||
|
|
||||||
item->_modtime = FileSystem::getModTime(fullFilePath);
|
|
||||||
if( prevModtime != item->_modtime ) {
|
|
||||||
_propagator->_anotherSyncNeeded = true;
|
|
||||||
itemDone(item, SyncFileItem::SoftError, tr("Local file changed during syncing. It will be resumed."));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
quint64 fileSize = FileSystem::getSize(fullFilePath);
|
|
||||||
item->_size = fileSize;
|
|
||||||
|
|
||||||
// But skip the file if the mtime is too close to 'now'!
|
|
||||||
// That usually indicates a file that is still being changed
|
|
||||||
// or not yet fully copied to the destination.
|
|
||||||
if (fileIsStillChanging(*item)) {
|
|
||||||
_propagator->_anotherSyncNeeded = true;
|
|
||||||
itemDone(item, SyncFileItem::SoftError, tr("Local file changed during sync."));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO use Upload Device to support bandwith limitation on the client
|
|
||||||
QFile *file = new QFile(fullFilePath);
|
|
||||||
if (! file->open(QIODevice::ReadOnly)) {
|
|
||||||
qDebug() << "ERR: Could not prepare upload device: " << file->errorString();
|
|
||||||
|
|
||||||
// If the file is currently locked, we want to retry the sync
|
|
||||||
// when it becomes available again.
|
|
||||||
if (FileSystem::isFileLocked(fullFilePath)) {
|
|
||||||
emit _propagator->seenLockedFile(fullFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Soft error because this is likely caused by the user modifying his files while syncing
|
|
||||||
itemDone(item, SyncFileItem::SoftError, tr("ERR: Could not prepare upload device"));
|
|
||||||
} else {
|
|
||||||
QHttpPart bundleContent;
|
|
||||||
bundleContent.setHeader(QNetworkRequest::ContentLengthHeader, QVariant(fileSize));
|
|
||||||
|
|
||||||
//TODO: dont use strings here!! Must change to variable in propagatorjobs.h!
|
|
||||||
bundleContent.setRawHeader("X-OC-Method", QByteArray("PUT"));
|
|
||||||
bundleContent.setRawHeader("X-OC-Path", getRemotePath(item->_file));
|
|
||||||
bundleContent.setRawHeader("X-OC-Mtime", QByteArray::number(qint64(item->_modtime)));
|
|
||||||
|
|
||||||
if (!item->_contentChecksumType.isEmpty()) {
|
|
||||||
bundleContent.setRawHeader(checkSumHeaderC,
|
|
||||||
makeChecksumHeader(item->_contentChecksumType, item->_contentChecksum));
|
|
||||||
}
|
|
||||||
if(item->_file.contains(".sys.admin#recall#")) {
|
|
||||||
// This is a file recall triggered by the admin. Note: the
|
|
||||||
// recall list file created by the admin and downloaded by the
|
|
||||||
// client (.sys.admin#recall#) also falls into this category
|
|
||||||
// (albeit users are not supposed to mess up with it)
|
|
||||||
|
|
||||||
// We use a special tag header so that the server may decide to store this file away in some admin stage area
|
|
||||||
// And not directly in the user's area (which would trigger redownloads etc).
|
|
||||||
bundleContent.setRawHeader("OC-Tag", QByteArray(".sys.admin#recall#"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// File has to be written to multipart body immedietely, because we dont want 1000> open files till the reply comes.
|
|
||||||
bundleContent.setBody(file->readAll());
|
|
||||||
file->close();
|
|
||||||
multiPart->append(bundleContent);
|
|
||||||
syncItems.append(item);
|
|
||||||
}
|
|
||||||
delete file;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!syncItems.isEmpty())
|
|
||||||
{
|
|
||||||
_propagator->_activeJobList.append(this);
|
|
||||||
|
|
||||||
const QString userPath = _propagator->account()->davFilesPath();
|
|
||||||
|
|
||||||
// job takes ownership of device via a QScopedPointer. Job deletes itself when finishing
|
|
||||||
MultipartJob* job = new MultipartJob(_propagator->account(), userPath, multiPart, syncItems);
|
|
||||||
job->_duration.start();
|
|
||||||
|
|
||||||
_jobs.append(job);
|
|
||||||
connect(job, SIGNAL(finishedSignal()), this, SLOT(slotMultipartFinished()));
|
|
||||||
connect(job, SIGNAL(destroyed(QObject*)), this, SLOT(slotJobDestroyed(QObject*)));
|
|
||||||
job->start();
|
|
||||||
_preparingBundle = false;
|
|
||||||
|
|
||||||
// check if there are any items to be bundled and if you can run another parallel job
|
|
||||||
if (!_itemsToChecksum.empty() && (_propagator->_activeJobList.count() < _propagator->maximumActiveJob())) {
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
delete multiPart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO this function is copied over from owncloudpropagator.cpp (not in owncloudpropagator.h)
|
|
||||||
/** Updates, creates or removes a blacklist entry for the given item.
|
|
||||||
*
|
|
||||||
* Returns whether the file is in the blacklist now.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static bool blacklistCheck(SyncJournalDb* journal, const SyncFileItem& item)
|
|
||||||
{
|
|
||||||
SyncJournalErrorBlacklistRecord oldEntry = journal->errorBlacklistEntry(item._file);
|
|
||||||
SyncJournalErrorBlacklistRecord newEntry = SyncJournalErrorBlacklistRecord::update(oldEntry, item);
|
|
||||||
|
|
||||||
if (newEntry.isValid()) {
|
|
||||||
journal->updateErrorBlacklistEntry(newEntry);
|
|
||||||
} else if (oldEntry.isValid()) {
|
|
||||||
journal->wipeErrorBlacklistEntry(item._file);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newEntry.isValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::itemDone(SyncFileItemPtr item, SyncFileItem::Status status, const QString &errorString)
|
|
||||||
{
|
|
||||||
if (item->_isRestoration) {
|
|
||||||
if( status == SyncFileItem::Success || status == SyncFileItem::Conflict) {
|
|
||||||
status = SyncFileItem::Restoration;
|
|
||||||
} else {
|
|
||||||
item->_errorString += tr("; Restoration Failed: %1").arg(errorString);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if( item->_errorString.isEmpty() ) {
|
|
||||||
item->_errorString = errorString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( _propagator->_abortRequested.fetchAndAddRelaxed(0) &&
|
|
||||||
(status == SyncFileItem::NormalError || status == SyncFileItem::FatalError)) {
|
|
||||||
// an abort request is ongoing. Change the status to Soft-Error
|
|
||||||
status = SyncFileItem::SoftError;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( status ) {
|
|
||||||
case SyncFileItem::SoftError:
|
|
||||||
case SyncFileItem::FatalError:
|
|
||||||
// do not blacklist in case of soft error or fatal error.
|
|
||||||
break;
|
|
||||||
case SyncFileItem::NormalError:
|
|
||||||
if (blacklistCheck(_propagator->_journal, *item) && item->_hasBlacklistEntry) {
|
|
||||||
// do not error if the item was, and continues to be, blacklisted
|
|
||||||
status = SyncFileItem::FileIgnored;
|
|
||||||
item->_errorString.prepend(tr("Continue blacklisting:") + " ");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SyncFileItem::Success:
|
|
||||||
case SyncFileItem::Restoration:
|
|
||||||
if( item->_hasBlacklistEntry ) {
|
|
||||||
// wipe blacklist entry.
|
|
||||||
_propagator->_journal->wipeErrorBlacklistEntry(item->_file);
|
|
||||||
// remove a blacklist entry in case the file was moved.
|
|
||||||
if( item->_originalFile != item->_file ) {
|
|
||||||
_propagator->_journal->wipeErrorBlacklistEntry(item->_originalFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SyncFileItem::Conflict:
|
|
||||||
case SyncFileItem::FileIgnored:
|
|
||||||
case SyncFileItem::NoStatus:
|
|
||||||
// nothing
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->_status = status;
|
|
||||||
|
|
||||||
emit itemCompleted(*item, *this);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray PropagateBundle::getRemotePath(QString filePath){
|
|
||||||
QString remotePath(_propagator->_remoteFolder+filePath);
|
|
||||||
return remotePath.toStdString().c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::append(const SyncFileItemPtr &bundledFile){
|
|
||||||
_size += bundledFile->_size;
|
|
||||||
_itemsToChecksum.append(bundledFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PropagateBundle::empty(){
|
|
||||||
return _itemsToChecksum.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::slotMultipartFinished()
|
|
||||||
{
|
|
||||||
MultipartJob *job = qobject_cast<MultipartJob *>(sender());
|
|
||||||
Q_ASSERT(job);
|
|
||||||
slotJobDestroyed(job); // remove it from the _jobs list
|
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << job->reply()->request().url() << "FINISHED WITH STATUS"
|
|
||||||
<< job->reply()->error()
|
|
||||||
<< (job->reply()->error() == QNetworkReply::NoError ? QLatin1String("") : job->reply()->errorString())
|
|
||||||
<< job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute)
|
|
||||||
<< job->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute);
|
|
||||||
|
|
||||||
_propagator->_activeJobList.removeOne(this);
|
|
||||||
|
|
||||||
QNetworkReply::NetworkError err = job->reply()->error();
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
|
|
||||||
if (job->reply()->error() == QNetworkReply::OperationCanceledError && job->reply()->property(owncloudShouldSoftCancelPropertyName).isValid()) {
|
|
||||||
// Abort the job and try again later.
|
|
||||||
// This works around a bug in QNAM wich might reuse a non-empty buffer for the next request.
|
|
||||||
qDebug() << "Forcing job abort on HTTP connection reset with Qt < 5.4.2.";
|
|
||||||
_propagator->_anotherSyncNeeded = true;
|
|
||||||
abortWithError(SyncFileItem::SoftError, tr("Forcing job abort on HTTP connection reset with Qt < 5.4.2."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (err != QNetworkReply::NoError) {
|
|
||||||
_item->_httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
|
||||||
|
|
||||||
QByteArray replyContent = job->reply()->readAll();
|
|
||||||
qDebug() << replyContent; // display the XML error in the debug
|
|
||||||
QString errorString = errorMessage(job->errorString(), replyContent);
|
|
||||||
|
|
||||||
if (job->reply()->hasRawHeader("OC-ErrorString")) {
|
|
||||||
errorString = job->reply()->rawHeader("OC-ErrorString");
|
|
||||||
}
|
|
||||||
|
|
||||||
abortWithError(SyncFileItem::SoftError, errorString);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse DAV response
|
|
||||||
QXmlStreamReader reader(job->reply());
|
|
||||||
reader.addExtraNamespaceDeclaration(QXmlStreamNamespaceDeclaration("d", "DAV:"));
|
|
||||||
|
|
||||||
QString currentHref;
|
|
||||||
QString currentOcPath;
|
|
||||||
QString expectedPath(_propagator->account()->davFilesPath());
|
|
||||||
QMap<QString, QString> itemProperties;
|
|
||||||
QMap<QString, QMap<QString, QString> > responseObjectsProperties;
|
|
||||||
bool insidePropstat = false;
|
|
||||||
bool insideProp = false;
|
|
||||||
bool insideError = false;
|
|
||||||
|
|
||||||
while (!reader.atEnd()) {
|
|
||||||
QXmlStreamReader::TokenType type = reader.readNext();
|
|
||||||
QString name = reader.name().toString();
|
|
||||||
// Start elements with DAV:
|
|
||||||
if (type == QXmlStreamReader::StartElement && reader.namespaceUri() == QLatin1String("DAV:")) {
|
|
||||||
if (name == QLatin1String("href")) {
|
|
||||||
// We don't use URL encoding in our request URL (which is the expected path) (QNAM will do it for us)
|
|
||||||
// but the result will have URL encoding..
|
|
||||||
QString hrefString = QString::fromUtf8(QByteArray::fromPercentEncoding(reader.readElementText().toUtf8()));
|
|
||||||
if (!hrefString.endsWith(expectedPath)) {
|
|
||||||
qDebug() << "Invalid href" << hrefString << "expected ending with" << expectedPath;
|
|
||||||
}
|
|
||||||
currentHref = hrefString;
|
|
||||||
} else if (name == QLatin1String("response")) {
|
|
||||||
continue;
|
|
||||||
} else if (name == QLatin1String("propstat")) {
|
|
||||||
insidePropstat = true;
|
|
||||||
} else if (name == QLatin1String("status") && insidePropstat) {
|
|
||||||
QString httpStatus = reader.readElementText();
|
|
||||||
itemProperties.insert(name, httpStatus);
|
|
||||||
} else if (name == QLatin1String("prop")) {
|
|
||||||
insideProp = true;
|
|
||||||
continue;
|
|
||||||
} else if (name == QLatin1String("multistatus")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == QXmlStreamReader::StartElement && insidePropstat && insideProp) {
|
|
||||||
if (name == QLatin1String("oc-path")){
|
|
||||||
currentOcPath = reader.readElementText(QXmlStreamReader::SkipChildElements);
|
|
||||||
} else if (name == QLatin1String("error")){
|
|
||||||
insideError = true;
|
|
||||||
} else if (name == QLatin1String("exception") && insideError){
|
|
||||||
itemProperties.insert(name, reader.readElementText(QXmlStreamReader::SkipChildElements));
|
|
||||||
} else if (name == QLatin1String("message") && insideError){
|
|
||||||
itemProperties.insert(name, reader.readElementText(QXmlStreamReader::SkipChildElements));
|
|
||||||
} else{
|
|
||||||
itemProperties.insert(name, reader.readElementText(QXmlStreamReader::SkipChildElements));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// End elements with DAV:
|
|
||||||
if (type == QXmlStreamReader::EndElement) {
|
|
||||||
if (reader.namespaceUri() == QLatin1String("DAV:")) {
|
|
||||||
if (reader.name() == "response") {
|
|
||||||
currentHref.clear();
|
|
||||||
} else if (reader.name() == "propstat") {
|
|
||||||
insidePropstat = false;
|
|
||||||
if (!currentOcPath.isEmpty()){
|
|
||||||
responseObjectsProperties.insert(currentOcPath, QMap<QString,QString>(itemProperties));
|
|
||||||
}
|
|
||||||
currentOcPath.clear();
|
|
||||||
itemProperties.clear();
|
|
||||||
} else if (reader.name() == "prop") {
|
|
||||||
insideProp = false;
|
|
||||||
} else if (reader.name() == "error") {
|
|
||||||
insideError = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reader.hasError()) {
|
|
||||||
// XML Parser error? Whatever had been emitted before will come as directoryListingIterated
|
|
||||||
qDebug() << "ERROR" << reader.errorString();
|
|
||||||
abortWithError(SyncFileItem::SoftError, tr("Cannot parse multistatus response!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<SyncFileItemPtr> syncItems = job->syncItems();
|
|
||||||
|
|
||||||
//get the total duration, and try to estimate sync time for single item in the bundle
|
|
||||||
quint64 avgItemDuration = job->_duration.elapsed()/syncItems.count();
|
|
||||||
|
|
||||||
foreach(SyncFileItemPtr item, syncItems) {
|
|
||||||
item->_requestDuration = avgItemDuration;
|
|
||||||
item->_responseTimeStamp = job->responseTimestamp();
|
|
||||||
slotItemFinished(item, responseObjectsProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
// performance logging
|
|
||||||
qDebug() << "*==* duration BUNDLE UPLOAD" << syncItems.count() << "items synced"
|
|
||||||
<< "average duration" << avgItemDuration;
|
|
||||||
// The job might stay alive for the whole sync, release this tiny bit of memory.
|
|
||||||
|
|
||||||
if (_jobs.empty() && _itemsToChecksum.isEmpty()){
|
|
||||||
done(SyncFileItem::Success);
|
|
||||||
} else if (!_preparingBundle){
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::slotItemFinished(const SyncFileItemPtr &item, QMap<QString, QMap<QString, QString> > &responseObjectsProperties)
|
|
||||||
{
|
|
||||||
QString itemFilePath(getRemotePath(item->_file));
|
|
||||||
QMap<QString, QString> fileProperties = responseObjectsProperties.value(itemFilePath);
|
|
||||||
|
|
||||||
item->_httpErrorCode = getHttpStatusCode(fileProperties.value("status"));
|
|
||||||
|
|
||||||
if (200 == item->_httpErrorCode){
|
|
||||||
// Check if the file still exists
|
|
||||||
const QString fullFilePath(_propagator->getFilePath(item->_file));
|
|
||||||
if( !FileSystem::fileExists(fullFilePath) ) {
|
|
||||||
_propagator->_anotherSyncNeeded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! FileSystem::verifyFileUnchanged(fullFilePath, item->_size, item->_modtime)) {
|
|
||||||
_propagator->_anotherSyncNeeded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//OC-FileID section
|
|
||||||
if (fileProperties.contains("oc-fileid")){
|
|
||||||
QString fid = fileProperties.value("oc-fileid");
|
|
||||||
if( !item->_fileId.isEmpty() && item->_fileId != fid ) {
|
|
||||||
qDebug() << "WARN: File ID changed!" << item->_fileId << fid;
|
|
||||||
}
|
|
||||||
item->_fileId =fid.toStdString().c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
//OC-ETag section
|
|
||||||
QByteArray ocEtag = parseEtag(fileProperties.value("oc-etag").toStdString().c_str());
|
|
||||||
QByteArray etag = parseEtag(fileProperties.value("etag").toStdString().c_str());
|
|
||||||
item->_etag = ocEtag.isEmpty() ? etag : ocEtag;
|
|
||||||
if (ocEtag.length() > 0 && ocEtag != etag) {
|
|
||||||
qDebug() << "Quite peculiar, we have an etag != OC-Etag [no problem!]" << etag << ocEtag;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileProperties.value("x-oc-mtime") != "accepted"){
|
|
||||||
// X-OC-MTime is supported since owncloud 5.0. But not when chunking.
|
|
||||||
// Normally Owncloud 6 always puts X-OC-MTime
|
|
||||||
qWarning() << "Server does not support X-OC-MTime" << fileProperties.value("x-oc-mtime");
|
|
||||||
// Well, the mtime was not set
|
|
||||||
itemDone(item, SyncFileItem::SoftError, "Server does not support X-OC-MTime");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else{
|
|
||||||
//We do not check for problems with shared folder since it is only CREATE
|
|
||||||
//TODO: if the file will support update, ensure to override checkForProblemsWithShared()
|
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << item->_file << "ERROR WITH STATUS"
|
|
||||||
<< fileProperties.value("status")
|
|
||||||
<< fileProperties.value("exception")
|
|
||||||
<< fileProperties.value("message");
|
|
||||||
|
|
||||||
if (412 == _item->_httpErrorCode) {
|
|
||||||
// Precondition Failed: Maybe the bad etag is in the database, we need to clear the
|
|
||||||
// parent folder etag so we won't read from DB next sync.
|
|
||||||
_propagator->_journal->avoidReadFromDbOnNextSync(item->_file);
|
|
||||||
_propagator->_anotherSyncNeeded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->_errorString = fileProperties.value("message");
|
|
||||||
item->_status = classifyError(QNetworkReply::ContentOperationNotPermittedError, item->_httpErrorCode,
|
|
||||||
&_propagator->_anotherSyncNeeded);
|
|
||||||
itemDone(item, item->_status, item->_errorString);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_propagator->_journal->setFileRecord(SyncJournalFileRecord(*item, _propagator->getFilePath(item->_file)))) {
|
|
||||||
itemDone(item, SyncFileItem::FatalError, tr("Error writing metadata to the database"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove from the progress database:
|
|
||||||
_propagator->_journal->setUploadInfo(item->_file, SyncJournalDb::UploadInfo());
|
|
||||||
_propagator->_journal->commit("upload file start");
|
|
||||||
itemDone(item, SyncFileItem::Success);
|
|
||||||
}
|
|
||||||
|
|
||||||
int PropagateBundle::getHttpStatusCode(const QString &status){
|
|
||||||
//if cannot read code, it means that server is not supported and raise 500 Internal Server Error
|
|
||||||
int code = 500;
|
|
||||||
QStringList statusList = status.split(QRegExp("\\s+"));
|
|
||||||
if (2 < statusList.size()){
|
|
||||||
//we expect status list to be at least 3 elements and second element to be the http error code
|
|
||||||
code = statusList.at(1).toInt();
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PropagateBundle::slotJobDestroyed(QObject* job)
|
|
||||||
{
|
|
||||||
_jobs.erase(std::remove(_jobs.begin(), _jobs.end(), job) , _jobs.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function is used whenever there is an error occuring and we need to raise status for whole the bundle
|
|
||||||
void PropagateBundle::abortWithError(SyncFileItem::Status status, const QString &error)
|
|
||||||
{
|
|
||||||
foreach(auto *job, _jobs) {
|
|
||||||
if (job->reply()) {
|
|
||||||
qDebug() << Q_FUNC_INFO << job;
|
|
||||||
job->reply()->abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
done(status, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
MultipartJob::~MultipartJob()
|
|
||||||
{
|
|
||||||
// Make sure that we destroy the QNetworkReply before our _device of which it keeps an internal pointer.
|
|
||||||
setReply(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MultipartJob::start() {
|
|
||||||
QNetworkRequest req;
|
|
||||||
setReply(multipartRequest(path(), req, _multipart));
|
|
||||||
_multipart->setParent(reply()); // delete the multiPart with the job
|
|
||||||
setupConnections(reply());
|
|
||||||
|
|
||||||
if( reply()->error() != QNetworkReply::NoError ) {
|
|
||||||
qWarning() << Q_FUNC_INFO << " Network error: " << reply()->errorString();
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(this, SIGNAL(networkActivity()), account().data(), SIGNAL(propagatorNetworkActivity()));
|
|
||||||
|
|
||||||
//TODO this uses _device, and we have no access here to that
|
|
||||||
// // For Qt versions not including https://codereview.qt-project.org/110150
|
|
||||||
// // Also do the runtime check if compiled with an old Qt but running with fixed one.
|
|
||||||
// // (workaround disabled on windows and mac because the binaries we ship have patched qt)
|
|
||||||
//#if QT_VERSION < QT_VERSION_CHECK(4, 8, 7)
|
|
||||||
// if (QLatin1String(qVersion()) < QLatin1String("4.8.7"))
|
|
||||||
// connect(_device.data(), SIGNAL(wasReset()), this, SLOT(slotSoftAbort()));
|
|
||||||
//#elif QT_VERSION > QT_VERSION_CHECK(5, 0, 0) && QT_VERSION < QT_VERSION_CHECK(5, 4, 2) && !defined Q_OS_WIN && !defined Q_OS_MAC
|
|
||||||
// if (QLatin1String(qVersion()) < QLatin1String("5.4.2"))
|
|
||||||
// connect(_device.data(), SIGNAL(wasReset()), this, SLOT(slotSoftAbort()));
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
AbstractNetworkJob::start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MultipartJob::slotTimeout() {
|
|
||||||
qDebug() << "Timeout" << (reply() ? reply()->request().url() : path());
|
|
||||||
if (!reply())
|
|
||||||
return;
|
|
||||||
_errorString = tr("Connection Timeout");
|
|
||||||
reply()->abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 2)
|
|
||||||
void MultipartJob::slotSoftAbort() {
|
|
||||||
reply()->setProperty(owncloudShouldSoftCancelPropertyName, true);
|
|
||||||
reply()->abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
class BandwidthManager;
|
class BandwidthManager;
|
||||||
|
|
||||||
@@ -122,51 +123,6 @@ private slots:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The MultipartJob class
|
|
||||||
* @ingroup libsync
|
|
||||||
*/
|
|
||||||
class MultipartJob : public AbstractNetworkJob {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
private:
|
|
||||||
QVector<SyncFileItemPtr> _syncItems;
|
|
||||||
QHttpMultiPart* _multipart;
|
|
||||||
QString _errorString;
|
|
||||||
public:
|
|
||||||
QElapsedTimer _duration;
|
|
||||||
// Takes ownership of the device
|
|
||||||
explicit MultipartJob(AccountPtr account, const QString& path, QHttpMultiPart* multiPart, const QVector<SyncFileItemPtr> &syncItems,QObject* parent = 0)
|
|
||||||
: AbstractNetworkJob(account, path, parent), _syncItems(syncItems), _multipart(multiPart), _errorString(QString()) {}
|
|
||||||
~MultipartJob();
|
|
||||||
|
|
||||||
virtual void start() Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
virtual bool finished() Q_DECL_OVERRIDE {
|
|
||||||
emit finishedSignal();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString errorString() {
|
|
||||||
return _errorString.isEmpty() ? reply()->errorString() : _errorString;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<SyncFileItemPtr> syncItems() const {
|
|
||||||
return _syncItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void slotTimeout() Q_DECL_OVERRIDE;
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void finishedSignal();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
#if QT_VERSION < 0x050402
|
|
||||||
void slotSoftAbort();
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This job implements the asynchronous PUT
|
* @brief This job implements the asynchronous PUT
|
||||||
*
|
*
|
||||||
@@ -239,8 +195,6 @@ public:
|
|||||||
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
|
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
|
||||||
void start() Q_DECL_OVERRIDE;
|
void start() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
bool isLikelyFinishedQuickly() Q_DECL_OVERRIDE { return _item->_size < 100*1024; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether an existing entity with the same name may be deleted before
|
* Whether an existing entity with the same name may be deleted before
|
||||||
* the upload.
|
* the upload.
|
||||||
@@ -266,66 +220,5 @@ private:
|
|||||||
void abortWithError(SyncFileItem::Status status, const QString &error);
|
void abortWithError(SyncFileItem::Status status, const QString &error);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The PropagateBundle class
|
|
||||||
* @ingroup libsync
|
|
||||||
*/
|
|
||||||
class PropagateBundle : public PropagateItemJob {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
private:
|
|
||||||
QLinkedList<SyncFileItemPtr> _itemsToSync;
|
|
||||||
QLinkedList<SyncFileItemPtr> _itemsToChecksum;
|
|
||||||
QVector<MultipartJob*> _jobs; /// network jobs that are currently in transit
|
|
||||||
bool _running; // Tells that all the jobs have been finished
|
|
||||||
bool _preparingBundle; // Tells that all the jobs have been finished
|
|
||||||
quint64 _size; // Tells what is the total size of _itemsToSync inside the bundle
|
|
||||||
quint64 _currentBundleSize;
|
|
||||||
quint64 _currentRequestsNumber;
|
|
||||||
quint64 _totalFiles;
|
|
||||||
// measure the performance of checksum calc and upload
|
|
||||||
Utility::StopWatch _stopWatch;
|
|
||||||
|
|
||||||
public:
|
|
||||||
PropagateBundle(OwncloudPropagator* propagator)
|
|
||||||
: PropagateItemJob(propagator, SyncFileItemPtr(new SyncFileItem)), _running(false), _preparingBundle(true), _size(0), _currentBundleSize(0), _currentRequestsNumber(0) {}
|
|
||||||
void start() Q_DECL_OVERRIDE;
|
|
||||||
void startBundle();
|
|
||||||
void append(const SyncFileItemPtr &bundledFile);
|
|
||||||
QByteArray getRemotePath(QString filePath);
|
|
||||||
bool empty();
|
|
||||||
bool scheduleNextJob() Q_DECL_OVERRIDE {
|
|
||||||
if (_running != true && _propagator->runningNowAtRootJob() == 1){
|
|
||||||
_running = true;
|
|
||||||
QMetaObject::invokeMethod(this, "start"); // We could be in a different thread (neon jobs)
|
|
||||||
}
|
|
||||||
if (_state == NotYetStarted){
|
|
||||||
_state = Running;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
quint64 syncItemsSize() const { return _size; }
|
|
||||||
quint64 syncItemsNumber() const { return _itemsToChecksum.count(); }
|
|
||||||
private slots:
|
|
||||||
void slotComputeTransmissionChecksum();
|
|
||||||
void slotStartUpload(const QByteArray& transmissionChecksumType, const QByteArray& transmissionChecksum);
|
|
||||||
void slotMultipartFinished();
|
|
||||||
void slotJobDestroyed(QObject *job);
|
|
||||||
void abortWithError(SyncFileItem::Status status, const QString &error);
|
|
||||||
|
|
||||||
private:
|
|
||||||
quint64 checkBundledRequestsLimits()
|
|
||||||
{
|
|
||||||
//TODO: obtain this value from the server or by other means
|
|
||||||
quint64 maximumBundledFiles = 500;
|
|
||||||
return (maximumBundledFiles/_propagator->maximumActiveJob());
|
|
||||||
}
|
|
||||||
quint64 chunkSize() const { return _propagator->chunkSize(); }
|
|
||||||
int getHttpStatusCode(const QString &status);
|
|
||||||
void slotItemFinished(const SyncFileItemPtr &item, QMap<QString, QMap<QString, QString> > &responseObjectsProperties);
|
|
||||||
void itemDone(SyncFileItemPtr item, SyncFileItem::Status status, const QString &errorString = QString());
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1163,7 +1163,7 @@ void SyncEngine::checkForPermission()
|
|||||||
qDebug() << "Moving of " << (*it)->_file << " canceled because no permission to add parent folder";
|
qDebug() << "Moving of " << (*it)->_file << " canceled because no permission to add parent folder";
|
||||||
}
|
}
|
||||||
(*it)->_instruction = CSYNC_INSTRUCTION_ERROR;
|
(*it)->_instruction = CSYNC_INSTRUCTION_ERROR;
|
||||||
(*it)->_status = SyncFileItem::SoftError;
|
(*it)->_status = SyncFileItem::NormalError;
|
||||||
(*it)->_errorString = tr("Not allowed because you don't have permission to add parent folder");
|
(*it)->_errorString = tr("Not allowed because you don't have permission to add parent folder");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public:
|
|||||||
|
|
||||||
enum Type {
|
enum Type {
|
||||||
UnknownType = 0,
|
UnknownType = 0,
|
||||||
RequestsContainer = 1,
|
|
||||||
File = CSYNC_FTW_TYPE_FILE,
|
File = CSYNC_FTW_TYPE_FILE,
|
||||||
Directory = CSYNC_FTW_TYPE_DIR,
|
Directory = CSYNC_FTW_TYPE_DIR,
|
||||||
SoftLink = CSYNC_FTW_TYPE_SLINK
|
SoftLink = CSYNC_FTW_TYPE_SLINK
|
||||||
|
|||||||
@@ -331,15 +331,6 @@ bool SyncJournalDb::checkConnect()
|
|||||||
qDebug() << Q_FUNC_INFO << "possibleUpgradeFromMirall_1_8_0_or_1 detected!";
|
qDebug() << Q_FUNC_INFO << "possibleUpgradeFromMirall_1_8_0_or_1 detected!";
|
||||||
forceRemoteDiscovery = true;
|
forceRemoteDiscovery = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There was a bug in versions <2.3.0 that could lead to stale
|
|
||||||
// local files and a remote discovery will fix them.
|
|
||||||
// See #5190 #5242.
|
|
||||||
if( major == 2 && minor < 3) {
|
|
||||||
qDebug() << Q_FUNC_INFO << "upgrade form client < 2.3.0 detected! forcing remote discovery";
|
|
||||||
forceRemoteDiscovery = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not comparing the BUILD id here, correct?
|
// Not comparing the BUILD id here, correct?
|
||||||
if( !(major == MIRALL_VERSION_MAJOR && minor == MIRALL_VERSION_MINOR && patch == MIRALL_VERSION_PATCH) ) {
|
if( !(major == MIRALL_VERSION_MAJOR && minor == MIRALL_VERSION_MINOR && patch == MIRALL_VERSION_PATCH) ) {
|
||||||
createQuery.prepare("UPDATE version SET major=?1, minor=?2, patch =?3, custom=?4 "
|
createQuery.prepare("UPDATE version SET major=?1, minor=?2, patch =?3, custom=?4 "
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "configfile.h"
|
|
||||||
|
|
||||||
// Note: This file must compile without QtGui
|
// Note: This file must compile without QtGui
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -587,41 +586,4 @@ void Utility::sortFilenames(QStringList& fileNames)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl Utility::concatUrlPath(const QUrl &url, const QString &concatPath,
|
|
||||||
const QList< QPair<QString, QString> > &queryItems)
|
|
||||||
{
|
|
||||||
QString path = url.path();
|
|
||||||
if (! concatPath.isEmpty()) {
|
|
||||||
// avoid '//'
|
|
||||||
if (path.endsWith('/') && concatPath.startsWith('/')) {
|
|
||||||
path.chop(1);
|
|
||||||
} // avoid missing '/'
|
|
||||||
else if (!path.endsWith('/') && !concatPath.startsWith('/')) {
|
|
||||||
path += QLatin1Char('/');
|
|
||||||
}
|
|
||||||
path += concatPath; // put the complete path together
|
|
||||||
}
|
|
||||||
|
|
||||||
QUrl tmpUrl = url;
|
|
||||||
tmpUrl.setPath(path);
|
|
||||||
if( queryItems.size() > 0 ) {
|
|
||||||
tmpUrl.setQueryItems(queryItems);
|
|
||||||
}
|
|
||||||
return tmpUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(QString, g_configFileName)
|
|
||||||
|
|
||||||
std::unique_ptr<QSettings> Utility::settingsWithGroup(const QString& group, QObject *parent)
|
|
||||||
{
|
|
||||||
if (g_configFileName()->isEmpty()) {
|
|
||||||
// cache file name
|
|
||||||
ConfigFile cfg;
|
|
||||||
*g_configFileName() = cfg.configFile();
|
|
||||||
}
|
|
||||||
std::unique_ptr<QSettings> settings(new QSettings(*g_configFileName(), QSettings::IniFormat, parent));
|
|
||||||
settings->beginGroup(group);
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace OCC
|
} // namespace OCC
|
||||||
|
|||||||
@@ -21,10 +21,6 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QUrl>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
class QSettings;
|
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
@@ -146,14 +142,6 @@ namespace Utility
|
|||||||
*/
|
*/
|
||||||
OWNCLOUDSYNC_EXPORT void sortFilenames(QStringList& fileNames);
|
OWNCLOUDSYNC_EXPORT void sortFilenames(QStringList& fileNames);
|
||||||
|
|
||||||
/** Appends concatPath and queryItems to the url */
|
|
||||||
OWNCLOUDSYNC_EXPORT QUrl concatUrlPath(
|
|
||||||
const QUrl &url, const QString &concatPath,
|
|
||||||
const QList< QPair<QString, QString> > &queryItems = (QList<QPair<QString, QString>>()));
|
|
||||||
|
|
||||||
/** Returns a new settings pre-set in a specific group. The Settings will be created
|
|
||||||
with the given parent. If no parent is specified, the caller must destroy the settings */
|
|
||||||
OWNCLOUDSYNC_EXPORT std::unique_ptr<QSettings> settingsWithGroup(const QString& group, QObject* parent = 0);
|
|
||||||
}
|
}
|
||||||
/** @} */ // \addtogroup
|
/** @} */ // \addtogroup
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ ENDIF()
|
|||||||
|
|
||||||
owncloud_add_test(FolderWatcher "${FolderWatcher_SRC}")
|
owncloud_add_test(FolderWatcher "${FolderWatcher_SRC}")
|
||||||
if( UNIX AND NOT APPLE )
|
if( UNIX AND NOT APPLE )
|
||||||
if(HAVE_QT5 AND NOT BUILD_WITH_QT4)
|
|
||||||
owncloud_add_test(InotifyWatcher "${FolderWatcher_SRC}")
|
owncloud_add_test(InotifyWatcher "${FolderWatcher_SRC}")
|
||||||
endif(HAVE_QT5 AND NOT BUILD_WITH_QT4)
|
|
||||||
endif(UNIX AND NOT APPLE)
|
endif(UNIX AND NOT APPLE)
|
||||||
|
|
||||||
owncloud_add_test(CSyncSqlite "")
|
owncloud_add_test(CSyncSqlite "")
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
static const QUrl sRootUrl("owncloud://somehost/owncloud/remote.php/webdav/");
|
static const QUrl sRootUrl("owncloud://somehost/owncloud/remote.php/webdav/");
|
||||||
static const QUrl sBundleRootUrl("owncloud://somehost/remote.php/dav/files/");
|
|
||||||
|
|
||||||
inline QString generateEtag() {
|
inline QString generateEtag() {
|
||||||
return QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch(), 16);
|
return QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch(), 16);
|
||||||
@@ -534,7 +533,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class FakeErrorReply : public QNetworkReply
|
class FakeErrorReply : public QNetworkReply
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -558,169 +556,6 @@ public:
|
|||||||
qint64 readData(char *, qint64) override { return 0; }
|
qint64 readData(char *, qint64) override { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class FakeBundlePOSTReply : public QNetworkReply
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
FileInfo *fileInfo;
|
|
||||||
QByteArray payload;
|
|
||||||
public:
|
|
||||||
FakeBundlePOSTReply(FileInfo &remoteRootFileInfo, QNetworkAccessManager::Operation op, const QNetworkRequest &request, const QByteArray &postPayload, QObject *parent)
|
|
||||||
: QNetworkReply{parent} {
|
|
||||||
setRequest(request);
|
|
||||||
QUrl rawUrl = request.url();
|
|
||||||
QString bundlePath(sBundleRootUrl.path()+rawUrl.userName());
|
|
||||||
setUrl(rawUrl);
|
|
||||||
setOperation(op);
|
|
||||||
open(QIODevice::ReadOnly);
|
|
||||||
const QString davUri{QStringLiteral("DAV:")};
|
|
||||||
const QString ocUri{QStringLiteral("http://owncloud.org/ns")};
|
|
||||||
const QString sabUri{QStringLiteral("http://sabredav.org/ns")};
|
|
||||||
QBuffer buffer{&payload};
|
|
||||||
buffer.open(QIODevice::WriteOnly);
|
|
||||||
QXmlStreamWriter xml( &buffer );
|
|
||||||
xml.writeNamespace(davUri, "d");
|
|
||||||
xml.writeNamespace(ocUri, "o");
|
|
||||||
xml.writeNamespace(sabUri, "s");
|
|
||||||
|
|
||||||
auto writeFileResponse = [&](const FileInfo &fileInfo) {
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("response"));
|
|
||||||
|
|
||||||
//TODO: no need for X-OC-PATH, href could contain that, fix client/server
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("href"), bundlePath);
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("propstat"));
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("prop"));
|
|
||||||
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("oc-etag"), fileInfo.etag);
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("etag"), fileInfo.etag);
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("oc-fileid"), fileInfo.fileId);
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("x-oc-mtime"), QStringLiteral("accepted"));
|
|
||||||
|
|
||||||
//TODO: this slash to be fixed on client/server
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("oc-path"), "/"+fileInfo.path());
|
|
||||||
xml.writeEndElement(); // prop
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("status"), "HTTP/1.1 200 OK");
|
|
||||||
xml.writeEndElement(); // propstat
|
|
||||||
xml.writeEndElement(); // response
|
|
||||||
};
|
|
||||||
auto writeFileErrorResponse = [&](const FileInfo &fileInfo, const QString &exception, const QString &message, const QString &status) {
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("response"));
|
|
||||||
|
|
||||||
//TODO: no need for X-OC-PATH, href could contain that, fix client/server
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("href"), bundlePath);
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("propstat"));
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("prop"));
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("error"));
|
|
||||||
xml.writeTextElement(sabUri, QStringLiteral("exception"), exception);
|
|
||||||
xml.writeTextElement(sabUri, QStringLiteral("message"), message);
|
|
||||||
xml.writeEndElement(); // error
|
|
||||||
|
|
||||||
//TODO: this slash to be fixed on client/server
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("oc-path"), "/"+fileInfo.path());
|
|
||||||
xml.writeEndElement(); // prop
|
|
||||||
xml.writeTextElement(davUri, QStringLiteral("status"), status);
|
|
||||||
xml.writeEndElement(); // propstat
|
|
||||||
xml.writeEndElement(); // response
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
if ("erroruser" == rawUrl.userName()) {
|
|
||||||
xml.writeStartDocument();
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("error"));
|
|
||||||
xml.writeTextElement(sabUri, QStringLiteral("exception"), QStringLiteral("OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden"));
|
|
||||||
xml.writeTextElement(sabUri, QStringLiteral("message"), QStringLiteral("URL endpoint has to be instance of \\OCA\\DAV\\Files\\FilesHome"));
|
|
||||||
xml.writeTextElement(ocUri, QStringLiteral("retry"), QStringLiteral("false"));
|
|
||||||
xml.writeTextElement(ocUri, QStringLiteral("reason"), QStringLiteral("URL endpoint has to be instance of \\OCA\\DAV\\Files\\FilesHome"));
|
|
||||||
xml.writeEndElement(); // error
|
|
||||||
xml.writeEndDocument();
|
|
||||||
setAttribute(QNetworkRequest::HttpStatusCodeAttribute, 403);
|
|
||||||
} else {
|
|
||||||
Q_ASSERT(request.url().path().endsWith(bundlePath));
|
|
||||||
xml.writeStartDocument();
|
|
||||||
xml.writeStartElement(davUri, QStringLiteral("multistatus"));
|
|
||||||
|
|
||||||
//multipart parsing
|
|
||||||
QString headerSectEnd = "\r\n\r\n";
|
|
||||||
QString headerEnd = "\r\n";
|
|
||||||
QString headerOcMethod = "X-OC-Method: ";
|
|
||||||
QString headerConLen = "Content-Length: ";
|
|
||||||
QString headerOcPath = "X-OC-Path: ";
|
|
||||||
int indexOfBody = 0;
|
|
||||||
QChar contentChar;
|
|
||||||
|
|
||||||
while(postPayload.indexOf(headerSectEnd,indexOfBody) + headerSectEnd.length() >=indexOfBody) {
|
|
||||||
//find oc-method
|
|
||||||
int indexOfheaderEnd = postPayload.indexOf(headerOcMethod,indexOfBody) + headerOcMethod.length();
|
|
||||||
int indexOfheaderBodyEnd = postPayload.indexOf(headerEnd,indexOfheaderEnd);
|
|
||||||
Q_ASSERT(postPayload.mid(indexOfheaderEnd,indexOfheaderBodyEnd-indexOfheaderEnd) == QString("PUT"));
|
|
||||||
|
|
||||||
//find oc-path
|
|
||||||
indexOfheaderEnd = postPayload.indexOf(headerOcPath,indexOfBody) + headerOcPath.length();
|
|
||||||
indexOfheaderBodyEnd = postPayload.indexOf(headerEnd,indexOfheaderEnd)-1;
|
|
||||||
QString filePath(postPayload.mid(indexOfheaderEnd+1,indexOfheaderBodyEnd-indexOfheaderEnd));
|
|
||||||
|
|
||||||
//find content-length
|
|
||||||
indexOfheaderEnd = postPayload.indexOf(headerConLen,indexOfBody) + headerConLen.length();
|
|
||||||
indexOfheaderBodyEnd = postPayload.indexOf(headerEnd,indexOfheaderEnd);
|
|
||||||
QString fileSize(postPayload.mid(indexOfheaderEnd,indexOfheaderBodyEnd-indexOfheaderEnd));
|
|
||||||
|
|
||||||
|
|
||||||
//find body content and extract first letter
|
|
||||||
indexOfheaderEnd = postPayload.indexOf(headerSectEnd,indexOfBody) + headerSectEnd.length();
|
|
||||||
indexOfBody = indexOfheaderEnd+1;
|
|
||||||
contentChar = postPayload.at(indexOfheaderEnd+1);
|
|
||||||
|
|
||||||
if ((fileInfo = remoteRootFileInfo.find(filePath))) {
|
|
||||||
fileInfo->size = fileSize.toInt();
|
|
||||||
fileInfo->contentChar = contentChar.toAscii();
|
|
||||||
} else {
|
|
||||||
// Assume that the file is filled with the same character
|
|
||||||
fileInfo = remoteRootFileInfo.create(filePath, fileSize.toInt(), contentChar.toAscii());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fileInfo) {
|
|
||||||
abort();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filePath.endsWith("normalerrorfile")){
|
|
||||||
writeFileErrorResponse(*fileInfo, QStringLiteral("Sabre\\DAV\\Exception\\BadRequest"), QStringLiteral("Method not allowed - file exists - update of the file is not supported!"), QStringLiteral("HTTP/1.1 400 Bad Request"));
|
|
||||||
} else if (filePath.endsWith("fatalerrorfile")){
|
|
||||||
writeFileErrorResponse(*fileInfo, QStringLiteral("Sabre\\DAV\\Exception\\ServiceUnavailable"), QStringLiteral("Failed to check file size"), QStringLiteral("HTTP/1.1 503 Service Unavailable"));
|
|
||||||
} else if (filePath.endsWith("softerrorfile")){
|
|
||||||
writeFileErrorResponse(*fileInfo, QStringLiteral("OCA\\DAV\\Connector\\Sabre\\Exception\\FileLocked"), QStringLiteral("Target file is locked by another process."), QStringLiteral("HTTP/1.1 423 Locked (WebDAV; RFC 4918)"));
|
|
||||||
} else {
|
|
||||||
writeFileResponse(*fileInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xml.writeEndElement(); // multistatus
|
|
||||||
xml.writeEndDocument();
|
|
||||||
setAttribute(QNetworkRequest::HttpStatusCodeAttribute, 207);
|
|
||||||
setFinished(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
QMetaObject::invokeMethod(this, "respond", Qt::QueuedConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_INVOKABLE void respond() {
|
|
||||||
setHeader(QNetworkRequest::ContentTypeHeader, "application/xml; charset=utf-8");
|
|
||||||
setHeader(QNetworkRequest::ContentLengthHeader, payload.size());
|
|
||||||
emit metaDataChanged();
|
|
||||||
if (bytesAvailable())
|
|
||||||
emit readyRead();
|
|
||||||
emit finished();
|
|
||||||
}
|
|
||||||
|
|
||||||
void abort() override { }
|
|
||||||
|
|
||||||
qint64 bytesAvailable() const override { return payload.size() + QIODevice::bytesAvailable(); }
|
|
||||||
qint64 readData(char *data, qint64 maxlen) override {
|
|
||||||
qint64 len = std::min(qint64{payload.size()}, maxlen);
|
|
||||||
strncpy(data, payload.constData(), len);
|
|
||||||
payload.remove(0, len);
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class FakeQNAM : public QNetworkAccessManager
|
class FakeQNAM : public QNetworkAccessManager
|
||||||
{
|
{
|
||||||
FileInfo _remoteRootFileInfo;
|
FileInfo _remoteRootFileInfo;
|
||||||
@@ -751,9 +586,7 @@ protected:
|
|||||||
return new FakeDeleteReply{_remoteRootFileInfo, op, request, this};
|
return new FakeDeleteReply{_remoteRootFileInfo, op, request, this};
|
||||||
else if (verb == QLatin1String("MOVE"))
|
else if (verb == QLatin1String("MOVE"))
|
||||||
return new FakeMoveReply{_remoteRootFileInfo, op, request, this};
|
return new FakeMoveReply{_remoteRootFileInfo, op, request, this};
|
||||||
else if (op == QNetworkAccessManager::PostOperation) {
|
else {
|
||||||
return new FakeBundlePOSTReply{_remoteRootFileInfo, op, request, outgoingData->readAll(), this};
|
|
||||||
} else {
|
|
||||||
qDebug() << verb << outgoingData;
|
qDebug() << verb << outgoingData;
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
@@ -765,6 +598,7 @@ class FakeCredentials : public OCC::AbstractCredentials
|
|||||||
QNetworkAccessManager *_qnam;
|
QNetworkAccessManager *_qnam;
|
||||||
public:
|
public:
|
||||||
FakeCredentials(QNetworkAccessManager *qnam) : _qnam{qnam} { }
|
FakeCredentials(QNetworkAccessManager *qnam) : _qnam{qnam} { }
|
||||||
|
virtual bool changed(AbstractCredentials *) const { return false; }
|
||||||
virtual QString authType() const { return "test"; }
|
virtual QString authType() const { return "test"; }
|
||||||
virtual QString user() const { return "admin"; }
|
virtual QString user() const { return "admin"; }
|
||||||
virtual QNetworkAccessManager* getQNAM() const { return _qnam; }
|
virtual QNetworkAccessManager* getQNAM() const { return _qnam; }
|
||||||
@@ -870,10 +704,6 @@ public:
|
|||||||
execUntilFinished();
|
execUntilFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
OCC::AccountPtr getAccount() {
|
|
||||||
return _account;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void toDisk(QDir &dir, const FileInfo &templateFi) {
|
static void toDisk(QDir &dir, const FileInfo &templateFi) {
|
||||||
foreach (const FileInfo &child, templateFi.children) {
|
foreach (const FileInfo &child, templateFi.children) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ private slots:
|
|||||||
QFETCH(QueryItems, query);
|
QFETCH(QueryItems, query);
|
||||||
QFETCH(QString, expected);
|
QFETCH(QString, expected);
|
||||||
QUrl baseUrl("http://example.com" + base);
|
QUrl baseUrl("http://example.com" + base);
|
||||||
QUrl resultUrl = Utility::concatUrlPath(baseUrl, concat, query);
|
QUrl resultUrl = Account::concatUrlPath(baseUrl, concat, query);
|
||||||
QString result = QString::fromUtf8(resultUrl.toEncoded());
|
QString result = QString::fromUtf8(resultUrl.toEncoded());
|
||||||
QString expectedFull = "http://example.com" + expected;
|
QString expectedFull = "http://example.com" + expected;
|
||||||
QCOMPARE(result, expectedFull);
|
QCOMPARE(result, expectedFull);
|
||||||
|
|||||||
@@ -11,18 +11,23 @@
|
|||||||
|
|
||||||
using namespace OCC;
|
using namespace OCC;
|
||||||
|
|
||||||
class TestInotifyWatcher: public FolderWatcherPrivate
|
|
||||||
|
struct FriendlyFolderWatcherPrivate : FolderWatcherPrivate
|
||||||
|
{
|
||||||
|
using FolderWatcherPrivate::FolderWatcherPrivate;
|
||||||
|
friend class TestInotifyWatcher;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TestInotifyWatcher : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
|
||||||
QString _root;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase() {
|
// Test the recursive path listing function lists everything
|
||||||
qsrand(QTime::currentTime().msec());
|
void testAddFolderRecursiveHelper() {
|
||||||
|
QTemporaryDir tmpDir;
|
||||||
|
|
||||||
_root = QDir::tempPath() + "/" + "test_" + QString::number(qrand());
|
QString _root = tmpDir.path();
|
||||||
qDebug() << "creating test directory tree in " << _root;
|
qDebug() << "creating test directory tree in " << _root;
|
||||||
QDir rootDir(_root);
|
QDir rootDir(_root);
|
||||||
|
|
||||||
@@ -32,13 +37,13 @@ private slots:
|
|||||||
rootDir.mkpath(_root + "/a1/b3/c3");
|
rootDir.mkpath(_root + "/a1/b3/c3");
|
||||||
rootDir.mkpath(_root + "/a2/b3/c3");
|
rootDir.mkpath(_root + "/a2/b3/c3");
|
||||||
|
|
||||||
}
|
FriendlyFolderWatcherPrivate watcher(0, _root);
|
||||||
|
QVERIFY(watcher._fd >= 0);
|
||||||
|
QCoreApplication::processEvents(); // Let the slotAddFolderRecursive slot run;
|
||||||
|
QStringList dirs = watcher._watches.values();
|
||||||
|
|
||||||
// Test the recursive path listing function findFoldersBelow
|
QVERIFY( dirs.indexOf(_root)>-1);
|
||||||
void testDirsBelowPath() {
|
|
||||||
QStringList dirs;
|
|
||||||
|
|
||||||
bool ok = findFoldersBelow(QDir(_root), dirs);
|
|
||||||
QVERIFY( dirs.indexOf(_root + "/a1")>-1);
|
QVERIFY( dirs.indexOf(_root + "/a1")>-1);
|
||||||
QVERIFY( dirs.indexOf(_root + "/a1/b1")>-1);
|
QVERIFY( dirs.indexOf(_root + "/a1/b1")>-1);
|
||||||
QVERIFY( dirs.indexOf(_root + "/a1/b1/c1")>-1);
|
QVERIFY( dirs.indexOf(_root + "/a1/b1/c1")>-1);
|
||||||
@@ -53,20 +58,13 @@ private slots:
|
|||||||
QVERIFY( dirs.indexOf(_root + "/a1/b3")>-1);
|
QVERIFY( dirs.indexOf(_root + "/a1/b3")>-1);
|
||||||
QVERIFY( dirs.indexOf(_root + "/a1/b3/c3")>-1);
|
QVERIFY( dirs.indexOf(_root + "/a1/b3/c3")>-1);
|
||||||
|
|
||||||
QVERIFY( dirs.indexOf(_root + "/a2"));
|
QVERIFY( dirs.contains(_root + "/a2"));
|
||||||
QVERIFY( dirs.indexOf(_root + "/a2/b3"));
|
QVERIFY( dirs.contains(_root + "/a2/b3"));
|
||||||
QVERIFY( dirs.indexOf(_root + "/a2/b3/c3"));
|
QVERIFY( dirs.contains(_root + "/a2/b3/c3"));
|
||||||
|
|
||||||
QVERIFY2(dirs.count() == 11, "Directory count wrong.");
|
QCOMPARE(dirs.count(), 12);
|
||||||
|
|
||||||
QVERIFY2(ok, "findFoldersBelow failed.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupTestCase() {
|
|
||||||
if( _root.startsWith(QDir::tempPath() )) {
|
|
||||||
system( QString("rm -rf %1").arg(_root).toLocal8Bit() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(TestInotifyWatcher)
|
QTEST_APPLESS_MAIN(TestInotifyWatcher)
|
||||||
|
|||||||
@@ -31,16 +31,6 @@ bool itemDidCompleteSuccessfully(const QSignalSpy &spy, const QString &path)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncFileItem::Status itemDidCompleteWithStatus(const QSignalSpy &spy, const QString &path)
|
|
||||||
{
|
|
||||||
for(const QList<QVariant> &args : spy) {
|
|
||||||
SyncFileItem item = args[0].value<SyncFileItem>();
|
|
||||||
if (item.destination() == path)
|
|
||||||
return item._status;
|
|
||||||
}
|
|
||||||
return SyncFileItem::NoStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TestSyncEngine : public QObject
|
class TestSyncEngine : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -64,75 +54,6 @@ private slots:
|
|||||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void testFileUploadBundled() {
|
|
||||||
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
|
|
||||||
|
|
||||||
QVariantMap capBundle;
|
|
||||||
capBundle["bundlerequest"] = true;
|
|
||||||
QVariantMap caps;
|
|
||||||
caps["dav"] = capBundle;
|
|
||||||
fakeFolder.getAccount()->setCapabilities(caps);
|
|
||||||
|
|
||||||
testFileUploadBundledAllFilesOK(fakeFolder);
|
|
||||||
testFileUploadBundledErrorForFile(fakeFolder);
|
|
||||||
|
|
||||||
//TODO unfinished, cannot generate NetworkError
|
|
||||||
//testFileUploadBundledNotHomeCollection(fakeFolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
void testFileUploadBundledAllFilesOK(FakeFolder &fakeFolder) {
|
|
||||||
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
|
||||||
fakeFolder.localModifier().insert("A/a3");
|
|
||||||
fakeFolder.localModifier().insert("A/a4");
|
|
||||||
fakeFolder.localModifier().insert("B/b0");
|
|
||||||
fakeFolder.syncOnce();
|
|
||||||
|
|
||||||
//check separate files
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, "A/a3"));
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, "A/a4"));
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, "B/b0"));
|
|
||||||
|
|
||||||
//check whole bundle
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, ""));
|
|
||||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
|
||||||
}
|
|
||||||
|
|
||||||
void testFileUploadBundledErrorForFile(FakeFolder &fakeFolder) {
|
|
||||||
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
|
||||||
fakeFolder.localModifier().insert("A/a5");
|
|
||||||
fakeFolder.localModifier().insert("A/normalerrorfile");
|
|
||||||
fakeFolder.localModifier().insert("A/fatalerrorfile");
|
|
||||||
fakeFolder.localModifier().insert("A/softerrorfile");
|
|
||||||
fakeFolder.localModifier().insert("B/b3");
|
|
||||||
fakeFolder.syncOnce();
|
|
||||||
|
|
||||||
//check separate files
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, "A/a5"));
|
|
||||||
QVERIFY(SyncFileItem::NormalError == itemDidCompleteWithStatus(completeSpy, "A/normalerrorfile"));
|
|
||||||
QVERIFY(SyncFileItem::FatalError == itemDidCompleteWithStatus(completeSpy, "A/fatalerrorfile"));
|
|
||||||
QVERIFY(SyncFileItem::SoftError == itemDidCompleteWithStatus(completeSpy, "A/softerrorfile"));
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, "B/b3"));
|
|
||||||
|
|
||||||
//check whole bundle
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, ""));
|
|
||||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
|
||||||
}
|
|
||||||
|
|
||||||
void testFileUploadBundledNotHomeCollection(FakeFolder &fakeFolder) {
|
|
||||||
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
|
||||||
fakeFolder.localModifier().insert("A/a7");
|
|
||||||
fakeFolder.localModifier().insert("A/a8");
|
|
||||||
fakeFolder.localModifier().insert("B/b4");
|
|
||||||
|
|
||||||
//add the user "erroruser" which is not a FilesHomeCollection
|
|
||||||
fakeFolder.getAccount()->setUrl(QUrl(QStringLiteral("http://erroruser:admin@localhost/owncloud")));
|
|
||||||
fakeFolder.syncOnce();
|
|
||||||
|
|
||||||
//check whole bundle
|
|
||||||
QVERIFY(itemDidCompleteSuccessfully(completeSpy, ""));
|
|
||||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
|
||||||
}
|
|
||||||
|
|
||||||
void testDirDownload() {
|
void testDirDownload() {
|
||||||
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
|
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
|
||||||
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
||||||
|
|||||||
+18
-18
@@ -724,7 +724,7 @@ Continuing the sync as normal will cause all your files to be overwritten by an
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folder.cpp" line="1006"/>
|
<location filename="../src/gui/folder.cpp" line="1006"/>
|
||||||
<source>Backup detected</source>
|
<source>Backup detected</source>
|
||||||
<translation>Copia de seguretat detectada</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folder.cpp" line="1008"/>
|
<location filename="../src/gui/folder.cpp" line="1008"/>
|
||||||
@@ -734,7 +734,7 @@ Continuing the sync as normal will cause all your files to be overwritten by an
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folder.cpp" line="1009"/>
|
<location filename="../src/gui/folder.cpp" line="1009"/>
|
||||||
<source>Keep Local Files as Conflict</source>
|
<source>Keep Local Files as Conflict</source>
|
||||||
<translation>Manté els fitxers locals com a conflicte</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@@ -817,7 +817,7 @@ Continuing the sync as normal will cause all your files to be overwritten by an
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folderman.cpp" line="1190"/>
|
<location filename="../src/gui/folderman.cpp" line="1190"/>
|
||||||
<source>The selected path is not a folder!</source>
|
<source>The selected path is not a folder!</source>
|
||||||
<translation>La ruta seleccionada no és un directori!</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folderman.cpp" line="1194"/>
|
<location filename="../src/gui/folderman.cpp" line="1194"/>
|
||||||
@@ -904,7 +904,7 @@ Continuing the sync as normal will cause all your files to be overwritten by an
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folderstatusmodel.cpp" line="170"/>
|
<location filename="../src/gui/folderstatusmodel.cpp" line="170"/>
|
||||||
<source>Fetching folder list from server...</source>
|
<source>Fetching folder list from server...</source>
|
||||||
<translation>Obtenint la llista de carpetes del servidor...</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folderstatusmodel.cpp" line="841"/>
|
<location filename="../src/gui/folderstatusmodel.cpp" line="841"/>
|
||||||
@@ -1006,7 +1006,7 @@ Continuing the sync as normal will cause all your files to be overwritten by an
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/folderwizard.cpp" line="544"/>
|
<location filename="../src/gui/folderwizard.cpp" line="544"/>
|
||||||
<source>Add Sync Connection</source>
|
<source>Add Sync Connection</source>
|
||||||
<translation>Afegir una connexió de sincronització</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@@ -1521,7 +1521,7 @@ Els elements que poden ser eliminats s'eliminaran si impedeixen que una car
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/notificationwidget.cpp" line="50"/>
|
<location filename="../src/gui/notificationwidget.cpp" line="50"/>
|
||||||
<source>Created at %1</source>
|
<source>Created at %1</source>
|
||||||
<translation>Creat el %1</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/notificationwidget.cpp" line="99"/>
|
<location filename="../src/gui/notificationwidget.cpp" line="99"/>
|
||||||
@@ -1626,12 +1626,12 @@ privilegis addicionals durant el procés.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/wizard/owncloudadvancedsetuppage.cpp" line="142"/>
|
<location filename="../src/gui/wizard/owncloudadvancedsetuppage.cpp" line="142"/>
|
||||||
<source>Sync the folder '%1'</source>
|
<source>Sync the folder '%1'</source>
|
||||||
<translation>Sincronitzar el directori '%1'</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/wizard/owncloudadvancedsetuppage.cpp" line="147"/>
|
<location filename="../src/gui/wizard/owncloudadvancedsetuppage.cpp" line="147"/>
|
||||||
<source><p><small><strong>Warning:</strong> The local folder is not empty. Pick a resolution!</small></p></source>
|
<source><p><small><strong>Warning:</strong> The local folder is not empty. Pick a resolution!</small></p></source>
|
||||||
<translation><p><small><strong>Atenció:</strong> La carpeta local no està buida. Trieu una resolució!</small></p></translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/wizard/owncloudadvancedsetuppage.cpp" line="246"/>
|
<location filename="../src/gui/wizard/owncloudadvancedsetuppage.cpp" line="246"/>
|
||||||
@@ -1741,7 +1741,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/owncloudsetupwizard.cpp" line="181"/>
|
<location filename="../src/gui/owncloudsetupwizard.cpp" line="181"/>
|
||||||
<source>Timeout while trying to connect to %1 at %2.</source>
|
<source>Timeout while trying to connect to %1 at %2.</source>
|
||||||
<translation>S'ha esgotat el temps d'espera mentres es conectava a %1 a les %2.</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/owncloudsetupwizard.cpp" line="192"/>
|
<location filename="../src/gui/owncloudsetupwizard.cpp" line="192"/>
|
||||||
@@ -1931,12 +1931,12 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/propagatedownload.cpp" line="376"/>
|
<location filename="../src/libsync/propagatedownload.cpp" line="376"/>
|
||||||
<source>The download would reduce free disk space below %1</source>
|
<source>The download would reduce free disk space below %1</source>
|
||||||
<translation>La descàrrega reduïrà l'espai lliure al disc per sota de %1</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/propagatedownload.cpp" line="381"/>
|
<location filename="../src/libsync/propagatedownload.cpp" line="381"/>
|
||||||
<source>Free space on disk is less than %1</source>
|
<source>Free space on disk is less than %1</source>
|
||||||
<translation>L'espai lliure del disc dur es inferior a %1</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/propagatedownload.cpp" line="496"/>
|
<location filename="../src/libsync/propagatedownload.cpp" line="496"/>
|
||||||
@@ -1946,7 +1946,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/propagatedownload.cpp" line="545"/>
|
<location filename="../src/libsync/propagatedownload.cpp" line="545"/>
|
||||||
<source>The file could not be downloaded completely.</source>
|
<source>The file could not be downloaded completely.</source>
|
||||||
<translation>No es pot descarregar el fitxer completament.</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/propagatedownload.cpp" line="552"/>
|
<location filename="../src/libsync/propagatedownload.cpp" line="552"/>
|
||||||
@@ -2363,7 +2363,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/sharedialog.cpp" line="98"/>
|
<location filename="../src/gui/sharedialog.cpp" line="98"/>
|
||||||
<source>%1 Sharing</source>
|
<source>%1 Sharing</source>
|
||||||
<translation>Compartint amb %1</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/sharedialog.cpp" line="73"/>
|
<location filename="../src/gui/sharedialog.cpp" line="73"/>
|
||||||
@@ -2378,7 +2378,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/sharedialog.cpp" line="101"/>
|
<location filename="../src/gui/sharedialog.cpp" line="101"/>
|
||||||
<source>The server does not allow sharing</source>
|
<source>The server does not allow sharing</source>
|
||||||
<translation>El servidor no permet la compartició de fitxers</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/sharedialog.cpp" line="113"/>
|
<location filename="../src/gui/sharedialog.cpp" line="113"/>
|
||||||
@@ -3048,7 +3048,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/synclogdialog.ui" line="14"/>
|
<location filename="../src/gui/synclogdialog.ui" line="14"/>
|
||||||
<source>Synchronisation Log</source>
|
<source>Synchronisation Log</source>
|
||||||
<translation>Registre de sincronització</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@@ -3069,7 +3069,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/theme.cpp" line="289"/>
|
<location filename="../src/libsync/theme.cpp" line="289"/>
|
||||||
<source><p>Copyright ownCloud GmbH</p></source>
|
<source><p>Copyright ownCloud GmbH</p></source>
|
||||||
<translation><p>Copyright ownCloud GmbH</p></translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/theme.cpp" line="290"/>
|
<location filename="../src/libsync/theme.cpp" line="290"/>
|
||||||
@@ -3215,7 +3215,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/owncloudgui.cpp" line="296"/>
|
<location filename="../src/gui/owncloudgui.cpp" line="296"/>
|
||||||
<source>Account synchronization is disabled</source>
|
<source>Account synchronization is disabled</source>
|
||||||
<translation>La sincronització del compte està deshabilitada</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/owncloudgui.cpp" line="379"/>
|
<location filename="../src/gui/owncloudgui.cpp" line="379"/>
|
||||||
@@ -3642,7 +3642,7 @@ No és aconsellada usar-la.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/progressdispatcher.cpp" line="37"/>
|
<location filename="../src/libsync/progressdispatcher.cpp" line="37"/>
|
||||||
<source>Server version downloaded, copied changed local file into conflict file</source>
|
<source>Server version downloaded, copied changed local file into conflict file</source>
|
||||||
<translation>S'ha baixat la versió del servidor i s'ha renomenat el fitxer local com a fitxer de conflicte</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/progressdispatcher.cpp" line="39"/>
|
<location filename="../src/libsync/progressdispatcher.cpp" line="39"/>
|
||||||
|
|||||||
@@ -3071,7 +3071,7 @@ Il est déconseillé de l'utiliser.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/theme.cpp" line="289"/>
|
<location filename="../src/libsync/theme.cpp" line="289"/>
|
||||||
<source><p>Copyright ownCloud GmbH</p></source>
|
<source><p>Copyright ownCloud GmbH</p></source>
|
||||||
<translation><p>Copyright ownCloud, Inc.</p></translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/theme.cpp" line="290"/>
|
<location filename="../src/libsync/theme.cpp" line="290"/>
|
||||||
@@ -3296,7 +3296,7 @@ Il est déconseillé de l'utiliser.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/owncloudtheme.cpp" line="47"/>
|
<location filename="../src/libsync/owncloudtheme.cpp" line="47"/>
|
||||||
<source><p>Version %2. For more information visit <a href="%3">%4</a></p><p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, Olivier Goffart, Markus Götz and others.</small></p><p>Copyright ownCloud GmbH</p><p>Licensed under the GNU General Public License (GPL) Version 2.0<br/>ownCloud and the ownCloud Logo are registered trademarks of ownCloud, Inc. in the United States, other countries, or both.</p></source>
|
<source><p>Version %2. For more information visit <a href="%3">%4</a></p><p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, Olivier Goffart, Markus Götz and others.</small></p><p>Copyright ownCloud GmbH</p><p>Licensed under the GNU General Public License (GPL) Version 2.0<br/>ownCloud and the ownCloud Logo are registered trademarks of ownCloud, Inc. in the United States, other countries, or both.</p></source>
|
||||||
<translation><p>Version %2. Pour plus d'informations, consultez <a href="%3">%4</a></p><p><small>Par Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, Olivier Goffart, Markus Götz et autres.</small></p><p>Copyright ownCloud GmbH</p><p>Sous licence GNU General Public License (GPL) Version 2.0<br/>ownCloud et le logo ownCloud sont des marques déposées de ownCloud, Inc. aux Etats-Unis, dans d'autres pays, ou dans les deux.</p></translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
|||||||
@@ -3601,7 +3601,7 @@ We adviseren deze site niet te gebruiken.</translation>
|
|||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="324"/>
|
<location filename="../src/libsync/utility.cpp" line="324"/>
|
||||||
<source>%n second(s)</source>
|
<source>%n second(s)</source>
|
||||||
<translation><numerusform>%n seconde</numerusform><numerusform>%n seconde(n)</numerusform></translation>
|
<translation><numerusform>%n seconde</numerusform><numerusform>%n seconden</numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/utility.cpp" line="348"/>
|
<location filename="../src/libsync/utility.cpp" line="348"/>
|
||||||
|
|||||||
+13
-13
@@ -631,17 +631,17 @@
|
|||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/gui/folder.cpp" line="489"/>
|
<location filename="../src/gui/folder.cpp" line="489"/>
|
||||||
<source>%1 and %n other file(s) have been removed.</source>
|
<source>%1 and %n other file(s) have been removed.</source>
|
||||||
<translation><numerusform>%1 i %n inny plik został usunięty.</numerusform><numerusform>%1 i %n inne pliki zostały usunięte.</numerusform><numerusform>%1 i %n innych plików zostało usuniętych.</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/gui/folder.cpp" line="496"/>
|
<location filename="../src/gui/folder.cpp" line="496"/>
|
||||||
<source>%1 and %n other file(s) have been downloaded.</source>
|
<source>%1 and %n other file(s) have been downloaded.</source>
|
||||||
<translation><numerusform>%1 i %n inny plik został pobrany.</numerusform><numerusform>%1 i %n inne pliki zostały pobrane.</numerusform><numerusform>%1 i %n innych plików zostało pobranych.</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/gui/folder.cpp" line="503"/>
|
<location filename="../src/gui/folder.cpp" line="503"/>
|
||||||
<source>%1 and %n other file(s) have been updated.</source>
|
<source>%1 and %n other file(s) have been updated.</source>
|
||||||
<translation><numerusform>%1 i %n inny plik został zaktualizowany.</numerusform><numerusform>%1 i %n inne pliki zostały zaktualizowane.</numerusform><numerusform>%1 i %n innych plików zostało zaktualizowanych.</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/gui/folder.cpp" line="510"/>
|
<location filename="../src/gui/folder.cpp" line="510"/>
|
||||||
@@ -1156,7 +1156,7 @@ Jeśli kontynuujesz synchronizację, pliki zostaną nadpisane przez swój pierwo
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/generalsettings.ui" line="26"/>
|
<location filename="../src/gui/generalsettings.ui" line="26"/>
|
||||||
<source>&Launch on System Startup</source>
|
<source>&Launch on System Startup</source>
|
||||||
<translation>&Uruchamiaj podczas startu systemu</translation>
|
<translation>&Uruchamiaj podczas startu systemu Windows</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/generalsettings.ui" line="33"/>
|
<location filename="../src/gui/generalsettings.ui" line="33"/>
|
||||||
@@ -1933,7 +1933,7 @@ Niezalecane jest jego użycie.</translation>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/propagatedownload.cpp" line="376"/>
|
<location filename="../src/libsync/propagatedownload.cpp" line="376"/>
|
||||||
<source>The download would reduce free disk space below %1</source>
|
<source>The download would reduce free disk space below %1</source>
|
||||||
<translation>Pobranie zmniejszy ilość wolnego miejsca poniżej %1.</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/propagatedownload.cpp" line="381"/>
|
<location filename="../src/libsync/propagatedownload.cpp" line="381"/>
|
||||||
@@ -3523,12 +3523,12 @@ Kliknij</translation>
|
|||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="469"/>
|
<location filename="../src/libsync/utility.cpp" line="469"/>
|
||||||
<source>%n day(s) ago</source>
|
<source>%n day(s) ago</source>
|
||||||
<translation><numerusform>%n dzień temu</numerusform><numerusform>%n dni temu</numerusform><numerusform>%n dni temu</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="477"/>
|
<location filename="../src/libsync/utility.cpp" line="477"/>
|
||||||
<source>%n hour(s) ago</source>
|
<source>%n hour(s) ago</source>
|
||||||
<translation><numerusform>%n godzinę temu</numerusform><numerusform>%n godziny temu</numerusform><numerusform>%n godzin temu</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/utility.cpp" line="482"/>
|
<location filename="../src/libsync/utility.cpp" line="482"/>
|
||||||
@@ -3543,7 +3543,7 @@ Kliknij</translation>
|
|||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="487"/>
|
<location filename="../src/libsync/utility.cpp" line="487"/>
|
||||||
<source>%n minute(s) ago</source>
|
<source>%n minute(s) ago</source>
|
||||||
<translation><numerusform>%n minutę temu</numerusform><numerusform>%n minuty temu</numerusform><numerusform>%n minut temu</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/utility.cpp" line="490"/>
|
<location filename="../src/libsync/utility.cpp" line="490"/>
|
||||||
@@ -3576,27 +3576,27 @@ Kliknij</translation>
|
|||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="319"/>
|
<location filename="../src/libsync/utility.cpp" line="319"/>
|
||||||
<source>%n year(s)</source>
|
<source>%n year(s)</source>
|
||||||
<translation><numerusform>%n rok</numerusform><numerusform>%n lata</numerusform><numerusform>%n lat</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="320"/>
|
<location filename="../src/libsync/utility.cpp" line="320"/>
|
||||||
<source>%n month(s)</source>
|
<source>%n month(s)</source>
|
||||||
<translation><numerusform>%n miesiąc</numerusform><numerusform>%n miesiące</numerusform><numerusform>%n miesięcy</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="321"/>
|
<location filename="../src/libsync/utility.cpp" line="321"/>
|
||||||
<source>%n day(s)</source>
|
<source>%n day(s)</source>
|
||||||
<translation><numerusform>%n dzień</numerusform><numerusform>%n dni</numerusform><numerusform>%n dni</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="322"/>
|
<location filename="../src/libsync/utility.cpp" line="322"/>
|
||||||
<source>%n hour(s)</source>
|
<source>%n hour(s)</source>
|
||||||
<translation><numerusform>%n godzina</numerusform><numerusform>%n godziny</numerusform><numerusform>%n godzin</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="323"/>
|
<location filename="../src/libsync/utility.cpp" line="323"/>
|
||||||
<source>%n minute(s)</source>
|
<source>%n minute(s)</source>
|
||||||
<translation><numerusform>%n minuta</numerusform><numerusform>%n minuty</numerusform><numerusform>%n minut</numerusform></translation>
|
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform><numerusform></numerusform></translation>
|
||||||
</message>
|
</message>
|
||||||
<message numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/libsync/utility.cpp" line="324"/>
|
<location filename="../src/libsync/utility.cpp" line="324"/>
|
||||||
|
|||||||
@@ -264,7 +264,7 @@
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/accountsettings.cpp" line="346"/>
|
<location filename="../src/gui/accountsettings.cpp" line="346"/>
|
||||||
<source><p>Do you really want to stop syncing the folder <i>%1</i>?</p><p><b>Note:</b> This will <b>not</b> delete any files.</p></source>
|
<source><p>Do you really want to stop syncing the folder <i>%1</i>?</p><p><b>Note:</b> This will <b>not</b> delete any files.</p></source>
|
||||||
<translation><p>Deseja mesmo parar a sincronização da pasta <i>%1</i>?</p><p><b>Nota:</b> isto <b>não</b> irá eliminar qualquer ficheiro.</p></translation>
|
<translation><p>Deseja mesmo parar a sincronização da pasta <i>%1</i>?</p><p><b>Nota:</b> isto <b>não</b> irá eliminar quaisquer ficheiros.</p></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/accountsettings.cpp" line="488"/>
|
<location filename="../src/gui/accountsettings.cpp" line="488"/>
|
||||||
|
|||||||
@@ -3070,7 +3070,7 @@ It is not advisable to use it.</source>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/theme.cpp" line="289"/>
|
<location filename="../src/libsync/theme.cpp" line="289"/>
|
||||||
<source><p>Copyright ownCloud GmbH</p></source>
|
<source><p>Copyright ownCloud GmbH</p></source>
|
||||||
<translation><p>Все права принадлежат ownCloud GmbH</p></translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/theme.cpp" line="290"/>
|
<location filename="../src/libsync/theme.cpp" line="290"/>
|
||||||
@@ -3295,7 +3295,7 @@ It is not advisable to use it.</source>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/libsync/owncloudtheme.cpp" line="47"/>
|
<location filename="../src/libsync/owncloudtheme.cpp" line="47"/>
|
||||||
<source><p>Version %2. For more information visit <a href="%3">%4</a></p><p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, Olivier Goffart, Markus Götz and others.</small></p><p>Copyright ownCloud GmbH</p><p>Licensed under the GNU General Public License (GPL) Version 2.0<br/>ownCloud and the ownCloud Logo are registered trademarks of ownCloud, Inc. in the United States, other countries, or both.</p></source>
|
<source><p>Version %2. For more information visit <a href="%3">%4</a></p><p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, Olivier Goffart, Markus Götz and others.</small></p><p>Copyright ownCloud GmbH</p><p>Licensed under the GNU General Public License (GPL) Version 2.0<br/>ownCloud and the ownCloud Logo are registered trademarks of ownCloud, Inc. in the United States, other countries, or both.</p></source>
|
||||||
<translation><p>Версия %2. Дополнительная информация доступна по ссылке <a href="%3">%4</a></p><p><small>Авторы: Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, Olivier Goffart, Markus Götz, и другие.</small></p><p>Авторские права принадлежат ownCloud GmbH</p><p>Лицензировано под GNU General Public License (GPL) Версии 2.0<br/>ownCloud и логотип ownCloud - зарегистрированные торговые марки ownCloud, Inc. в Соединенных Штатах, и/или других странах</p></translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
|||||||
@@ -2550,7 +2550,7 @@ It is not advisable to use it.</source>
|
|||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/creds/shibboleth/shibbolethwebview.cpp" line="91"/>
|
<location filename="../src/gui/creds/shibboleth/shibbolethwebview.cpp" line="91"/>
|
||||||
<source>SSL Chipher Debug View</source>
|
<source>SSL Chipher Debug View</source>
|
||||||
<translation>查看SSL加密调试信息</translation>
|
<translation type="unfinished"/>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui/creds/shibboleth/shibbolethwebview.cpp" line="99"/>
|
<location filename="../src/gui/creds/shibboleth/shibbolethwebview.cpp" line="99"/>
|
||||||
|
|||||||
Referência em uma Nova Issue
Bloquear um usuário