Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
Markus Goetz c69cd514b8 Folder/Watcher: Fix up #5174 #5153
It was surprising to have a broken symlink return empty for
canonical path.
2016-09-15 12:39:37 +02:00
299 arquivos alterados com 20056 adições e 27500 exclusões
+1 -8
Ver Arquivo
@@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 2.6)
cmake_policy(VERSION 2.8.0)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif()
project(client)
@@ -60,7 +57,7 @@ endif()
include(GNUInstallDirs)
include(DefineInstallationPaths)
include(GenerateExportHeader)
include(GetGitRevisionDescription)
@@ -169,9 +166,6 @@ find_package(SQLite3 3.8.0 REQUIRED)
# On some OS, we want to use our own, not the system sqlite
if (USE_OUR_OWN_SQLITE3)
include_directories(BEFORE ${SQLITE3_INCLUDE_DIR})
if (WIN32)
add_definitions(-DSQLITE_API=__declspec\(dllimport\))
endif()
endif()
find_package(ZLIB)
@@ -186,7 +180,6 @@ add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
if( WIN32 )
add_definitions( -D__USE_MINGW_ANSI_STDIO=1 )
add_definitions( -DNOMINMAX )
endif( WIN32 )
# Handle Translations, pick all client_* files from trans directory.
-9
Ver Arquivo
@@ -1,15 +1,6 @@
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
Ver Arquivo
@@ -27,7 +27,7 @@ https://github.com/owncloud/client.
## Building the source code
[Building the Client](http://doc.owncloud.org/desktop/2.2/building.html)
[Building the Client](http://doc.owncloud.org/desktop/2.0/building.html)
in the ownCloud Desktop Client manual.
## Maintainers and Contributors
+1 -2
Ver Arquivo
@@ -5,8 +5,7 @@
#
# ownCloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# the Free Software Foundation; version 2 of the License.
#
# ownCLoud is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
+2 -2
Ver Arquivo
@@ -9,7 +9,6 @@ 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}"
@@ -38,6 +37,7 @@ 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 -1
Ver Arquivo
@@ -1,5 +1,5 @@
# Auto-generated - do not modify
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Toon opmerkingen bij deze versie"
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Toon opmerkingen bij deze uitgave"
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!"
+1 -1
Ver Arquivo
@@ -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 o processo para terminar!"
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Não foi encontrado nenhum 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"
+1 -1
Ver Arquivo
@@ -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 a finalizar no encontrado!"
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "¡Proceso para finalizar no encontrado!"
StrCpy $PageReinstall_NEW_Field_1 "Una versión anterior de ${APPLICATION_NAME} se encuentra instalada en el sistema. Se recomienda de instalar la versión actual antes de instalar la nueva. Seleccione la operacion deseada y haga click en Siguiente para continuar."
StrCpy $PageReinstall_NEW_Field_2 "Desinstalar antes de instalar"
StrCpy $PageReinstall_NEW_Field_3 "No desinstalar"
+1 -1
Ver Arquivo
@@ -32,7 +32,7 @@ find_library(CMOCKA_LIBRARY
NAMES
cmocka
PATHS
${CMOCKA_ROOT_DIR}/lib
${CMOCKA_ROOT_DIR}/include
)
if (CMOCKA_LIBRARY)
+15 -17
Ver Arquivo
@@ -2,23 +2,21 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-long-long")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-long-long")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
if(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
else(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
else()
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
if(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
else(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif()
endif(GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif(CMAKE_COMPILER_IS_GNUCXX)
if(DEFINED MIRALL_FATAL_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif(DEFINED MIRALL_FATAL_WARNINGS)
endif()
if(DEFINED MIRALL_FATAL_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif(DEFINED MIRALL_FATAL_WARNINGS)
-13
Ver Arquivo
@@ -81,13 +81,6 @@ set(csync_HDRS
# Statically include sqlite
if (USE_OUR_OWN_SQLITE3)
list(APPEND csync_SRCS ${SQLITE3_SOURCE})
if (WIN32)
# We want to export sqlite symbols from the ocsync DLL without
# having to patch both sqlite3.h and the amalgation sqlite3.c,
# so do the import/export magic manually through the build system.
remove_definitions(-DSQLITE_API=__declspec\(dllimport\))
add_definitions(-DSQLITE_API=__declspec\(dllexport\))
endif()
endif()
include_directories(
@@ -98,12 +91,6 @@ include_directories(
add_library(${CSYNC_LIBRARY} SHARED ${csync_SRCS})
#add_library(${CSYNC_LIBRARY}_static STATIC ${csync_SRCS})
generate_export_header( ${CSYNC_LIBRARY}
BASE_NAME ${CSYNC_LIBRARY}
EXPORT_MACRO_NAME OCSYNC_EXPORT
EXPORT_FILE_NAME ocsynclib.h
)
target_link_libraries(${CSYNC_LIBRARY} ${CSYNC_LINK_LIBRARIES})
#target_link_libraries(${CSYNC_LIBRARY}_static ${CSYNC_LINK_LIBRARIES})
+10 -2
Ver Arquivo
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <stdbool.h>
@@ -89,7 +90,7 @@ static int _data_cmp(const void *key, const void *data) {
return 0;
}
void csync_create(CSYNC **csync, const char *local) {
void csync_create(CSYNC **csync, const char *local, const char *remote) {
CSYNC *ctx;
size_t len = 0;
@@ -103,6 +104,12 @@ void csync_create(CSYNC **csync, const char *local) {
ctx->local.uri = c_strndup(local, len);
/* remove trailing slashes */
len = strlen(remote);
while(len > 0 && remote[len - 1] == '/') --len;
ctx->remote.uri = c_strndup(remote, len);
ctx->status_code = CSYNC_STATUS_OK;
ctx->current_fs = NULL;
@@ -193,7 +200,7 @@ int csync_update(CSYNC *ctx) {
ctx->current = REMOTE_REPLICA;
ctx->replica = ctx->remote.type;
rc = csync_ftw(ctx, "", csync_walker, MAX_DEPTH);
rc = csync_ftw(ctx, ctx->remote.uri, csync_walker, MAX_DEPTH);
if (rc < 0) {
if(ctx->status_code == CSYNC_STATUS_OK) {
ctx->status_code = csync_errno_to_status(errno, CSYNC_STATUS_UPDATE_ERROR);
@@ -573,6 +580,7 @@ int csync_destroy(CSYNC *ctx) {
_csync_clean_ctx(ctx);
SAFE_FREE(ctx->local.uri);
SAFE_FREE(ctx->remote.uri);
SAFE_FREE(ctx->error_string);
#ifdef WITH_ICONV
+32 -32
Ver Arquivo
@@ -33,10 +33,10 @@
#define _CSYNC_H
#include "std/c_private.h"
#include "ocsynclib.h"
#include <sys/stat.h>
#include <stdbool.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/types.h>
#include <config_csync.h>
@@ -229,14 +229,14 @@ struct csync_vio_file_stat_s {
char *original_name; // only set if locale conversion fails
};
csync_vio_file_stat_t OCSYNC_EXPORT *csync_vio_file_stat_new(void);
csync_vio_file_stat_t OCSYNC_EXPORT *csync_vio_file_stat_copy(csync_vio_file_stat_t *file_stat);
csync_vio_file_stat_t *csync_vio_file_stat_new(void);
csync_vio_file_stat_t *csync_vio_file_stat_copy(csync_vio_file_stat_t *file_stat);
void OCSYNC_EXPORT csync_vio_file_stat_destroy(csync_vio_file_stat_t *fstat);
void csync_vio_file_stat_destroy(csync_vio_file_stat_t *fstat);
void OCSYNC_EXPORT csync_vio_file_stat_set_file_id( csync_vio_file_stat_t* dst, const char* src );
void csync_vio_file_stat_set_file_id( csync_vio_file_stat_t* dst, const char* src );
void OCSYNC_EXPORT csync_vio_set_file_id(char* dst, const char *src );
void csync_vio_set_file_id(char* dst, const char *src );
/**
@@ -317,7 +317,7 @@ typedef const char* (*csync_checksum_hook) (
*
* @param csync The context variable to allocate.
*/
void OCSYNC_EXPORT csync_create(CSYNC **csync, const char *local);
void csync_create(CSYNC **csync, const char *local, const char *remote);
/**
* @brief Initialize the file synchronizer.
@@ -326,7 +326,7 @@ void OCSYNC_EXPORT csync_create(CSYNC **csync, const char *local);
*
* @param ctx The context to initialize.
*/
void OCSYNC_EXPORT csync_init(CSYNC *ctx);
void csync_init(CSYNC *ctx);
/**
* @brief Update detection
@@ -335,7 +335,7 @@ void OCSYNC_EXPORT csync_init(CSYNC *ctx);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_update(CSYNC *ctx);
int csync_update(CSYNC *ctx);
/**
* @brief Reconciliation
@@ -344,7 +344,7 @@ int OCSYNC_EXPORT csync_update(CSYNC *ctx);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_reconcile(CSYNC *ctx);
int csync_reconcile(CSYNC *ctx);
/**
* @brief Re-initializes the csync context
@@ -353,7 +353,7 @@ int OCSYNC_EXPORT csync_reconcile(CSYNC *ctx);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_commit(CSYNC *ctx);
int csync_commit(CSYNC *ctx);
/**
* @brief Destroy the csync context
@@ -364,7 +364,7 @@ int OCSYNC_EXPORT csync_commit(CSYNC *ctx);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_destroy(CSYNC *ctx);
int csync_destroy(CSYNC *ctx);
/**
* @brief Get the userdata saved in the context.
@@ -386,7 +386,7 @@ void *csync_get_userdata(CSYNC *ctx);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_set_userdata(CSYNC *ctx, void *userdata);
int csync_set_userdata(CSYNC *ctx, void *userdata);
/**
* @brief Get the authentication callback set.
@@ -396,7 +396,7 @@ int OCSYNC_EXPORT csync_set_userdata(CSYNC *ctx, void *userdata);
* @return The authentication callback set or NULL if an error
* occurred.
*/
csync_auth_callback OCSYNC_EXPORT csync_get_auth_callback(CSYNC *ctx);
csync_auth_callback csync_get_auth_callback(CSYNC *ctx);
/**
* @brief Set the authentication callback.
@@ -407,7 +407,7 @@ csync_auth_callback OCSYNC_EXPORT csync_get_auth_callback(CSYNC *ctx);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
/**
* @brief Set the log level.
@@ -416,14 +416,14 @@ int OCSYNC_EXPORT csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
*
* @return 0 on success, < 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_set_log_level(int level);
int csync_set_log_level(int level);
/**
* @brief Get the log verbosity
*
* @return The log verbosity, -1 on error.
*/
int OCSYNC_EXPORT csync_get_log_level(void);
int csync_get_log_level(void);
/**
* @brief Get the logging callback set.
@@ -431,7 +431,7 @@ int OCSYNC_EXPORT csync_get_log_level(void);
* @return The logging callback set or NULL if an error
* occurred.
*/
csync_log_callback OCSYNC_EXPORT csync_get_log_callback(void);
csync_log_callback csync_get_log_callback(void);
/**
* @brief Set the logging callback.
@@ -440,14 +440,14 @@ csync_log_callback OCSYNC_EXPORT csync_get_log_callback(void);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_set_log_callback(csync_log_callback cb);
int csync_set_log_callback(csync_log_callback cb);
/**
* @brief get the userdata set for the logging callback.
*
* @return The userdata or NULL.
*/
void OCSYNC_EXPORT *csync_get_log_userdata(void);
void *csync_get_log_userdata(void);
/**
* @brief Set the userdata passed to the logging callback.
@@ -456,13 +456,13 @@ void OCSYNC_EXPORT *csync_get_log_userdata(void);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_set_log_userdata(void *data);
int csync_set_log_userdata(void *data);
/* Used for special modes or debugging */
CSYNC_STATUS OCSYNC_EXPORT csync_get_status(CSYNC *ctx);
CSYNC_STATUS csync_get_status(CSYNC *ctx);
/* Used for special modes or debugging */
int OCSYNC_EXPORT csync_set_status(CSYNC *ctx, int status);
int csync_set_status(CSYNC *ctx, int status);
typedef int csync_treewalk_visit_func(TREE_WALK_FILE* ,void*);
@@ -475,7 +475,7 @@ typedef int csync_treewalk_visit_func(TREE_WALK_FILE* ,void*);
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
int csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
/**
* @brief Walk the remote file tree and call a visitor function for each file.
@@ -486,7 +486,7 @@ int OCSYNC_EXPORT csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *v
*
* @return 0 on success, less than 0 if an error occurred.
*/
int OCSYNC_EXPORT csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
int csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
/**
* @brief Get the csync status string.
@@ -495,7 +495,7 @@ int OCSYNC_EXPORT csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *
*
* @return A const pointer to a string with more precise status info.
*/
const char OCSYNC_EXPORT *csync_get_status_string(CSYNC *ctx);
const char *csync_get_status_string(CSYNC *ctx);
#ifdef WITH_ICONV
/**
@@ -505,7 +505,7 @@ const char OCSYNC_EXPORT *csync_get_status_string(CSYNC *ctx);
*
* @return 0 on success, or an iconv error number.
*/
int OCSYNC_EXPORT csync_set_iconv_codec(const char *from);
int csync_set_iconv_codec(const char *from);
#endif
/**
@@ -513,24 +513,24 @@ int OCSYNC_EXPORT csync_set_iconv_codec(const char *from);
*
* @param ctx The csync context.
*/
void OCSYNC_EXPORT csync_request_abort(CSYNC *ctx);
void csync_request_abort(CSYNC *ctx);
/**
* @brief Clears the abort flag. Can be called from another thread.
*
* @param ctx The csync context.
*/
void OCSYNC_EXPORT csync_resume(CSYNC *ctx);
void csync_resume(CSYNC *ctx);
/**
* @brief Checks for the abort flag, to be used from the modules.
*
* @param ctx The csync context.
*/
int OCSYNC_EXPORT csync_abort_requested(CSYNC *ctx);
int csync_abort_requested(CSYNC *ctx);
char OCSYNC_EXPORT *csync_normalize_etag(const char *);
time_t OCSYNC_EXPORT oc_httpdate_parse( const char *date );
char *csync_normalize_etag(const char *);
time_t oc_httpdate_parse( const char *date );
#ifdef __cplusplus
}
+1 -6
Ver Arquivo
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "c_lib.h"
#include "c_private.h"
@@ -36,12 +37,6 @@
#include "csync_exclude.h"
#include "csync_misc.h"
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#define CSYNC_LOG_CATEGORY_NAME "csync.exclude"
#include "csync_log.h"
+3 -5
Ver Arquivo
@@ -21,8 +21,6 @@
#ifndef _CSYNC_EXCLUDE_H
#define _CSYNC_EXCLUDE_H
#include "ocsynclib.h"
enum csync_exclude_type_e {
CSYNC_NOT_EXCLUDED = 0,
CSYNC_FILE_SILENTLY_EXCLUDED,
@@ -37,7 +35,7 @@ enum csync_exclude_type_e {
typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
#ifdef WITH_UNIT_TESTING
int OCSYNC_EXPORT _csync_exclude_add(c_strlist_t **inList, const char *string);
int _csync_exclude_add(c_strlist_t **inList, const char *string);
#endif
/**
@@ -48,7 +46,7 @@ int OCSYNC_EXPORT _csync_exclude_add(c_strlist_t **inList, const char *string);
*
* @return 0 on success, -1 if an error occurred with errno set.
*/
int OCSYNC_EXPORT csync_exclude_load(const char *fname, c_strlist_t **list);
int csync_exclude_load(const char *fname, c_strlist_t **list);
/**
* @brief Check if the given path should be excluded in a traversal situation.
@@ -74,7 +72,7 @@ CSYNC_EXCLUDE_TYPE csync_excluded_traversal(c_strlist_t *excludes, const char *p
* @param filetype
* @return
*/
CSYNC_EXCLUDE_TYPE OCSYNC_EXPORT csync_excluded_no_ctx(c_strlist_t *excludes, const char *path, int filetype);
CSYNC_EXCLUDE_TYPE csync_excluded_no_ctx(c_strlist_t *excludes, const char *path, int filetype);
#endif /* _CSYNC_EXCLUDE_H */
/**
+42 -1
Ver Arquivo
@@ -23,6 +23,12 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#ifndef _WIN32
#include <sys/time.h>
#else
#include <sys/utime.h>
#endif
#include <time.h>
#include "csync_private.h"
#include "csync_log.h"
@@ -31,11 +37,46 @@ CSYNC_THREAD int csync_log_level;
CSYNC_THREAD csync_log_callback csync_log_cb;
CSYNC_THREAD void *csync_log_userdata;
static int current_timestring(int hires, char *buf, size_t len)
{
char tbuf[64];
struct timeval tv;
struct tm *tm;
time_t t;
gettimeofday(&tv, NULL);
t = (time_t) tv.tv_sec;
tm = localtime(&t);
if (tm == NULL) {
return -1;
}
if (hires) {
strftime(tbuf, sizeof(tbuf) - 1, "%Y/%m/%d %H:%M:%S", tm);
snprintf(buf, len, "%s.%06ld", tbuf, (long) tv.tv_usec);
} else {
strftime(tbuf, sizeof(tbuf) - 1, "%Y/%m/%d %H:%M:%S", tm);
snprintf(buf, len, "%s", tbuf);
}
return 0;
}
static void csync_log_stderr(int verbosity,
const char *function,
const char *buffer)
{
fprintf(stderr, "[%d] %s", verbosity, function);
char date[64] = {0};
int rc;
rc = current_timestring(1, date, sizeof(date));
if (rc == 0) {
fprintf(stderr, "[%s, %d] %s:", date+5, verbosity, function);
} else {
fprintf(stderr, "[%d] %s", verbosity, function);
}
fprintf(stderr, " %s\n", buffer);
}
static void csync_log_function(int verbosity,
+1
Ver Arquivo
@@ -39,6 +39,7 @@
# include <shlobj.h>
#else /* _WIN32 */
# include <pwd.h>
# include <unistd.h>
#endif /* _WIN32 */
#include "c_lib.h"
+1 -1
Ver Arquivo
@@ -36,7 +36,7 @@
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
#endif
int csync_fnmatch(const char *pattern, const char *name, int flags);
int csync_fnmatch(__const char *__pattern, __const char *__name, int __flags);
/**
* @brief csync_errno_to_status - errno to csync status code
+4
Ver Arquivo
@@ -126,6 +126,7 @@ struct csync_s {
} local;
struct {
char *uri;
c_rbtree_t *tree;
enum csync_replica_e type;
int read_from_db;
@@ -223,6 +224,9 @@ struct _csync_treewalk_context_s
};
typedef struct _csync_treewalk_context_s _csync_treewalk_context;
time_t oc_httpdate_parse( const char *date );
void set_errno_from_http_errcode( int err );
/**
+1 -15
Ver Arquivo
@@ -65,21 +65,7 @@ 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
+1 -1
Ver Arquivo
@@ -50,7 +50,7 @@
*
* @todo Add an argument to set the algorithm to use.
*/
int OCSYNC_EXPORT csync_reconcile_updates(CSYNC *ctx);
int csync_reconcile_updates(CSYNC *ctx);
/**
* }@
-5
Ver Arquivo
@@ -20,7 +20,6 @@
extern "C" {
#include "csync_private.h"
#include "csync_rename.h"
}
#include <map>
@@ -94,9 +93,5 @@ 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();
}
}
+4 -6
Ver Arquivo
@@ -27,13 +27,11 @@ extern "C" {
#endif
/* Return the final destination path of a given patch in case of renames */
char OCSYNC_EXPORT *csync_rename_adjust_path(CSYNC *ctx, const char *path);
char *csync_rename_adjust_path(CSYNC *ctx, const char *path);
/* Return the source of a given path in case of renames */
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);
char *csync_rename_adjust_path_source(CSYNC *ctx, const char *path);
void csync_rename_destroy(CSYNC *ctx);
void csync_rename_record(CSYNC *ctx, const char *from, const char *to);
#ifdef __cplusplus
}
+7 -4
Ver Arquivo
@@ -27,6 +27,7 @@
#include <sqlite3.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -52,7 +53,7 @@
#define sqlite_open(A, B) sqlite3_open_v2(A,B, SQLITE_OPEN_READONLY+SQLITE_OPEN_NOMUTEX, NULL)
#define SQLTM_TIME 150
#define SQLTM_TIME 150000
#define SQLTM_COUNT 10
#define SQLITE_BUSY_HANDLED(F) if(1) { \
@@ -60,7 +61,7 @@
do { rc = F ; \
if( (rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED) ) { \
n++; \
csync_sleep(SQLTM_TIME); \
usleep(SQLTM_TIME); \
} \
}while( (n < SQLTM_COUNT) && ((rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED))); \
}
@@ -518,7 +519,8 @@ c_strlist_t *csync_statedb_query(sqlite3 *db,
/* compile SQL program into a virtual machine, reattempteing if busy */
do {
if (busy_count) {
csync_sleep(100);
/* sleep 100 msec */
usleep(100000);
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "sqlite3_prepare: BUSY counter: %zu", busy_count);
}
err = sqlite3_prepare(db, statement, -1, &stmt, &tail);
@@ -545,7 +547,8 @@ c_strlist_t *csync_statedb_query(sqlite3 *db,
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Busy counter has reached its maximum. Aborting this sql statement");
break;
}
csync_sleep(100);
/* sleep 100 msec */
usleep(100000);
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "sqlite3_step: BUSY counter: %zu", busy_count);
continue;
}
+2 -20
Ver Arquivo
@@ -31,11 +31,6 @@
#include "csync_time.h"
#include "vio/csync_vio.h"
#ifndef _WIN32
#include <unistd.h>
#include <sys/time.h>
#endif
#define CSYNC_LOG_CATEGORY_NAME "csync.time"
#include "csync_log.h"
@@ -50,13 +45,7 @@
int csync_gettime(struct timespec *tp)
{
#if defined(_WIN32)
__int64 wintime;
GetSystemTimeAsFileTime((FILETIME*)&wintime);
wintime -= 116444736000000000ll; //1jan1601 to 1jan1970
tp->tv_sec = wintime / 10000000ll; //seconds
tp->tv_nsec = wintime % 10000000ll * 100; //nano-seconds
#elif defined(HAVE_CLOCK_GETTIME)
#ifdef HAVE_CLOCK_GETTIME
return clock_gettime(CSYNC_CLOCK, tp);
#else
struct timeval tv;
@@ -73,11 +62,4 @@ int csync_gettime(struct timespec *tp)
#undef CSYNC_CLOCK
void csync_sleep(unsigned int msecs)
{
#if defined(_WIN32)
Sleep(msecs);
#else
usleep(msecs * 1000);
#endif
}
/* vim: set ts=8 sw=2 et cindent: */
-1
Ver Arquivo
@@ -26,6 +26,5 @@
#include "csync_private.h"
int csync_gettime(struct timespec *tp);
void csync_sleep(unsigned int msecs);
#endif /* _CSYNC_TIME_H */
+74 -34
Ver Arquivo
@@ -56,13 +56,26 @@ static uint64_t _hash_of_file(CSYNC *ctx, const char *file) {
if( ctx && file ) {
path = file;
if (ctx->current == LOCAL_REPLICA) {
switch (ctx->current) {
case LOCAL_REPLICA:
if (strlen(path) <= strlen(ctx->local.uri)) {
return 0;
}
path += strlen(ctx->local.uri) + 1;
break;
case REMOTE_REPLICA:
if (strlen(path) <= strlen(ctx->remote.uri)) {
return 0;
}
path += strlen(ctx->remote.uri) + 1;
break;
default:
path = NULL;
return 0;
break;
}
len = strlen(path);
h = c_jhash64((uint8_t *) path, len, 0);
}
return h;
@@ -145,19 +158,7 @@ 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;
@@ -175,12 +176,25 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
}
path = file;
if (ctx->current == LOCAL_REPLICA) {
switch (ctx->current) {
case LOCAL_REPLICA:
if (strlen(path) <= strlen(ctx->local.uri)) {
ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
return -1;
}
path += strlen(ctx->local.uri) + 1;
break;
case REMOTE_REPLICA:
if (strlen(path) <= strlen(ctx->remote.uri)) {
ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
return -1;
}
path += strlen(ctx->remote.uri) + 1;
break;
default:
path = NULL;
ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
return -1;
}
len = strlen(path);
@@ -603,7 +617,16 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
static bool fill_tree_from_db(CSYNC *ctx, const char *uri)
{
if( csync_statedb_get_below_path(ctx, uri) < 0 ) {
const char *path = NULL;
if( strlen(uri) < strlen(ctx->remote.uri)+1) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "name does not contain remote uri!");
return false;
}
path = uri + strlen(ctx->remote.uri)+1;
if( csync_statedb_get_below_path(ctx, path) < 0 ) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "StateDB could not be read!");
return false;
}
@@ -645,6 +668,12 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
bool do_read_from_db = (ctx->current == REMOTE_REPLICA && ctx->remote.read_from_db);
if (uri[0] == '\0') {
errno = ENOENT;
ctx->status_code = CSYNC_STATUS_PARAM_ERROR;
goto error;
}
read_from_db = ctx->remote.read_from_db;
// if the etag of this dir is still the same, its content is restored from the
@@ -658,7 +687,16 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
goto done;
}
if ((dh = csync_vio_opendir(ctx, uri)) == NULL) {
const char *uri_for_vio = uri;
if (ctx->current == REMOTE_REPLICA) {
uri_for_vio += strlen(ctx->remote.uri);
if (strlen(uri_for_vio) > 0 && uri_for_vio[0] == '/') {
uri_for_vio++; // cut leading slash
}
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "URI without fuzz for %s is \"%s\"", uri, uri_for_vio);
}
if ((dh = csync_vio_opendir(ctx, uri_for_vio)) == NULL) {
if (ctx->abort) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Aborted!");
ctx->status_code = CSYNC_STATUS_ABORTED;
@@ -731,32 +769,34 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
continue;
}
if (uri[0] == '\0') {
filename = c_strdup(d_name);
flen = strlen(d_name);
} else {
flen = asprintf(&filename, "%s/%s", uri, d_name);
}
if (flen < 0 || !filename) {
flen = asprintf(&filename, "%s/%s", uri, d_name);
if (flen < 0) {
csync_vio_file_stat_destroy(dirent);
dirent = NULL;
ctx->status_code = CSYNC_STATUS_MEMORY_ERROR;
goto error;
}
/* Create relative path: For local replica, we need to remove the base path. */
path = filename;
if (ctx->current == LOCAL_REPLICA) {
/* Create relative path */
switch (ctx->current) {
case LOCAL_REPLICA:
ulen = strlen(ctx->local.uri) + 1;
if (((size_t)flen) < ulen) {
csync_vio_file_stat_destroy(dirent);
dirent = NULL;
ctx->status_code = CSYNC_STATUS_UNSUCCESSFUL;
goto error;
}
path += ulen;
break;
case REMOTE_REPLICA:
ulen = strlen(ctx->remote.uri) + 1;
break;
default:
break;
}
if (((size_t)flen) < ulen) {
csync_vio_file_stat_destroy(dirent);
dirent = NULL;
ctx->status_code = CSYNC_STATUS_UNSUCCESSFUL;
goto error;
}
path = filename + ulen;
/* skip ".csync_journal.db" and ".csync_journal.db.ctmp" */
/* Isn't this done via csync_exclude already? */
+3 -3
Ver Arquivo
@@ -26,9 +26,9 @@
#include "csync_private.h"
const char OCSYNC_EXPORT *csync_instruction_str(enum csync_instructions_e instr);
const char *csync_instruction_str(enum csync_instructions_e instr);
void OCSYNC_EXPORT csync_memstat_check(void);
void csync_memstat_check(void);
bool OCSYNC_EXPORT csync_file_locked_or_open( const char *dir, const char *fname);
bool csync_file_locked_or_open( const char *dir, const char *fname);
#endif /* _CSYNC_UTIL_H */
-6
Ver Arquivo
@@ -26,12 +26,6 @@ set(cstdlib_SRCS
c_time.c
)
if(NOT HAVE_ASPRINTF AND NOT HAVE___MINGW_ASPRINTF)
list(APPEND cstdlib_SRCS
asprintf.c
)
endif()
include_directories(
${CSTDLIB_PUBLIC_INCLUDE_DIRS}
${CSTDLIB_PRIVATE_INCLUDE_DIRS}
-90
Ver Arquivo
@@ -1,90 +0,0 @@
/*
https://raw.githubusercontent.com/littlstar/asprintf.c/20ce5207a4ecb24017b5a17e6cd7d006e3047146/asprintf.c
The MIT License (MIT)
Copyright (c) 2014 Little Star Media, Inc.
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.
*/
/**
* `asprintf.c' - asprintf
*
* copyright (c) 2014 joseph werle <joseph.werle@gmail.com>
*/
#ifndef HAVE_ASPRINTF
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "asprintf.h"
int
asprintf (char **str, const char *fmt, ...) {
int size = 0;
va_list args;
// init variadic argumens
va_start(args, fmt);
// format and get size
size = vasprintf(str, fmt, args);
// toss args
va_end(args);
return size;
}
int
vasprintf (char **str, const char *fmt, va_list args) {
int size = 0;
va_list tmpa;
// copy
va_copy(tmpa, args);
// apply variadic arguments to
// sprintf with format to get size
size = vsnprintf(NULL, size, fmt, tmpa);
// toss args
va_end(tmpa);
// return -1 to be compliant if
// size is less than 0
if (size < 0) { return -1; }
// alloc with size plus 1 for `\0'
*str = (char *) malloc(size + 1);
// return -1 to be compliant
// if pointer is `NULL'
if (NULL == *str) { return -1; }
// format string with original
// variadic arguments and set new size
size = vsprintf(*str, fmt, args);
return size;
}
#endif
-60
Ver Arquivo
@@ -1,60 +0,0 @@
/*
https://raw.githubusercontent.com/littlstar/asprintf.c/20ce5207a4ecb24017b5a17e6cd7d006e3047146/asprintf.h
The MIT License (MIT)
Copyright (c) 2014 Little Star Media, Inc.
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.
*/
/**
* `asprintf.h' - asprintf.c
*
* copyright (c) 2014 joseph werle <joseph.werle@gmail.com>
*/
#ifndef HAVE_ASPRINTF
#ifndef ASPRINTF_H
#define ASPRINTF_H 1
#include <stdarg.h>
/**
* Sets `char **' pointer to be a buffer
* large enough to hold the formatted string
* accepting a `va_list' args of variadic
* arguments.
*/
int
vasprintf (char **, const char *, va_list);
/**
* Sets `char **' pointer to be a buffer
* large enough to hold the formatted
* string accepting `n' arguments of
* variadic arguments.
*/
int
asprintf (char **, const char *, ...);
#endif
#endif
+2 -11
Ver Arquivo
@@ -31,17 +31,14 @@
#include <sys/stat.h>
#ifdef _WIN32
#include <windows.h>
#include <windef.h>
#include <winbase.h>
#include <wchar.h>
#else
#include <unistd.h>
#endif
#include <errno.h>
#ifdef __MINGW32__
#ifdef _WIN32
#define EDQUOT 0
#define ENODATA 0
#ifndef S_IRGRP
@@ -68,8 +65,6 @@
#define nlink_t int
#define getuid() 0
#define geteuid() 0
#elif defined(_WIN32)
#define mode_t int
#else
#include <fcntl.h>
#endif
@@ -94,12 +89,8 @@ typedef struct stat csync_stat_t;
#define ENODATA EBADF
#endif
#if !defined(HAVE_ASPRINTF)
#if defined(HAVE___MINGW_ASPRINTF)
#if !defined(HAVE_ASPRINTF) && defined(HAVE___MINGW_ASPRINTF)
#define asprintf __mingw_asprintf
#else
#include "asprintf.h"
#endif
#endif
#ifndef HAVE_STRERROR_R
-4
Ver Arquivo
@@ -25,10 +25,6 @@
#include "c_path.h"
#include "c_time.h"
#ifndef _WIN32
#include <sys/time.h>
#endif
struct timespec c_tspecdiff(struct timespec time1, struct timespec time0) {
struct timespec ret;
int xsec = 0;
+1
Ver Arquivo
@@ -22,6 +22,7 @@
#define _C_TIME_H
#include <time.h>
#include <sys/time.h>
/**
* @brief Calculate time difference
+6 -4
Ver Arquivo
@@ -21,10 +21,12 @@
#ifndef _CSYNC_VIO_LOCAL_H
#define _CSYNC_VIO_LOCAL_H
csync_vio_handle_t OCSYNC_EXPORT *csync_vio_local_opendir(const char *name);
int OCSYNC_EXPORT csync_vio_local_closedir(csync_vio_handle_t *dhandle);
csync_vio_file_stat_t OCSYNC_EXPORT *csync_vio_local_readdir(csync_vio_handle_t *dhandle);
#include <sys/time.h>
int OCSYNC_EXPORT csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf);
csync_vio_handle_t *csync_vio_local_opendir(const char *name);
int csync_vio_local_closedir(csync_vio_handle_t *dhandle);
csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_handle_t *dhandle);
int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf);
#endif /* _CSYNC_VIO_LOCAL_H */
+1
Ver Arquivo
@@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <stdio.h>
#include "windows.h"
+11 -2
Ver Arquivo
@@ -30,7 +30,10 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
*state = csync;
}
@@ -42,7 +45,10 @@ static void setup_module(void **state) {
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
csync_init(csync);
*state = csync;
@@ -60,6 +66,9 @@ static void teardown(void **state) {
rc = system("rm -rf /tmp/check_csync1");
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync2");
assert_int_equal(rc, 0);
*state = NULL;
}
+1 -1
Ver Arquivo
@@ -42,7 +42,7 @@ static void check_csync_create(void **state)
(void) state; /* unused */
csync_create(&csync, "/tmp/csync1");
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
rc = csync_destroy(csync);
assert_int_equal(rc, 0);
+2 -3
Ver Arquivo
@@ -20,7 +20,6 @@
#include "config_csync.h"
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include "torture.h"
@@ -32,7 +31,7 @@
static void setup(void **state) {
CSYNC *csync;
csync_create(&csync, "/tmp/check_csync1");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
*state = csync;
}
@@ -41,7 +40,7 @@ static void setup_init(void **state) {
CSYNC *csync;
int rc;
csync_create(&csync, "/tmp/check_csync1");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
rc = csync_exclude_load(EXCLUDE_LIST_FILE, &(csync->excludes));
assert_int_equal(rc, 0);
+11 -2
Ver Arquivo
@@ -30,7 +30,10 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
*state = csync;
}
@@ -42,7 +45,10 @@ static void setup_module(void **state) {
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
*state = csync;
}
@@ -59,6 +65,9 @@ static void teardown(void **state) {
rc = system("rm -rf /tmp/check_csync1");
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync2");
assert_int_equal(rc, 0);
*state = NULL;
}
+8 -1
Ver Arquivo
@@ -19,6 +19,7 @@
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "torture.h"
@@ -33,7 +34,10 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
*state = csync;
}
@@ -50,6 +54,9 @@ static void teardown(void **state) {
rc = system("rm -rf /tmp/check_csync1");
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync2");
assert_int_equal(rc, 0);
*state = NULL;
}
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <unistd.h>
#include "torture.h"
@@ -36,7 +37,7 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
csync->statedb.file = c_strdup( TESTDB );
*state = csync;
@@ -34,11 +34,15 @@ static void setup(void **state)
rc = system("rm -rf /tmp/check_csync1");
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync2");
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
csync_init(csync);
sqlite3 *db = NULL;
@@ -102,6 +106,8 @@ static void teardown(void **state) {
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync1");
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync2");
assert_int_equal(rc, 0);
*state = NULL;
}
+8 -2
Ver Arquivo
@@ -91,7 +91,9 @@ static void setup(void **state)
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1");
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
csync_init(csync);
/* Create a new db with metadata */
@@ -120,7 +122,9 @@ static void setup_ftw(void **state)
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp");
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp", "/tmp");
csync_init(csync);
sqlite3 *db = NULL;
@@ -158,6 +162,8 @@ static void teardown_rm(void **state) {
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync1");
assert_int_equal(rc, 0);
rc = system("rm -rf /tmp/check_csync2");
assert_int_equal(rc, 0);
}
/* create a file stat, caller must free memory */
-31
Ver Arquivo
@@ -232,37 +232,6 @@ 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();
-6
Ver Arquivo
@@ -56,8 +56,6 @@ 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();
@@ -70,10 +68,6 @@ 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#");
+1
Ver Arquivo
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <unistd.h>
#include "torture.h"
+2 -1
Ver Arquivo
@@ -22,6 +22,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include "torture.h"
@@ -48,7 +49,7 @@ static void setup(void **state)
rc = system("rm -rf /tmp/csync_test");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/csync1");
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
csync->replica = LOCAL_REPLICA;
+2 -1
Ver Arquivo
@@ -22,6 +22,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include "torture.h"
@@ -96,7 +97,7 @@ static void setup_testenv(void **state) {
statevar *mystate = malloc( sizeof(statevar) );
mystate->result = NULL;
csync_create(&(mystate->csync), "/tmp/csync1");
csync_create(&(mystate->csync), "/tmp/csync1", "/tmp/csync2");
mystate->csync->replica = LOCAL_REPLICA;
+6
Ver Arquivo
@@ -199,6 +199,12 @@ 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
------------------------
+4 -31
Ver Arquivo
@@ -42,8 +42,7 @@ 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. Make sure the repositories for source packages are enabled.
2. Install the dependencies using the following commands for your specific Linux distribution:
* Debian/Ubuntu: ``apt-get update; apt-get build-dep owncloud-client``
* openSUSE/SLES: ``zypper ref; zypper si -d owncloud-client``
@@ -66,26 +65,11 @@ recipes.
To set up your build environment for development using HomeBrew_:
1. Install Xcode
2. Install Xcode command line tools::
<<<<<<< HEAD
xcode-select --install
3. Install homebrew::
=======
xcode-select --install
3. Install homebrew::
>>>>>>> ca9ec4625391ae23940b3a62aaa0afe89f3d98e8
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
4. Add the ownCloud repository using the following command::
1. Add the ownCloud repository using the following command::
brew tap owncloud/owncloud
5. Install any missing dependencies::
2. Install any missing dependencies::
brew install $(brew deps owncloud-client)
@@ -95,9 +79,6 @@ 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`.
@@ -108,7 +89,7 @@ To set up your build environment for development using HomeBrew_:
its Common Name as a third parameter (use quotes) to have the package
signed automatically.
.. note:: Contrary to earlier versions, ownCloud 1.7 and later are packaged
.. note:: Contrary to earlier versions, ownCloud 1.7 and later are packaged
as a ``pkg`` installer. Do not call "make package" at any time when
compiling for OS X, as this will build a disk image, and will not
work correctly.
@@ -252,14 +233,6 @@ 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
.. 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/ -D_OPENSSL_VERSION=1.0.2a -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include/ -DNO_SHIBBOLETH=1
qtkeychain must be compiled with the same prefix e.g CMAKE_INSTALL_PREFIX=/Users/path/to/client/install/ .
4. Call ``make``.
-84
Ver Arquivo
@@ -1,84 +0,0 @@
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.
+1 -1
Ver Arquivo
@@ -12,7 +12,7 @@ Desktop Sync client enables you to:
Your files are always automatically synchronized between your ownCloud server
and local PC.
Because of various technical issues, desktop sync clients older than 2.2.1 will
Because of various technical issues, desktop sync clients older than 1.7 will
not allowed to connect and sync with the ownCloud 8.1+ server. It is highly
recommended to keep your client updated.
+1 -2
Ver Arquivo
@@ -4,8 +4,7 @@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+4 -227
Ver Arquivo
@@ -292,228 +292,6 @@ X-GNOME-Autostart-Delay=3
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
# 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
@@ -604,10 +382,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]=Настольный клиент синхронизации @APPLICATION_NAME@
GenericName[ru]=Синхронизация каталогов
Name[ru]=Настольный клиент синхронизации @APPLICATION_NAME@
Icon[ru]=@APPLICATION_EXECUTABLE@
Comment[ru]=Настольный клиент синхронизации @НАЗВАНИЕ_ПРИЛОЖЕНИЯ@
GenericName[ru]=Синхронизация папки
Name[ru]=Настольный клиент синхронизации @НАЗВАНИЕ_ПРИЛОЖЕНИЯ@
Icon[ru]=@ВЫПОЛНЯЕМОЕ_ПРИЛОЖЕНИЕ@
Comment[sl]=@APPLICATION_NAME@ Program za usklajevanje datotek z namizjem
GenericName[sl]=Usklajevanje map
Name[sl]=@APPLICATION_NAME@ Program za usklajevanje datotek z namizjem
@@ -649,7 +427,6 @@ 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
+2 -11
Ver Arquivo
@@ -4,7 +4,6 @@ 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")
@@ -19,17 +18,9 @@ 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 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)
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)
@@ -1,7 +0,0 @@
#!/bin/sh
# this script creates a plugin for caja, just by replacing
# all occurences of Nautilus with Caja (case sensitive).
sed -i.org -e 's/Nautilus/Caja/g' syncstate_caja.py
sed -i.org -e 's/nautilus/caja/g' syncstate_caja.py
+37 -66
Ver Arquivo
@@ -18,7 +18,6 @@
import os
import urllib
import socket
import tempfile
from gi.repository import GObject, Nautilus
@@ -44,7 +43,7 @@ def get_runtime_dir():
try:
return os.environ['XDG_RUNTIME_DIR']
except KeyError:
fallback = os.path.join(tempfile.gettempdir(), 'runtime-' + os.environ['USER'])
fallback = '/tmp/runtime-' + os.environ['USER']
return fallback
@@ -87,17 +86,22 @@ class SocketConnect(GObject.GObject):
def _connectToSocketServer(self):
try:
self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
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))
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)
except Exception as e: # Bad habbit
print("Connect could not be established, try again later.")
self._sock.close()
@@ -153,65 +157,32 @@ 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 = []
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
# 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
# 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:
# If it is neither in a synced folder or is a directory
if not syncedFile:
return items
# Create a menu item
@@ -332,7 +303,7 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
filename = get_local_path(item.get_uri())
if item.is_directory():
filename += os.sep
filename += '/'
inScope = False
for reg_path in socketConnect.registered_paths:
+161 -17
Ver Arquivo
@@ -1,21 +1,165 @@
The MIT License (MIT)
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (c) 2011 Morgan Leborgne
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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 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.
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.
+20 -23
Ver Arquivo
@@ -1,27 +1,24 @@
/*
* 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.
*/
*
* 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/>.
*
*/
#include "QProgressIndicator.h"
#include <QPainter>
+24 -27
Ver Arquivo
@@ -1,27 +1,24 @@
/*
* 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.
*/
*
* 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/>.
*
*/
#ifndef QPROGRESSINDICATOR_H
#define QPROGRESSINDICATOR_H
@@ -67,8 +64,8 @@ public:
*/
const QColor & color() const { return m_color; }
virtual QSize sizeHint() const;
int heightForWidth(int w) const;
virtual QSize sizeHint() const Q_DECL_OVERRIDE;
int heightForWidth(int w) const Q_DECL_OVERRIDE;
public slots:
/*! Starts the spin animation.
\sa stopAnimation isAnimated
@@ -98,8 +95,8 @@ public slots:
*/
void setColor(const QColor & color);
protected:
virtual void timerEvent(QTimerEvent * event);
virtual void paintEvent(QPaintEvent * event);
virtual void timerEvent(QTimerEvent * event) Q_DECL_OVERRIDE;
virtual void paintEvent(QPaintEvent * event) Q_DECL_OVERRIDE;
private:
int m_angle;
int m_timerId;
+1 -1
Ver Arquivo
@@ -11,4 +11,4 @@ Qt 4.4.x.
## License
MIT
LGPL
+2678 -3731
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+267 -421
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+2 -30
Ver Arquivo
@@ -29,7 +29,6 @@
#include "syncengine.h"
#include "syncjournaldb.h"
#include "config.h"
#include "connectionvalidator.h"
#include "cmd.h"
@@ -42,14 +41,10 @@
#include <windows.h>
#else
#include <termios.h>
#include <unistd.h>
#endif
using namespace OCC;
static void nullMessageHandler(QtMsgType, const char *) {}
struct CmdOptions {
QString source_dir;
QString target_url;
@@ -73,8 +68,6 @@ 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:
@@ -302,11 +295,6 @@ 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 ) {
@@ -400,29 +388,13 @@ 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;
@@ -475,7 +447,7 @@ restart_sync:
selectiveSyncFixup(&db, selectiveSyncList);
}
SyncEngine engine(account, options.source_dir, folder, &db);
SyncEngine engine(account, options.source_dir, QUrl(options.target_url), folder, &db);
engine.setIgnoreHiddenFiles(options.ignoreHiddenFiles);
QObject::connect(&engine, SIGNAL(finished(bool)), &app, SLOT(quit()));
QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot()));
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -5
Ver Arquivo
@@ -70,9 +70,9 @@ set(client_SRCS
activityitemdelegate.cpp
selectivesyncdialog.cpp
settingsdialog.cpp
share.cpp
sharedialog.cpp
sharelinkwidget.cpp
sharemanager.cpp
shareusergroupwidget.cpp
sharee.cpp
socketapi.cpp
@@ -199,9 +199,6 @@ 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
@@ -209,7 +206,6 @@ set( final_src
${client_SRCS}
${client_UI_SRCS}
${client_version}
${client_manifest}
${guiMoc}
${client_I18N}
${3rdparty_SRC}
+14 -16
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -45,7 +44,7 @@ AccountManager *AccountManager::instance()
bool AccountManager::restore()
{
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
// If there are no accounts, check the old format.
if (settings->childGroups().isEmpty()
@@ -70,7 +69,9 @@ bool AccountManager::restore()
bool AccountManager::restoreFromLegacySettings()
{
// try to open the correctly themed settings
auto settings = Utility::settingsWithGroup(Theme::instance()->appName());
auto settings = Account::settingsWithGroup(Theme::instance()->appName());
bool migratedCreds = false;
// if the settings file could not be opened, the childKeys list is empty
// then try to load settings from a very old place
@@ -101,6 +102,7 @@ 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;
@@ -112,6 +114,9 @@ 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;
}
@@ -121,7 +126,7 @@ bool AccountManager::restoreFromLegacySettings()
void AccountManager::save(bool saveCredentials)
{
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
settings->setValue(QLatin1String(versionC), 2);
foreach (const auto &acc, _accounts) {
settings->beginGroup(acc->account()->id());
@@ -137,7 +142,7 @@ void AccountManager::save(bool saveCredentials)
void AccountManager::saveAccount(Account* a)
{
qDebug() << "Saving account" << a->url().toString();
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
settings->beginGroup(a->id());
saveAccountHelper(a, *settings, false); // don't save credentials they might not have been loaded yet
settings->endGroup();
@@ -149,7 +154,7 @@ void AccountManager::saveAccount(Account* a)
void AccountManager::saveAccountState(AccountState* a)
{
qDebug() << "Saving account state" << a->account()->url().toString();
auto settings = Utility::settingsWithGroup(QLatin1String(accountsC));
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
settings->beginGroup(a->account()->id());
a->writeToSettings(*settings);
settings->endGroup();
@@ -204,13 +209,6 @@ 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();
@@ -222,7 +220,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings& settings)
acc->setUrl(overrideUrl);
authType = forceAuth;
} else {
acc->setUrl(urlConfig.toUrl());
acc->setUrl(settings.value(QLatin1String(urlC)).toUrl());
}
acc->_serverVersion = settings.value(QLatin1String(serverVersionC)).toString();
@@ -275,7 +273,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 = Utility::settingsWithGroup(QLatin1String(accountsC));
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
settings->remove(account->account()->id());
emit accountRemoved(account);
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+8 -16
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -31,7 +30,6 @@
#include "owncloudsetupwizard.h"
#include "creds/abstractcredentials.h"
#include "tooltipupdater.h"
#include "filesystem.h"
#include <math.h>
@@ -119,10 +117,6 @@ 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()));
@@ -301,9 +295,8 @@ void AccountSettings::slotFolderWizardAccepted()
tr("<p>Could not create local folder <i>%1</i>.")
.arg(QDir::toNativeSeparators(definition.localPath)));
return;
} else {
FileSystem::setFolderMinimumPermissions(definition.localPath);
}
}
}
@@ -324,7 +317,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->scheduleAllFolders();
folderMan->slotScheduleAllFolders();
emit folderChanged();
}
}
@@ -363,7 +356,7 @@ void AccountSettings::slotRemoveCurrentFolder()
return;
}
folderMan->removeFolder( folderMan->folder(alias) );
folderMan->slotRemoveFolder( folderMan->folder(alias) );
_model->removeRow(row);
// single folder fix to show add-button and hide remove-button
@@ -471,7 +464,7 @@ void AccountSettings::slotSyncCurrentFolderNow()
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
FolderMan *folderMan = FolderMan::instance();
folderMan->scheduleFolder(folderMan->folder(alias));
folderMan->slotScheduleSync(folderMan->folder(alias));
}
void AccountSettings::slotOpenOC()
@@ -642,13 +635,12 @@ void AccountSettings::refreshSelectiveSyncStatus()
}
if (msg.isEmpty()) {
ui->selectiveSyncButtons->setVisible(true);
ui->bigFolderUi->setVisible(false);
ui->selectiveSyncNotification->setVisible(false);
ui->selectiveSyncNotification->setText(QString());
} 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;
}
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+33 -94
Ver Arquivo
@@ -154,105 +154,44 @@
</widget>
</item>
<item>
<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 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>
</layout>
</item>
<item>
<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 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>
+2 -3
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -307,7 +306,7 @@ void AccountState::slotCredentialsAsked(AbstractCredentials* credentials)
std::unique_ptr<QSettings> AccountState::settings()
{
auto s = Utility::settingsWithGroup(QLatin1String("Accounts"));
auto s = _account->settingsWithGroup(QLatin1String("Accounts"));
s->beginGroup(_account->id());
return s;
}
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+2 -3
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -617,7 +616,7 @@ void ActivitySettings::slotCopyToClipboard()
message = tr("The sync activity list has been copied to the clipboard.");
} else if(idx == 2 ) {
// issues Widget
message = tr("The list of unsynced items has been copied to the clipboard.");
message = tr("The list of unsynched items has been copied to the clipboard.");
_protocolWidget->storeSyncIssues(ts);
}
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -4,8 +4,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -4,8 +4,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+3 -8
Ver Arquivo
@@ -336,14 +336,9 @@ void Application::slotownCloudWizardDone( int res )
_checkConnectionTimer.start();
slotCheckConnection();
// 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);
// 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);
}
}
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+1 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+20 -6
Ver Arquivo
@@ -4,8 +4,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -80,6 +79,21 @@ void ShibbolethCredentials::setAccount(Account* account)
}
}
bool ShibbolethCredentials::changed(AbstractCredentials* credentials) const
{
ShibbolethCredentials* other(qobject_cast< ShibbolethCredentials* >(credentials));
if (!other) {
return true;
}
if (_shibCookie != other->_shibCookie || _user != other->_user) {
return true;
}
return false;
}
QString ShibbolethCredentials::authType() const
{
return QString::fromLatin1("shibboleth");
@@ -128,7 +142,7 @@ void ShibbolethCredentials::fetchFromKeychain()
} else {
_url = _account->url();
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
job->setInsecureFallback(false);
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*)));
@@ -247,7 +261,7 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
addToCookieJar(_shibCookie);
}
// access
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
_ready = true;
_stillValid = true;
@@ -306,7 +320,7 @@ QByteArray ShibbolethCredentials::shibCookieName()
void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
{
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
// we don't really care if it works...
//connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotWriteJobDone(QKeychain::Job*)));
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
@@ -317,7 +331,7 @@ void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie)
void ShibbolethCredentials::removeShibCookie()
{
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
job->setSettings(Utility::settingsWithGroup(Theme::instance()->appName(), job).release());
job->setSettings(_account->settingsWithGroup(Theme::instance()->appName(), job).release());
job->setKey(keychainKey(_account->url().toString(), "shibAssertion"));
job->start();
}
+2 -2
Ver Arquivo
@@ -3,8 +3,7 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -49,6 +48,7 @@ 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;
+59 -36
Ver Arquivo
@@ -58,6 +58,7 @@ Folder::Folder(const FolderDefinition& definition,
, _wipeDb(false)
, _proxyDirty(true)
, _lastSyncDuration(0)
, _forceSyncOnPollTimeout(false)
, _consecutiveFailingSyncs(0)
, _consecutiveFollowUpSyncs(0)
, _journal(definition.localPath)
@@ -81,7 +82,7 @@ Folder::Folder(const FolderDefinition& definition,
_syncResult.setFolder(_definition.alias);
_engine.reset(new SyncEngine(_accountState->account(), path(), remotePath(), &_journal));
_engine.reset(new SyncEngine(_accountState->account(), path(), remoteUrl(), remotePath(), &_journal));
// pass the setting if hidden files are to be ignored, will be read in csync_update
_engine->setIgnoreHiddenFiles(_definition.ignoreHiddenFiles);
@@ -111,11 +112,6 @@ 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()));
}
Folder::~Folder()
@@ -225,7 +221,7 @@ QString Folder::remotePath() const
QUrl Folder::remoteUrl() const
{
return Utility::concatUrlPath(_accountState->account()->davUrl(), remotePath());
return Account::concatUrlPath(_accountState->account()->davUrl(), remotePath());
}
bool Folder::syncPaused() const
@@ -279,7 +275,7 @@ void Folder::slotRunEtagJob()
AccountPtr account = _accountState->account();
if (_requestEtagJob) {
if (!_requestEtagJob.isNull()) {
qDebug() << Q_FUNC_INFO << remoteUrl().toString() << "has ETag job queued, not trying to sync";
return;
}
@@ -289,15 +285,47 @@ void Folder::slotRunEtagJob()
return;
}
// Do the ordinary etag check for the root folder and schedule a
// sync if it's different.
bool forceSyncIntervalExpired =
quint64(_timeSinceLastSyncDone.elapsed()) > ConfigFile().forceSyncInterval();
bool syncAgainAfterFail = _consecutiveFailingSyncs > 0 && _consecutiveFailingSyncs < 3;
_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.
// 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) {
if (forceSyncIntervalExpired) {
qDebug() << "** Force Sync, because it has been " << _timeSinceLastSyncDone.elapsed() << "ms "
<< "since the last sync";
}
if (_forceSyncOnPollTimeout) {
qDebug() << "** Force Sync, because it was requested";
}
if (syncAgainAfterFail) {
qDebug() << "** Force Sync, because the last"
<< _consecutiveFailingSyncs << "syncs failed, last status:"
<< _syncResult.statusString();
}
_forceSyncOnPollTimeout = false;
emit scheduleToSync(this);
} else {
// Do the ordinary etag check for the root folder and only schedule a real
// sync if it's different.
_requestEtagJob = new RequestEtagJob(account, remotePath(), this);
_requestEtagJob->setTimeout(60*1000);
// check if the etag is different
QObject::connect(_requestEtagJob, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
FolderMan::instance()->slotScheduleETagJob(alias(), _requestEtagJob);
// The _requestEtagJob is auto deleting itself on finish. Our guard pointer _requestEtagJob will then be null.
}
}
void Folder::etagRetreived(const QString& etag)
@@ -310,7 +338,7 @@ void Folder::etagRetreived(const QString& etag)
if (_lastEtag != etag) {
qDebug() << "* Compare etag with previous etag: last:" << _lastEtag << ", received:" << etag << "-> CHANGED";
_lastEtag = etag;
slotScheduleThisFolder();
emit scheduleToSync(this);
}
_accountState->tagLastSuccessfullETagRequest();
@@ -570,10 +598,7 @@ void Folder::slotWatchedPathChanged(const QString& path)
}
emit watchedFileChangedExternally(path);
// Also schedule this folder for a sync, but only after some delay:
// The sync will not upload files that were changed too recently.
scheduleThisFolderSoon();
emit scheduleToSync(this);
}
void Folder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
@@ -733,6 +758,8 @@ void Folder::startSync(const QStringList &pathList)
QMetaObject::invokeMethod(_engine.data(), "startSync", Qt::QueuedConnection);
// disable events until syncing is done
// _watcher->setEventsEnabled(false);
emit syncStarted();
}
@@ -796,6 +823,9 @@ void Folder::slotSyncFinished(bool success)
bubbleUpSyncResult();
bool anotherSyncNeeded = _engine->isAnotherSyncNeeded();
// _watcher->setEventsEnabledDelayed(2000);
if (_csyncError) {
_syncResult.setStatus(SyncResult::Error);
@@ -854,10 +884,11 @@ void Folder::slotSyncFinished(bool success)
// Maybe force a follow-up sync to take place, but only a couple of times.
if (anotherSyncNeeded && _consecutiveFollowUpSyncs <= 3)
{
// 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();
_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() ));
}
}
@@ -938,17 +969,7 @@ 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)
{
@@ -972,8 +993,10 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
*cancel = msgBox.clickedButton() == keepBtn;
if (*cancel) {
wipe();
// speed up next sync
_lastEtag.clear();
slotScheduleThisFolder();
_forceSyncOnPollTimeout = true;
QTimer::singleShot(50, this, SLOT(slotRunEtagJob()));
}
}
+2 -19
Ver Arquivo
@@ -178,7 +178,6 @@ 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;
@@ -195,21 +194,11 @@ 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);
@@ -277,11 +266,6 @@ private slots:
void slotLogPropagationStart();
/** Adds this folder to the list of scheduled folders in the
* FolderMan.
*/
void slotScheduleThisFolder();
private:
bool setIgnoredFiles();
@@ -318,6 +302,7 @@ private:
QElapsedTimer _timeSinceLastSyncDone;
QElapsedTimer _timeSinceLastSyncStart;
qint64 _lastSyncDuration;
bool _forceSyncOnPollTimeout;
/// The number of syncs that failed in a row.
/// Reset when a sync is successful.
@@ -332,8 +317,6 @@ private:
ClientProxy _clientProxy;
QScopedPointer<SyncRunFileLog> _fileLog;
QTimer _scheduleSelfTimer;
};
}
+52 -88
Ver Arquivo
@@ -64,17 +64,11 @@ 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(slotWatchedFileUnlocked(QString)));
SLOT(slotScheduleFolderOwningFile(QString)));
}
FolderMan *FolderMan::instance()
@@ -106,6 +100,8 @@ 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)),
@@ -135,7 +131,7 @@ int FolderMan::unloadAndDeleteAllFolders()
}
_lastSyncFolder = 0;
_currentSyncFolder = 0;
_scheduledFolders.clear();
_scheduleQueue.clear();
emit scheduleQueueChanged();
Q_ASSERT(_folderMap.count() == 0);
@@ -191,7 +187,7 @@ int FolderMan::setupFolders()
{
unloadAndDeleteAllFolders();
auto settings = Utility::settingsWithGroup(QLatin1String("Accounts"));
auto settings = Account::settingsWithGroup(QLatin1String("Accounts"));
const auto accountsWithSettings = settings->childGroups();
if (accountsWithSettings.isEmpty()) {
int r = setupFoldersMigration();
@@ -215,7 +211,7 @@ int FolderMan::setupFolders()
if (FolderDefinition::load(*settings, folderAlias, &folderDefinition)) {
Folder* f = addFolderInternal(std::move(folderDefinition), account.data());
if (f) {
scheduleFolder(f);
slotScheduleSync(f);
emit folderSyncStateChange(f);
}
}
@@ -248,7 +244,7 @@ int FolderMan::setupFoldersMigration()
foreach ( const QString& alias, list ) {
Folder *f = setupFolderFromOldConfigFile( alias, accountState );
if( f ) {
scheduleFolder(f);
slotScheduleSync(f);
emit folderSyncStateChange(f);
}
}
@@ -338,7 +334,6 @@ QString FolderMan::unescapeAlias( const QString& alias )
// filename is the name of the file only, it does not include
// the configuration directory path
// WARNING: Do not remove this code, it is used for predefined/automated deployments (2016)
Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountState *accountState )
{
Folder *folder = 0;
@@ -409,8 +404,6 @@ Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat
//migrate settings
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
settings.remove(QLatin1String("blackList"));
// FIXME: If you remove this codepath, you need to provide another way to do
// this via theme.h or the normal FolderMan::setupFolders
}
folder->saveToSettings();
@@ -429,7 +422,7 @@ void FolderMan::slotFolderSyncPaused( Folder *f, bool paused )
if (!paused) {
_disabledFolders.remove(f);
scheduleFolder(f);
slotScheduleSync(f);
} else {
_disabledFolders.insert(f);
}
@@ -469,11 +462,11 @@ Folder *FolderMan::folder( const QString& alias )
return 0;
}
void FolderMan::scheduleAllFolders()
void FolderMan::slotScheduleAllFolders()
{
foreach( Folder *f, _folderMap.values() ) {
if (f && f->canSync()) {
scheduleFolder( f );
slotScheduleSync( f );
}
}
}
@@ -493,7 +486,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::scheduleFolder( Folder *f )
void FolderMan::slotScheduleSync( Folder *f )
{
if( !f ) {
qWarning() << "slotScheduleSync called with null folder";
@@ -503,7 +496,7 @@ void FolderMan::scheduleFolder( Folder *f )
qDebug() << "Schedule folder " << alias << " to sync!";
if( ! _scheduledFolders.contains(f) ) {
if( ! _scheduleQueue.contains(f) ) {
if( !f->canSync() ) {
qDebug() << "Folder is not ready to sync, not scheduled!";
_socketApi->slotUpdateFolderView(f);
@@ -511,7 +504,7 @@ void FolderMan::scheduleFolder( Folder *f )
}
f->prepareToSync();
emit folderSyncStateChange(f);
_scheduledFolders.enqueue(f);
_scheduleQueue.enqueue(f);
emit scheduleQueueChanged();
} else {
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
@@ -575,7 +568,7 @@ void FolderMan::slotAccountStateChanged()
if (f
&& f->canSync()
&& f->accountState() == accountState) {
scheduleFolder(f);
slotScheduleSync(f);
}
}
} else {
@@ -587,7 +580,7 @@ void FolderMan::slotAccountStateChanged()
_currentSyncFolder->slotTerminateSync();
}
QMutableListIterator<Folder*> it(_scheduledFolders);
QMutableListIterator<Folder*> it(_scheduleQueue);
while (it.hasNext()) {
Folder* f = it.next();
if (f->accountState() == accountState) {
@@ -602,7 +595,7 @@ void FolderMan::slotAccountStateChanged()
// this is not the same as Pause and Resume of folders.
void FolderMan::setSyncEnabled( bool enabled )
{
if (!_syncEnabled && enabled && !_scheduledFolders.isEmpty()) {
if (!_syncEnabled && enabled && !_scheduleQueue.isEmpty()) {
// We have things in our queue that were waiting for the connection to come back on.
startScheduledSyncSoon();
}
@@ -611,19 +604,19 @@ void FolderMan::setSyncEnabled( bool enabled )
emit( folderSyncStateChange(0) );
}
void FolderMan::startScheduledSyncSoon()
void FolderMan::startScheduledSyncSoon(qint64 msMinimumDelay)
{
if (_startScheduledSyncTimer.isActive()) {
return;
}
if (_scheduledFolders.empty()) {
if (_scheduleQueue.empty()) {
return;
}
if (_currentSyncFolder) {
return;
}
qint64 msDelay = 100; // 100ms minimum delay
qint64 msDelay = msMinimumDelay;
qint64 msSinceLastSync = 0;
// Require a pause based on the duration of the last sync run.
@@ -638,6 +631,15 @@ void FolderMan::startScheduledSyncSoon()
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!
@@ -646,7 +648,11 @@ void FolderMan::startScheduledSyncSoon()
// Time since the last sync run counts against the delay
msDelay = qMax(1ll, msDelay - msSinceLastSync);
qDebug() << "Starting the next scheduled sync in" << (msDelay/1000) << "seconds";
// A minimum of delay here is essential as the sync will not upload
// files that were changed too recently.
msDelay = qMax(SyncEngine::minimumFileAgeForUpload, msDelay);
qDebug() << "Scheduling a sync in" << (msDelay/1000) << "seconds";
_startScheduledSyncTimer.start(msDelay);
}
@@ -667,17 +673,18 @@ void FolderMan::slotStartScheduledFolderSync()
return;
}
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduledFolders.count();
if( _scheduledFolders.isEmpty() ) {
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduleQueue.count();
if( _scheduleQueue.isEmpty() ) {
return;
}
// Find the first folder in the queue that can be synced.
Folder* folder = 0;
while( !_scheduledFolders.isEmpty() ) {
Folder* g = _scheduledFolders.dequeue();
if( g->canSync() ) {
folder = g;
Folder* f = 0;
while( !_scheduleQueue.isEmpty() ) {
f = _scheduleQueue.dequeue();
Q_ASSERT(f);
if( f->canSync() ) {
break;
}
}
@@ -685,9 +692,9 @@ void FolderMan::slotStartScheduledFolderSync()
emit scheduleQueueChanged();
// Start syncing this folder!
if( folder ) {
_currentSyncFolder = folder;
folder->startSync( QStringList() );
if( f ) {
_currentSyncFolder = f;
f->startSync( QStringList() );
}
}
@@ -704,7 +711,7 @@ void FolderMan::slotEtagPollTimerTimeout()
if (_currentSyncFolder == f) {
continue;
}
if (_scheduledFolders.contains(f)) {
if (_scheduleQueue.contains(f)) {
continue;
}
if (_disabledFolders.contains(f)) {
@@ -733,7 +740,7 @@ void FolderMan::slotRemoveFoldersForAccount(AccountState* accountState)
}
foreach (const auto &f, foldersToRemove) {
removeFolder(f);
slotRemoveFolder(f);
}
}
@@ -759,54 +766,10 @@ void FolderMan::slotServerVersionChanged(Account *account)
}
}
void FolderMan::slotWatchedFileUnlocked(const QString& path)
void FolderMan::slotScheduleFolderOwningFile(const QString& path)
{
if (Folder* f = folderForPath(path)) {
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?
slotScheduleSync(f);
}
}
@@ -864,6 +827,7 @@ 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()));
@@ -916,7 +880,7 @@ QStringList FolderMan::findFileInLocalFolders( const QString& relPath, const Acc
return re;
}
void FolderMan::removeFolder( Folder *f )
void FolderMan::slotRemoveFolder( Folder *f )
{
if( !f ) {
qWarning() << "!! Can not remove null folder";
@@ -931,7 +895,7 @@ void FolderMan::removeFolder( Folder *f )
terminateSyncProcess();
}
if (_scheduledFolders.removeAll(f) > 0) {
if (_scheduleQueue.removeAll(f) > 0) {
emit scheduleQueueChanged();
}
@@ -1298,7 +1262,7 @@ void FolderMan::setIgnoreHiddenFiles(bool ignore)
QQueue<Folder*> FolderMan::scheduleQueue() const
{
return _scheduledFolders;
return _scheduleQueue;
}
Folder *FolderMan::currentSyncFolder() const
+43 -94
Ver Arquivo
@@ -37,26 +37,6 @@ 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
{
@@ -74,9 +54,6 @@ 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);
@@ -149,24 +126,6 @@ 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.
@@ -180,12 +139,41 @@ 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
@@ -202,22 +190,10 @@ 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();
@@ -231,29 +207,12 @@ private slots:
void slotServerVersionChanged(Account* account);
/**
* A file whose locks were being monitored has become unlocked.
*
* This schedules the folder for synchronization that contains
* Schedules the folder for synchronization that contains
* the file with the given 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();
void slotScheduleFolderOwningFile(const QString& path);
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.
*/
@@ -263,7 +222,7 @@ private:
void unloadFolder( Folder * );
/** Will start a sync after a bit of delay. */
void startScheduledSyncSoon();
void startScheduledSyncSoon(qint64 msMinimumDelay = 0);
// finds all folder configuration files
// and create the folders
@@ -279,29 +238,19 @@ 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;
/// Occasionally schedules folders
QTimer _timeScheduler;
/// Scheduled folders that should be synced as soon as possible
QQueue<Folder*> _scheduledFolders;
/// Picks the next scheduled folder and starts the sync
QTimer _startScheduledSyncTimer;
QScopedPointer<SocketApi> _socketApi;
/** The aliases of folders that shall be synced. */
QQueue<Folder*> _scheduleQueue;
/** When the timer expires one of the scheduled syncs will be started. */
QTimer _startScheduledSyncTimer;
bool _appRestartRequired;
static FolderMan *_instance;
-4
Ver Arquivo
@@ -295,11 +295,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
pBRect.setHeight(barHeight);
pBRect.setWidth( overallWidth - 2 * margin );
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QStyleOptionProgressBarV2 pBarOpt;
#else
QStyleOptionProgressBar pBarOpt;
#endif
pBarOpt.state = option.state | QStyle::State_Horizontal;
pBarOpt.minimum = 0;
+32 -100
Ver Arquivo
@@ -38,12 +38,6 @@ 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)
{
@@ -64,6 +58,7 @@ 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;
@@ -74,14 +69,6 @@ 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();
}
@@ -388,13 +375,12 @@ QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString& path) cons
if (slashPos == -1) {
// first level folder
for (int i = 0; i < _folders.size(); ++i) {
auto& info = _folders.at(i);
if (info._folder == f) {
if (_folders.at(i)._folder == f) {
if( path.isEmpty() ) { // the folder object
return index(i, 0);
}
for (int j = 0; j < info._subs.size(); ++j) {
const QString subName = info._subs.at(j)._name;
for (int j = 0; j < _folders.at(i)._subs.size(); ++j) {
const QString subName = _folders.at(i)._subs.at(j)._name;
if (subName == path) {
return index(j, 0, index(i));
}
@@ -799,13 +785,32 @@ void FolderStatusModel::slotApplySelectiveSync()
foreach(const auto &it, changes) {
folder->journalDb()->avoidReadFromDbOnNextSync(it);
}
FolderMan::instance()->scheduleFolder(folder);
FolderMan::instance()->slotScheduleSync(folder);
}
}
resetFolders();
}
static QString shortenFilename( Folder *f, const QString& file )
{
// strip off the server prefix from the file name
QString shortFile(file);
if( shortFile.isEmpty() ) {
return QString::null;
}
if(shortFile.startsWith(QLatin1String("ownclouds://")) ||
shortFile.startsWith(QLatin1String("owncloud://")) ) {
// rip off the whole ownCloud URL.
if( f ) {
QString remotePathUrl = f->remoteUrl().toString();
shortFile.remove(Utility::toCSyncScheme(remotePathUrl));
}
}
return shortFile;
}
void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
{
auto par = qobject_cast<QWidget*>(QObject::parent());
@@ -879,7 +884,7 @@ void FolderStatusModel::slotSetProgress(const ProgressInfo &progress)
curItemProgress = curItem._size;
}
QString itemFileName = curItem._file;
QString itemFileName = shortenFilename(f, curItem._file);
QString kindString = Progress::asActionString(curItem);
QString fileProgressString;
@@ -981,12 +986,10 @@ 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.
pi = SubFolderInfo::Progress();
_folders[folderIndex]._progress = SubFolderInfo::Progress();
} else if (state == SyncResult::NotYetStarted) {
FolderMan* folderMan = FolderMan::instance();
int pos = folderMan->scheduleQueue().indexOf(f);
@@ -1000,16 +1003,16 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
} else {
message = tr("Waiting for %n other folder(s)...", "", pos);
}
pi = SubFolderInfo::Progress();
pi._overallSyncString = message;
_folders[folderIndex]._progress = SubFolderInfo::Progress();
_folders[folderIndex]._progress._overallSyncString = message;
} else if (state == SyncResult::SyncPrepare) {
pi = SubFolderInfo::Progress();
pi._overallSyncString = tr("Preparing to sync...");
_folders[folderIndex]._progress = SubFolderInfo::Progress();
_folders[folderIndex]._progress._overallSyncString = tr("Preparing to sync...");
} else if (state == SyncResult::Problem || state == SyncResult::Success) {
// Reset the progress info after a sync.
pi = SubFolderInfo::Progress();
_folders[folderIndex]._progress = SubFolderInfo::Progress();
} else if (state == SyncResult::Error) {
pi = SubFolderInfo::Progress();
_folders[folderIndex]._progress = SubFolderInfo::Progress();
}
// update the icon etc. now
@@ -1043,77 +1046,6 @@ 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());

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais