Comparar commits
163 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 0e36a25b31 | |||
| acd151102c | |||
| 77e790d2ee | |||
| 899c675f0a | |||
| fb76487e76 | |||
| 0c0a3ca0a5 | |||
| 676ad530e7 | |||
| fbcb01ed27 | |||
| c2b006e857 | |||
| 0e7ccea588 | |||
| c16deb3e44 | |||
| 019544fcfd | |||
| 5f0167b19e | |||
| 29d3c33eb2 | |||
| 469eca1f5f | |||
| 0864d67a9a | |||
| e9503664f5 | |||
| 58cee61624 | |||
| d23d07f99b | |||
| d70db810dd | |||
| 842129f99d | |||
| 36d61ef3a9 | |||
| f1f27221a7 | |||
| eb012d26ee | |||
| 9ee8187083 | |||
| b0c45cfc89 | |||
| 90cea69692 | |||
| 155bdfbffe | |||
| 0e2782d369 | |||
| 6b3d0e69aa | |||
| f30aee6d4e | |||
| 82f86eb019 | |||
| 9573c5e64d | |||
| f5aff70398 | |||
| e3a4c3989a | |||
| 3e954bc17f | |||
| 2527569bb8 | |||
| 1e197531cb | |||
| 8b876576eb | |||
| a2287c9657 | |||
| 34c59ba9ed | |||
| c110745330 | |||
| 19521863a0 | |||
| c256896165 | |||
| ef922f60fa | |||
| 733ea90e6b | |||
| a4e1fa9dcf | |||
| 1a1684ca2a | |||
| 9c8572e335 | |||
| e675a34fbb | |||
| 5f47c01346 | |||
| 10644d3568 | |||
| 9ee3144358 | |||
| cf48ea2e00 | |||
| 6026148692 | |||
| a2222228c9 | |||
| 9e2d3f5bc7 | |||
| fe984b61d7 | |||
| e6be670e49 | |||
| 46ce2f4722 | |||
| 166a0f60ca | |||
| a9019ccbad | |||
| 0a4806af44 | |||
| 6b899be895 | |||
| 641785298f | |||
| 1f78ea0fd1 | |||
| 2fd9767892 | |||
| 69a1e46d0c | |||
| e020a5327e | |||
| 1b04489887 | |||
| 36a19703db | |||
| f3a345a23b | |||
| 826459eae7 | |||
| c2c36b85cb | |||
| 7b2f8ae6f7 | |||
| d600fdc89b | |||
| 8c5ea8dc90 | |||
| 0eddcd6384 | |||
| 9f2ae5dd17 | |||
| 766d9ae1ac | |||
| 21128ed762 | |||
| 5000d40619 | |||
| 0d321050a6 | |||
| fc7aaf792b | |||
| f6355e15a3 | |||
| d80d5a8ee4 | |||
| e0a36ab313 | |||
| 9d3e78ed54 | |||
| b6079bfe4f | |||
| f75106fd8e | |||
| 57fe7b800f | |||
| 089ecf8222 | |||
| c2fa9b5bbf | |||
| 86522cbbf0 | |||
| d54f8adac5 | |||
| d35ecafa0b | |||
| 2ca807280a | |||
| 91b6b88883 | |||
| f36d4562a1 | |||
| 67ecca492b | |||
| 84c925dc58 | |||
| e1a01c75d9 | |||
| 6a4adbc87e | |||
| 89974ab1d4 | |||
| 8d0c313486 | |||
| aab0cdf12a | |||
| a89520043e | |||
| 6382a142cd | |||
| 02c403e360 | |||
| 5f2b1999f6 | |||
| bd2bcad3ba | |||
| 598a7cec5d | |||
| 46d934bd95 | |||
| e8c8943a30 | |||
| f1e2e42d99 | |||
| 95c479aa07 | |||
| 035442b6da | |||
| 98efb07535 | |||
| bc04f79959 | |||
| e10c97573f | |||
| 383479fbfd | |||
| fca5f1b210 | |||
| 0cea3d85f5 | |||
| 85b8ab178e | |||
| ea9d17b41d | |||
| b7eb37dc03 | |||
| 98bfa8d5de | |||
| 3e1690ff7a | |||
| 826a675f32 | |||
| 323ebf9bf2 | |||
| e4bf3ec19a | |||
| f2721aff1d | |||
| 29bd8658bb | |||
| 8b9ca63eeb | |||
| 6f1b03c560 | |||
| 3bd3ffb8e2 | |||
| a810d69daa | |||
| 8496817db2 | |||
| 3d06f4b7c9 | |||
| b228488eb7 | |||
| 7fd00b2cd5 | |||
| 907918dca3 | |||
| 5ffaf3a90f | |||
| 1040e7b57b | |||
| 65c49e1de6 | |||
| 4abaee7736 | |||
| 3cdcd8dea0 | |||
| cb19ebc9e3 | |||
| 37adaa7872 | |||
| 9d93afb2a1 | |||
| 7c24ed769e | |||
| 65110f7a91 | |||
| c33abd468d | |||
| 584b205bd5 | |||
| b75f50d62c | |||
| 14457e93e6 | |||
| 9c0ecad420 | |||
| 85b5fdb3d3 | |||
| f2c6669224 | |||
| d8f9bf3a0b | |||
| d5fa8faa91 | |||
| d1a1b95926 | |||
| ee2a67e332 |
@@ -1,6 +1,15 @@
|
||||
ChangeLog
|
||||
=========
|
||||
|
||||
version 2.2.4 (release 2016-09-27)
|
||||
* Dolphin Plugin: Use the Application name for the socket path (#5172)
|
||||
* SyncEngine: Fix renaming of folder when file are changed (#5195)
|
||||
* Selective Sync: Fix HTTP request loop and show error in view (#5154)
|
||||
* ConnectionValidator: properly handle error in status.php request (#5188)
|
||||
* Discovery: Set thread priority to low (#5017)
|
||||
* ExcludeFiles: Fix when the folder casing is not the same in the settings and in the FS
|
||||
* ShareLink: Ensure the password line edit is enabled (#5117)
|
||||
|
||||
version 2.2.3 (release 2016-08-08)
|
||||
* SyncEngine: Fix detection of backup (#5104)
|
||||
* Fix bug with overriding URL in config (#5016)
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ https://github.com/owncloud/client.
|
||||
|
||||
## Building the source code
|
||||
|
||||
[Building the Client](http://doc.owncloud.org/desktop/2.0/building.html)
|
||||
[Building the Client](http://doc.owncloud.org/desktop/2.2/building.html)
|
||||
in the ownCloud Desktop Client manual.
|
||||
|
||||
## Maintainers and Contributors
|
||||
|
||||
@@ -9,6 +9,7 @@ StrCpy $PageReinstall_NEW_Field_3 "No instal·lar"
|
||||
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Ja instal·lat"
|
||||
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Trieu la manera com voleu instal·lar ${APPLICATION_NAME}."
|
||||
StrCpy $PageReinstall_OLD_Field_1 "Una versió més recent de ${APPLICATION_NAME} ja està instal.lada!! No es recomana instal.lar una versió més antiga. Si realment voleu instal.lar una versió més antiga, és millor primer desinstal.lar la versió actual. Seleccioni l'operació que desitjeu realitzar i feu clic a Següent per a continuar."
|
||||
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} ja està instal·lat.$\n$\nSeleccioneu la operació que voleu fer i feu clic a Següent per continuar."
|
||||
StrCpy $PageReinstall_SAME_Field_2 "Afegir/Reinstal.lar components"
|
||||
StrCpy $PageReinstall_SAME_Field_3 "Desinstal.lar ${APPLICATION_NAME}"
|
||||
StrCpy $UNINSTALLER_APPDATA_TITLE "Desinstal.lar ${APPLICATION_NAME}"
|
||||
@@ -37,7 +38,6 @@ StrCpy $UAC_ERROR_ELEVATE "No es pot elevar, error:"
|
||||
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "Aquest instal·lador requereix accés d'administrador, intenteu-ho de nou"
|
||||
StrCpy $INIT_INSTALLER_RUNNING "L'instal·lador ja s'està executant."
|
||||
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Aquest desinstal·lador requereix accés d'administrador, intenteu-ho de nou."
|
||||
StrCpy $UAC_ERROR_LOGON_SERVICE "El servei de inici de sessió no s'està executant, s'està abortant!"
|
||||
StrCpy $INIT_UNINSTALLER_RUNNING "El desinstal·lador ja s'està executant."
|
||||
StrCpy $SectionGroup_Shortcuts "Dreceres"
|
||||
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} is already installed.$\r$\nSelect the operation you want to perform and click Next to continue."
|
||||
StrCpy $UAC_ERROR_LOGON_SERVICE "Logon service is not running, aborting!"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Auto-generated - do not modify
|
||||
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Toon opmerkingen bij deze uitgave"
|
||||
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Toon opmerkingen bij deze versie"
|
||||
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Gevonden ${APPLICATION_EXECUTABLE} proces(sen) moet worden gestopt.$\nWilt u dat het installatieprogramma dat voor u doet?"
|
||||
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Stoppen ${APPLICATION_EXECUTABLE} processen."
|
||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Het te stoppen proces is niet gevonden!"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostrar notas de lançamento"
|
||||
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Encontrados ${APPLICATION_EXECUTABLE} processo(s) em execução que precisa(m) de ser interrompido(s).$\nDeseja que o instalador o(s) termine por si?"
|
||||
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "A terminar os processos de ${APPLICATION_EXECUTABLE}."
|
||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Não foi encontrado nenhum processo para terminar!"
|
||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Não foi encontrado o processo para terminar!"
|
||||
StrCpy $PageReinstall_NEW_Field_1 "Está instalada no sistema uma versão antiga de ${APPLICATION_NAME}. É recomendado que desinstale a versão atual antes de instalar a mais recente. Selecione a operação que deseja executar e clique em $\"Seguinte$\" para continuar."
|
||||
StrCpy $PageReinstall_NEW_Field_2 "Desinstalar antes de instalar"
|
||||
StrCpy $PageReinstall_NEW_Field_3 "Não desinstale"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
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_KILLING_PROCESSES_TEXT "Deteniendo el/los proceso/s ${APPLICATION_EXECUTABLE}."
|
||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "¡Proceso para finalizar no encontrado!"
|
||||
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "¡Proceso a 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_2 "Desinstalar antes de instalar"
|
||||
StrCpy $PageReinstall_NEW_Field_3 "No desinstalar"
|
||||
|
||||
@@ -32,7 +32,7 @@ find_library(CMOCKA_LIBRARY
|
||||
NAMES
|
||||
cmocka
|
||||
PATHS
|
||||
${CMOCKA_ROOT_DIR}/include
|
||||
${CMOCKA_ROOT_DIR}/lib
|
||||
)
|
||||
|
||||
if (CMOCKA_LIBRARY)
|
||||
|
||||
@@ -34,6 +34,8 @@ if( Qt5Core_FOUND )
|
||||
message(FATAL_ERROR "Qt5WebKit required for Shibboleth. Use -DNO_SHIBBOLETH=1 to disable it.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Qt5WebSockets)
|
||||
endif()
|
||||
|
||||
else( Qt5Core_FOUND )
|
||||
@@ -67,6 +69,12 @@ if( Qt5Core_FOUND )
|
||||
set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(Qt5WebSockets_FOUND)
|
||||
message(STATUS "Building with websocket notify support")
|
||||
include_directories(${Qt5WebSockets_INCLUDE_DIRS})
|
||||
set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5WebSockets_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_LIBRARIES_ONLY)
|
||||
macro(qt_wrap_ui)
|
||||
qt5_wrap_ui(${ARGN})
|
||||
|
||||
@@ -37,7 +37,7 @@ enum csync_exclude_type_e {
|
||||
typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
|
||||
|
||||
#ifdef WITH_UNIT_TESTING
|
||||
int _csync_exclude_add(c_strlist_t **inList, const char *string);
|
||||
int OCSYNC_EXPORT _csync_exclude_add(c_strlist_t **inList, const char *string);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,7 +65,21 @@ static c_rbnode_t *_csync_check_ignored(c_rbtree_t *tree, const char *path, int
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* The main function in the reconcile pass.
|
||||
*
|
||||
* It's called for each entry in the local and remote rbtrees by
|
||||
* csync_reconcile()
|
||||
*
|
||||
* Before the reconcile phase the trees already know about changes
|
||||
* relative to the sync journal. This function's job is to spot conflicts
|
||||
* between local and remote changes and adjust the nodes accordingly.
|
||||
*
|
||||
* See doc/dev/sync-algorithm.md for an overview.
|
||||
*
|
||||
*
|
||||
* Older detail comment:
|
||||
*
|
||||
* We merge replicas at the file level. The merged replica contains the
|
||||
* superset of files that are on the local machine and server copies of
|
||||
* the replica. In the case where the same file is in both the local
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
extern "C" {
|
||||
#include "csync_private.h"
|
||||
#include "csync_rename.h"
|
||||
}
|
||||
|
||||
#include <map>
|
||||
@@ -93,5 +94,9 @@ char* csync_rename_adjust_path_source(CSYNC* ctx, const char* path)
|
||||
return c_strdup(path);
|
||||
}
|
||||
|
||||
bool csync_rename_count(CSYNC *ctx) {
|
||||
csync_rename_s* d = csync_rename_s::get(ctx);
|
||||
return d->folder_renamed_from.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ char OCSYNC_EXPORT *csync_rename_adjust_path(CSYNC *ctx, const char *path);
|
||||
char OCSYNC_EXPORT *csync_rename_adjust_path_source(CSYNC *ctx, const char *path);
|
||||
void OCSYNC_EXPORT csync_rename_destroy(CSYNC *ctx);
|
||||
void OCSYNC_EXPORT csync_rename_record(CSYNC *ctx, const char *from, const char *to);
|
||||
/* Return the amount of renamed item recorded */
|
||||
bool OCSYNC_EXPORT csync_rename_count(CSYNC *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -158,7 +158,19 @@ static bool _csync_mtime_equal(time_t a, time_t b)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The main function of the discovery/update pass.
|
||||
*
|
||||
* It's called (indirectly) by csync_update(), once for each entity in the
|
||||
* local filesystem and once for each entity in the server data.
|
||||
*
|
||||
* It has two main jobs:
|
||||
* - figure out whether anything happened compared to the sync journal
|
||||
* and set (primarily) the instruction flag accordingly
|
||||
* - build the ctx->local.tree / ctx->remote.tree
|
||||
*
|
||||
* See doc/dev/sync-algorithm.md for an overview.
|
||||
*/
|
||||
static int _csync_detect_update(CSYNC *ctx, const char *file,
|
||||
const csync_vio_file_stat_t *fs, const int type) {
|
||||
uint64_t h = 0;
|
||||
|
||||
@@ -232,6 +232,37 @@ assertLocalAndRemoteDir( '', 0);
|
||||
system("sqlite3 " . localDir().'.csync_journal.db .dump');
|
||||
|
||||
|
||||
#######################################################################
|
||||
printInfo( "multiple restores of a file create different conflict files" );
|
||||
|
||||
system("sleep 1"); #make sure changes have different mtime
|
||||
|
||||
system("echo 'modified_1' > ". localDir() . "readonlyDirectory_PERM_M_/canotBeModified_PERM_DVN_.data");
|
||||
|
||||
#do the sync
|
||||
csync();
|
||||
assertCsyncJournalOk(localDir());
|
||||
|
||||
system("sleep 1"); #make sure changes have different mtime
|
||||
|
||||
system("echo 'modified_2' > ". localDir() . "readonlyDirectory_PERM_M_/canotBeModified_PERM_DVN_.data");
|
||||
|
||||
#do the sync
|
||||
csync();
|
||||
assertCsyncJournalOk(localDir());
|
||||
|
||||
# there should be two conflict files
|
||||
# TODO check that the conflict file has the right content
|
||||
my @conflicts = glob(localDir().'readonlyDirectory_PERM_M_/canotBeModified_PERM_DVN__conflict-*.data' );
|
||||
assert( scalar @conflicts == 2 );
|
||||
# remove the conflicts for the next assertLocalAndRemoteDir
|
||||
system("rm " . localDir().'readonlyDirectory_PERM_M_/canotBeModified_PERM_DVN__conflict-*.data' );
|
||||
|
||||
### Both side should still be the same
|
||||
assertLocalAndRemoteDir( '', 0);
|
||||
|
||||
|
||||
|
||||
cleanup();
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ assertLocalAndRemoteDir( '', 0);
|
||||
printInfo( "Testing with a .sys.admin#recall#" );
|
||||
system("echo 'dir/file2.dat' > ". $tmpdir . ".sys.admin\#recall\#");
|
||||
system("echo 'dir/file3.dat' >> ". $tmpdir . ".sys.admin\#recall\#");
|
||||
system("echo 'nonexistant' >> ". $tmpdir . ".sys.admin\#recall\#");
|
||||
system("echo '/tmp/t_recall/file4.dat' >> ". $tmpdir . ".sys.admin\#recall\#");
|
||||
glob_put( "$tmpdir/.sys.admin\#recall\#", "" );
|
||||
|
||||
csync();
|
||||
@@ -68,6 +70,10 @@ assert( -e glob(localDir().'dir/file3_.sys.admin#recall#-*.dat' ) );
|
||||
assert( -e glob(localDir().'dir/file2.dat' ) );
|
||||
assert( -e glob(localDir().'dir/file3.dat' ) );
|
||||
|
||||
assert( !-e glob(localDir().'nonexistant*' ) );
|
||||
assert( !-e glob('/tmp/t_recall/file4_.sys.admin#recall#-*.dat' ) );
|
||||
assert( -e glob('/tmp/t_recall/file4.dat' ) );
|
||||
|
||||
#Remove the recall file
|
||||
unlink(localDir() . ".sys.admin#recall#");
|
||||
|
||||
|
||||
@@ -199,12 +199,6 @@ the database by comparing the files and their modification times. This process
|
||||
ensures that both server and client are synchronized using the appropriate NTP
|
||||
time before restarting the client following a database removal.
|
||||
|
||||
Pressing ``F5`` while in the Account Settings Dialog enables you to "reset" the
|
||||
journal. This function can be used to recreate the journal database.
|
||||
|
||||
.. note:: We recommend that you use this function only when advised to do so by
|
||||
ownCloud support staff.
|
||||
|
||||
Custom WebDAV Properties
|
||||
------------------------
|
||||
|
||||
|
||||
+18
-3
@@ -42,7 +42,8 @@ repositories`_ to see all the Linux client repos.
|
||||
echo 'deb-src
|
||||
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 distribution:
|
||||
2. Install the dependencies using the following commands for your specific Linux
|
||||
distribution. Make sure the repositories for source packages are enabled.
|
||||
|
||||
* Debian/Ubuntu: ``apt-get update; apt-get build-dep owncloud-client``
|
||||
* openSUSE/SLES: ``zypper ref; zypper si -d owncloud-client``
|
||||
@@ -65,11 +66,18 @@ recipes.
|
||||
|
||||
To set up your build environment for development using HomeBrew_:
|
||||
|
||||
1. Add the ownCloud repository using the following command::
|
||||
1. Install Xcode
|
||||
2. Install Xcode command line tools::
|
||||
xcode-select --install
|
||||
|
||||
3. Install homebrew::
|
||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
|
||||
4. Add the ownCloud repository using the following command::
|
||||
|
||||
brew tap owncloud/owncloud
|
||||
|
||||
2. Install any missing dependencies::
|
||||
5. Install any missing dependencies::
|
||||
|
||||
brew install $(brew deps owncloud-client)
|
||||
|
||||
@@ -79,6 +87,9 @@ To set up your build environment for development using HomeBrew_:
|
||||
|
||||
Where ``x.z`` is the current version of Qt 5 that brew has installed
|
||||
on your machine.
|
||||
4. Install qtkeychain from here: git clone https://github.com/frankosterfeld/qtkeychain.git
|
||||
make sure you make the same install prefix as later while building the client e.g. -
|
||||
``DCMAKE_INSTALL_PREFIX=/Path/to/client-install``
|
||||
|
||||
5. For compilation of the client, follow the :ref:`generic-build-instructions`.
|
||||
|
||||
@@ -233,6 +244,10 @@ To build the most up-to-date version of the client:
|
||||
.. note:: On Mac OS X, you need to specify ``-DCMAKE_INSTALL_PREFIX=target``,
|
||||
where ``target`` is a private location, i.e. in parallel to your build
|
||||
dir by specifying ``../install``.
|
||||
|
||||
..note:: qtkeychain must be compiled with the same prefix e.g CMAKE_INSTALL_PREFIX=/Users/path/to/client/install/
|
||||
|
||||
.. note:: Example:: cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 -DCMAKE_INSTALL_PREFIX=/Users/path/to/client/install/ -D_OPENSSL_LIBDIR=/usr/local/opt/openssl/lib/ -D_OPENSSL_INCLUDEDIR=/usr/local/opt/openssl/include/ -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include/ -DNO_SHIBBOLETH=1
|
||||
|
||||
4. Call ``make``.
|
||||
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
Sync Algorithm
|
||||
==============
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
This is a technical description of the synchronization (sync) algorithm used by the ownCloud client.
|
||||
|
||||
The sync algorithm is the thing that looks at the local and remote file system trees and the sync journal and decides which steps need to be taken to bring the two trees into synchronization. It's different from the propagator, whose job it is to actually execute these steps.
|
||||
|
||||
|
||||
Definitions
|
||||
-----------
|
||||
|
||||
- local tree: The files and directories on the local file system that shall be kept in sync with the remote tree.
|
||||
- remote tree: The files and directories on the ownCloud server that shall be kept in sync with the local tree.
|
||||
- sync journal (journal): A snapshot of file and directory metadata that the sync algorithm uses as a baseline to detect local or remote changes. Typically stored in a database.
|
||||
- file and directory metadata:
|
||||
- mtimes
|
||||
- sizes
|
||||
- inodes (journal and local only): Representation of filesystem object. Useful for rename detection.
|
||||
- etags (journal and remote only): The server assigns a new etag when a file or directory changes.
|
||||
- checksums (journal and remote only): Checksum algorithm applied to a file's contents.
|
||||
- permissions (journal and remote only)
|
||||
|
||||
|
||||
Phases
|
||||
------
|
||||
|
||||
### Discovery (aka Update)
|
||||
|
||||
The discovery phase collects file and directory metadata from the local and remote trees, detecting differences between each tree and the journal.
|
||||
|
||||
Afterwards, we have two trees that tell us what happened relative to the journal. But there may still be conflicts if something happened to an entity both locally and on the remote.
|
||||
|
||||
- Input: file system, server data, journal
|
||||
- Output: two c_rbtree_t*, representing the local and remote trees
|
||||
|
||||
- Note on remote discovery: Since a change to a file on the server causes the etags of all parent folders to change, folders with an unchanged etag can be read from the journal directly and don't need to be walked into.
|
||||
|
||||
- Details
|
||||
- csync_update() uses csync_ftw() on the local and remote trees, one after the other.
|
||||
- csync_ftw() iterates through the entities in a tree and calls csync_walker() for each.
|
||||
- csync_walker() calls _csync_detect_update() on each.
|
||||
- _csync_detect_update() compares the item to its journal entry (if any) to detect new, changed or renamed files. This is the main function of this pass.
|
||||
|
||||
|
||||
|
||||
### Reconcile
|
||||
|
||||
The reconcile phase compares and adjusts the local and remote trees (in both directions), detecting conflicts.
|
||||
|
||||
Afterwards, there are still two trees, but conflicts are marked in them.
|
||||
|
||||
- Input: c_rbtree_t* for the local and remote trees, journal (for some rename-related queries)
|
||||
- Output: changes c_rbtree_t* in-place
|
||||
|
||||
- Details
|
||||
- csync_reconcile() runs csync_reconcile_updates() for the local and remote trees, one after the other.
|
||||
- csync_reconcile_updates() uses c_rbtree_walk() to iterate through the entries, calling _csync_merge_algorithm_visitor() for each.
|
||||
- _csync_merge_algorithm_visitor() checks whether the other tree also has an entry for that node and merges the actions, detecting conflicts. This is the main function of this pass.
|
||||
|
||||
|
||||
### Post-Reconcile
|
||||
|
||||
The post-reconcile phase merges the two trees into one set of SyncFileItems.
|
||||
|
||||
Afterwards, there is a list of items that can tell the propagator what needs to be done.
|
||||
|
||||
- Input: c_rbtree_t* for the local and remote trees
|
||||
- Output: QMap<QString, SyncFileItemPtr>
|
||||
|
||||
- Note that some "propagations", specifically cheap metadata-only updates, are already done at this stage.
|
||||
|
||||
- Details
|
||||
- csync_walk_local_tree() and csync_walk_remote_tree() are called.
|
||||
- They use _csync_walk_tree() to run SyncEngine::treewalkFile() on each entry.
|
||||
- treewalkFile() creates and fills SyncFileItems for each entry, ensuring that each file only has a single instance. This is the main function of this pass.
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
An overview of the propagation steps is still missing. The sync protocol is documented at https://github.com/cernbox/smashbox/blob/master/protocol/protocol.md.
|
||||
+206
-4
@@ -292,6 +292,207 @@ 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
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# Translations
|
||||
|
||||
|
||||
# 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
|
||||
GenericName[oc]=Dorsièr de Sincronizacion
|
||||
@@ -382,10 +583,10 @@ Comment[cs_CZ]=@APPLICATION_NAME@ počítačový synchronizační klient
|
||||
GenericName[cs_CZ]=Synchronizace adresáře
|
||||
Name[cs_CZ]=@APPLICATION_NAME@ počítačový synchronizační klient
|
||||
Icon[cs_CZ]=@APPLICATION_EXECUTABLE@
|
||||
Comment[ru]=Настольный клиент синхронизации @НАЗВАНИЕ_ПРИЛОЖЕНИЯ@
|
||||
GenericName[ru]=Синхронизация папки
|
||||
Name[ru]=Настольный клиент синхронизации @НАЗВАНИЕ_ПРИЛОЖЕНИЯ@
|
||||
Icon[ru]=@ВЫПОЛНЯЕМОЕ_ПРИЛОЖЕНИЕ@
|
||||
Comment[ru]=Настольный клиент синхронизации @APPLICATION_NAME@
|
||||
GenericName[ru]=Синхронизация каталогов
|
||||
Name[ru]=Настольный клиент синхронизации @APPLICATION_NAME@
|
||||
Icon[ru]=@APPLICATION_EXECUTABLE@
|
||||
Comment[sl]=@APPLICATION_NAME@ ‒ Program za usklajevanje datotek z namizjem
|
||||
GenericName[sl]=Usklajevanje map
|
||||
Name[sl]=@APPLICATION_NAME@ ‒ Program za usklajevanje datotek z namizjem
|
||||
@@ -427,6 +628,7 @@ Comment[th_TH]=@APPLICATION_NAME@ ไคลเอนต์ประสานข
|
||||
GenericName[th_TH]=ประสานข้อมูลโฟลเดอร์
|
||||
Name[th_TH]= @APPLICATION_NAME@ ไคลเอนต์ประสานข้อมูลเดสก์ท็อป
|
||||
Icon[th_TH]=@APPLICATION_EXECUTABLE@
|
||||
GenericName[es_MX]=Sincronización de Carpetas
|
||||
Comment[nb_NO]=@APPLICATION_NAME@ skrivebordssynkroniseringsklient
|
||||
GenericName[nb_NO]=Mappesynkronisering
|
||||
Name[nb_NO]=@APPLICATION_NAME@ skrivebordssynkroniseringsklient
|
||||
|
||||
@@ -4,6 +4,7 @@ if( UNIX AND NOT APPLE )
|
||||
|
||||
configure_file(syncstate.py syncstate.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.
|
||||
set (cmd "${CMAKE_CURRENT_SOURCE_DIR}/setappname.sh")
|
||||
@@ -18,9 +19,17 @@ if( UNIX AND NOT APPLE )
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
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)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/syncstate_nemo.py DESTINATION ${DATADIR}/nemo-python/extensions RENAME syncstate.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_caja.py DESTINATION ${DATADIR}/caja-python/extensions RENAME syncstate-${APPLICATION_SHORTNAME}.py)
|
||||
|
||||
|
||||
|
||||
|
||||
Arquivo executável
+7
@@ -0,0 +1,7 @@
|
||||
#!/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
|
||||
@@ -18,6 +18,7 @@
|
||||
import os
|
||||
import urllib
|
||||
import socket
|
||||
import tempfile
|
||||
|
||||
from gi.repository import GObject, Nautilus
|
||||
|
||||
@@ -43,7 +44,7 @@ def get_runtime_dir():
|
||||
try:
|
||||
return os.environ['XDG_RUNTIME_DIR']
|
||||
except KeyError:
|
||||
fallback = '/tmp/runtime-' + os.environ['USER']
|
||||
fallback = os.path.join(tempfile.gettempdir(), 'runtime-' + os.environ['USER'])
|
||||
return fallback
|
||||
|
||||
|
||||
@@ -86,22 +87,17 @@ class SocketConnect(GObject.GObject):
|
||||
def _connectToSocketServer(self):
|
||||
try:
|
||||
self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
postfix = "/" + appname + "/socket" # Should use os.path.join instead
|
||||
sock_file = get_runtime_dir() + postfix
|
||||
print ("Socket: " + sock_file + " <=> " + postfix)
|
||||
if sock_file != postfix:
|
||||
try:
|
||||
print("Socket File: " + sock_file)
|
||||
self._sock.connect(sock_file)
|
||||
self.connected = True
|
||||
print("Setting connected to %r." % self.connected )
|
||||
self._watch_id = GObject.io_add_watch(self._sock, GObject.IO_IN, self._handle_notify)
|
||||
print("Socket watch id: " + str(self._watch_id))
|
||||
return False # Don't run again
|
||||
except Exception as e:
|
||||
print("Could not connect to unix socket. " + str(e))
|
||||
else:
|
||||
print("Sock-File not valid: " + sock_file)
|
||||
sock_file = os.path.join(get_runtime_dir(), appname, "socket")
|
||||
try:
|
||||
print("Socket File: " + sock_file)
|
||||
self._sock.connect(sock_file) # fails if sock_file doesn't exist
|
||||
self.connected = True
|
||||
print("Setting connected to %r." % self.connected )
|
||||
self._watch_id = GObject.io_add_watch(self._sock, GObject.IO_IN, self._handle_notify)
|
||||
print("Socket watch id: " + str(self._watch_id))
|
||||
return False # Don't run again
|
||||
except Exception as e:
|
||||
print("Could not connect to unix socket. " + str(e))
|
||||
except Exception as e: # Bad habbit
|
||||
print("Connect could not be established, try again later.")
|
||||
self._sock.close()
|
||||
@@ -157,32 +153,65 @@ class MenuExtension(GObject.GObject, Nautilus.MenuProvider):
|
||||
def __init__(self):
|
||||
GObject.GObject.__init__(self)
|
||||
|
||||
def check_registered_paths(self, filename):
|
||||
topLevelFolder = False
|
||||
internalFile = False
|
||||
for reg_path in socketConnect.registered_paths:
|
||||
if filename == reg_path:
|
||||
topLevelFolder = True
|
||||
break
|
||||
if filename.startswith(reg_path):
|
||||
internalFile = True
|
||||
# you can't have a registered path below another so it is save to break here
|
||||
break
|
||||
return (topLevelFolder, internalFile)
|
||||
|
||||
def get_file_items(self, window, files):
|
||||
# Show the menu extension to share a file or folder
|
||||
#
|
||||
# Show if file is OK.
|
||||
# Ignore top level folders.
|
||||
# Also show extension for folders
|
||||
# if there is a OK or SYNC underneath.
|
||||
# This is only
|
||||
|
||||
if len(files) != 1:
|
||||
return
|
||||
file = files[0]
|
||||
items = []
|
||||
|
||||
# Internal or external file?!
|
||||
syncedFile = False
|
||||
for reg_path in socketConnect.registered_paths:
|
||||
topLevelFolder = False
|
||||
filename = get_local_path(file.get_uri())
|
||||
# Check if its a folder (ends with an /), if yes add a "/"
|
||||
# otherwise it will not find the entry in the table
|
||||
if os.path.isdir(filename + "/"):
|
||||
filename += "/"
|
||||
# Check if toplevel folder, we need to ignore those as they cannot be shared
|
||||
if filename == reg_path:
|
||||
topLevelFolder=True
|
||||
# Only show the menu extension if the file is synced and the sync
|
||||
# status is ok. Not for ignored files etc.
|
||||
# ignore top level folders
|
||||
if filename.startswith(reg_path) and topLevelFolder == False and socketConnect.nautilusVFSFile_table[filename]['state'].startswith('OK'):
|
||||
syncedFile = True
|
||||
filename = get_local_path(file.get_uri())
|
||||
# Check if its a folder (ends with an /), if yes add a "/"
|
||||
# otherwise it will not find the entry in the table
|
||||
isDir = os.path.isdir(filename + os.sep)
|
||||
if isDir:
|
||||
filename += os.sep
|
||||
|
||||
# If it is neither in a synced folder or is a directory
|
||||
if not syncedFile:
|
||||
# Check if toplevel folder, we need to ignore those as they cannot be shared
|
||||
topLevelFolder, internalFile = self.check_registered_paths(filename)
|
||||
if topLevelFolder or not internalFile:
|
||||
return items
|
||||
|
||||
entry = socketConnect.nautilusVFSFile_table.get(filename)
|
||||
if not entry:
|
||||
return items
|
||||
|
||||
shareable = False
|
||||
state = entry['state']
|
||||
state_ok = state.startswith('OK')
|
||||
state_sync = state.startswith('SYNC')
|
||||
if state_ok:
|
||||
shareable = True
|
||||
elif state_sync and isDir:
|
||||
# some file below is OK or SYNC
|
||||
for key, value in socketConnect.nautilusVFSFile_table.items():
|
||||
if key != filename and key.startswith(filename):
|
||||
state = value['state']
|
||||
if state.startswith('OK') or state.startswith('SYNC'):
|
||||
shareable = True
|
||||
break
|
||||
|
||||
if not shareable:
|
||||
return items
|
||||
|
||||
# Create a menu item
|
||||
@@ -303,7 +332,7 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
|
||||
|
||||
filename = get_local_path(item.get_uri())
|
||||
if item.is_directory():
|
||||
filename += '/'
|
||||
filename += os.sep
|
||||
|
||||
inScope = False
|
||||
for reg_path in socketConnect.registered_paths:
|
||||
|
||||
+17
-161
@@ -1,165 +1,21 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
The MIT License (MIT)
|
||||
|
||||
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.
|
||||
Copyright (c) 2011 Morgan Leborgne
|
||||
|
||||
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:
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"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.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
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.
|
||||
|
||||
+23
-20
@@ -1,24 +1,27 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of QProgressIndicator,
|
||||
* an open-source recent files menu widget
|
||||
*
|
||||
* Copyright (C) 2009 - 2010 Morgan Leborgne
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2011 Morgan Leborgne
|
||||
*
|
||||
* 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
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* 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 <QPainter>
|
||||
|
||||
+27
-24
@@ -1,24 +1,27 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of QProgressIndicator,
|
||||
* an open-source recent files menu widget
|
||||
*
|
||||
* Copyright (C) 2009 - 2010 Morgan Leborgne
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2011 Morgan Leborgne
|
||||
*
|
||||
* 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
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* 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
|
||||
#define QPROGRESSINDICATOR_H
|
||||
|
||||
@@ -64,8 +67,8 @@ public:
|
||||
*/
|
||||
const QColor & color() const { return m_color; }
|
||||
|
||||
virtual QSize sizeHint() const Q_DECL_OVERRIDE;
|
||||
int heightForWidth(int w) const Q_DECL_OVERRIDE;
|
||||
virtual QSize sizeHint() const;
|
||||
int heightForWidth(int w) const;
|
||||
public slots:
|
||||
/*! Starts the spin animation.
|
||||
\sa stopAnimation isAnimated
|
||||
@@ -95,8 +98,8 @@ public slots:
|
||||
*/
|
||||
void setColor(const QColor & color);
|
||||
protected:
|
||||
virtual void timerEvent(QTimerEvent * event) Q_DECL_OVERRIDE;
|
||||
virtual void paintEvent(QPaintEvent * event) Q_DECL_OVERRIDE;
|
||||
virtual void timerEvent(QTimerEvent * event);
|
||||
virtual void paintEvent(QPaintEvent * event);
|
||||
private:
|
||||
int m_angle;
|
||||
int m_timerId;
|
||||
|
||||
+1
-1
@@ -11,4 +11,4 @@ Qt 4.4.x.
|
||||
|
||||
## License
|
||||
|
||||
LGPL
|
||||
MIT
|
||||
|
||||
externo
+3732
-2679
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
externo
+421
-267
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+28
-1
@@ -29,6 +29,7 @@
|
||||
#include "syncengine.h"
|
||||
#include "syncjournaldb.h"
|
||||
#include "config.h"
|
||||
#include "connectionvalidator.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
@@ -46,6 +47,9 @@
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
|
||||
static void nullMessageHandler(QtMsgType, const char *) {}
|
||||
|
||||
struct CmdOptions {
|
||||
QString source_dir;
|
||||
QString target_url;
|
||||
@@ -69,6 +73,8 @@ struct CmdOptions {
|
||||
// So we have to use a global variable
|
||||
CmdOptions *opts = 0;
|
||||
|
||||
const qint64 timeoutToUseMsec = qMax(1000, ConnectionValidator::DefaultCallingIntervalMsec - 5*1000);
|
||||
|
||||
class EchoDisabler
|
||||
{
|
||||
public:
|
||||
@@ -296,6 +302,11 @@ int main(int argc, char **argv) {
|
||||
|
||||
parseOptions( app.arguments(), &options );
|
||||
|
||||
csync_set_log_level(options.silent ? 1 : 11);
|
||||
if (options.silent) {
|
||||
qInstallMsgHandler(nullMessageHandler);
|
||||
}
|
||||
|
||||
AccountPtr account = Account::create();
|
||||
|
||||
if( !account ) {
|
||||
@@ -389,13 +400,29 @@ int main(int argc, char **argv) {
|
||||
account->setCredentials(cred);
|
||||
account->setSslErrorHandler(sslErrorHandler);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
//obtain capabilities using event loop
|
||||
QEventLoop loop;
|
||||
|
||||
JsonApiJob *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
|
||||
job->setTimeout(timeoutToUseMsec);
|
||||
QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QVariantMap &json) {
|
||||
auto caps = json.value("ocs").toMap().value("data").toMap().value("capabilities");
|
||||
qDebug() << "Server capabilities" << caps;
|
||||
account->setCapabilities(caps.toMap());
|
||||
loop.quit();
|
||||
});
|
||||
job->start();
|
||||
|
||||
loop.exec();
|
||||
#endif
|
||||
|
||||
// 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;
|
||||
|
||||
int restartCount = 0;
|
||||
restart_sync:
|
||||
|
||||
csync_set_log_level(options.silent ? 1 : 11);
|
||||
|
||||
opts = &options;
|
||||
|
||||
|
||||
@@ -199,6 +199,9 @@ IF( WIN32 )
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
||||
@ONLY)
|
||||
set(client_version ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
||||
IF(NOT MSVC)
|
||||
set(client_manifest ${CMAKE_CURRENT_SOURCE_DIR}/manifest-mingw.rc)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
set( final_src
|
||||
@@ -206,6 +209,7 @@ set( final_src
|
||||
${client_SRCS}
|
||||
${client_UI_SRCS}
|
||||
${client_version}
|
||||
${client_manifest}
|
||||
${guiMoc}
|
||||
${client_I18N}
|
||||
${3rdparty_SRC}
|
||||
|
||||
@@ -44,7 +44,7 @@ AccountManager *AccountManager::instance()
|
||||
|
||||
bool AccountManager::restore()
|
||||
{
|
||||
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
||||
|
||||
// If there are no accounts, check the old format.
|
||||
if (settings->childGroups().isEmpty()
|
||||
@@ -69,9 +69,7 @@ bool AccountManager::restore()
|
||||
bool AccountManager::restoreFromLegacySettings()
|
||||
{
|
||||
// try to open the correctly themed settings
|
||||
auto settings = Account::settingsWithGroup(Theme::instance()->appName());
|
||||
|
||||
bool migratedCreds = false;
|
||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
||||
|
||||
// if the settings file could not be opened, the childKeys list is empty
|
||||
// then try to load settings from a very old place
|
||||
@@ -102,7 +100,6 @@ bool AccountManager::restoreFromLegacySettings()
|
||||
qDebug() << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":"
|
||||
<< (oCUrl == overrideUrl ? "Yes" : "No");
|
||||
if( oCUrl == overrideUrl ) {
|
||||
migratedCreds = true;
|
||||
settings.reset( oCSettings );
|
||||
} else {
|
||||
delete oCSettings;
|
||||
@@ -114,9 +111,6 @@ bool AccountManager::restoreFromLegacySettings()
|
||||
// Try to load the single account.
|
||||
if (!settings->childKeys().isEmpty()) {
|
||||
if (auto acc = loadAccountHelper(*settings)) {
|
||||
if (migratedCreds) {
|
||||
acc->setMigrated(true);
|
||||
}
|
||||
addAccount(acc);
|
||||
return true;
|
||||
}
|
||||
@@ -126,7 +120,7 @@ bool AccountManager::restoreFromLegacySettings()
|
||||
|
||||
void AccountManager::save(bool saveCredentials)
|
||||
{
|
||||
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
||||
settings->setValue(QLatin1String(versionC), 2);
|
||||
foreach (const auto &acc, _accounts) {
|
||||
settings->beginGroup(acc->account()->id());
|
||||
@@ -142,7 +136,7 @@ void AccountManager::save(bool saveCredentials)
|
||||
void AccountManager::saveAccount(Account* a)
|
||||
{
|
||||
qDebug() << "Saving account" << a->url().toString();
|
||||
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
||||
settings->beginGroup(a->id());
|
||||
saveAccountHelper(a, *settings, false); // don't save credentials they might not have been loaded yet
|
||||
settings->endGroup();
|
||||
@@ -154,7 +148,7 @@ void AccountManager::saveAccount(Account* a)
|
||||
void AccountManager::saveAccountState(AccountState* a)
|
||||
{
|
||||
qDebug() << "Saving account state" << a->account()->url().toString();
|
||||
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
||||
settings->beginGroup(a->account()->id());
|
||||
a->writeToSettings(*settings);
|
||||
settings->endGroup();
|
||||
@@ -209,6 +203,13 @@ void AccountManager::saveAccountHelper(Account* acc, QSettings& settings, bool s
|
||||
|
||||
AccountPtr AccountManager::loadAccountHelper(QSettings& settings)
|
||||
{
|
||||
auto urlConfig = settings.value(QLatin1String(urlC));
|
||||
if (!urlConfig.isValid()) {
|
||||
// No URL probably means a corrupted entry in the account settings
|
||||
qDebug() << "No URL for account " << settings.group();
|
||||
return AccountPtr();
|
||||
}
|
||||
|
||||
auto acc = createAccount();
|
||||
|
||||
QString authType = settings.value(QLatin1String(authTypeC)).toString();
|
||||
@@ -220,7 +221,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings& settings)
|
||||
acc->setUrl(overrideUrl);
|
||||
authType = forceAuth;
|
||||
} else {
|
||||
acc->setUrl(settings.value(QLatin1String(urlC)).toUrl());
|
||||
acc->setUrl(urlConfig.toUrl());
|
||||
}
|
||||
acc->_serverVersion = settings.value(QLatin1String(serverVersionC)).toString();
|
||||
|
||||
@@ -273,7 +274,7 @@ void AccountManager::deleteAccount(AccountState* account)
|
||||
auto copy = *it; // keep a reference to the shared pointer so it does not delete it just yet
|
||||
_accounts.erase(it);
|
||||
|
||||
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
|
||||
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
|
||||
settings->remove(account->account()->id());
|
||||
|
||||
emit accountRemoved(account);
|
||||
|
||||
@@ -117,6 +117,10 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
|
||||
|
||||
connect(ui->selectiveSyncApply, SIGNAL(clicked()), _model, SLOT(slotApplySelectiveSync()));
|
||||
connect(ui->selectiveSyncCancel, SIGNAL(clicked()), _model, SLOT(resetFolders()));
|
||||
connect(ui->bigFolderApply, SIGNAL(clicked(bool)), _model, SLOT(slotApplySelectiveSync()));
|
||||
connect(ui->bigFolderSyncAll, SIGNAL(clicked(bool)), _model, SLOT(slotSyncAllPendingBigFolders()));
|
||||
connect(ui->bigFolderSyncNone, SIGNAL(clicked(bool)), _model, SLOT(slotSyncNoPendingBigFolders()));
|
||||
|
||||
connect(FolderMan::instance(), SIGNAL(folderListChanged(Folder::Map)), _model, SLOT(resetFolders()));
|
||||
connect(this, SIGNAL(folderChanged()), _model, SLOT(resetFolders()));
|
||||
|
||||
@@ -317,7 +321,7 @@ void AccountSettings::slotFolderWizardAccepted()
|
||||
// The user already accepted the selective sync dialog. everything is in the white list
|
||||
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList,
|
||||
QStringList() << QLatin1String("/"));
|
||||
folderMan->slotScheduleAllFolders();
|
||||
folderMan->scheduleAllFolders();
|
||||
emit folderChanged();
|
||||
}
|
||||
}
|
||||
@@ -356,7 +360,7 @@ void AccountSettings::slotRemoveCurrentFolder()
|
||||
return;
|
||||
}
|
||||
|
||||
folderMan->slotRemoveFolder( folderMan->folder(alias) );
|
||||
folderMan->removeFolder( folderMan->folder(alias) );
|
||||
_model->removeRow(row);
|
||||
|
||||
// single folder fix to show add-button and hide remove-button
|
||||
@@ -464,7 +468,7 @@ void AccountSettings::slotSyncCurrentFolderNow()
|
||||
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
|
||||
FolderMan *folderMan = FolderMan::instance();
|
||||
|
||||
folderMan->slotScheduleSync(folderMan->folder(alias));
|
||||
folderMan->scheduleFolder(folderMan->folder(alias));
|
||||
}
|
||||
|
||||
void AccountSettings::slotOpenOC()
|
||||
@@ -635,12 +639,13 @@ void AccountSettings::refreshSelectiveSyncStatus()
|
||||
}
|
||||
|
||||
if (msg.isEmpty()) {
|
||||
ui->selectiveSyncNotification->setVisible(false);
|
||||
ui->selectiveSyncNotification->setText(QString());
|
||||
ui->selectiveSyncButtons->setVisible(true);
|
||||
ui->bigFolderUi->setVisible(false);
|
||||
} else {
|
||||
ui->selectiveSyncNotification->setVisible(true);
|
||||
QString wholeMsg = tr("There are new folders that were not synchronized because they are too big: ") + msg;
|
||||
ui->selectiveSyncNotification->setText(wholeMsg);
|
||||
ui->selectiveSyncButtons->setVisible(false);
|
||||
ui->bigFolderUi->setVisible(true);
|
||||
shouldBeVisible = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,44 +154,105 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="selectiveSyncNotification">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="bigFolderUi" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="selectiveSyncNotification">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="bigFolderSyncAll">
|
||||
<property name="text">
|
||||
<string>Synchronize all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="bigFolderSyncNone">
|
||||
<property name="text">
|
||||
<string>Synchronize none</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="bigFolderApply">
|
||||
<property name="text">
|
||||
<string>Apply manual changes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectiveSyncCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectiveSyncApply">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="selectiveSyncButtons" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectiveSyncCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectiveSyncApply">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -306,7 +306,7 @@ void AccountState::slotCredentialsAsked(AbstractCredentials* credentials)
|
||||
|
||||
std::unique_ptr<QSettings> AccountState::settings()
|
||||
{
|
||||
auto s = _account->settingsWithGroup(QLatin1String("Accounts"));
|
||||
auto s = Utility::settingsWithGroup(QLatin1String("Accounts"));
|
||||
s->beginGroup(_account->id());
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -336,9 +336,14 @@ void Application::slotownCloudWizardDone( int res )
|
||||
_checkConnectionTimer.start();
|
||||
slotCheckConnection();
|
||||
|
||||
// The very first time an account is configured: enabled autostart
|
||||
// TODO: Doing this every time the account wizard finishes will annoy users.
|
||||
Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true);
|
||||
// If one account is configured: enable autostart
|
||||
bool shouldSetAutoStart = (accountMan->accounts().size() == 1);
|
||||
#ifdef Q_OS_MAC
|
||||
// Don't auto start when not being 'installed'
|
||||
shouldSetAutoStart = shouldSetAutoStart
|
||||
&& QCoreApplication::applicationDirPath().startsWith("/Applications/");
|
||||
#endif
|
||||
Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), shouldSetAutoStart);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,21 +79,6 @@ 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
|
||||
{
|
||||
return QString::fromLatin1("shibboleth");
|
||||
@@ -142,7 +127,7 @@ void ShibbolethCredentials::fetchFromKeychain()
|
||||
} else {
|
||||
_url = _account->url();
|
||||
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
|
||||
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
job->setInsecureFallback(false);
|
||||
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
||||
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
|
||||
@@ -261,7 +246,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
|
||||
addToCookieJar(_shibCookie);
|
||||
}
|
||||
// access
|
||||
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
|
||||
_ready = true;
|
||||
_stillValid = true;
|
||||
@@ -320,7 +305,7 @@ QByteArray ShibbolethCredentials::shibCookieName()
|
||||
void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
|
||||
{
|
||||
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
|
||||
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
// we don't really care if it works...
|
||||
//connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*)));
|
||||
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
||||
@@ -331,7 +316,7 @@ void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
|
||||
void ShibbolethCredentials::removeShibCookie()
|
||||
{
|
||||
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
|
||||
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
|
||||
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
|
||||
job->start();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ public:
|
||||
ShibbolethCredentials(const QNetworkCookie &cookie);
|
||||
|
||||
void setAccount(Account* account) Q_DECL_OVERRIDE;
|
||||
bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
|
||||
QString authType() const Q_DECL_OVERRIDE;
|
||||
QString user() const Q_DECL_OVERRIDE;
|
||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||
|
||||
+80
-55
@@ -33,6 +33,10 @@
|
||||
#include "filesystem.h"
|
||||
#include "excludedfiles.h"
|
||||
|
||||
// FIXME ifdef
|
||||
#include "json.h"
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
|
||||
#include "creds/abstractcredentials.h"
|
||||
|
||||
#include <QDebug>
|
||||
@@ -58,7 +62,6 @@ Folder::Folder(const FolderDefinition& definition,
|
||||
, _wipeDb(false)
|
||||
, _proxyDirty(true)
|
||||
, _lastSyncDuration(0)
|
||||
, _forceSyncOnPollTimeout(false)
|
||||
, _consecutiveFailingSyncs(0)
|
||||
, _consecutiveFollowUpSyncs(0)
|
||||
, _journal(definition.localPath)
|
||||
@@ -112,6 +115,28 @@ Folder::Folder(const FolderDefinition& definition,
|
||||
connect(_engine.data(), SIGNAL(seenLockedFile(QString)), FolderMan::instance(), SLOT(slotSyncOnceFileUnlocks(QString)));
|
||||
connect(_engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector&)),
|
||||
SLOT(slotLogPropagationStart()));
|
||||
|
||||
_scheduleSelfTimer.setSingleShot(true);
|
||||
_scheduleSelfTimer.setInterval(SyncEngine::minimumFileAgeForUpload);
|
||||
connect(&_scheduleSelfTimer, SIGNAL(timeout()),
|
||||
SLOT(slotScheduleThisFolder()));
|
||||
|
||||
_webSocket.reset(new QWebSocket());
|
||||
// FIXME: Also handle re-connect
|
||||
QObject::connect(_webSocket.data(), &QWebSocket::connected, this, &Folder::slotWebSocketConnected);
|
||||
QObject::connect(_webSocket.data(), &QWebSocket::textMessageReceived,
|
||||
this, &Folder::slotWebSocketTextMessageReceived);
|
||||
// FIXME: Accept same ssl errors as normal server?
|
||||
// typedef void (QWebSocket:: *sslErrorsSignal)(const QList<QSslError> &);
|
||||
// connect(&m_webSocket, static_cast<sslErrorsSignal>(&QWebSocket::sslErrors),
|
||||
// this, &SslEchoClient::onSslErrors);
|
||||
// FIXME something with _accountState->account()->davUrl()
|
||||
// FIXME: Check env / capabilities
|
||||
QByteArray wsUrl = qgetenv("OWNCLOUD_WEBSOCKET_URL");
|
||||
if (wsUrl.length() > 0) {
|
||||
qDebug() << "Connecting to websocket " << wsUrl;
|
||||
_webSocket->open(QUrl::fromEncoded(wsUrl));
|
||||
}
|
||||
}
|
||||
|
||||
Folder::~Folder()
|
||||
@@ -221,7 +246,7 @@ QString Folder::remotePath() const
|
||||
|
||||
QUrl Folder::remoteUrl() const
|
||||
{
|
||||
return Account::concatUrlPath(_accountState->account()->davUrl(), remotePath());
|
||||
return Utility::concatUrlPath(_accountState->account()->davUrl(), remotePath());
|
||||
}
|
||||
|
||||
bool Folder::syncPaused() const
|
||||
@@ -275,7 +300,7 @@ void Folder::slotRunEtagJob()
|
||||
|
||||
AccountPtr account = _accountState->account();
|
||||
|
||||
if (!_requestEtagJob.isNull()) {
|
||||
if (_requestEtagJob) {
|
||||
qDebug() << Q_FUNC_INFO << remoteUrl().toString() << "has ETag job queued, not trying to sync";
|
||||
return;
|
||||
}
|
||||
@@ -285,46 +310,41 @@ void Folder::slotRunEtagJob()
|
||||
return;
|
||||
}
|
||||
|
||||
bool forceSyncIntervalExpired =
|
||||
quint64(_timeSinceLastSyncDone.elapsed()) > ConfigFile().forceSyncInterval();
|
||||
bool syncAgainAfterFail = _consecutiveFailingSyncs > 0 && _consecutiveFailingSyncs < 3;
|
||||
// Do the ordinary etag check for the root folder and schedule a
|
||||
// sync if it's different.
|
||||
|
||||
// There are several conditions under which we trigger a full-discovery sync:
|
||||
// * When a suitably long time has passed since the last sync finished
|
||||
// * When the last sync failed (only a couple of times)
|
||||
// * When the last sync requested another sync to be done (only a couple of times)
|
||||
//
|
||||
// Note that the etag check (see below) and the file watcher may also trigger
|
||||
// syncs.
|
||||
if (forceSyncIntervalExpired
|
||||
|| _forceSyncOnPollTimeout
|
||||
|| syncAgainAfterFail) {
|
||||
_requestEtagJob = new RequestEtagJob(account, remotePath(), this);
|
||||
_requestEtagJob->setTimeout(60*1000);
|
||||
// check if the etag is different when retrieved
|
||||
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.
|
||||
}
|
||||
|
||||
if (forceSyncIntervalExpired) {
|
||||
qDebug() << "** Force Sync, because it has been " << _timeSinceLastSyncDone.elapsed() << "ms "
|
||||
<< "since the last sync";
|
||||
void Folder::slotWebSocketConnected()
|
||||
{
|
||||
qDebug() << "CONNECTED";
|
||||
}
|
||||
|
||||
// FIXME: Can we always assume it's a message? the docs are unclear
|
||||
void Folder::slotWebSocketTextMessageReceived(QString message)
|
||||
{
|
||||
qDebug() << message;
|
||||
if (!canSync() || isBusy()) {
|
||||
return;
|
||||
}
|
||||
bool success;
|
||||
QVariantMap json = QtJson::parse(message, success).toMap();
|
||||
if (success) {
|
||||
QString notificationEtag = json["etag"].toString();
|
||||
QString notificationUser = json["user"].toString();
|
||||
QString user = _accountState->account()->credentials()->user();
|
||||
if (user == notificationUser && _lastEtag != notificationEtag) {
|
||||
qDebug() << "* [WebSocket] Compare etag with previous etag: last:" << _lastEtag << ", received:" << notificationEtag << "-> CHANGED";
|
||||
_lastEtag = notificationEtag;
|
||||
slotScheduleThisFolder();
|
||||
_accountState->tagLastSuccessfullETagRequest();
|
||||
}
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +358,7 @@ void Folder::etagRetreived(const QString& etag)
|
||||
if (_lastEtag != etag) {
|
||||
qDebug() << "* Compare etag with previous etag: last:" << _lastEtag << ", received:" << etag << "-> CHANGED";
|
||||
_lastEtag = etag;
|
||||
emit scheduleToSync(this);
|
||||
slotScheduleThisFolder();
|
||||
}
|
||||
|
||||
_accountState->tagLastSuccessfullETagRequest();
|
||||
@@ -598,7 +618,10 @@ void Folder::slotWatchedPathChanged(const QString& 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)
|
||||
@@ -758,8 +781,6 @@ void Folder::startSync(const QStringList &pathList)
|
||||
|
||||
QMetaObject::invokeMethod(_engine.data(), "startSync", Qt::QueuedConnection);
|
||||
|
||||
// disable events until syncing is done
|
||||
// _watcher->setEventsEnabled(false);
|
||||
emit syncStarted();
|
||||
}
|
||||
|
||||
@@ -823,9 +844,6 @@ void Folder::slotSyncFinished(bool success)
|
||||
bubbleUpSyncResult();
|
||||
|
||||
bool anotherSyncNeeded = _engine->isAnotherSyncNeeded();
|
||||
// _watcher->setEventsEnabledDelayed(2000);
|
||||
|
||||
|
||||
|
||||
if (_csyncError) {
|
||||
_syncResult.setStatus(SyncResult::Error);
|
||||
@@ -884,11 +902,10 @@ void Folder::slotSyncFinished(bool success)
|
||||
// Maybe force a follow-up sync to take place, but only a couple of times.
|
||||
if (anotherSyncNeeded && _consecutiveFollowUpSyncs <= 3)
|
||||
{
|
||||
_forceSyncOnPollTimeout = true;
|
||||
// We will make sure that the poll timer occurs soon enough.
|
||||
// delay 1s, 4s, 9s
|
||||
int c = _consecutiveFollowUpSyncs;
|
||||
QTimer::singleShot(c*c * 1000, this, SLOT(slotRunEtagJob() ));
|
||||
// Sometimes another sync is requested because a local file is still
|
||||
// changing, so wait at least a small amount of time before syncing
|
||||
// the folder again.
|
||||
scheduleThisFolderSoon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,7 +986,17 @@ void Folder::slotLogPropagationStart()
|
||||
_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)
|
||||
{
|
||||
@@ -993,10 +1020,8 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
|
||||
*cancel = msgBox.clickedButton() == keepBtn;
|
||||
if (*cancel) {
|
||||
wipe();
|
||||
// speed up next sync
|
||||
_lastEtag.clear();
|
||||
_forceSyncOnPollTimeout = true;
|
||||
QTimer::singleShot(50, this, SLOT(slotRunEtagJob()));
|
||||
slotScheduleThisFolder();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+26
-2
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QtWebSockets/QWebSocket>
|
||||
|
||||
|
||||
class QThread;
|
||||
class QSettings;
|
||||
@@ -178,6 +180,7 @@ public:
|
||||
qint64 msecSinceLastSync() const { return _timeSinceLastSyncDone.elapsed(); }
|
||||
qint64 msecLastSyncDuration() const { return _lastSyncDuration; }
|
||||
int consecutiveFollowUpSyncs() const { return _consecutiveFollowUpSyncs; }
|
||||
int consecutiveFailingSyncs() const { return _consecutiveFailingSyncs; }
|
||||
|
||||
/// Saves the folder data in the account's settings.
|
||||
void saveToSettings() const;
|
||||
@@ -194,11 +197,21 @@ public:
|
||||
*/
|
||||
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:
|
||||
void syncStateChange();
|
||||
void syncStarted();
|
||||
void syncFinished(const SyncResult &result);
|
||||
void scheduleToSync(Folder*);
|
||||
void progressInfo(const ProgressInfo& progress);
|
||||
void newBigFolderDiscovered(const QString &); // A new folder bigger than the threshold was discovered
|
||||
void syncPausedChanged(Folder*, bool paused);
|
||||
@@ -258,6 +271,9 @@ private slots:
|
||||
void etagRetreived(const QString &);
|
||||
void etagRetreivedFromSyncEngine(const QString &);
|
||||
|
||||
void slotWebSocketConnected();
|
||||
void slotWebSocketTextMessageReceived(QString message);
|
||||
|
||||
void slotThreadTreeWalkResult(const SyncFileItemVector& ); // after sync is done
|
||||
|
||||
void slotEmitFinishedDelayed();
|
||||
@@ -266,6 +282,11 @@ private slots:
|
||||
|
||||
void slotLogPropagationStart();
|
||||
|
||||
/** Adds this folder to the list of scheduled folders in the
|
||||
* FolderMan.
|
||||
*/
|
||||
void slotScheduleThisFolder();
|
||||
|
||||
private:
|
||||
bool setIgnoredFiles();
|
||||
|
||||
@@ -298,11 +319,12 @@ private:
|
||||
bool _wipeDb;
|
||||
bool _proxyDirty;
|
||||
QPointer<RequestEtagJob> _requestEtagJob;
|
||||
// FIXME: ifdef etc
|
||||
QScopedPointer<QWebSocket> _webSocket;
|
||||
QString _lastEtag;
|
||||
QElapsedTimer _timeSinceLastSyncDone;
|
||||
QElapsedTimer _timeSinceLastSyncStart;
|
||||
qint64 _lastSyncDuration;
|
||||
bool _forceSyncOnPollTimeout;
|
||||
|
||||
/// The number of syncs that failed in a row.
|
||||
/// Reset when a sync is successful.
|
||||
@@ -317,6 +339,8 @@ private:
|
||||
ClientProxy _clientProxy;
|
||||
|
||||
QScopedPointer<SyncRunFileLog> _fileLog;
|
||||
|
||||
QTimer _scheduleSelfTimer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+79
-45
@@ -64,11 +64,17 @@ FolderMan::FolderMan(QObject *parent) :
|
||||
connect(&_startScheduledSyncTimer, SIGNAL(timeout()),
|
||||
SLOT(slotStartScheduledFolderSync()));
|
||||
|
||||
_timeScheduler.setInterval(5000);
|
||||
_timeScheduler.setSingleShot(false);
|
||||
connect(&_timeScheduler, SIGNAL(timeout()),
|
||||
SLOT(slotScheduleFolderByTime()));
|
||||
_timeScheduler.start();
|
||||
|
||||
connect(AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)),
|
||||
SLOT(slotRemoveFoldersForAccount(AccountState*)));
|
||||
|
||||
connect(_lockWatcher.data(), SIGNAL(fileUnlocked(QString)),
|
||||
SLOT(slotScheduleFolderOwningFile(QString)));
|
||||
SLOT(slotWatchedFileUnlocked(QString)));
|
||||
}
|
||||
|
||||
FolderMan *FolderMan::instance()
|
||||
@@ -100,8 +106,6 @@ void FolderMan::unloadFolder( Folder *f )
|
||||
}
|
||||
_folderMap.remove( f->alias() );
|
||||
|
||||
disconnect(f, SIGNAL(scheduleToSync(Folder*)),
|
||||
this, SLOT(slotScheduleSync(Folder*)));
|
||||
disconnect(f, SIGNAL(syncStarted()),
|
||||
this, SLOT(slotFolderSyncStarted()));
|
||||
disconnect(f, SIGNAL(syncFinished(SyncResult)),
|
||||
@@ -131,7 +135,7 @@ int FolderMan::unloadAndDeleteAllFolders()
|
||||
}
|
||||
_lastSyncFolder = 0;
|
||||
_currentSyncFolder = 0;
|
||||
_scheduleQueue.clear();
|
||||
_scheduledFolders.clear();
|
||||
emit scheduleQueueChanged();
|
||||
|
||||
Q_ASSERT(_folderMap.count() == 0);
|
||||
@@ -187,7 +191,7 @@ int FolderMan::setupFolders()
|
||||
{
|
||||
unloadAndDeleteAllFolders();
|
||||
|
||||
auto settings = Account::settingsWithGroup(QLatin1String("Accounts"));
|
||||
auto settings = Utility::settingsWithGroup(QLatin1String("Accounts"));
|
||||
const auto accountsWithSettings = settings->childGroups();
|
||||
if (accountsWithSettings.isEmpty()) {
|
||||
int r = setupFoldersMigration();
|
||||
@@ -211,7 +215,7 @@ int FolderMan::setupFolders()
|
||||
if (FolderDefinition::load(*settings, folderAlias, &folderDefinition)) {
|
||||
Folder* f = addFolderInternal(std::move(folderDefinition), account.data());
|
||||
if (f) {
|
||||
slotScheduleSync(f);
|
||||
scheduleFolder(f);
|
||||
emit folderSyncStateChange(f);
|
||||
}
|
||||
}
|
||||
@@ -244,7 +248,7 @@ int FolderMan::setupFoldersMigration()
|
||||
foreach ( const QString& alias, list ) {
|
||||
Folder *f = setupFolderFromOldConfigFile( alias, accountState );
|
||||
if( f ) {
|
||||
slotScheduleSync(f);
|
||||
scheduleFolder(f);
|
||||
emit folderSyncStateChange(f);
|
||||
}
|
||||
}
|
||||
@@ -422,7 +426,7 @@ void FolderMan::slotFolderSyncPaused( Folder *f, bool paused )
|
||||
|
||||
if (!paused) {
|
||||
_disabledFolders.remove(f);
|
||||
slotScheduleSync(f);
|
||||
scheduleFolder(f);
|
||||
} else {
|
||||
_disabledFolders.insert(f);
|
||||
}
|
||||
@@ -462,11 +466,11 @@ Folder *FolderMan::folder( const QString& alias )
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FolderMan::slotScheduleAllFolders()
|
||||
void FolderMan::scheduleAllFolders()
|
||||
{
|
||||
foreach( Folder *f, _folderMap.values() ) {
|
||||
if (f && f->canSync()) {
|
||||
slotScheduleSync( f );
|
||||
scheduleFolder( f );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -486,7 +490,7 @@ void FolderMan::slotSyncOnceFileUnlocks(const QString& path)
|
||||
* 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.
|
||||
*/
|
||||
void FolderMan::slotScheduleSync( Folder *f )
|
||||
void FolderMan::scheduleFolder( Folder *f )
|
||||
{
|
||||
if( !f ) {
|
||||
qWarning() << "slotScheduleSync called with null folder";
|
||||
@@ -496,7 +500,7 @@ void FolderMan::slotScheduleSync( Folder *f )
|
||||
|
||||
qDebug() << "Schedule folder " << alias << " to sync!";
|
||||
|
||||
if( ! _scheduleQueue.contains(f) ) {
|
||||
if( ! _scheduledFolders.contains(f) ) {
|
||||
if( !f->canSync() ) {
|
||||
qDebug() << "Folder is not ready to sync, not scheduled!";
|
||||
_socketApi->slotUpdateFolderView(f);
|
||||
@@ -504,7 +508,7 @@ void FolderMan::slotScheduleSync( Folder *f )
|
||||
}
|
||||
f->prepareToSync();
|
||||
emit folderSyncStateChange(f);
|
||||
_scheduleQueue.enqueue(f);
|
||||
_scheduledFolders.enqueue(f);
|
||||
emit scheduleQueueChanged();
|
||||
} else {
|
||||
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
|
||||
@@ -568,7 +572,7 @@ void FolderMan::slotAccountStateChanged()
|
||||
if (f
|
||||
&& f->canSync()
|
||||
&& f->accountState() == accountState) {
|
||||
slotScheduleSync(f);
|
||||
scheduleFolder(f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -580,7 +584,7 @@ void FolderMan::slotAccountStateChanged()
|
||||
_currentSyncFolder->slotTerminateSync();
|
||||
}
|
||||
|
||||
QMutableListIterator<Folder*> it(_scheduleQueue);
|
||||
QMutableListIterator<Folder*> it(_scheduledFolders);
|
||||
while (it.hasNext()) {
|
||||
Folder* f = it.next();
|
||||
if (f->accountState() == accountState) {
|
||||
@@ -595,7 +599,7 @@ void FolderMan::slotAccountStateChanged()
|
||||
// this is not the same as Pause and Resume of folders.
|
||||
void FolderMan::setSyncEnabled( bool enabled )
|
||||
{
|
||||
if (!_syncEnabled && enabled && !_scheduleQueue.isEmpty()) {
|
||||
if (!_syncEnabled && enabled && !_scheduledFolders.isEmpty()) {
|
||||
// We have things in our queue that were waiting for the connection to come back on.
|
||||
startScheduledSyncSoon();
|
||||
}
|
||||
@@ -604,19 +608,19 @@ void FolderMan::setSyncEnabled( bool enabled )
|
||||
emit( folderSyncStateChange(0) );
|
||||
}
|
||||
|
||||
void FolderMan::startScheduledSyncSoon(qint64 msMinimumDelay)
|
||||
void FolderMan::startScheduledSyncSoon()
|
||||
{
|
||||
if (_startScheduledSyncTimer.isActive()) {
|
||||
return;
|
||||
}
|
||||
if (_scheduleQueue.empty()) {
|
||||
if (_scheduledFolders.empty()) {
|
||||
return;
|
||||
}
|
||||
if (_currentSyncFolder) {
|
||||
return;
|
||||
}
|
||||
|
||||
qint64 msDelay = msMinimumDelay;
|
||||
qint64 msDelay = 100; // 100ms minimum delay
|
||||
qint64 msSinceLastSync = 0;
|
||||
|
||||
// Require a pause based on the duration of the last sync run.
|
||||
@@ -631,15 +635,6 @@ void FolderMan::startScheduledSyncSoon(qint64 msMinimumDelay)
|
||||
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
|
||||
// could be things later in the queue that shouldn't be punished by a
|
||||
// long delay!
|
||||
@@ -648,11 +643,7 @@ void FolderMan::startScheduledSyncSoon(qint64 msMinimumDelay)
|
||||
// Time since the last sync run counts against the delay
|
||||
msDelay = qMax(1ll, msDelay - msSinceLastSync);
|
||||
|
||||
// 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";
|
||||
qDebug() << "Starting the next scheduled sync in" << (msDelay/1000) << "seconds";
|
||||
_startScheduledSyncTimer.start(msDelay);
|
||||
}
|
||||
|
||||
@@ -673,15 +664,15 @@ void FolderMan::slotStartScheduledFolderSync()
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduleQueue.count();
|
||||
if( _scheduleQueue.isEmpty() ) {
|
||||
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduledFolders.count();
|
||||
if( _scheduledFolders.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the first folder in the queue that can be synced.
|
||||
Folder* f = 0;
|
||||
while( !_scheduleQueue.isEmpty() ) {
|
||||
f = _scheduleQueue.dequeue();
|
||||
while( !_scheduledFolders.isEmpty() ) {
|
||||
f = _scheduledFolders.dequeue();
|
||||
Q_ASSERT(f);
|
||||
|
||||
if( f->canSync() ) {
|
||||
@@ -711,7 +702,7 @@ void FolderMan::slotEtagPollTimerTimeout()
|
||||
if (_currentSyncFolder == f) {
|
||||
continue;
|
||||
}
|
||||
if (_scheduleQueue.contains(f)) {
|
||||
if (_scheduledFolders.contains(f)) {
|
||||
continue;
|
||||
}
|
||||
if (_disabledFolders.contains(f)) {
|
||||
@@ -740,7 +731,7 @@ void FolderMan::slotRemoveFoldersForAccount(AccountState* accountState)
|
||||
}
|
||||
|
||||
foreach (const auto &f, foldersToRemove) {
|
||||
slotRemoveFolder(f);
|
||||
removeFolder(f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,10 +757,54 @@ void FolderMan::slotServerVersionChanged(Account *account)
|
||||
}
|
||||
}
|
||||
|
||||
void FolderMan::slotScheduleFolderOwningFile(const QString& path)
|
||||
void FolderMan::slotWatchedFileUnlocked(const QString& path)
|
||||
{
|
||||
if (Folder* f = folderForPath(path)) {
|
||||
slotScheduleSync(f);
|
||||
f->scheduleThisFolderSoon();
|
||||
}
|
||||
}
|
||||
|
||||
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?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -827,7 +862,6 @@ Folder* FolderMan::addFolderInternal(FolderDefinition folderDefinition, AccountS
|
||||
}
|
||||
|
||||
// See matching disconnects in unloadFolder().
|
||||
connect(folder, SIGNAL(scheduleToSync(Folder*)), SLOT(slotScheduleSync(Folder*)));
|
||||
connect(folder, SIGNAL(syncStarted()), SLOT(slotFolderSyncStarted()));
|
||||
connect(folder, SIGNAL(syncFinished(SyncResult)), SLOT(slotFolderSyncFinished(SyncResult)));
|
||||
connect(folder, SIGNAL(syncStateChange()), SLOT(slotForwardFolderSyncStateChange()));
|
||||
@@ -880,7 +914,7 @@ QStringList FolderMan::findFileInLocalFolders( const QString& relPath, const Acc
|
||||
return re;
|
||||
}
|
||||
|
||||
void FolderMan::slotRemoveFolder( Folder *f )
|
||||
void FolderMan::removeFolder( Folder *f )
|
||||
{
|
||||
if( !f ) {
|
||||
qWarning() << "!! Can not remove null folder";
|
||||
@@ -895,7 +929,7 @@ void FolderMan::slotRemoveFolder( Folder *f )
|
||||
terminateSyncProcess();
|
||||
}
|
||||
|
||||
if (_scheduleQueue.removeAll(f) > 0) {
|
||||
if (_scheduledFolders.removeAll(f) > 0) {
|
||||
emit scheduleQueueChanged();
|
||||
}
|
||||
|
||||
@@ -1262,7 +1296,7 @@ void FolderMan::setIgnoreHiddenFiles(bool ignore)
|
||||
|
||||
QQueue<Folder*> FolderMan::scheduleQueue() const
|
||||
{
|
||||
return _scheduleQueue;
|
||||
return _scheduledFolders;
|
||||
}
|
||||
|
||||
Folder *FolderMan::currentSyncFolder() const
|
||||
|
||||
+92
-41
@@ -37,6 +37,26 @@ class LockWatcher;
|
||||
/**
|
||||
* @brief The FolderMan class
|
||||
* @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
|
||||
{
|
||||
@@ -54,6 +74,9 @@ public:
|
||||
*/
|
||||
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 */
|
||||
Folder* folderForPath(const QString& path);
|
||||
|
||||
@@ -126,6 +149,24 @@ public:
|
||||
*/
|
||||
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:
|
||||
/**
|
||||
* signal to indicate a folder has changed its sync state.
|
||||
@@ -139,41 +180,12 @@ signals:
|
||||
*/
|
||||
void scheduleQueueChanged();
|
||||
|
||||
/**
|
||||
* Emitted whenever the list of configured folders changes.
|
||||
*/
|
||||
void folderListChanged(const Folder::Map &);
|
||||
|
||||
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
|
||||
@@ -190,10 +202,22 @@ public slots:
|
||||
* Triggers a sync run once the lock on the given file is removed.
|
||||
*
|
||||
* Automatically detemines the folder that's responsible for the file.
|
||||
* See slotWatchedFileUnlocked().
|
||||
*/
|
||||
void slotSyncOnceFileUnlocks(const QString& path);
|
||||
|
||||
// slot to schedule an ETag job (from Folder only)
|
||||
void slotScheduleETagJob ( const QString &alias, RequestEtagJob *job);
|
||||
|
||||
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.
|
||||
void slotStartScheduledFolderSync();
|
||||
void slotEtagPollTimerTimeout();
|
||||
@@ -207,12 +231,29 @@ private slots:
|
||||
void slotServerVersionChanged(Account* account);
|
||||
|
||||
/**
|
||||
* Schedules the folder for synchronization that contains
|
||||
* A file whose locks were being monitored has become unlocked.
|
||||
*
|
||||
* This schedules the folder for synchronization that contains
|
||||
* the file with the given path.
|
||||
*/
|
||||
void slotScheduleFolderOwningFile(const QString& path);
|
||||
void slotWatchedFileUnlocked(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:
|
||||
/**
|
||||
* 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
|
||||
* does not set an account on the new folder.
|
||||
*/
|
||||
@@ -222,7 +263,7 @@ private:
|
||||
void unloadFolder( Folder * );
|
||||
|
||||
/** Will start a sync after a bit of delay. */
|
||||
void startScheduledSyncSoon(qint64 msMinimumDelay = 0);
|
||||
void startScheduledSyncSoon();
|
||||
|
||||
// finds all folder configuration files
|
||||
// and create the folders
|
||||
@@ -238,19 +279,29 @@ private:
|
||||
Folder *_currentSyncFolder;
|
||||
QPointer<Folder> _lastSyncFolder;
|
||||
bool _syncEnabled;
|
||||
QTimer _etagPollTimer;
|
||||
QPointer<RequestEtagJob> _currentEtagJob; // alias of Folder running the current RequestEtagJob
|
||||
|
||||
/// Watching for file changes in folders
|
||||
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<SocketApi> _socketApi;
|
||||
|
||||
/** The aliases of folders that shall be synced. */
|
||||
QQueue<Folder*> _scheduleQueue;
|
||||
/// Occasionally schedules folders
|
||||
QTimer _timeScheduler;
|
||||
|
||||
/** When the timer expires one of the scheduled syncs will be started. */
|
||||
/// 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;
|
||||
|
||||
bool _appRestartRequired;
|
||||
|
||||
static FolderMan *_instance;
|
||||
|
||||
@@ -38,6 +38,12 @@ FolderStatusModel::FolderStatusModel(QObject *parent)
|
||||
FolderStatusModel::~FolderStatusModel()
|
||||
{ }
|
||||
|
||||
static bool sortByFolderHeader(const FolderStatusModel::SubFolderInfo& lhs, const FolderStatusModel::SubFolderInfo& rhs)
|
||||
{
|
||||
return QString::compare(lhs._folder->shortGuiRemotePathOrAppName(),
|
||||
rhs._folder->shortGuiRemotePathOrAppName(),
|
||||
Qt::CaseInsensitive) < 0;
|
||||
}
|
||||
|
||||
void FolderStatusModel::setAccountState(const AccountState* accountState)
|
||||
{
|
||||
@@ -58,7 +64,6 @@ void FolderStatusModel::setAccountState(const AccountState* accountState)
|
||||
if (f->accountState() != accountState)
|
||||
continue;
|
||||
SubFolderInfo info;
|
||||
info._pathIdx << _folders.size();
|
||||
info._name = f->alias();
|
||||
info._path = "/";
|
||||
info._folder = f;
|
||||
@@ -69,6 +74,14 @@ void FolderStatusModel::setAccountState(const AccountState* accountState)
|
||||
connect(f, SIGNAL(newBigFolderDiscovered(QString)), this, SLOT(slotNewBigFolder()), Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
// Sort by header text
|
||||
qSort(_folders.begin(), _folders.end(), sortByFolderHeader);
|
||||
|
||||
// Set the root _pathIdx after the sorting
|
||||
for (int i = 0; i < _folders.size(); ++i) {
|
||||
_folders[i]._pathIdx << i;
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
emit dirtyChanged();
|
||||
}
|
||||
@@ -375,12 +388,13 @@ QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString& path) cons
|
||||
if (slashPos == -1) {
|
||||
// first level folder
|
||||
for (int i = 0; i < _folders.size(); ++i) {
|
||||
if (_folders.at(i)._folder == f) {
|
||||
auto& info = _folders.at(i);
|
||||
if (info._folder == f) {
|
||||
if( path.isEmpty() ) { // the folder object
|
||||
return index(i, 0);
|
||||
}
|
||||
for (int j = 0; j < _folders.at(i)._subs.size(); ++j) {
|
||||
const QString subName = _folders.at(i)._subs.at(j)._name;
|
||||
for (int j = 0; j < info._subs.size(); ++j) {
|
||||
const QString subName = info._subs.at(j)._name;
|
||||
if (subName == path) {
|
||||
return index(j, 0, index(i));
|
||||
}
|
||||
@@ -785,7 +799,7 @@ void FolderStatusModel::slotApplySelectiveSync()
|
||||
foreach(const auto &it, changes) {
|
||||
folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
||||
}
|
||||
FolderMan::instance()->slotScheduleSync(folder);
|
||||
FolderMan::instance()->scheduleFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -986,10 +1000,12 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
|
||||
}
|
||||
if (folderIndex < 0) { return; }
|
||||
|
||||
auto& pi = _folders[folderIndex]._progress;
|
||||
|
||||
SyncResult::Status state = f->syncResult().status();
|
||||
if (f->syncPaused()) {
|
||||
// Reset progress info.
|
||||
_folders[folderIndex]._progress = SubFolderInfo::Progress();
|
||||
pi = SubFolderInfo::Progress();
|
||||
} else if (state == SyncResult::NotYetStarted) {
|
||||
FolderMan* folderMan = FolderMan::instance();
|
||||
int pos = folderMan->scheduleQueue().indexOf(f);
|
||||
@@ -1003,16 +1019,16 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
|
||||
} else {
|
||||
message = tr("Waiting for %n other folder(s)...", "", pos);
|
||||
}
|
||||
_folders[folderIndex]._progress = SubFolderInfo::Progress();
|
||||
_folders[folderIndex]._progress._overallSyncString = message;
|
||||
pi = SubFolderInfo::Progress();
|
||||
pi._overallSyncString = message;
|
||||
} else if (state == SyncResult::SyncPrepare) {
|
||||
_folders[folderIndex]._progress = SubFolderInfo::Progress();
|
||||
_folders[folderIndex]._progress._overallSyncString = tr("Preparing to sync...");
|
||||
pi = SubFolderInfo::Progress();
|
||||
pi._overallSyncString = tr("Preparing to sync...");
|
||||
} else if (state == SyncResult::Problem || state == SyncResult::Success) {
|
||||
// Reset the progress info after a sync.
|
||||
_folders[folderIndex]._progress = SubFolderInfo::Progress();
|
||||
pi = SubFolderInfo::Progress();
|
||||
} else if (state == SyncResult::Error) {
|
||||
_folders[folderIndex]._progress = SubFolderInfo::Progress();
|
||||
pi = SubFolderInfo::Progress();
|
||||
}
|
||||
|
||||
// update the icon etc. now
|
||||
@@ -1046,6 +1062,77 @@ void FolderStatusModel::resetFolders()
|
||||
setAccountState(_accountState);
|
||||
}
|
||||
|
||||
void FolderStatusModel::slotSyncAllPendingBigFolders()
|
||||
{
|
||||
for (int i = 0; i < _folders.count(); ++i) {
|
||||
if (!_folders[i]._fetched) {
|
||||
_folders[i]._folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
|
||||
continue;
|
||||
}
|
||||
auto folder = _folders.at(i)._folder;
|
||||
|
||||
bool ok;
|
||||
auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok);
|
||||
if( !ok ) {
|
||||
qDebug() << Q_FUNC_INFO << "Could not read selective sync list from db.";
|
||||
return;
|
||||
}
|
||||
|
||||
// If this folder had no undecided entries, skip it.
|
||||
if (undecidedList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove all undecided folders from the blacklist
|
||||
auto blackList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
|
||||
if( !ok ) {
|
||||
qDebug() << Q_FUNC_INFO << "Could not read selective sync list from db.";
|
||||
return;
|
||||
}
|
||||
foreach (const auto& undecidedFolder, undecidedList) {
|
||||
blackList.removeAll(undecidedFolder);
|
||||
}
|
||||
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
|
||||
|
||||
// Add all undecided folders to the white list
|
||||
auto whiteList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, &ok);
|
||||
if( !ok ) {
|
||||
qDebug() << Q_FUNC_INFO << "Could not read selective sync list from db.";
|
||||
return;
|
||||
}
|
||||
whiteList += undecidedList;
|
||||
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, whiteList);
|
||||
|
||||
// Clear the undecided list
|
||||
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
|
||||
|
||||
// Trigger a sync
|
||||
if (folder->isBusy()) {
|
||||
folder->slotTerminateSync();
|
||||
}
|
||||
// The part that changed should not be read from the DB on next sync because there might be new folders
|
||||
// (the ones that are no longer in the blacklist)
|
||||
foreach (const auto &it, undecidedList) {
|
||||
folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
||||
}
|
||||
FolderMan::instance()->scheduleFolder(folder);
|
||||
}
|
||||
|
||||
resetFolders();
|
||||
}
|
||||
|
||||
void FolderStatusModel::slotSyncNoPendingBigFolders()
|
||||
{
|
||||
for (int i = 0; i < _folders.count(); ++i) {
|
||||
auto folder = _folders.at(i)._folder;
|
||||
|
||||
// clear the undecided list
|
||||
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
|
||||
}
|
||||
|
||||
resetFolders();
|
||||
}
|
||||
|
||||
void FolderStatusModel::slotNewBigFolder()
|
||||
{
|
||||
auto f = qobject_cast<Folder *>(sender());
|
||||
|
||||
@@ -107,6 +107,8 @@ public slots:
|
||||
void slotUpdateFolderState(Folder *);
|
||||
void slotApplySelectiveSync();
|
||||
void resetFolders();
|
||||
void slotSyncAllPendingBigFolders();
|
||||
void slotSyncNoPendingBigFolders();
|
||||
void slotSetProgress(const ProgressInfo &progress);
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -126,7 +126,7 @@ void IgnoreListEditor::slotUpdateLocalIgnoreList()
|
||||
// ignored (because the remote etag did not change) (issue #3172)
|
||||
foreach (Folder* folder, folderMan->map()) {
|
||||
folder->journalDb()->forceRemoteDiscoveryNextSync();
|
||||
folderMan->slotScheduleSync(folder);
|
||||
folderMan->scheduleFolder(folder);
|
||||
}
|
||||
|
||||
ExcludedFiles::instance().reloadExcludes();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "filesystem.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
@@ -30,6 +31,7 @@ LockWatcher::LockWatcher(QObject* parent)
|
||||
|
||||
void LockWatcher::addFile(const QString& path)
|
||||
{
|
||||
qDebug() << "Watching for lock of" << path << "being released";
|
||||
_watchedPaths.insert(path);
|
||||
}
|
||||
|
||||
@@ -39,6 +41,7 @@ void LockWatcher::checkFiles()
|
||||
|
||||
foreach (const QString& path, _watchedPaths) {
|
||||
if (!FileSystem::isFileLocked(path)) {
|
||||
qDebug() << "Lock of" << path << "was released";
|
||||
emit fileUnlocked(path);
|
||||
unlocked.insert(path);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#include "winuser.h"
|
||||
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "owncloud.exe.manifest-mingw"
|
||||
@@ -66,7 +66,7 @@ void OcsJob::start()
|
||||
req.setRawHeader("Ocs-APIREQUEST", "true");
|
||||
req.setRawHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
QUrl url = Account::concatUrlPath(account()->url(), path());
|
||||
QUrl url = Utility::concatUrlPath(account()->url(), path());
|
||||
QBuffer *buffer = new QBuffer;
|
||||
|
||||
if (_verb == "GET") {
|
||||
@@ -107,7 +107,7 @@ bool OcsJob::finished()
|
||||
if (!success) {
|
||||
qDebug() << "Could not parse reply to"
|
||||
<< _verb
|
||||
<< Account::concatUrlPath(account()->url(), path())
|
||||
<< Utility::concatUrlPath(account()->url(), path())
|
||||
<< _params
|
||||
<< ":" << replyData;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ bool OcsJob::finished()
|
||||
if (!_passStatusCodes.contains(statusCode)) {
|
||||
qDebug() << "Reply to"
|
||||
<< _verb
|
||||
<< Account::concatUrlPath(account()->url(), path())
|
||||
<< Utility::concatUrlPath(account()->url(), path())
|
||||
<< _params
|
||||
<< "has unexpected status code:" << statusCode << replyData;
|
||||
emit ocsError(statusCode, message);
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
|
||||
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
+168
-85
@@ -56,7 +56,7 @@ ownCloudGui::ownCloudGui(Application *parent) :
|
||||
_settingsDialog(new SettingsDialog(this)),
|
||||
#endif
|
||||
_logBrowser(0),
|
||||
_contextMenuVisible(false),
|
||||
_contextMenuVisibleOsx(false),
|
||||
_recentActionsMenu(0),
|
||||
_qdbusmenuWorkaround(false),
|
||||
_folderOpenActionMapper(new QSignalMapper(this)),
|
||||
@@ -67,7 +67,7 @@ ownCloudGui::ownCloudGui(Application *parent) :
|
||||
_tray->setParent(this);
|
||||
|
||||
// for the beginning, set the offline icon until the account was verified
|
||||
_tray->setIcon( Theme::instance()->folderOfflineIcon(true));
|
||||
_tray->setIcon( Theme::instance()->folderOfflineIcon(/*systray?*/ true, /*currently visible?*/ false));
|
||||
|
||||
connect(_tray.data(), SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)));
|
||||
@@ -93,9 +93,9 @@ ownCloudGui::ownCloudGui(Application *parent) :
|
||||
this,SLOT(slotSyncStateChange(Folder*)));
|
||||
|
||||
connect( AccountManager::instance(), SIGNAL(accountAdded(AccountState*)),
|
||||
SLOT(setupContextMenuIfVisible()));
|
||||
SLOT(updateContextMenuNeeded()));
|
||||
connect( AccountManager::instance(), SIGNAL(accountRemoved(AccountState*)),
|
||||
SLOT(setupContextMenuIfVisible()));
|
||||
SLOT(updateContextMenuNeeded()));
|
||||
|
||||
connect( Logger::instance(), SIGNAL(guiLog(QString,QString)),
|
||||
SLOT(slotShowTrayMessage(QString,QString)));
|
||||
@@ -194,7 +194,7 @@ void ownCloudGui::slotTrayClicked( QSystemTrayIcon::ActivationReason reason )
|
||||
void ownCloudGui::slotSyncStateChange( Folder* folder )
|
||||
{
|
||||
slotComputeOverallSyncStatus();
|
||||
setupContextMenuIfVisible();
|
||||
updateContextMenuNeeded();
|
||||
|
||||
if( !folder ) {
|
||||
return; // Valid, just a general GUI redraw was needed.
|
||||
@@ -216,7 +216,7 @@ void ownCloudGui::slotSyncStateChange( Folder* folder )
|
||||
void ownCloudGui::slotFoldersChanged()
|
||||
{
|
||||
slotComputeOverallSyncStatus();
|
||||
setupContextMenuIfVisible();
|
||||
updateContextMenuNeeded();
|
||||
}
|
||||
|
||||
void ownCloudGui::slotOpenPath(const QString &path)
|
||||
@@ -226,7 +226,7 @@ void ownCloudGui::slotOpenPath(const QString &path)
|
||||
|
||||
void ownCloudGui::slotAccountStateChanged()
|
||||
{
|
||||
setupContextMenuIfVisible();
|
||||
updateContextMenuNeeded();
|
||||
slotComputeOverallSyncStatus();
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void ownCloudGui::slotComputeOverallSyncStatus()
|
||||
}
|
||||
|
||||
if (!problemAccounts.empty()) {
|
||||
_tray->setIcon(Theme::instance()->folderOfflineIcon(true));
|
||||
_tray->setIcon(Theme::instance()->folderOfflineIcon(true, contextMenuVisible()));
|
||||
#ifdef Q_OS_WIN
|
||||
// Windows has a 128-char tray tooltip length limit.
|
||||
QStringList accountNames;
|
||||
@@ -289,11 +289,11 @@ void ownCloudGui::slotComputeOverallSyncStatus()
|
||||
}
|
||||
|
||||
if (allSignedOut) {
|
||||
_tray->setIcon(Theme::instance()->folderOfflineIcon(true));
|
||||
_tray->setIcon(Theme::instance()->folderOfflineIcon(true, contextMenuVisible()));
|
||||
_tray->setToolTip(tr("Please sign in"));
|
||||
return;
|
||||
} else if (allPaused) {
|
||||
_tray->setIcon(Theme::instance()->syncStateIcon(SyncResult::Paused, true));
|
||||
_tray->setIcon(Theme::instance()->syncStateIcon(SyncResult::Paused, true, contextMenuVisible()));
|
||||
_tray->setToolTip(tr("Account synchronization is disabled"));
|
||||
return;
|
||||
}
|
||||
@@ -323,12 +323,12 @@ void ownCloudGui::slotComputeOverallSyncStatus()
|
||||
trayMessage = tr("No sync folders configured.");
|
||||
}
|
||||
|
||||
QIcon statusIcon = Theme::instance()->syncStateIcon( overallResult.status(), true);
|
||||
QIcon statusIcon = Theme::instance()->syncStateIcon( overallResult.status(), true, contextMenuVisible());
|
||||
_tray->setIcon( statusIcon );
|
||||
_tray->setToolTip(trayMessage);
|
||||
} else {
|
||||
// undefined because there are no folders.
|
||||
QIcon icon = Theme::instance()->syncStateIcon(SyncResult::Problem, true);
|
||||
QIcon icon = Theme::instance()->syncStateIcon(SyncResult::Problem, true, contextMenuVisible());
|
||||
_tray->setIcon( icon );
|
||||
_tray->setToolTip(tr("There are no sync folders configured."));
|
||||
}
|
||||
@@ -400,41 +400,160 @@ void ownCloudGui::addAccountContextMenu(AccountStatePtr accountState, QMenu *men
|
||||
|
||||
}
|
||||
|
||||
static bool minimalTrayMenu()
|
||||
{
|
||||
static QByteArray var = qgetenv("OWNCLOUD_MINIMAL_TRAY_MENU");
|
||||
return !var.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
void ownCloudGui::slotContextMenuAboutToShow()
|
||||
{
|
||||
// For some reason on OS X _contextMenu->isVisible returns always false
|
||||
qDebug() << "";
|
||||
_contextMenuVisible = true;
|
||||
_contextMenuVisibleOsx = true;
|
||||
|
||||
// Update icon in sys tray, as it might change depending on the context menu state
|
||||
slotComputeOverallSyncStatus();
|
||||
}
|
||||
|
||||
void ownCloudGui::slotContextMenuAboutToHide()
|
||||
{
|
||||
// For some reason on OS X _contextMenu->isVisible returns always false
|
||||
qDebug() << "";
|
||||
_contextMenuVisible = false;
|
||||
_contextMenuVisibleOsx = false;
|
||||
|
||||
// Update icon in sys tray, as it might change depending on the context menu state
|
||||
slotComputeOverallSyncStatus();
|
||||
}
|
||||
|
||||
bool ownCloudGui::contextMenuVisible() const
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
return _contextMenuVisibleOsx;
|
||||
#else
|
||||
return _contextMenu->isVisible();
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool minimalTrayMenu()
|
||||
{
|
||||
static QByteArray var = qgetenv("OWNCLOUD_MINIMAL_TRAY_MENU");
|
||||
return !var.isEmpty();
|
||||
}
|
||||
|
||||
static bool updateWhileVisible()
|
||||
{
|
||||
static QByteArray var = qgetenv("OWNCLOUD_TRAY_UPDATE_WHILE_VISIBLE");
|
||||
if (var == "1") {
|
||||
return true;
|
||||
} else if (var == "0") {
|
||||
return false;
|
||||
} else {
|
||||
// triggers bug on OS X: https://bugreports.qt.io/browse/QTBUG-54845
|
||||
// or flickering on Xubuntu
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static QByteArray forceQDBusTrayWorkaround()
|
||||
{
|
||||
static QByteArray var = qgetenv("OWNCLOUD_FORCE_QDBUS_TRAY_WORKAROUND");
|
||||
return var;
|
||||
}
|
||||
|
||||
void ownCloudGui::setupContextMenu()
|
||||
{
|
||||
if (_contextMenu) {
|
||||
return;
|
||||
}
|
||||
|
||||
_contextMenu.reset(new QMenu());
|
||||
_contextMenu->setTitle(Theme::instance()->appNameGUI() );
|
||||
|
||||
_recentActionsMenu = new QMenu(tr("Recent Changes"), _contextMenu.data());
|
||||
|
||||
// this must be called only once after creating the context menu, or
|
||||
// it will trigger a bug in Ubuntu's SNI bridge patch (11.10, 12.04).
|
||||
_tray->setContextMenu(_contextMenu.data());
|
||||
|
||||
// The tray menu is surprisingly problematic. Being able to switch to
|
||||
// a minimal version of it is a useful workaround and testing tool.
|
||||
if (minimalTrayMenu()) {
|
||||
if (!_contextMenu) {
|
||||
_contextMenu.reset(new QMenu());
|
||||
_recentActionsMenu = new QMenu(tr("Recent Changes"), _contextMenu.data());
|
||||
_tray->setContextMenu(_contextMenu.data());
|
||||
_contextMenu->addAction(_actionQuit);
|
||||
}
|
||||
_contextMenu->addAction(_actionQuit);
|
||||
return;
|
||||
}
|
||||
|
||||
// Enables workarounds for bugs introduced in Qt 5.5.0
|
||||
// In particular QTBUG-47863 #3672 (tray menu fails to update and
|
||||
// becomes unresponsive) and QTBUG-48068 #3722 (click signal is
|
||||
// emitted several times)
|
||||
// The Qt version check intentionally uses 5.0.0 (where platformMenu()
|
||||
// was introduced) instead of 5.5.0 to avoid issues where the Qt
|
||||
// version used to build is different from the one used at runtime.
|
||||
// If we build with 5.6.1 or newer, we can skip this because the
|
||||
// bugs should be fixed there.
|
||||
#ifdef Q_OS_LINUX
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) && (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
|
||||
if (qVersion() == QByteArray("5.5.0")) {
|
||||
QObject* platformMenu = reinterpret_cast<QObject*>(_tray->contextMenu()->platformMenu());
|
||||
if (platformMenu
|
||||
&& platformMenu->metaObject()->className() == QLatin1String("QDBusPlatformMenu")) {
|
||||
_qdbusmenuWorkaround = true;
|
||||
qDebug() << "Enabled QDBusPlatformMenu workaround";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (forceQDBusTrayWorkaround() == "1") {
|
||||
_qdbusmenuWorkaround = true;
|
||||
} else if (forceQDBusTrayWorkaround() == "0") {
|
||||
_qdbusmenuWorkaround = false;
|
||||
}
|
||||
|
||||
// When the qdbusmenuWorkaround is necessary, we can't do on-demand updates
|
||||
// because the workaround is to hide and show the tray icon.
|
||||
if (_qdbusmenuWorkaround) {
|
||||
connect(&_workaroundBatchTrayUpdate, SIGNAL(timeout()), SLOT(updateContextMenu()));
|
||||
_workaroundBatchTrayUpdate.setInterval(30 * 1000);
|
||||
_workaroundBatchTrayUpdate.setSingleShot(true);
|
||||
} else {
|
||||
// Update the context menu whenever we're about to show it
|
||||
// to the user.
|
||||
#ifdef Q_OS_MAC
|
||||
// https://bugreports.qt.io/browse/QTBUG-54633
|
||||
connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(slotContextMenuAboutToShow()));
|
||||
connect(_contextMenu.data(), SIGNAL(aboutToHide()), SLOT(slotContextMenuAboutToHide()));
|
||||
#else
|
||||
connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(updateContextMenu()));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Populate the context menu now.
|
||||
updateContextMenu();
|
||||
}
|
||||
|
||||
void ownCloudGui::updateContextMenu()
|
||||
{
|
||||
if (minimalTrayMenu()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_qdbusmenuWorkaround) {
|
||||
// To make tray menu updates work with these bugs (see setupContextMenu)
|
||||
// we need to hide and show the tray icon. We don't want to do that
|
||||
// while it's visible!
|
||||
if (contextMenuVisible()) {
|
||||
if (!_workaroundBatchTrayUpdate.isActive()) {
|
||||
_workaroundBatchTrayUpdate.start();
|
||||
}
|
||||
return;
|
||||
}
|
||||
_tray->hide();
|
||||
}
|
||||
|
||||
_contextMenu->clear();
|
||||
slotRebuildRecentMenus();
|
||||
|
||||
// We must call deleteLater because we might be called from the press in one of the actions.
|
||||
foreach (auto menu, _accountMenus) { menu->deleteLater(); }
|
||||
_accountMenus.clear();
|
||||
|
||||
|
||||
auto accountList = AccountManager::instance()->accounts();
|
||||
|
||||
bool isConfigured = (!accountList.isEmpty());
|
||||
@@ -461,54 +580,6 @@ void ownCloudGui::setupContextMenu()
|
||||
}
|
||||
}
|
||||
|
||||
if ( _contextMenu ) {
|
||||
if (_qdbusmenuWorkaround) {
|
||||
_tray->hide();
|
||||
}
|
||||
_contextMenu->clear();
|
||||
} else {
|
||||
_contextMenu.reset(new QMenu());
|
||||
|
||||
// Update the context menu whenever we're about to show it
|
||||
// to the user.
|
||||
#ifdef Q_OS_MAC
|
||||
// https://bugreports.qt.io/browse/QTBUG-54633
|
||||
#else
|
||||
connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(setupContextMenu()));
|
||||
#endif
|
||||
connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(slotContextMenuAboutToShow()));
|
||||
connect(_contextMenu.data(), SIGNAL(aboutToHide()), SLOT(slotContextMenuAboutToHide()));
|
||||
|
||||
|
||||
_recentActionsMenu = new QMenu(tr("Recent Changes"), _contextMenu.data());
|
||||
// this must be called only once after creating the context menu, or
|
||||
// it will trigger a bug in Ubuntu's SNI bridge patch (11.10, 12.04).
|
||||
_tray->setContextMenu(_contextMenu.data());
|
||||
|
||||
// Enables workarounds for bugs introduced in Qt 5.5.0
|
||||
// In particular QTBUG-47863 #3672 (tray menu fails to update and
|
||||
// becomes unresponsive) and QTBUG-48068 #3722 (click signal is
|
||||
// emitted several times)
|
||||
// The Qt version check intentionally uses 5.0.0 (where platformMenu()
|
||||
// was introduced) instead of 5.5.0 to avoid issues where the Qt
|
||||
// version used to build is different from the one used at runtime.
|
||||
#ifdef Q_OS_LINUX
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
QObject* platformMenu = reinterpret_cast<QObject*>(_tray->contextMenu()->platformMenu());
|
||||
if (platformMenu
|
||||
&& platformMenu->metaObject()->className() == QLatin1String("QDBusPlatformMenu")) {
|
||||
_qdbusmenuWorkaround = true;
|
||||
qDebug() << "Enabled QDBusPlatformMenu workaround";
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
_contextMenu->setTitle(Theme::instance()->appNameGUI() );
|
||||
slotRebuildRecentMenus();
|
||||
|
||||
// We must call deleteLater because we might be called from the press in one of the actions.
|
||||
foreach (auto menu, _accountMenus) { menu->deleteLater(); }
|
||||
_accountMenus.clear();
|
||||
if (accountList.count() > 1) {
|
||||
foreach (AccountStatePtr account, accountList) {
|
||||
QMenu* accountMenu = new QMenu(account->account()->displayName(), _contextMenu.data());
|
||||
@@ -581,17 +652,30 @@ void ownCloudGui::setupContextMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void ownCloudGui::setupContextMenuIfVisible()
|
||||
void ownCloudGui::updateContextMenuNeeded()
|
||||
{
|
||||
// For the workaround case updating while visible is impossible. Instead
|
||||
// occasionally update the menu when it's invisible.
|
||||
if (_qdbusmenuWorkaround) {
|
||||
if (!_workaroundBatchTrayUpdate.isActive()) {
|
||||
_workaroundBatchTrayUpdate.start();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// https://bugreports.qt.io/browse/QTBUG-54845
|
||||
if (!_contextMenuVisible) {
|
||||
setupContextMenu();
|
||||
// We cannot update on demand or while visible -> update when invisible.
|
||||
if (!contextMenuVisible()) {
|
||||
updateContextMenu();
|
||||
}
|
||||
#else
|
||||
if (_contextMenuVisible)
|
||||
setupContextMenu();
|
||||
if (updateWhileVisible() && contextMenuVisible())
|
||||
updateContextMenu();
|
||||
#endif
|
||||
|
||||
// If no update was done here, we might update it on-demand due to
|
||||
// the aboutToShow() signal.
|
||||
}
|
||||
|
||||
void ownCloudGui::slotShowTrayMessage(const QString &title, const QString &msg)
|
||||
@@ -754,13 +838,9 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const ProgressInfo&
|
||||
|
||||
// Update the "Recent" menu if the context menu is being shown,
|
||||
// otherwise it'll be updated later, when the context menu is opened.
|
||||
#ifdef Q_OS_MAC
|
||||
// https://bugreports.qt.io/browse/QTBUG-54845
|
||||
#else
|
||||
if (_contextMenuVisible) {
|
||||
if (updateWhileVisible() && contextMenuVisible()) {
|
||||
slotRebuildRecentMenus();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (progress.isUpdatingEstimates()
|
||||
@@ -823,6 +903,9 @@ void ownCloudGui::setPauseOnAllFoldersHelper(bool pause)
|
||||
foreach (Folder* f, FolderMan::instance()->map()) {
|
||||
if (accounts.contains(f->accountState())) {
|
||||
f->setSyncPaused(pause);
|
||||
if (pause) {
|
||||
f->slotTerminateSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -24,6 +24,7 @@
|
||||
#include <QMenu>
|
||||
#include <QSignalMapper>
|
||||
#include <QSize>
|
||||
#include <QTimer>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@@ -52,12 +53,16 @@ public:
|
||||
static QSize settingsDialogSize() { return QSize(800, 500); }
|
||||
void setupOverlayIcons();
|
||||
|
||||
/// Whether the tray menu is visible
|
||||
bool contextMenuVisible() const;
|
||||
|
||||
signals:
|
||||
void setupProxy();
|
||||
|
||||
public slots:
|
||||
void setupContextMenu();
|
||||
void setupContextMenuIfVisible();
|
||||
void updateContextMenu();
|
||||
void updateContextMenuNeeded();
|
||||
void slotContextMenuAboutToShow();
|
||||
void slotContextMenuAboutToHide();
|
||||
void slotComputeOverallSyncStatus();
|
||||
@@ -104,11 +109,15 @@ private:
|
||||
QPointer<LogBrowser>_logBrowser;
|
||||
// tray's menu
|
||||
QScopedPointer<QMenu> _contextMenu;
|
||||
bool _contextMenuVisible;
|
||||
|
||||
// Manually tracking whether the context menu is visible, but only works
|
||||
// on OSX because aboutToHide is not reliable everywhere.
|
||||
bool _contextMenuVisibleOsx;
|
||||
|
||||
QMenu *_recentActionsMenu;
|
||||
QVector<QMenu*> _accountMenus;
|
||||
bool _qdbusmenuWorkaround;
|
||||
QTimer _workaroundBatchTrayUpdate;
|
||||
QMap<QString, QPointer<ShareDialog> > _shareDialogs;
|
||||
|
||||
QAction *_actionLogin;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "networkjobs.h"
|
||||
#include "sslerrordialog.h"
|
||||
#include "accountmanager.h"
|
||||
#include "clientproxy.h"
|
||||
|
||||
#include "creds/credentialsfactory.h"
|
||||
#include "creds/abstractcredentials.h"
|
||||
@@ -128,7 +129,38 @@ void OwncloudSetupWizard::slotDetermineAuthType(const QString &urlString)
|
||||
account->setUrl(url);
|
||||
// Reset the proxy which might had been determined previously in ConnectionValidator::checkServerAndAuth()
|
||||
// when there was a previous account.
|
||||
account->networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy));
|
||||
account->networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
|
||||
|
||||
// Lookup system proxy in a thread https://github.com/owncloud/client/issues/2993
|
||||
if (ClientProxy::isUsingSystemDefault()) {
|
||||
qDebug() << "Trying to look up system proxy";
|
||||
ClientProxy::lookupSystemProxyAsync(account->url(),
|
||||
this, SLOT(slotSystemProxyLookupDone(QNetworkProxy)));
|
||||
} else {
|
||||
// We want to reset the QNAM proxy so that the global proxy settings are used (via ClientProxy settings)
|
||||
account->networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy));
|
||||
// use a queued invocation so we're as asynchronous as with the other code path
|
||||
QMetaObject::invokeMethod(this, "slotContinueDetermineAuth", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotSystemProxyLookupDone(const QNetworkProxy &proxy)
|
||||
{
|
||||
if (proxy.type() != QNetworkProxy::NoProxy) {
|
||||
qDebug() << "Setting QNAM proxy to be system proxy" << printQNetworkProxy(proxy);
|
||||
} else {
|
||||
qDebug() << "No system proxy set by OS";
|
||||
}
|
||||
AccountPtr account = _ocWizard->account();
|
||||
account->networkAccessManager()->setProxy(proxy);
|
||||
|
||||
slotContinueDetermineAuth();
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotContinueDetermineAuth()
|
||||
{
|
||||
AccountPtr account = _ocWizard->account();
|
||||
|
||||
// Set fake credentials before we check what credential it actually is.
|
||||
account->setCredentials(CredentialsFactory::create("dummy"));
|
||||
CheckServerJob *job = new CheckServerJob(_ocWizard->account(), this);
|
||||
@@ -136,7 +168,7 @@ void OwncloudSetupWizard::slotDetermineAuthType(const QString &urlString)
|
||||
connect(job, SIGNAL(instanceFound(QUrl,QVariantMap)), SLOT(slotOwnCloudFoundAuth(QUrl,QVariantMap)));
|
||||
connect(job, SIGNAL(instanceNotFound(QNetworkReply*)), SLOT(slotNoOwnCloudFoundAuth(QNetworkReply*)));
|
||||
connect(job, SIGNAL(timeout(const QUrl&)), SLOT(slotNoOwnCloudFoundAuthTimeout(const QUrl&)));
|
||||
job->setTimeout(10*1000);
|
||||
job->setTimeout((account->url().scheme() == "https") ? 30*1000 : 10*1000);
|
||||
job->start();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ signals:
|
||||
|
||||
private slots:
|
||||
void slotDetermineAuthType(const QString&);
|
||||
void slotSystemProxyLookupDone(const QNetworkProxy &proxy);
|
||||
void slotContinueDetermineAuth();
|
||||
void slotOwnCloudFoundAuth(const QUrl&, const QVariantMap&);
|
||||
void slotNoOwnCloudFoundAuth(QNetworkReply *reply);
|
||||
void slotNoOwnCloudFoundAuthTimeout(const QUrl&url);
|
||||
|
||||
@@ -460,7 +460,7 @@ void SelectiveSyncDialog::accept()
|
||||
_folder->journalDb()->avoidReadFromDbOnNextSync(it);
|
||||
}
|
||||
|
||||
folderMan->slotScheduleSync(_folder);
|
||||
folderMan->scheduleFolder(_folder);
|
||||
}
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
|
||||
_userGroupWidget(NULL),
|
||||
_progressIndicator(NULL)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setObjectName("SharingDialog"); // required as group for saveGeometry call
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QClipboard>
|
||||
#include <QFileInfo>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@@ -490,13 +491,20 @@ void ShareLinkWidget::slotPushButtonMailLinkPressed()
|
||||
{
|
||||
QString fileName = _sharePath.mid(_sharePath.lastIndexOf('/') + 1);
|
||||
|
||||
QDesktopServices::openUrl(QUrl(QString(
|
||||
"mailto: "
|
||||
"?subject=I shared %1 with you"
|
||||
"&body=%2").arg(
|
||||
fileName,
|
||||
_shareUrl),
|
||||
QUrl::TolerantMode));
|
||||
if (!QDesktopServices::openUrl(QUrl(QString(
|
||||
"mailto: "
|
||||
"?subject=I shared %1 with you"
|
||||
"&body=%2").arg(
|
||||
fileName,
|
||||
_shareUrl),
|
||||
QUrl::TolerantMode))) {
|
||||
QMessageBox::warning(
|
||||
this,
|
||||
tr("Could not open email client"),
|
||||
tr("There was an error when launching the email client to "
|
||||
"create a new message. Maybe no default email client is "
|
||||
"configured?"));
|
||||
}
|
||||
}
|
||||
|
||||
void ShareLinkWidget::slotCheckBoxEditingClicked()
|
||||
|
||||
@@ -344,12 +344,12 @@ QSharedPointer<LinkShare> ShareManager::parseLinkShare(const QVariantMap &data)
|
||||
url = QUrl(data.value("url").toString());
|
||||
} else if (_account->serverVersionInt() >= (8 << 16)) {
|
||||
// From ownCloud server version 8 on, a different share link scheme is used.
|
||||
url = QUrl(Account::concatUrlPath(_account->url(), QString("index.php/s/%1").arg(data.value("token").toString())).toString());
|
||||
url = QUrl(Utility::concatUrlPath(_account->url(), QString("index.php/s/%1").arg(data.value("token").toString())).toString());
|
||||
} else {
|
||||
QList<QPair<QString, QString>> queryArgs;
|
||||
queryArgs.append(qMakePair(QString("service"), QString("files")));
|
||||
queryArgs.append(qMakePair(QString("t"), data.value("token").toString()));
|
||||
url = QUrl(Account::concatUrlPath(_account->url(), QLatin1String("public.php"), queryArgs).toString());
|
||||
url = QUrl(Utility::concatUrlPath(_account->url(), QLatin1String("public.php"), queryArgs).toString());
|
||||
}
|
||||
|
||||
QDate expireDate;
|
||||
|
||||
@@ -267,6 +267,12 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rSelectiveSync">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
||||
@@ -63,6 +63,10 @@ QNetworkReply* AccessManager::createRequest(QNetworkAccessManager::Operation op,
|
||||
}
|
||||
|
||||
newRequest.setRawHeader(QByteArray("User-Agent"), Utility::userAgentString());
|
||||
|
||||
// Some firewalls reject requests that have a "User-Agent" but no "Accept" header
|
||||
newRequest.setRawHeader(QByteArray("Accept"), "*/*");
|
||||
|
||||
QByteArray verb = newRequest.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray();
|
||||
// For PROPFIND (assumed to be a WebDAV op), set xml/utf8 as content type/encoding
|
||||
// This needs extension
|
||||
|
||||
@@ -39,7 +39,6 @@ Account::Account(QObject *parent)
|
||||
: QObject(parent)
|
||||
, _capabilities(QVariantMap())
|
||||
, _davPath( Theme::instance()->webDavPath() )
|
||||
, _wasMigrated(false)
|
||||
{
|
||||
qRegisterMetaType<AccountPtr>("AccountPtr");
|
||||
}
|
||||
@@ -94,30 +93,6 @@ QString Account::id() const
|
||||
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
|
||||
{
|
||||
return _credentials.data();
|
||||
@@ -157,12 +132,7 @@ void Account::setCredentials(AbstractCredentials *cred)
|
||||
|
||||
QUrl Account::davUrl() const
|
||||
{
|
||||
return concatUrlPath(url(), davPath());
|
||||
}
|
||||
|
||||
QList<QNetworkCookie> Account::lastAuthCookies() const
|
||||
{
|
||||
return _am->cookieJar()->cookiesForUrl(_url);
|
||||
return Utility::concatUrlPath(url(), davPath());
|
||||
}
|
||||
|
||||
void Account::clearCookieJar()
|
||||
@@ -209,7 +179,7 @@ QNetworkAccessManager *Account::networkAccessManager()
|
||||
|
||||
QNetworkReply *Account::headRequest(const QString &relPath)
|
||||
{
|
||||
return headRequest(concatUrlPath(url(), relPath));
|
||||
return headRequest(Utility::concatUrlPath(url(), relPath));
|
||||
}
|
||||
|
||||
QNetworkReply *Account::headRequest(const QUrl &url)
|
||||
@@ -223,7 +193,7 @@ QNetworkReply *Account::headRequest(const QUrl &url)
|
||||
|
||||
QNetworkReply *Account::getRequest(const QString &relPath)
|
||||
{
|
||||
return getRequest(concatUrlPath(url(), relPath));
|
||||
return getRequest(Utility::concatUrlPath(url(), relPath));
|
||||
}
|
||||
|
||||
QNetworkReply *Account::getRequest(const QUrl &url)
|
||||
@@ -246,7 +216,7 @@ QNetworkReply *Account::deleteRequest( const QUrl &url)
|
||||
|
||||
QNetworkReply *Account::davRequest(const QByteArray &verb, const QString &relPath, QNetworkRequest req, QIODevice *data)
|
||||
{
|
||||
return davRequest(verb, concatUrlPath(davUrl(), relPath), req, data);
|
||||
return davRequest(verb, Utility::concatUrlPath(davUrl(), relPath), req, data);
|
||||
}
|
||||
|
||||
QNetworkReply *Account::davRequest(const QByteArray &verb, const QUrl &url, QNetworkRequest req, QIODevice *data)
|
||||
@@ -340,43 +310,6 @@ void Account::setUrl(const QUrl &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
|
||||
{
|
||||
if (_credentials) {
|
||||
@@ -475,16 +408,6 @@ void Account::handleInvalidCredentials()
|
||||
emit invalidCredentials();
|
||||
}
|
||||
|
||||
bool Account::wasMigrated()
|
||||
{
|
||||
return _wasMigrated;
|
||||
}
|
||||
|
||||
void Account::setMigrated(bool mig)
|
||||
{
|
||||
_wasMigrated = mig;
|
||||
}
|
||||
|
||||
const Capabilities &Account::capabilities() const
|
||||
{
|
||||
return _capabilities;
|
||||
|
||||
+36
-45
@@ -56,10 +56,28 @@ public:
|
||||
/**
|
||||
* @brief The Account class represents an account on an ownCloud Server
|
||||
* @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 {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static AccountPtr create();
|
||||
~Account();
|
||||
|
||||
AccountPtr sharedFromThis();
|
||||
|
||||
/// The name of the account as shown in the toolbar
|
||||
QString displayName() const;
|
||||
|
||||
/// The internal id of the account.
|
||||
QString id() const;
|
||||
|
||||
/** Server url of the account */
|
||||
void setUrl(const QUrl &url);
|
||||
QUrl url() const { return _url; }
|
||||
|
||||
/**
|
||||
* @brief The possibly themed dav path for the account. It has
|
||||
* a trailing slash.
|
||||
@@ -69,44 +87,15 @@ public:
|
||||
void setDavPath(const QString&s) { _davPath = s; }
|
||||
void setNonShib(bool nonShib);
|
||||
|
||||
static AccountPtr create();
|
||||
~Account();
|
||||
|
||||
void setSharedThis(AccountPtr sharedThis);
|
||||
AccountPtr sharedFromThis();
|
||||
|
||||
/// The name of the account as shown in the toolbar
|
||||
QString displayName() const;
|
||||
|
||||
/// The internal id of the account.
|
||||
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;
|
||||
/** Returns webdav entry URL, based on url() */
|
||||
QUrl davUrl() const;
|
||||
|
||||
/** Holds the accounts credentials */
|
||||
AbstractCredentials* credentials() const;
|
||||
void setCredentials(AbstractCredentials *cred);
|
||||
|
||||
/** Server url of the account */
|
||||
void setUrl(const QUrl &url);
|
||||
QUrl url() const { return _url; }
|
||||
|
||||
/** Returns webdav entry URL, based on url() */
|
||||
QUrl davUrl() const;
|
||||
|
||||
/** set and retrieve the migration flag: if an account of a branded
|
||||
* client was migrated from a former ownCloud Account, this is true
|
||||
*/
|
||||
void setMigrated(bool mig);
|
||||
bool wasMigrated();
|
||||
|
||||
QList<QNetworkCookie> lastAuthCookies() const;
|
||||
|
||||
// For creating various network requests
|
||||
QNetworkReply* headRequest(const QString &relPath);
|
||||
QNetworkReply* headRequest(const QUrl &url);
|
||||
QNetworkReply* getRequest(const QString &relPath);
|
||||
@@ -115,6 +104,7 @@ public:
|
||||
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);
|
||||
|
||||
|
||||
/** The ssl configuration during the first connection */
|
||||
QSslConfiguration getOrCreateSslConfig();
|
||||
QSslConfiguration sslConfiguration() const { return _sslConfiguration; }
|
||||
@@ -138,25 +128,21 @@ public:
|
||||
// pluggable handler
|
||||
void setSslErrorHandler(AbstractSslErrorHandler *handler);
|
||||
|
||||
// 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
|
||||
// To be called by credentials only, for storing username and the like
|
||||
QVariant credentialSetting(const QString& key) const;
|
||||
void setCredentialSetting(const QString& key, const QVariant &value);
|
||||
|
||||
/** Assign a client certificate */
|
||||
void setCertificate(const QByteArray certficate = QByteArray(), const QString privateKey = QString());
|
||||
|
||||
void setCapabilities(const QVariantMap &caps);
|
||||
/** Access the server capabilities */
|
||||
const Capabilities &capabilities() const;
|
||||
void setServerVersion(const QString &version);
|
||||
void setCapabilities(const QVariantMap &caps);
|
||||
|
||||
/** Access the server version */
|
||||
QString serverVersion() const;
|
||||
int serverVersionInt() const;
|
||||
void setServerVersion(const QString &version);
|
||||
|
||||
/** Whether the server is too old.
|
||||
*
|
||||
@@ -171,6 +157,7 @@ public:
|
||||
bool serverVersionUnsupported() const;
|
||||
|
||||
// Fixed from 8.1 https://github.com/owncloud/client/issues/3730
|
||||
/** Detects a specific bug in older server versions */
|
||||
bool rootEtagChangesNotOnlySubFolderEtags();
|
||||
|
||||
void clearCookieJar();
|
||||
@@ -179,12 +166,16 @@ public:
|
||||
void resetNetworkAccessManager();
|
||||
QNetworkAccessManager* networkAccessManager();
|
||||
|
||||
/// Called by network jobs on credential errors.
|
||||
/// Called by network jobs on credential errors, emits invalidCredentials()
|
||||
void handleInvalidCredentials();
|
||||
|
||||
signals:
|
||||
/// Emitted whenever there's network activity
|
||||
void propagatorNetworkActivity();
|
||||
|
||||
/// Triggered by handleInvalidCredentials()
|
||||
void invalidCredentials();
|
||||
|
||||
void credentialsFetched(AbstractCredentials* credentials);
|
||||
void credentialsAsked(AbstractCredentials* credentials);
|
||||
|
||||
@@ -203,6 +194,7 @@ protected Q_SLOTS:
|
||||
|
||||
private:
|
||||
Account(QObject *parent = 0);
|
||||
void setSharedThis(AccountPtr sharedThis);
|
||||
|
||||
QWeakPointer<Account> _sharedThis;
|
||||
QString _id;
|
||||
@@ -224,7 +216,6 @@ private:
|
||||
QByteArray _pemCertificate;
|
||||
QString _pemPrivateKey;
|
||||
QString _davPath; // defaults to value from theme, might be overwritten in brandings
|
||||
bool _wasMigrated;
|
||||
friend class AccountManager;
|
||||
};
|
||||
|
||||
|
||||
@@ -129,7 +129,6 @@ SystemProxyRunnable::SystemProxyRunnable(const QUrl &url) : QObject(), QRunnable
|
||||
|
||||
void SystemProxyRunnable::run()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Starting system proxy lookup";
|
||||
qRegisterMetaType<QNetworkProxy>("QNetworkProxy");
|
||||
QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(QNetworkProxyQuery(_url));
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
QUrl _url;
|
||||
};
|
||||
|
||||
QString printQNetworkProxy(const QNetworkProxy &proxy);
|
||||
OWNCLOUDSYNC_EXPORT QString printQNetworkProxy(const QNetworkProxy &proxy);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -611,7 +611,12 @@ void ConfigFile::setPromptDeleteFiles(bool promptDeleteFiles)
|
||||
bool ConfigFile::monoIcons() const
|
||||
{
|
||||
QSettings settings(configFile(), QSettings::IniFormat);
|
||||
return settings.value(QLatin1String(monoIconsC), false).toBool();
|
||||
bool monoDefault = false; // On Mac we want bw by default
|
||||
#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)
|
||||
|
||||
@@ -41,7 +41,6 @@ public:
|
||||
*/
|
||||
virtual void setAccount(Account* account);
|
||||
|
||||
virtual bool changed(AbstractCredentials* credentials) const = 0;
|
||||
virtual QString authType() const = 0;
|
||||
virtual QString user() const = 0;
|
||||
virtual QNetworkAccessManager* getQNAM() const = 0;
|
||||
|
||||
@@ -17,13 +17,6 @@
|
||||
namespace OCC
|
||||
{
|
||||
|
||||
bool DummyCredentials::changed(AbstractCredentials* credentials) const
|
||||
{
|
||||
DummyCredentials* dummy(dynamic_cast< DummyCredentials* >(credentials));
|
||||
|
||||
return dummy == 0;
|
||||
}
|
||||
|
||||
QString DummyCredentials::authType() const
|
||||
{
|
||||
return QString::fromLatin1("dummy");
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
|
||||
QString _user;
|
||||
QString _password;
|
||||
bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
|
||||
QString authType() const Q_DECL_OVERRIDE;
|
||||
QString user() const Q_DECL_OVERRIDE;
|
||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||
|
||||
@@ -71,21 +71,6 @@ 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
|
||||
{
|
||||
return QString::fromLatin1("http");
|
||||
@@ -147,7 +132,7 @@ void HttpCredentials::fetchFromKeychain()
|
||||
_certificatePath = _account->credentialSetting(QLatin1String(certifPathC)).toString();
|
||||
_certificatePasswd = _account->credentialSetting(QLatin1String(certifPasswdC)).toString();
|
||||
|
||||
auto settings = _account->settingsWithGroup(Theme::instance()->appName());
|
||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
||||
const QString kck = keychainKey(_account->url().toString(), _user );
|
||||
|
||||
QString key = QString::fromLatin1( "%1/data" ).arg( kck );
|
||||
@@ -229,7 +214,7 @@ void HttpCredentials::invalidateToken()
|
||||
}
|
||||
|
||||
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
|
||||
auto settings = _account->settingsWithGroup(Theme::instance()->appName());
|
||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
||||
settings->setParent(job); // make the job parent to make setting deleted properly
|
||||
job->setSettings(settings.release());
|
||||
job->setInsecureFallback(true);
|
||||
@@ -280,7 +265,7 @@ void HttpCredentials::persist()
|
||||
_account->setCredentialSetting(QLatin1String(certifPathC), _certificatePath);
|
||||
_account->setCredentialSetting(QLatin1String(certifPasswdC), _certificatePasswd);
|
||||
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
|
||||
auto settings = _account->settingsWithGroup(Theme::instance()->appName());
|
||||
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
|
||||
settings->setParent(job); // make the job parent to make setting deleted properly
|
||||
job->setSettings(settings.release());
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ public:
|
||||
explicit HttpCredentials();
|
||||
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;
|
||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||
bool ready() const Q_DECL_OVERRIDE;
|
||||
|
||||
@@ -80,17 +80,6 @@ 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
|
||||
{
|
||||
return QString::fromLatin1("token");
|
||||
|
||||
@@ -40,7 +40,6 @@ public:
|
||||
TokenCredentials();
|
||||
TokenCredentials(const QString& user, const QString& password, const QString &token);
|
||||
|
||||
bool changed(AbstractCredentials* credentials) const Q_DECL_OVERRIDE;
|
||||
QString authType() const Q_DECL_OVERRIDE;
|
||||
QNetworkAccessManager* getQNAM() const Q_DECL_OVERRIDE;
|
||||
bool ready() const Q_DECL_OVERRIDE;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "discoveryphase.h"
|
||||
#include <csync_private.h>
|
||||
#include <csync_rename.h>
|
||||
#include <qdebug.h>
|
||||
|
||||
#include <QUrl>
|
||||
@@ -51,7 +52,7 @@ static bool findPathInList(const QStringList &list, const QString &path)
|
||||
return pathSlash.startsWith(*it);
|
||||
}
|
||||
|
||||
bool DiscoveryJob::isInSelectiveSyncBlackList(const QString& path) const
|
||||
bool DiscoveryJob::isInSelectiveSyncBlackList(const char *path) const
|
||||
{
|
||||
if (_selectiveSyncBlackList.isEmpty()) {
|
||||
// If there is no black list, everything is allowed
|
||||
@@ -59,13 +60,25 @@ bool DiscoveryJob::isInSelectiveSyncBlackList(const QString& path) const
|
||||
}
|
||||
|
||||
// Block if it is in the black list
|
||||
return findPathInList(_selectiveSyncBlackList, path);
|
||||
if (findPathInList(_selectiveSyncBlackList, QString::fromUtf8(path))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Also try to adjust the path if there was renames
|
||||
if (csync_rename_count(_csync_ctx)) {
|
||||
QScopedPointer<char, QScopedPointerPodDeleter> adjusted(
|
||||
csync_rename_adjust_path_source(_csync_ctx, path));
|
||||
if (strcmp(adjusted.data(), path) != 0) {
|
||||
return findPathInList(_selectiveSyncBlackList, QString::fromUtf8(adjusted.data()));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int DiscoveryJob::isInSelectiveSyncBlackListCallback(void *data, const char *path)
|
||||
{
|
||||
return static_cast<DiscoveryJob*>(data)->isInSelectiveSyncBlackList(QString::fromUtf8(path));
|
||||
return static_cast<DiscoveryJob*>(data)->isInSelectiveSyncBlackList(path);
|
||||
}
|
||||
|
||||
bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path)
|
||||
@@ -192,7 +205,8 @@ int get_errno_from_http_errcode( int err, const QString & reason ) {
|
||||
new_errno = EIO;
|
||||
break;
|
||||
case 503: /* Service Unavailable */
|
||||
if (reason == "Storage not available") {
|
||||
// https://github.com/owncloud/core/pull/26145/files
|
||||
if (reason == "Storage not available" || reason == "Storage is temporarily not available") {
|
||||
new_errno = ERRNO_STORAGE_UNAVAILABLE;
|
||||
} else {
|
||||
new_errno = ERRNO_SERVICE_UNAVAILABLE;
|
||||
|
||||
@@ -174,7 +174,7 @@ class DiscoveryJob : public QObject {
|
||||
* return true if the given path should be ignored,
|
||||
* false if the path should be synced
|
||||
*/
|
||||
bool isInSelectiveSyncBlackList(const QString &path) const;
|
||||
bool isInSelectiveSyncBlackList(const char* path) const;
|
||||
static int isInSelectiveSyncBlackListCallback(void *, const char *);
|
||||
bool checkSelectiveSyncNewFolder(const QString &path);
|
||||
static int checkSelectiveSyncNewFolderCallback(void*, const char*);
|
||||
|
||||
@@ -680,7 +680,7 @@ void JsonApiJob::start()
|
||||
{
|
||||
QNetworkRequest req;
|
||||
req.setRawHeader("OCS-APIREQUEST", "true");
|
||||
QUrl url = Account::concatUrlPath(account()->url(), path());
|
||||
QUrl url = Utility::concatUrlPath(account()->url(), path());
|
||||
QList<QPair<QString, QString> > params = _additionalParams;
|
||||
params << qMakePair(QString::fromLatin1("format"), QString::fromLatin1("json"));
|
||||
url.setQueryItems(params);
|
||||
|
||||
@@ -529,7 +529,7 @@ void OwncloudPropagator::scheduleNextJob()
|
||||
}
|
||||
}
|
||||
if (_activeJobList.count() < maximumActiveJob() + likelyFinishedQuicklyCount) {
|
||||
qDebug() << "Can pump in another request!";
|
||||
qDebug() << "Can pump in another request! activeJobs =" << _activeJobList.count();
|
||||
if (_rootJob->scheduleNextJob()) {
|
||||
QTimer::singleShot(0, this, SLOT(scheduleNextJob()));
|
||||
}
|
||||
@@ -606,9 +606,15 @@ bool PropagateDirectory::scheduleNextJob()
|
||||
return false;
|
||||
}
|
||||
|
||||
// cache the value of first unfinished subjob
|
||||
bool stopAtDirectory = false;
|
||||
// FIXME: use the cached value of finished job
|
||||
for (int i = 0; i < _subJobs.count(); ++i) {
|
||||
int i = _firstUnfinishedSubJob;
|
||||
int subJobsCount = _subJobs.count();
|
||||
while (i < subJobsCount && _subJobs.at(i)->_state == Finished) {
|
||||
_firstUnfinishedSubJob = ++i;
|
||||
}
|
||||
|
||||
for (int i = _firstUnfinishedSubJob; i < subJobsCount; ++i) {
|
||||
if (_subJobs.at(i)->_state == Finished) {
|
||||
continue;
|
||||
}
|
||||
@@ -692,14 +698,14 @@ void PropagateDirectory::finalize()
|
||||
SyncJournalFileRecord record(*_item, _propagator->_localDir + _item->_file);
|
||||
ok = _propagator->_journal->setFileRecordMetadata(record);
|
||||
if (!ok) {
|
||||
_item->_status = SyncFileItem::FatalError;
|
||||
_hasError = _item->_status = SyncFileItem::FatalError;
|
||||
_item->_errorString = tr("Error writing metadata to the database");
|
||||
qWarning() << "Error writing to the database for file" << _item->_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
_state = Finished;
|
||||
emit finished(_item->_status);
|
||||
emit finished(_hasError == SyncFileItem::NoStatus ? SyncFileItem::Success : _hasError);
|
||||
}
|
||||
|
||||
qint64 PropagateDirectory::committedDiskSpace() const
|
||||
|
||||
@@ -195,10 +195,11 @@ public:
|
||||
int _jobsFinished; // number of jobs that have completed
|
||||
int _runningNow; // number of subJobs running right now
|
||||
SyncFileItem::Status _hasError; // NoStatus, or NormalError / SoftError if there was an error
|
||||
int _firstUnfinishedSubJob;
|
||||
|
||||
explicit PropagateDirectory(OwncloudPropagator *propagator, const SyncFileItemPtr &item = SyncFileItemPtr(new SyncFileItem))
|
||||
: PropagatorJob(propagator)
|
||||
, _firstJob(0), _item(item), _jobsFinished(0), _runningNow(0), _hasError(SyncFileItem::NoStatus)
|
||||
, _firstJob(0), _item(item), _jobsFinished(0), _runningNow(0), _hasError(SyncFileItem::NoStatus), _firstUnfinishedSubJob(0)
|
||||
{ }
|
||||
|
||||
virtual ~PropagateDirectory() {
|
||||
|
||||
@@ -44,13 +44,14 @@ QString ownCloudTheme::configFileName() const
|
||||
QString ownCloudTheme::about() const
|
||||
{
|
||||
QString devString;
|
||||
devString = trUtf8("<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>"
|
||||
devString = trUtf8("<p>Version %2. For more information visit <a href=\"%3\">https://%4</a></p>"
|
||||
"<p>For known issues and help, please visit: <a href=\"https://central.owncloud.org/c/help/desktop-file-sync\">https://central.owncloud.org</a></p>"
|
||||
"<p><small>By Klaas Freitag, Daniel Molkentin, Olivier Goffart, Markus Götz, "
|
||||
" Jan-Christoph Borchardt, 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>"
|
||||
"ownCloud and the ownCloud Logo are registered trademarks of ownCloud GmbH "
|
||||
"in the United States, other countries, or both.</p>"
|
||||
)
|
||||
.arg(MIRALL_VERSION_STRING)
|
||||
.arg("https://" MIRALL_STRINGIFY(APPLICATION_DOMAIN))
|
||||
|
||||
@@ -230,8 +230,12 @@ bool SqlQuery::isPragma()
|
||||
|
||||
bool SqlQuery::exec()
|
||||
{
|
||||
if (!_stmt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't do anything for selects, that is how we use the lib :-|
|
||||
if(_stmt && !isSelect() && !isPragma() ) {
|
||||
if( !isSelect() && !isPragma() ) {
|
||||
int rc, n = 0;
|
||||
do {
|
||||
rc = sqlite3_step(_stmt);
|
||||
@@ -376,8 +380,10 @@ void SqlQuery::finish()
|
||||
|
||||
void SqlQuery::reset_and_clear_bindings()
|
||||
{
|
||||
SQLITE_DO(sqlite3_reset(_stmt));
|
||||
SQLITE_DO(sqlite3_clear_bindings(_stmt));
|
||||
if (_stmt) {
|
||||
SQLITE_DO(sqlite3_reset(_stmt));
|
||||
SQLITE_DO(sqlite3_clear_bindings(_stmt));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
@@ -147,6 +147,7 @@ void ProgressInfo::reset()
|
||||
_maxBytesPerSecond = 100000.0;
|
||||
_maxFilesPerSecond = 2.0;
|
||||
_updateEstimatesTimer.stop();
|
||||
_lastCompletedItem = SyncFileItem();
|
||||
}
|
||||
|
||||
void ProgressInfo::startEstimateUpdates()
|
||||
|
||||
@@ -593,7 +593,7 @@ void PropagateDownloadFile::deleteExistingFolder()
|
||||
}
|
||||
|
||||
QString conflictDir = FileSystem::makeConflictFileName(
|
||||
existingDir, Utility::qDateTimeFromTime_t(_item->_modtime));
|
||||
existingDir, Utility::qDateTimeFromTime_t(FileSystem::getModTime(existingDir)));
|
||||
|
||||
emit _propagator->touchedFile(existingDir);
|
||||
emit _propagator->touchedFile(conflictDir);
|
||||
@@ -620,30 +620,47 @@ static QString makeRecallFileName(const QString &fn)
|
||||
return recallFileName;
|
||||
}
|
||||
|
||||
static void handleRecallFile(const QString &fn)
|
||||
void handleRecallFile(const QString& filePath, const QString& folderPath, SyncJournalDb& journal)
|
||||
{
|
||||
qDebug() << "handleRecallFile: " << fn;
|
||||
qDebug() << "handleRecallFile: " << filePath;
|
||||
|
||||
FileSystem::setFileHidden(fn, true);
|
||||
FileSystem::setFileHidden(filePath, true);
|
||||
|
||||
QFile file(fn);
|
||||
QFile file(filePath);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Could not open recall file" << file.errorString();
|
||||
return;
|
||||
}
|
||||
QFileInfo existingFile(fn);
|
||||
QDir thisDir = existingFile.dir();
|
||||
QFileInfo existingFile(filePath);
|
||||
QDir baseDir = existingFile.dir();
|
||||
|
||||
while (!file.atEnd()) {
|
||||
QByteArray line = file.readLine();
|
||||
line.chop(1); // remove trailing \n
|
||||
QString fpath = thisDir.filePath(line);
|
||||
QString rpath = makeRecallFileName(fpath);
|
||||
|
||||
qDebug() << "Copy recall file: " << fpath << " -> " << rpath;
|
||||
QString recalledFile = QDir::cleanPath(baseDir.filePath(line));
|
||||
if (!recalledFile.startsWith(folderPath) || !recalledFile.startsWith(baseDir.path())) {
|
||||
qDebug() << "Ignoring recall of " << recalledFile;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Path of the recalled file in the local folder
|
||||
QString localRecalledFile = recalledFile.mid(folderPath.size());
|
||||
|
||||
SyncJournalFileRecord record = journal.getFileRecord(localRecalledFile);
|
||||
if (!record.isValid()) {
|
||||
qDebug() << "No db entry for recall of" << localRecalledFile;
|
||||
continue;
|
||||
}
|
||||
|
||||
qDebug() << "Recalling" << localRecalledFile << "Checksum:" << record._contentChecksumType << record._contentChecksum;
|
||||
|
||||
QString targetPath = makeRecallFileName(recalledFile);
|
||||
|
||||
qDebug() << "Copy recall file: " << recalledFile << " -> " << targetPath;
|
||||
// Remove the target first, QFile::copy will not overwrite it.
|
||||
FileSystem::remove(rpath);
|
||||
QFile::copy(fpath, rpath);
|
||||
FileSystem::remove(targetPath);
|
||||
QFile::copy(recalledFile, targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -705,7 +722,8 @@ void PropagateDownloadFile::downloadFinished()
|
||||
&& !FileSystem::fileEquals(fn, _tmpFile.fileName());
|
||||
if (isConflict) {
|
||||
QString renameError;
|
||||
QString conflictFileName = FileSystem::makeConflictFileName(fn, Utility::qDateTimeFromTime_t(_item->_modtime));
|
||||
QString conflictFileName = FileSystem::makeConflictFileName(
|
||||
fn, Utility::qDateTimeFromTime_t(FileSystem::getModTime(fn)));
|
||||
if (!FileSystem::rename(fn, conflictFileName, &renameError)) {
|
||||
// If the rename fails, don't replace it.
|
||||
|
||||
@@ -800,8 +818,10 @@ void PropagateDownloadFile::downloadFinished()
|
||||
done(isConflict ? SyncFileItem::Conflict : SyncFileItem::Success);
|
||||
|
||||
// handle the special recall file
|
||||
if(_item->_file == QLatin1String(".sys.admin#recall#") || _item->_file.endsWith("/.sys.admin#recall#")) {
|
||||
handleRecallFile(fn);
|
||||
if(!_item->_remotePerm.contains("S")
|
||||
&& (_item->_file == QLatin1String(".sys.admin#recall#")
|
||||
|| _item->_file.endsWith("/.sys.admin#recall#"))) {
|
||||
handleRecallFile(fn, _propagator->_localDir, *_propagator->_journal);
|
||||
}
|
||||
|
||||
qint64 duration = _stopwatch.elapsed();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
*/
|
||||
|
||||
#include "propagateremotemove.h"
|
||||
#include "propagatorjobs.h"
|
||||
#include "owncloudpropagator_p.h"
|
||||
#include "account.h"
|
||||
#include "syncjournalfilerecord.h"
|
||||
@@ -175,10 +176,45 @@ void PropagateRemoteMove::finalize()
|
||||
done(SyncFileItem::FatalError, tr("Error writing metadata to the database"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_item->_isDirectory) {
|
||||
if (!adjustSelectiveSync(_propagator->_journal, _item->_file, _item->_renameTarget)) {
|
||||
done(SyncFileItem::FatalError, tr("Error writing metadata to the database"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_propagator->_journal->commit("Remote Rename");
|
||||
done(SyncFileItem::Success);
|
||||
}
|
||||
|
||||
bool PropagateRemoteMove::adjustSelectiveSync(SyncJournalDb *journal, const QString &from_, const QString &to_)
|
||||
{
|
||||
bool ok;
|
||||
// We only care about preserving the blacklist. The white list should anyway be empty.
|
||||
// And the undecided list will be repopulated on the next sync, if there is anything too big.
|
||||
QStringList list = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
bool changed = false;
|
||||
Q_ASSERT(!from_.endsWith(QLatin1String("/")));
|
||||
Q_ASSERT(!to_.endsWith(QLatin1String("/")));
|
||||
QString from = from_ + QLatin1String("/");
|
||||
QString to = to_ + QLatin1String("/");
|
||||
|
||||
for (auto it = list.begin(); it != list.end(); ++it) {
|
||||
if (it->startsWith(from)) {
|
||||
*it = it->replace(0, from.size(), to);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, list);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@ public:
|
||||
void start() Q_DECL_OVERRIDE;
|
||||
void abort() Q_DECL_OVERRIDE;
|
||||
JobParallelism parallelism() Q_DECL_OVERRIDE { return OCC::PropagatorJob::WaitForFinishedInParentDirectory; }
|
||||
|
||||
/**
|
||||
* Rename the directory in the selective sync list
|
||||
*/
|
||||
static bool adjustSelectiveSync(SyncJournalDb *journal, const QString &from, const QString &to);
|
||||
|
||||
private slots:
|
||||
void slotMoveJobFinished();
|
||||
void finalize();
|
||||
|
||||
@@ -195,6 +195,8 @@ public:
|
||||
: PropagateItemJob(propagator, item), _startChunk(0), _currentChunk(0), _chunkCount(0), _transferId(0), _finished(false), _deleteExisting(false) {}
|
||||
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
|
||||
* the upload.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "propagatorjobs.h"
|
||||
#include "owncloudpropagator_p.h"
|
||||
|
||||
#include "propagateremotemove.h"
|
||||
#include "utility.h"
|
||||
#include "syncjournaldb.h"
|
||||
#include "syncjournalfilerecord.h"
|
||||
@@ -231,6 +231,7 @@ void PropagateLocalRename::start()
|
||||
_propagator->_journal->deleteFileRecord(_item->_originalFile);
|
||||
|
||||
// store the rename file name in the item.
|
||||
const auto oldFile = _item->_file;
|
||||
_item->_file = _item->_renameTarget;
|
||||
|
||||
SyncJournalFileRecord record(*_item, targetFile);
|
||||
@@ -245,9 +246,14 @@ void PropagateLocalRename::start()
|
||||
done(SyncFileItem::FatalError, tr("Error writing metadata to the database"));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!PropagateRemoteMove::adjustSelectiveSync(_propagator->_journal, oldFile, _item->_renameTarget)) {
|
||||
done(SyncFileItem::FatalError, tr("Error writing metadata to the database"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
_propagator->_journal->commit("localRename");
|
||||
|
||||
_propagator->_journal->commit("localRename");
|
||||
|
||||
done(SyncFileItem::Success);
|
||||
}
|
||||
|
||||
@@ -334,6 +334,16 @@ int SyncEngine::treewalkRemote( TREE_WALK_FILE* file, void *data )
|
||||
return static_cast<SyncEngine*>(data)->treewalkFile( file, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* The main function in the post-reconcile phase.
|
||||
*
|
||||
* Called on each entry in the local and remote trees by
|
||||
* csync_walk_local_tree()/csync_walk_remote_tree().
|
||||
*
|
||||
* It merges the two csync rbtrees into a single map of SyncFileItems.
|
||||
*
|
||||
* See doc/dev/sync-algorithm.md for an overview.
|
||||
*/
|
||||
int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||
{
|
||||
if( ! file ) return -1;
|
||||
@@ -589,11 +599,15 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||
// This counts as a NONE for detecting if all the files on the server were changed
|
||||
_hasNoneFiles = true;
|
||||
} else if (!isDirectory) {
|
||||
if (std::difftime(file->modtime, file->other.modtime) < 0) {
|
||||
auto difftime = std::difftime(file->modtime, file->other.modtime);
|
||||
if (difftime < -3600*2) {
|
||||
// We are going back on time
|
||||
// We only increment if the difference is more than two hours to avoid clock skew
|
||||
// issues or DST changes. (We simply ignore files that goes in the past less than
|
||||
// two hours for the backup detection heuristics.)
|
||||
_backInTimeFiles++;
|
||||
qDebug() << file->path << "has a timestamp earlier than the local file";
|
||||
} else {
|
||||
} else if (difftime > 0) {
|
||||
_hasForwardInTimeFiles = true;
|
||||
}
|
||||
}
|
||||
@@ -928,7 +942,10 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult)
|
||||
&& _discoveryMainThread->_dataFingerprint != databaseFingerprint) {
|
||||
qDebug() << "data fingerprint changed, assume restore from backup" << databaseFingerprint << _discoveryMainThread->_dataFingerprint;
|
||||
restoreOldFiles();
|
||||
} else if (!_hasForwardInTimeFiles && _backInTimeFiles >= 2) {
|
||||
} else if (!_hasForwardInTimeFiles && _backInTimeFiles >= 2 && _account->serverVersionInt() < 0x090100) {
|
||||
// The server before ownCloud 9.1 did not have the data-fingerprint property. So in that
|
||||
// case we use heuristics to detect restored backup. This is disabled with newer version
|
||||
// because this causes troubles to the user and is not as reliable as the data-fingerprint.
|
||||
qDebug() << "All the changes are bringing files in the past, asking the user";
|
||||
// this typically happen when a backup is restored on the server
|
||||
bool restore = false;
|
||||
@@ -1163,7 +1180,7 @@ void SyncEngine::checkForPermission()
|
||||
qDebug() << "Moving of " << (*it)->_file << " canceled because no permission to add parent folder";
|
||||
}
|
||||
(*it)->_instruction = CSYNC_INSTRUCTION_ERROR;
|
||||
(*it)->_status = SyncFileItem::NormalError;
|
||||
(*it)->_status = SyncFileItem::SoftError;
|
||||
(*it)->_errorString = tr("Not allowed because you don't have permission to add parent folder");
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,6 @@ private:
|
||||
SyncJournalDb *_journal;
|
||||
QPointer<DiscoveryMainThread> _discoveryMainThread;
|
||||
QSharedPointer <OwncloudPropagator> _propagator;
|
||||
QString _lastDeleted; // if the last item was a path and it has been deleted
|
||||
|
||||
// After a sync, only the syncdb entries whose filenames appear in this
|
||||
// set will be kept. See _temporarilyUnavailablePaths.
|
||||
|
||||
@@ -318,7 +318,9 @@ bool SyncJournalDb::checkConnect()
|
||||
createQuery.bindValue(2, MIRALL_VERSION_MINOR);
|
||||
createQuery.bindValue(3, MIRALL_VERSION_PATCH);
|
||||
createQuery.bindValue(4, MIRALL_VERSION_BUILD);
|
||||
createQuery.exec();
|
||||
if (!createQuery.exec()) {
|
||||
return sqlFail("Update version", createQuery);
|
||||
}
|
||||
|
||||
} else {
|
||||
int major = versionQuery.intValue(0);
|
||||
@@ -329,6 +331,15 @@ bool SyncJournalDb::checkConnect()
|
||||
qDebug() << Q_FUNC_INFO << "possibleUpgradeFromMirall_1_8_0_or_1 detected!";
|
||||
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?
|
||||
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 "
|
||||
@@ -367,60 +378,84 @@ bool SyncJournalDb::checkConnect()
|
||||
}
|
||||
|
||||
_getFileRecordQuery.reset(new SqlQuery(_db));
|
||||
_getFileRecordQuery->prepare(
|
||||
if (_getFileRecordQuery->prepare(
|
||||
"SELECT path, inode, uid, gid, mode, modtime, type, md5, fileid, remotePerm, filesize,"
|
||||
" ignoredChildrenRemote, contentChecksum, contentchecksumtype.name"
|
||||
" FROM metadata"
|
||||
" LEFT JOIN checksumtype as contentchecksumtype ON metadata.contentChecksumTypeId == contentchecksumtype.id"
|
||||
" WHERE phash=?1" );
|
||||
" WHERE phash=?1" )) {
|
||||
return sqlFail("prepare _getFileRecordQuery", *_getFileRecordQuery);
|
||||
}
|
||||
|
||||
_setFileRecordQuery.reset(new SqlQuery(_db) );
|
||||
_setFileRecordQuery->prepare("INSERT OR REPLACE INTO metadata "
|
||||
if (_setFileRecordQuery->prepare("INSERT OR REPLACE INTO metadata "
|
||||
"(phash, pathlen, path, inode, uid, gid, mode, modtime, type, md5, fileid, remotePerm, filesize, ignoredChildrenRemote, contentChecksum, contentChecksumTypeId) "
|
||||
"VALUES (?1 , ?2, ?3 , ?4 , ?5 , ?6 , ?7, ?8 , ?9 , ?10, ?11, ?12, ?13, ?14, ?15, ?16);" );
|
||||
"VALUES (?1 , ?2, ?3 , ?4 , ?5 , ?6 , ?7, ?8 , ?9 , ?10, ?11, ?12, ?13, ?14, ?15, ?16);" )) {
|
||||
return sqlFail("prepare _setFileRecordQuery", *_setFileRecordQuery);
|
||||
}
|
||||
|
||||
_setFileRecordChecksumQuery.reset(new SqlQuery(_db) );
|
||||
_setFileRecordChecksumQuery->prepare(
|
||||
if (_setFileRecordChecksumQuery->prepare(
|
||||
"UPDATE metadata"
|
||||
" SET contentChecksum = ?2, contentChecksumTypeId = ?3"
|
||||
" WHERE phash == ?1;");
|
||||
" WHERE phash == ?1;")) {
|
||||
return sqlFail("prepare _setFileRecordChecksumQuery", *_setFileRecordChecksumQuery);
|
||||
}
|
||||
|
||||
_setFileRecordLocalMetadataQuery.reset(new SqlQuery(_db));
|
||||
_setFileRecordLocalMetadataQuery->prepare(
|
||||
if (_setFileRecordLocalMetadataQuery->prepare(
|
||||
"UPDATE metadata"
|
||||
" SET inode=?2, modtime=?3, filesize=?4"
|
||||
" WHERE phash == ?1;");
|
||||
" WHERE phash == ?1;")) {
|
||||
return sqlFail("prepare _setFileRecordLocalMetadataQuery", *_setFileRecordLocalMetadataQuery);
|
||||
}
|
||||
|
||||
_getDownloadInfoQuery.reset(new SqlQuery(_db) );
|
||||
_getDownloadInfoQuery->prepare( "SELECT tmpfile, etag, errorcount FROM "
|
||||
"downloadinfo WHERE path=?1" );
|
||||
if (_getDownloadInfoQuery->prepare( "SELECT tmpfile, etag, errorcount FROM "
|
||||
"downloadinfo WHERE path=?1" )) {
|
||||
return sqlFail("prepare _getDownloadInfoQuery", *_getDownloadInfoQuery);
|
||||
}
|
||||
|
||||
_setDownloadInfoQuery.reset(new SqlQuery(_db) );
|
||||
_setDownloadInfoQuery->prepare( "INSERT OR REPLACE INTO downloadinfo "
|
||||
if (_setDownloadInfoQuery->prepare( "INSERT OR REPLACE INTO downloadinfo "
|
||||
"(path, tmpfile, etag, errorcount) "
|
||||
"VALUES ( ?1 , ?2, ?3, ?4 )" );
|
||||
"VALUES ( ?1 , ?2, ?3, ?4 )" )) {
|
||||
return sqlFail("prepare _setDownloadInfoQuery", *_setDownloadInfoQuery);
|
||||
}
|
||||
|
||||
_deleteDownloadInfoQuery.reset(new SqlQuery(_db) );
|
||||
_deleteDownloadInfoQuery->prepare( "DELETE FROM downloadinfo WHERE path=?1" );
|
||||
if (_deleteDownloadInfoQuery->prepare( "DELETE FROM downloadinfo WHERE path=?1" )) {
|
||||
return sqlFail("prepare _deleteDownloadInfoQuery", *_deleteDownloadInfoQuery);
|
||||
}
|
||||
|
||||
_getUploadInfoQuery.reset(new SqlQuery(_db));
|
||||
_getUploadInfoQuery->prepare( "SELECT chunk, transferid, errorcount, size, modtime FROM "
|
||||
"uploadinfo WHERE path=?1" );
|
||||
if (_getUploadInfoQuery->prepare( "SELECT chunk, transferid, errorcount, size, modtime FROM "
|
||||
"uploadinfo WHERE path=?1" )) {
|
||||
return sqlFail("prepare _getUploadInfoQuery", *_getUploadInfoQuery);
|
||||
}
|
||||
|
||||
_setUploadInfoQuery.reset(new SqlQuery(_db));
|
||||
_setUploadInfoQuery->prepare( "INSERT OR REPLACE INTO uploadinfo "
|
||||
if (_setUploadInfoQuery->prepare( "INSERT OR REPLACE INTO uploadinfo "
|
||||
"(path, chunk, transferid, errorcount, size, modtime) "
|
||||
"VALUES ( ?1 , ?2, ?3 , ?4 , ?5, ?6 )");
|
||||
"VALUES ( ?1 , ?2, ?3 , ?4 , ?5, ?6 )")) {
|
||||
return sqlFail("prepare _setUploadInfoQuery", *_setUploadInfoQuery);
|
||||
}
|
||||
|
||||
_deleteUploadInfoQuery.reset(new SqlQuery(_db));
|
||||
_deleteUploadInfoQuery->prepare("DELETE FROM uploadinfo WHERE path=?1" );
|
||||
if (_deleteUploadInfoQuery->prepare("DELETE FROM uploadinfo WHERE path=?1" )) {
|
||||
return sqlFail("prepare _deleteUploadInfoQuery", *_deleteUploadInfoQuery);
|
||||
}
|
||||
|
||||
|
||||
_deleteFileRecordPhash.reset(new SqlQuery(_db));
|
||||
_deleteFileRecordPhash->prepare("DELETE FROM metadata WHERE phash=?1");
|
||||
if (_deleteFileRecordPhash->prepare("DELETE FROM metadata WHERE phash=?1")) {
|
||||
return sqlFail("prepare _deleteFileRecordPhash", *_deleteFileRecordPhash);
|
||||
}
|
||||
|
||||
_deleteFileRecordRecursively.reset(new SqlQuery(_db));
|
||||
_deleteFileRecordRecursively->prepare("DELETE FROM metadata WHERE path LIKE(?||'/%')");
|
||||
if (_deleteFileRecordRecursively->prepare("DELETE FROM metadata WHERE path LIKE(?||'/%')")) {
|
||||
return sqlFail("prepare _deleteFileRecordRecursively", *_deleteFileRecordRecursively);
|
||||
}
|
||||
|
||||
QString sql( "SELECT lastTryEtag, lastTryModtime, retrycount, errorstring, lastTryTime, ignoreDuration, renameTarget "
|
||||
"FROM blacklist WHERE path=?1");
|
||||
@@ -430,32 +465,50 @@ bool SyncJournalDb::checkConnect()
|
||||
sql += QLatin1String(" COLLATE NOCASE");
|
||||
}
|
||||
_getErrorBlacklistQuery.reset(new SqlQuery(_db));
|
||||
_getErrorBlacklistQuery->prepare(sql);
|
||||
if (_getErrorBlacklistQuery->prepare(sql)) {
|
||||
return sqlFail("prepare _getErrorBlacklistQuery", *_getErrorBlacklistQuery);
|
||||
}
|
||||
|
||||
_setErrorBlacklistQuery.reset(new SqlQuery(_db));
|
||||
_setErrorBlacklistQuery->prepare("INSERT OR REPLACE INTO blacklist "
|
||||
if (_setErrorBlacklistQuery->prepare("INSERT OR REPLACE INTO blacklist "
|
||||
"(path, lastTryEtag, lastTryModtime, retrycount, errorstring, lastTryTime, ignoreDuration, renameTarget) "
|
||||
"VALUES ( ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)");
|
||||
"VALUES ( ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)")) {
|
||||
return sqlFail("prepare _setErrorBlacklistQuery", *_setErrorBlacklistQuery);
|
||||
}
|
||||
|
||||
_getSelectiveSyncListQuery.reset(new SqlQuery(_db));
|
||||
_getSelectiveSyncListQuery->prepare("SELECT path FROM selectivesync WHERE type=?1");
|
||||
if (_getSelectiveSyncListQuery->prepare("SELECT path FROM selectivesync WHERE type=?1")) {
|
||||
return sqlFail("prepare _getSelectiveSyncListQuery", *_getSelectiveSyncListQuery);
|
||||
}
|
||||
|
||||
_getChecksumTypeIdQuery.reset(new SqlQuery(_db));
|
||||
_getChecksumTypeIdQuery->prepare("SELECT id FROM checksumtype WHERE name=?1");
|
||||
if (_getChecksumTypeIdQuery->prepare("SELECT id FROM checksumtype WHERE name=?1")) {
|
||||
return sqlFail("prepare _getChecksumTypeIdQuery", *_getChecksumTypeIdQuery);
|
||||
}
|
||||
|
||||
_getChecksumTypeQuery.reset(new SqlQuery(_db));
|
||||
_getChecksumTypeQuery->prepare("SELECT name FROM checksumtype WHERE id=?1");
|
||||
if (_getChecksumTypeQuery->prepare("SELECT name FROM checksumtype WHERE id=?1")) {
|
||||
return sqlFail("prepare _getChecksumTypeQuery", *_getChecksumTypeQuery);
|
||||
}
|
||||
|
||||
_insertChecksumTypeQuery.reset(new SqlQuery(_db));
|
||||
_insertChecksumTypeQuery->prepare("INSERT OR IGNORE INTO checksumtype (name) VALUES (?1)");
|
||||
if (_insertChecksumTypeQuery->prepare("INSERT OR IGNORE INTO checksumtype (name) VALUES (?1)")) {
|
||||
return sqlFail("prepare _insertChecksumTypeQuery", *_insertChecksumTypeQuery);
|
||||
}
|
||||
|
||||
_getDataFingerprintQuery.reset(new SqlQuery(_db));
|
||||
_getDataFingerprintQuery->prepare("SELECT fingerprint FROM datafingerprint");
|
||||
if (_getDataFingerprintQuery->prepare("SELECT fingerprint FROM datafingerprint")) {
|
||||
return sqlFail("prepare _getDataFingerprintQuery", *_getDataFingerprintQuery);
|
||||
}
|
||||
|
||||
_setDataFingerprintQuery1.reset(new SqlQuery(_db));
|
||||
_setDataFingerprintQuery1->prepare("DELETE FROM datafingerprint;");
|
||||
if (_setDataFingerprintQuery1->prepare("DELETE FROM datafingerprint;")) {
|
||||
return sqlFail("prepare _setDataFingerprintQuery1", *_setDataFingerprintQuery1);
|
||||
}
|
||||
_setDataFingerprintQuery2.reset(new SqlQuery(_db));
|
||||
_setDataFingerprintQuery2->prepare("INSERT INTO datafingerprint (fingerprint) VALUES (?1);");
|
||||
if (_setDataFingerprintQuery2->prepare("INSERT INTO datafingerprint (fingerprint) VALUES (?1);")) {
|
||||
return sqlFail("prepare _setDataFingerprintQuery2", *_setDataFingerprintQuery2);
|
||||
}
|
||||
|
||||
// don't start a new transaction now
|
||||
commitInternal(QString("checkConnect End"), false);
|
||||
|
||||
+22
-7
@@ -115,11 +115,11 @@ QIcon Theme::trayFolderIcon( const QString& backend ) const
|
||||
* helper to load a icon from either the icon theme the desktop provides or from
|
||||
* the apps Qt resources.
|
||||
*/
|
||||
QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
|
||||
QIcon Theme::themeIcon( const QString& name, bool sysTray, bool sysTrayMenuVisible ) const
|
||||
{
|
||||
QString flavor;
|
||||
if (sysTray) {
|
||||
flavor = systrayIconFlavor(_mono);
|
||||
flavor = systrayIconFlavor(_mono, sysTrayMenuVisible);
|
||||
} else {
|
||||
flavor = QLatin1String("colored");
|
||||
}
|
||||
@@ -158,6 +158,14 @@ QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
// This defines the icon as a template and enables automatic macOS color handling
|
||||
// See https://bugreports.qt.io/browse/QTBUG-42109
|
||||
cached.setIsMask(_mono && sysTray && !sysTrayMenuVisible);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return cached;
|
||||
}
|
||||
|
||||
@@ -227,11 +235,18 @@ QString Theme::defaultClientFolder() const
|
||||
return appName();
|
||||
}
|
||||
|
||||
QString Theme::systrayIconFlavor(bool mono) const
|
||||
QString Theme::systrayIconFlavor(bool mono, bool sysTrayMenuVisible ) const
|
||||
{
|
||||
Q_UNUSED(sysTrayMenuVisible)
|
||||
QString flavor;
|
||||
if (mono) {
|
||||
flavor = Utility::hasDarkSystray() ? QLatin1String("white") : QLatin1String("black");
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
if (sysTrayMenuVisible) {
|
||||
flavor = QLatin1String("white");
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
flavor = QLatin1String("colored");
|
||||
}
|
||||
@@ -331,7 +346,7 @@ QVariant Theme::customMedia( CustomMediaType type )
|
||||
return re;
|
||||
}
|
||||
|
||||
QIcon Theme::syncStateIcon( SyncResult::Status status, bool sysTray ) const
|
||||
QIcon Theme::syncStateIcon( SyncResult::Status status, bool sysTray, bool sysTrayMenuVisible ) const
|
||||
{
|
||||
// FIXME: Mind the size!
|
||||
QString statusIcon;
|
||||
@@ -363,7 +378,7 @@ QIcon Theme::syncStateIcon( SyncResult::Status status, bool sysTray ) const
|
||||
statusIcon = QLatin1String("state-error");
|
||||
}
|
||||
|
||||
return themeIcon( statusIcon, sysTray );
|
||||
return themeIcon( statusIcon, sysTray, sysTrayMenuVisible );
|
||||
}
|
||||
|
||||
QIcon Theme::folderDisabledIcon( ) const
|
||||
@@ -371,9 +386,9 @@ QIcon Theme::folderDisabledIcon( ) const
|
||||
return themeIcon( QLatin1String("state-pause") );
|
||||
}
|
||||
|
||||
QIcon Theme::folderOfflineIcon(bool systray) const
|
||||
QIcon Theme::folderOfflineIcon(bool sysTray, bool sysTrayMenuVisible ) const
|
||||
{
|
||||
return themeIcon( QLatin1String("state-offline"), systray );
|
||||
return themeIcon( QLatin1String("state-offline"), sysTray, sysTrayMenuVisible );
|
||||
}
|
||||
|
||||
QColor Theme::wizardHeaderTitleColor() const
|
||||
|
||||
@@ -97,10 +97,10 @@ public:
|
||||
/**
|
||||
* get an sync state icon
|
||||
*/
|
||||
virtual QIcon syncStateIcon( SyncResult::Status, bool sysTray = false ) const;
|
||||
virtual QIcon syncStateIcon( SyncResult::Status, bool sysTray = false, bool sysTrayMenuVisible = false) const;
|
||||
|
||||
virtual QIcon folderDisabledIcon() const;
|
||||
virtual QIcon folderOfflineIcon(bool systray = false) const;
|
||||
virtual QIcon folderOfflineIcon(bool sysTray = false, bool sysTrayMenuVisible = false) const;
|
||||
virtual QIcon applicationIcon() const = 0;
|
||||
#endif
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
virtual QString enforcedLocale() const { return QString::null; }
|
||||
|
||||
/** colored, white or black */
|
||||
QString systrayIconFlavor(bool mono) const;
|
||||
QString systrayIconFlavor(bool mono, bool sysTrayMenuVisible = false) const;
|
||||
|
||||
#ifndef TOKEN_AUTH_ONLY
|
||||
/**
|
||||
@@ -304,7 +304,7 @@ public:
|
||||
|
||||
protected:
|
||||
#ifndef TOKEN_AUTH_ONLY
|
||||
QIcon themeIcon(const QString& name, bool sysTray = false) const;
|
||||
QIcon themeIcon(const QString& name, bool sysTray = false, bool sysTrayMenuVisible = false) const;
|
||||
#endif
|
||||
Theme();
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "utility.h"
|
||||
|
||||
#include "version.h"
|
||||
#include "configfile.h"
|
||||
|
||||
// Note: This file must compile without QtGui
|
||||
#include <QCoreApplication>
|
||||
@@ -586,4 +587,41 @@ void Utility::sortFilenames(QStringList& fileNames)
|
||||
#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
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
#include <QDateTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QMap>
|
||||
#include <QUrl>
|
||||
#include <memory>
|
||||
|
||||
class QSettings;
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@@ -142,6 +146,14 @@ namespace Utility
|
||||
*/
|
||||
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
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@ ENDIF()
|
||||
|
||||
owncloud_add_test(FolderWatcher "${FolderWatcher_SRC}")
|
||||
if( UNIX AND NOT APPLE )
|
||||
if(HAVE_QT5 AND NOT BUILD_WITH_QT4)
|
||||
owncloud_add_test(InotifyWatcher "${FolderWatcher_SRC}")
|
||||
endif(HAVE_QT5 AND NOT BUILD_WITH_QT4)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
owncloud_add_test(CSyncSqlite "")
|
||||
|
||||
@@ -28,6 +28,7 @@ inline QByteArray generateFileId() {
|
||||
|
||||
class PathComponents : public QStringList {
|
||||
public:
|
||||
PathComponents(const char *path) : PathComponents{QString::fromUtf8(path)} {}
|
||||
PathComponents(const QString &path) : QStringList{path.split('/', QString::SkipEmptyParts)} { }
|
||||
PathComponents(const QStringList &pathComponents) : QStringList{pathComponents} { }
|
||||
|
||||
@@ -90,8 +91,9 @@ public:
|
||||
void mkdir(const QString &relativePath) override {
|
||||
_rootDir.mkpath(relativePath);
|
||||
}
|
||||
void rename(const QString &, const QString &) override {
|
||||
Q_ASSERT(!"not implemented");
|
||||
void rename(const QString &from, const QString &to) override {
|
||||
QVERIFY(_rootDir.exists(from));
|
||||
QVERIFY(_rootDir.rename(from, to));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -457,6 +459,36 @@ public:
|
||||
qint64 readData(char *, qint64) override { return 0; }
|
||||
};
|
||||
|
||||
class FakeMoveReply : public QNetworkReply
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FakeMoveReply(FileInfo &remoteRootFileInfo, QNetworkAccessManager::Operation op, const QNetworkRequest &request, QObject *parent)
|
||||
: QNetworkReply{parent} {
|
||||
setRequest(request);
|
||||
setUrl(request.url());
|
||||
setOperation(op);
|
||||
open(QIODevice::ReadOnly);
|
||||
|
||||
Q_ASSERT(request.url().path().startsWith(sRootUrl.path()));
|
||||
QString fileName = request.url().path().mid(sRootUrl.path().length());
|
||||
QString destPath = request.rawHeader("Destination");
|
||||
Q_ASSERT(destPath.startsWith(sRootUrl.path()));
|
||||
QString dest = destPath.mid(sRootUrl.path().length());
|
||||
remoteRootFileInfo.rename(fileName, dest);
|
||||
QMetaObject::invokeMethod(this, "respond", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
Q_INVOKABLE void respond() {
|
||||
setAttribute(QNetworkRequest::HttpStatusCodeAttribute, 201);
|
||||
emit metaDataChanged();
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void abort() override { }
|
||||
qint64 readData(char *, qint64) override { return 0; }
|
||||
};
|
||||
|
||||
class FakeGetReply : public QNetworkReply
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -552,6 +584,8 @@ protected:
|
||||
return new FakeMkcolReply{_remoteRootFileInfo, op, request, this};
|
||||
else if (verb == QLatin1String("DELETE"))
|
||||
return new FakeDeleteReply{_remoteRootFileInfo, op, request, this};
|
||||
else if (verb == QLatin1String("MOVE"))
|
||||
return new FakeMoveReply{_remoteRootFileInfo, op, request, this};
|
||||
else {
|
||||
qDebug() << verb << outgoingData;
|
||||
Q_UNREACHABLE();
|
||||
@@ -564,7 +598,6 @@ class FakeCredentials : public OCC::AbstractCredentials
|
||||
QNetworkAccessManager *_qnam;
|
||||
public:
|
||||
FakeCredentials(QNetworkAccessManager *qnam) : _qnam{qnam} { }
|
||||
virtual bool changed(AbstractCredentials *) const { return false; }
|
||||
virtual QString authType() const { return "test"; }
|
||||
virtual QString user() const { return "admin"; }
|
||||
virtual QNetworkAccessManager* getQNAM() const { return _qnam; }
|
||||
|
||||
@@ -50,7 +50,7 @@ private slots:
|
||||
QFETCH(QueryItems, query);
|
||||
QFETCH(QString, expected);
|
||||
QUrl baseUrl("http://example.com" + base);
|
||||
QUrl resultUrl = Account::concatUrlPath(baseUrl, concat, query);
|
||||
QUrl resultUrl = Utility::concatUrlPath(baseUrl, concat, query);
|
||||
QString result = QString::fromUtf8(resultUrl.toEncoded());
|
||||
QString expectedFull = "http://example.com" + expected;
|
||||
QCOMPARE(result, expectedFull);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "folderman.h"
|
||||
#include "account.h"
|
||||
#include "accountstate.h"
|
||||
#include "configfile.h"
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
@@ -39,6 +40,7 @@ private slots:
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
QTemporaryDir dir;
|
||||
ConfigFile::setConfDir(dir.path()); // we don't want to pollute the user's config file
|
||||
QVERIFY(dir.isValid());
|
||||
QDir dir2(dir.path());
|
||||
QVERIFY(dir2.mkpath("sub/ownCloud1/folder/f"));
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <QtTest>
|
||||
#include "syncenginetestutils.h"
|
||||
#include <syncengine.h>
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
@@ -137,8 +138,8 @@ private slots:
|
||||
fakeFolder.syncOnce();
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
auto oldState = fakeFolder.currentLocalState();
|
||||
QVERIFY(oldState.find(PathComponents("folder/folderB/folderA/file.txt")));
|
||||
QVERIFY(!oldState.find(PathComponents("folder/folderA/file.txt")));
|
||||
QVERIFY(oldState.find("folder/folderB/folderA/file.txt"));
|
||||
QVERIFY(!oldState.find("folder/folderA/file.txt"));
|
||||
|
||||
// This sync should not remove the file
|
||||
fakeFolder.syncOnce();
|
||||
@@ -146,6 +147,72 @@ private slots:
|
||||
QCOMPARE(fakeFolder.currentLocalState(), oldState);
|
||||
|
||||
}
|
||||
|
||||
void testSelectiveSyncModevFolder() {
|
||||
// issue #5224
|
||||
FakeFolder fakeFolder{FileInfo{ QString(), {
|
||||
FileInfo { QStringLiteral("parentFolder"), {
|
||||
FileInfo{ QStringLiteral("subFolderA"), { { QStringLiteral("fileA.txt"), 400 } } },
|
||||
FileInfo{ QStringLiteral("subFolderB"), { { QStringLiteral("fileB.txt"), 400 } } }
|
||||
}
|
||||
}}}};
|
||||
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
auto expectedServerState = fakeFolder.currentRemoteState();
|
||||
|
||||
// Remove subFolderA with selectiveSync:
|
||||
fakeFolder.syncEngine().journal()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
|
||||
{"parentFolder/subFolderA/"});
|
||||
fakeFolder.syncEngine().journal()->avoidReadFromDbOnNextSync("parentFolder/subFolderA/");
|
||||
|
||||
fakeFolder.syncOnce();
|
||||
|
||||
{
|
||||
// Nothing changed on the server
|
||||
QCOMPARE(fakeFolder.currentRemoteState(), expectedServerState);
|
||||
// The local state should not have subFolderA
|
||||
auto remoteState = fakeFolder.currentRemoteState();
|
||||
remoteState.remove("parentFolder/subFolderA");
|
||||
QCOMPARE(fakeFolder.currentLocalState(), remoteState);
|
||||
}
|
||||
|
||||
// Rename parentFolder on the server
|
||||
fakeFolder.remoteModifier().rename("parentFolder", "parentFolderRenamed");
|
||||
expectedServerState = fakeFolder.currentRemoteState();
|
||||
fakeFolder.syncOnce();
|
||||
|
||||
{
|
||||
QCOMPARE(fakeFolder.currentRemoteState(), expectedServerState);
|
||||
auto remoteState = fakeFolder.currentRemoteState();
|
||||
// The subFolderA should still be there on the server.
|
||||
QVERIFY(remoteState.find("parentFolderRenamed/subFolderA/fileA.txt"));
|
||||
// But not on the client because of the selective sync
|
||||
remoteState.remove("parentFolderRenamed/subFolderA");
|
||||
QCOMPARE(fakeFolder.currentLocalState(), remoteState);
|
||||
}
|
||||
|
||||
// Rename it again, locally this time.
|
||||
fakeFolder.localModifier().rename("parentFolderRenamed", "parentThirdName");
|
||||
fakeFolder.syncOnce();
|
||||
|
||||
{
|
||||
auto remoteState = fakeFolder.currentRemoteState();
|
||||
// The subFolderA should still be there on the server.
|
||||
QVERIFY(remoteState.find("parentThirdName/subFolderA/fileA.txt"));
|
||||
// But not on the client because of the selective sync
|
||||
remoteState.remove("parentThirdName/subFolderA");
|
||||
QCOMPARE(fakeFolder.currentLocalState(), remoteState);
|
||||
|
||||
expectedServerState = fakeFolder.currentRemoteState();
|
||||
QSignalSpy completeSpy(&fakeFolder.syncEngine(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)));
|
||||
fakeFolder.syncOnce(); // This sync should do nothing
|
||||
QCOMPARE(completeSpy.count(), 0);
|
||||
|
||||
QCOMPARE(fakeFolder.currentRemoteState(), expectedServerState);
|
||||
QCOMPARE(fakeFolder.currentLocalState(), remoteState);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
QTEST_GUILESS_MAIN(TestSyncEngine)
|
||||
|
||||
@@ -80,7 +80,7 @@ private slots:
|
||||
quint64 sec = 1000;
|
||||
quint64 hour = 3600 * sec;
|
||||
|
||||
QDateTime current = QDateTime::currentDateTime();
|
||||
QDateTime current = QDateTime::currentDateTimeUtc();
|
||||
|
||||
QCOMPARE(durationToDescriptiveString2(0), QString("0 second(s)") );
|
||||
QCOMPARE(durationToDescriptiveString2(5), QString("0 second(s)") );
|
||||
|
||||
+436
-388
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+419
-371
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+419
-371
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+452
-404
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais
Referência em uma Nova Issue
Bloquear um usuário