Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
Volkan Gezer a34e95055b Translatable configuration wizard navigation buttons 2014-04-14 23:41:04 +02:00
161 arquivos alterados com 7193 adições e 9596 exclusões
-8
Ver Arquivo
@@ -85,14 +85,6 @@ endif()
# this option creates only libocsync and libowncloudsync
option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
# When this option is enabled, 5xx errors are not added to the clacklist
# Normaly you don't want to enable this option because if a particular file
# trigger a bug on the server, you want the file to be blacklisted.
option(OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF)
if(OWNCLOUD_5XX_NO_BLACKLIST)
add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
endif()
#### find libs
#find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
#if( UNIX AND NOT APPLE ) # Fdo notifications
-17
Ver Arquivo
@@ -1,22 +1,6 @@
ChangeLog
=========
version 1.6.0 (release 2014-04- )
* Minor GUI improvements
* Qt5 compile issues fixed
* Ignore sync log file in filewatcher
* Install libocsync to private library dir and use rpath to localize
* Fix reconnect after server disconnect
* Fix "unknown action" display in Activity window
* Fix memory leaks
* Respect XDG_CONFIG_HOME environment var
* Handle empty fileids in the journal correctly
* Add abilility to compile libowncloudsync without GUI dependendy
* Fix SSL error with previously-expired CAs on Windows
* Fix incorrect folder pause state after start
* Fix a couple of actual potential crashes
* Improve Cookie support (e.g. for cookie-based load-balancers)
* Introduce a general timeout of 300s for network operations
* Improve error handling, blacklisting
* Job-based change propagation, enables faster parallel up/downloads
(right now only if no bandwidth limit is set and no proxy is used)
* Significantly reduced CPU load when checking for local and remote changes
@@ -34,7 +18,6 @@ version 1.6.0 (release 2014-04- )
* Mac OS X: Fix UI inconsistencies on Mavericks
* Shibboleth: Warn if authenticating with a different user
* Remove vio abstraction in csync
* Avoid data loss when a client file system is not case sensitive
version 1.5.3 (release 2014-03-10 )
* Fix usage of proxies after first sync run (#1502, #1524, #1459, #1521)
+1 -1
Ver Arquivo
@@ -4,7 +4,7 @@ set( MIRALL_VERSION_PATCH 0 )
set( MIRALL_SOVERSION 0 )
if ( NOT DEFINED MIRALL_VERSION_SUFFIX )
set( MIRALL_VERSION_SUFFIX "rc3" ) #e.g. beta1, beta2, rc1
set( MIRALL_VERSION_SUFFIX "beta1" ) #e.g. beta1, beta2, rc1
endif( NOT DEFINED MIRALL_VERSION_SUFFIX )
if( NOT DEFINED MIRALL_VERSION_BUILD )
+6 -6
Ver Arquivo
@@ -1,18 +1,17 @@
# Auto-generated - do not modify
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Kiadási jegyzetek megtekintése"
StrCpy $PageReinstall_NEW_Field_2 "Eltávolítás telepítés előtt"
StrCpy $PageReinstall_NEW_Field_3 "Ne távolítsa el"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Már telepítve"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Válaszd ki, hogy szeretnéd telepíteni a következő alkalmazást ${APPLICATION_NAME}."
StrCpy $PageReinstall_SAME_Field_2 "Komponens hozzáadása/újratelepítése"
StrCpy $PageReinstall_SAME_Field_3 "${APPLICATION_NAME} eltávolítása"
StrCpy $UNINSTALLER_APPDATA_TITLE "${APPLICATION_NAME} eltávolítása"
StrCpy $UNINSTALLER_APPDATA_CHECKBOX "Igen, törölje ezt az adatkönyvtárat."
StrCpy $PageReinstall_SAME_Field_3 "Eltávolitani ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "Eltávolitani ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_FINISHED_Detail "Befejezve"
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Show release notes"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Found ${APPLICATION_EXECUTABLE} process(s) which need to be stopped.$\nDo you want the installer to stop these for you?"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Killing ${APPLICATION_EXECUTABLE} processes."
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Process to kill not found!"
StrCpy $PageReinstall_NEW_Field_1 "An older version of ${APPLICATION_NAME} is installed on your system. It is recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
StrCpy $PageReinstall_NEW_Field_2 "Uninstall before installing"
StrCpy $PageReinstall_NEW_Field_3 "Do not uninstall"
StrCpy $PageReinstall_OLD_Field_1 "A newer version of ${APPLICATION_NAME} is already installed! It is not recommended that you install an older version. If you really want to install this older version, it is better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
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 $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE "Choose the maintenance option to perform."
@@ -30,6 +29,7 @@ StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_Desc "Quick Launch shortcut for ${APPLICA
StrCpy $UNINSTALLER_APPDATA_SUBTITLE "Remove ${APPLICATION_NAME}'s data folder from your computer."
StrCpy $UNINSTALLER_APPDATA_LABEL_1 "Do you want to delete ${APPLICATION_NAME}'s data folder?"
StrCpy $UNINSTALLER_APPDATA_LABEL_2 "Leave unchecked to keep the data folder for later use or check to delete the data folder."
StrCpy $UNINSTALLER_APPDATA_CHECKBOX "Yes, delete this data folder."
StrCpy $UNINSTALLER_FILE_Detail "Writing Uninstaller"
StrCpy $UNINSTALLER_REGISTRY_Detail "Writing Installer Registry Keys"
StrCpy $UNINSTALL_MESSAGEBOX "It does not appear that ${APPLICATION_NAME} is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?"
+1 -1
Ver Arquivo
@@ -1,6 +1,6 @@
# Auto-generated - do not modify
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostra le note di rilascio"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Trovati ${APPLICATION_EXECUTABLE} processi che dovrebbero essere fermati.$\nVuoi che il programma di installazione li fermi al posto tuo?"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Trovati ${APPLICATION_EXECUTABLE} processi che dovrebbero essere fermati.$\nVuoi che il programma di installazione li fermi per te?"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Sto terminando ${APPLICATION_EXECUTABLE} processi."
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Il processo da terminare non è stato trovato!"
StrCpy $PageReinstall_NEW_Field_1 "Una versione più datata di ${APPLICATION_NAME} è installata sul tuo sistema. Si consiglia di disinstallare la versione attuale prima di installare. Seleziona l'operazione da eseguire e fai clic su Avanti per continuare."
-44
Ver Arquivo
@@ -1,44 +0,0 @@
# Auto-generated - do not modify
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostrar notas de la versión"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Parando el proceso ${APPLICATION_EXECUTABLE}."
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Proceso a detener no encontrado!"
StrCpy $PageReinstall_NEW_Field_1 "Una versión anterior de ${APPLICATION_NAME} esta instalada en el sistema. Es recomendado que quite esta versión antes de instalar. Elija la operación a realizar y seleccione Siguiente para continuar."
StrCpy $PageReinstall_NEW_Field_2 "Des-instale antes de Instalar."
StrCpy $PageReinstall_NEW_Field_3 "No des-instalar."
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Actualmente Instalado."
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Elija como desea instalar ${APPLICATION_NAME}."
StrCpy $PageReinstall_OLD_Field_1 "Una versión mas reciente de ${APPLICATION_NAME} esta actualmente instalada! No es recomendado que instale una versión antigua. Si realmente desea instalar esta versión obsoleta, es mejor que des-instale la versión actual primero. Seleccione la operación que desea realizar y presione en Siguiente para continuar. "
StrCpy $PageReinstall_SAME_Field_2 "Agregar/Re-Instalar componentes"
StrCpy $PageReinstall_SAME_Field_3 "Des-instalar ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "Des-instalar ${APPLICATION_NAME}"
StrCpy $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE "Elija la opción de mantenimiento a realizar."
StrCpy $SEC_APPLICATION_DETAILS "Instalar esenciales ${APPLICATION_NAME}."
StrCpy $OPTION_SECTION_SC_START_MENU_SECTION "Acceso Directo en Menú de Programas"
StrCpy $OPTION_SECTION_SC_START_MENU_DetailPrint "Agregando el Acceso Directo al Menú de Inicio para ${APPLICATION_NAME}."
StrCpy $OPTION_SECTION_SC_DESKTOP_SECTION "Acceso directo en Escritorio"
StrCpy $OPTION_SECTION_SC_DESKTOP_DetailPrint "Creando Accesos Directos en Escritorio"
StrCpy $OPTION_SECTION_SC_START_MENU_Desc "Acceso directo de ${APPLICATION_NAME}"
StrCpy $OPTION_SECTION_SC_DESKTOP_Desc "Acceso Directo al Escritorio para ${APPLICATION_NAME}."
StrCpy $UNINSTALLER_APPDATA_SUBTITLE "Quitar la carpeta de datos ${APPLICATION_NAME} de la computadora."
StrCpy $UNINSTALLER_APPDATA_LABEL_1 "Desea borrar la carpeta de datos de ${APPLICATION_NAME}?"
StrCpy $UNINSTALLER_APPDATA_LABEL_2 "Dejar des-tildado para mantener la carpeta de datos para posterior uso o tildar para borrar la carpeta de datos."
StrCpy $UNINSTALLER_APPDATA_CHECKBOX "Si, eliminar esta carpeta de datos."
StrCpy $UNINSTALLER_FILE_Detail "Escribiendo Des-Instalador."
StrCpy $UNINSTALLER_REGISTRY_Detail "Escribiendo claves de Registro del Instalador"
StrCpy $UNINSTALLER_FINISHED_Detail "Terminado"
StrCpy $UNINSTALL_ABORT "Des-instalación abortada por el usuario"
StrCpy $INIT_NO_DESKTOP "Acceso Directo en Escritorio (Sobrescribe existentes)"
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "Este instalador requiere acceso Administrador, intente de nuevo. "
StrCpy $INIT_INSTALLER_RUNNING "El instalador ya esta corriendo."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Este des-instalador requiere acceso administrador, intente de nuevo"
StrCpy $INIT_UNINSTALLER_RUNNING "El des-instalador ya esta corriendo"
StrCpy $SectionGroup_Shortcuts "Accesos Directos"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Found ${APPLICATION_EXECUTABLE} process(s) which need to be stopped.$\nDo you want the installer to stop these for you?"
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 $OPTION_SECTION_SC_QUICK_LAUNCH_SECTION "Quick Launch Shortcut"
StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_DetailPrint "Creating Quick Launch Shortcut"
StrCpy $OPTION_SECTION_SC_APPLICATION_Desc "${APPLICATION_NAME} essentials."
StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_Desc "Quick Launch shortcut for ${APPLICATION_NAME}."
StrCpy $UNINSTALL_MESSAGEBOX "It does not appear that ${APPLICATION_NAME} is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?"
StrCpy $INIT_NO_QUICK_LAUNCH "Quick Launch Shortcut (N/A)"
StrCpy $UAC_ERROR_ELEVATE "Unable to elevate, error:"
+1 -1
Ver Arquivo
@@ -9,7 +9,7 @@ StrCpy $PageReinstall_NEW_Field_3 "Kald
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Zaten Yüklü"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "${APPLICATION_NAME} uygulamasını nasıl yüklemek istediğinizi seçin."
StrCpy $PageReinstall_OLD_Field_1 "${APPLICATION_NAME} uygulamasının daha yeni sürümü zaten yüklü! Daha eski bir sürümünü yüklemeniz önerilmez. Gerçekten bu eski sürümü yüklemek isterseniz, ilk olarak geçerli sürümü kaldırmanız tavsiye edilir. Yapmak istediğiniz işlemi seçin ve devam etmek üzere İleri tıklayın."
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} zaten yüklü.\n\nYapmak istediğiniz işlemi seçin ve devam etmek için İleri tıklayın."
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} zaten yüklü.\nYapmak istediğiniz işlemi seçin ve devam etmek için İleri tıklayın."
StrCpy $PageReinstall_SAME_Field_2 "Bileşenleri ekle/yeniden yükle"
StrCpy $PageReinstall_SAME_Field_3 "${APPLICATION_NAME} uygulamasını kaldır"
StrCpy $UNINSTALLER_APPDATA_TITLE "${APPLICATION_NAME} uygulamasını kaldır"
-1
Ver Arquivo
@@ -3,7 +3,6 @@
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "French"
+1 -1
Ver Arquivo
@@ -31,7 +31,7 @@ HINTS
find_library(NEON_LIBRARIES
NAMES
neon neon-27
neon
HINTS
${_NEON_LIBDIR}
${CMAKE_INSTALL_LIBDIR}
+1 -1
Ver Arquivo
@@ -30,7 +30,7 @@ find_path(SQLITE3_INCLUDE_DIR
find_library(SQLITE3_LIBRARY
NAMES
sqlite3 sqlite3-0
sqlite3
PATHS
${_SQLITE3_LIBDIR}
)
+40 -117
Ver Arquivo
@@ -1,49 +1,32 @@
#.rst:
# GNUInstallDirs
# --------------
#
# Define GNU standard installation directories
#
# - Define GNU standard installation directories
# Provides install directory variables as defined for GNU software:
#
# ::
#
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
#
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
# Inclusion of this module defines the following variables:
#
# ::
#
# CMAKE_INSTALL_<dir> - destination for files of a given type
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
#
# CMAKE_INSTALL_<dir> - destination for files of a given type
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
# where <dir> is one of:
#
# ::
#
# BINDIR - user executables (bin)
# SBINDIR - system admin executables (sbin)
# LIBEXECDIR - program executables (libexec)
# SYSCONFDIR - read-only single-machine data (etc)
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
# LOCALSTATEDIR - modifiable single-machine data (var)
# LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
# INCLUDEDIR - C header files (include)
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
# DATAROOTDIR - read-only architecture-independent data root (share)
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
# INFODIR - info documentation (DATAROOTDIR/info)
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
# MANDIR - man documentation (DATAROOTDIR/man)
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
#
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION
# options of install() commands for the corresponding file type. If the
# includer does not define a value the above-shown default will be used
# and the value will appear in the cache for editing by the user. Each
# CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
# from the corresponding destination by prepending (if necessary) the
# value of CMAKE_INSTALL_PREFIX.
# BINDIR - user executables (bin)
# SBINDIR - system admin executables (sbin)
# LIBEXECDIR - program executables (libexec)
# SYSCONFDIR - read-only single-machine data (etc)
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
# LOCALSTATEDIR - modifiable single-machine data (var)
# LIBDIR - object code libraries (lib or lib64)
# INCLUDEDIR - C header files (include)
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
# DATAROOTDIR - read-only architecture-independent data root (share)
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
# INFODIR - info documentation (DATAROOTDIR/info)
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
# MANDIR - man documentation (DATAROOTDIR/man)
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
# install() commands for the corresponding file type. If the includer does
# not define a value the above-shown default will be used and the value will
# appear in the cache for editing by the user.
# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
# from the corresponding destination by prepending (if necessary) the value
# of CMAKE_INSTALL_PREFIX.
#=============================================================================
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
@@ -85,90 +68,30 @@ if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
endif()
# We check if the variable was manually set and not cached, in order to
# allow projects to set the values as normal variables before including
# GNUInstallDirs to avoid having the entries cached or user-editable. It
# replaces the "if(NOT DEFINED CMAKE_INSTALL_XXX)" checks in all the
# other cases.
# If CMAKE_INSTALL_LIBDIR is defined, if _libdir_set is false, then the
# variable is a normal one, otherwise it is a cache one.
get_property(_libdir_set CACHE CMAKE_INSTALL_LIBDIR PROPERTY TYPE SET)
if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set
AND DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX
AND NOT "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" STREQUAL "${CMAKE_INSTALL_PREFIX}"))
# If CMAKE_INSTALL_LIBDIR is not defined, it is always executed.
# Otherwise:
# * if _libdir_set is false it is not executed (meaning that it is
# not a cache variable)
# * if _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX is not defined it is
# not executed
# * if _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX and
# CMAKE_INSTALL_PREFIX are the same string it is not executed.
# _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX is updated after the
# execution, of this part of code, therefore at the next inclusion
# of the file, CMAKE_INSTALL_LIBDIR is defined, and the 2 strings
# are equal, meaning that the if is not executed the code the
# second time.
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(_LIBDIR_DEFAULT "lib")
# Override this default 'lib' with 'lib64' iff:
# - we are on Linux system but NOT cross-compiling
# - we are NOT on debian
# - we are on a 64 bits system
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
# and CMAKE_INSTALL_PREFIX is "/usr"
# See http://wiki.debian.org/Multiarch
if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
set(__LAST_LIBDIR_DEFAULT "lib")
# __LAST_LIBDIR_DEFAULT is the default value that we compute from
# _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX, not a cache entry for
# the value that was last used as the default.
# This value is used to figure out whether the user changed the
# CMAKE_INSTALL_LIBDIR value manually, or if the value was the
# default one. When CMAKE_INSTALL_PREFIX changes, the value is
# updated to the new default, unless the user explicitly changed it.
endif()
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
AND NOT CMAKE_CROSSCOMPILING)
if (EXISTS "/etc/debian_version") # is this a debian system ?
if(CMAKE_LIBRARY_ARCHITECTURE)
if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX
AND "${_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$")
set(__LAST_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
endif()
endif()
else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
message(AUTHOR_WARNING
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
"Please enable at least one language before including GNUInstallDirs.")
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(_LIBDIR_DEFAULT "lib64")
if(DEFINED _GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX)
set(__LAST_LIBDIR_DEFAULT "lib64")
endif()
endif()
# Note that the future of multi-arch handling may be even
# more complicated than that: http://wiki.debian.org/Multiarch
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
AND NOT CMAKE_CROSSCOMPILING
AND NOT EXISTS "/etc/debian_version")
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
message(AUTHOR_WARNING
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
"Please enable at least one language before including GNUInstallDirs.")
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(_LIBDIR_DEFAULT "lib64")
endif()
endif()
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
elseif(DEFINED __LAST_LIBDIR_DEFAULT
AND "${__LAST_LIBDIR_DEFAULT}" STREQUAL "${CMAKE_INSTALL_LIBDIR}")
set_property(CACHE CMAKE_INSTALL_LIBDIR PROPERTY VALUE "${_LIBDIR_DEFAULT}")
endif()
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
endif()
# Save for next run
set(_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "CMAKE_INSTALL_PREFIX during last run")
unset(_libdir_set)
unset(__LAST_LIBDIR_DEFAULT)
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
+10 -16
Ver Arquivo
@@ -11,15 +11,13 @@ endif( BUILD_WITH_QT4 )
if( Qt5Core_FOUND )
message(STATUS "Found Qt5 core, checking for further dependencies...")
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Quick REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
find_package(Qt5WebKit REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Xml REQUIRED)
if(NOT TOKEN_AUTH_ONLY)
find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5WebKit REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
find_package(Qt5Quick REQUIRED)
find_package(Qt5Widgets REQUIRED)
endif()
find_package(Qt5WebKitWidgets REQUIRED)
if(APPLE)
find_package(Qt5MacExtras REQUIRED)
endif(APPLE)
@@ -39,27 +37,23 @@ if( Qt5Core_FOUND )
include_directories(${Qt5DBus_INCLUDES})
add_definitions(${Qt5DBus_DEFINITIONS})
endif (WITH_DBUS)
include_directories(${Qt5Core_INCLUDES})
add_definitions(${Qt5Core_DEFINITIONS})
include_directories(${Qt5Widgets_INCLUDES})
add_definitions(${Qt5Widgets_DEFINITIONS})
if (NOT WIN32) #implied on Win32
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif(NOT WIN32)
# set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
if(APPLE AND NOT TOKEN_AUTH_ONLY)
if(APPLE)
include_directories(${Qt5MacExtras_INCLUDE_DIRS})
add_definitions(${Qt5MacExtras_DEFINITIONS})
set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES})
endif()
endif(APPLE)
if(NOT BUILD_LIBRARIES_ONLY)
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
else()
# hack
SET(QT_UIC_EXECUTABLE "")
endif()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
+8 -19
Ver Arquivo
@@ -44,10 +44,11 @@ if(HAVE_ICONV AND WITH_ICONV)
list(APPEND CSYNC_LINK_LIBRARIES ${ICONV_LIBRARIES})
endif()
# Specific option for builds tied to servers that do not support renaming extensions
set(NO_RENAME_EXTENSION 0 CACHE BOOL "Do not issue rename if the extension changes")
if(NO_RENAME_EXTENSION)
add_definitions(-DNO_RENAME_EXTENSION)
set(BLACKLIST_ON_ERROR 0 CACHE BOOL
"If an errors occurs three times on the same file, do not attempt to process that file any further.")
if(BLACKLIST_ON_ERROR)
add_definitions(-DBLACKLIST_ON_ERROR)
endif()
set(csync_SRCS
@@ -109,19 +110,8 @@ set_target_properties(
SOVERSION
${LIBRARY_SOVERSION}
)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
INSTALL(
TARGETS
${CSYNC_LIBRARY}
LIBRARY DESTINATION
${LIB_INSTALL_DIR}
ARCHIVE DESTINATION
${LIB_INSTALL_DIR}
RUNTIME DESTINATION
${BIN_INSTALL_DIR}
)
else()
INSTALL(
INSTALL(
TARGETS
${CSYNC_LIBRARY}
LIBRARY DESTINATION
@@ -130,8 +120,7 @@ else()
${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE}
RUNTIME DESTINATION
${BIN_INSTALL_DIR}/${APPLICATION_EXECUTABLE}
)
endif()
)
# INSTALL(
# FILES
+6 -13
Ver Arquivo
@@ -191,12 +191,15 @@ int csync_init(CSYNC *ctx) {
ctx->local.type = LOCAL_REPLICA;
if ( !ctx->options.local_only_mode) {
owncloud_init(csync_get_userdata(ctx));
owncloud_init(csync_get_auth_callback(ctx), csync_get_userdata(ctx));
ctx->remote.type = REMOTE_REPLICA;
} else {
ctx->remote.type = LOCAL_REPLICA;
}
if (ctx->options.timeout)
csync_vio_set_property(ctx, "timeout", &ctx->options.timeout);
if (c_rbtree_create(&ctx->local.tree, _key_cmp, _data_cmp) < 0) {
ctx->status_code = CSYNC_STATUS_TREE_ERROR;
rc = -1;
@@ -444,15 +447,14 @@ static int _csync_treewalk_visitor(void *obj, void *data) {
trav.rename_path = cur->destpath;
trav.etag = cur->etag;
trav.file_id = cur->file_id;
trav.inode = cur->inode;
trav.error_status = cur->error_status;
trav.should_update_etag = cur->should_update_etag;
if( other_node ) {
csync_file_stat_t *other_stat = (csync_file_stat_t*)other_node->data;
trav.other.etag = other_stat->etag;
trav.other.file_id = other_stat->file_id;
trav.other.etag = other_stat->etag ? c_strdup(other_stat->etag) : NULL;
trav.other.file_id = c_strdup(other_stat->file_id);
trav.other.instruction = other_stat->instruction;
trav.other.modtime = other_stat->modtime;
trav.other.size = other_stat->size;
@@ -627,8 +629,6 @@ int csync_commit(CSYNC *ctx) {
_csync_clean_ctx(ctx);
ctx->remote.read_from_db = 0;
ctx->read_from_db_disabled = 0;
/* Create new trees */
rc = c_rbtree_create(&ctx->local.tree, _key_cmp, _data_cmp);
@@ -923,10 +923,3 @@ int csync_set_module_property(CSYNC* ctx, const char* key, void* value)
return csync_vio_set_property(ctx, key, value);
}
int csync_set_read_from_db(CSYNC* ctx, int enabled)
{
ctx->read_from_db_disabled = !enabled;
return 0;
}
+5 -9
Ver Arquivo
@@ -102,8 +102,7 @@ enum csync_status_codes_e {
/* Codes for file individual status: */
CSYNC_STATUS_INDIVIDUAL_IS_SYMLINK,
CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST,
CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS,
CYSNC_STATUS_FILE_LOCKED_OR_OPEN
CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS
};
typedef enum csync_status_codes_e CSYNC_STATUS;
@@ -131,7 +130,10 @@ enum csync_instructions_e {
CSYNC_INSTRUCTION_IGNORE = 0x00000020, /* The file is ignored (UPDATE|RECONCILE) */
CSYNC_INSTRUCTION_SYNC = 0x00000040, /* The file need to be pushed to the other remote (RECONCILE) */
CSYNC_INSTRUCTION_STAT_ERROR = 0x00000080,
CSYNC_INSTRUCTION_ERROR = 0x00000100
CSYNC_INSTRUCTION_ERROR = 0x00000100,
/* instructions for the propagator */
CSYNC_INSTRUCTION_DELETED = 0x00000200,
CSYNC_INSTRUCTION_UPDATED = 0x00000400
};
enum csync_ftw_type_e {
@@ -170,7 +172,6 @@ enum csync_notify_type_e {
struct csync_tree_walk_file_s {
const char *path;
int64_t size;
int64_t inode;
time_t modtime;
#ifdef _WIN32
uint32_t uid;
@@ -590,11 +591,6 @@ void csync_resume(CSYNC *ctx);
*/
int csync_abort_requested(CSYNC *ctx);
/**
* Specify if it is allowed to read the remote tree from the DB (default to enabled)
*/
int csync_set_read_from_db(CSYNC* ctx, int enabled);
#ifdef __cplusplus
}
#endif
-14
Ver Arquivo
@@ -144,7 +144,6 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype) {
char *bname = NULL;
char *dname = NULL;
char *prev_dname = NULL;
char *conflict = NULL;
int rc = -1;
CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
CSYNC_EXCLUDE_TYPE type = CSYNC_NOT_EXCLUDED;
@@ -201,19 +200,6 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype) {
goto out;
}
if (getenv("CSYNC_CONFLICT_FILE_USERNAME")) {
asprintf(&conflict, "*_conflict_%s-*", getenv("CSYNC_CONFLICT_FILE_USERNAME"));
rc = csync_fnmatch(conflict, path, 0);
if (rc == 0) {
match = CSYNC_FILE_SILENTLY_EXCLUDED;
SAFE_FREE(conflict);
SAFE_FREE(bname);
SAFE_FREE(dname);
goto out;
}
SAFE_FREE(conflict);
}
SAFE_FREE(bname);
SAFE_FREE(dname);
+26 -38
Ver Arquivo
@@ -60,7 +60,7 @@ struct dav_session_s dav_session; /* The DAV Session, initialised in dav_connect
int _connected = 0; /* flag to indicate if a connection exists, ie.
the dav_session is valid */
csync_auth_callback _authcb;
void *_userdata;
long long chunked_total_size = 0;
long long chunked_done = 0;
@@ -123,7 +123,6 @@ static int verify_sslcert(void *userdata, int failures,
char buf[MAX(NE_SSL_DIGESTLEN, NE_ABUFSIZ)];
int ret = -1;
const ne_ssl_certificate *cert = certificate;
csync_auth_callback authcb = NULL;
(void) userdata;
memset( problem, 0, LEN );
@@ -161,14 +160,11 @@ static int verify_sslcert(void *userdata, int failures,
}
addSSLWarning( problem, "Do you want to accept the certificate chain anyway?\nAnswer yes to do so and take the risk: ", LEN );
if( dav_session.csync_ctx ) {
authcb = csync_get_auth_callback( dav_session.csync_ctx );
}
if( authcb ){
if( _authcb ){
/* call the csync callback */
DEBUG_WEBDAV("Call the csync callback for SSL problems");
memset( buf, 0, NE_ABUFSIZ );
(*authcb) ( problem, buf, NE_ABUFSIZ-1, 1, 0, _userdata );
(*_authcb) ( problem, buf, NE_ABUFSIZ-1, 1, 0, _userdata );
if( buf[0] == 'y' || buf[0] == 'Y') {
ret = 0;
} else {
@@ -188,8 +184,6 @@ static int ne_auth( void *userdata, const char *realm, int attempt,
char *username, char *password)
{
char buf[NE_ABUFSIZ];
csync_auth_callback authcb = NULL;
int re = attempt;
(void) userdata;
(void) realm;
@@ -205,29 +199,24 @@ static int ne_auth( void *userdata, const char *realm, int attempt,
if( dav_session.pwd && strlen( dav_session.pwd ) < NE_ABUFSIZ ) {
strcpy( password, dav_session.pwd );
}
} else if( _authcb != NULL ){
/* call the csync callback */
DEBUG_WEBDAV("Call the csync callback for %s", realm );
memset( buf, 0, NE_ABUFSIZ );
(*_authcb) ("Enter your username: ", buf, NE_ABUFSIZ-1, 1, 0, _userdata );
if( strlen(buf) < NE_ABUFSIZ ) {
strcpy( username, buf );
}
memset( buf, 0, NE_ABUFSIZ );
(*_authcb) ("Enter your password: ", buf, NE_ABUFSIZ-1, 0, 0, _userdata );
if( strlen(buf) < NE_ABUFSIZ) {
strcpy( password, buf );
}
} else {
if( dav_session.csync_ctx ) {
authcb = csync_get_auth_callback( dav_session.csync_ctx );
}
if( authcb != NULL ){
/* call the csync callback */
DEBUG_WEBDAV("Call the csync callback for %s", realm );
memset( buf, 0, NE_ABUFSIZ );
(*authcb) ("Enter your username: ", buf, NE_ABUFSIZ-1, 1, 0, _userdata );
if( strlen(buf) < NE_ABUFSIZ ) {
strcpy( username, buf );
}
memset( buf, 0, NE_ABUFSIZ );
(*authcb) ("Enter your password: ", buf, NE_ABUFSIZ-1, 0, 0, _userdata );
if( strlen(buf) < NE_ABUFSIZ) {
strcpy( password, buf );
}
} else {
re = 1;
}
DEBUG_WEBDAV("I can not authenticate!");
}
}
return re;
return attempt;
}
/*
@@ -519,10 +508,10 @@ static int dav_connect(const char *base_url) {
goto out;
}
if (dav_session.read_timeout != 0) {
ne_set_read_timeout(dav_session.ctx, dav_session.read_timeout);
DEBUG_WEBDAV("Timeout set to %u seconds", dav_session.read_timeout );
}
if (dav_session.read_timeout == 0)
dav_session.read_timeout = 300; // set 300 seconds as default.
ne_set_read_timeout(dav_session.ctx, dav_session.read_timeout);
snprintf( uaBuf, sizeof(uaBuf), "Mozilla/5.0 (%s) csyncoC/%s",
get_platform(), CSYNC_STRINGIFY( LIBCSYNC_VERSION ));
@@ -993,10 +982,8 @@ int owncloud_commit(void) {
clean_caches();
if( dav_session.ctx ) {
ne_forget_auth(dav_session.ctx);
ne_session_destroy( dav_session.ctx );
}
if( dav_session.ctx )
ne_session_destroy( dav_session.ctx );
/* DEBUG_WEBDAV( "********** vio_module_shutdown" ); */
dav_session.ctx = 0;
@@ -1060,9 +1047,10 @@ int owncloud_set_property(const char *key, void *data) {
return -1;
}
void owncloud_init(void *userdata) {
void owncloud_init(csync_auth_callback cb, void *userdata) {
_userdata = userdata;
_authcb = cb;
_connected = 0; /* triggers dav_connect to go through the whole neon setup */
memset(&dav_session, 0, sizeof(dav_session));
+1 -1
Ver Arquivo
@@ -173,7 +173,7 @@ int owncloud_closedir(csync_vio_handle_t *dhandle);
int owncloud_stat(const char *uri, csync_vio_file_stat_t *buf);
int owncloud_commit(void);
char *owncloud_error_string(void);
void owncloud_init(void *userdata);
void owncloud_init(csync_auth_callback cb, void *userdata);
int owncloud_set_property(const char *key, void *data);
#endif /* CSYNC_OWNCLOUD_H */
-1
Ver Arquivo
@@ -161,7 +161,6 @@ struct csync_s {
int status;
volatile int abort;
void *rename_info;
int read_from_db_disabled;
};
+2 -14
Ver Arquivo
@@ -183,7 +183,6 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
if( !c_streq(cur->file_id, "") ) {
csync_vio_set_file_id( other->file_id, cur->file_id );
}
other->inode = cur->inode;
cur->instruction = CSYNC_INSTRUCTION_NONE;
} else if (other->instruction == CSYNC_INSTRUCTION_REMOVE) {
other->instruction = CSYNC_INSTRUCTION_RENAME;
@@ -192,7 +191,7 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
if( !c_streq(cur->file_id, "") ) {
csync_vio_set_file_id( other->file_id, cur->file_id );
}
other->inode = cur->inode;
cur->instruction = CSYNC_INSTRUCTION_NONE;
} else if (other->instruction == CSYNC_INSTRUCTION_NEW) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "OOOO=> NEW detected in other tree!");
@@ -224,16 +223,6 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
/* file on current replica is changed or new */
case CSYNC_INSTRUCTION_EVAL:
case CSYNC_INSTRUCTION_NEW:
// This operation is usually a no-op and will by default return false
if (csync_file_locked_or_open(ctx->local.uri, cur->path)) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "[Reconciler] IGNORING file %s/%s since it is locked / open", ctx->local.uri, cur->path);
cur->instruction = CSYNC_INSTRUCTION_ERROR;
if (cur->error_status == CSYNC_STATUS_OK) // don't overwrite error
cur->error_status = CYSNC_STATUS_FILE_LOCKED_OR_OPEN;
break;
} else {
//CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "[Reconciler] not ignoring file %s/%s", ctx->local.uri, cur->path);
}
switch (other->instruction) {
/* file on other replica is changed or new */
case CSYNC_INSTRUCTION_NEW:
@@ -246,11 +235,10 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
}
if (is_equal_files) {
/* The files are considered equal. */
cur->instruction = CSYNC_INSTRUCTION_NONE;
cur->instruction = CSYNC_INSTRUCTION_UPDATED; /* update the DB */
other->instruction = CSYNC_INSTRUCTION_NONE;
if( !cur->etag && other->etag ) cur->etag = c_strdup(other->etag);
cur->should_update_etag = true; /* update DB */
} else if(ctx->current == REMOTE_REPLICA) {
cur->instruction = CSYNC_INSTRUCTION_CONFLICT;
other->instruction = CSYNC_INSTRUCTION_NONE;
+10 -42
Ver Arquivo
@@ -79,26 +79,6 @@ static uint64_t _hash_of_file(CSYNC *ctx, const char *file) {
return h;
}
#ifdef NO_RENAME_EXTENSION
/* Return true if the two path have the same extension. false otherwise. */
static bool _csync_sameextension(const char *p1, const char *p2) {
/* Find pointer to the extensions */
const char *e1 = strrchr(p1, '.');
const char *e2 = strrchr(p2, '.');
/* If the found extension contains a '/', it is because the . was in the folder name
* => no extensions */
if (e1 && strchr(e1, '/')) e1 = NULL;
if (e2 && strchr(e2, '/')) e2 = NULL;
/* If none have extension, it is the same extension */
if (!e1 && !e2)
return true;
/* c_streq takes care of the rest */
return c_streq(e1, e2);
}
#endif
static int _csync_detect_update(CSYNC *ctx, const char *file,
const csync_vio_file_stat_t *fs, const int type) {
@@ -255,29 +235,18 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
goto out;
}
if (type == CSYNC_FTW_TYPE_DIR && ctx->current == REMOTE_REPLICA
&& c_streq(fs->file_id, tmp->file_id) && !ctx->read_from_db_disabled) {
&& c_streq(fs->file_id, tmp->file_id)) {
/* If both etag and file id are equal for a directory, read all contents from
* the database.
* The comparison of file id ensure that we fetch all the file id when upgrading from
* owncloud 5 to owncloud 6.
*/
* the database. */
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Reading from database: %s", path);
ctx->remote.read_from_db = true;
}
if (!c_streq(fs->file_id, tmp->file_id) && ctx->current == REMOTE_REPLICA) {
/* file id has changed. Which means we need to update the DB.
* (upgrade from owncloud 5 to owncloud 6 for instence) */
st->should_update_etag = true;
}
st->instruction = CSYNC_INSTRUCTION_NONE;
} else {
enum csync_vio_file_type_e tmp_vio_type = CSYNC_VIO_FILE_TYPE_UNKNOWN;
/* check if it's a file and has been renamed */
if (ctx->current == LOCAL_REPLICA) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Checking for rename based on inode # %" PRId64 "", (uint64_t) fs->inode);
tmp = csync_statedb_get_stat_by_inode(ctx, fs->inode);
/* translate the file type between the two stat types csync has. */
@@ -290,12 +259,8 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
}
if (tmp && tmp->inode == fs->inode && tmp_vio_type == fs->type
&& (tmp->modtime == fs->mtime || fs->type == CSYNC_VIO_FILE_TYPE_DIRECTORY)
#ifdef NO_RENAME_EXTENSION
&& _csync_sameextension(tmp->path, path)
#endif
) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "pot rename detected based on inode # %" PRId64 "", (uint64_t) fs->inode);
&& (tmp->modtime == fs->mtime || fs->type == CSYNC_VIO_FILE_TYPE_DIRECTORY)) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "inodes: %" PRId64 " <-> %" PRId64, (uint64_t) tmp->inode, (uint64_t) fs->inode);
/* inode found so the file has been renamed */
st->instruction = CSYNC_INSTRUCTION_EVAL_RENAME;
if (fs->type == CSYNC_VIO_FILE_TYPE_DIRECTORY) {
@@ -478,6 +443,7 @@ static bool fill_tree_from_db(CSYNC *ctx, const char *uri)
/* File tree walker */
int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
unsigned int depth) {
char errbuf[256] = {0};
char *filename = NULL;
char *d_name = NULL;
csync_vio_handle_t *dh = NULL;
@@ -521,7 +487,10 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "asprintf failed!");
}
} else {
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "opendir failed for %s - errno %d", uri, errno);
C_STRERROR(errno, errbuf, sizeof(errbuf));
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
"opendir failed for %s - %s (errno %d)",
uri, errbuf, errno);
}
goto error;
}
@@ -669,8 +638,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
}
}
if (flag == CSYNC_FTW_FLAG_DIR && ctx->current_fs
&& (ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL ||
if (ctx->current_fs && (ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL ||
ctx->current_fs->instruction == CSYNC_INSTRUCTION_NEW ||
ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL_RENAME)) {
ctx->current_fs->should_update_etag = true;
+2 -19
Ver Arquivo
@@ -55,6 +55,8 @@ static const _instr_code_struct _instr[] =
{ "INSTRUCTION_SYNC", CSYNC_INSTRUCTION_SYNC },
{ "INSTRUCTION_STAT_ERR", CSYNC_INSTRUCTION_STAT_ERROR },
{ "INSTRUCTION_ERROR", CSYNC_INSTRUCTION_ERROR },
{ "INSTRUCTION_DELETED", CSYNC_INSTRUCTION_DELETED },
{ "INSTRUCTION_UPDATED", CSYNC_INSTRUCTION_UPDATED },
{ NULL, CSYNC_INSTRUCTION_ERROR }
};
@@ -180,22 +182,3 @@ csync_vio_file_stat_t *csync_vio_convert_file_stat(csync_file_stat_t *st) {
return vfs;
}
bool (*csync_file_locked_or_open_ext) (const char*) = 0; // filled in by library user
void set_csync_file_locked_or_open_ext(bool (*f) (const char*));
void set_csync_file_locked_or_open_ext(bool (*f) (const char*)) {
csync_file_locked_or_open_ext = f;
}
bool csync_file_locked_or_open( const char *dir, const char *fname) {
char *tmp_uri = NULL;
bool ret;
if (!csync_file_locked_or_open_ext) {
return false;
}
asprintf(&tmp_uri, "%s/%s", dir, fname);
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "csync_file_locked_or_open %s", tmp_uri);
ret = csync_file_locked_or_open_ext(tmp_uri);
SAFE_FREE(tmp_uri);
return ret;
}
-1
Ver Arquivo
@@ -35,5 +35,4 @@ void csync_win32_set_file_hidden( const char *file, bool hidden );
/* Convert a csync_file_stat_t to csync_vio_file_stat_t */
csync_vio_file_stat_t *csync_vio_convert_file_stat(csync_file_stat_t *st);
bool csync_file_locked_or_open( const char *dir, const char *fname);
#endif /* _CSYNC_UTIL_H */
+3
Ver Arquivo
@@ -55,6 +55,9 @@
/** Get the size of an array */
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
/** Macro to make strerror_r work with -Werror=unused-result */
#define C_STRERROR(errno, buf, size) if(strerror_r(errno, buf, size)) {}
/**
* This is a hack to fix warnings. The idea is to use this everywhere that we
* get the "discarding const" warning by the compiler. That doesn't actually
+5
Ver Arquivo
@@ -113,6 +113,11 @@ int csync_vio_stat(CSYNC *ctx, const char *uri, csync_vio_file_stat_t *buf) {
if (rc < 0) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Local stat failed, errno %d", errno);
}
#ifdef _WIN32
else {
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Win32: STAT-inode for %s: %llu", uri, buf->inode );
}
#endif
break;
default:
break;
-3
Ver Arquivo
@@ -240,9 +240,6 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
/* printf("Index: %I64i\n", FileIndex.QuadPart); */
buf->inode = FileIndex.QuadPart;
buf->size = (fileInfo.nFileSizeHigh * (int64_t)(MAXDWORD+1)) + fileInfo.nFileSizeLow;
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
/* Get the file time with a win32 call rather than through stat. See
* http://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting
* for deeper explanation.
@@ -243,6 +243,19 @@ static void check_csync_statedb_get_stat_by_hash_not_found(void **state)
free(tmp);
}
static void check_csync_statedb_get_stat_by_inode(void **state)
{
CSYNC *csync = *state;
csync_file_stat_t *tmp;
tmp = csync_statedb_get_stat_by_inode(csync, (ino_t) 23);
assert_non_null(tmp);
assert_int_equal(tmp->phash, 42);
assert_int_equal(tmp->inode, 23);
free(tmp);
}
static void check_csync_statedb_get_stat_by_inode_not_found(void **state)
{
@@ -259,10 +272,14 @@ int torture_run_tests(void)
unit_test_setup_teardown(check_csync_statedb_query_statement, setup, teardown),
unit_test_setup_teardown(check_csync_statedb_create_error, setup, teardown),
unit_test_setup_teardown(check_csync_statedb_insert_statement, setup, teardown),
/* unit_test_setup_teardown(check_csync_statedb_is_empty, setup, teardown), */
/* unit_test_setup_teardown(check_csync_statedb_create_tables, setup, teardown), */
unit_test_setup_teardown(check_csync_statedb_drop_tables, setup, teardown),
unit_test_setup_teardown(check_csync_statedb_insert_metadata, setup, teardown),
unit_test_setup_teardown(check_csync_statedb_write, setup, teardown),
/* unit_test_setup_teardown(check_csync_statedb_get_stat_by_hash, setup_db, teardown), */
unit_test_setup_teardown(check_csync_statedb_get_stat_by_hash_not_found, setup_db, teardown),
/* unit_test_setup_teardown(check_csync_statedb_get_stat_by_inode, setup_db, teardown), */
unit_test_setup_teardown(check_csync_statedb_get_stat_by_inode_not_found, setup_db, teardown),
};
@@ -233,6 +233,8 @@ static void check_csync_detect_update_db_none(void **state)
st = c_rbtree_node_data(csync->local.tree->root);
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
/* set the instruction to UPDATED that it gets written to the statedb */
st->instruction = CSYNC_INSTRUCTION_UPDATED;
/* create a statedb */
csync_set_status(csync, 0xFFFF);
@@ -260,6 +262,9 @@ static void check_csync_detect_update_db_eval(void **state)
st = c_rbtree_node_data(csync->local.tree->root);
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
/* set the instruction to UPDATED that it gets written to the statedb */
st->instruction = CSYNC_INSTRUCTION_UPDATED;
/* create a statedb */
csync_set_status(csync, 0xFFFF);
@@ -339,6 +344,8 @@ static void check_csync_detect_update_db_new(void **state)
st = c_rbtree_node_data(csync->local.tree->root);
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
/* set the instruction to UPDATED that it gets written to the statedb */
st->instruction = CSYNC_INSTRUCTION_UPDATED;
/* create a statedb */
csync_set_status(csync, 0xFFFF);
+16 -29
Ver Arquivo
@@ -56,13 +56,13 @@ assertLocalDirs( 'toremote1', localDir().'remoteToLocal1' );
# Check if the synced files from ownCloud have the same timestamp as the local ones.
print "\nNow assert remote 'toremote1' with local " . localDir() . " :\n";
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'remoteToLocal1', 0);
# remove a local file.
printInfo( "\nRemove a local file\n" );
unlink( localDir() . 'remoteToLocal1/rtl4/quitte.pdf' );
unlink( localDir() . 'remoteToLocal1/kernelcrash.txt' );
csync();
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'remoteToLocal1', 0);
# add local files to a new dir1
printInfo( "Add some more files to local:");
@@ -76,46 +76,34 @@ foreach my $file ( <./tolocal1/*> ) {
}
csync( );
print "\nAssert local and remote dirs.\n";
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
# move a local file
printInfo( "Move a file locally." );
move( "$locDir/kramer.jpg", "$locDir/oldtimer.jpg" );
csync( );
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
# move a local directory.
printInfo( "Move a local directory." );
move( localDir() . 'remoteToLocal1/rtl1', localDir(). 'remoteToLocal1/rtlX');
csync();
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
# remove a local dir
printInfo( "Remove a local directory.");
localCleanup( 'remoteToLocal1/rtlX' );
csync();
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
assert( ! -e localDir().'remoteToLocal1/rtlX' );
# create twos false conflict, only the mtimes are changed, by content are equal.
printInfo( "Create two false conflict.");
put_to_dir( 'toremote1/kernelcrash.txt', 'remoteToLocal1' );
put_to_dir( 'toremote1/kraft_logo.gif', 'remoteToLocal1' );
# don't wait so mtime are likely the same on the client and the server.
system( "touch " . localDir() . "remoteToLocal1/kraft_logo.gif" );
# wait two second so the mtime are different
# create a false conflict, only the mtimes are changed, by content are equal.
printInfo( "Create a false conflict.");
my $srcFile = 'toremote1/kernelcrash.txt';
put_to_dir( $srcFile, 'remoteToLocal1' );
system( "sleep 2 && touch " . localDir() . "remoteToLocal1/kernelcrash.txt" );
csync( );
assertLocalAndRemoteDir( '', 0);
# The previous sync should have updated the etags, and this should NOT be a conflict
printInfo( "Update the file again");
system("echo more data >> " . localDir() . "remoteToLocal1/kernelcrash.txt");
system("echo corruption >> " . localDir() . "remoteToLocal1/kraft_logo.gif");
csync( );
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
# create a true conflict.
printInfo( "Create a conflict." );
@@ -123,14 +111,13 @@ system( "echo \"This is more stuff\" >> /tmp/kernelcrash.txt" );
put_to_dir( '/tmp/kernelcrash.txt', 'remoteToLocal1' );
system( "sleep 2 && touch " . localDir() . "remoteToLocal1/kernelcrash.txt" );
csync();
assertLocalAndRemoteDir( '', 1);
assertLocalAndRemoteDir( 'remoteToLocal1', 1);
my $localMD5 = md5OfFile( localDir().'remoteToLocal1/kernelcrash.txt' );
my $realMD5 = md5OfFile( '/tmp/kernelcrash.txt' );
print "MD5 compare $localMD5 <-> $realMD5\n";
assert( $localMD5 eq $realMD5 );
assert( glob(localDir().'remoteToLocal1/kernelcrash_conflict-*.txt' ) );
system("rm " . localDir().'remoteToLocal1/kernelcrash_conflict-*.txt' );
# prepare test for issue 1329, rtlX need to be modified
@@ -138,13 +125,13 @@ system("rm " . localDir().'remoteToLocal1/kernelcrash_conflict-*.txt' );
printInfo( "Add a local directory");
system("cp -r 'toremote1/rtl1/' '" . localDir(). "remoteToLocal1/rtlX'");
csync();
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
# remove a local dir (still for issue 1329)
printInfo( "Remove that directory.");
localCleanup( 'remoteToLocal1/rtlX' );
csync();
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
assert( ! -e localDir().'remoteToLocal1/rtlX' );
@@ -154,7 +141,7 @@ system("cp -r 'toremote1/rtl1/' '" . localDir(). "remoteToLocal1/rtlX'");
assert( -e localDir().'remoteToLocal1/rtlX' );
assert( -e localDir().'remoteToLocal1/rtlX/rtl11/file.txt' );
csync();
assertLocalAndRemoteDir( '', 0);
assertLocalAndRemoteDir( 'fromLocal1', 0);
assert( -e localDir().'remoteToLocal1/rtlX' );
assert( -e localDir().'remoteToLocal1/rtlX/rtl11/file.txt' );
+1 -18
Ver Arquivo
@@ -80,6 +80,7 @@ assert( $inode == $inode2, "Inode has changed!");
printInfo("Move a file into a sub directory.");
# now move the file into a sub directory
$inode = getInode('remoteToLocal1/kernel.txt');
moveRemoteFile( 'remoteToLocal1/kernel.txt', 'remoteToLocal1/rtl1/');
csync();
@@ -174,24 +175,6 @@ createLocalFile( localDir(). 'remoteToLocal1/rtl2/newRemoteDir/donat.txt', 8021
csync();
assertLocalAndRemoteDir( 'remoteToLocal1', 1);
printInfo("simulate a owncloud 5 update by removing all the fileid");
## simulate a owncloud 5 update by removing all the fileid
system( "sqlite3 " . localDir() . ".csync_journal.db \"UPDATE metadata SET fileid='';\"");
#refresh the ids
csync();
assertLocalAndRemoteDir( 'remoteToLocal1', 1);
printInfo("Move a file from the server");
$inode = getInode('remoteToLocal1/rtl2/kb1_local_gone.jpg');
moveRemoteFile( 'remoteToLocal1/rtl2/kb1_local_gone.jpg', 'remoteToLocal1/rtl2/kb1_local_gone2.jpg');
csync();
assertLocalAndRemoteDir( 'remoteToLocal1', 1);
$inode2 = getInode('remoteToLocal1/rtl2/kb1_local_gone2.jpg');
assert( $inode == $inode2, "Inode has changed 3!");
cleanup();
# --
@@ -1 +0,0 @@
A nice document.
@@ -1,16 +0,0 @@
freitag@zora:~>
Message from syslogd@zora at Sep 20 21:35:41 ...
kernel:[ 6702.458047] general protection fault: 0000 [#1] PREEMPT SMP
Message from syslogd@zora at Sep 20 21:35:41 ...
kernel:[ 6702.458060] last sysfs file: /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:03/ATK0110:00/hwmon/hwmon0/temp1_label
Message from syslogd@zora at Sep 20 21:35:41 ...
kernel:[ 6702.458232] Stack:
Message from syslogd@zora at Sep 20 21:35:41 ...
kernel:[ 6702.458262] Call Trace:
Message from syslogd@zora at Sep 20 21:35:41 ...
kernel:[ 6702.458375] Code: 00 00 80 00 00 00 48 b9 00 00 00 00 80 ff ff ff 4e 8d 34 30 49 21 ce 48 8b 4c 24 38 49 8d 56 ff 48 3b 54 24 48 4c 0f 43 74 24 40 <48> 8b 11 48 85 d2 0f 84 d4 01 00 00 48 b9 fb 0f 00 00 00 c0 ff
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 6.9 KiB

@@ -0,0 +1 @@
some content.
+8 -5
Ver Arquivo
@@ -12,15 +12,12 @@ if(SPHINX_FOUND)
# assets
set(LATEX_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/logo-blue.pdf")
install(DIRECTORY ${SPHINX_HTML_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
install(DIRECTORY ${SPHINX_MAN_DIR} DESTINATION ${CMAKE_INSTALL_MANDIR} OPTIONAL)
install(DIRECTORY ${SPHINX_PDF_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
install(DIRECTORY ${SPHINX_QCH_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" conf.py @ONLY)
if(WITH_DOC)
add_custom_target(doc ALL DEPENDS doc-html doc-man COMMENT "Building documentation...")
install(DIRECTORY ${SPHINX_HTML_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY ${SPHINX_MAN_DIR} DESTINATION ${CMAKE_INSTALL_MANDIR})
else(WITH_DOC)
add_custom_target(doc DEPENDS doc-html doc-man COMMENT "Building documentation...")
endif(WITH_DOC)
@@ -42,6 +39,9 @@ if(SPHINX_FOUND)
add_custom_target(doc-pdf $(MAKE) -C ${SPHINX_PDF_DIR} all-pdf
DEPENDS doc-latex )
add_dependencies(doc doc-pdf)
if (WITH_DOC)
install(DIRECTORY ${SPHINX_PDF_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif (WITH_DOC)
endif(PDFLATEX_FOUND)
if (EXISTS ${QT_QCOLLECTIONGENERATOR_EXECUTABLE})
add_custom_target( doc-qch-sphinx ${SPHINX_EXECUTABLE}
@@ -53,6 +53,9 @@ if(SPHINX_FOUND)
${SPHINX_QCH_DIR}/*.qhcp
DEPENDS doc-qch-sphinx )
add_dependencies(doc doc-qch)
if (WITH_DOC)
install(DIRECTORY ${SPHINX_QCH_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif (WITH_DOC)
endif()
add_custom_target( doc-html ${SPHINX_EXECUTABLE}
-q -c . -b html
-22
Ver Arquivo
@@ -134,25 +134,3 @@ log line contains a lot of information of every request and it's result.
More information about the apache logging can be found at
``http://httpd.apache.org/docs/current/logs.html``.
Core Dumps
----------
In case of crashes of the client software, having a core dump helps to
debug the issue tremendously.
The client is able to write a core dump in case of crashing on Linux and
MacOSX. To enable that, the environment variable ``OWNCLOUD_CORE_DUMP`` has
to be defined.
For example
```
OWNCLOUD_CORE_DUMP=1 owncloud
```
starts the client with core dumping enabled. Core dumps appear in the
current working directory, and since they can be fairly large, it is
important to have plenty of disk space when running with dumps enabled.
If a core dump file should be transfered back to the developers it
should be compressed properly before.
+1 -1
Ver Arquivo
@@ -80,7 +80,7 @@ Adding a Folder
Adding a new sync is initiated by clicking ``Add Folder...`` in the ``Account``
settings.
..note:: To add a folder, you must not already sync a folder that contains this
..note: To add a folder, you must not already sync a folder that contains this
folder. By default, the wizard sets up the root folder of the ownCloud
server to sync all of your ownCloud account. In consequence, you will
first need to remove this folder prior to specifying new syncs.
+1 -1
Ver Arquivo
@@ -1,5 +1,5 @@
This is the src directory of the QtLockedFile
solution integrated over from Qt's Qt Creator.
solution integrated over from Qt's Qt Creator.
It is required by the QtSingleApplication solution.
+21 -20
Ver Arquivo
@@ -1,31 +1,32 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include "qtlockedfile.h"
+21 -20
Ver Arquivo
@@ -1,31 +1,32 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#ifndef QTLOCKEDFILE_H
#define QTLOCKEDFILE_H
-11
Ver Arquivo
@@ -1,11 +0,0 @@
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/qtlockedfile.h
SOURCES += $$PWD/qtlockedfile.cpp
unix:SOURCES += $$PWD/qtlockedfile_unix.cpp
win32:SOURCES += $$PWD/qtlockedfile_win.cpp
win32:contains(TEMPLATE, lib):contains(CONFIG, shared) {
DEFINES += QT_QTLOCKEDFILE_EXPORT=__declspec(dllexport)
}
+21 -21
Ver Arquivo
@@ -1,31 +1,32 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include "qtlockedfile.h"
@@ -95,7 +96,6 @@ bool QtLockedFile::unlock()
}
m_lock_mode = NoLock;
remove();
return true;
}
+22 -22
Ver Arquivo
@@ -1,31 +1,32 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include "qtlockedfile.h"
@@ -49,7 +50,7 @@ static QString errorCodeToString(DWORD errorCode)
if (data != 0)
LocalFree(data);
if (result.endsWith(QLatin1Char('\n')))
if (result.endsWith('\n'))
result.truncate(result.length() - 1);
return result;
@@ -167,7 +168,6 @@ bool QtLockedFile::unlock()
}
m_lock_mode = QtLockedFile::NoLock;
remove();
return true;
}
+1 -1
Ver Arquivo
@@ -1,5 +1,5 @@
This is the src directory of the QtSingleApplication solution
integrated over from Qt's Qt Creator project.
integrated over from Qt's Qt Creator project.
It additionally requires the QtLockedFile solution.
+47 -55
Ver Arquivo
@@ -1,31 +1,32 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include "qtlocalpeer.h"
@@ -46,31 +47,7 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0;
namespace SharedTools {
static const char ack[] = "ack";
QString QtLocalPeer::appSessionId(const QString &appId)
{
QByteArray idc = appId.toUtf8();
quint16 idNum = qChecksum(idc.constData(), idc.size());
//### could do: two 16bit checksums over separate halves of id, for a 32bit result - improved uniqeness probability. Every-other-char split would be best.
QString res = QLatin1String("qtsingleapplication-")
+ QString::number(idNum, 16);
#if defined(Q_OS_WIN)
if (!pProcessIdToSessionId) {
QLibrary lib(QLatin1String("kernel32"));
pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId");
}
if (pProcessIdToSessionId) {
DWORD sessionId = 0;
pProcessIdToSessionId(GetCurrentProcessId(), &sessionId);
res += QLatin1Char('-') + QString::number(sessionId, 16);
}
#else
res += QLatin1Char('-') + QString::number(::getuid(), 16);
#endif
return res;
}
const char *QtLocalPeer::ack = "ack";
QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId)
: QObject(parent), id(appId)
@@ -78,7 +55,26 @@ QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId)
if (id.isEmpty())
id = QCoreApplication::applicationFilePath(); //### On win, check if this returns .../argv[0] without casefolding; .\MYAPP == .\myapp on Win
socketName = appSessionId(id);
QByteArray idc = id.toUtf8();
quint16 idNum = qChecksum(idc.constData(), idc.size());
//### could do: two 16bit checksums over separate halves of id, for a 32bit result - improved uniqeness probability. Every-other-char split would be best.
socketName = QLatin1String("qtsingleapplication-")
+ QString::number(idNum, 16);
#if defined(Q_OS_WIN)
if (!pProcessIdToSessionId) {
QLibrary lib("kernel32");
pProcessIdToSessionId = (PProcessIdToSessionId)lib.resolve("ProcessIdToSessionId");
}
if (pProcessIdToSessionId) {
DWORD sessionId = 0;
pProcessIdToSessionId(GetCurrentProcessId(), &sessionId);
socketName += QLatin1Char('-') + QString::number(sessionId, 16);
}
#else
socketName += QLatin1Char('-') + QString::number(::getuid(), 16);
#endif
server = new QLocalServer(this);
QString lockName = QDir(QDir::tempPath()).absolutePath()
+ QLatin1Char('/') + socketName
@@ -104,7 +100,7 @@ bool QtLocalPeer::isClient()
return false;
}
bool QtLocalPeer::sendMessage(const QString &message, int timeout, bool block)
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
{
if (!isClient())
return false;
@@ -134,8 +130,6 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout, bool block)
bool res = socket.waitForBytesWritten(timeout);
res &= socket.waitForReadyRead(timeout); // wait for ack
res &= (socket.read(qstrlen(ack)) == ack);
if (block) // block until peer disconnects
socket.waitForDisconnected(-1);
return res;
}
@@ -146,11 +140,8 @@ void QtLocalPeer::receiveConnection()
return;
// Why doesn't Qt have a blocking stream that takes care of this shait???
while (socket->bytesAvailable() < static_cast<int>(sizeof(quint32))) {
if (!socket->isValid()) // stale request
return;
socket->waitForReadyRead(1000);
}
while (socket->bytesAvailable() < static_cast<int>(sizeof(quint32)))
socket->waitForReadyRead();
QDataStream ds(socket);
QByteArray uMsg;
quint32 remaining;
@@ -175,7 +166,8 @@ void QtLocalPeer::receiveConnection()
QString message = QString::fromUtf8(uMsg.constData(), uMsg.size());
socket->write(ack, qstrlen(ack));
socket->waitForBytesWritten(1000);
emit messageReceived(message, socket); // ##(might take a long time to return)
delete socket;
emit messageReceived(message); // ##(might take a long time to return)
}
} // namespace SharedTools
+27 -24
Ver Arquivo
@@ -1,33 +1,34 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include <qtlockedfile.h>
#include "qtlockedfile.h"
#include <QLocalServer>
#include <QLocalSocket>
@@ -42,13 +43,12 @@ class QtLocalPeer : public QObject
public:
explicit QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
bool isClient();
bool sendMessage(const QString &message, int timeout, bool block);
bool sendMessage(const QString &message, int timeout);
QString applicationId() const
{ return id; }
static QString appSessionId(const QString &appId);
Q_SIGNALS:
void messageReceived(const QString &message, QObject *socket);
void messageReceived(const QString &message);
protected Q_SLOTS:
void receiveConnection();
@@ -58,6 +58,9 @@ protected:
QString socketName;
QLocalServer* server;
QtLockedFile lockFile;
private:
static const char* ack;
};
} // namespace SharedTools
+90 -116
Ver Arquivo
@@ -1,123 +1,96 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include "qtsingleapplication.h"
#include "qtlocalpeer.h"
#include <qtlockedfile.h>
#include <QDir>
#include <QFileOpenEvent>
#include <QSharedMemory>
#include <QWidget>
#include <QFileOpenEvent>
namespace SharedTools {
static const int instancesSize = 1024;
static QString instancesLockFilename(const QString &appSessionId)
void QtSingleApplication::sysInit(const QString &appId)
{
const QChar slash(QLatin1Char('/'));
QString res = QDir::tempPath();
if (!res.endsWith(slash))
res += slash;
return res + appSessionId + QLatin1String("-instances");
actWin = 0;
firstPeer = new QtLocalPeer(this, appId);
connect(firstPeer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));
pidPeer = new QtLocalPeer(this, appId + QLatin1Char('-') + QString::number(QCoreApplication::applicationPid(), 10));
connect(pidPeer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));
}
QtSingleApplication::QtSingleApplication(int &argc, char **argv, bool GUIenabled)
: QApplication(argc, argv, GUIenabled)
{
sysInit();
}
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
: QApplication(argc, argv),
firstPeer(-1),
pidPeer(0)
: QApplication(argc, argv)
{
this->appId = appId;
const QString appSessionId = QtLocalPeer::appSessionId(appId);
// This shared memory holds a zero-terminated array of active (or crashed) instances
instances = new QSharedMemory(appSessionId, this);
actWin = 0;
block = false;
// First instance creates the shared memory, later instances attach to it
const bool created = instances->create(instancesSize);
if (!created) {
if (!instances->attach()) {
qWarning() << "Failed to initialize instances shared memory: "
<< instances->errorString();
delete instances;
instances = 0;
return;
}
}
// QtLockedFile is used to workaround QTBUG-10364
QtLockedFile lockfile(instancesLockFilename(appSessionId));
lockfile.open(QtLockedFile::ReadWrite);
lockfile.lock(QtLockedFile::WriteLock);
qint64 *pids = static_cast<qint64 *>(instances->data());
if (!created) {
// Find the first instance that it still running
// The whole list needs to be iterated in order to append to it
for (; *pids; ++pids) {
if (firstPeer == -1 && isRunning(*pids))
firstPeer = *pids;
}
}
// Add current pid to list and terminate it
*pids++ = QCoreApplication::applicationPid();
*pids = 0;
pidPeer = new QtLocalPeer(this, appId + QLatin1Char('-') +
QString::number(QCoreApplication::applicationPid()));
connect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), SIGNAL(messageReceived(QString,QObject*)));
pidPeer->isClient();
lockfile.unlock();
sysInit(appId);
}
QtSingleApplication::~QtSingleApplication()
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QtSingleApplication::QtSingleApplication(int &argc, char **argv, Type type)
: QApplication(argc, argv, type)
{
if (!instances)
return;
const qint64 appPid = QCoreApplication::applicationPid();
QtLockedFile lockfile(instancesLockFilename(QtLocalPeer::appSessionId(appId)));
lockfile.open(QtLockedFile::ReadWrite);
lockfile.lock(QtLockedFile::WriteLock);
// Rewrite array, removing current pid and previously crashed ones
qint64 *pids = static_cast<qint64 *>(instances->data());
qint64 *newpids = pids;
for (; *pids; ++pids) {
if (*pids != appPid && isRunning(*pids))
*newpids++ = *pids;
}
*newpids = 0;
lockfile.unlock();
sysInit();
}
#endif
#if defined(Q_WS_X11)
QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap)
: QApplication(dpy, visual, colormap)
{
sysInit();
}
QtSingleApplication::QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE cmap)
: QApplication(dpy, argc, argv, visual, cmap)
{
sysInit();
}
QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId,
int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap)
: QApplication(dpy, argc, argv, visual, colormap)
{
this->appId = appId;
sysInit(appId);
}
#endif
bool QtSingleApplication::event(QEvent *event)
{
@@ -131,26 +104,31 @@ bool QtSingleApplication::event(QEvent *event)
bool QtSingleApplication::isRunning(qint64 pid)
{
if (pid == -1) {
pid = firstPeer;
if (pid == -1)
return false;
}
if (pid == -1)
return firstPeer->isClient();
QtLocalPeer peer(this, appId + QLatin1Char('-') + QString::number(pid, 10));
return peer.isClient();
}
void QtSingleApplication::initialize(bool)
{
firstPeer->isClient();
pidPeer->isClient();
}
bool QtSingleApplication::sendMessage(const QString &message, int timeout, qint64 pid)
{
if (pid == -1) {
pid = firstPeer;
if (pid == -1)
return false;
}
if (pid == -1)
return firstPeer->sendMessage(message, timeout);
QtLocalPeer peer(this, appId + QLatin1Char('-') + QString::number(pid, 10));
return peer.sendMessage(message, timeout, block);
return peer.sendMessage(message, timeout);
}
QString QtSingleApplication::id() const
{
return firstPeer->applicationId();
}
QString QtSingleApplication::applicationId() const
@@ -158,20 +136,16 @@ QString QtSingleApplication::applicationId() const
return appId;
}
void QtSingleApplication::setBlock(bool value)
{
block = value;
}
void QtSingleApplication::setActivationWindow(QWidget *aw, bool activateOnMessage)
{
actWin = aw;
if (!pidPeer)
return;
if (activateOnMessage)
connect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), this, SLOT(activateWindow()));
else
disconnect(pidPeer, SIGNAL(messageReceived(QString,QObject*)), this, SLOT(activateWindow()));
if (activateOnMessage) {
connect(firstPeer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
connect(pidPeer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
} else {
disconnect(firstPeer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
disconnect(pidPeer, SIGNAL(messageReceived(QString)), this, SLOT(activateWindow()));
}
}
+46 -34
Ver Arquivo
@@ -1,39 +1,38 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#ifndef QTSINGLEAPPLICATION_H
#define QTSINGLEAPPLICATION_H
#ifndef _SHAREDTOOLS_SINGLEAPPLICATION
#define _SHAREDTOOLS_SINGLEAPPLICATION
#include <QApplication>
QT_FORWARD_DECLARE_CLASS(QSharedMemory)
namespace SharedTools {
class QtLocalPeer;
@@ -43,37 +42,50 @@ class QtSingleApplication : public QApplication
Q_OBJECT
public:
QtSingleApplication(int &argc, char **argv, bool GUIenabled = true);
QtSingleApplication(const QString &id, int &argc, char **argv);
~QtSingleApplication();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QtSingleApplication(int &argc, char **argv, Type type);
#endif
#if defined(Q_WS_X11)
explicit QtSingleApplication(Display *dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
QtSingleApplication(Display *dpy, int &argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE cmap = 0);
#endif
bool isRunning(qint64 pid = -1);
QString id() const;
void setActivationWindow(QWidget* aw, bool activateOnMessage = true);
QWidget* activationWindow() const;
bool event(QEvent *event);
QString applicationId() const;
void setBlock(bool value);
public Q_SLOTS:
bool sendMessage(const QString &message, int timeout = 5000, qint64 pid = -1);
void activateWindow();
//Obsolete methods:
public:
void initialize(bool = true);
#if defined(Q_WS_X11)
QtSingleApplication(Display* dpy, const QString &id, int argc, char **argv, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
#endif
// end obsolete methods
Q_SIGNALS:
void messageReceived(const QString &message, QObject *socket);
void messageReceived(const QString &message);
void fileOpenRequest(const QString &file);
private:
QString instancesFileName(const QString &appId);
qint64 firstPeer;
QSharedMemory *instances;
void sysInit(const QString &appId = QString());
QtLocalPeer *firstPeer;
QtLocalPeer *pidPeer;
QWidget *actWin;
QString appId;
bool block;
};
} // namespace SharedTools
#endif // QTSINGLEAPPLICATION_H
#endif // _SHAREDTOOLS_SINGLEAPPLICATION
-15
Ver Arquivo
@@ -1,15 +0,0 @@
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/qtsingleapplication.h $$PWD/qtlocalpeer.h
SOURCES += $$PWD/qtsingleapplication.cpp $$PWD/qtlocalpeer.cpp
QT *= network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
gotqtlockedfile = $$find(HEADERS, .*qtlockedfile.h)
isEmpty(gotqtlockedfile):include(../qtlockedfile/qtlockedfile.pri)
win32:contains(TEMPLATE, lib):contains(CONFIG, shared) {
DEFINES += QT_QTSINGLEAPPLICATION_EXPORT=__declspec(dllexport)
}
+22 -27
Ver Arquivo
@@ -1,31 +1,32 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include "qtsinglecoreapplication.h"
#include "qtlocalpeer.h"
@@ -36,7 +37,6 @@ QtSingleCoreApplication::QtSingleCoreApplication(int &argc, char **argv)
: QCoreApplication(argc, argv)
{
peer = new QtLocalPeer(this);
block = false;
connect(peer, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));
}
@@ -57,7 +57,7 @@ bool QtSingleCoreApplication::isRunning()
bool QtSingleCoreApplication::sendMessage(const QString &message, int timeout)
{
return peer->sendMessage(message, timeout, block);
return peer->sendMessage(message, timeout);
}
@@ -66,9 +66,4 @@ QString QtSingleCoreApplication::id() const
return peer->applicationId();
}
void QtSingleCoreApplication::setBlock(bool value)
{
block = value;
}
} // namespace SharedTools
+21 -22
Ver Arquivo
@@ -1,31 +1,32 @@
/****************************************************************************
/**************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** This file is part of Qt Creator
**
** This file is part of Qt Creator.
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: http://www.qt-project.org/
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**************************************************************************/
#include <QCoreApplication>
@@ -43,7 +44,6 @@ public:
bool isRunning();
QString id() const;
void setBlock(bool value);
public Q_SLOTS:
bool sendMessage(const QString &message, int timeout = 5000);
@@ -55,7 +55,6 @@ Q_SIGNALS:
private:
QtLocalPeer* peer;
bool block;
};
} // namespace SharedTools
@@ -1,14 +0,0 @@
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
HEADERS += $$PWD/qtsinglecoreapplication.h $$PWD/qtlocalpeer.h
SOURCES += $$PWD/qtsinglecoreapplication.cpp $$PWD/qtlocalpeer.cpp
QT *= network
gotqtlockedfile = $$find(HEADERS, .*qtlockedfile.h)
isEmpty(gotqtlockedfile):include(../qtlockedfile/qtlockedfile.pri)
win32:contains(TEMPLATE, lib):contains(CONFIG, shared) {
DEFINES += QT_QTSINGLECOREAPPLICATION_EXPORT=__declspec(dllexport)
}
+36 -47
Ver Arquivo
@@ -1,5 +1,4 @@
set(CMAKE_AUTOMOC TRUE)
include(GenerateExportHeader)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
@@ -28,9 +27,9 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
if(SPARKLE_FOUND AND NOT BUILD_LIBRARIES_ONLY)
if(SPARKLE_FOUND)
list (APPEND OS_SPECIFIC_LINK_LIBRARIES ${SPARKLE_LIBRARY})
endif()
endif(SPARKLE_FOUND)
set(3rdparty_SRC
3rdparty/qtsingleapplication/qtsingleapplication.cpp
@@ -104,7 +103,6 @@ set(libsync_SRCS
mirall/quotainfo.cpp
mirall/clientproxy.cpp
mirall/syncrunfilelog.cpp
mirall/cookiejar.cpp
creds/dummycredentials.cpp
creds/abstractcredentials.cpp
creds/credentialsfactory.cpp
@@ -117,16 +115,19 @@ if(TOKEN_AUTH_ONLY)
${libsync_SRCS}
creds/tokencredentials.cpp
)
else()
set (libsync_SRCS
${libsync_SRCS}
creds/httpcredentials.cpp
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethrefresher.cpp
creds/shibboleth/authenticationdialog.cpp
creds/shibboleth/shibbolethuserjob.cpp
)
else()
set (libsync_SRCS
${libsync_SRCS}
creds/httpcredentials.cpp
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethaccessmanager.cpp
creds/shibboleth/shibbolethcookiejar.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethrefresher.cpp
creds/shibboleth/shibbolethconfigfile.cpp
creds/shibboleth/authenticationdialog.cpp
creds/shibboleth/shibbolethuserjob.cpp
)
endif()
IF( NOT WIN32 AND NOT APPLE )
@@ -194,19 +195,7 @@ if(NEON_FOUND)
endif()
add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc})
GENERATE_EXPORT_HEADER( ${synclib_NAME}
BASE_NAME ${synclib_NAME}
EXPORT_MACRO_NAME OWNCLOUDSYNC_EXPORT
EXPORT_FILE_NAME owncloudlib.h
STATIC_DEFINE OWNCLOUD_BUILT_AS_STATIC
)
if(TOKEN_AUTH_ONLY)
qt5_use_modules(${synclib_NAME} Network Xml Sql)
else()
qt5_use_modules(${synclib_NAME} Widgets Network Xml WebKitWidgets Sql)
endif()
qt5_use_modules(${synclib_NAME} Widgets Network Xml WebKitWidgets Sql)
set_target_properties( ${synclib_NAME} PROPERTIES
VERSION ${MIRALL_VERSION}
@@ -218,15 +207,15 @@ set_target_properties( ${synclib_NAME} PROPERTIES
target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} )
if(BUILD_LIBRARIES_ONLY)
#add_library(${synclib_NAME}_static STATIC ${libsync_SRCS} ${syncMoc})
#qt5_use_modules(${synclib_NAME}_static Widgets Network Xml Sql)
add_library(${synclib_NAME}_static STATIC ${libsync_SRCS} ${syncMoc})
qt5_use_modules(${synclib_NAME}_static Widgets Network Xml WebKitWidgets Sql)
#set_target_properties( ${synclib_NAME}_static PROPERTIES
# VERSION ${MIRALL_VERSION}
# SOVERSION ${MIRALL_SOVERSION}
#)
set_target_properties( ${synclib_NAME}_static PROPERTIES
VERSION ${MIRALL_VERSION}
SOVERSION ${MIRALL_SOVERSION}
)
#target_link_libraries(${synclib_NAME}_static ${libsync_LINK_TARGETS} )
target_link_libraries(${synclib_NAME}_static ${libsync_LINK_TARGETS} )
endif()
@@ -389,17 +378,17 @@ if (WITH_DBUS)
set(ADDITIONAL_APP_MODULES DBus)
endif(WITH_DBUS)
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
if(NOT WIN32)
file( GLOB _icons "${theme_dir}/colored/${ICON_APP_NAME}-icon-*.png" )
foreach( _file ${_icons} )
string( REPLACE "${theme_dir}/colored/${ICON_APP_NAME}-icon-" "" _res ${_file} )
string( REPLACE ".png" "" _res ${_res} )
install( FILES ${_file} RENAME ${ICON_APP_NAME}.png DESTINATION ${DATADIR}/icons/hicolor/${_res}x${_res}/apps )
endforeach( _file )
endif(NOT WIN32)
if(NOT WIN32 AND NOT BUILD_LIBRARIES_ONLY)
file( GLOB _icons "${theme_dir}/colored/${ICON_APP_NAME}-icon-*.png" )
foreach( _file ${_icons} )
string( REPLACE "${theme_dir}/colored/${ICON_APP_NAME}-icon-" "" _res ${_file} )
string( REPLACE ".png" "" _res ${_res} )
install( FILES ${_file} RENAME ${ICON_APP_NAME}.png DESTINATION ${DATADIR}/icons/hicolor/${_res}x${_res}/apps )
endforeach( _file )
endif(NOT WIN32 AND NOT BUILD_LIBRARIES_ONLY)
install(FILES ${mirall_I18N} DESTINATION share/${APPLICATION_EXECUTABLE}/i18n)
@@ -431,11 +420,11 @@ elseif(NOT BUILD_LIBRARIES_ONLY)
install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR})
endif()
if(NOT BUILD_LIBRARIES_ONLY)
add_library(updater STATIC ${updater_SRCS} ${updaterMoc})
target_link_libraries(updater ${synclib_NAME})
qt5_use_modules(updater Widgets Network Xml)
add_library(updater STATIC ${updater_SRCS} ${updaterMoc})
target_link_libraries(updater ${synclib_NAME})
qt5_use_modules(updater Widgets Network Xml)
if(NOT BUILD_LIBRARIES_ONLY)
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
)
+1 -3
Ver Arquivo
@@ -17,8 +17,6 @@
#include <QObject>
#include <csync.h>
#include "owncloudlib.h"
class QNetworkAccessManager;
class QNetworkReply;
@@ -26,7 +24,7 @@ namespace Mirall
{
class Account;
class OWNCLOUDSYNC_EXPORT AbstractCredentials : public QObject
class AbstractCredentials : public QObject
{
Q_OBJECT
-1
Ver Arquivo
@@ -13,7 +13,6 @@
#include <QString>
#include "creds/credentialsfactory.h"
#ifdef TOKEN_AUTH_ONLY
#include "creds/tokencredentials.h"
#else
+2 -4
Ver Arquivo
@@ -14,18 +14,16 @@
#ifndef MIRALL_CREDS_CREDENTIALS_FACTORY_H
#define MIRALL_CREDS_CREDENTIALS_FACTORY_H
#include "owncloudlib.h"
class AbstractCredentials;
class QString;
namespace Mirall
{
class AbstractCredentials;
namespace CredentialsFactory
{
OWNCLOUDSYNC_EXPORT AbstractCredentials* create(const QString& type);
AbstractCredentials* create(const QString& type);
} // ns CredentialsFactory
+1 -5
Ver Arquivo
@@ -141,11 +141,7 @@ void HttpCredentials::syncContextPreStart (CSYNC* ctx)
bool HttpCredentials::changed(AbstractCredentials* credentials) const
{
HttpCredentials* other(qobject_cast< HttpCredentials* >(credentials));
if (!other) {
return true;
}
HttpCredentials* other(dynamic_cast< HttpCredentials* >(credentials));
if (!other || (other->user() != this->user())) {
return true;
+1 -1
Ver Arquivo
@@ -30,7 +30,7 @@ class Job;
namespace Mirall
{
class OWNCLOUDSYNC_EXPORT HttpCredentials : public AbstractCredentials
class HttpCredentials : public AbstractCredentials
{
Q_OBJECT
@@ -0,0 +1,55 @@
/*
* Copyright (C) by Krzesimir Nowak <krzesimir@endocode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <QDebug>
#include <QNetworkRequest>
#include <QNetworkCookieJar>
#include "creds/shibboleth/shibbolethaccessmanager.h"
namespace Mirall
{
ShibbolethAccessManager::ShibbolethAccessManager(const QNetworkCookie& cookie, QObject* parent)
: MirallAccessManager (parent),
_cookie(cookie)
{}
QNetworkReply* ShibbolethAccessManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest& request, QIODevice* outgoingData)
{
if (!_cookie.name().isEmpty()) {
QNetworkCookieJar* jar(cookieJar());
QUrl url(request.url());
QList<QNetworkCookie> cookies;
Q_FOREACH(const QNetworkCookie& cookie, jar->cookiesForUrl(url)) {
if (!cookie.name().startsWith("_shibsession_")) {
cookies << cookie;
}
}
cookies << _cookie; // this line and the line above replace all cookies with self and then add the shibboleth cookie (filtering the current shib cookie)
jar->setCookiesFromUrl(cookies, url);
}
qDebug() << "Creating a request to " << request.url().toString() << " with shibboleth cookie:" << _cookie.name();
return MirallAccessManager::createRequest (op, request, outgoingData);
}
void ShibbolethAccessManager::setCookie(const QNetworkCookie& cookie)
{
qDebug() << "Got new shibboleth cookie:" << cookie.name();
_cookie = cookie;
}
} // ns Mirall
@@ -0,0 +1,43 @@
/*
* Copyright (C) by Krzesimir Nowak <krzesimir@endocode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef MIRALL_WIZARD_SHIBBOLETH_ACCESS_MANAGER_H
#define MIRALL_WIZARD_SHIBBOLETH_ACCESS_MANAGER_H
#include <QNetworkCookie>
#include "mirall/mirallaccessmanager.h"
namespace Mirall
{
class ShibbolethAccessManager : public MirallAccessManager
{
Q_OBJECT
public:
ShibbolethAccessManager(const QNetworkCookie& cookie, QObject* parent = 0);
public Q_SLOTS:
void setCookie(const QNetworkCookie& cookie);
protected:
QNetworkReply* createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest& request, QIODevice* outgoingData = 0);
private:
QNetworkCookie _cookie;
};
} // ns Mirall
#endif
+104
Ver Arquivo
@@ -0,0 +1,104 @@
/*
* Copyright (C) by Krzesimir Nowak <krzesimir@endocode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <QDebug>
#include <QTextStream>
#include "creds/shibboleth/shibbolethconfigfile.h"
#include "creds/shibboleth/shibbolethcookiejar.h"
namespace Mirall
{
namespace
{
const char otherCookiesC[] = "otherCookies";
} // ns
void ShibbolethConfigFile::storeCookies(const QMap<QUrl, QList<QNetworkCookie> >& cookiesForUrl)
{
if (cookiesForUrl.isEmpty()) {
removeData(QString(), QString::fromLatin1(otherCookiesC));
} else {
QByteArray data;
QTextStream stream(&data);
Q_FOREACH (const QUrl& url, cookiesForUrl.keys()) {
const QList<QNetworkCookie>& cookies(cookiesForUrl[url]);
if (cookies.isEmpty()) {
continue;
}
stream << "URL: " << url.toString().toUtf8() << "\n";
qDebug() << "URL: " << url.toString().toUtf8();
Q_FOREACH (const QNetworkCookie& cookie, cookies) {
stream << cookie.toRawForm(QNetworkCookie::NameAndValueOnly) << "\n";
qDebug() << cookie.toRawForm(QNetworkCookie::NameAndValueOnly);
}
}
stream.flush();
const QByteArray encodedCookies(data.toBase64());
qDebug() << "Raw cookies:\n" << data;
qDebug() << "Encoded cookies: " << encodedCookies;
storeData(QString(), QString::fromLatin1(otherCookiesC), QVariant(encodedCookies));
}
}
ShibbolethCookieJar* ShibbolethConfigFile::createCookieJar() const
{
ShibbolethCookieJar* jar = new ShibbolethCookieJar();
const QVariant variant(retrieveData(QString(), QString::fromLatin1(otherCookiesC)));
if (variant.isValid()) {
QByteArray data(QByteArray::fromBase64(variant.toByteArray()));
QTextStream stream (&data);
const QString urlHeader(QString::fromLatin1("URL: "));
QUrl currentUrl;
QList<QNetworkCookie> currentCookies;
qDebug() << "Got valid cookies variant: " << data;
while (!stream.atEnd()) {
const QString line(stream.readLine());
qDebug() << line;
if (line.startsWith(urlHeader)) {
if (!currentUrl.isEmpty() && !currentCookies.isEmpty()) {
jar->setCookiesFromUrl(currentCookies, currentUrl);
currentCookies.clear();
currentUrl.clear();
}
currentUrl = QUrl(line.mid(5));
} else if (!currentUrl.isEmpty()) {
const int equalPos(line.indexOf('='));
currentCookies << QNetworkCookie(line.left(equalPos).toUtf8(), line.mid(equalPos + 1).toUtf8());
}
}
if (!currentUrl.isEmpty() && !currentCookies.isEmpty()) {
jar->setCookiesFromUrl(currentCookies, currentUrl);
}
}
return jar;
}
} // ns Mirall
+38
Ver Arquivo
@@ -0,0 +1,38 @@
/*
* Copyright (C) by Krzesimir Nowak <krzesimir@endocode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef MIRALL_CREDS_SHIBBOLETH_CONFIG_FILE_H
#define MIRALL_CREDS_SHIBBOLETH_CONFIG_FILE_H
#include <QList>
#include <QMap>
#include <QNetworkCookie>
#include <QUrl>
#include "mirall/mirallconfigfile.h"
namespace Mirall
{
class ShibbolethCookieJar;
class ShibbolethConfigFile : public MirallConfigFile
{
public:
void storeCookies(const QMap<QUrl, QList<QNetworkCookie> >& cookies);
ShibbolethCookieJar* createCookieJar() const;
};
} // ns Mirall
#endif
+34
Ver Arquivo
@@ -0,0 +1,34 @@
/*
* Copyright (C) by Krzesimir Nowak <krzesimir@endocode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "creds/shibboleth/shibbolethcookiejar.h"
namespace Mirall
{
ShibbolethCookieJar::ShibbolethCookieJar (QObject* parent)
: QNetworkCookieJar (parent)
{}
bool ShibbolethCookieJar::setCookiesFromUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url)
{
if (QNetworkCookieJar::setCookiesFromUrl (cookieList, url)) {
Q_EMIT newCookiesForUrl (cookieList, url);
return true;
}
return false;
}
} // ns Mirall
+41
Ver Arquivo
@@ -0,0 +1,41 @@
/*
* Copyright (C) by Krzesimir Nowak <krzesimir@endocode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef MIRALL_WIZARD_SHIBBOLETH_COOKIE_JAR_H
#define MIRALL_WIZARD_SHIBBOLETH_COOKIE_JAR_H
#include <QNetworkCookieJar>
#include <QList>
class QUrl;
class QNetworkCookie;
namespace Mirall
{
class ShibbolethCookieJar : public QNetworkCookieJar
{
Q_OBJECT
public:
ShibbolethCookieJar (QObject* parent = 0);
virtual bool setCookiesFromUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url);
Q_SIGNALS:
void newCookiesForUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url);
};
} // ns Mirall
#endif
+1 -1
Ver Arquivo
@@ -47,7 +47,7 @@ bool ShibbolethUserJob::finished()
}
QString user = json.value("ocs").toMap().value("data").toMap().value("id").toString();
//qDebug() << "cloud/user: " << json << "->" << user;
qDebug() << "cloud/user: " << json << "->" << user;
emit userFetched(user);
return true;
}
+53 -40
Ver Arquivo
@@ -14,53 +14,54 @@
#include <QApplication>
#include <QDebug>
#include <QNetworkCookie>
#include <QNetworkCookieJar>
#include <QWebFrame>
#include <QWebPage>
#include <QMessageBox>
#include <QAuthenticator>
#include <QNetworkReply>
#include "creds/shibboleth/authenticationdialog.h"
#include "creds/shibboleth/shibbolethcookiejar.h"
#include "creds/shibboleth/shibbolethwebview.h"
#include "creds/shibbolethcredentials.h"
#include "creds/shibboleth/authenticationdialog.h"
#include "mirall/account.h"
#include "mirall/logger.h"
#include "mirall/mirallaccessmanager.h"
#include "mirall/theme.h"
namespace Mirall
{
ShibbolethWebView::ShibbolethWebView(Account* account, QWidget* parent)
: QWebView(parent)
, _account(account)
, _accepted(false)
void ShibbolethWebView::setup(Account *account, ShibbolethCookieJar* jar)
{
// no minimize
setWindowFlags(Qt::Dialog);
setAttribute(Qt::WA_DeleteOnClose);
_account = account;
MirallAccessManager* nm = new MirallAccessManager(this);
// we need our own QNAM, but the we offload the SSL error handling to
// the account object, which already can do this
connect(nm, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
account, SLOT(slotHandleErrors(QNetworkReply*,QList<QSslError>)));
connect(nm, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
SLOT(slotHandleAuthentication(QNetworkReply*,QAuthenticator*)));
QWebPage* page = new QWebPage(this);
page->setNetworkAccessManager(account->networkAccessManager());
jar->setParent(this);
connect(jar, SIGNAL (newCookiesForUrl (QList<QNetworkCookie>, QUrl)),
this, SLOT (onNewCookiesForUrl (QList<QNetworkCookie>, QUrl)));
connect(page, SIGNAL(loadStarted()),
this, SLOT(slotLoadStarted()));
connect(page, SIGNAL(loadFinished(bool)),
this, SLOT(slotLoadFinished(bool)));
connect(page->networkAccessManager()->cookieJar(),
SIGNAL(newCookiesForUrl (QList<QNetworkCookie>, QUrl)),
this, SLOT(onNewCookiesForUrl (QList<QNetworkCookie>, QUrl)));
nm->setCookieJar(jar);
page->setNetworkAccessManager(nm);
page->mainFrame()->load(account->url());
this->setPage(page);
setWindowTitle(tr("%1 - Authenticate").arg(Theme::instance()->appNameGUI()));
}
// If we have a valid cookie, it's most likely expired. We can use this as
// as a criteria to tell the user why the browser window pops up
QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account, ShibbolethCredentials::accountCookies(_account));
if (shibCookie != QNetworkCookie()) {
Logger::instance()->postOptionalGuiLog(tr("Reauthentication required"), tr("Your session has expired. You need to re-login to continue to use the client."));
}
ShibbolethWebView::ShibbolethWebView(Account* account, QWidget* parent)
: QWebView(parent)
{
setup(account, new ShibbolethCookieJar(this));
}
ShibbolethWebView::~ShibbolethWebView()
@@ -68,24 +69,41 @@ ShibbolethWebView::~ShibbolethWebView()
slotLoadFinished();
}
void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url)
ShibbolethWebView::ShibbolethWebView(Account* account, ShibbolethCookieJar* jar, QWidget* parent)
: QWebView(parent)
{
if (url.host() == _account->url().host()) {
QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account, cookieList);
if (shibCookie != QNetworkCookie()) {
Q_EMIT shibbolethCookieReceived(shibCookie, _account);
accept();
close();
}
}
setup(account, jar);
}
void ShibbolethWebView::closeEvent(QCloseEvent *event)
void ShibbolethWebView::onNewCookiesForUrl (const QList<QNetworkCookie>& cookieList, const QUrl& url)
{
if (!_accepted) {
Q_EMIT rejected();
QList<QNetworkCookie> otherCookies;
QNetworkCookie shibCookie;
Q_FOREACH (const QNetworkCookie& cookie, cookieList) {
if (cookie.name().startsWith ("_shibsession_")) {
if (shibCookie.name().isEmpty()) {
shibCookie = cookie;
} else {
qWarning() << "Too many Shibboleth session cookies at once!";
}
} else {
otherCookies << cookie;
}
QWebView::closeEvent(event);
}
if (!otherCookies.isEmpty()) {
Q_EMIT otherCookiesReceived(otherCookies, url);
}
if (!shibCookie.name().isEmpty()) {
Q_EMIT shibbolethCookieReceived(shibCookie, _account);
}
}
void ShibbolethWebView::hideEvent(QHideEvent* event)
{
Q_EMIT viewHidden();
QWebView::hideEvent(event);
}
void ShibbolethWebView::slotLoadStarted()
@@ -124,9 +142,4 @@ void ShibbolethWebView::slotHandleAuthentication(QNetworkReply *reply, QAuthenti
}
}
void ShibbolethWebView::accept()
{
_accepted = true;
}
} // ns Mirall
+6 -9
Ver Arquivo
@@ -14,7 +14,6 @@
#ifndef MIRALL_WIZARD_SHIBBOLETH_WEB_VIEW_H
#define MIRALL_WIZARD_SHIBBOLETH_WEB_VIEW_H
#include "owncloudlib.h"
#include <QList>
#include <QPointer>
#include <QWebView>
@@ -28,7 +27,7 @@ namespace Mirall
class ShibbolethCookieJar;
class Account;
class OWNCLOUDSYNC_EXPORT ShibbolethWebView : public QWebView
class ShibbolethWebView : public QWebView
{
Q_OBJECT
@@ -37,11 +36,13 @@ public:
ShibbolethWebView(Account *account, ShibbolethCookieJar* jar, QWidget* parent = 0);
~ShibbolethWebView();
void closeEvent(QCloseEvent *event);
protected:
void hideEvent(QHideEvent* event);
Q_SIGNALS:
void shibbolethCookieReceived(const QNetworkCookie &cookie, Account *account);
void rejected();
void shibbolethCookieReceived(const QNetworkCookie& cookie, Account* account);
void viewHidden();
void otherCookiesReceived(const QList<QNetworkCookie>& cookieList, const QUrl& url);
private Q_SLOTS:
void onNewCookiesForUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url);
@@ -49,13 +50,9 @@ private Q_SLOTS:
void slotLoadFinished(bool success = true);
void slotHandleAuthentication(QNetworkReply*,QAuthenticator*);
protected:
void accept();
private:
void setup(Account *account, ShibbolethCookieJar* jar);
QPointer<Account> _account;
bool _accepted;
};
} // ns Mirall
+85 -82
Ver Arquivo
@@ -16,19 +16,18 @@
#include <QSettings>
#include <QNetworkReply>
#include <QMessageBox>
#include <QDebug>
#include <qdebug.h>
#include "creds/shibbolethcredentials.h"
#include "creds/shibboleth/shibbolethaccessmanager.h"
#include "creds/shibboleth/shibbolethwebview.h"
#include "creds/shibboleth/shibbolethrefresher.h"
#include "creds/shibbolethcredentials.h"
#include "creds/shibboleth/shibbolethconfigfile.h"
#include "shibboleth/shibbolethuserjob.h"
#include "creds/credentialscommon.h"
#include "mirall/mirallaccessmanager.h"
#include "mirall/account.h"
#include "mirall/theme.h"
#include "mirall/cookiejar.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qt5keychain/keychain.h>
@@ -44,9 +43,7 @@ namespace Mirall
namespace
{
// Not "user" because it has a special meaning for http
const char userC[] = "shib_user";
const char shibCookieNameC[] = "_shibsession_";
const char userC[] = "user";
int shibboleth_redirect_callback(CSYNC* csync_ctx,
const char* uri)
@@ -68,6 +65,7 @@ int shibboleth_redirect_callback(CSYNC* csync_ctx,
Account *account = AccountManager::instance()->account();
ShibbolethCredentials* creds = qobject_cast<ShibbolethCredentials*>(account->credentials());
if (!creds) {
qDebug() << "Not a Shibboleth creds instance!";
return 1;
@@ -86,9 +84,18 @@ int shibboleth_redirect_callback(CSYNC* csync_ctx,
ShibbolethCredentials::ShibbolethCredentials()
: AbstractCredentials(),
_url(),
_shibCookie(),
_ready(false),
_stillValid(false),
_browser(0)
_browser(0),
_otherCookies()
{}
ShibbolethCredentials::ShibbolethCredentials(const QNetworkCookie& cookie, const QMap<QUrl, QList<QNetworkCookie> >& otherCookies)
: _shibCookie(cookie),
_ready(true),
_browser(0),
_otherCookies(otherCookies)
{}
void ShibbolethCredentials::syncContextPreInit(CSYNC* ctx)
@@ -103,11 +110,29 @@ QByteArray ShibbolethCredentials::prepareCookieData() const
// have any way to get "session_key" module property from
// csync. Had we have it, then we could just append shibboleth
// cookies to the "session_key" value and set it in csync module.
Account *account = AccountManager::instance()->account();
QList<QNetworkCookie> cookies = accountCookies(account);
QList<QNetworkCookie> cookies(AccountManager::instance()->account()->lastAuthCookies());
QMap<QString, QString> uniqueCookies;
foreach(const QNetworkCookie &cookie, cookies) {
cookiesAsString += cookie.toRawForm(QNetworkCookie::NameAndValueOnly) + QLatin1String("; ");
cookies << _shibCookie;
// Stuff cookies inside csync, then we can avoid the intermediate HTTP 401 reply
// when https://github.com/owncloud/core/pull/4042 is merged.
foreach(QNetworkCookie c, cookies) {
const QString cookieName(c.name());
if (cookieName.startsWith("_shibsession_")) {
continue;
}
uniqueCookies.insert(cookieName, c.value());
}
if (!_shibCookie.name().isEmpty()) {
uniqueCookies.insert(_shibCookie.name(), _shibCookie.value());
}
foreach(const QString& cookieName, uniqueCookies.keys()) {
cookiesAsString += cookieName;
cookiesAsString += '=';
cookiesAsString += uniqueCookies[cookieName];
cookiesAsString += "; ";
}
return cookiesAsString.toLatin1();
@@ -125,13 +150,9 @@ void ShibbolethCredentials::syncContextPreStart (CSYNC* ctx)
bool ShibbolethCredentials::changed(AbstractCredentials* credentials) const
{
ShibbolethCredentials* other(qobject_cast< ShibbolethCredentials* >(credentials));
ShibbolethCredentials* other(dynamic_cast< ShibbolethCredentials* >(credentials));
if (!other) {
return true;
}
if (_shibCookie != other->_shibCookie || _user != other->_user) {
if (!other || other->cookie() != this->cookie()) {
return true;
}
@@ -148,9 +169,17 @@ QString ShibbolethCredentials::user() const
return _user;
}
QNetworkCookie ShibbolethCredentials::cookie() const
{
return _shibCookie;
}
QNetworkAccessManager* ShibbolethCredentials::getQNAM() const
{
QNetworkAccessManager* qnam(new MirallAccessManager);
ShibbolethAccessManager* qnam(new ShibbolethAccessManager(_shibCookie));
connect(this, SIGNAL(newCookie(QNetworkCookie)),
qnam, SLOT(setCookie(QNetworkCookie)));
connect(qnam, SIGNAL(finished(QNetworkReply*)),
this, SLOT(slotReplyFinished(QNetworkReply*)));
return qnam;
@@ -158,10 +187,6 @@ QNetworkAccessManager* ShibbolethCredentials::getQNAM() const
void ShibbolethCredentials::slotReplyFinished(QNetworkReply* r)
{
if (!_browser.isNull()) {
return;
}
QVariant target = r->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (target.isValid()) {
_stillValid = false;
@@ -205,29 +230,44 @@ bool ShibbolethCredentials::stillValid(QNetworkReply *reply)
void ShibbolethCredentials::persist(Account* account)
{
ShibbolethConfigFile cfg;
cfg.storeCookies(_otherCookies);
storeShibCookie(_shibCookie, account);
if (!_user.isEmpty()) {
if (!_user.isEmpty())
account->setCredentialSetting(QLatin1String(userC), _user);
}
}
// only used by Application::slotLogout(). Use invalidateAndFetch for normal usage
void ShibbolethCredentials::invalidateToken(Account *account)
{
CookieJar *jar = static_cast<CookieJar*>(account->networkAccessManager()->cookieJar());
jar->deleteCookie(_shibCookie);
jar->clearSessionCookies();
removeShibCookie(account);
Q_UNUSED(account)
_shibCookie = QNetworkCookie();
storeShibCookie(_shibCookie, account); // store/erase cookie
// ### access to ctx missing, but might not be required at all
//csync_set_module_property(ctx, "session_key", "");
}
void ShibbolethCredentials::onShibbolethCookieReceived(const QNetworkCookie& shibCookie, Account *account)
void ShibbolethCredentials::disposeBrowser()
{
storeShibCookie(shibCookie, account);
_shibCookie = shibCookie;
addToCookieJar(shibCookie);
qDebug() << Q_FUNC_INFO;
disconnect(_browser, SIGNAL(viewHidden()),
this, SLOT(slotBrowserHidden()));
disconnect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
this, SLOT(onShibbolethCookieReceived(QNetworkCookie, Account*)));
_browser->hide();
_browser->deleteLater();
_browser = 0;
}
void ShibbolethCredentials::onShibbolethCookieReceived(const QNetworkCookie& cookie, Account* account)
{
disposeBrowser();
_shibCookie = cookie;
storeShibCookie(_shibCookie, account);
Q_EMIT newCookie(_shibCookie);
// Now fetch the user...
// But we must first do a request to webdav so the session is enabled.
@@ -268,9 +308,11 @@ void ShibbolethCredentials::slotUserFetched(const QString &user)
}
void ShibbolethCredentials::slotBrowserRejected()
void ShibbolethCredentials::slotBrowserHidden()
{
disposeBrowser();
_ready = false;
_shibCookie = QNetworkCookie();
Q_EMIT fetched();
}
@@ -313,16 +355,16 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
if (job->error() == QKeychain::NoError) {
ReadPasswordJob *readJob = static_cast<ReadPasswordJob*>(job);
delete readJob->settings();
qDebug() << Q_FUNC_INFO;
QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(readJob->textData().toUtf8());
if (cookies.count() > 0) {
_shibCookie = cookies.first();
addToCookieJar(_shibCookie);
}
// access
job->setSettings(account->settingsWithGroup(Theme::instance()->appName(), job));
_ready = true;
_stillValid = true;
Q_EMIT newCookie(_shibCookie);
Q_EMIT fetched();
} else {
showLoginWindow(account);
@@ -331,44 +373,24 @@ void ShibbolethCredentials::slotReadJobDone(QKeychain::Job *job)
void ShibbolethCredentials::showLoginWindow(Account* account)
{
if (!_browser.isNull()) {
if (_browser) {
_browser->activateWindow();
_browser->raise();
// FIXME On OS X this does not raise properly
return;
}
_browser = new ShibbolethWebView(account);
ShibbolethConfigFile cfg;
_browser = new ShibbolethWebView(account, cfg.createCookieJar());
connect(_browser, SIGNAL(shibbolethCookieReceived(QNetworkCookie, Account*)),
this, SLOT(onShibbolethCookieReceived(QNetworkCookie, Account*)));
connect(_browser, SIGNAL(rejected()), this, SLOT(slotBrowserRejected()));
connect(_browser, SIGNAL(viewHidden()),
this, SLOT(slotBrowserHidden()));
// FIXME If the browser was hidden (e.g. user closed it) without us logging in, the logic gets stuck
// and can only be unstuck by restarting the app or pressing "Sign in" (we should switch to offline but we don't)
_browser->show();
}
QList<QNetworkCookie> ShibbolethCredentials::accountCookies(Account *account)
{
return account->networkAccessManager()->cookieJar()->cookiesForUrl(account->url());
}
QNetworkCookie ShibbolethCredentials::findShibCookie(Account *account, QList<QNetworkCookie> cookies)
{
if(cookies.isEmpty()) {
cookies = accountCookies(account);
}
Q_FOREACH(QNetworkCookie cookie, cookies) {
if (cookie.name().startsWith(shibCookieNameC)) {
return cookie;
}
}
return QNetworkCookie();
}
QByteArray ShibbolethCredentials::shibCookieName()
{
return QByteArray(shibCookieNameC);
}
void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie, Account *account)
{
WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());
@@ -380,24 +402,5 @@ void ShibbolethCredentials::storeShibCookie(const QNetworkCookie &cookie, Accoun
job->start();
}
void ShibbolethCredentials::removeShibCookie(Account *account)
{
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
job->setSettings(account->settingsWithGroup(Theme::instance()->appName(), job));
job->setKey(keychainKey(account->url().toString(), "shibAssertion"));
job->start();
}
void ShibbolethCredentials::addToCookieJar(const QNetworkCookie &cookie)
{
QList<QNetworkCookie> cookies;
cookies << cookie;
Account *account = AccountManager::instance()->account();
QNetworkCookieJar *jar = account->networkAccessManager()->cookieJar();
jar->blockSignals(true); // otherwise we'd call ourselves
jar->setCookiesFromUrl(cookies, account->url());
jar->blockSignals(false);
}
} // ns Mirall
+10 -12
Ver Arquivo
@@ -18,7 +18,6 @@
#include <QMap>
#include <QNetworkCookie>
#include <QUrl>
#include <QPointer>
#include "creds/abstractcredentials.h"
@@ -31,12 +30,13 @@ namespace Mirall
class ShibbolethWebView;
class OWNCLOUDSYNC_EXPORT ShibbolethCredentials : public AbstractCredentials
class ShibbolethCredentials : public AbstractCredentials
{
Q_OBJECT
public:
ShibbolethCredentials();
ShibbolethCredentials(const QNetworkCookie& cookie, const QMap<QUrl, QList<QNetworkCookie> >& otherCookies);
void syncContextPreInit(CSYNC* ctx);
void syncContextPreStart(CSYNC* ctx);
@@ -50,18 +50,16 @@ public:
void persist(Account *account);
void invalidateToken(Account *account);
void showLoginWindow(Account*);
QNetworkCookie cookie() const;
static QList<QNetworkCookie> accountCookies(Account*);
static QNetworkCookie findShibCookie(Account*, QList<QNetworkCookie> cookies = QList<QNetworkCookie>());
static QByteArray shibCookieName();
void showLoginWindow(Account*);
public Q_SLOTS:
void invalidateAndFetch(Account *account);
private Q_SLOTS:
void onShibbolethCookieReceived(const QNetworkCookie&, Account*);
void slotBrowserRejected();
void onShibbolethCookieReceived(const QNetworkCookie& cookie, Account*);
void slotBrowserHidden();
void onFetched();
void slotReadJobDone(QKeychain::Job*);
void slotInvalidateAndFetchInvalidateDone(QKeychain::Job*);
@@ -75,15 +73,15 @@ Q_SIGNALS:
private:
void storeShibCookie(const QNetworkCookie &cookie, Account *account);
void removeShibCookie(Account *account);
void addToCookieJar(const QNetworkCookie &cookie);
QUrl _url;
QByteArray prepareCookieData() const;
void disposeBrowser();
QNetworkCookie _shibCookie;
bool _ready;
bool _stillValid;
QPointer<ShibbolethWebView> _browser;
QNetworkCookie _shibCookie;
ShibbolethWebView* _browser;
QMap<QUrl, QList<QNetworkCookie> > _otherCookies;
QString _user;
};
+14 -5
Ver Arquivo
@@ -17,6 +17,8 @@
#include <QDebug>
#include <QNetworkReply>
#include <QSettings>
#include <QInputDialog>
#include "mirall/account.h"
#include "mirall/mirallaccessmanager.h"
@@ -68,7 +70,6 @@ int getauth(const char *prompt,
}
const char userC[] = "user";
const char authenticationFailedC[] = "owncloud-authentication-failed";
} // ns
@@ -173,13 +174,22 @@ bool TokenCredentials::stillValid(QNetworkReply *reply)
{
return ((reply->error() != QNetworkReply::AuthenticationRequiredError)
// returned if user or password is incorrect
&& (reply->error() != QNetworkReply::OperationCanceledError
|| !reply->property(authenticationFailedC).toBool()));
&& (reply->error() != QNetworkReply::OperationCanceledError));
}
QString TokenCredentials::queryPassword(bool *ok)
{
return QString();
qDebug() << AccountManager::instance()->account()->state();
if (ok) {
QString str = QInputDialog::getText(0, tr("Enter Password"),
tr("Please enter %1 password for user '%2':")
.arg(Theme::instance()->appNameGUI(), _user),
QLineEdit::Password, QString(), ok);
qDebug() << AccountManager::instance()->account()->state();
return str;
} else {
return QString();
}
}
void TokenCredentials::invalidateToken(Account *account)
@@ -211,7 +221,6 @@ void TokenCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator*
// instead of utf8 encoding. Instead, we send it manually. Thus, if we reach this signal,
// those credentials were invalid and we terminate.
qDebug() << "Stop request: Authentication failed for " << reply->url().toString();
reply->setProperty(authenticationFailedC, true);
reply->close();
}
+1 -1
Ver Arquivo
@@ -31,7 +31,7 @@ namespace Mirall
{
class TokenCredentialsAccessManager;
class OWNCLOUDSYNC_EXPORT TokenCredentials : public AbstractCredentials
class TokenCredentials : public AbstractCredentials
{
Q_OBJECT
-22
Ver Arquivo
@@ -1,5 +1,4 @@
/*
*
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -12,15 +11,8 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <QtGlobal>
#include <signal.h>
#ifdef Q_OS_UNIX
#include <sys/time.h>
#include <sys/resource.h>
#endif
#include "mirall/application.h"
#include "mirall/theme.h"
#include "mirall/utility.h"
@@ -59,20 +51,6 @@ int main(int argc, char **argv)
return 0;
}
// check a environment variable for core dumps
#ifdef Q_OS_UNIX
if( !qgetenv("OWNCLOUD_CORE_DUMP").isEmpty() ) {
struct rlimit core_limit;
core_limit.rlim_cur = RLIM_INFINITY;
core_limit.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_CORE, &core_limit) < 0) {
fprintf(stderr, "Unable to set core dump limit\n");
} else {
qDebug() << "Core dumps enabled";
}
}
#endif
// if handleStartup returns true, main()
// needs to terminate here, e.g. because
// the updater is triggered
+1 -17
Ver Arquivo
@@ -12,11 +12,9 @@
*/
#include "mirall/account.h"
#include "mirall/cookiejar.h"
#include "mirall/theme.h"
#include "mirall/networkjobs.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/mirallaccessmanager.h"
#include "mirall/quotainfo.h"
#include "creds/abstractcredentials.h"
#include "creds/credentialsfactory.h"
@@ -77,8 +75,6 @@ Account::Account(AbstractSslErrorHandler *sslErrorHandler, QObject *parent)
Account::~Account()
{
delete _credentials;
delete _am;
}
void Account::save()
@@ -165,11 +161,7 @@ AbstractCredentials *Account::credentials() const
void Account::setCredentials(AbstractCredentials *cred)
{
// set active credential manager
QNetworkCookieJar *jar = 0;
if (_am) {
jar = _am->cookieJar();
jar->setParent(0);
_am->deleteLater();
}
@@ -178,9 +170,6 @@ void Account::setCredentials(AbstractCredentials *cred)
}
_credentials = cred;
_am = _credentials->getQNAM();
if (jar) {
_am->setCookieJar(jar);
}
connect(_am, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
SLOT(slotHandleErrors(QNetworkReply*,QList<QSslError>)));
}
@@ -197,12 +186,7 @@ QList<QNetworkCookie> Account::lastAuthCookies() const
void Account::clearCookieJar()
{
_am->setCookieJar(new CookieJar);
}
QNetworkAccessManager *Account::networkAccessManager()
{
return _am;
_am->setCookieJar(new QNetworkCookieJar);
}
QNetworkReply *Account::headRequest(const QString &relPath)
+2 -6
Ver Arquivo
@@ -22,7 +22,6 @@
#include <QSslCertificate>
#include <QSslConfiguration>
#include <QSslError>
#include "utility.h"
class QSettings;
class QNetworkReply;
@@ -34,9 +33,8 @@ namespace Mirall {
class AbstractCredentials;
class Account;
class QuotaInfo;
class MirallAccessManager;
class OWNCLOUDSYNC_EXPORT AccountManager : public QObject {
class AccountManager : public QObject {
Q_OBJECT
public:
static AccountManager *instance();
@@ -65,7 +63,7 @@ public:
/**
* @brief This class represents an account on an ownCloud Server
*/
class OWNCLOUDSYNC_EXPORT Account : public QObject {
class Account : public QObject {
Q_OBJECT
public:
enum State { Disconnected = 0, /// no network connection
@@ -144,8 +142,6 @@ public:
void clearCookieJar();
QNetworkAccessManager* networkAccessManager();
QuotaInfo *quotaInfo();
signals:
void stateChanged(int state);
+12 -21
Ver Arquivo
@@ -114,6 +114,7 @@ AccountSettings::AccountSettings(QWidget *parent) :
connect(FolderMan::instance(), SIGNAL(folderListLoaded(Folder::Map)),
this, SLOT(setFolderList(Folder::Map)));
setFolderList(FolderMan::instance()->map());
}
void AccountSettings::slotAccountChanged(Account *newAccount, Account *oldAccount)
@@ -139,28 +140,28 @@ void AccountSettings::slotAccountChanged(Account *newAccount, Account *oldAccoun
void AccountSettings::slotFolderActivated( const QModelIndex& indx )
{
bool isValid = indx.isValid();
bool state = indx.isValid();
bool haveFolders = ui->_folderList->model()->rowCount() > 0;
ui->_buttonRemove->setEnabled(isValid);
ui->_buttonRemove->setEnabled(state);
if( Theme::instance()->singleSyncFolder() ) {
// only one folder synced folder allowed.
ui->_buttonAdd->setVisible(!haveFolders);
} else {
ui->_buttonAdd->setVisible(true);
ui->_buttonAdd->setEnabled( true );
}
ui->_buttonAdd->setEnabled(_account && _account->state() == Account::Connected);
ui->_buttonEnable->setEnabled( isValid );
ui->_buttonEnable->setEnabled( state );
if ( isValid ) {
if ( state ) {
bool folderEnabled = _model->data( indx, FolderStatusDelegate::FolderSyncEnabled).toBool();
if ( folderEnabled ) {
ui->_buttonEnable->setText( tr( "Pause" ) );
} else {
ui->_buttonEnable->setText( tr( "Resume" ) );
}
ui->_buttonEnable->setEnabled( _account && _account->state() == Account::Connected);
ui->_buttonEnable->setEnabled(_account && _account->state() == Account::Connected);
}
}
@@ -240,10 +241,6 @@ void AccountSettings::slotButtonsSetEnabled()
void AccountSettings::setGeneralErrors( const QStringList& errors )
{
_generalErrors = errors;
if (_account) {
// this will update the message
slotAccountStateChanged(_account->state());
}
}
void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
@@ -268,10 +265,6 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
// if the folder was disabled before, set the sync icon
item->setData( theme->syncStateIcon( SyncResult::SyncRunning), FolderStatusDelegate::FolderStatusIconRole );
} // we keep the previous icon for the SyncPrepare state.
} else if( status == SyncResult::Undefined ) {
// startup, the sync was never done.
qDebug() << "XXX FIRST time sync, setting icon to sync running!";
item->setData( theme->syncStateIcon( SyncResult::SyncRunning), FolderStatusDelegate::FolderStatusIconRole );
} else {
// kepp the previous icon for the prepare phase.
if( status == SyncResult::Problem) {
@@ -364,7 +357,7 @@ void AccountSettings::slotResetCurrentFolder()
if( ret == QMessageBox::Yes ) {
FolderMan *folderMan = FolderMan::instance();
Folder *f = folderMan->folder(alias);
f->slotTerminateSync();
f->slotTerminateSync(true);
f->wipe();
folderMan->slotScheduleAllFolders();
}
@@ -387,7 +380,6 @@ void AccountSettings::showConnectionLabel( const QString& message, const QString
if( _generalErrors.isEmpty() ) {
ui->connectLabel->setText( message );
ui->connectLabel->setToolTip(tooltip);
ui->connectLabel->setStyleSheet(QString());
} else {
const QString msg = _generalErrors.join(QLatin1String("\n"));
ui->connectLabel->setText( msg );
@@ -481,7 +473,7 @@ void AccountSettings::slotEnableCurrentFolder()
// message box can return at any time while the thread keeps running,
// so better check again after the user has responded.
if ( f->isBusy() && terminate ) {
f->slotTerminateSync();
f->slotTerminateSync(false);
}
folderMan->slotEnableFolder( alias, !folderEnabled );
@@ -636,9 +628,8 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
item->setData( overallSyncString, FolderStatusDelegate::SyncProgressOverallString );
int overallPercent = 0;
if( progress._totalFileCount > 0 ) {
// Add one 'byte' for each files so the percentage is moving when deleting or renaming files
overallPercent = qRound(double(completedSize + progress._completedFileCount)/double(progress._totalSize + progress._totalFileCount) * 100.0);
if( progress._totalSize > 0 ) {
overallPercent = qRound(double(completedSize)/double(progress._totalSize) * 100.0);
}
item->setData( overallPercent, FolderStatusDelegate::SyncProgressOverallPercent);
}
@@ -743,7 +734,7 @@ void AccountSettings::slotAccountStateChanged(int state)
ui->sslButton->updateAccountInfo(_account);
QUrl safeUrl(_account->url());
safeUrl.setPassword(QString()); // Remove the password from the URL to avoid showing it in the UI
slotButtonsSetEnabled();
ui->_buttonAdd->setEnabled(state == Account::Connected);
if (state == Account::Connected) {
QString user;
if (AbstractCredentials *cred = _account->credentials()) {
+13 -23
Ver Arquivo
@@ -45,8 +45,6 @@
#include <QMenu>
#include <QMessageBox>
class QSocket;
namespace Mirall {
namespace {
@@ -66,20 +64,22 @@ static const char optionsC[] =
QString applicationTrPath()
{
#if defined(Q_OS_WIN)
return QApplication::applicationDirPath();
#elif defined(Q_OS_MAC)
return QApplication::applicationDirPath()+QLatin1String("/../Resources/Translations"); // path defaults to app dir.
#elif defined(Q_OS_UNIX)
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
return QString::fromLatin1(DATADIR"/"APPLICATION_EXECUTABLE"/i18n/");
#endif
#ifdef Q_OS_MAC
return QApplication::applicationDirPath()+QLatin1String("/../Resources/Translations"); // path defaults to app dir.
#endif
#ifdef Q_OS_WIN
return QApplication::applicationDirPath();
#endif
}
}
// ----------------------------------------------------------------------------------
Application::Application(int &argc, char **argv) :
SharedTools::QtSingleApplication(Theme::instance()->appName() ,argc, argv),
SharedTools::QtSingleApplication(argc, argv),
_gui(0),
_theme(Theme::instance()),
_helpOnly(false),
@@ -99,13 +99,14 @@ Application::Application(int &argc, char **argv) :
//no need to waste time;
if ( _helpOnly ) return;
initialize();
if (isRunning())
return;
setupLogging();
setupTranslations();
connect( this, SIGNAL(messageReceived(QString, QObject*)), SLOT(slotParseOptions(QString, QObject*)));
connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString)));
Account *account = Account::restore();
if (account) {
@@ -138,10 +139,6 @@ Application::Application(int &argc, char **argv) :
this, SLOT(slotAccountChanged(Account*,Account*)));
// startup procedure.
connect(&_checkConnectionTimer, SIGNAL(timeout()), this, SLOT(slotCheckConnection()));
_checkConnectionTimer.setInterval(32 * 1000); // check for connection every 32 seconds.
_checkConnectionTimer.start();
// Also check immediatly
QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
if( cfg.skipUpdateCheck() ) {
@@ -158,7 +155,6 @@ Application::Application(int &argc, char **argv) :
Application::~Application()
{
delete AccountManager::instance()->account();
// qDebug() << "* Mirall shutdown";
}
@@ -230,9 +226,8 @@ void Application::slotCheckConnection()
if (account->state() == Account::InvalidCredidential
|| account->state() == Account::SignedOut) {
//Do not try to connect if we are logged out
if (!_userTriggeredConnect) {
if (!_userTriggeredConnect)
return;
}
}
if (_conValidator)
@@ -245,8 +240,6 @@ void Application::slotCheckConnection()
} else {
// let gui open the setup wizard
_gui->slotOpenSettingsDialog( true );
_checkConnectionTimer.stop(); // don't popup the wizard on interval;
}
}
@@ -276,8 +269,6 @@ void Application::slotToggleFolderman(int state)
folderMan->slotScheduleAllFolders();
break;
case Account::Disconnected:
_checkConnectionTimer.start();
// fall through
case Account::SignedOut:
case Account::InvalidCredidential:
folderMan->setSyncEnabled(false);
@@ -298,7 +289,6 @@ void Application::slotConnectionValidatorResult(ConnectionValidator::Status stat
folderMan->setSyncEnabled(true);
// queue up the sync for all folders.
folderMan->slotScheduleAllFolders();
_checkConnectionTimer.stop();
} else {
// if we have problems here, it's unlikely that syncing will work.
FolderMan::instance()->setSyncEnabled(false);
@@ -308,6 +298,7 @@ void Application::slotConnectionValidatorResult(ConnectionValidator::Status stat
if (_userTriggeredConnect) {
_userTriggeredConnect = false;
}
QTimer::singleShot(30*1000, this, SLOT(slotCheckConnection()));
}
_gui->startupConnected( (status == ConnectionValidator::Connected), startupFails);
@@ -325,7 +316,6 @@ void Application::slotownCloudWizardDone( int res )
}
folderMan->setSyncEnabled( true );
if( res == QDialog::Accepted ) {
_checkConnectionTimer.start();
slotCheckConnection();
}
@@ -353,7 +343,7 @@ void Application::slotUseMonoIconsChanged(bool)
_gui->slotComputeOverallSyncStatus();
}
void Application::slotParseOptions(const QString &opts, QObject*)
void Application::slotParseOptions(const QString &opts)
{
QStringList options = opts.split(QLatin1Char('|'));
parseOptions(options);
+1 -8
Ver Arquivo
@@ -18,7 +18,6 @@
#include <QApplication>
#include <QPointer>
#include <QQueue>
#include <QTimer>
#include "qtsingleapplication.h"
@@ -28,11 +27,9 @@
#include "mirall/connectionvalidator.h"
#include "mirall/progressdispatcher.h"
#include "mirall/clientproxy.h"
#include "mirall/folderman.h"
class QMessageBox;
class QSystemTrayIcon;
class QSocket;
namespace Mirall {
class Theme;
@@ -71,7 +68,7 @@ signals:
void folderStateChanged(Folder*);
protected slots:
void slotParseOptions( const QString&, QObject* );
void slotParseOptions( const QString& );
void slotCheckConnection();
void slotConnectionValidatorResult(ConnectionValidator::Status);
void slotStartUpdateDetector();
@@ -106,10 +103,6 @@ private:
ClientProxy _proxy;
QTimer _checkConnectionTimer;
FolderMan folderManager;
friend class ownCloudGui; // for _startupNetworkError
};
+1 -2
Ver Arquivo
@@ -18,13 +18,12 @@
#include <QNetworkProxy>
#include <csync.h>
#include "utility.h"
namespace Mirall {
class MirallConfigFile;
class OWNCLOUDSYNC_EXPORT ClientProxy : public QObject
class ClientProxy : public QObject
{
Q_OBJECT
public:
+1 -2
Ver Arquivo
@@ -14,7 +14,6 @@
#ifndef CONNECTIONVALIDATOR_H
#define CONNECTIONVALIDATOR_H
#include "owncloudlib.h"
#include <QObject>
#include <QStringList>
#include <QVariantMap>
@@ -24,7 +23,7 @@ namespace Mirall {
class Account;
class OWNCLOUDSYNC_EXPORT ConnectionValidator : public QObject
class ConnectionValidator : public QObject
{
Q_OBJECT
public:
-155
Ver Arquivo
@@ -1,155 +0,0 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "cookiejar.h"
#include "mirall/mirallconfigfile.h"
#include <QDebug>
#include <QFile>
#include <QDateTime>
#include <QNetworkCookie>
namespace Mirall {
namespace {
const unsigned int JAR_VERSION = 23;
}
QDataStream &operator<<(QDataStream &stream, const QList<QNetworkCookie> &list)
{
stream << JAR_VERSION;
stream << quint32(list.size());
for (int i = 0; i < list.size(); ++i)
stream << list.at(i).toRawForm();
return stream;
}
QDataStream &operator>>(QDataStream &stream, QList<QNetworkCookie> &list)
{
list.clear();
quint32 version;
stream >> version;
if (version != JAR_VERSION)
return stream;
quint32 count;
stream >> count;
for(quint32 i = 0; i < count; ++i)
{
QByteArray value;
stream >> value;
QList<QNetworkCookie> newCookies = QNetworkCookie::parseCookies(value);
if (newCookies.count() == 0 && value.length() != 0) {
qWarning() << "CookieJar: Unable to parse saved cookie:" << value;
}
for (int j = 0; j < newCookies.count(); ++j)
list.append(newCookies.at(j));
if (stream.atEnd())
break;
}
return stream;
}
CookieJar::CookieJar(QObject *parent) :
QNetworkCookieJar(parent)
{
restore();
}
CookieJar::~CookieJar()
{
save();
}
bool CookieJar::setCookiesFromUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url)
{
if (QNetworkCookieJar::setCookiesFromUrl(cookieList, url)) {
Q_EMIT newCookiesForUrl(cookieList, url);
return true;
}
return false;
}
QList<QNetworkCookie> CookieJar::cookiesForUrl(const QUrl &url) const
{
QList<QNetworkCookie> cookies = QNetworkCookieJar::cookiesForUrl(url);
// qDebug() << url << "requests:" << cookies;
return cookies;
}
bool CookieJar::deleteCookie(const QNetworkCookie &delCookie)
{
QList<QNetworkCookie> cookies = allCookies();
bool removeSucceeded = false;
foreach(const QNetworkCookie &cookie, cookies) {
// ### cookies are not identical in attriutes, why?
if (cookie.name() == delCookie.name()) {
cookies.removeOne(cookie);
removeSucceeded = true;
}
}
setAllCookies(cookies);
return removeSucceeded;
}
void CookieJar::clearSessionCookies()
{
setAllCookies(removeExpired(allCookies()));
}
void CookieJar::save()
{
QFile file;
file.setFileName(storagePath());
qDebug() << storagePath();
file.open(QIODevice::WriteOnly);
QDataStream stream(&file);
stream << allCookies();
file.close();
}
void CookieJar::restore()
{
QFile file;
file.setFileName(storagePath());
file.open(QIODevice::ReadOnly);
QDataStream stream(&file);
QList<QNetworkCookie> list;
stream >> list;
setAllCookies(removeExpired(list));
file.close();
}
QList<QNetworkCookie> CookieJar::removeExpired(const QList<QNetworkCookie> &cookies)
{
QList<QNetworkCookie> updatedList;
foreach(const QNetworkCookie &cookie, cookies) {
if (cookie.expirationDate() > QDateTime::currentDateTime() && !cookie.isSessionCookie()) {
updatedList << cookie;
}
}
return updatedList;
}
QString CookieJar::storagePath() const
{
MirallConfigFile cfg;
return cfg.configPath() + "/cookies.db";
}
} // namespace Mirall
-47
Ver Arquivo
@@ -1,47 +0,0 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef MIRALL_COOKIEJAR_H
#define MIRALL_COOKIEJAR_H
#include <QNetworkCookieJar>
#include "owncloudlib.h"
namespace Mirall {
class OWNCLOUDSYNC_EXPORT CookieJar : public QNetworkCookieJar
{
Q_OBJECT
public:
explicit CookieJar(QObject *parent = 0);
~CookieJar();
bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url);
QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const;
virtual bool deleteCookie(const QNetworkCookie & cookie);
void clearSessionCookies();
signals:
void newCookiesForUrl(const QList<QNetworkCookie>& cookieList, const QUrl& url);
private:
void save();
void restore();
QList<QNetworkCookie> removeExpired(const QList<QNetworkCookie> &cookies);
QString storagePath() const;
};
} // namespace Mirall
#endif // MIRALL_COOKIEJAR_H
+9 -36
Ver Arquivo
@@ -49,11 +49,8 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype);
#include <QTimer>
#include <QUrl>
#include <QDir>
#ifndef TOKEN_AUTH_ONLY
#include <QMessageBox>
#include <QPushButton>
#endif
namespace Mirall {
@@ -91,14 +88,6 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
bool Folder::init()
{
Account *account = AccountManager::instance()->account();
if (!account) {
// Normaly this should not happen, but it could be that there is something
// wrong with the config and it is better not to crash.
qWarning() << "WRN: No account configured, can't sync";
return false;
}
QString url = Utility::toCSyncScheme(remoteUrl().toString());
QString localpath = path();
@@ -309,7 +298,7 @@ void Folder::bubbleUpSyncResult()
SyncRunFileLog syncFileLog;
syncFileLog.start(path(), _engine ? _engine->stopWatch() : Utility::StopWatch() );
syncFileLog.start(path(), _engine->stopWatch() );
QElapsedTimer timer;
timer.start();
@@ -474,7 +463,7 @@ void Folder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
_syncResult.setSyncFileItemVector(items);
}
void Folder::slotTerminateSync()
void Folder::slotTerminateSync(bool block)
{
qDebug() << "folder " << alias() << " Terminating!";
@@ -484,10 +473,14 @@ void Folder::slotTerminateSync()
// Do not display an error message, user knows his own actions.
// _errors.append( tr("The CSync thread terminated.") );
// _csyncError = true;
setSyncEnabled(false);
setSyncState(SyncResult::SyncAbortRequested);
return;
if (!block) {
setSyncState(SyncResult::SyncAbortRequested);
return;
}
slotSyncFinished();
}
setSyncEnabled(false);
}
// This removes the csync File database
@@ -655,24 +648,9 @@ void Folder::slotSyncFinished()
}
emit syncStateChange();
// The syncFinished result that is to be triggered here makes the folderman
// clearing the current running sync folder marker.
// Lets wait a bit to do that because, as long as this marker is not cleared,
// file system change notifications are ignored for that folder. And it takes
// some time under certain conditions to make the file system notifications
// all come in.
QTimer::singleShot(200, this, SLOT(slotEmitFinishedDelayed() ));
}
void Folder::slotEmitFinishedDelayed()
{
emit syncFinished( _syncResult );
}
// the progress comes without a folder and the valid path set. Add that here
// and hand the result over to the progress dispatcher.
void Folder::slotTransmissionProgress(const Progress::Info &pi)
@@ -692,7 +670,6 @@ void Folder::slotTransmissionProgress(const Progress::Info &pi)
void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel)
{
#ifndef TOKEN_AUTH_ONLY
QString msg = direction == SyncFileItem::Down ?
tr("This sync would remove all the files in the local sync folder '%1'.\n"
"If you or your administrator have reset your account on the server, choose "
@@ -712,11 +689,7 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *
*cancel = msgBox.clickedButton() == keepBtn;
if (*cancel) {
wipe();
// speed up next sync
_lastEtag = QString();
QTimer::singleShot(50, this, SLOT(slotPollTimerTimeout()));
}
#endif
}
SyncFileStatus Folder::fileStatus( const QString& fileName )
+4 -4
Ver Arquivo
@@ -59,7 +59,7 @@ typedef enum SyncFileStatus_s {
} SyncFileStatus;
class OWNCLOUDSYNC_EXPORT Folder : public QObject
class Folder : public QObject
{
Q_OBJECT
@@ -148,8 +148,10 @@ public slots:
/**
* terminate the current sync run
*
* If block is true, this will block synchroniously for the sync thread to finish.
*/
void slotTerminateSync();
void slotTerminateSync(bool block);
void slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool*);
@@ -181,8 +183,6 @@ private slots:
void slotThreadTreeWalkResult(const SyncFileItemVector& );
void slotEmitFinishedDelayed();
private:
bool init();
+18 -24
Ver Arquivo
@@ -27,10 +27,8 @@
#include <shlobj.h>
#endif
#ifndef TOKEN_AUTH_ONLY
#include <QDesktopServices>
#include <QMessageBox>
#endif
#include <QtCore>
namespace Mirall {
@@ -41,6 +39,13 @@ FolderMan::FolderMan(QObject *parent) :
QObject(parent),
_syncEnabled( true )
{
// if QDir::mkpath would not be so stupid, I would not need to have this
// duplication of folderConfigPath() here
MirallConfigFile cfg;
QDir storageDir(cfg.configPath());
storageDir.mkpath(QLatin1String("folders"));
_folderConfigPath = cfg.configPath() + QLatin1String("folders");
_folderChangeSignalMapper = new QSignalMapper(this);
connect(_folderChangeSignalMapper, SIGNAL(mapped(const QString &)),
this, SIGNAL(folderSyncStateChange(const QString &)));
@@ -48,14 +53,15 @@ FolderMan::FolderMan(QObject *parent) :
_folderWatcherSignalMapper = new QSignalMapper(this);
connect(_folderWatcherSignalMapper, SIGNAL(mapped(const QString&)),
this, SLOT(slotScheduleSync(const QString&)));
ne_sock_init();
Q_ASSERT(!_instance);
_instance = this;
}
FolderMan *FolderMan::instance()
{
if(!_instance) {
_instance = new FolderMan;
ne_sock_init();
}
return _instance;
}
@@ -63,7 +69,6 @@ FolderMan::~FolderMan()
{
qDeleteAll(_folderMap);
ne_sock_exit();
_instance = 0;
}
Mirall::Folder::Map FolderMan::map()
@@ -137,19 +142,14 @@ int FolderMan::setupFolders()
unloadAllFolders();
MirallConfigFile cfg;
QDir storageDir(cfg.configPath());
storageDir.mkpath(QLatin1String("folders"));
_folderConfigPath = cfg.configPath() + QLatin1String("folders");
QDir dir( _folderConfigPath );
//We need to include hidden files just in case the alias starts with '.'
dir.setFilter(QDir::Files | QDir::Hidden);
dir.setFilter(QDir::Files);
QStringList list = dir.entryList();
foreach ( const QString& alias, list ) {
Folder *f = setupFolderFromConfigFile( alias );
if( f ) {
registerFolderMonitor(f);
slotScheduleSync(alias);
emit( folderSyncStateChange( f->alias() ) );
}
@@ -163,8 +163,7 @@ int FolderMan::setupFolders()
bool FolderMan::ensureJournalGone(const QString &localPath)
{
// FIXME move this to UI, not libowncloudsync
#ifndef TOKEN_AUTH_ONLY
// remove old .csync_journal file
QString stateDbFile = localPath+QLatin1String("/.csync_journal.db");
while (QFile::exists(stateDbFile) && !QFile::remove(stateDbFile)) {
@@ -178,7 +177,6 @@ bool FolderMan::ensureJournalGone(const QString &localPath)
return false;
}
}
#endif
return true;
}
@@ -299,7 +297,6 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
qDebug() << "Adding folder to Folder Map " << folder;
_folderMap[alias] = folder;
if (paused) {
folder->setSyncEnabled(!paused);
_disabledFolders.insert(folder);
}
@@ -310,8 +307,6 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
connect(folder, SIGNAL(syncFinished(SyncResult)), SLOT(slotFolderSyncFinished(SyncResult)));
_folderChangeSignalMapper->setMapping( folder, folder->alias() );
registerFolderMonitor(folder);
return folder;
}
@@ -352,10 +347,9 @@ void FolderMan::terminateSyncProcess( const QString& alias )
if( ! folderAlias.isEmpty() && _folderMap.contains(folderAlias) ) {
Folder *f = _folderMap[folderAlias];
if( f ) {
f->slotTerminateSync();
if(_currentSyncFolder == folderAlias ) {
f->slotTerminateSync(true);
if(_currentSyncFolder == folderAlias )
_currentSyncFolder.clear();
}
}
}
}
+5 -6
Ver Arquivo
@@ -30,13 +30,12 @@ class SyncResult;
namespace Mirall {
class Application;
class OWNCLOUDSYNC_EXPORT FolderMan : public QObject
class FolderMan : public QObject
{
Q_OBJECT
public:
static FolderMan* instance();
~FolderMan();
int setupFolders();
@@ -145,10 +144,10 @@ private:
QQueue<QString> _scheduleQueue;
QMap<QString, FolderWatcher*> _folderWatchers;
static FolderMan *_instance;
explicit FolderMan(QObject *parent = 0);
~FolderMan();
friend class Mirall::Application;
static FolderMan *_instance;
};
} // namespace Mirall
+2 -2
Ver Arquivo
@@ -29,7 +29,7 @@
#include "mirall/folderwatcher_win.h"
#elif defined(Q_OS_MAC)
#include "mirall/folderwatcher_mac.h"
#elif defined(Q_OS_UNIX)
#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
#include "mirall/folderwatcher_linux.h"
#endif
@@ -115,7 +115,7 @@ void FolderWatcher::changeDetected( const QString& path )
void FolderWatcher::changeDetected( const QStringList& paths )
{
// qDebug() << Q_FUNC_INFO << paths;
qDebug() << Q_FUNC_INFO << paths;
// TODO: this shortcut doesn't look very reliable:
// - why is the timeout only 1 second?
+8 -1
Ver Arquivo
@@ -69,6 +69,10 @@ FolderWizardLocalPath::FolderWizardLocalPath()
_ui.aliasLineEdit->setToolTip(tr("The directory alias is a descriptive name for this sync connection."));
_ui.warnLabel->setTextFormat(Qt::RichText);
_ui.warnLabel->hide();
setButtonText(QWizard::NextButton, tr("&Next >"));
setButtonText(QWizard::BackButton, tr("< &Back"));
setButtonText(QWizard::CancelButton, tr("Cancel"));
}
FolderWizardLocalPath::~FolderWizardLocalPath()
@@ -136,7 +140,7 @@ bool FolderWizardLocalPath::isComplete() const
QString absCleanUserFolder = QDir::cleanPath(QDir(userInput).canonicalPath())+'/';
if( isOk && QDir::cleanPath(folderDir).startsWith(absCleanUserFolder) ) {
qDebug() << "A already configured folder is child of the current selected";
warnStrings.append( tr("The selected folder is a symbolic link. An already configured "
warnStrings.append( tr("The selected folder is a symbolic link. An already configured"
"folder is contained in the folder this link is pointing to."));
isOk = false;
}
@@ -235,6 +239,9 @@ FolderWizardRemotePath::FolderWizardRemotePath()
connect(_ui.folderTreeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SIGNAL(completeChanged()));
connect(_ui.folderTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(slotItemExpanded(QTreeWidgetItem*)));
setButtonText(QWizard::CancelButton, tr("Cancel"));
setButtonText(QWizard::BackButton, tr("< &Back"));
}
void FolderWizardRemotePath::slotAddRemoteFolder()
+3
Ver Arquivo
@@ -47,6 +47,9 @@ IgnoreListEditor::IgnoreListEditor(QWidget *parent) :
connect(ui->removePushButton, SIGNAL(clicked()), SLOT(slotRemoveCurrentItem()));
connect(ui->addPushButton, SIGNAL(clicked()), SLOT(slotAddPattern()));
connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(slotEditPattern(QListWidgetItem*)));
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("OK"));
ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
}
static void setupItemFlags(QListWidgetItem* item)
+21 -12
Ver Arquivo
@@ -27,9 +27,6 @@ static void mirallLogCatcher(QtMsgType type, const char *msg)
// qDebug() exports to local8Bit, which is not always UTF-8
Logger::instance()->mirallLog( QString::fromLocal8Bit(msg) );
}
static void qInstallMessageHandler(QtMsgHandler h) {
qInstallMsgHandler(h);
}
#else
static void mirallLogCatcher(QtMsgType, const QMessageLogContext &ctx, const QString &message) {
Q_UNUSED(ctx);
@@ -41,22 +38,34 @@ static void mirallLogCatcher(QtMsgType, const QMessageLogContext &ctx, const QSt
}
#endif
Logger *Logger::instance()
{
static Logger log;
return &log;
}
Logger* Logger::_instance=0;
Logger::Logger( QObject* parent) : QObject(parent),
Logger::Logger( QObject* parent)
: QObject(parent),
_showTime(true), _doLogging(false), _doFileFlush(false), _logExpire(0)
{
qInstallMessageHandler(mirallLogCatcher);
}
Logger::~Logger() {
qInstallMessageHandler(0);
Logger *Logger::instance()
{
if( !Logger::_instance ) {
Logger::_instance = new Logger;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
qInstallMsgHandler( mirallLogCatcher );
#else
qInstallMessageHandler(mirallLogCatcher);
#endif
}
return Logger::_instance;
}
void Logger::destroy()
{
if( Logger::_instance ) {
delete Logger::_instance;
Logger::_instance = 0;
}
}
void Logger::postGuiLog(const QString &title, const QString &message)
{
+6 -6
Ver Arquivo
@@ -22,8 +22,6 @@
#include <QTextStream>
#include <qmutex.h>
#include "utility.h"
namespace Mirall {
struct Log{
@@ -37,11 +35,10 @@ struct Log{
QString message;
};
class OWNCLOUDSYNC_EXPORT Logger : public QObject
class Logger : public QObject
{
Q_OBJECT
public:
void log(Log log);
static void csyncLog( const QString& message );
@@ -50,6 +47,7 @@ public:
const QList<Log>& logs() const {return _logs;}
static Logger* instance();
static void destroy();
void postGuiLog(const QString& title, const QString& message);
void postOptionalGuiLog(const QString& title, const QString& message);
@@ -69,12 +67,14 @@ signals:
public slots:
void enterNextLogFile();
private:
protected:
Logger(QObject* parent=0);
~Logger();
QList<Log> _logs;
bool _showTime;
bool _doLogging;
static Logger* _instance;
QFile _logFile;
bool _doFileFlush;
int _logExpire;
+1 -4
Ver Arquivo
@@ -14,9 +14,7 @@
#include <QNetworkRequest>
#include <QNetworkProxy>
#include <QAuthenticator>
#include <QSslConfiguration>
#include "mirall/cookiejar.h"
#include "mirall/mirallaccessmanager.h"
#include "mirall/utility.h"
@@ -26,13 +24,12 @@ namespace Mirall
MirallAccessManager::MirallAccessManager(QObject* parent)
: QNetworkAccessManager (parent)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) && defined(Q_OS_MAC)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// FIXME Workaround http://stackoverflow.com/a/15707366/2941 https://bugreports.qt-project.org/browse/QTBUG-30434
QNetworkProxy proxy = this->proxy();
proxy.setHostName(" ");
setProxy(proxy);
#endif
setCookieJar(new CookieJar);
QObject::connect(this, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
this, SLOT(slotProxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
}
+1 -2
Ver Arquivo
@@ -14,13 +14,12 @@
#ifndef MIRALL_ACCESS_MANAGER_H
#define MIRALL_ACCESS_MANAGER_H
#include "owncloudlib.h"
#include <QNetworkAccessManager>
namespace Mirall
{
class OWNCLOUDSYNC_EXPORT MirallAccessManager : public QNetworkAccessManager
class MirallAccessManager : public QNetworkAccessManager
{
Q_OBJECT
+1 -19
Ver Arquivo
@@ -22,11 +22,7 @@
#include "creds/abstractcredentials.h"
#include "creds/credentialsfactory.h"
#ifndef TOKEN_AUTH_ONLY
#include <QWidget>
#include <QHeaderView>
#endif
#include <QCoreApplication>
#include <QDir>
#include <QFile>
@@ -34,6 +30,7 @@
#include <QSettings>
#include <QDebug>
#include <QNetworkProxy>
#include <QHeaderView>
#define DEFAULT_REMOTE_POLL_INTERVAL 30000 // default remote poll time in milliseconds
#define DEFAULT_MAX_LOG_LINES 20000
@@ -47,7 +44,6 @@ static const char monoIconsC[] = "monoIcons";
static const char optionalDesktopNoficationsC[] = "optionalDesktopNotifications";
static const char skipUpdateCheckC[] = "skipUpdateCheck";
static const char geometryC[] = "geometry";
static const char timeoutC[] = "timeout";
static const char proxyHostC[] = "Proxy/host";
static const char proxyTypeC[] = "Proxy/type";
@@ -104,12 +100,6 @@ bool MirallConfigFile::optionalDesktopNotifications() const
return settings.value(QLatin1String(optionalDesktopNoficationsC), true).toBool();
}
int MirallConfigFile::timeout() const
{
QSettings settings(configFile(), QSettings::IniFormat);
return settings.value(QLatin1String(timeoutC), 300).toInt(); // default to 5 min
}
void MirallConfigFile::setOptionalDesktopNotifications(bool show)
{
QSettings settings(configFile(), QSettings::IniFormat);
@@ -119,25 +109,20 @@ void MirallConfigFile::setOptionalDesktopNotifications(bool show)
void MirallConfigFile::saveGeometry(QWidget *w)
{
#ifndef TOKEN_AUTH_ONLY
Q_ASSERT(!w->objectName().isNull());
QSettings settings(configFile(), QSettings::IniFormat);
settings.beginGroup(w->objectName());
settings.setValue(QLatin1String(geometryC), w->saveGeometry());
settings.sync();
#endif
}
void MirallConfigFile::restoreGeometry(QWidget *w)
{
#ifndef TOKEN_AUTH_ONLY
w->restoreGeometry(getValue(geometryC, w->objectName()).toByteArray());
#endif
}
void MirallConfigFile::saveGeometryHeader(QHeaderView *header)
{
#ifndef TOKEN_AUTH_ONLY
if(!header) return;
Q_ASSERT(!header->objectName().isNull());
@@ -145,19 +130,16 @@ void MirallConfigFile::saveGeometryHeader(QHeaderView *header)
settings.beginGroup(header->objectName());
settings.setValue(QLatin1String(geometryC), header->saveState());
settings.sync();
#endif
}
void MirallConfigFile::restoreGeometryHeader(QHeaderView *header)
{
#ifndef TOKEN_AUTH_ONLY
if(!header) return;
Q_ASSERT(!header->objectName().isNull());
QSettings settings(configFile(), QSettings::IniFormat);
settings.beginGroup(header->objectName());
header->restoreState(getValue(geometryC, header->objectName()).toByteArray());
#endif
}
QVariant MirallConfigFile::getPolicySetting(const QString &setting, const QVariant& defaultValue) const
+1 -4
Ver Arquivo
@@ -15,7 +15,6 @@
#ifndef MIRALLCONFIGFILE_H
#define MIRALLCONFIGFILE_H
#include "owncloudlib.h"
#include <QSharedPointer>
#include <QString>
#include <QVariant>
@@ -27,7 +26,7 @@ namespace Mirall {
class AbstractCredentials;
class OWNCLOUDSYNC_EXPORT MirallConfigFile
class MirallConfigFile
{
public:
MirallConfigFile();
@@ -97,8 +96,6 @@ public:
bool optionalDesktopNotifications() const;
void setOptionalDesktopNotifications(bool show);
int timeout() const;
void saveGeometry(QWidget *w);
void restoreGeometry(QWidget *w);
+1
Ver Arquivo
@@ -34,6 +34,7 @@
#include "creds/credentialsfactory.h"
#include "creds/abstractcredentials.h"
#include "creds/shibbolethcredentials.h"
Q_DECLARE_METATYPE(QTimer*)
+7 -9
Ver Arquivo
@@ -16,7 +16,6 @@
#ifndef NETWORKJOBS_H
#define NETWORKJOBS_H
#include "owncloudlib.h"
#include <QObject>
#include <QNetworkRequest>
#include <QNetworkReply>
@@ -47,7 +46,7 @@ private:
/**
* @brief The AbstractNetworkJob class
*/
class OWNCLOUDSYNC_EXPORT AbstractNetworkJob : public QObject {
class AbstractNetworkJob : public QObject {
Q_OBJECT
public:
explicit AbstractNetworkJob(Account *account, const QString &path, QObject* parent = 0);
@@ -63,6 +62,8 @@ public:
void setReply(QNetworkReply *reply);
QNetworkReply* reply() const { return _reply; }
void setTimeout(qint64 msec);
void resetTimeout();
void setIgnoreCredentialFailure(bool ignore);
bool ignoreCredentialFailure() const { return _ignoreCredentialFailure; }
@@ -70,9 +71,6 @@ public:
QString responseTimestamp();
quint64 duration();
public slots:
void setTimeout(qint64 msec);
void resetTimeout();
signals:
void networkError(QNetworkReply *reply);
protected:
@@ -110,7 +108,7 @@ private:
/**
* @brief The EntityExistsJob class
*/
class OWNCLOUDSYNC_EXPORT EntityExistsJob : public AbstractNetworkJob {
class EntityExistsJob : public AbstractNetworkJob {
Q_OBJECT
public:
explicit EntityExistsJob(Account *account, const QString &path, QObject* parent = 0);
@@ -126,7 +124,7 @@ private slots:
/**
* @brief The LsColJob class
*/
class OWNCLOUDSYNC_EXPORT LsColJob : public AbstractNetworkJob {
class LsColJob : public AbstractNetworkJob {
Q_OBJECT
public:
explicit LsColJob(Account *account, const QString &path, QObject *parent = 0);
@@ -163,7 +161,7 @@ private:
/**
* @brief The MkColJob class
*/
class OWNCLOUDSYNC_EXPORT MkColJob : public AbstractNetworkJob {
class MkColJob : public AbstractNetworkJob {
Q_OBJECT
public:
explicit MkColJob(Account *account, const QString &path, QObject *parent = 0);
@@ -179,7 +177,7 @@ private slots:
/**
* @brief The CheckServerJob class
*/
class OWNCLOUDSYNC_EXPORT CheckServerJob : public AbstractNetworkJob {
class CheckServerJob : public AbstractNetworkJob {
Q_OBJECT
public:
explicit CheckServerJob(Account *account, bool followRedirect = false, QObject *parent = 0);
-2
Ver Arquivo
@@ -161,8 +161,6 @@ void ownCloudGui::startupConnected( bool connected, const QStringList& fails )
}
_startupFails = fails; // store that for the settings dialog once it appears.
if( !_settingsDialog.isNull() )
_settingsDialog->setGeneralErrors( _startupFails );
}
+4 -71
Ver Arquivo
@@ -19,16 +19,9 @@
#include "propagator_qnam.h"
#include "propagatorjobs.h"
#include "propagator_legacy.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/utility.h"
#ifdef Q_OS_WIN
#include <windef.h>
#include <winbase.h>
#endif
#include <QStack>
#include <QFileInfo>
namespace Mirall {
@@ -63,17 +56,10 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
switch( status ) {
case SyncFileItem::SoftError:
case SyncFileItem::FatalError:
// do not blacklist in case of soft error or fatal error.
// do not blacklist in case of soft error.
break;
case SyncFileItem::FatalError:
case SyncFileItem::NormalError:
#ifdef OWNCLOUD_5XX_NO_BLACKLIST
if (_item._httpErrorCode / 100 == 5) {
// In this configuration, never blacklist error 5xx
qDebug() << "Do not blacklist error " << _item._httpErrorCode;
break;
}
#endif
_propagator->_journal->updateBlacklistEntry( record );
break;
case SyncFileItem::Success:
@@ -138,7 +124,7 @@ bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QStr
_restoreJob.reset(newJob);
connect(_restoreJob.data(), SIGNAL(completed(SyncFileItem)),
this, SLOT(slotRestoreJobCompleted(SyncFileItem)));
QMetaObject::invokeMethod(newJob, "start");
_restoreJob->start();
}
return true;
}
@@ -160,8 +146,6 @@ void PropagateItemJob::slotRestoreJobCompleted(const SyncFileItem& item )
}
}
// ================================================================================
PropagateItemJob* OwncloudPropagator::createJob(const SyncFileItem& item) {
switch(item._instruction) {
case CSYNC_INSTRUCTION_REMOVE:
@@ -290,58 +274,6 @@ bool OwncloudPropagator::useLegacyJobs()
return env=="true" || env =="1";
}
int OwncloudPropagator::httpTimeout()
{
static int timeout;
if (!timeout) {
timeout = qgetenv("OWNCLOUD_TIMEOUT").toUInt();
if (timeout == 0) {
MirallConfigFile cfg;
timeout = cfg.timeout();
}
}
return timeout;
}
bool OwncloudPropagator::localFileNameClash( const QString& relFile )
{
bool re = false;
const QString file( _localDir + relFile );
if( !file.isEmpty() && Utility::fsCasePreserving() ) {
#ifdef Q_OS_MAC
QFileInfo fileInfo(file);
if (!fileInfo.exists())
re = false;
else
re = ( ! file.endsWith(fileInfo.canonicalFilePath(), Qt::CaseSensitive) );
#elif defined(Q_OS_WIN)
const QString file( _localDir + relFile );
qDebug() << "CaseClashCheck for " << file;
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFileW( (wchar_t*)file.utf16(), &FindFileData);
if (hFind == INVALID_HANDLE_VALUE) {
qDebug() << "FindFirstFile failed " << GetLastError();
// returns false.
} else {
QString realFileName = QString::fromWCharArray( FindFileData.cFileName );
qDebug() << Q_FUNC_INFO << "Real file name is " << realFileName;
FindClose(hFind);
if( ! file.endsWith(realFileName, Qt::CaseSensitive) ) {
re = true;
}
}
#endif
}
return re;
}
// ================================================================================
void PropagateDirectory::start()
{
@@ -400,4 +332,5 @@ void PropagateDirectory::slotSubJobReady()
}
}
}
+3 -5
Ver Arquivo
@@ -210,19 +210,17 @@ public:
/* The number of currently active jobs */
int _activeJobs;
bool isInSharedDirectory(const QString& file);
bool localFileNameClash(const QString& relfile);
void abort() {
_abortRequested.fetchAndStoreOrdered(true);
if (_rootJob) {
if (_rootJob)
_rootJob->abort();
}
emit finished();
}
// timeout in seconds
static int httpTimeout();
signals:
void completed(const SyncFileItem &);
+5 -10
Ver Arquivo
@@ -152,8 +152,7 @@ void OwncloudSetupWizard::slotOwnCloudFoundAuth(const QUrl& url, const QVariantM
.arg(CheckServerJob::versionString(info))
.arg(CheckServerJob::version(info)));
QString p = url.path();
if (p.endsWith("/status.php")) {
if (url.path().endsWith("/status.php")) {
// We might be redirected, update the account
QUrl redirectedUrl = url;
redirectedUrl.setPath(url.path().left(url.path().length() - 11));
@@ -187,8 +186,7 @@ void OwncloudSetupWizard::slotNoOwnCloudFoundAuthTimeout(const QUrl&url)
void OwncloudSetupWizard::slotConnectToOCUrl( const QString& url )
{
qDebug() << "Connect to url: " << url;
AbstractCredentials *creds = _ocWizard->getCredentials();
_ocWizard->account()->setCredentials(creds);
_ocWizard->account()->setCredentials(_ocWizard->getCredentials());
_ocWizard->setField(QLatin1String("OCUrl"), url );
_ocWizard->appendToConfigurationLog(tr("Trying to connect to %1 at %2...")
.arg( Theme::instance()->appNameGUI() ).arg(url) );
@@ -198,9 +196,7 @@ void OwncloudSetupWizard::slotConnectToOCUrl( const QString& url )
void OwncloudSetupWizard::testOwnCloudConnect()
{
Account *account = _ocWizard->account();
ValidateDavAuthJob *job = new ValidateDavAuthJob(account, this);
ValidateDavAuthJob *job = new ValidateDavAuthJob(_ocWizard->account(), this);
job->setIgnoreCredentialFailure(true);
connect(job, SIGNAL(authResult(QNetworkReply*)), SLOT(slotConnectionCheck(QNetworkReply*)));
job->start();
@@ -359,7 +355,7 @@ bool OwncloudSetupWizard::ensureStartFromScratch(const QString &localFolder) {
QMessageBox::StandardButton but;
but = QMessageBox::question( 0, tr("Folder rename failed"),
tr("Can't remove and back up the folder because the folder or a file in it is open in another program."
" Please close the folder or file and hit retry or cancel the setup."), QMessageBox::Retry | QMessageBox::Abort, QMessageBox::Retry);
"Please close the folder or file and hit retry or cancel the setup."), QMessageBox::Retry | QMessageBox::Abort, QMessageBox::Retry);
if( but == QMessageBox::Abort ) {
break;
}
@@ -486,8 +482,7 @@ ValidateDavAuthJob::ValidateDavAuthJob(Account *account, QObject *parent)
void ValidateDavAuthJob::start()
{
QString p = account()->davPath();
QNetworkReply *reply = getRequest(p);
QNetworkReply *reply = getRequest(account()->davPath());
setReply(reply);
setupConnections(reply);
AbstractNetworkJob::start();

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