Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
Klaas Freitag 6ced577b78 Propagate: Enable Pipelining Attrib for QRequest 2016-02-15 14:12:16 +01:00
269 arquivos alterados com 26140 adições e 39289 exclusões
+1 -1
Ver Arquivo
@@ -3,7 +3,7 @@
url = https://github.com/owncloud/documentation
[submodule "src/3rdparty/qtmacgoodies"]
path = src/3rdparty/qtmacgoodies
url = https://github.com/guruz/qtmacgoodies.git
url = git://github.com/guruz/qtmacgoodies.git
[submodule "binary"]
path = binary
url = git://github.com/owncloud/owncloud-client-binary.git
+29 -6
Ver Arquivo
@@ -20,11 +20,6 @@ if (NOT DEFINED APPLICATION_SHORTNAME)
set ( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
endif()
# For usage in XML files we preprocess
string(REPLACE "&" "&" APPLICATION_NAME_XML_ESCAPED "${APPLICATION_NAME}")
string(REPLACE "<" "&lt;" APPLICATION_NAME_XML_ESCAPED "${APPLICATION_NAME_XML_ESCAPED}")
string(REPLACE ">" "&gt;" APPLICATION_NAME_XML_ESCAPED "${APPLICATION_NAME_XML_ESCAPED}")
set(PACKAGE "${APPLICATION_SHORTNAME}-client")
set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
@@ -35,7 +30,7 @@ endif()
include(Warnings)
include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/")
# disable the crashreporter if libcrashreporter-qt is not available or we're building for ARM
if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/libcrashreporter-qt/CMakeLists.txt")
@@ -56,7 +51,9 @@ endif()
include(GNUInstallDirs)
include(DefineInstallationPaths)
include(QtVersionAbstraction)
setup_qt()
include(GetGitRevisionDescription)
@@ -129,8 +126,34 @@ if(APPLE)
set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
endif()
#### find libs
#find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
#if( UNIX AND NOT APPLE ) # Fdo notifications
# find_package(Qt4 4.7.0 COMPONENTS QtDBus REQUIRED )
#endif()
if(HAVE_QT5)
if (${Qt5Core_VERSION_MAJOR} EQUAL "5")
if (${Qt5Core_VERSION_MINOR} EQUAL "4" OR ${Qt5Core_VERSION_MINOR} GREATER 4)
else()
message(STATUS "If possible compile me with Qt 5.4 or higher.")
endif()
endif()
else()
message(STATUS "If possible compile me with Qt 5.4 or higher.")
endif()
find_package(OpenSSL 1.0.0 REQUIRED)
if(NOT TOKEN_AUTH_ONLY)
if (Qt5Core_DIR)
find_package(Qt5Keychain REQUIRED)
else()
find_package(QtKeychain REQUIRED)
endif()
endif()
if(APPLE)
find_package(Sparkle)
endif(APPLE)
-23
Ver Arquivo
@@ -1,28 +1,5 @@
ChangeLog
=========
version 2.2.0 (release 2016-05-12)
* Overlay icons: Refactoring - mainly for performance improvements
* Improved error handling with Sync Journal on USB storages (#4632)
* Sharing Completion: Improved UI of completion in sharing from desktop. (#3737)
* Show server notifications on the client (#3733)
* Improved Speed with small files by dynamic parallel request count (#4529)
* LockWatcher: Make sure to sync files after apps released exclusive locks on Windows.
* Improved handling of Win32 file locks and network files
* Workaround Ubuntu 16.04 tray icon bug (#4693)
* Removed the Alias field from the folder definition (#4695)
* Improved netrc parser (#4691)
* Improved user notifications about ignored files and conflicts (#4761, #3222)
* Add warnings for old server versions (#4523)
* Enable tranportation checksums if the server supports based on server capabilities (#3735)
* Default Chunk-size changed to 10MB (#4354)
* Documentation Improvements, ie. about overlay icons
* Translation fixes
* Countless other bugfixes
* Sqlite Update to recent version
* Update of QtKeyChain to support Windows credential store
* Packaging of dolphin overlay icon module for bleeding edge distros
version 2.1.1 (release 2016-02-10)
* UI improvements for HiDPI screens, error messages, RTL languages
* Fix occurences of "Connection Closed" when a new unauthenticated TCP socket is used
+1 -2
Ver Arquivo
@@ -1,11 +1,10 @@
set( MIRALL_VERSION_MAJOR 2 )
set( MIRALL_VERSION_MINOR 2 )
set( MIRALL_VERSION_PATCH 0 )
set( MIRALL_VERSION_YEAR 2016 )
set( MIRALL_SOVERSION 0 )
if ( NOT DEFINED MIRALL_VERSION_SUFFIX )
set( MIRALL_VERSION_SUFFIX "") #e.g. beta1, beta2, rc1
set( MIRALL_VERSION_SUFFIX "git") #e.g. beta1, beta2, rc1
endif( NOT DEFINED MIRALL_VERSION_SUFFIX )
if( NOT DEFINED MIRALL_VERSION_BUILD )
+3 -3
Ver Arquivo
@@ -497,7 +497,7 @@
<key>IDENTIFIER</key>
<string>@APPLICATION_REV_DOMAIN_INSTALLER@</string>
<key>NAME</key>
<string>@APPLICATION_NAME_XML_ESCAPED@</string>
<string>@APPLICATION_NAME@</string>
<key>OVERWRITE_PERMISSIONS</key>
<false/>
<key>VERSION</key>
@@ -1245,7 +1245,7 @@
<key>LANGUAGE</key>
<string>English</string>
<key>VALUE</key>
<string>@APPLICATION_NAME_XML_ESCAPED@ Client</string>
<string>@APPLICATION_NAME@ Client</string>
</dict>
</array>
</dict>
@@ -1445,7 +1445,7 @@
</dict>
</array>
<key>NAME</key>
<string>@APPLICATION_NAME_XML_ESCAPED@ Installer</string>
<string>@APPLICATION_NAME@ Installer</string>
<key>REFERENCE_FOLDER_PATH</key>
<string>@CMAKE_INSTALL_DIR@</string>
</dict>
+1 -3
Ver Arquivo
@@ -12,10 +12,8 @@ EOF
if [ -x "$(command -v pluginkit)" ]; then
# add it to DB. This happens automatically too but we try to push it a bit harder for issue #3463
pluginkit -a "/Applications/@APPLICATION_EXECUTABLE@.app/Contents/PlugIns/FinderSyncExt.appex/"
# Since El Capitan we need to sleep #4650
sleep 10s
# enable it
pluginkit -e use -i @APPLICATION_REV_DOMAIN@.FinderSyncExt
fi
exit 0
exit 0
+5 -13
Ver Arquivo
@@ -1,7 +1,7 @@
## Patches used
There are our patches on top of Qt 5.4.0, which we are currently
using for our binary packages on Windows and Mac OS X. Most of them
using for our binary packages on Windows and Mac OS. Most of them
have been sent upstream and are part of newer Qt releases.
All changes are designed to up upstream, and all those that are
@@ -28,26 +28,18 @@ purpose is outlined in each patches' front matter.
* 0007-X-Network-Fix-up-previous-corruption-patch.patch
* 0008-QNAM-Fix-reply-deadlocks-on-server-closing-connectio.patch
* 0014-Fix-SNI-for-TlsV1_0OrLater-TlsV1_1OrLater-and-TlsV1_.patch
* 0016-Fix-possible-crash-when-passing-an-invalid-PAC-URL.patch
* 0011-Make-sure-to-report-correct-NetworkAccessibility.patch
### Part of Qt v5.5.2 (UNRELEASED!)
* 0009-QNAM-Assign-proper-channel-before-sslErrors-emission.patch
* 0010-Don-t-let-closed-http-sockets-pass-as-valid-connecti.patch
* 0012-Make-sure-networkAccessibilityChanged-is-emitted.patch
### Part of Qt v5.6 and later
### Upstreamed but not in any release yet (as of 2015-11-16)
* 0009-QNAM-Assign-proper-channel-before-sslErrors-emission.patch
* 0010-Don-t-let-closed-http-sockets-pass-as-valid-connecti.patch
* 0011-Make-sure-to-report-correct-NetworkAccessibility.patch
* 0012-Make-sure-networkAccessibilityChanged-is-emitted.patch
* 0013-Make-UnknownAccessibility-not-block-requests.patch
* 0015-Remove-legacy-platform-code-in-QSslSocket-for-OS-X-1.patch
* 0016-Fix-possible-crash-when-passing-an-invalid-PAC-URL.patch
* 0019-Ensure-system-tray-icon-is-prepared-even-when-menu-bar.patch
### Part of Qt 5.7 and later
* 0015-Remove-legacy-platform-code-in-QSslSocket-for-OS-X-1.patch
### Not submitted upstream to be part of any release:
### Not submitted to be part of any release:
* 0006-Fix-force-debug-info-with-macx-clang_NOUPSTREAM.patch
This is only needed if you intent to harvest debugging symbols
for breakpad.
+2 -2
Ver Arquivo
@@ -5,11 +5,11 @@ MAINTAINER Daniel Molkentin <danimo@owncloud.com>
ENV TERM ansi
ENV HOME /root
ENV REFRESHED_AT 20160421
ENV REFRESHED_AT 20160202
RUN zypper --non-interactive --gpg-auto-import-keys refresh
RUN zypper --non-interactive --gpg-auto-import-keys ar http://download.opensuse.org/repositories/windows:/mingw/openSUSE_42.1/windows:mingw.repo
RUN zypper --non-interactive --gpg-auto-import-keys ar http://download.opensuse.org/repositories/isv:ownCloud:toolchains:mingw:win32:2.2/openSUSE_Leap_42.1/isv:ownCloud:toolchains:mingw:win32:2.2.repo
RUN zypper --non-interactive --gpg-auto-import-keys ar http://download.opensuse.org/repositories/isv:ownCloud:toolchains:mingw:win32:2.1/openSUSE_Leap_42.1/isv:ownCloud:toolchains:mingw:win32:2.1.repo
RUN zypper --non-interactive --gpg-auto-import-keys install cmake make mingw32-cross-binutils mingw32-cross-cpp mingw32-cross-gcc \
mingw32-cross-gcc-c++ mingw32-cross-pkg-config mingw32-filesystem \
mingw32-headers mingw32-runtime site-config mingw32-libwebp \
+3 -3
Ver Arquivo
@@ -1,11 +1,11 @@
# Auto-generated - do not modify
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Toon opmerkingen bij deze uitgave"
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Toon releaseopmerkingen"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Gevonden ${APPLICATION_EXECUTABLE} proces(sen) moet worden gestopt.$\nWilt u dat het installatieprogramma dat voor u doet?"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "Stoppen ${APPLICATION_EXECUTABLE} processen."
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Het te stoppen proces is niet gevonden!"
StrCpy $PageReinstall_NEW_Field_1 "Er is een oudere versie van ${APPLICATION_NAME} geïnstalleerd op uw systeem. geadviseerd wordt om de huidige versie te de-installeren voordat de nieuwe versie wordt geïnstalleerd. Selecteer de uit te voeren actie en klik op Verder om door te gaan."
StrCpy $PageReinstall_NEW_Field_2 "Verwijder oude versie"
StrCpy $PageReinstall_NEW_Field_3 "Behoud oude versie"
StrCpy $PageReinstall_NEW_Field_2 "De-installeren voor installeren"
StrCpy $PageReinstall_NEW_Field_3 "Niet de-installeren"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Al geïnstalleerd"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Kies hoe u ${APPLICATION_NAME} wilt installeren."
StrCpy $PageReinstall_OLD_Field_1 "Er is al een recentere versie van ${APPLICATION_NAME} geïnstalleerd! Installeren van een oudere versie wordt niet aangeraden. Als u echt de oudere versie wilt installeren, adviseren we de huidige versie eerst te verwijderen. Kies de actie die u wilt uitvoeren en druk op Verder om door te gaan."
+1 -1
Ver Arquivo
@@ -38,6 +38,6 @@ StrCpy $UAC_ERROR_ELEVATE "Rechte k
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "Dieses Installationsprogramm erfordert Administrator-Rechte, bitte erneut versuchen"
StrCpy $INIT_INSTALLER_RUNNING "Das Installationsprogramm wird bereits ausgeführt."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Das Deinstallationsprogramm erfordert Administrator-Rechte. Bitte erneut versuchen."
StrCpy $UAC_ERROR_LOGON_SERVICE "Anmeldedienst läuft nicht, abbruch!"
StrCpy $INIT_UNINSTALLER_RUNNING "Das Deinstallationsprogramm wird bereits ausgeführt."
StrCpy $SectionGroup_Shortcuts "Verknüpfungen"
StrCpy $UAC_ERROR_LOGON_SERVICE "Logon service is not running, aborting!"
+4 -4
Ver Arquivo
@@ -7,7 +7,7 @@ StrCpy $PageReinstall_NEW_Field_1 "Az ${APPLICATION_NAME} alkalmazás egy régeb
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álassza ki, hogy szeretné telepíteni a következő alkalmazást: ${APPLICATION_NAME}."
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Válaszd ki, hogy szeretnéd telepíteni a következő alkalmazást ${APPLICATION_NAME}."
StrCpy $PageReinstall_OLD_Field_1 "Az ${APPLICATION_NAME} alkalmazás egy újabb verziója már megtalálható a rendszeren. Nem ajánlott egy régebbi verzió telepítése. Ha valóban szeretné a régebbi verziót telepíteni, akkor ajánlott a jelenleg telepített verzió eltávolítása. Válassza ki milyen műveletet szeretne végrehajtani, és nyomja meg a $\"Következő$\" gombot a folytatáshoz."
StrCpy $PageReinstall_SAME_Field_1 "Az ${APPLICATION_NAME} alkalmazás ${VERSION} verziója már telepítve van.$↩$\nKérjük válaszd ki milyen műveletet szeretnél végrehajtani, és nyomd meg a „Következő” gombot."
StrCpy $PageReinstall_SAME_Field_2 "Komponens hozzáadása/újratelepítése"
@@ -31,13 +31,13 @@ StrCpy $UNINSTALLER_FILE_Detail "Elltávolító írása"
StrCpy $UNINSTALLER_REGISTRY_Detail "Telepítési registry kulcsok írása"
StrCpy $UNINSTALLER_FINISHED_Detail "Befejezve!"
StrCpy $UNINSTALL_MESSAGEBOX "Nem sikerült az ${APPLICATION_NAME} alkalmazás telepítése a '$INSTDIR' könyvtárba.$\n$\nSzeretné mindenképpen folytatni (nem ajánlott)?"
StrCpy $UNINSTALL_ABORT "Az eltávolítást a felhasználó megszakította"
StrCpy $UNINSTALL_ABORT "Az eltávolítást egy felhasználó megszakította"
StrCpy $INIT_NO_QUICK_LAUNCH "Gyorsindító hivatkozás (N/A)"
StrCpy $INIT_NO_DESKTOP "Asztali hivatkozás (felülírja a meglévőt)"
StrCpy $UAC_ERROR_ELEVATE "Nem sikerült felemelni, hiba:"
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "A telepítő futtatásához adminisztrátori hozzáférés szükséges, próbálja újra."
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "A telepítő futtatásához adminisztrátori hozzáférés szükséges, próbáld újra."
StrCpy $INIT_INSTALLER_RUNNING "A telepítő már fut."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Az eltávolító futtatásához adminisztrátori hozzáférés szükséges, próbálja újra."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Az eltávolító futtatásához adminisztrátori hozzáférés szükséges, próbáld újra."
StrCpy $UAC_ERROR_LOGON_SERVICE "A bejelentkező szolgáltatás nem fut, megszakítás!"
StrCpy $INIT_UNINSTALLER_RUNNING "Az eltávolító már fut."
StrCpy $SectionGroup_Shortcuts "Parancsikonok"
+2 -2
Ver Arquivo
@@ -9,7 +9,6 @@ StrCpy $PageReinstall_NEW_Field_3 "Nie usuwaj "
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Ju¿ zainstalowane"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Wybierz jak chcesz zainstalowaæ ${APPLICATION_NAME}."
StrCpy $PageReinstall_OLD_Field_1 "Zainstalowana jest nowsza wersja ${APPLICATION_NAME}! Niezalecane jest instalowanie starszej wersji. Jeœli naprawdê chcesz zainstalowaæ starsz¹ wersjê lepiej najpierw odinstalowaæ obecn¹ aplikacjê. Wybierz operacjê któr¹ chcesz wykonaæ i naciœnij przycisk Dalej."
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} jest ju¿ zainstalowany.$\nWybierz operacjê któr¹ chcesz wykonaæ i naciœnij przycisk Dalej."
StrCpy $PageReinstall_SAME_Field_2 "Doda/Przeinstaluj komponenty"
StrCpy $PageReinstall_SAME_Field_3 "Odinstaluj ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "Odinstaluj ${APPLICATION_NAME}"
@@ -38,6 +37,7 @@ StrCpy $UAC_ERROR_ELEVATE "Niemo
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "Ten instalator potrzebuje uprawnieñ administratora, spróbuj ponownie"
StrCpy $INIT_INSTALLER_RUNNING "Instalator ju¿ jest uruchomiony."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Ten dezinstalator potrzebuje uprawnieñ administratora, spróbuj ponownie"
StrCpy $UAC_ERROR_LOGON_SERVICE "Proces logowania nie jest uruchomiony, przerywam !"
StrCpy $INIT_UNINSTALLER_RUNNING "Dezinstalator ju¿ jest uruchomiony."
StrCpy $SectionGroup_Shortcuts "Skróty"
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} is already installed.$\r$\nSelect the operation you want to perform and click Next to continue."
StrCpy $UAC_ERROR_LOGON_SERVICE "Logon service is not running, aborting!"
+1 -1
Ver Arquivo
@@ -1,6 +1,6 @@
# Auto-generated - do not modify
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostrar notas de lançamento"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Existem ${APPLICATION_EXECUTABLE} processo(s) em execução que precisa(m) de ser interrompido(s).$\nDeseja que o instalador o(s) termine automaticamente?"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Processos(s) ${APPLICATION_EXECUTABLE} em execução. Estes processos precisam de ser interrompidos.$\nDeseja que o instalador os termine automaticamente?"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "A terminar os processos ${APPLICATION_EXECUTABLE}."
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Não foi encontrado o processo a terminar!"
StrCpy $PageReinstall_NEW_Field_1 "Uma versão antiga de ${APPLICATION_NAME} está instalada no sistema. É recomendado que você desinstale a versão atual antes de instalar a mais recente. Selecione a operação que deseja executar e clique em $\"Avançar$\" para continuar."
+3 -3
Ver Arquivo
@@ -1,8 +1,8 @@
# Auto-generated - do not modify
StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "查看版本日志"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "有 ${APPLICATION_EXECUTABLE} 项进程需要关闭。$\n您想让安装程序关闭这些进程吗?"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "停止${APPLICATION_EXECUTABLE}进程。"
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "未找到要停止的进程!"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "杀死${APPLICATION_EXECUTABLE}进程。"
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "未找到要杀死的进程!"
StrCpy $PageReinstall_NEW_Field_1 "您的系统已经安装${APPLICATION_NAME}较老版本。建议安装前卸载当前版本。选择将要执行的操作,点击下一步继续。"
StrCpy $PageReinstall_NEW_Field_2 "在安装前先卸载"
StrCpy $PageReinstall_NEW_Field_3 "不要卸载"
@@ -38,6 +38,6 @@ StrCpy $UAC_ERROR_ELEVATE "无法获得权限,错误:"
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "安装程序需要管理员权限,请重试"
StrCpy $INIT_INSTALLER_RUNNING "安装程序已经运行。"
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "卸载程序需要管理员权限,请重试"
StrCpy $UAC_ERROR_LOGON_SERVICE "登录服务器未运行!"
StrCpy $INIT_UNINSTALLER_RUNNING "卸载程序已经运行。"
StrCpy $SectionGroup_Shortcuts "快捷方式"
StrCpy $UAC_ERROR_LOGON_SERVICE "Logon service is not running, aborting!"
+3 -3
Ver Arquivo
@@ -14,8 +14,6 @@ StrCpy $PageReinstall_SAME_Field_3 "Avinstallera ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "Avinstallera ${APPLICATION_NAME}"
StrCpy $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE "Välj underhålls alternativ att utföra."
StrCpy $SEC_APPLICATION_DETAILS "Installerar ${APPLICATION_NAME} väsentligheter."
StrCpy $OPTION_SECTION_SC_SHELL_EXT_SECTION "Integration för Windows Explorer"
StrCpy $OPTION_SECTION_SC_SHELL_EXT_DetailPrint "Installerar integration för Windows Explorer"
StrCpy $OPTION_SECTION_SC_START_MENU_SECTION "Start-meny program genväg"
StrCpy $OPTION_SECTION_SC_START_MENU_DetailPrint "Lägger till genväg för ${APPLICATION_NAME} till Start-menyn."
StrCpy $OPTION_SECTION_SC_DESKTOP_SECTION "Skrivbordsgenväg"
@@ -37,7 +35,9 @@ StrCpy $UAC_ERROR_ELEVATE "Kunde inte få förhöjda rättigheter, fel:"
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "Detta installationsprogram kräver adminstratörs rättigheter, försök igen"
StrCpy $INIT_INSTALLER_RUNNING "Installationsprogrammet körs redan."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Detta avinstallationsprogram kräver administratörsrättigheter, försök igen"
StrCpy $UAC_ERROR_LOGON_SERVICE "Login-service körs inte, avbryter!"
StrCpy $INIT_UNINSTALLER_RUNNING "Avinstallationsprogrammet körs redan."
StrCpy $SectionGroup_Shortcuts "Genvägar"
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_SHELL_EXT_SECTION "Integration for Windows Explorer"
StrCpy $OPTION_SECTION_SC_SHELL_EXT_DetailPrint "Installing Integration for Windows Explorer"
StrCpy $UAC_ERROR_LOGON_SERVICE "Logon service is not running, aborting!"
+3 -3
Ver Arquivo
@@ -3,13 +3,13 @@ StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "แสดงบันทึกป
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "พบว่ากระบวนการ ${APPLICATION_EXECUTABLE} จะต้องหยุดทำงาน$\nคุณต้องการติดตั้งเพื่อหยุดการทำงานเหล่านี้ของคุณ?"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "ฆ่ากระบวนการทำงาน ${APPLICATION_EXECUTABLE}"
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "ไม่พบการฆ่ากระบวนการ!"
StrCpy $PageReinstall_NEW_Field_1 "รุ่นเก่าของ ${APPLICATION_NAME} ได้ถูกติดตั้งในระบบของคุณ ขอแนะนำให้คุณถอนการติดตั้งรุ่นปัจจุบันออกก่อน แล้วเลือกการดำเนินการที่คุณต้องการหลังจากนั้นคลิกถัดไปเพื่อดำเนินการต่อ"
StrCpy $PageReinstall_NEW_Field_1 "รุ่นเก่าของ ${APPLICATION_NAME} มีการติดตั้งในระบบของคุณ ขอแนะนำให้คุณถอนการติดตั้งรุ่นปัจจุบันออกก่อน เลือกการดำเนินการที่คุณต้องการที่จะดำเนินการและคลิกถัดไปเพื่อดำเนินการต่อ"
StrCpy $PageReinstall_NEW_Field_2 "ถอนการติดตั้งก่อนการติดตั้ง"
StrCpy $PageReinstall_NEW_Field_3 "อย่าถอนการติดตั้ง"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "ติดตั้งแล้ว"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "เลือกวิธีที่คุณต้องการติดตั้ง ${APPLICATION_NAME}"
StrCpy $PageReinstall_OLD_Field_1 "รุ่นใหม่ของ ${APPLICATION_NAME} ถูกติดตั้งแล้ว! เราไม่แนะนำให้คุณติดตั้งรุ่นที่เก่ากว่า ถ้าคุณอยากจะติดตั้งรุ่นเก่าก็สามารถอนการติดตั้งได้"
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} รุ่น ${VERSION} ถูกติดตั้งไปแล้ว$ $\nเลือกดำเนินงานที่คุณต้องการและคลิกถัดไปเพื่อดำเนินการต่อ"
StrCpy $PageReinstall_OLD_Field_1 "รุ่นใหม่ของ ${APPLICATION_NAME} ถูกติดตั้งแล้ว! เราไม่แนะนำให้คุณติดตั้งรุ่นเก่า ถ้าคุณอยากจะติดตั้งรุ่นเก่าก็สามารถอนการติดตั้งได้"
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} ถูกติดตั้งไปแล้ว$ $\nเลือกดำเนินงานที่คุณต้องการและคลิกถัดไปเพื่อดำเนินการต่อ"
StrCpy $PageReinstall_SAME_Field_2 "ส่วนประกอบ เพิ่ม/ติดตั้งใหม่ "
StrCpy $PageReinstall_SAME_Field_3 "ถอนการติดตั้ง ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "ถอนการติดตั้ง ${APPLICATION_NAME}"
+2 -2
Ver Arquivo
@@ -9,7 +9,6 @@ StrCpy $PageReinstall_NEW_Field_3 "Не видаляти"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Установлено"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Оберіть, як ви хочете установити ${APPLICATION_NAME}."
StrCpy $PageReinstall_OLD_Field_1 "Знайдено новішу версію ${APPLICATION_NAME}! Ми не рекомендуємо встановлювати стару версію. Якщо ви все ж бажаєте встановити цю версію, спочатку видаліть поточну версію. Оберіть подальшу дію та натисніть $\"Далі$\"."
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} вже встановлено.$\n$\nОберіть подальшу дію та натисніть $\"Далі$\" для продовження."
StrCpy $PageReinstall_SAME_Field_2 "Додати/Перевстановити компоненти"
StrCpy $PageReinstall_SAME_Field_3 "Видалити ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "Видалити ${APPLICATION_NAME}"
@@ -38,6 +37,7 @@ StrCpy $UAC_ERROR_ELEVATE "Неможливо підняти, помилка:"
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "Для установки потрібні права адміністратора, спробуйте ще раз"
StrCpy $INIT_INSTALLER_RUNNING "Установка вже запущена."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Для видалення потрібні права адміністратора, спробуйте ще раз"
StrCpy $UAC_ERROR_LOGON_SERVICE "Сервіс авторизації не запущений, припиняю!"
StrCpy $INIT_UNINSTALLER_RUNNING "Програма видалення вже запущено."
StrCpy $SectionGroup_Shortcuts "Ярлики"
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} is already installed.$\r$\nSelect the operation you want to perform and click Next to continue."
StrCpy $UAC_ERROR_LOGON_SERVICE "Logon service is not running, aborting!"
+1 -1
Submodule binary updated: d27d472817...71633edc9a
-1
Ver Arquivo
@@ -22,6 +22,5 @@
<file>resources/account.png</file>
<file>resources/more.png</file>
<file>resources/delete.png</file>
<file>resources/bell.png</file>
</qresource>
</RCC>
+1 -1
Ver Arquivo
@@ -17,7 +17,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>@APPLICATION_NAME_XML_ESCAPED@ @MIRALL_VERSION_STRING@</string>
<string>@APPLICATION_NAME@ @MIRALL_VERSION_STRING@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
+1 -11
Ver Arquivo
@@ -620,6 +620,7 @@ Section Uninstall
!insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCOverlays_x64.dll"
!insertmacro UnInstallLib DLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCUtil_x64.dll"
!undef LIBRARY_X64
${Else}
DetailPrint "Uninstalling x86 overlay DLLs"
!insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCContextMenu_x86.dll"
!insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_PROTECTED "$INSTDIR\shellext\OCOverlays_x86.dll"
@@ -756,12 +757,6 @@ Function .onInit
;Shutdown ${APPLICATION_NAME} in case Add/Remove re-installer option used.
Call EnsureOwncloudShutdown
ReadRegStr $R0 ${MEMENTO_REGISTRY_ROOT} "${MEMENTO_REGISTRY_KEY}" "InstallLocation"
${If} ${Silent}
${AndIf} $R0 != ""
ExecWait '"$R0\Uninstall.exe" /S _?=$R0'
${EndIf}
FunctionEnd
Function .onInstSuccess
@@ -771,11 +766,6 @@ Function .onInstSuccess
WriteRegDWORD HKLM "Software\${APPLICATION_VENDOR}\${APPLICATION_NAME}" "skipUpdateCheck" "1"
${EndIf}
; TODO: Only needed to when updating from 2.1.{0,1}. Remove in due time.
Delete /REBOOTOK $INSTDIR\bearer\qgenericbearer.dll
Delete /REBOOTOK $INSTDIR\bearer\qnativewifibearer.dll
RMDir /REBOOTOK $INSTDIR\bearer
${If} ${Silent}
${AndIf} $InstallRunIfSilent == "yes"
Call LaunchApplication
-3
Ver Arquivo
@@ -18,9 +18,6 @@ if( Qt5Core_FOUND )
find_package(Qt5Network REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5Concurrent REQUIRED)
if(UNIT_TESTING)
find_package(Qt5Test REQUIRED)
endif()
if(NOT TOKEN_AUTH_ONLY)
find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5WebKit REQUIRED)
+6
Ver Arquivo
@@ -128,4 +128,10 @@ else()
)
endif()
# INSTALL(
# FILES
# ${csync_HDRS}
# DESTINATION
# ${INCLUDE_INSTALL_DIR}/${APPLICATION_NAME}
# )
+70 -10
Ver Arquivo
@@ -25,7 +25,6 @@
#define _GNU_SOURCE
#endif
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
@@ -90,11 +89,14 @@ static int _data_cmp(const void *key, const void *data) {
return 0;
}
void csync_create(CSYNC **csync, const char *local, const char *remote) {
int csync_create(CSYNC **csync, const char *local, const char *remote) {
CSYNC *ctx;
size_t len = 0;
ctx = c_malloc(sizeof(CSYNC));
if (ctx == NULL) {
return -1;
}
ctx->status_code = CSYNC_STATUS_OK;
@@ -119,21 +121,46 @@ void csync_create(CSYNC **csync, const char *local, const char *remote) {
ctx->ignore_hidden_files = true;
*csync = ctx;
return 0;
}
void csync_init(CSYNC *ctx) {
assert(ctx);
/* Do not initialize twice */
int csync_init(CSYNC *ctx) {
int rc;
if (ctx == NULL) {
errno = EBADF;
return -1;
}
assert(!(ctx->status & CSYNC_STATUS_INIT));
ctx->status_code = CSYNC_STATUS_OK;
/* Do not initialize twice */
if (ctx->status & CSYNC_STATUS_INIT) {
return 1;
}
/* check for uri */
if (csync_fnmatch("owncloud://*", ctx->remote.uri, 0) == 0 && csync_fnmatch("ownclouds://*", ctx->remote.uri, 0) == 0) {
ctx->status_code = CSYNC_STATUS_NO_MODULE;
rc = -1;
goto out;
}
ctx->local.type = LOCAL_REPLICA;
ctx->remote.type = REMOTE_REPLICA;
c_rbtree_create(&ctx->local.tree, _key_cmp, _data_cmp);
c_rbtree_create(&ctx->remote.tree, _key_cmp, _data_cmp);
if (c_rbtree_create(&ctx->local.tree, _key_cmp, _data_cmp) < 0) {
ctx->status_code = CSYNC_STATUS_TREE_ERROR;
rc = -1;
goto out;
}
if (c_rbtree_create(&ctx->remote.tree, _key_cmp, _data_cmp) < 0) {
ctx->status_code = CSYNC_STATUS_TREE_ERROR;
rc = -1;
goto out;
}
ctx->remote.root_perms = 0;
@@ -141,6 +168,11 @@ void csync_init(CSYNC *ctx) {
/* initialize random generator */
srand(time(NULL));
rc = 0;
out:
return rc;
}
int csync_update(CSYNC *ctx) {
@@ -548,17 +580,29 @@ int csync_commit(CSYNC *ctx) {
ctx->remote.read_from_db = 0;
ctx->read_remote_from_db = true;
ctx->db_is_empty = false;
ctx->ignore_hidden_files = true; // do NOT sync hidden files by default.
/* Create new trees */
c_rbtree_create(&ctx->local.tree, _key_cmp, _data_cmp);
c_rbtree_create(&ctx->remote.tree, _key_cmp, _data_cmp);
rc = c_rbtree_create(&ctx->local.tree, _key_cmp, _data_cmp);
if (rc < 0) {
ctx->status_code = CSYNC_STATUS_TREE_ERROR;
goto out;
}
rc = c_rbtree_create(&ctx->remote.tree, _key_cmp, _data_cmp);
if (rc < 0) {
ctx->status_code = CSYNC_STATUS_TREE_ERROR;
goto out;
}
ctx->status = CSYNC_STATUS_INIT;
SAFE_FREE(ctx->error_string);
rc = 0;
out:
return rc;
}
@@ -578,6 +622,9 @@ int csync_destroy(CSYNC *ctx) {
}
ctx->statedb.db = NULL;
/* destroy exclude list */
csync_exclude_destroy(ctx);
_csync_clean_ctx(ctx);
SAFE_FREE(ctx->local.uri);
@@ -593,6 +640,19 @@ int csync_destroy(CSYNC *ctx) {
return rc;
}
int csync_add_exclude_list(CSYNC *ctx, const char *path) {
if (ctx == NULL || path == NULL) {
return -1;
}
return csync_exclude_load(path, &ctx->excludes);
}
void csync_clear_exclude_list(CSYNC *ctx)
{
csync_exclude_clear(ctx);
}
void *csync_get_userdata(CSYNC *ctx) {
if (ctx == NULL) {
return NULL;
+38 -16
Ver Arquivo
@@ -316,8 +316,10 @@ typedef const char* (*csync_checksum_hook) (
* @brief Allocate a csync context.
*
* @param csync The context variable to allocate.
*
* @return 0 on success, less than 0 if an error occured.
*/
void csync_create(CSYNC **csync, const char *local, const char *remote);
int csync_create(CSYNC **csync, const char *local, const char *remote);
/**
* @brief Initialize the file synchronizer.
@@ -325,15 +327,17 @@ void csync_create(CSYNC **csync, const char *local, const char *remote);
* This function loads the configuration
*
* @param ctx The context to initialize.
*
* @return 0 on success, less than 0 if an error occured.
*/
void csync_init(CSYNC *ctx);
int csync_init(CSYNC *ctx);
/**
* @brief Update detection
*
* @param ctx The context to run the update detection on.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_update(CSYNC *ctx);
@@ -342,7 +346,7 @@ int csync_update(CSYNC *ctx);
*
* @param ctx The context to run the reconciliation on.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_reconcile(CSYNC *ctx);
@@ -351,7 +355,7 @@ int csync_reconcile(CSYNC *ctx);
*
* @param ctx The context to commit.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_commit(CSYNC *ctx);
@@ -362,17 +366,35 @@ int csync_commit(CSYNC *ctx);
*
* @param ctx The context to destroy.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_destroy(CSYNC *ctx);
/**
* @brief Add an additional exclude list.
*
* @param ctx The context to add the exclude list.
*
* @param path The path pointing to the file.
*
* @return 0 on success, less than 0 if an error occured.
*/
int csync_add_exclude_list(CSYNC *ctx, const char *path);
/**
* @brief Removes all items imported from exclude lists.
*
* @param ctx The context to add the exclude list.
*/
void csync_clear_exclude_list(CSYNC *ctx);
/**
* @brief Get the userdata saved in the context.
*
* @param ctx The csync context.
*
* @return The userdata saved in the context, NULL if an error
* occurred.
* occured.
*/
void *csync_get_userdata(CSYNC *ctx);
@@ -384,7 +406,7 @@ void *csync_get_userdata(CSYNC *ctx);
*
* @param userdata The userdata to be stored in the context.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_set_userdata(CSYNC *ctx, void *userdata);
@@ -394,7 +416,7 @@ int csync_set_userdata(CSYNC *ctx, void *userdata);
* @param ctx The csync context.
*
* @return The authentication callback set or NULL if an error
* occurred.
* occured.
*/
csync_auth_callback csync_get_auth_callback(CSYNC *ctx);
@@ -405,7 +427,7 @@ csync_auth_callback csync_get_auth_callback(CSYNC *ctx);
*
* @param cb The authentication callback.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
@@ -414,7 +436,7 @@ int csync_set_auth_callback(CSYNC *ctx, csync_auth_callback cb);
*
* @param[in] level The log verbosity.
*
* @return 0 on success, < 0 if an error occurred.
* @return 0 on success, < 0 if an error occured.
*/
int csync_set_log_level(int level);
@@ -429,7 +451,7 @@ int csync_get_log_level(void);
* @brief Get the logging callback set.
*
* @return The logging callback set or NULL if an error
* occurred.
* occured.
*/
csync_log_callback csync_get_log_callback(void);
@@ -438,7 +460,7 @@ csync_log_callback csync_get_log_callback(void);
*
* @param cb The logging callback.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_set_log_callback(csync_log_callback cb);
@@ -454,7 +476,7 @@ void *csync_get_log_userdata(void);
*
* @param[in] data The userdata to set.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_set_log_userdata(void *data);
@@ -473,7 +495,7 @@ typedef int csync_treewalk_visit_func(TREE_WALK_FILE* ,void*);
* @param visitor A callback function to handle the file info.
* @param filter A filter, built from or'ed csync_instructions_e
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
@@ -484,7 +506,7 @@ int csync_walk_local_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int fi
* @param visitor A callback function to handle the file info.
* @param filter A filter, built from and'ed csync_instructions_e
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int filter);
+19 -43
Ver Arquivo
@@ -47,45 +47,6 @@ int _csync_exclude_add(c_strlist_t **inList, const char *string) {
return c_strlist_add_grow(inList, string);
}
/** Expands C-like escape sequences.
*
* The returned string is heap-allocated and owned by the caller.
*/
static const char *csync_exclude_expand_escapes(const char * input)
{
size_t i_len = strlen(input) + 1;
char *out = c_malloc(i_len); // out can only be shorter
size_t i = 0;
size_t o = 0;
for (; i < i_len; ++i) {
if (input[i] == '\\') {
// at worst input[i+1] is \0
switch (input[i+1]) {
case '\'': out[o++] = '\''; break;
case '"': out[o++] = '"'; break;
case '?': out[o++] = '?'; break;
case '\\': out[o++] = '\\'; break;
case 'a': out[o++] = '\a'; break;
case 'b': out[o++] = '\b'; break;
case 'f': out[o++] = '\f'; break;
case 'n': out[o++] = '\n'; break;
case 'r': out[o++] = '\r'; break;
case 't': out[o++] = '\t'; break;
case 'v': out[o++] = '\v'; break;
default:
out[o++] = input[i];
out[o++] = input[i+1];
break;
}
++i;
} else {
out[o++] = input[i];
}
}
return out;
}
int csync_exclude_load(const char *fname, c_strlist_t **list) {
int fd = -1;
int i = 0;
@@ -138,10 +99,8 @@ int csync_exclude_load(const char *fname, c_strlist_t **list) {
if (entry != buf + i) {
buf[i] = '\0';
if (*entry != '#') {
const char *unescaped = csync_exclude_expand_escapes(entry);
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Adding entry: %s", unescaped);
rc = _csync_exclude_add(list, unescaped);
SAFE_FREE(unescaped);
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Adding entry: %s", entry);
rc = _csync_exclude_add(list, entry);
if (rc < 0) {
goto out;
}
@@ -158,6 +117,23 @@ out:
return rc;
}
void csync_exclude_clear(CSYNC *ctx) {
c_strlist_clear(ctx->excludes);
}
void csync_exclude_destroy(CSYNC *ctx) {
c_strlist_destroy(ctx->excludes);
}
CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype) {
CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
match = csync_excluded_no_ctx( ctx->excludes, path, filetype );
return match;
}
// See http://support.microsoft.com/kb/74496 and
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
// Additionally, we ignore '$Recycle.Bin', see https://github.com/owncloud/client/issues/2955
+32 -1
Ver Arquivo
@@ -43,10 +43,41 @@ int _csync_exclude_add(c_strlist_t **inList, const char *string);
* @param ctx The context of the synchronizer.
* @param fname The filename to load.
*
* @return 0 on success, -1 if an error occurred with errno set.
* @return 0 on success, -1 if an error occured with errno set.
*/
int csync_exclude_load(const char *fname, c_strlist_t **list);
/**
* @brief Clear the exclude list in memory.
*
* @param ctx The synchronizer context.
*/
void csync_exclude_clear(CSYNC *ctx);
/**
* @brief Destroy the exclude list in memory.
*
* @param ctx The synchronizer context.
*/
void csync_exclude_destroy(CSYNC *ctx);
/**
* @brief Check if the given path should be excluded.
*
* This excludes also paths which can't be used without unix extensions.
*
* The exclude list is checked against the full path, each component of
* the path and all leading directory strings, e.g.
* '/foo/bar/file' checks ('/foo/bar/file', 'foo', 'bar', 'file',
* '/foo/bar', '/foo').
*
* @param ctx The synchronizer context.
* @param path The patch to check.
*
* @return 2 if excluded and needs cleanup, 1 if excluded, 0 if not.
*/
CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype);
/**
* @brief Check if the given path should be excluded in a traversal situation.
*
-1
Ver Arquivo
@@ -33,7 +33,6 @@
* than fmmatch anyway, which does not care for flags.
**/
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
#endif
int csync_fnmatch(__const char *__pattern, __const char *__name, int __flags);
+1 -1
Ver Arquivo
@@ -54,7 +54,7 @@ int csync_get_statedb_exists(CSYNC *ctx);
* @param ctx The csync context.
* @param statedb Path to the statedb file (sqlite3 db).
*
* @return 0 on success, less than 0 if an error occurred with errno set.
* @return 0 on success, less than 0 if an error occured with errno set.
*/
int csync_statedb_load(CSYNC *ctx, const char *statedb, sqlite3 **pdb);
+27 -10
Ver Arquivo
@@ -245,9 +245,33 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
st->etag = NULL;
st->child_modified = 0;
st->has_ignored_files = 0;
/* FIXME: Under which conditions are the following two ifs true and the code
* is executed? */
if (type == CSYNC_FTW_TYPE_FILE ) {
if (fs->mtime == 0) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s - mtime is zero!", path);
tmp = csync_statedb_get_stat_by_hash(ctx, h);
if(_last_db_return_error(ctx)) {
SAFE_FREE(st);
SAFE_FREE(tmp);
ctx->status_code = CSYNC_STATUS_UNSUCCESSFUL;
return -1;
}
if (tmp == NULL) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s - not found in db, IGNORE!", path);
st->instruction = CSYNC_INSTRUCTION_IGNORE;
} else {
SAFE_FREE(st);
st = tmp;
st->instruction = CSYNC_INSTRUCTION_NONE;
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s - tmp non zero, mtime %lu", path, st->modtime );
tmp = NULL;
}
goto fastout; /* Skip copying of the etag. That's an important difference to upstream
* without etags. */
}
}
@@ -297,10 +321,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
// zero size in statedb can happen during migration
|| (tmp->size != 0 && fs->size != tmp->size))) {
// Checksum comparison at this stage is only enabled for .eml files,
// check #4754 #4755
bool isEmlFile = csync_fnmatch("*.eml", file, FNM_CASEFOLD) == 0;
if (isEmlFile && fs->size == tmp->size && tmp->checksumTypeId) {
if (fs->size == tmp->size && tmp->checksumTypeId) {
if (ctx->callbacks.checksum_hook) {
st->checksum = ctx->callbacks.checksum_hook(
file, tmp->checksumTypeId,
@@ -312,7 +333,6 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
checksumIdentical = strncmp(st->checksum, tmp->checksum, 1000) == 0;
}
if (checksumIdentical) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "NOTE: Checksums are identical, file did not actually change: %s", path);
st->instruction = CSYNC_INSTRUCTION_NONE;
st->should_update_metadata = true;
goto out;
@@ -515,6 +535,7 @@ out:
strncpy(st->remotePerm, fs->remotePerm, REMOTE_PERM_BUF_SIZE);
}
fastout: /* target if the file information is read from database into st */
st->phash = h;
st->pathlen = len;
memcpy(st->path, (len ? path : ""), len + 1);
@@ -559,11 +580,7 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
switch (flag) {
case CSYNC_FTW_FLAG_FILE:
if (ctx->current == REMOTE_REPLICA) {
if (fs->fields & CSYNC_VIO_FILE_STAT_FIELDS_SIZE) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size);
} else {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=UNKNOWN]", file, fs->file_id);
}
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size);
} else {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [inode=%" PRIu64 " size=%" PRIu64 "]", file, fs->inode, fs->size);
}
+8 -5
Ver Arquivo
@@ -38,13 +38,14 @@
#define NIL &_sentinel /* all leafs are sentinels */
static c_rbnode_t _sentinel = {NULL, NIL, NIL, NULL, NULL, BLACK};
void c_rbtree_create(c_rbtree_t **rbtree, c_rbtree_compare_func *key_compare, c_rbtree_compare_func *data_compare) {
assert(rbtree);
assert(key_compare);
assert(data_compare);
int c_rbtree_create(c_rbtree_t **rbtree, c_rbtree_compare_func *key_compare, c_rbtree_compare_func *data_compare) {
c_rbtree_t *tree = NULL;
if (rbtree == NULL || key_compare == NULL || data_compare == NULL) {
errno = EINVAL;
return -1;
}
tree = c_malloc(sizeof(*tree));
tree->root = NIL;
tree->key_compare = key_compare;
@@ -52,6 +53,8 @@ void c_rbtree_create(c_rbtree_t **rbtree, c_rbtree_compare_func *key_compare, c_
tree->size = 0;
*rbtree = tree;
return 0;
}
static c_rbnode_t *_rbtree_subtree_dup(const c_rbnode_t *node, c_rbtree_t *new_tree, c_rbnode_t *new_parent) {
+14 -12
Ver Arquivo
@@ -135,8 +135,10 @@ struct c_rbnode_s {
*
* @param data_compare Callback function to compare a key as data with thee
* data inside a red-black tree node.
*
* @return 0 on success, -1 if an error occured with errno set.
*/
void c_rbtree_create(c_rbtree_t **rbtree, c_rbtree_compare_func *key_compare, c_rbtree_compare_func *data_compare);
int c_rbtree_create(c_rbtree_t **rbtree, c_rbtree_compare_func *key_compare, c_rbtree_compare_func *data_compare);
/**
* @brief Duplicate a red-black tree.
@@ -144,7 +146,7 @@ void c_rbtree_create(c_rbtree_t **rbtree, c_rbtree_compare_func *key_compare, c_
* @param tree Tree to duplicate.
*
* @return Pointer to a new allocated duplicated rbtree. NULL if an error
* occurred.
* occured.
*/
c_rbtree_t *c_rbtree_dup(const c_rbtree_t *tree);
@@ -155,7 +157,7 @@ c_rbtree_t *c_rbtree_dup(const c_rbtree_t *tree);
*
* @param tree The tree to free.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int c_rbtree_free(c_rbtree_t *tree);
@@ -196,7 +198,7 @@ int c_rbtree_free(c_rbtree_t *tree);
* @param data The data to insert into the tree.
*
* @return 0 on success, 1 if a duplicate has been found and < 0 if an error
* occurred with errno set.
* occured with errno set.
* EINVAL if a null pointer has been passed as the tree.
* ENOMEM if there is no memory left.
*/
@@ -221,7 +223,7 @@ c_rbnode_t *c_rbtree_find(c_rbtree_t *tree, const void *key);
*
* @param tree The tree to get the head for.
*
* @return The head node. NULL if an error occurred.
* @return The head node. NULL if an error occured.
*/
c_rbnode_t *c_rbtree_head(c_rbtree_t *tree);
@@ -230,7 +232,7 @@ c_rbnode_t *c_rbtree_head(c_rbtree_t *tree);
*
* @param tree The tree to get the tail for.
*
* @return The tail node. NULL if an error occurred.
* @return The tail node. NULL if an error occured.
*/
c_rbnode_t *c_rbtree_tail(c_rbtree_t *tree);
@@ -252,7 +254,7 @@ c_rbnode_t *c_rbtree_tail(c_rbtree_t *tree);
* @param data Data which should be passed to the visitor function.
* @param visitor Visitor function. This will be called for each node passed.
*
* @return 0 on sucess, less than 0 if an error occurred.
* @return 0 on sucess, less than 0 if an error occured.
*/
int c_rbtree_walk(c_rbtree_t *tree, void *data, c_rbtree_visit_func *visitor);
@@ -261,7 +263,7 @@ int c_rbtree_walk(c_rbtree_t *tree, void *data, c_rbtree_visit_func *visitor);
*
* @param node Node which should be deleted.
*
* @return 0 on success, -1 if an error occurred.
* @return 0 on success, -1 if an error occured.
*/
int c_rbtree_node_delete(c_rbnode_t *node);
@@ -270,7 +272,7 @@ int c_rbtree_node_delete(c_rbnode_t *node);
*
* @param node The node of which you want the next node.
*
* @return The next node, NULL if an error occurred.
* @return The next node, NULL if an error occured.
*/
c_rbnode_t *c_rbtree_node_next(c_rbnode_t *node);
@@ -279,7 +281,7 @@ c_rbnode_t *c_rbtree_node_next(c_rbnode_t *node);
*
* @param node The node of which you want the previous node.
*
* @return The previous node, NULL if an error occurred.
* @return The previous node, NULL if an error occured.
*/
c_rbnode_t *c_rbtree_node_prev(c_rbnode_t *node);
@@ -288,7 +290,7 @@ c_rbnode_t *c_rbtree_node_prev(c_rbnode_t *node);
*
* @param N The node to get the data from.
*
* @return The data, NULL if an error occurred.
* @return The data, NULL if an error occured.
*/
#define c_rbtree_node_data(N) ((N) ? ((N)->data) : NULL)
@@ -299,7 +301,7 @@ c_rbnode_t *c_rbtree_node_prev(c_rbnode_t *node);
*
* @param tree The tree to check.
*
* @return 0 on success, less than 0 if an error occurred.
* @return 0 on success, less than 0 if an error occured.
*/
int c_rbtree_check_sanity(c_rbtree_t *tree);
+6 -12
Ver Arquivo
@@ -139,6 +139,7 @@ csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
dhandle_t *handle = NULL;
csync_vio_file_stat_t *file_stat = NULL;
ULARGE_INTEGER FileIndex;
DWORD rem;
handle = (dhandle_t *) dhandle;
@@ -167,14 +168,9 @@ csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
}
file_stat->name = c_utf8_from_locale(handle->ffd.cFileName);
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
if ( (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
&& (handle->ffd.dwReserved0 & IO_REPARSE_TAG_SYMLINK)
// The SIS or DEDUP flag points to a MS deduplication feature of
// certain file storage products. It is not a normal symlink
// that should be ignored.
&& (! (handle->ffd.dwReserved0 & IO_REPARSE_TAG_SIS))
&& (! (handle->ffd.dwReserved0 & IO_REPARSE_TAG_DEDUP)) ) {
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT
&& handle->ffd.dwReserved0 & IO_REPARSE_TAG_SYMLINK) {
file_stat->flags = CSYNC_VIO_FILE_FLAGS_SYMLINK;
file_stat->type = CSYNC_VIO_FILE_TYPE_SYMBOLIC_LINK;
} else if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_DEVICE
@@ -230,10 +226,8 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
ULARGE_INTEGER FileIndex;
mbchar_t *wuri = c_utf8_path_to_locale( uri );
h = CreateFileW( wuri, 0, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
NULL );
h = CreateFileW( wuri, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL+FILE_FLAG_BACKUP_SEMANTICS+FILE_FLAG_OPEN_REPARSE_POINT, NULL );
if( h == INVALID_HANDLE_VALUE ) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_CRIT, "CreateFileW failed on %s", uri );
errno = GetLastError();
+16 -3
Ver Arquivo
@@ -33,7 +33,8 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
*state = csync;
}
@@ -48,9 +49,10 @@ static void setup_module(void **state) {
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
rc = csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
assert_int_equal(rc, 0);
csync_init(csync);
rc = csync_init(csync);
*state = csync;
}
@@ -72,6 +74,16 @@ static void teardown(void **state) {
*state = NULL;
}
static void check_csync_commit_null(void **state)
{
int rc;
(void) state; /* unused */
rc = csync_commit(NULL);
assert_int_equal(rc, -1);
}
static void check_csync_commit(void **state)
{
CSYNC *csync = *state;
@@ -98,6 +110,7 @@ static void check_csync_commit_dummy(void **state)
int torture_run_tests(void)
{
const UnitTest tests[] = {
unit_test_setup_teardown(check_csync_commit_null, setup, teardown),
unit_test_setup_teardown(check_csync_commit, setup, teardown),
unit_test_setup_teardown(check_csync_commit_dummy, setup_module, teardown),
};
+2 -1
Ver Arquivo
@@ -42,7 +42,8 @@ static void check_csync_create(void **state)
(void) state; /* unused */
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
rc = csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
assert_int_equal(rc, 0);
rc = csync_destroy(csync);
assert_int_equal(rc, 0);
+44 -62
Ver Arquivo
@@ -32,7 +32,8 @@ static void setup(void **state) {
CSYNC *csync;
int rc;
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
*state = csync;
}
@@ -41,7 +42,8 @@ static void setup_init(void **state) {
CSYNC *csync;
int rc;
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
rc = csync_exclude_load(EXCLUDE_LIST_FILE, &(csync->excludes));
assert_int_equal(rc, 0);
@@ -100,84 +102,84 @@ static void check_csync_excluded(void **state)
CSYNC *csync = *state;
int rc;
rc = csync_excluded_no_ctx(csync->excludes, "", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, "/", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "/", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, "krawel_krawel", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "krawel_krawel", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, ".kde/share/config/kwin.eventsrc", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, ".kde/share/config/kwin.eventsrc", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, ".htaccess/cache-maximegalon/cache1.txt", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, ".htaccess/cache-maximegalon/cache1.txt", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "mozilla/.htaccess", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "mozilla/.htaccess", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
/*
* Test for patterns in subdirs. '.beagle' is defined as a pattern and has
* to be found in top dir as well as in directories underneath.
*/
rc = csync_excluded_no_ctx(csync->excludes, ".apdisk", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, ".apdisk", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "foo/.apdisk", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "foo/.apdisk", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "foo/bar/.apdisk", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "foo/bar/.apdisk", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, ".java", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, ".java", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
/* Files in the ignored dir .java will also be ignored. */
rc = csync_excluded_no_ctx(csync->excludes, ".apdisk/totally_amazing.jar", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, ".apdisk/totally_amazing.jar", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
/* and also in subdirs */
rc = csync_excluded_no_ctx(csync->excludes, "projects/.apdisk/totally_amazing.jar", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "projects/.apdisk/totally_amazing.jar", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
/* csync-journal is ignored in general silently. */
rc = csync_excluded_no_ctx(csync->excludes, ".csync_journal.db", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, ".csync_journal.db", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, ".csync_journal.db.ctmp", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, ".csync_journal.db.ctmp", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, "subdir/.csync_journal.db", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "subdir/.csync_journal.db", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_SILENTLY_EXCLUDED);
/* pattern ]*.directory - ignore and remove */
rc = csync_excluded_no_ctx(csync->excludes, "my.~directory", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "my.~directory", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_AND_REMOVE);
rc = csync_excluded_no_ctx(csync->excludes, "/a_folder/my.~directory", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "/a_folder/my.~directory", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_AND_REMOVE);
/* Not excluded because the pattern .netscape/cache requires directory. */
rc = csync_excluded_no_ctx(csync->excludes, ".netscape/cache", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, ".netscape/cache", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
/* Not excluded */
rc = csync_excluded_no_ctx(csync->excludes, "unicode/中文.hé", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "unicode/中文.hé", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
/* excluded */
rc = csync_excluded_no_ctx(csync->excludes, "unicode/пятницы.txt", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "unicode/пятницы.txt", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "unicode/中文.💩", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "unicode/中文.💩", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
/* path wildcards */
rc = csync_excluded_no_ctx(csync->excludes, "foobar/my_manuscript.out", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "foobar/my_manuscript.out", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "latex_tmp/my_manuscript.run.xml", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "latex_tmp/my_manuscript.run.xml", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "word_tmp/my_manuscript.run.xml", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "word_tmp/my_manuscript.run.xml", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, "latex/my_manuscript.tex.tmp", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "latex/my_manuscript.tex.tmp", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, "latex/songbook/my_manuscript.tex.tmp", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "latex/songbook/my_manuscript.tex.tmp", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
}
@@ -239,45 +241,45 @@ static void check_csync_pathes(void **state)
_csync_exclude_add( &(csync->excludes), "/exclude" );
/* Check toplevel dir, the pattern only works for toplevel dir. */
rc = csync_excluded_no_ctx(csync->excludes, "/exclude", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "/exclude", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "/foo/exclude", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "/foo/exclude", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
/* check for a file called exclude. Must still work */
rc = csync_excluded_no_ctx(csync->excludes, "/exclude", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "/exclude", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "/foo/exclude", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "/foo/exclude", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
/* Add an exclude for directories only: excl/ */
_csync_exclude_add( &(csync->excludes), "excl/" );
rc = csync_excluded_no_ctx(csync->excludes, "/excl", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "/excl", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "meep/excl", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "meep/excl", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "meep/excl/file", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "meep/excl/file", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "/excl", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "/excl", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
_csync_exclude_add(&csync->excludes, "/excludepath/withsubdir");
rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "/excludepath/withsubdir", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir", CSYNC_FTW_TYPE_FILE);
rc = csync_excluded(csync, "/excludepath/withsubdir", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir2", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "/excludepath/withsubdir2", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
rc = csync_excluded_no_ctx(csync->excludes, "/excludepath/withsubdir/foo", CSYNC_FTW_TYPE_DIR);
rc = csync_excluded(csync, "/excludepath/withsubdir/foo", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
}
@@ -312,8 +314,8 @@ static void check_csync_excluded_performance(void **state)
gettimeofday(&before, 0);
for (int i = 0; i < N; ++i) {
totalRc += csync_excluded_no_ctx(csync->excludes, "/this/is/quite/a/long/path/with/many/components", CSYNC_FTW_TYPE_DIR);
totalRc += csync_excluded_no_ctx(csync->excludes, "/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/29", CSYNC_FTW_TYPE_FILE);
totalRc += csync_excluded(csync, "/this/is/quite/a/long/path/with/many/components", CSYNC_FTW_TYPE_DIR);
totalRc += csync_excluded(csync, "/1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/29", CSYNC_FTW_TYPE_FILE);
}
assert_int_equal(totalRc, CSYNC_NOT_EXCLUDED); // mainly to avoid optimization
@@ -344,25 +346,6 @@ static void check_csync_excluded_performance(void **state)
}
}
static void check_csync_exclude_expand_escapes(void **state)
{
(void)state;
const char *str = csync_exclude_expand_escapes(
"keep \\' \\\" \\? \\\\ \\a \\b \\f \\n \\r \\t \\v \\z");
assert_true(0 == strcmp(
str, "keep ' \" ? \\ \a \b \f \n \r \t \v \\z"));
SAFE_FREE(str);
str = csync_exclude_expand_escapes("");
assert_true(0 == strcmp(str, ""));
SAFE_FREE(str);
str = csync_exclude_expand_escapes("\\");
assert_true(0 == strcmp(str, "\\"));
SAFE_FREE(str);
}
int torture_run_tests(void)
{
const UnitTest tests[] = {
@@ -373,7 +356,6 @@ int torture_run_tests(void)
unit_test_setup_teardown(check_csync_pathes, setup_init, teardown),
unit_test_setup_teardown(check_csync_is_windows_reserved_word, setup_init, teardown),
unit_test_setup_teardown(check_csync_excluded_performance, setup_init, teardown),
unit_test(check_csync_exclude_expand_escapes),
};
return run_tests(tests);
+20 -3
Ver Arquivo
@@ -33,7 +33,8 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
*state = csync;
}
@@ -48,7 +49,8 @@ static void setup_module(void **state) {
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
rc = csync_create(&csync, "/tmp/check_csync1", "dummy://foo/bar");
assert_int_equal(rc, 0);
*state = csync;
}
@@ -71,19 +73,34 @@ static void teardown(void **state) {
*state = NULL;
}
static void check_csync_init_null(void **state)
{
int rc;
(void) state; /* unused */
rc = csync_init(NULL);
assert_int_equal(rc, -1);
}
static void check_csync_init(void **state)
{
CSYNC *csync = *state;
int rc;
csync_init(csync);
rc = csync_init(csync);
assert_int_equal(rc, 0);
assert_int_equal(csync->status & CSYNC_STATUS_INIT, 1);
rc = csync_init(csync);
assert_int_equal(rc, 1);
}
int torture_run_tests(void)
{
const UnitTest tests[] = {
unit_test_setup_teardown(check_csync_init_null, setup, teardown),
unit_test_setup_teardown(check_csync_init, setup, teardown),
unit_test_setup_teardown(check_csync_init, setup_module, teardown),
};
+2 -1
Ver Arquivo
@@ -37,7 +37,8 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
*state = csync;
}
@@ -37,7 +37,8 @@ static void setup(void **state) {
rc = system("mkdir -p /tmp/check_csync1");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
csync->statedb.file = c_strdup( TESTDB );
*state = csync;
@@ -42,8 +42,10 @@ static void setup(void **state)
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
csync_init(csync);
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
rc = csync_init(csync);
assert_int_equal(rc, 0);
sqlite3 *db = NULL;
rc = sqlite3_open_v2(TESTDB, &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL);
+8 -4
Ver Arquivo
@@ -93,8 +93,10 @@ static void setup(void **state)
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
csync_init(csync);
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
assert_int_equal(rc, 0);
rc = csync_init(csync);
assert_int_equal(rc, 0);
/* Create a new db with metadata */
sqlite3 *db;
@@ -124,8 +126,10 @@ static void setup_ftw(void **state)
assert_int_equal(rc, 0);
rc = system("mkdir -p /tmp/check_csync2");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp", "/tmp");
csync_init(csync);
rc = csync_create(&csync, "/tmp", "/tmp");
assert_int_equal(rc, 0);
rc = csync_init(csync);
assert_int_equal(rc, 0);
sqlite3 *db = NULL;
rc = sqlite3_open_v2(TESTDB, &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL);
+24 -18
Ver Arquivo
@@ -85,16 +85,6 @@ sub fromFileName($)
}
}
sub setCredentials
{
my ($dav, $user, $passwd) = @_;
$dav->credentials(-url=> $owncloud, -realm=>"sabre/dav",
-user=> $user, -pass=> $passwd);
$dav->credentials(-url=> $owncloud, -realm=>"ownCloud",
-user=> $user, -pass=> $passwd);
}
sub initTesting(;$)
{
@@ -137,7 +127,9 @@ sub initTesting(;$)
my $ua = HTTP::DAV::UserAgent->new(keep_alive => 1 );
$d = HTTP::DAV->new(-useragent => $ua);
setCredentials($d, $user, $passwd);
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $user,
-pass=> $passwd );
# $d->DebugLevel(3);
$prefix = "t1" unless( defined $prefix );
@@ -201,7 +193,9 @@ sub removeRemoteDir($;$)
my $url = testDirUrl() . $dir;
if( $optionsRef && $optionsRef->{user} && $optionsRef->{passwd} ) {
setCredentials($d, $optionsRef->{user}, $optionsRef->{passwd});
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $optionsRef->{user},
-pass=> $optionsRef->{passwd} );
if( $optionsRef->{url} ) {
$url = $optionsRef->{url} . $dir;
}
@@ -225,7 +219,9 @@ sub createRemoteDir(;$$)
my $url = testDirUrl() . $dir;
if( $optionsRef && $optionsRef->{user} && $optionsRef->{passwd} ) {
setCredentials($d, $optionsRef->{user}, $optionsRef->{passwd});
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $optionsRef->{user},
-pass=> $optionsRef->{passwd} );
if( $optionsRef->{url} ) {
$url = $optionsRef->{url} . $dir;
}
@@ -400,7 +396,9 @@ sub traverse( $$;$ )
my %seen;
setCredentials($d, $user, $passwd);
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $user,
-pass=> $passwd );
$d->open( $owncloud );
if( my $r = $d->propfind( -url => $url, -depth => 1 ) ) {
@@ -515,7 +513,9 @@ sub put_to_dir( $$;$ )
my $targetUrl = testDirUrl();
if( $optionsRef && $optionsRef->{user} && $optionsRef->{passwd} ) {
setCredentials($d, $optionsRef->{user}, $optionsRef->{passwd});
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $optionsRef->{user},
-pass=> $optionsRef->{passwd} );
if( $optionsRef->{url} ) {
$targetUrl = $optionsRef->{url};
}
@@ -649,7 +649,9 @@ sub moveRemoteFile($$;$)
{
my ($from, $to, $no_testdir) = @_;
setCredentials($d, $user, $passwd);
$d->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $user,
-pass=> $passwd );
my $fromUrl = testDirUrl(). $from;
my $toUrl = testDirUrl() . $to;
@@ -723,7 +725,9 @@ sub createShare($$)
my $dd = HTTP::DAV->new();
setCredentials($dd, $share_user, $share_passwd);
$dd->credentials( -url=> $owncloud, -realm=>"ownCloud",
-user=> $share_user,
-pass=> $share_passwd );
$dd->open( $owncloud);
# create a remote dir
@@ -765,7 +769,9 @@ sub removeShare($$)
my $dd = HTTP::DAV->new();
setCredentials($dd, $share_user, $share_passwd);
$dd->credentials( -url => $owncloud, -realm=>"ownCloud",
-user => $share_user,
-pass => $share_passwd );
$dd->open( $owncloud);
my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
+2 -2
Ver Arquivo
@@ -146,9 +146,9 @@ assertLocalAndRemoteDir( '', 0);
# create a true conflict.
printInfo( "Create a conflict." );
system( "echo \"This is more server stuff\" >> /tmp/kernelcrash.txt" );
system( "echo \"This is more stuff\" >> /tmp/kernelcrash.txt" );
put_to_dir( '/tmp/kernelcrash.txt', 'remoteToLocal1' );
system( "sleep 2 && echo \"This is more client stuff\" >> " . localDir() . "remoteToLocal1/kernelcrash.txt" );
system( "sleep 2 && touch " . localDir() . "remoteToLocal1/kernelcrash.txt" );
csync();
assertLocalAndRemoteDir( '', 1);
+1 -1
Ver Arquivo
@@ -71,7 +71,7 @@ assert($emlpropafter->get_property( "getlastmodified" ) eq
$emlpropbefore->get_property( "getlastmodified" ));
printInfo( "Change content of eml file (but not size)");
system( "sleep 1 && sed -i -e 's/in/IN/' $locDir/test.eml" );
system( "sed -i -e 's/in/IN/' $locDir/test.eml" );
csync( );
+27 -4
Ver Arquivo
@@ -84,8 +84,10 @@ static void destructor(void *data) {
static void setup(void **state) {
c_rbtree_t *tree = NULL;
int rc;
c_rbtree_create(&tree, key_cmp, data_cmp);
rc = c_rbtree_create(&tree, key_cmp, data_cmp);
assert_int_equal(rc, 0);
*state = tree;
}
@@ -95,7 +97,8 @@ static void setup_complete_tree(void **state) {
int i = 0;
int rc;
c_rbtree_create(&tree, key_cmp, data_cmp);
rc = c_rbtree_create(&tree, key_cmp, data_cmp);
assert_int_equal(rc, 0);
for (i = 0; i < 100; i++) {
test_t *testdata = NULL;
@@ -128,13 +131,31 @@ static void check_c_rbtree_create_free(void **state)
(void) state; /* unused */
c_rbtree_create(&tree, key_cmp, data_cmp);
rc = c_rbtree_create(&tree, key_cmp, data_cmp);
assert_int_equal(rc, 0);
assert_int_equal(tree->size, 0);
rc = c_rbtree_free(tree);
assert_int_equal(rc, 0);
}
static void check_c_rbtree_create_null(void **state)
{
c_rbtree_t *tree = NULL;
int rc;
(void) state; /* unused */
rc = c_rbtree_create(NULL, key_cmp, data_cmp);
assert_int_equal(rc, -1);
rc = c_rbtree_create(&tree, NULL, data_cmp);
assert_int_equal(rc, -1);
rc = c_rbtree_create(&tree, key_cmp, NULL);
assert_int_equal(rc, -1);
}
static void check_c_rbtree_free_null(void **state)
{
int rc;
@@ -154,7 +175,8 @@ static void check_c_rbtree_insert_delete(void **state)
(void) state; /* unused */
c_rbtree_create(&tree, key_cmp, data_cmp);
rc = c_rbtree_create(&tree, key_cmp, data_cmp);
assert_int_equal(rc, 0);
testdata = malloc(sizeof(test_t));
testdata->key = 42;
@@ -347,6 +369,7 @@ int torture_run_tests(void)
{
const UnitTest tests[] = {
unit_test(check_c_rbtree_create_free),
unit_test(check_c_rbtree_create_null),
unit_test(check_c_rbtree_free_null),
unit_test(check_c_rbtree_insert_delete),
unit_test_setup_teardown(check_c_rbtree_insert_random, setup, teardown),
+2 -1
Ver Arquivo
@@ -49,7 +49,8 @@ static void setup(void **state)
rc = system("rm -rf /tmp/csync_test");
assert_int_equal(rc, 0);
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
rc = csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
assert_int_equal(rc, 0);
csync->replica = LOCAL_REPLICA;
+2 -1
Ver Arquivo
@@ -97,7 +97,8 @@ static void setup_testenv(void **state) {
statevar *mystate = malloc( sizeof(statevar) );
mystate->result = NULL;
csync_create(&(mystate->csync), "/tmp/csync1", "/tmp/csync2");
rc = csync_create(&(mystate->csync), "/tmp/csync1", "/tmp/csync2");
assert_int_equal(rc, 0);
mystate->csync->replica = LOCAL_REPLICA;
-5
Ver Arquivo
@@ -18,8 +18,3 @@ ownCloud Command Line Client
----------------------------
.. index:: owncloudcmd
.. include:: owncloudcmd.rst
Low Disk Space
--------------
.. index:: disk space
.. include:: lowdiskspace.rst
+1 -9
Ver Arquivo
@@ -87,7 +87,7 @@ To manually override this key, use the same value in ``HKEY_CURRENT_USER``.
To prevent automatic updates and disallow manual overrides:
.. note:: This is the preferred method of controlling the updater behavior using
.. note::This is the preferred method of controlling the updater behavior using
Group Policies.
1. Edit this Registry key:
@@ -98,14 +98,6 @@ To prevent automatic updates and disallow manual overrides:
3. Specify a value of ``1`` to the machine.
.. note:: Enterprise branded clients
(see `Building Branded ownCloud Clients
<https://doc.owncloud.org/branded_clients/>`_) have different key names,
which are set in ownBrander using the Application Vendor and Application
Name fields. Your key names look like this::
``HKEY_LOCAL_MACHINE\Software\Policies\myCompanyName\myAppName``
Preventing Automatic Updates in Mac OS X Environments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+16 -41
Ver Arquivo
@@ -11,44 +11,22 @@ desktop client.
.. note:: Build instructions are subject to change as development proceeds.
Please check the version for which you want to build.
These instructions are updated to work with version 2.2 of the ownCloud Client.
Getting Source Code
-------------------
The :ref:`generic-build-instructions` pull the latest code directly from
GitHub, and work on Linux, Mac OS X, and Windows.
See the next section for instructions on getting source code from Linux
packages.
The instructions contained in this topic were updated to work with version 1.7 of the ownCloud Client.
Linux
-----
You may wish to use source packages for your Linux distribution, as these give
you the exact sources from which the binary packages are built. These are
hosted on the `ownCloud repository from OBS`_. Go to the `Index of
repositories`_ to see all the Linux client repos.
1. At the `bottom of the page for each distribution
<https://software.opensuse.org/download/package?project=isv:ownCloud:desktop&
package=owncloud-client>`_ is a "Grab binary packages directly" section.
These contain source RPMs for CentOS, RHEL, Fedora, SLES, and openSUSE.
To get the .deb source packages add the source
repo for your Debian or Ubuntu version, like this example for Debian 8
(run as root)::
echo 'deb-src
http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Debian_8.0/ /' >> /etc/apt/sources.list.d/owncloud-client.list
2. Install the dependencies using the following commands for your specific Linux distribution:
1. Add the `ownCloud repository from OBS`_.
2. Install the dependencies (as root, or using ``sudo``) using the following
commands for your specific Linux distribution:
* Debian/Ubuntu: ``apt-get update; apt-get build-dep owncloud-client``
* openSUSE/SLES: ``zypper ref; zypper si -d owncloud-client``
* Fedora/CentOS/RHEL: ``yum install yum-utils; yum-builddep owncloud-client``
* openSUSE: ``zypper ref; zypper si -d owncloud-client``
* Fedora/CentOS: ``yum install yum-utils; yum-builddep owncloud-client``
3. Follow the :ref:`generic-build-instructions`, starting with step 2.
3. Follow the :ref:`generic-build-instructions`.
4. (Optional) Call ``make install`` to install the client to the ``/usr/local/bin`` directory.
Mac OS X
--------
@@ -209,7 +187,9 @@ Compared to previous versions, building the desktop sync client has become easie
earlier versions, CSync, which is the sync engine library of the client, is now
part of the client source repository and not a separate module.
To build the most up-to-date version of the client:
You can download the desktop sync client from the ownCloud `Client Download Page`_.
To build the most up to date version of the client:
1. Clone the latest versions of the client from Git_ as follows::
@@ -237,9 +217,6 @@ To build the most up-to-date version of the client:
4. Call ``make``.
The owncloud binary will appear in the ``bin`` directory.
5. (Optional) Call ``make install`` to install the client to the
``/usr/local/bin`` directory.
The following are known cmake parameters:
@@ -252,17 +229,15 @@ The following are known cmake parameters:
* ``BUILD_WITH_QT4=ON``: Builds using Qt4 (even if Qt5 is found).
* ``CMAKE_INSTALL_PREFIX=path``: Set an install prefix. This is mandatory on Mac OS
.. _ownCloud repository from OBS: http://software.opensuse.org/download/package?
project=isv:ownCloud:desktop&package=owncloud-client
.. _`ownCloud repository from OBS`: http://software.opensuse.org/download/package?project=isv:ownCloud:desktop&package=owncloud-client
.. _CMake: http://www.cmake.org/download
.. _CSync: http://www.csync.org
.. _Client Download Page: https://owncloud.org/install/#desktop
.. _`Client Download Page`: http://owncloud.org/sync-clients/
.. _Git: http://git-scm.com
.. _MacPorts: http://www.macports.org
.. _Homebrew: http://mxcl.github.com/homebrew/
.. _OpenSSL Windows Build: http://slproweb.com/products/Win32OpenSSL.html
.. _`OpenSSL Windows Build`: http://slproweb.com/products/Win32OpenSSL.html
.. _Qt: http://www.qt.io/download
.. _Microsoft Authenticode: https://msdn.microsoft.com/en-us/library/ie/ms537361%28v=vs.85%29.aspx
.. _`Microsoft Authenticode`: https://msdn.microsoft.com/en-us/library/ie/ms537361%28v=vs.85%29.aspx
.. _QtKeychain: https://github.com/frankosterfeld/qtkeychain
.. _Packages: http://s.sudre.free.fr/Software/Packages/about.html
.. _Index of repositories: http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/
-6
Ver Arquivo
@@ -22,9 +22,3 @@ You can change the following configuration settings (must be under the ``[ownClo
- ``maxLogLines`` (default: ``20000``) -- Specifies the maximum number of log lines displayed in the log window.
- ``chunkSize`` (default: ``5242880``) -- Specifies the chunk size of uploaded files in bytes.
- ``promptDeleteAllFiles`` (default: ``true``) -- If a UI prompt should ask for confirmation if it was detected that all files and folders were deleted.
- ``notificationRefreshInterval`` (default``300,000``) -- Specifies the default interval of checking for new server notifications in milliseconds.
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 72 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 82 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 86 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 52 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 82 KiB

Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 23 KiB

Depois

Largura:  |  Altura:  |  Tamanho: 99 KiB

+1 -9
Ver Arquivo
@@ -22,16 +22,8 @@ Improvements and New Features
The 2.1 release of the ownCloud desktop sync client has many new features and
improvements. (See the `complete changelog
<https://owncloud.org/changelog/desktop/>`_.)
* Improved appearance on HiDPI screens
* Improved error messages
* Several fixes/improvements to the sharing dialog
* Several fixes/improvements to the server activity tab
* Allow changeable upload chunk size in owncloud.cfg
* Forget password on explicit sign-out
* Windows: Fix deleting and replacing of read-only files
* Share with internal ownCloud users from your desktop
* Separate views for server activity, sync activity, and errors
* Don't re-upload *eml-files if size and checksum are unchanged
* Improved upload/download progress indicator
-5
Ver Arquivo
@@ -1,5 +0,0 @@
When disk space is low the ownCloud Client will be unable to synchronize all files. This section describes its behavior in a low disk space situation as well as the options that influence it.
1. Synchronization of a folder aborts entirely if the remaining disk space falls below 50 MB. This threshold can be adjusted with the ``OWNCLOUD_CRITICAL_FREE_SPACE_BYTES`` environment variable.
2. Downloads that would reduce the free disk space below 250 MB will be skipped or aborted. The download will be retried regularly and other synchronization is unaffected. This threshold can be adjusted with the ``OWNCLOUD_FREE_SPACE_BYTES`` environment variable.
+9 -71
Ver Arquivo
@@ -11,7 +11,7 @@ in the system tray (Windows, KDE), status bar (Mac OS X), or notification area
.. figure:: images/icon.png
:alt: Status icon, little cloud with green circle and white checkmark
The status indicator uses icons to indicate the current status of your
The status indicator uses overlay icons to indicate the current status of your
synchronization. The green circle with the white checkmark tells you that your
synchronization is current and you are connected to your ownCloud server.
@@ -24,7 +24,7 @@ The blue icon with the white semi-circles means synchronization is in progress.
:alt: Status icon, little cloud with yellow circle and vertical parallel
lines
The yellow icon with the parallel lines tells you your synchronization
The yellow overlay icon with the parallel lines tells you your synchronization
has been paused. (Most likely by you.)
.. figure:: images/icon-offline.png
@@ -58,12 +58,11 @@ operations.
This menu provides the following options:
* Quick access to your accounts
* Sync status
* Recent Changes, showing latest activities
* Settings
* Status of your client version (whether it is up to date)
* Help menu
* An option to log in or log out of all of your accounts at once
* Quit ownCloud, logging out and closing the client
* Quit ownCloud
A left-click on your systray icon opens the desktop client to the account
settings window.
@@ -83,7 +82,7 @@ have the following features:
* Connection status, showing which ownCloud server you are connected to, and
your ownCloud username.
* An **Account** button, which contains a dropdown menu with **Add New**,
**Log In/Log Out**, and **Remove**.
**Sign In/Sign Out**, and **Remove**.
* Used and available space on the server.
* Current synchronization status.
* **Add Folder Sync Connection** button, which is active only when you have
@@ -125,47 +124,12 @@ button, and re-select the folder tree that you want to sync.
Adding New Accounts
^^^^^^^^^^^^^^^^^^^
You may configure multiple ownCloud accounts in your desktop sync client.
Simply
You may configure multiple ownCloud accounts in your desktop sync client. Simply
click the **Account** > **Add New** button on any account tab to add a new
account, and then follow the account creation wizard. The new account will
appear as a new tab in the settings dialog, where you can adjust its settings
at
appear as a new tab in the settings dialog, where you can adjust its settings at
any time. Use **Account** > **Remove** to delete accounts.
File Manager Overlay Icons
--------------------------
The ownCloud sync client provides overlay icons, in addition to the normal file
type icons, for your system file manager (Explorer on Windows, Finder on Mac and
Nautilus on Linux) to indicate the sync status of your ownCloud files.
The overlay icons are similar to the systray icons introduced above. They
behave differently on files and directories according to sync status
and errors.
The overlay icon of an individual file indicates its current sync state. If the
file is in sync with the server version, it displays a green checkmark.
If the file is ignored from syncing, for example because it is on your
exclude list, or because it is a symbolic link, it displays a warning icon.
If there is a sync error, or the file is blacklisted, it displays an
eye-catching red X.
If the file is waiting to be synced, or is currently syncing, the overlay
icon displays a blue cycling icon.
When the client is offline, no icons are shown to reflect that the
folder is currently out of sync and no changes are synced to the server.
The overlay icon of a synced directory indicates the status of the files in the
directory. If there are any sync errors, the directory is marked with a warning
icon.
If a directory includes ignored files that are marked with warning icons
that does not change the status of the parent directories.
Sharing From Your Desktop
-------------------------
@@ -207,30 +171,6 @@ such as files not synced.
.. figure:: images/client-8.png
:alt: Activity windows logs all server and client activities.
Server Notifications
--------------------
Starting with version 2.2.0 the client will display notifications which origin
from the server. Notifications require a kind of manual interaction from the
user and they are triggered by certain events happening on the server. One
example is that somebody created a share from a remote ownCloud for the user
which has to approved. The notification will be something like "Do you want
to accept the share from user Joe on host owncloud.joesdomain.com", and the
user of the client can either click an Accept- or Decline-button.
The desktop client checks for avialable notifications automatically on a regular
base.
If a notification is due for the user, it is displayed integrated in the
activity tab, and the user receives a tray notification to draw attention.
.. figure:: images/client12.png
:alt: Activity window with notification.
There is also the Announcement App that allows administrators to create
notifications for users. This is a convenient way to send information to
all users.
General Window
--------------
@@ -266,12 +206,10 @@ can use the *Ignored Files Editor* (General tab.)
.. figure:: images/ignored_files_editor.png
For your convenience, the editor is pre-populated with a default list of
typical
For your convenience, the editor is pre-populated with a default list of typical
ignore patterns. These patterns are contained in a system file (typically
``sync-exclude.lst``) located in the ownCloud Client application directory. You
cannot modify these pre-populated patterns directly from the editor. However,
if
cannot modify these pre-populated patterns directly from the editor. However, if
necessary, you can hover over any pattern in the list to show the path and
filename associated with that pattern, locate the file, and edit the
``sync-exclude.lst`` file.
+1 -1
Ver Arquivo
@@ -49,7 +49,7 @@ Other command line switches supported by ``owncloudcmd`` include the following:
Exclude list file
``--unsyncedfolders [file]``
File containing the list of unsynced remote folders (selective sync)
File containing the list of unsynced folders (selective sync)
``--max-sync-retries [n]``
Retries maximum n times (defaults to 3)
+1 -1
Ver Arquivo
@@ -78,7 +78,7 @@ Other issues can affect synchronization of your ownCloud files:
- If you are operating your own server, and use the local storage backend (the
default), make sure that ownCloud has exclusive access to the directory.
.. warning:: The data directory on the server is exclusive to ownCloud and must not be modified manually.
.. note:: The data directory on the server is exclusive to ownCloud and must not be modified manually.
- If you are using a different file backend on the server, you can try to exclude a bug in the
backend by reverting to the built-in backend.
-11
Ver Arquivo
@@ -8,14 +8,3 @@ GenericName=Folder Sync
Icon=@APPLICATION_EXECUTABLE@
Keywords=@APPLICATION_NAME@;syncing;file;sharing;
X-GNOME-Autostart-Delay=3
# Translations
Comment[sq]=Klient njëkohësimesh @APPLICATION_NAME@ për desktop
GenericName[sq]=Njëkohësim Dosjesh
Name[sq]=Klient njëkohësimesh @APPLICATION_NAME@ për desktop
Icon[sq]=@APPLICATION_EXECUTABLE@
Comment[nl]=@APPLICATION_NAME@ desktop synchronisatie client
GenericName[nl]=Mappen sync
Name[nl]=@APPLICATION_NAME@ desktop sync client
Icon[nl]=@APPLICATION_EXECUTABLE@
Arquivo binário não exibido.

Antes

Largura:  |  Altura:  |  Tamanho: 900 B

+2 -11
Ver Arquivo
@@ -7,9 +7,6 @@ add_custom_target( legacy_mac_overlayplugin ALL
OC_SOCKETAPI_TEAM_IDENTIFIER_PREFIX=${SOCKETAPI_TEAM_IDENTIFIER_PREFIX}
COMMENT building Legacy Mac Overlay icons)
# Contrary to popular belief, this is called like this no matter what theme/OEM.
set(OC_OEM_SHARE_ICNS "${CMAKE_BINARY_DIR}/src/gui/ownCloud.icns")
# The bundle identifier and application group need to have compatible values with the client
# to be able to open a Mach port across the extension's sandbox boundary.
# Pass the info through the xcodebuild command line and make sure that the project uses
@@ -17,21 +14,15 @@ set(OC_OEM_SHARE_ICNS "${CMAKE_BINARY_DIR}/src/gui/ownCloud.icns")
add_custom_target( mac_overlayplugin ALL
xcodebuild -project ${CMAKE_SOURCE_DIR}/shell_integration/MacOSX/OwnCloudFinderSync/OwnCloudFinderSync.xcodeproj
-target FinderSyncExt -configuration Release SYMROOT=${CMAKE_CURRENT_BINARY_DIR}
OC_OEM_SHARE_ICNS=${OC_OEM_SHARE_ICNS}
OC_APPLICATION_NAME="${APPLICATION_NAME}"
OC_APPLICATION_NAME=${APPLICATION_NAME}
OC_APPLICATION_REV_DOMAIN=${APPLICATION_REV_DOMAIN}
OC_SOCKETAPI_TEAM_IDENTIFIER_PREFIX=${SOCKETAPI_TEAM_IDENTIFIER_PREFIX}
COMMENT building Mac Overlay icons)
add_dependencies(mac_overlayplugin ${APPLICATION_EXECUTABLE}) # for the ownCloud.icns to be generated
# legacy
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Release/SyncStateFinder.osax/Contents
DESTINATION ${CMAKE_INSTALL_PREFIX}/Library/ScriptingAdditions/SyncStateFinder.osax/ )
# >= 10.10.x
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Release/FinderSyncExt.appex
DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns
DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Plugins
USE_SOURCE_PERMISSIONS)
endif(APPLE)
@@ -103,8 +103,7 @@
if (_shareMenuTitle && !onlyRootsSelected) {
NSMenu *menu = [[NSMenu alloc] initWithTitle:@""];
NSMenuItem *item = [menu addItemWithTitle:_shareMenuTitle action:@selector(shareMenuAction:) keyEquivalent:@"title"];
item.image = [[NSBundle mainBundle] imageForResource:@"app.icns"];
[menu addItemWithTitle:_shareMenuTitle action:@selector(shareMenuAction:) keyEquivalent:@"title"];
return menu;
}
@@ -178,7 +178,6 @@
C2B573D31B1CD9CE00303B36 /* Sources */,
C2B573D41B1CD9CE00303B36 /* Frameworks */,
C2B573D51B1CD9CE00303B36 /* Resources */,
5B3335471CA058E200E11A45 /* ShellScript */,
);
buildRules = (
);
@@ -254,23 +253,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
5B3335471CA058E200E11A45 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ ${OC_OEM_SHARE_ICNS} ]]; then\n cp ${OC_OEM_SHARE_ICNS} ${BUILT_PRODUCTS_DIR}/FinderSyncExt.appex/Contents/Resources/app.icns\nfi";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
C2B573AD1B1CD91E00303B36 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -447,7 +429,6 @@
MTL_ENABLE_DEBUG_INFO = YES;
OC_APPLICATION_NAME = ownCloud;
OC_APPLICATION_REV_DOMAIN = com.owncloud.desktopclient;
OC_OEM_SHARE_ICNS = "";
OC_SOCKETAPI_TEAM_IDENTIFIER_PREFIX = "";
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -495,7 +476,6 @@
MTL_ENABLE_DEBUG_INFO = NO;
OC_APPLICATION_NAME = ownCloud;
OC_APPLICATION_REV_DOMAIN = com.owncloud.desktopclient;
OC_OEM_SHARE_ICNS = "";
OC_SOCKETAPI_TEAM_IDENTIFIER_PREFIX = "";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
+10 -17
Ver Arquivo
@@ -28,26 +28,19 @@ include(GenerateExportHeader)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
if (NOT DEFINED APPLICATION_EXECUTABLE )
set ( APPLICATION_EXECUTABLE "owncloud" )
endif()
#---HELPER---
set(OWNCLOUDDOLPHINHELPER ${APPLICATION_EXECUTABLE}dolphinpluginhelper)
add_library(${OWNCLOUDDOLPHINHELPER} SHARED ownclouddolphinpluginhelper.cpp)
target_link_libraries(${OWNCLOUDDOLPHINHELPER} Qt5::Network)
generate_export_header(${OWNCLOUDDOLPHINHELPER} BASE_NAME ownclouddolphinpluginhelper)
install(TARGETS ${OWNCLOUDDOLPHINHELPER} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
add_library(ownclouddolphinpluginhelper SHARED ownclouddolphinpluginhelper.cpp)
target_link_libraries(ownclouddolphinpluginhelper Qt5::Network)
generate_export_header(ownclouddolphinpluginhelper)
install(TARGETS ownclouddolphinpluginhelper LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
#---OVERLAY PLUGIN---
set(OWNCLOUDDOLPHINOVERLAYPLUGIN ${APPLICATION_EXECUTABLE}dolphinoverlayplugin)
kcoreaddons_add_plugin(${OWNCLOUDDOLPHINOVERLAYPLUGIN} INSTALL_NAMESPACE "kf5/overlayicon"
kcoreaddons_add_plugin(ownclouddolphinoverlayplugin INSTALL_NAMESPACE "kf5/overlayicon"
JSON ownclouddolphinoverlayplugin.json SOURCES ownclouddolphinoverlayplugin.cpp)
target_link_libraries(${OWNCLOUDDOLPHINOVERLAYPLUGIN} KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets ${OWNCLOUDDOLPHINHELPER})
target_link_libraries(ownclouddolphinoverlayplugin KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets ownclouddolphinpluginhelper)
#---ACTION PLUGIN---
set(OWNCLOUDDOLPHINACTIONPLUGIN ${APPLICATION_EXECUTABLE}dolphinactionplugin)
add_library(${OWNCLOUDDOLPHINACTIONPLUGIN} MODULE ownclouddolphinactionplugin.cpp)
target_link_libraries(${OWNCLOUDDOLPHINACTIONPLUGIN} KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets ${OWNCLOUDDOLPHINHELPER})
install(FILES ownclouddolphinactionplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} RENAME ${OWNCLOUDDOLPHINACTIONPLUGIN}.desktop)
install(TARGETS ${OWNCLOUDDOLPHINACTIONPLUGIN} DESTINATION ${KDE_INSTALL_PLUGINDIR})
add_library(ownclouddolphinactionplugin MODULE ownclouddolphinactionplugin.cpp)
target_link_libraries(ownclouddolphinactionplugin KF5::CoreAddons KF5::KIOCore KF5::KIOWidgets ownclouddolphinpluginhelper)
install(FILES ownclouddolphinactionplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(TARGETS ownclouddolphinactionplugin DESTINATION ${KDE_INSTALL_PLUGINDIR})
+37 -78
Ver Arquivo
@@ -21,15 +21,11 @@ import socket
from gi.repository import GObject, Nautilus
# Please do not touch the following line.
# The reason is that we use a script to adopt this file for branding
# by replacing this line with the branding app name. If the following
# line is changed, the script can not match the pattern and fails.
print("Initializing owncloud-client-nautilus extension")
# Do not touch the following line.
appname = 'ownCloud'
print("Initializing "+appname+"-client-nautilus extension")
def get_local_path(url):
if url[0:7] == 'file://':
url = url[7:]
@@ -70,7 +66,6 @@ class SocketConnect(GObject.GObject):
GObject.timeout_add(5000, self._connectToSocketServer)
def sendCommand(self, cmd):
# print("Server command: " + cmd)
if self.connected:
try:
self._sock.send(cmd)
@@ -185,10 +180,10 @@ class MenuExtension(GObject.GObject, Nautilus.MenuProvider):
if not syncedFile:
return items
# Create a menu item
# Create an menu item
labelStr = "Share with " + appname + "..."
item = Nautilus.MenuItem(name='NautilusPython::ShareItem', label=labelStr,
tip='Share file {} through {}'.format(file.get_name(), appname) )
tip='Share file %s through ownCloud' % file.get_name())
item.connect("activate", self.menu_share, file)
items.append(item)
@@ -230,43 +225,41 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
for p in socketConnect.nautilusVFSFile_table:
if p == path or p.startswith(path):
item = socketConnect.nautilusVFSFile_table[p]['item']
update_items.append(p)
update_items.append(item)
for path1 in update_items:
socketConnect.nautilusVFSFile_table[path1]['item'].invalidate_extension_info()
for item in update_items:
item.invalidate_extension_info()
# Handles a single line of server response and sets the emblem
def handle_commands(self, action, args):
Emblems = { 'OK' : appname +'_ok',
'SYNC' : appname +'_sync',
'NEW' : appname +'_sync',
'IGNORE' : appname +'_warn',
'ERROR' : appname +'_error',
'OK+SWM' : appname +'_ok_shared',
'SYNC+SWM' : appname +'_sync_shared',
'NEW+SWM' : appname +'_sync_shared',
'IGNORE+SWM': appname +'_warn_shared',
'ERROR+SWM' : appname +'_error_shared',
'NOP' : appname +'_error'
}
# file = args[0] # For debug only
# print("Action for " + file + ": " + args[0]) # For debug only
if action == 'STATUS':
newState = args[0]
emblem = Emblems[newState]
filename = ':'.join(args[1:])
itemStore = self.find_item_for_file(filename)
if itemStore:
if( not itemStore['state'] or newState != itemStore['state'] ):
item = itemStore['item']
# print("Setting emblem on " + filename + "<>" + emblem + "<>") # For debug only
# If an emblem is already set for this item, we need to
# clear the existing extension info before setting a new one.
#
# That will also trigger a new call to
# update_file_info for this item! That's why we set
# skipNextUpdate to True: we don't want to pull the
# current data from the client after getting a push
# notification.
invalidate = itemStore['state'] != None
if invalidate:
item.invalidate_extension_info()
self.set_emblem(item, newState)
socketConnect.nautilusVFSFile_table[filename] = {
'item': item,
'state': newState,
'skipNextUpdate': invalidate }
if emblem:
itemStore = self.find_item_for_file(filename)
if itemStore:
if( not itemStore['state'] or newState != itemStore['state'] ):
item = itemStore['item']
item.add_emblem(emblem)
# print("Setting emblem on " + filename + "<>" + emblem + "<>") # For debug only
socketConnect.nautilusVFSFile_table[filename] = {'item': item, 'state':newState}
elif action == 'UPDATE_VIEW':
# Search all items underneath this path and invalidate them
@@ -278,25 +271,6 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
elif action == 'UNREGISTER_PATH':
self.invalidate_items_underneath(args[0])
def set_emblem(self, item, state):
Emblems = { 'OK' : appname +'_ok',
'SYNC' : appname +'_sync',
'NEW' : appname +'_sync',
'IGNORE' : appname +'_warn',
'ERROR' : appname +'_error',
'OK+SWM' : appname +'_ok_shared',
'SYNC+SWM' : appname +'_sync_shared',
'NEW+SWM' : appname +'_sync_shared',
'IGNORE+SWM': appname +'_warn_shared',
'ERROR+SWM' : appname +'_error_shared',
'NOP' : ''
}
emblem = 'NOP' # Show nothing if no emblem is defined.
if state in Emblems:
emblem = Emblems[state]
item.add_emblem(emblem)
def update_file_info(self, item):
if item.get_uri_scheme() != 'file':
return
@@ -305,28 +279,13 @@ class SyncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.Info
if item.is_directory():
filename += '/'
inScope = False
for reg_path in socketConnect.registered_paths:
if filename.startswith(reg_path):
inScope = True
socketConnect.nautilusVFSFile_table[filename] = {'item': item, 'state':''}
# item.add_string_attribute('share_state', "share state") # ?
self.askForOverlay(filename)
break
if not inScope:
return
# Ask for the current state from the client -- unless this update was
# triggered by receiving a STATUS message from the client in the first
# place.
itemStore = self.find_item_for_file(filename)
if itemStore and itemStore['skipNextUpdate'] and itemStore['state']:
itemStore['skipNextUpdate'] = False
itemStore['item'] = item
self.set_emblem(item, itemStore['state'])
else:
socketConnect.nautilusVFSFile_table[filename] = {
'item': item,
'state': None,
'skipNextUpdate': False }
# item.add_string_attribute('share_state', "share state") # ?
self.askForOverlay(filename)
else:
# print("Not in scope:" + filename) # For debug only
pass
@@ -36,7 +36,8 @@ using namespace std;
OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo()
{
auto pipename = CommunicationSocket::DefaultPipePath();
auto pipename = std::wstring(L"\\\\.\\pipe\\");
pipename += L"ownCloud";
CommunicationSocket socket;
if (!WaitNamedPipe(pipename.data(), PIPE_TIMEOUT)) {
@@ -71,7 +72,8 @@ OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo()
void OCClientInterface::ShareObject(const std::wstring &path)
{
auto pipename = CommunicationSocket::DefaultPipePath();
auto pipename = std::wstring(L"\\\\.\\pipe\\");
pipename += L"ownCloud";
CommunicationSocket socket;
if (!WaitNamedPipe(pipename.data(), PIPE_TIMEOUT)) {
+25 -31
Ver Arquivo
@@ -108,6 +108,31 @@ HRESULT RegisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr, PCWSTR szModule)
return hResult;
}
HRESULT _stdcall DllRegisterServer(void)
{
HRESULT hResult = S_OK;
wchar_t szModule[MAX_PATH];
if (GetModuleFileName(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) {
hResult = HRESULT_FROM_WIN32(GetLastError());
return hResult;
}
hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_OK_SHARED, OVERLAY_NAME_OK_SHARED, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_SYNC, OVERLAY_NAME_SYNC, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_WARNING, OVERLAY_NAME_WARNING, szModule);
return hResult;
}
HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr)
{
HRESULT hResult = S_OK;
@@ -130,37 +155,6 @@ HRESULT UnregisterCLSID(LPCOLESTR guidStr, PCWSTR overlayStr)
return hResult;
}
HRESULT _stdcall DllRegisterServer(void)
{
HRESULT hResult = S_OK;
wchar_t szModule[MAX_PATH];
if (GetModuleFileName(instanceHandle, szModule, ARRAYSIZE(szModule)) == 0) {
hResult = HRESULT_FROM_WIN32(GetLastError());
return hResult;
}
// Unregister any obsolete CLSID when we register here
// Those CLSID were removed in 2.1, but we need to make sure to prevent any previous version
// of the extension on the system from loading at the same time as a new version to avoid crashing explorer.
UnregisterCLSID(OVERLAY_GUID_ERROR_SHARED, OVERLAY_NAME_ERROR_SHARED);
UnregisterCLSID(OVERLAY_GUID_SYNC_SHARED, OVERLAY_NAME_SYNC_SHARED);
UnregisterCLSID(OVERLAY_GUID_WARNING_SHARED, OVERLAY_NAME_WARNING_SHARED);
hResult = RegisterCLSID(OVERLAY_GUID_ERROR, OVERLAY_NAME_ERROR, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_OK, OVERLAY_NAME_OK, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_OK_SHARED, OVERLAY_NAME_OK_SHARED, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_SYNC, OVERLAY_NAME_SYNC, szModule);
if (!SUCCEEDED(hResult)) { return hResult; }
hResult = RegisterCLSID(OVERLAY_GUID_WARNING, OVERLAY_NAME_WARNING, szModule);
return hResult;
}
STDAPI DllUnregisterServer(void)
{
HRESULT hResult = S_OK;
@@ -14,25 +14,19 @@
#define OVERLAY_GUID_ERROR L"{0960F090-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GUID_ERROR_SHARED L"{0960F091-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GUID_OK L"{0960F092-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GUID_OK_SHARED L"{0960F093-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GUID_SYNC L"{0960F094-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GUID_SYNC_SHARED L"{0960F095-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GUID_WARNING L"{0960F096-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GUID_WARNING_SHARED L"{0960F097-F328-48A3-B746-276B1E3C3722}"
#define OVERLAY_GENERIC_NAME L"OC Overlay Handler"
// two spaces to put us ahead of the competition :/
#define OVERLAY_NAME_ERROR L" OCError"
#define OVERLAY_NAME_ERROR_SHARED L" OCErrorShared"
#define OVERLAY_NAME_OK L" OCOK"
#define OVERLAY_NAME_OK_SHARED L" OCOKShared"
#define OVERLAY_NAME_SYNC L" OCSync"
#define OVERLAY_NAME_SYNC_SHARED L" OCSyncShared"
#define OVERLAY_NAME_WARNING L" OCWarning"
#define OVERLAY_NAME_WARNING_SHARED L" OCWarningShared"
#define REGISTRY_OVERLAY_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ShellIconOverlayIdentifiers"
#define REGISTRY_CLSID L"CLSID"
@@ -24,31 +24,11 @@
#include <fstream>
#define DEFAULT_BUFLEN 4096
#define BUFSIZE 1024
using namespace std;
namespace {
std::wstring getUserName() {
DWORD len = DEFAULT_BUFLEN;
TCHAR buf[DEFAULT_BUFLEN];
if (GetUserName(buf, &len)) {
return std::wstring(&buf[0], len);
} else {
return std::wstring();
}
}
}
std::wstring CommunicationSocket::DefaultPipePath()
{
auto pipename = std::wstring(L"\\\\.\\pipe\\");
pipename += L"ownCloud\\";
pipename += getUserName();
return pipename;
}
#define DEFAULT_BUFLEN 4096
CommunicationSocket::CommunicationSocket()
: _pipe(INVALID_HANDLE_VALUE)
@@ -26,8 +26,6 @@
class __declspec(dllexport) CommunicationSocket
{
public:
static std::wstring DefaultPipePath();
CommunicationSocket();
~CommunicationSocket();
@@ -45,4 +43,4 @@ private:
bool _connected;
};
#endif
#endif
@@ -31,10 +31,13 @@
using namespace std;
// This code is run in a thread
void RemotePathChecker::workerThreadLoop()
{
auto pipename = CommunicationSocket::DefaultPipePath();
auto pipename = std::wstring(L"\\\\.\\pipe\\");
pipename += L"ownCloud";
bool connected = false;
CommunicationSocket socket;
std::unordered_set<std::wstring> asked;
@@ -238,4 +241,4 @@ RemotePathChecker::FileState RemotePathChecker::_StrToFileState(const std::wstri
}
return StateNone;
}
}
+353
Ver Arquivo
@@ -0,0 +1,353 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** 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
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "fancylineedit.h"
#include <QEvent>
#include <QDebug>
#include <QString>
#include <QPropertyAnimation>
#include <QApplication>
#include <QMenu>
#include <QMouseEvent>
#include <QLabel>
#include <QAbstractButton>
#include <QPainter>
#include <QStyle>
#include <QPaintEvent>
#include <QDesktopWidget>
/*! Opens a menu at the specified widget position.
* This functions computes the position where to show the menu, and opens it with
* QMenu::exec().
* \param menu The menu to open
* \param widget The widget next to which to open the menu
*/
static void execMenuAtWidget(QMenu *menu, QWidget *widget)
{
QPoint p;
QRect screen = qApp->desktop()->availableGeometry(widget);
QSize sh = menu->sizeHint();
QRect rect = widget->rect();
if (widget->isRightToLeft()) {
if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height())
p = widget->mapToGlobal(rect.bottomRight());
else
p = widget->mapToGlobal(rect.topRight() - QPoint(0, sh.height()));
p.rx() -= sh.width();
} else {
if (widget->mapToGlobal(QPoint(0, rect.bottom())).y() + sh.height() <= screen.height())
p = widget->mapToGlobal(rect.bottomLeft());
else
p = widget->mapToGlobal(rect.topLeft() - QPoint(0, sh.height()));
}
p.rx() = qMax(screen.left(), qMin(p.x(), screen.right() - sh.width()));
p.ry() += 1;
menu->exec(p);
}
/*!
\class Utils::FancyLineEdit
\brief A line edit with an embedded pixmap on one side that is connected to
a menu.
Additionally, it can display a grayed hintText (like "Type Here to")
when not focused and empty. When connecting to the changed signals and
querying text, one has to be aware that the text is set to that hint
text if isShowingHintText() returns true (that is, does not contain
valid user input).
*/
enum { margin = 6 };
#define ICONBUTTON_HEIGHT 18
#define FADE_TIME 160
namespace Utils {
// --------- FancyLineEditPrivate
class FancyLineEditPrivate : public QObject
{
public:
explicit FancyLineEditPrivate(FancyLineEdit *parent);
virtual bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
FancyLineEdit *m_lineEdit;
QPixmap m_pixmap[2];
QMenu *m_menu[2];
bool m_menuTabFocusTrigger[2];
IconButton *m_iconbutton[2];
bool m_iconEnabled[2];
};
FancyLineEditPrivate::FancyLineEditPrivate(FancyLineEdit *parent) :
QObject(parent), m_lineEdit(parent)
{
for (int i = 0; i < 2; ++i) {
m_menu[i] = 0;
m_menuTabFocusTrigger[i] = false;
m_iconbutton[i] = new IconButton(parent);
m_iconbutton[i]->installEventFilter(this);
m_iconbutton[i]->hide();
m_iconbutton[i]->setAutoHide(false);
m_iconEnabled[i] = false;
}
}
bool FancyLineEditPrivate::eventFilter(QObject *obj, QEvent *event)
{
int buttonIndex = -1;
for (int i = 0; i < 2; ++i) {
if (obj == m_iconbutton[i]) {
buttonIndex = i;
break;
}
}
if (buttonIndex == -1)
return QObject::eventFilter(obj, event);
switch (event->type()) {
case QEvent::FocusIn:
if (m_menuTabFocusTrigger[buttonIndex] && m_menu[buttonIndex]) {
m_lineEdit->setFocus();
execMenuAtWidget(m_menu[buttonIndex], m_iconbutton[buttonIndex]);
return true;
}
default:
break;
}
return QObject::eventFilter(obj, event);
}
// --------- FancyLineEdit
FancyLineEdit::FancyLineEdit(QWidget *parent) :
QLineEdit(parent),
d(new FancyLineEditPrivate(this))
{
ensurePolished();
updateMargins();
connect(this, SIGNAL(textChanged(QString)), this, SLOT(checkButtons(QString)));
connect(d->m_iconbutton[Left], SIGNAL(clicked()), this, SLOT(iconClicked()));
connect(d->m_iconbutton[Right], SIGNAL(clicked()), this, SLOT(iconClicked()));
}
void FancyLineEdit::checkButtons(const QString &text)
{
if (m_oldText.isEmpty() || text.isEmpty()) {
for (int i = 0; i < 2; ++i) {
if (d->m_iconbutton[i]->hasAutoHide())
d->m_iconbutton[i]->animateShow(!text.isEmpty());
}
m_oldText = text;
}
}
FancyLineEdit::~FancyLineEdit()
{
}
void FancyLineEdit::setButtonVisible(Side side, bool visible)
{
d->m_iconbutton[side]->setVisible(visible);
d->m_iconEnabled[side] = visible;
updateMargins();
}
bool FancyLineEdit::isButtonVisible(Side side) const
{
return d->m_iconEnabled[side];
}
void FancyLineEdit::iconClicked()
{
IconButton *button = qobject_cast<IconButton *>(sender());
int index = -1;
for (int i = 0; i < 2; ++i)
if (d->m_iconbutton[i] == button)
index = i;
if (index == -1)
return;
if (d->m_menu[index]) {
execMenuAtWidget(d->m_menu[index], button);
} else {
emit buttonClicked((Side)index);
if (index == Left)
emit leftButtonClicked();
else if (index == Right)
emit rightButtonClicked();
}
}
void FancyLineEdit::updateMargins()
{
bool leftToRight = (layoutDirection() == Qt::LeftToRight);
Side realLeft = (leftToRight ? Left : Right);
Side realRight = (leftToRight ? Right : Left);
int leftMargin = d->m_iconbutton[realLeft]->pixmap().width() + 8;
int rightMargin = d->m_iconbutton[realRight]->pixmap().width() + 8;
// Note KDE does not reserve space for the highlight color
if (style()->inherits("OxygenStyle")) {
leftMargin = qMax(24, leftMargin);
rightMargin = qMax(24, rightMargin);
}
QMargins margins((d->m_iconEnabled[realLeft] ? leftMargin : 0), 0,
(d->m_iconEnabled[realRight] ? rightMargin : 0), 0);
setTextMargins(margins);
}
void FancyLineEdit::updateButtonPositions()
{
QRect contentRect = rect();
for (int i = 0; i < 2; ++i) {
Side iconpos = (Side)i;
if (layoutDirection() == Qt::RightToLeft)
iconpos = (iconpos == Left ? Right : Left);
if (iconpos == FancyLineEdit::Right) {
const int iconoffset = textMargins().right() + 4;
d->m_iconbutton[i]->setGeometry(contentRect.adjusted(width() - iconoffset, 0, 0, 0));
} else {
const int iconoffset = textMargins().left() + 4;
d->m_iconbutton[i]->setGeometry(contentRect.adjusted(0, 0, -width() + iconoffset, 0));
}
}
}
void FancyLineEdit::resizeEvent(QResizeEvent *)
{
updateButtonPositions();
}
void FancyLineEdit::setButtonPixmap(Side side, const QPixmap &buttonPixmap)
{
d->m_iconbutton[side]->setPixmap(buttonPixmap);
updateMargins();
updateButtonPositions();
update();
}
QPixmap FancyLineEdit::buttonPixmap(Side side) const
{
return d->m_pixmap[side];
}
void FancyLineEdit::setButtonMenu(Side side, QMenu *buttonMenu)
{
d->m_menu[side] = buttonMenu;
d->m_iconbutton[side]->setIconOpacity(1.0);
}
QMenu *FancyLineEdit::buttonMenu(Side side) const
{
return d->m_menu[side];
}
bool FancyLineEdit::hasMenuTabFocusTrigger(Side side) const
{
return d->m_menuTabFocusTrigger[side];
}
void FancyLineEdit::setMenuTabFocusTrigger(Side side, bool v)
{
if (d->m_menuTabFocusTrigger[side] == v)
return;
d->m_menuTabFocusTrigger[side] = v;
d->m_iconbutton[side]->setFocusPolicy(v ? Qt::TabFocus : Qt::NoFocus);
}
bool FancyLineEdit::hasAutoHideButton(Side side) const
{
return d->m_iconbutton[side]->hasAutoHide();
}
void FancyLineEdit::setAutoHideButton(Side side, bool h)
{
d->m_iconbutton[side]->setAutoHide(h);
if (h)
d->m_iconbutton[side]->setIconOpacity(text().isEmpty() ? 0.0 : 1.0);
else
d->m_iconbutton[side]->setIconOpacity(1.0);
}
void FancyLineEdit::setButtonToolTip(Side side, const QString &tip)
{
d->m_iconbutton[side]->setToolTip(tip);
}
void FancyLineEdit::setButtonFocusPolicy(Side side, Qt::FocusPolicy policy)
{
d->m_iconbutton[side]->setFocusPolicy(policy);
}
// IconButton - helper class to represent a clickable icon
IconButton::IconButton(QWidget *parent)
: QAbstractButton(parent), m_iconOpacity(0), m_autoHide(false)
{
setCursor(Qt::ArrowCursor);
setFocusPolicy(Qt::NoFocus);
}
void IconButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QRect pixmapRect = QRect(0, 0, m_pixmap.width(), m_pixmap.height());
pixmapRect.moveCenter(rect().center());
if (m_autoHide)
painter.setOpacity(m_iconOpacity);
painter.drawPixmap(pixmapRect, m_pixmap);
}
void IconButton::animateShow(bool visible)
{
if (visible) {
QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
animation->setDuration(FADE_TIME);
animation->setEndValue(1.0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
} else {
QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
animation->setDuration(FADE_TIME);
animation->setEndValue(0.0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
}
} // namespace Utils
+121
Ver Arquivo
@@ -0,0 +1,121 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** 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
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef FANCYLINEEDIT_H
#define FANCYLINEEDIT_H
#include <QLineEdit>
#include <QAbstractButton>
namespace Utils {
class FancyLineEditPrivate;
class IconButton: public QAbstractButton
{
Q_OBJECT
Q_PROPERTY(float iconOpacity READ iconOpacity WRITE setIconOpacity)
Q_PROPERTY(bool autoHide READ hasAutoHide WRITE setAutoHide)
Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap)
public:
explicit IconButton(QWidget *parent = 0);
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void setPixmap(const QPixmap &pixmap) { m_pixmap = pixmap; update(); }
QPixmap pixmap() const { return m_pixmap; }
float iconOpacity() { return m_iconOpacity; }
void setIconOpacity(float value) { m_iconOpacity = value; update(); }
void animateShow(bool visible);
void setAutoHide(bool hide) { m_autoHide = hide; }
bool hasAutoHide() const { return m_autoHide; }
private:
float m_iconOpacity;
bool m_autoHide;
QPixmap m_pixmap;
};
class FancyLineEdit : public QLineEdit
{
Q_OBJECT
Q_ENUMS(Side)
public:
enum Side {Left = 0, Right = 1};
explicit FancyLineEdit(QWidget *parent = 0);
~FancyLineEdit();
QPixmap buttonPixmap(Side side) const;
void setButtonPixmap(Side side, const QPixmap &pixmap);
QMenu *buttonMenu(Side side) const;
void setButtonMenu(Side side, QMenu *menu);
void setButtonVisible(Side side, bool visible);
bool isButtonVisible(Side side) const;
void setButtonToolTip(Side side, const QString &);
void setButtonFocusPolicy(Side side, Qt::FocusPolicy policy);
// Set whether tabbing in will trigger the menu.
void setMenuTabFocusTrigger(Side side, bool v);
bool hasMenuTabFocusTrigger(Side side) const;
// Set if icon should be hidden when text is empty
void setAutoHideButton(Side side, bool h);
bool hasAutoHideButton(Side side) const;
#if QT_VERSION <= 0x040700
void setPlaceholderText( const QString& ) { }
#endif
signals:
void buttonClicked(Utils::FancyLineEdit::Side side);
void leftButtonClicked();
void rightButtonClicked();
private slots:
void checkButtons(const QString &);
void iconClicked();
protected:
virtual void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
private:
void updateMargins();
void updateButtonPositions();
friend class Utils::FancyLineEditPrivate;
FancyLineEditPrivate *d;
QString m_oldText;
};
} // namespace Utils
#endif // FANCYLINEEDIT_H
-264
Ver Arquivo
@@ -1,264 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2014 Daniel Molkentin <daniel@molkentin.de>
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtNetwork module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TOKENIZER_H
#define TOKENIZER_H
#include <QString>
#include <QByteArray>
#include <QSharedPointer>
QT_BEGIN_NAMESPACE
template <class T, class const_iterator>
struct QTokenizerPrivate {
typedef typename T::value_type char_type;
struct State {
bool inQuote;
bool inEscape;
char_type quoteChar;
State() : inQuote(false), inEscape(false), quoteChar('\0') {}
};
QTokenizerPrivate(const T& _string, const T& _delims) :
string(_string)
, begin(string.begin())
, end(string.end())
, tokenBegin(end)
, tokenEnd(begin)
, delimiters(_delims)
, isDelim(false)
, returnDelimiters(false)
, returnQuotes(false)
{
}
bool isDelimiter(char_type c) const {
return delimiters.contains(c);
}
bool isQuote(char_type c) const {
return quotes.contains(c);
}
// Returns true if a delimiter was not hit
bool nextChar(State* state, char_type c) {
if (state->inQuote) {
if (state->inEscape) {
state->inEscape = false;
} else if (c == '\\') {
state->inEscape = true;
} else if (c == state->quoteChar) {
state->inQuote = false;
}
} else {
if (isDelimiter(c))
return false;
state->inQuote = isQuote(state->quoteChar = c);
}
return true;
}
T string;
// ### copies begin and end for performance, premature optimization?
const_iterator begin;
const_iterator end;
const_iterator tokenBegin;
const_iterator tokenEnd;
T delimiters;
T quotes;
bool isDelim;
bool returnDelimiters;
bool returnQuotes;
};
template <class T, class const_iterator>
class QTokenizer {
public:
typedef typename T::value_type char_type;
/*!
\class QTokenizer
\inmodule QtNetwork
\brief QTokenizer tokenizes Strings on QString, QByteArray,
std::string or std::wstring
Example Usage:
\code
QString str = ...;
QByteArrayTokenizer tokenizer(str, "; ");
tokenizer.setQuoteCharacters("\"'");
tokenizer.setReturnDelimiters(true);
while (tokenizer.hasNext()) {
QByteArray token = tokenizer.next();
bool isDelimiter = tokenizer.isDelimiter();
...
}
\endcode
\param string The string to tokenize
\param delimiters A string containing delimiters
\sa QStringTokenizer, QByteArrayTokenizer, StringTokenizer, WStringTokenizer
*/
QTokenizer(const T& string, const T& delimiters)
: d(new QTokenizerPrivate<T, const_iterator>(string, delimiters))
{ }
/*!
Whether or not to return delimiters as tokens
\see setQuoteCharacters
*/
void setReturnDelimiters(bool enable) { d->returnDelimiters = enable; }
/*!
Sets characters that are considered to start and end quotes.
When between two characters considered a quote, delimiters will
be ignored.
When between quotes, blackslash characters will cause the QTokenizer
to skip the next character.
\param quotes Characters that delimit quotes.
*/
void setQuoteCharacters(const T& quotes) { d->quotes = quotes; }
/*!
Whether or not to return delimiters as tokens
\see setQuoteCharacters
*/
void setReturnQuoteCharacters(bool enable) { d->returnQuotes = enable; }
/*!
Retrieve next token.
Returns true if there are more tokens, false otherwise.
\sa next()
*/
bool hasNext()
{
typename QTokenizerPrivate<T, const_iterator>::State state;
d->isDelim = false;
for (;;) {
d->tokenBegin = d->tokenEnd;
if (d->tokenEnd == d->end)
return false;
d->tokenEnd++;
if (d->nextChar(&state, *d->tokenBegin))
break;
if (d->returnDelimiters) {
d->isDelim = true;
return true;
}
}
while (d->tokenEnd != d->end && d->nextChar(&state, *d->tokenEnd)) {
d->tokenEnd++;
}
return true;
}
/*!
Resets the tokenizer to the starting position.
*/
void reset() {
d->tokenEnd = d->begin;
}
/*!
Returns true if the current token is a delimiter,
if one more more delimiting characters have been set.
*/
bool isDelimiter() const { return d->isDelim; }
/*!
Returns the current token.
Use \c hasNext() to fetch the next token.
*/
T next() const {
int len = d->tokenEnd-d->tokenBegin;
const_iterator tmpStart = d->tokenBegin;
if (!d->returnQuotes && len > 1 && d->isQuote(*d->tokenBegin)) {
tmpStart++;
len -= 2;
}
return T(tmpStart, len);
}
private:
friend class QStringTokenizer;
QSharedPointer<QTokenizerPrivate<T, const_iterator> > d;
};
class QStringTokenizer : public QTokenizer<QString, QString::const_iterator> {
public:
QStringTokenizer(const QString &string, const QString &delim) :
QTokenizer<QString, QString::const_iterator>(string, delim) {}
/**
* @brief Like \see next(), but returns a lightweight string reference
* @return A reference to the token within the string
*/
QStringRef stringRef() {
int begin = d->tokenBegin-d->begin;
int end = d->tokenEnd-d->tokenBegin;
if (!d->returnQuotes && d->isQuote(*d->tokenBegin)) {
begin++;
end -= 2;
}
return QStringRef(&d->string, begin, end);
}
};
typedef QTokenizer<QByteArray, QByteArray::const_iterator> QByteArrayTokenizer;
typedef QTokenizer<std::string, std::string::const_iterator> StringTokenizer;
typedef QTokenizer<std::wstring, std::wstring::const_iterator> WStringTokenizer;
QT_END_NAMESPACE
#endif // TOKENIZER_H
-2
Ver Arquivo
@@ -1,2 +0,0 @@
TEMPLATE = subdirs
SUBDIRS = test
-8
Ver Arquivo
@@ -1,8 +0,0 @@
TEMPLATE = app
QT += testlib
CONFIG += testlib
TARGET = test
INCLUDEPATH += . ..
# Input
SOURCES += tst_qtokenizer.cpp
-139
Ver Arquivo
@@ -1,139 +0,0 @@
#include <QtTest>
#include "qtokenizer.h"
namespace {
const QString simple = QLatin1String("A simple tokenizer test");
const QString quoted = QLatin1String("\"Wait for me!\" he shouted");
}
class TestTokenizer : public QObject
{
Q_OBJECT
private slots:
void tokenizeQStringSimple() {
QStringTokenizer tokenizer(simple, " ");
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("A"));
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("simple"));
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("tokenizer"));
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("test"));
QCOMPARE(tokenizer.hasNext(), false);
}
void tokenizeQStringSimpleRef() {
QStringTokenizer tokenizer(simple, " ");
QCOMPARE(tokenizer.hasNext(), true);
QVERIFY(tokenizer.stringRef() == QLatin1String("A"));
QCOMPARE(tokenizer.hasNext(), true);
QVERIFY(tokenizer.stringRef() == QLatin1String("simple"));
QCOMPARE(tokenizer.hasNext(), true);
QVERIFY(tokenizer.stringRef() == QLatin1String("tokenizer"));
QCOMPARE(tokenizer.hasNext(), true);
QVERIFY(tokenizer.stringRef() == QLatin1String("test"));
QCOMPARE(tokenizer.hasNext(), false);
}
void tokenizeQStringQuoted() {
const QString multiquote(QLatin1String("\"'Billy - the Kid' is dead!\""));
QStringTokenizer tokenizer(multiquote, " -");
tokenizer.setQuoteCharacters("\"");
tokenizer.setReturnQuoteCharacters(true);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("\"'Billy - the Kid' is dead!\""));
QCOMPARE(tokenizer.hasNext(), false);
}
void tokenizeQStringSkipQuotes() {
const QString multiquote(QLatin1String("\"'Billy - the Kid' is dead!\""));
QStringTokenizer tokenizer(multiquote, " ");
tokenizer.setQuoteCharacters("\"");
tokenizer.setReturnQuoteCharacters(false);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("'Billy - the Kid' is dead!"));
QCOMPARE(tokenizer.stringRef().toString(), QLatin1String("'Billy - the Kid' is dead!"));
QCOMPARE(tokenizer.hasNext(), false);
}
void tokenizeQStringWithDelims() {
const QString delims(QLatin1String("I;Insist,On/a-Delimiter"));
QStringTokenizer tokenizer(delims, ";,/-");
tokenizer.setReturnDelimiters(true);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), false);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), true);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), false);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), true);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), false);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), true);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), false);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), true);
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.isDelimiter(), false);
QCOMPARE(tokenizer.hasNext(), false);
}
void resetTokenizer() {
for (int i = 0; i < 2; i++) {
QStringTokenizer tokenizer(simple, " ");
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("A"));
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("simple"));
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("tokenizer"));
QCOMPARE(tokenizer.hasNext(), true);
QCOMPARE(tokenizer.next(), QLatin1String("test"));
QCOMPARE(tokenizer.hasNext(), false);
tokenizer.reset();
}
}
// ### QByteArray, other types
};
QTEST_APPLESS_MAIN(TestTokenizer)
#include "tst_qtokenizer.moc"
+8791 -13879
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+46 -336
Ver Arquivo
@@ -111,9 +111,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.12.2"
#define SQLITE_VERSION_NUMBER 3012002
#define SQLITE_SOURCE_ID "2016-04-18 17:30:31 92dc59fd5ad66f646666042eb04195e3a61a9e8e"
#define SQLITE_VERSION "3.9.1"
#define SQLITE_VERSION_NUMBER 3009001
#define SQLITE_SOURCE_ID "2015-10-16 17:31:12 767c1727fec4ce11b83f25b3f1bfcfe68a2c8b02"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -347,7 +347,7 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
** from [sqlite3_malloc()] and passed back through the 5th parameter.
** To avoid memory leaks, the application should invoke [sqlite3_free()]
** on error message strings returned through the 5th parameter of
** sqlite3_exec() after the error message string is no longer needed.
** of sqlite3_exec() after the error message string is no longer needed.
** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
** NULL before returning.
@@ -478,7 +478,6 @@ SQLITE_API int SQLITE_STDCALL sqlite3_exec(
#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8))
#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
@@ -794,13 +793,8 @@ struct sqlite3_io_methods {
** <li>[[SQLITE_FCNTL_FILE_POINTER]]
** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
** to the [sqlite3_file] object associated with a particular database
** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER].
**
** <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
** to the [sqlite3_file] object associated with the journal file (either
** the [rollback journal] or the [write-ahead log]) for a particular database
** connection. See also [SQLITE_FCNTL_FILE_POINTER].
** connection. See the [sqlite3_file_control()] documentation for
** additional information.
**
** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
** No longer in use.
@@ -887,15 +881,6 @@ struct sqlite3_io_methods {
** pointer in case this file-control is not implemented. This file-control
** is intended for diagnostic use only.
**
** <li>[[SQLITE_FCNTL_VFS_POINTER]]
** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
** [VFSes] currently in use. ^(The argument X in
** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
** of type "[sqlite3_vfs] **". This opcodes will set *X
** to a pointer to the top-level VFS.)^
** ^When there are multiple VFS shims in the stack, this opcode finds the
** upper-most shim only.
**
** <li>[[SQLITE_FCNTL_PRAGMA]]
** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
** file control is sent to the open [sqlite3_file] object corresponding
@@ -1014,8 +999,6 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_WAL_BLOCK 24
#define SQLITE_FCNTL_ZIPVFS 25
#define SQLITE_FCNTL_RBU 26
#define SQLITE_FCNTL_VFS_POINTER 27
#define SQLITE_FCNTL_JOURNAL_POINTER 28
/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -1228,7 +1211,7 @@ struct sqlite3_vfs {
const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
/*
** The methods above are in versions 1 through 3 of the sqlite_vfs object.
** New fields may be appended in future versions. The iVersion
** New fields may be appended in figure versions. The iVersion
** value will increment whenever this happens.
*/
};
@@ -1615,34 +1598,29 @@ struct sqlite3_mem_methods {
** </dd>
**
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a static memory buffer
** that SQLite can use for the database page cache with the default page
** cache implementation.
** This configuration option is a no-op if an application-define page
** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
** This configuration should not be used if an application-define page
** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2]
** configuration option.
** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
** 8-byte aligned memory (pMem), the size of each page cache line (sz),
** and the number of cache lines (N).
** 8-byte aligned
** memory, the size of each page buffer (sz), and the number of pages (N).
** The sz argument should be the size of the largest database page
** (a power of two between 512 and 65536) plus some extra bytes for each
** page header. ^The number of extra bytes needed by the page header
** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ].
** can be determined using the [SQLITE_CONFIG_PCACHE_HDRSZ] option
** to [sqlite3_config()].
** ^It is harmless, apart from the wasted memory,
** for the sz parameter to be larger than necessary. The pMem
** argument must be either a NULL pointer or a pointer to an 8-byte
** aligned block of memory of at least sz*N bytes, otherwise
** subsequent behavior is undefined.
** ^When pMem is not NULL, SQLite will strive to use the memory provided
** to satisfy page cache needs, falling back to [sqlite3_malloc()] if
** a page cache line is larger than sz bytes or if all of the pMem buffer
** is exhausted.
** ^If pMem is NULL and N is non-zero, then each database connection
** does an initial bulk allocation for page cache memory
** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
** of -1024*N bytes if N is negative, . ^If additional
** page cache memory is needed beyond what is provided by the initial
** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
** additional cache line. </dd>
** for the sz parameter to be larger than necessary. The first
** argument should pointer to an 8-byte aligned block of memory that
** is at least sz*N bytes of memory, otherwise subsequent behavior is
** undefined.
** ^SQLite will use the memory provided by the first argument to satisfy its
** memory needs for the first N pages that it adds to cache. ^If additional
** page cache memory is needed beyond what is provided by this option, then
** SQLite goes to [sqlite3_malloc()] for the additional storage space.</dd>
**
** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
@@ -1820,20 +1798,6 @@ struct sqlite3_mem_methods {
** is enabled (using the [PRAGMA threads] command) and the amount of content
** to be sorted exceeds the page size times the minimum of the
** [PRAGMA cache_size] setting and this value.
**
** [[SQLITE_CONFIG_STMTJRNL_SPILL]]
** <dt>SQLITE_CONFIG_STMTJRNL_SPILL
** <dd>^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which
** becomes the [statement journal] spill-to-disk threshold.
** [Statement journals] are held in memory until their size (in bytes)
** exceeds this threshold, at which point they are written to disk.
** Or if the threshold is -1, statement journals are always held
** exclusively in memory.
** Since many statement journals never become large, setting the spill
** threshold to a value such as 64KiB can greatly reduce the amount of
** I/O required to support statement rollback.
** The default value for this setting is controlled by the
** [SQLITE_STMTJRNL_SPILL] compile-time option.
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -1861,7 +1825,6 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
/*
** CAPI3REF: Database Connection Configuration Options
@@ -1919,25 +1882,11 @@ struct sqlite3_mem_methods {
** following this call. The second parameter may be a NULL pointer, in
** which case the trigger setting is not reported back. </dd>
**
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
** <dd> ^This option is used to enable or disable the two-argument
** version of the [fts3_tokenizer()] function which is part of the
** [FTS3] full-text search engine extension.
** There should be two additional arguments.
** The first argument is an integer which is 0 to disable fts3_tokenizer() or
** positive to enable fts3_tokenizer() or negative to leave the setting
** unchanged.
** The second parameter is a pointer to an integer into which
** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
** following this call. The second parameter may be a NULL pointer, in
** which case the new setting is not reported back. </dd>
**
** </dl>
*/
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
/*
@@ -4440,8 +4389,8 @@ SQLITE_API unsigned int SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value*);
** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
** then sqlite3_value_free(V) is a harmless no-op.
*/
SQLITE_API sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
SQLITE_API void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
SQLITE_API SQLITE_EXPERIMENTAL sqlite3_value *SQLITE_STDCALL sqlite3_value_dup(const sqlite3_value*);
SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_value_free(sqlite3_value*);
/*
** CAPI3REF: Obtain Aggregate Function Context
@@ -5660,17 +5609,6 @@ struct sqlite3_module {
** ^Information about the ORDER BY clause is stored in aOrderBy[].
** ^Each term of aOrderBy records a column of the ORDER BY clause.
**
** The colUsed field indicates which columns of the virtual table may be
** required by the current scan. Virtual table columns are numbered from
** zero in the order in which they appear within the CREATE TABLE statement
** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
** the corresponding bit is set within the colUsed mask if the column may be
** required by SQLite. If the table has at least 64 columns and any column
** to the right of the first 63 is required, then bit 63 of colUsed is also
** set. In other words, column iCol may be required if the expression
** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
** non-zero.
**
** The [xBestIndex] method must fill aConstraintUsage[] with information
** about what parameters to pass to xFilter. ^If argvIndex>0 then
** the right-hand side of the corresponding aConstraint[] is evaluated
@@ -5726,7 +5664,7 @@ struct sqlite3_index_info {
/* Inputs */
int nConstraint; /* Number of entries in aConstraint */
struct sqlite3_index_constraint {
int iColumn; /* Column constrained. -1 for ROWID */
int iColumn; /* Column on left-hand side of constraint */
unsigned char op; /* Constraint operator */
unsigned char usable; /* True if this constraint is usable */
int iTermOffset; /* Used internally - xBestIndex should ignore */
@@ -5750,8 +5688,6 @@ struct sqlite3_index_info {
sqlite3_int64 estimatedRows; /* Estimated number of rows returned */
/* Fields below are only available in SQLite 3.9.0 and later */
int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */
/* Fields below are only available in SQLite 3.10.0 and later */
sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */
};
/*
@@ -5767,15 +5703,12 @@ struct sqlite3_index_info {
** an operator that is part of a constraint term in the wHERE clause of
** a query that uses a [virtual table].
*/
#define SQLITE_INDEX_CONSTRAINT_EQ 2
#define SQLITE_INDEX_CONSTRAINT_GT 4
#define SQLITE_INDEX_CONSTRAINT_LE 8
#define SQLITE_INDEX_CONSTRAINT_LT 16
#define SQLITE_INDEX_CONSTRAINT_GE 32
#define SQLITE_INDEX_CONSTRAINT_MATCH 64
#define SQLITE_INDEX_CONSTRAINT_LIKE 65
#define SQLITE_INDEX_CONSTRAINT_GLOB 66
#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
#define SQLITE_INDEX_CONSTRAINT_EQ 2
#define SQLITE_INDEX_CONSTRAINT_GT 4
#define SQLITE_INDEX_CONSTRAINT_LE 8
#define SQLITE_INDEX_CONSTRAINT_LT 16
#define SQLITE_INDEX_CONSTRAINT_GE 32
#define SQLITE_INDEX_CONSTRAINT_MATCH 64
/*
** CAPI3REF: Register A Virtual Table Implementation
@@ -6639,8 +6572,7 @@ SQLITE_API int SQLITE_STDCALL sqlite3_status64(
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>The *pHighwater parameter records the deepest parser stack.
** The *pCurrent value is undefined. The *pHighwater value is only
** <dd>This parameter records the deepest parser stack. It is only
** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
** </dl>
**
@@ -7426,43 +7358,18 @@ SQLITE_API int SQLITE_STDCALL sqlite3_strnicmp(const char *, const char *, int);
/*
** CAPI3REF: String Globbing
*
** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
** string X matches the [GLOB] pattern P.
** ^The definition of [GLOB] pattern matching used in
** ^The [sqlite3_strglob(P,X)] interface returns zero if string X matches
** the glob pattern P, and it returns non-zero if string X does not match
** the glob pattern P. ^The definition of glob pattern matching used in
** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the
** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function
** is case sensitive.
** SQL dialect used by SQLite. ^The sqlite3_strglob(P,X) function is case
** sensitive.
**
** Note that this routine returns zero on a match and non-zero if the strings
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
**
** See also: [sqlite3_strlike()].
*/
SQLITE_API int SQLITE_STDCALL sqlite3_strglob(const char *zGlob, const char *zStr);
/*
** CAPI3REF: String LIKE Matching
*
** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
** string X matches the [LIKE] pattern P with escape character E.
** ^The definition of [LIKE] pattern matching used in
** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E"
** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without
** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0.
** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case
** insensitive - equivalent upper and lower case ASCII characters match
** one another.
**
** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though
** only ASCII characters are case folded.
**
** Note that this routine returns zero on a match and non-zero if the strings
** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
**
** See also: [sqlite3_strglob()].
*/
SQLITE_API int SQLITE_STDCALL sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
/*
** CAPI3REF: Error Logging Interface
**
@@ -7518,7 +7425,7 @@ SQLITE_API void SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...)
** previously registered write-ahead log callback. ^Note that the
** [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
** overwrite any prior [sqlite3_wal_hook()] settings.
** those overwrite any prior [sqlite3_wal_hook()] settings.
*/
SQLITE_API void *SQLITE_STDCALL sqlite3_wal_hook(
sqlite3*,
@@ -7883,145 +7790,6 @@ SQLITE_API int SQLITE_STDCALL sqlite3_stmt_scanstatus(
*/
SQLITE_API void SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
/*
** CAPI3REF: Flush caches to disk mid-transaction
**
** ^If a write-transaction is open on [database connection] D when the
** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
** pages in the pager-cache that are not currently in use are written out
** to disk. A dirty page may be in use if a database cursor created by an
** active SQL statement is reading from it, or if it is page 1 of a database
** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)]
** interface flushes caches for all schemas - "main", "temp", and
** any [attached] databases.
**
** ^If this function needs to obtain extra database locks before dirty pages
** can be flushed to disk, it does so. ^If those locks cannot be obtained
** immediately and there is a busy-handler callback configured, it is invoked
** in the usual manner. ^If the required lock still cannot be obtained, then
** the database is skipped and an attempt made to flush any dirty pages
** belonging to the next (if any) database. ^If any databases are skipped
** because locks cannot be obtained, but no other error occurs, this
** function returns SQLITE_BUSY.
**
** ^If any other error occurs while flushing dirty pages to disk (for
** example an IO error or out-of-memory condition), then processing is
** abandoned and an SQLite [error code] is returned to the caller immediately.
**
** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
**
** ^This function does not set the database handle error code or message
** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
*/
SQLITE_API int SQLITE_STDCALL sqlite3_db_cacheflush(sqlite3*);
/*
** CAPI3REF: Low-level system error code
**
** ^Attempt to return the underlying operating system error code or error
** number that caused the most reason I/O error or failure to open a file.
** The return value is OS-dependent. For example, on unix systems, after
** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
** called to get back the underlying "errno" that caused the problem, such
** as ENOSPC, EAUTH, EISDIR, and so forth.
*/
SQLITE_API int SQLITE_STDCALL sqlite3_system_errno(sqlite3*);
/*
** CAPI3REF: Database Snapshot
** KEYWORDS: {snapshot}
** EXPERIMENTAL
**
** An instance of the snapshot object records the state of a [WAL mode]
** database for some specific point in history.
**
** In [WAL mode], multiple [database connections] that are open on the
** same database file can each be reading a different historical version
** of the database file. When a [database connection] begins a read
** transaction, that connection sees an unchanging copy of the database
** as it existed for the point in time when the transaction first started.
** Subsequent changes to the database from other connections are not seen
** by the reader until a new read transaction is started.
**
** The sqlite3_snapshot object records state information about an historical
** version of the database file so that it is possible to later open a new read
** transaction that sees that historical version of the database rather than
** the most recent version.
**
** The constructor for this object is [sqlite3_snapshot_get()]. The
** [sqlite3_snapshot_open()] method causes a fresh read transaction to refer
** to an historical snapshot (if possible). The destructor for
** sqlite3_snapshot objects is [sqlite3_snapshot_free()].
*/
typedef struct sqlite3_snapshot sqlite3_snapshot;
/*
** CAPI3REF: Record A Database Snapshot
** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
** new [sqlite3_snapshot] object that records the current state of
** schema S in database connection D. ^On success, the
** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
** ^If schema S of [database connection] D is not a [WAL mode] database
** that is in a read transaction, then [sqlite3_snapshot_get(D,S,P)]
** leaves the *P value unchanged and returns an appropriate [error code].
**
** The [sqlite3_snapshot] object returned from a successful call to
** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
** to avoid a memory leak.
**
** The [sqlite3_snapshot_get()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
*/
SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_get(
sqlite3 *db,
const char *zSchema,
sqlite3_snapshot **ppSnapshot
);
/*
** CAPI3REF: Start a read transaction on an historical snapshot
** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_open(D,S,P)] interface attempts to move the
** read transaction that is currently open on schema S of
** [database connection] D so that it refers to historical [snapshot] P.
** ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK on success
** or an appropriate [error code] if it fails.
**
** ^In order to succeed, a call to [sqlite3_snapshot_open(D,S,P)] must be
** the first operation, apart from other sqlite3_snapshot_open() calls,
** following the [BEGIN] that starts a new read transaction.
** ^A [snapshot] will fail to open if it has been overwritten by a
** [checkpoint].
** ^A [snapshot] will fail to open if the database connection D has not
** previously completed at least one read operation against the database
** file. (Hint: Run "[PRAGMA application_id]" against a newly opened
** database connection in order to make it ready to use snapshots.)
**
** The [sqlite3_snapshot_open()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
*/
SQLITE_API SQLITE_EXPERIMENTAL int SQLITE_STDCALL sqlite3_snapshot_open(
sqlite3 *db,
const char *zSchema,
sqlite3_snapshot *pSnapshot
);
/*
** CAPI3REF: Destroy a snapshot
** EXPERIMENTAL
**
** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
** The application must eventually free every [sqlite3_snapshot] object
** using this routine to avoid a memory leak.
**
** The [sqlite3_snapshot_free()] interface is only available when the
** SQLITE_ENABLE_SNAPSHOT compile-time option is used.
*/
SQLITE_API SQLITE_EXPERIMENTAL void SQLITE_STDCALL sqlite3_snapshot_free(sqlite3_snapshot*);
/*
** Undo the hack that converts floating point types to integer for
@@ -8238,9 +8006,6 @@ struct Fts5PhraseIter {
** an OOM condition or IO error), an appropriate SQLite error code is
** returned.
**
** This function may be quite inefficient if used with an FTS5 table
** created with the "columnsize=0" option.
**
** xColumnText:
** This function attempts to retrieve the text of column iCol of the
** current document. If successful, (*pz) is set to point to a buffer
@@ -8261,29 +8026,15 @@ struct Fts5PhraseIter {
** the query within the current row. Return SQLITE_OK if successful, or
** an error code (i.e. SQLITE_NOMEM) if an error occurs.
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option. If the FTS5 table is created
** with either "detail=none" or "detail=column" and "content=" option
** (i.e. if it is a contentless table), then this API always returns 0.
**
** xInst:
** Query for the details of phrase match iIdx within the current row.
** Phrase matches are numbered starting from zero, so the iIdx argument
** should be greater than or equal to zero and smaller than the value
** output by xInstCount().
**
** Usually, output parameter *piPhrase is set to the phrase number, *piCol
** to the column in which it occurs and *piOff the token offset of the
** first token of the phrase. The exception is if the table was created
** with the offsets=0 option specified. In this case *piOff is always
** set to -1.
**
** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM)
** if an error occurs.
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option.
**
** xRowid:
** Returns the rowid of the current row.
**
@@ -8367,7 +8118,7 @@ struct Fts5PhraseIter {
** Fts5PhraseIter iter;
** int iCol, iOff;
** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);
** iCol>=0;
** iOff>=0;
** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
** ){
** // An instance of phrase iPhrase at offset iOff of column iCol
@@ -8375,51 +8126,13 @@ struct Fts5PhraseIter {
**
** The Fts5PhraseIter structure is defined above. Applications should not
** modify this structure directly - it should only be used as shown above
** with the xPhraseFirst() and xPhraseNext() API methods (and by
** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" or "detail=column" option. If the FTS5 table is created
** with either "detail=none" or "detail=column" and "content=" option
** (i.e. if it is a contentless table), then this API always iterates
** through an empty set (all calls to xPhraseFirst() set iCol to -1).
** with the xPhraseFirst() and xPhraseNext() API methods.
**
** xPhraseNext()
** See xPhraseFirst above.
**
** xPhraseFirstColumn()
** This function and xPhraseNextColumn() are similar to the xPhraseFirst()
** and xPhraseNext() APIs described above. The difference is that instead
** of iterating through all instances of a phrase in the current row, these
** APIs are used to iterate through the set of columns in the current row
** that contain one or more instances of a specified phrase. For example:
**
** Fts5PhraseIter iter;
** int iCol;
** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);
** iCol>=0;
** pApi->xPhraseNextColumn(pFts, &iter, &iCol)
** ){
** // Column iCol contains at least one instance of phrase iPhrase
** }
**
** This API can be quite slow if used with an FTS5 table created with the
** "detail=none" option. If the FTS5 table is created with either
** "detail=none" "content=" option (i.e. if it is a contentless table),
** then this API always iterates through an empty set (all calls to
** xPhraseFirstColumn() set iCol to -1).
**
** The information accessed using this API and its companion
** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
** (or xInst/xInstCount). The chief advantage of this API is that it is
** significantly more efficient than those alternatives when used with
** "detail=column" tables.
**
** xPhraseNextColumn()
** See xPhraseFirstColumn above.
*/
struct Fts5ExtensionApi {
int iVersion; /* Currently always set to 3 */
int iVersion; /* Currently always set to 1 */
void *(*xUserData)(Fts5Context*);
@@ -8449,11 +8162,8 @@ struct Fts5ExtensionApi {
int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));
void *(*xGetAuxdata)(Fts5Context*, int bClear);
int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
void (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);
int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
};
/*
-22
Ver Arquivo
@@ -5,32 +5,10 @@ set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(synclib_NAME ${APPLICATION_EXECUTABLE}sync)
include(QtVersionAbstraction)
setup_qt()
if(HAVE_QT5 AND NOT BUILD_WITH_QT4)
if (${Qt5Core_VERSION_MAJOR} EQUAL "5")
if (${Qt5Core_VERSION_MINOR} EQUAL "4" OR ${Qt5Core_VERSION_MINOR} GREATER 4)
else()
message(STATUS "If possible compile me with Qt 5.4 or higher.")
endif()
endif()
else()
message(STATUS "If possible compile me with Qt 5.4 or higher.")
endif()
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
if(NOT TOKEN_AUTH_ONLY)
if (Qt5Core_DIR)
find_package(Qt5Keychain REQUIRED)
else()
find_package(QtKeychain REQUIRED)
endif()
endif()
add_subdirectory(libsync)
if (NOT BUILD_LIBRARIES_ONLY)
add_subdirectory(gui)
-3
Ver Arquivo
@@ -17,9 +17,6 @@ include_directories(${CMAKE_SOURCE_DIR}/csync/src
${CMAKE_BINARY_DIR}/csync/src
)
# Need tokenizer for netrc parser
include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer)
if(NOT BUILD_LIBRARIES_ONLY)
add_executable(${cmd_NAME} ${cmd_SRC})
qt5_use_modules(${cmd_NAME} Network Sql)
+50 -24
Ver Arquivo
@@ -153,7 +153,7 @@ void help()
std::cout << " Proxy is http://server:port" << std::endl;
std::cout << " --trust Trust the SSL certification." << std::endl;
std::cout << " --exclude [file] Exclude list file" << std::endl;
std::cout << " --unsyncedfolders [file] File containing the list of unsynced remote folders (selective sync)" << std::endl;
std::cout << " --unsyncedfolders [file] File containing the list of unsynced folders (selective sync)" << std::endl;
std::cout << " --user, -u [name] Use [name] as the login name" << std::endl;
std::cout << " --password, -p [pass] Use [pass] as password" << std::endl;
std::cout << " -n Use netrc (5) for login" << std::endl;
@@ -249,23 +249,23 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
*/
void selectiveSyncFixup(OCC::SyncJournalDb *journal, const QStringList &newList)
{
if (!journal->exists()) {
return;
}
SqlDatabase db;
if (!db.openOrCreateReadWrite(journal->databaseFilePath())) {
return;
}
bool ok;
auto oldBlackListSet = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok).toSet();
if( ok ) {
auto blackListSet = newList.toSet();
auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
foreach(const auto &it, changes) {
journal->avoidReadFromDbOnNextSync(it);
}
journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, newList);
auto oldBlackListSet = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList).toSet();
auto blackListSet = newList.toSet();
auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
foreach(const auto &it, changes) {
journal->avoidReadFromDbOnNextSync(it);
}
journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, newList);
}
@@ -385,10 +385,26 @@ int main(int argc, char **argv) {
int restartCount = 0;
restart_sync:
CSYNC *_csync_ctx;
if( csync_create( &_csync_ctx, options.source_dir.toUtf8(),
remUrl.constData()) < 0 ) {
qFatal("Unable to create csync-context!");
return EXIT_FAILURE;
}
csync_set_log_level(options.silent ? 1 : 11);
opts = &options;
if( csync_init( _csync_ctx ) < 0 ) {
qFatal("Could not initialize csync!");
return EXIT_FAILURE;
}
// ignore hidden files or not
_csync_ctx->ignore_hidden_files = options.ignoreHiddenFiles;
if( !options.proxy.isNull() ) {
QString host;
int port = 0;
@@ -415,6 +431,18 @@ restart_sync:
}
}
// Exclude lists
QString systemExcludeListFn = ConfigFile::excludeFileFromSystem();
int loadedSystemExcludeList = false;
if (!systemExcludeListFn.isEmpty()) {
loadedSystemExcludeList = csync_add_exclude_list(_csync_ctx, systemExcludeListFn.toLocal8Bit());
}
int loadedUserExcludeList = false;
if (!options.exclude.isEmpty()) {
loadedUserExcludeList = csync_add_exclude_list(_csync_ctx, options.exclude.toLocal8Bit());
}
QStringList selectiveSyncList;
if (!options.unsyncedfolders.isEmpty()) {
QFile f(options.unsyncedfolders);
@@ -432,32 +460,30 @@ restart_sync:
}
}
if (loadedSystemExcludeList != 0 && loadedUserExcludeList != 0) {
// Always make sure at least one list has been loaded
qFatal("Cannot load system exclude list or list supplied via --exclude");
return EXIT_FAILURE;
}
Cmd cmd;
SyncJournalDb db(options.source_dir);
if (!selectiveSyncList.empty()) {
selectiveSyncFixup(&db, selectiveSyncList);
}
SyncEngine engine(account, options.source_dir, QUrl(options.target_url), folder, &db);
engine.setIgnoreHiddenFiles(options.ignoreHiddenFiles);
SyncEngine engine(account, _csync_ctx, options.source_dir, QUrl(options.target_url).path(), folder, &db);
QObject::connect(&engine, SIGNAL(finished(bool)), &app, SLOT(quit()));
QObject::connect(&engine, SIGNAL(transmissionProgress(ProgressInfo)), &cmd, SLOT(transmissionProgressSlot()));
// Exclude lists
engine.excludedFiles().addExcludeFilePath(ConfigFile::excludeFileFromSystem());
if( QFile::exists(options.exclude) )
engine.excludedFiles().addExcludeFilePath(options.exclude);
if (!engine.excludedFiles().reloadExcludes()) {
// Always make sure at least one list has been loaded
qFatal("Cannot load system exclude list or list supplied via --exclude");
return EXIT_FAILURE;
}
// Have to be done async, else, an error before exec() does not terminate the event loop.
QMetaObject::invokeMethod(&engine, "startSync", Qt::QueuedConnection);
app.exec();
csync_destroy(_csync_ctx);
if (engine.isAnotherSyncNeeded()) {
if (restartCount < options.restartTimes) {
restartCount++;
+16 -30
Ver Arquivo
@@ -16,10 +16,6 @@
#include <QFile>
#include <QTextStream>
#include <qtokenizer.h>
#include <QDebug>
#include "netrcparser.h"
namespace OCC {
@@ -32,11 +28,11 @@ QString passwordKeyword = QLatin1String("password");
}
NetrcParser::NetrcParser(const QString &file)
NetrcParser::NetrcParser(const QString &fileName)
: _fileName(fileName)
{
_netrcLocation = file;
if (_netrcLocation.isEmpty()) {
_netrcLocation = QDir::homePath()+QLatin1String("/.netrc");
if (_fileName.isEmpty()) {
_fileName = QDir::homePath()+QLatin1String("/.netrc");
}
}
@@ -53,39 +49,29 @@ void NetrcParser::tryAddEntryAndClear(QString& machine, LoginPair& pair, bool& i
bool NetrcParser::parse()
{
QFile netrc(_netrcLocation);
QFile netrc(_fileName);
if (!netrc.open(QIODevice::ReadOnly)) {
return false;
}
QString content = netrc.readAll();
QStringTokenizer tokenizer(content, " \n\t");
tokenizer.setQuoteCharacters("\"'");
QTextStream ts(&netrc);
LoginPair pair;
QString machine;
bool isDefault = false;
while (tokenizer.hasNext()) {
QString key = tokenizer.next();
if (key == defaultKeyword) {
while (!ts.atEnd()) {
QString next;
ts >> next;
if (next == defaultKeyword) {
tryAddEntryAndClear(machine, pair, isDefault);
isDefault = true;
continue; // don't read a value
}
if (!tokenizer.hasNext()) {
qDebug() << "error fetching value for" << key;
return false;
}
QString value = tokenizer.next();
if (key == machineKeyword) {
if (next == machineKeyword) {
tryAddEntryAndClear(machine, pair, isDefault);
machine = value;
} else if (key == loginKeyword) {
pair.first = value;
} else if (key == passwordKeyword) {
pair.second = value;
ts >> machine;
} else if (next == loginKeyword) {
ts >> pair.first;
} else if (next == passwordKeyword) {
ts >> pair.second;
} // ignore unsupported tokens
}
+2 -2
Ver Arquivo
@@ -29,7 +29,7 @@ class NetrcParser
public:
typedef QPair<QString, QString> LoginPair;
NetrcParser(const QString &file = QString());
NetrcParser(const QString &fileName = QString::null);
bool parse();
LoginPair find(const QString &machine);
@@ -37,7 +37,7 @@ private:
void tryAddEntryAndClear(QString &machine, LoginPair &pair, bool &isDefault);
QHash<QString, LoginPair> _entries;
LoginPair _default;
QString _netrcLocation;
QString _fileName;
};
} // namespace OCC
+2 -9
Ver Arquivo
@@ -32,7 +32,6 @@ set(client_UI
owncloudsetuppage.ui
addcertificatedialog.ui
proxyauthdialog.ui
notificationwidget.ui
wizard/owncloudadvancedsetuppage.ui
wizard/owncloudconnectionmethoddialog.ui
wizard/owncloudhttpcredspage.ui
@@ -54,7 +53,6 @@ set(client_SRCS
folderwizard.cpp
generalsettings.cpp
ignorelisteditor.cpp
lockwatcher.cpp
logbrowser.cpp
networksettings.cpp
ocsjob.cpp
@@ -64,8 +62,6 @@ set(client_SRCS
owncloudgui.cpp
owncloudsetupwizard.cpp
protocolwidget.cpp
activitydata.cpp
activitylistmodel.cpp
activitywidget.cpp
activityitemdelegate.cpp
selectivesyncdialog.cpp
@@ -88,16 +84,11 @@ set(client_SRCS
proxyauthhandler.cpp
proxyauthdialog.cpp
synclogdialog.cpp
tooltipupdater.cpp
notificationwidget.cpp
notificationconfirmjob.cpp
servernotificationhandler.cpp
creds/credentialsfactory.cpp
creds/httpcredentialsgui.cpp
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethuserjob.cpp
wizard/postfixlineedit.cpp
wizard/abstractcredswizardpage.cpp
wizard/owncloudadvancedsetuppage.cpp
wizard/owncloudconnectionmethoddialog.cpp
@@ -142,6 +133,7 @@ list(APPEND client_SRCS folderwatcher_mac.cpp)
ENDIF()
set(3rdparty_SRC
../3rdparty/fancylineedit/fancylineedit.cpp
../3rdparty/QProgressIndicator/QProgressIndicator.cpp
../3rdparty/qtlockedfile/qtlockedfile.cpp
../3rdparty/qtsingleapplication/qtlocalpeer.cpp
@@ -165,6 +157,7 @@ else()
endif()
set(3rdparty_INC
${CMAKE_SOURCE_DIR}/src/3rdparty/fancylineedit
${CMAKE_SOURCE_DIR}/src/3rdparty/qjson
${CMAKE_SOURCE_DIR}/src/3rdparty/QProgressIndicator
${CMAKE_SOURCE_DIR}/src/3rdparty/qtlockedfile
+18 -55
Ver Arquivo
@@ -30,7 +30,6 @@ static const char httpUserC[] = "http_user";
static const char caCertsKeyC[] = "CaCertificates";
static const char accountsC[] = "Accounts";
static const char versionC[] = "version";
static const char serverVersionC[] = "serverVersion";
}
@@ -54,11 +53,9 @@ bool AccountManager::restore()
foreach (const auto& accountId, settings->childGroups()) {
settings->beginGroup(accountId);
if (auto acc = loadAccountHelper(*settings)) {
if (auto acc = load(*settings)) {
acc->_id = accountId;
if (auto accState = AccountState::loadFromSettings(acc, *settings)) {
addAccountState(accState);
}
addAccount(acc);
}
settings->endGroup();
}
@@ -113,7 +110,7 @@ bool AccountManager::restoreFromLegacySettings()
// Try to load the single account.
if (!settings->childKeys().isEmpty()) {
if (auto acc = loadAccountHelper(*settings)) {
if (auto acc = load(*settings)) {
if (migratedCreds) {
acc->setMigrated(true);
}
@@ -130,8 +127,7 @@ void AccountManager::save(bool saveCredentials)
settings->setValue(QLatin1String(versionC), 2);
foreach (const auto &acc, _accounts) {
settings->beginGroup(acc->account()->id());
saveAccountHelper(acc->account().data(), *settings, saveCredentials);
acc->writeToSettings(*settings);
save(acc->account(), *settings, saveCredentials);
settings->endGroup();
}
@@ -139,34 +135,21 @@ void AccountManager::save(bool saveCredentials)
qDebug() << "Saved all account settings, status:" << settings->status();
}
void AccountManager::saveAccount(Account* a)
void AccountManager::wantsAccountSavedSlot(AccountPtr a)
{
qDebug() << "Saving account" << a->url().toString();
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
settings->beginGroup(a->id());
saveAccountHelper(a, *settings, false); // don't save credentials they might not have been loaded yet
save(a, *settings, false); // don't save credentials they might not have been loaded yet
settings->endGroup();
settings->sync();
qDebug() << "Saved account settings, status:" << settings->status();
}
void AccountManager::saveAccountState(AccountState* a)
{
qDebug() << "Saving account state" << a->account()->url().toString();
auto settings = Account::settingsWithGroup(QLatin1String(accountsC));
settings->beginGroup(a->account()->id());
a->writeToSettings(*settings);
settings->endGroup();
settings->sync();
qDebug() << "Saved account state settings, status:" << settings->status();
}
void AccountManager::saveAccountHelper(Account* acc, QSettings& settings, bool saveCredentials)
void AccountManager::save(const AccountPtr& acc, QSettings& settings, bool saveCredentials)
{
settings.setValue(QLatin1String(urlC), acc->_url.toString());
settings.setValue(QLatin1String(serverVersionC), acc->_serverVersion);
if (acc->_credentials) {
if (saveCredentials) {
// Only persist the credentials if the parameter is set, on migration from 1.8.x
@@ -207,35 +190,22 @@ void AccountManager::saveAccountHelper(Account* acc, QSettings& settings, bool s
}
}
AccountPtr AccountManager::loadAccountHelper(QSettings& settings)
AccountPtr AccountManager::load(QSettings& settings)
{
auto acc = createAccount();
QString authType = settings.value(QLatin1String(authTypeC)).toString();
QString overrideUrl = Theme::instance()->overrideServerUrl();
if( !overrideUrl.isEmpty() ) {
// if there is a overrideUrl, don't even bother reading from the config as all the accounts
// must use the overrideUrl
acc->setUrl(overrideUrl);
auto forceAuth = Theme::instance()->forceConfigAuthType();
if (!forceAuth.isEmpty()) {
authType = forceAuth;
}
} else {
acc->setUrl(settings.value(QLatin1String(urlC)).toUrl());
}
acc->_serverVersion = settings.value(QLatin1String(serverVersionC)).toString();
acc->setUrl(settings.value(QLatin1String(urlC)).toUrl());
// We want to only restore settings for that auth type and the user value
acc->_settingsMap.insert(QLatin1String(userC), settings.value(userC));
QString authTypePrefix = authType + "_";
QString authTypePrefix = settings.value(authTypeC).toString() + "_";
Q_FOREACH(QString key, settings.childKeys()) {
if (!key.startsWith(authTypePrefix))
continue;
acc->_settingsMap.insert(key, settings.value(key));
}
acc->setCredentials(CredentialsFactory::create(authType));
acc->setCredentials(CredentialsFactory::create(settings.value(QLatin1String(authTypeC)).toString()));
// now the cert, it is in the general group
settings.beginGroup(QLatin1String("General"));
@@ -263,9 +233,13 @@ AccountState *AccountManager::addAccount(const AccountPtr& newAccount)
}
newAccount->_id = id;
auto newAccountState = new AccountState(newAccount);
addAccountState(newAccountState);
return newAccountState;
QObject::connect(newAccount.data(), SIGNAL(wantsAccountSaved(AccountPtr)),
this, SLOT(wantsAccountSavedSlot(AccountPtr)));
AccountStatePtr newAccountState(new AccountState(newAccount));
_accounts << newAccountState;
emit accountAdded(newAccountState.data());
return newAccountState.data();
}
void AccountManager::deleteAccount(AccountState* account)
@@ -322,15 +296,4 @@ QString AccountManager::generateFreeAccountId() const
}
}
void AccountManager::addAccountState(AccountState* accountState)
{
QObject::connect(accountState->account().data(),
SIGNAL(wantsAccountSaved(Account*)),
SLOT(saveAccount(Account*)));
AccountStatePtr ptr(accountState);
_accounts << ptr;
emit accountAdded(accountState);
}
}
+5 -12
Ver Arquivo
@@ -18,6 +18,8 @@
namespace OCC {
typedef QSharedPointer<AccountState> AccountStatePtr;
/**
@brief The AccountManager class
@ingroup gui
@@ -74,24 +76,15 @@ public:
static AccountPtr createAccount();
private:
// saving and loading Account to settings
void saveAccountHelper(Account* account, QSettings& settings, bool saveCredentials = true);
AccountPtr loadAccountHelper(QSettings& settings);
void save(const AccountPtr& account, QSettings& settings, bool saveCredentials = true);
AccountPtr load(QSettings& settings);
bool restoreFromLegacySettings();
bool isAccountIdAvailable(const QString& id) const;
QString generateFreeAccountId() const;
// Adds an account to the tracked list, emitting accountAdded()
void addAccountState(AccountState* accountState);
public slots:
/// Saves account data, not including the credentials
void saveAccount(Account* a);
/// Saves account state data, not including the account
void saveAccountState(AccountState* a);
void wantsAccountSavedSlot(AccountPtr a);
Q_SIGNALS:
+16 -25
Ver Arquivo
@@ -29,13 +29,11 @@
#include "accountmanager.h"
#include "owncloudsetupwizard.h"
#include "creds/abstractcredentials.h"
#include "tooltipupdater.h"
#include <math.h>
#include <QDebug>
#include <QDesktopServices>
#include <QDir>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QAction>
@@ -89,8 +87,6 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
#else
ui->_folderList->setMinimumWidth( 300 );
#endif
new ToolTipUpdater(ui->_folderList);
createAccountToolbox();
connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)),
SLOT(slotAccountAdded(AccountState*)));
@@ -197,7 +193,8 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
return;
}
if (_model->classify(index) != FolderStatusModel::RootFolder) {
QString alias = _model->data( index, FolderStatusDelegate::FolderAliasRole ).toString();
if (alias.isEmpty()) {
return;
}
@@ -211,11 +208,9 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
QAction *ac = menu->addAction(tr("Open folder"));
connect(ac, SIGNAL(triggered(bool)), this, SLOT(slotOpenCurrentFolder()));
if (!ui->_folderList->isExpanded(index)) {
ac = menu->addAction(tr("Choose what to sync"));
ac->setEnabled(folderConnected);
connect(ac, SIGNAL(triggered(bool)), this, SLOT(doExpand()));
}
ac = menu->addAction(tr("Choose what to sync"));
ac->setEnabled(folderConnected);
connect(ac, SIGNAL(triggered(bool)), this, SLOT(doExpand()));
ac = menu->addAction(folderPaused ? tr("Resume sync") : tr("Pause sync"));
connect(ac, SIGNAL(triggered(bool)), this, SLOT(slotEnableCurrentFolder()));
@@ -276,6 +271,7 @@ void AccountSettings::slotFolderWizardAccepted()
qDebug() << "* Folder wizard completed";
FolderDefinition definition;
definition.alias = folderWizard->field(QLatin1String("alias")).toString();
definition.localPath = FolderDefinition::prepareLocalPath(
folderWizard->field(QLatin1String("sourceFolder")).toString());
definition.targetPath = folderWizard->property("targetPath").toString();
@@ -332,13 +328,10 @@ void AccountSettings::slotRemoveCurrentFolder()
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
qDebug() << "Remove Folder alias " << alias;
if( !alias.isEmpty() ) {
FolderMan *folderMan = FolderMan::instance();
QString shortGuiLocalPath = folderMan->folder(alias)->shortGuiLocalPath();
QMessageBox messageBox(QMessageBox::Question,
tr("Confirm Folder Sync Connection Removal"),
tr("<p>Do you really want to stop syncing the folder <i>%1</i>?</p>"
"<p><b>Note:</b> This will <b>not</b> delete any files.</p>").arg(shortGuiLocalPath),
"<p><b>Note:</b> This will <b>not</b> delete any files.</p>").arg(alias),
QMessageBox::NoButton,
this);
QPushButton* yesButton =
@@ -350,6 +343,7 @@ void AccountSettings::slotRemoveCurrentFolder()
return;
}
FolderMan *folderMan = FolderMan::instance();
folderMan->slotRemoveFolder( folderMan->folder(alias) );
_model->removeRow(row);
@@ -441,7 +435,8 @@ void AccountSettings::slotEnableCurrentFolder()
if ( f->isBusy() && terminate ) {
f->slotTerminateSync();
}
f->setSyncPaused(!currentlyPaused);
f->setSyncPaused(!currentlyPaused); // toggle the pause setting
folderMan->slotSetFolderPaused( f, !currentlyPaused );
// keep state for the icon setting.
if( currentlyPaused ) _wasDisabledBefore = true;
@@ -516,11 +511,7 @@ void AccountSettings::slotAccountStateChanged(int state)
}
if (state == AccountState::Connected) {
QStringList errors;
if (account->serverVersionUnsupported()) {
errors << tr("The server version %1 is old and unsupported! Proceed at your own risk.").arg(account->serverVersion());
}
showConnectionLabel( tr("Connected to %1.").arg(serverWithUser), errors );
showConnectionLabel( tr("Connected to %1.").arg(serverWithUser) );
} else if (state == AccountState::ServiceUnavailable) {
showConnectionLabel( tr("Server %1 is temporarily unavailable.").arg(server) );
} else if (state == AccountState::SignedOut) {
@@ -548,10 +539,11 @@ void AccountSettings::slotAccountStateChanged(int state)
}
/* set the correct label for the Account toolbox button */
if( _accountState ) {
if( _accountState->isSignedOut() ) {
_toggleSignInOutAction->setText(tr("Log in"));
} else {
bool isConnected = _accountState->isConnected();
if( isConnected ) {
_toggleSignInOutAction->setText(tr("Log out"));
} else {
_toggleSignInOutAction->setText(tr("Log in"));
}
}
}
@@ -606,8 +598,7 @@ void AccountSettings::refreshSelectiveSyncStatus()
continue;
}
bool ok;
auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok);
auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList);
QString p;
foreach(const auto &it, undecidedList) {
// FIXME: add the folder alias in a hoover hint.
-13
Ver Arquivo
@@ -46,16 +46,6 @@ AccountState::~AccountState()
{
}
AccountState *AccountState::loadFromSettings(AccountPtr account, QSettings& /*settings*/)
{
auto accountState = new AccountState(account);
return accountState;
}
void AccountState::writeToSettings(QSettings& /*settings*/)
{
}
AccountPtr AccountState::account() const
{
return _account;
@@ -95,9 +85,6 @@ void AccountState::setState(State state)
} else if (oldState == SignedOut && _state == Disconnected) {
checkConnectivity();
}
if (oldState == Connected || _state == Connected) {
emit isConnectedChanged();
}
}
// might not have changed but the underlying _connectionErrors might have
+3 -18
Ver Arquivo
@@ -29,13 +29,11 @@ namespace OCC {
class AccountState;
class Account;
typedef QExplicitlySharedDataPointer<AccountState> AccountStatePtr;
/**
* @brief Extra info about an ownCloud server account.
* @ingroup gui
*/
class AccountState : public QObject, public QSharedData {
class AccountState : public QObject {
Q_OBJECT
public:
enum State {
@@ -66,21 +64,9 @@ public:
typedef ConnectionValidator::Status ConnectionStatus;
/// Use the account as parent
explicit AccountState(AccountPtr account);
AccountState(AccountPtr account);
~AccountState();
/** Creates an account state from settings and an Account object.
*
* Use from AccountManager with a prepared QSettings object only.
*/
static AccountState* loadFromSettings(AccountPtr account, QSettings& settings);
/** Writes account state information to settings.
*
* It does not write the Account data.
*/
void writeToSettings(QSettings& settings);
AccountPtr account() const;
ConnectionStatus connectionStatus() const;
@@ -127,7 +113,6 @@ private:
signals:
void stateChanged(int state);
void isConnectedChanged();
protected Q_SLOTS:
void slotConnectionValidatorResult(ConnectionValidator::Status status, const QStringList& errors);
@@ -148,6 +133,6 @@ private:
}
Q_DECLARE_METATYPE(OCC::AccountState*)
Q_DECLARE_METATYPE(OCC::AccountStatePtr)
Q_DECLARE_METATYPE(QSharedPointer<OCC::AccountState>)
#endif //ACCOUNTINFO_H
-35
Ver Arquivo
@@ -1,35 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <QtCore>
#include "activitydata.h"
namespace OCC
{
bool operator<( const Activity& rhs, const Activity& lhs ) {
return rhs._dateTime.toMSecsSinceEpoch() > lhs._dateTime.toMSecsSinceEpoch();
}
bool operator==( const Activity& rhs, const Activity& lhs ) {
return (rhs._type == lhs._type && rhs._id== lhs._id && rhs._accName == lhs._accName);
}
Activity::Identifier Activity::ident() const {
return Identifier( _id, _accName );
}
}
-89
Ver Arquivo
@@ -1,89 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef ACTIVITYDATA_H
#define ACTIVITYDATA_H
#include <QtCore>
namespace OCC {
/**
* @brief The ActivityLink class describes actions of an activity
*
* These are part of notifications which are mapped into activities.
*/
class ActivityLink
{
public:
QString _label;
QString _link;
QByteArray _verb;
bool _isPrimary;
};
/* ==================================================================== */
/**
* @brief Activity Structure
* @ingroup gui
*
* contains all the information describing a single activity.
*/
class Activity
{
public:
typedef QPair<qlonglong, QString> Identifier;
enum Type {
ActivityType,
NotificationType
};
Type _type;
qlonglong _id;
QString _subject;
QString _message;
QString _file;
QUrl _link;
QDateTime _dateTime;
QString _accName;
QVector <ActivityLink> _links;
/**
* @brief Sort operator to sort the list youngest first.
* @param val
* @return
*/
Identifier ident() const;
};
bool operator==( const Activity& rhs, const Activity& lhs );
bool operator<( const Activity& rhs, const Activity& lhs );
/* ==================================================================== */
/**
* @brief The ActivityList
* @ingroup gui
*
* A QList based list of Activities
*/
typedef QList<Activity> ActivityList;
}
#endif // ACTIVITYDATA_H
-228
Ver Arquivo
@@ -1,228 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <QtCore>
#include <QAbstractListModel>
#include <QWidget>
#include <QIcon>
#include "account.h"
#include "accountstate.h"
#include "accountmanager.h"
#include "folderman.h"
#include "accessmanager.h"
#include "activityitemdelegate.h"
#include "activitydata.h"
#include "activitylistmodel.h"
namespace OCC {
ActivityListModel::ActivityListModel(QWidget *parent)
:QAbstractListModel(parent)
{
}
QVariant ActivityListModel::data(const QModelIndex &index, int role) const
{
Activity a;
if (!index.isValid())
return QVariant();
a = _finalList.at(index.row());
AccountStatePtr ast = AccountManager::instance()->account(a._accName);
QStringList list;
switch (role) {
case ActivityItemDelegate::PathRole:
list = FolderMan::instance()->findFileInLocalFolders(a._file, ast->account());
if( list.count() > 0 ) {
return QVariant(list.at(0));
}
// File does not exist anymore? Let's try to open its path
list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(a._file).path(), ast->account());
if( list.count() > 0 ) {
return QVariant(list.at(0));
}
return QVariant();
break;
case ActivityItemDelegate::ActionIconRole:
return QVariant(); // FIXME once the action can be quantified, display on Icon
break;
case ActivityItemDelegate::UserIconRole:
return QIcon(QLatin1String(":/client/resources/account.png"));
break;
case Qt::ToolTipRole:
case ActivityItemDelegate::ActionTextRole:
return a._subject;
break;
case ActivityItemDelegate::LinkRole:
return a._link;
break;
case ActivityItemDelegate::AccountRole:
return a._accName;
break;
case ActivityItemDelegate::PointInTimeRole:
return Utility::timeAgoInWords(a._dateTime);
break;
case ActivityItemDelegate::AccountConnectedRole:
return (ast && ast->isConnected());
break;
default:
return QVariant();
}
return QVariant();
}
int ActivityListModel::rowCount(const QModelIndex&) const
{
return _finalList.count();
}
// current strategy: Fetch 100 items per Account
// ATTENTION: This method is const and thus it is not possible to modify
// the _activityLists hash or so. Doesn't make it easier...
bool ActivityListModel::canFetchMore(const QModelIndex& ) const
{
if( _activityLists.count() == 0 ) return true;
for(auto i = _activityLists.begin() ; i != _activityLists.end(); ++i) {
AccountState *ast = i.key();
if( ast && ast->isConnected() ) {
ActivityList activities = i.value();
if( activities.count() == 0 &&
! _currentlyFetching.contains(ast) ) {
return true;
}
}
}
return false;
}
void ActivityListModel::startFetchJob(AccountState* s)
{
if( !s->isConnected() ) {
return;
}
JsonApiJob *job = new JsonApiJob(s->account(), QLatin1String("ocs/v1.php/cloud/activity"), this);
QObject::connect(job, SIGNAL(jsonReceived(QVariantMap, int)),
this, SLOT(slotActivitiesReceived(QVariantMap, int)));
job->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(s));
QList< QPair<QString,QString> > params;
params.append(qMakePair(QString::fromLatin1("page"), QString::fromLatin1("0")));
params.append(qMakePair(QString::fromLatin1("pagesize"), QString::fromLatin1("100")));
job->addQueryParams(params);
_currentlyFetching.insert(s);
qDebug() << Q_FUNC_INFO << "Start fetching activities for " << s->account()->displayName();
job->start();
}
void ActivityListModel::slotActivitiesReceived(const QVariantMap& json, int statusCode)
{
auto activities = json.value("ocs").toMap().value("data").toList();
ActivityList list;
AccountState* ast = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr"));
_currentlyFetching.remove(ast);
foreach( auto activ, activities ) {
auto json = activ.toMap();
Activity a;
a._type = Activity::ActivityType;
a._accName = ast->account()->displayName();
a._id = json.value("id").toLongLong();
a._subject = json.value("subject").toString();
a._message = json.value("message").toString();
a._file = json.value("file").toString();
a._link = json.value("link").toUrl();
a._dateTime = json.value("date").toDateTime();
list.append(a);
}
_activityLists[ast] = list;
emit activityJobStatusCode(ast, statusCode);
combineActivityLists();
}
void ActivityListModel::combineActivityLists()
{
ActivityList resultList;
foreach( ActivityList list, _activityLists.values() ) {
resultList.append(list);
}
std::sort( resultList.begin(), resultList.end() );
beginResetModel();
_finalList.clear();
endResetModel();
beginInsertRows(QModelIndex(), 0, resultList.count());
_finalList = resultList;
endInsertRows();
}
void ActivityListModel::fetchMore(const QModelIndex &)
{
QList<AccountStatePtr> accounts = AccountManager::instance()->accounts();
foreach (const AccountStatePtr& asp, accounts) {
if( !_activityLists.contains(asp.data()) && asp->isConnected() ) {
_activityLists[asp.data()] = ActivityList();
startFetchJob(asp.data());
}
}
}
void ActivityListModel::slotRefreshActivity(AccountState *ast)
{
if(ast && _activityLists.contains(ast)) {
_activityLists.remove(ast);
}
startFetchJob(ast);
}
void ActivityListModel::slotRemoveAccount(AccountState *ast )
{
if( _activityLists.contains(ast) ) {
int i = 0;
const QString accountToRemove = ast->account()->displayName();
QMutableListIterator<Activity> it(_finalList);
while (it.hasNext()) {
Activity activity = it.next();
if( activity._accName == accountToRemove ) {
beginRemoveRows(QModelIndex(), i, i+1);
it.remove();
endRemoveRows();
}
}
_activityLists.remove(ast);
_currentlyFetching.remove(ast);
}
}
}
-67
Ver Arquivo
@@ -1,67 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef ACTIVITYLISTMODEL_H
#define ACTIVITYLISTMODEL_H
#include <QtCore>
#include "activitydata.h"
namespace OCC {
class AccountState;
/**
* @brief The ActivityListModel
* @ingroup gui
*
* Simple list model to provide the list view with data.
*/
class ActivityListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit ActivityListModel(QWidget *parent=0);
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
bool canFetchMore(const QModelIndex& ) const Q_DECL_OVERRIDE;
void fetchMore(const QModelIndex&) Q_DECL_OVERRIDE;
ActivityList activityList() { return _finalList; }
public slots:
void slotRefreshActivity(AccountState* ast);
void slotRemoveAccount( AccountState *ast );
private slots:
void slotActivitiesReceived(const QVariantMap& json, int statusCode);
signals:
void activityJobStatusCode(AccountState* ast, int statusCode);
private:
void startFetchJob(AccountState* s);
void combineActivityLists();
QMap<AccountState*, ActivityList> _activityLists;
ActivityList _finalList;
QSet<AccountState*> _currentlyFetching;
};
}
#endif // ACTIVITYLISTMODEL_H
+234 -402
Ver Arquivo
@@ -16,8 +16,8 @@
#include <QtWidgets>
#endif
#include "activitylistmodel.h"
#include "activitywidget.h"
#include "configfile.h"
#include "syncresult.h"
#include "logger.h"
#include "utility.h"
@@ -33,28 +33,236 @@
#include "activityitemdelegate.h"
#include "protocolwidget.h"
#include "QProgressIndicator.h"
#include "notificationwidget.h"
#include "notificationconfirmjob.h"
#include "servernotificationhandler.h"
#include "theme.h"
#include "ocsjob.h"
#include "ui_activitywidget.h"
#include <climits>
// time span in milliseconds which has to be between two
// refreshes of the notifications
#define NOTIFICATION_REQUEST_FREE_PERIOD 15000
namespace OCC {
void ActivityList::setAccountName( const QString& name )
{
_accountName = name;
}
QString ActivityList::accountName() const
{
return _accountName;
}
/* ==================================================================== */
ActivityListModel::ActivityListModel(QWidget *parent)
:QAbstractListModel(parent)
{
}
QVariant ActivityListModel::data(const QModelIndex &index, int role) const
{
Activity a;
if (!index.isValid())
return QVariant();
a = _finalList.at(index.row());
AccountStatePtr ast = AccountManager::instance()->account(a._accName);
QStringList list;
if (role == Qt::EditRole)
return QVariant();
switch (role) {
case ActivityItemDelegate::PathRole:
list = FolderMan::instance()->findFileInLocalFolders(a._file, ast->account());
if( list.count() > 0 ) {
return QVariant(list.at(0));
}
// File does not exist anymore? Let's try to open its path
list = FolderMan::instance()->findFileInLocalFolders(QFileInfo(a._file).path(), ast->account());
if( list.count() > 0 ) {
return QVariant(list.at(0));
}
return QVariant();
break;
case ActivityItemDelegate::ActionIconRole:
return QVariant(); // FIXME once the action can be quantified, display on Icon
break;
case ActivityItemDelegate::UserIconRole:
return QIcon(QLatin1String(":/client/resources/account.png"));
break;
case Qt::ToolTipRole:
case ActivityItemDelegate::ActionTextRole:
return a._subject;
break;
case ActivityItemDelegate::LinkRole:
return a._link;
break;
case ActivityItemDelegate::AccountRole:
return a._accName;
break;
case ActivityItemDelegate::PointInTimeRole:
return Utility::timeAgoInWords(a._dateTime);
break;
case ActivityItemDelegate::AccountConnectedRole:
return (ast && ast->isConnected());
break;
default:
return QVariant();
}
return QVariant();
}
int ActivityListModel::rowCount(const QModelIndex&) const
{
return _finalList.count();
}
// current strategy: Fetch 100 items per Account
bool ActivityListModel::canFetchMore(const QModelIndex& ) const
{
if( _activityLists.count() == 0 ) return true;
QMap<AccountState*, ActivityList>::const_iterator i = _activityLists.begin();
while (i != _activityLists.end()) {
AccountState *ast = i.key();
if( !ast->isConnected() ) {
return false;
}
ActivityList activities = i.value();
if( activities.count() == 0 &&
! _currentlyFetching.contains(ast) ) {
return true;
}
++i;
}
return false;
}
void ActivityListModel::startFetchJob(AccountState* s)
{
if( !s->isConnected() ) {
return;
}
JsonApiJob *job = new JsonApiJob(s->account(), QLatin1String("ocs/v1.php/cloud/activity"), this);
QObject::connect(job, SIGNAL(jsonReceived(QVariantMap, int)),
this, SLOT(slotActivitiesReceived(QVariantMap, int)));
job->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(s));
QList< QPair<QString,QString> > params;
params.append(qMakePair(QString::fromLatin1("page"), QString::fromLatin1("0")));
params.append(qMakePair(QString::fromLatin1("pagesize"), QString::fromLatin1("100")));
job->addQueryParams(params);
_currentlyFetching.insert(s);
qDebug() << "Start fetching activities for " << s->account()->displayName();
job->start();
}
void ActivityListModel::slotActivitiesReceived(const QVariantMap& json, int statusCode)
{
auto activities = json.value("ocs").toMap().value("data").toList();
qDebug() << "*** activities" << activities;
ActivityList list;
AccountState* ai = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr"));
_currentlyFetching.remove(ai);
list.setAccountName( ai->account()->displayName());
foreach( auto activ, activities ) {
auto json = activ.toMap();
Activity a;
a._accName = ai->account()->displayName();
a._id = json.value("id").toLongLong();
a._subject = json.value("subject").toString();
a._message = json.value("message").toString();
a._file = json.value("file").toString();
a._link = json.value("link").toUrl();
a._dateTime = json.value("date").toDateTime();
list.append(a);
}
_activityLists[ai] = list;
if( statusCode == 999 ) {
emit accountWithoutActivityApp(ai);
}
combineActivityLists();
}
void ActivityListModel::combineActivityLists()
{
ActivityList resultList;
foreach( ActivityList list, _activityLists.values() ) {
resultList.append(list);
}
std::sort( resultList.begin(), resultList.end() );
beginInsertRows(QModelIndex(), 0, resultList.count()-1);
_finalList = resultList;
endInsertRows();
}
void ActivityListModel::fetchMore(const QModelIndex &)
{
QList<AccountStatePtr> accounts = AccountManager::instance()->accounts();
foreach (AccountStatePtr asp, accounts) {
bool newItem = false;
// if the account is not yet managed, add an empty list.
if( !_activityLists.contains(asp.data()) ) {
_activityLists[asp.data()] = ActivityList();
newItem = true;
}
ActivityList activities = _activityLists[asp.data()];
if( newItem ) {
startFetchJob(asp.data());
}
}
}
void ActivityListModel::slotRefreshActivity(AccountState *ast)
{
if(ast && _activityLists.contains(ast)) {
qDebug() << "**** Refreshing Activity list for" << ast->account()->displayName();
_activityLists.remove(ast);
}
startFetchJob(ast);
}
void ActivityListModel::slotRemoveAccount(AccountState *ast )
{
if( _activityLists.contains(ast) ) {
int i = 0;
const QString accountToRemove = ast->account()->displayName();
QMutableListIterator<Activity> it(_finalList);
while (it.hasNext()) {
Activity activity = it.next();
if( activity._accName == accountToRemove ) {
beginRemoveRows(QModelIndex(), i, i+1);
it.remove();
endRemoveRows();
}
}
_activityLists.remove(ast);
_currentlyFetching.remove(ast);
}
}
/* ==================================================================== */
ActivityWidget::ActivityWidget(QWidget *parent) :
QWidget(parent),
_ui(new Ui::ActivityWidget),
_notificationRequestsRunning(0)
_ui(new Ui::ActivityWidget)
{
_ui->setupUi(this);
@@ -70,22 +278,10 @@ ActivityWidget::ActivityWidget(QWidget *parent) :
_ui->_activityList->setAlternatingRowColors(true);
_ui->_activityList->setModel(_model);
_ui->_notifyLabel->hide();
_ui->_notifyScroll->hide();
// Create a widget container for the notifications. The ui file defines
// a scroll area that get a widget with a layout as children
QWidget *w = new QWidget;
_notificationsLayout = new QVBoxLayout;
w->setLayout(_notificationsLayout);
_notificationsLayout->setAlignment(Qt::AlignTop);
_ui->_notifyScroll->setAlignment(Qt::AlignTop);
_ui->_notifyScroll->setWidget(w);
showLabels();
connect(_model, SIGNAL(activityJobStatusCode(AccountState*,int)),
this, SLOT(slotAccountActivityStatus(AccountState*,int)));
connect(_model, SIGNAL(accountWithoutActivityApp(AccountState*)),
this, SLOT(slotAccountWithoutActivityApp(AccountState*)));
_copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
_copyBtn->setToolTip( tr("Copy the activity list to the clipboard."));
@@ -95,9 +291,6 @@ ActivityWidget::ActivityWidget(QWidget *parent) :
connect( _ui->_activityList, SIGNAL(activated(QModelIndex)), this,
SLOT(slotOpenFile(QModelIndex)));
connect( &_removeTimer, SIGNAL(timeout()), this, SLOT(slotCheckToCleanWidgets()) );
_removeTimer.setInterval(1000);
}
ActivityWidget::~ActivityWidget()
@@ -105,26 +298,11 @@ ActivityWidget::~ActivityWidget()
delete _ui;
}
void ActivityWidget::slotRefreshActivities(AccountState *ptr)
void ActivityWidget::slotRefresh(AccountState *ptr)
{
_model->slotRefreshActivity(ptr);
}
void ActivityWidget::slotRefreshNotifications(AccountState *ptr)
{
// start a server notification handler if no notification requests
// are running
if( _notificationRequestsRunning == 0 ) {
ServerNotificationHandler *snh = new ServerNotificationHandler;
connect(snh, SIGNAL(newNotificationList(ActivityList)), this,
SLOT(slotBuildNotificationDisplay(ActivityList)));
snh->slotFetchNotifications(ptr);
} else {
qDebug() << Q_FUNC_INFO << "========> notification request counter not zero.";
}
}
void ActivityWidget::slotRemoveAccount( AccountState *ptr )
{
_model->slotRemoveAccount(ptr);
@@ -136,8 +314,6 @@ void ActivityWidget::showLabels()
_ui->_headerLabel->setTextFormat(Qt::RichText);
_ui->_headerLabel->setText(t);
_ui->_notifyLabel->setText(tr("Action Required: Notifications"));
t.clear();
QSetIterator<QString> i(_accountsWithoutActivities);
while (i.hasNext() ) {
@@ -147,18 +323,12 @@ void ActivityWidget::showLabels()
_ui->_bottomLabel->setText(t);
}
void ActivityWidget::slotAccountActivityStatus(AccountState *ast, int statusCode)
void ActivityWidget::slotAccountWithoutActivityApp(AccountState *ast)
{
if( !(ast && ast->account()) ) {
return;
}
if( statusCode == 999 ) {
if( ast && ast->account() ) {
_accountsWithoutActivities.insert(ast->account()->displayName());
} else {
_accountsWithoutActivities.remove(ast->account()->displayName());
}
checkActivityTabVisibility();
showLabels();
}
@@ -211,25 +381,9 @@ void ActivityWidget::storeActivityList( QTextStream& ts )
}
}
void ActivityWidget::checkActivityTabVisibility()
{
int accountCount = AccountManager::instance()->accounts().count();
bool hasAccountsWithActivity =
_accountsWithoutActivities.count() != accountCount;
bool hasNotifications = !_widgetForNotifId.isEmpty();
_ui->_headerLabel->setVisible( hasAccountsWithActivity );
_ui->_activityList->setVisible( hasAccountsWithActivity );
_ui->_notifyLabel->setVisible( hasNotifications );
_ui->_notifyScroll->setVisible( hasNotifications );
emit hideActivityTab(!hasAccountsWithActivity && !hasNotifications);
}
void ActivityWidget::slotOpenFile(QModelIndex indx)
{
qDebug() << Q_FUNC_INFO << indx.isValid() << indx.data(ActivityItemDelegate::PathRole).toString() << QFile::exists(indx.data(ActivityItemDelegate::PathRole).toString());
qDebug() << indx.isValid() << indx.data(ActivityItemDelegate::PathRole).toString() << QFile::exists(indx.data(ActivityItemDelegate::PathRole).toString());
if( indx.isValid() ) {
QString fullPath = indx.data(ActivityItemDelegate::PathRole).toString();
@@ -239,268 +393,6 @@ void ActivityWidget::slotOpenFile(QModelIndex indx)
}
}
// GUI: Display the notifications.
// All notifications in list are coming from the same account
// but in the _widgetForNotifId hash widgets for all accounts are
// collected.
void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
{
QHash<QString, int> accNotified;
QString listAccountName;
foreach( auto activity, list ) {
if( _blacklistedNotifications.contains(activity)) {
qDebug() << Q_FUNC_INFO << "Activity in blacklist, skip";
continue;
}
NotificationWidget *widget = 0;
if( _widgetForNotifId.contains( activity.ident()) ) {
widget = _widgetForNotifId[activity.ident()];
} else {
widget = new NotificationWidget(this);
connect(widget, SIGNAL(sendNotificationRequest(QString, QString, QByteArray)),
this, SLOT(slotSendNotificationRequest(QString, QString, QByteArray)));
connect(widget, SIGNAL(requestCleanupAndBlacklist(Activity)),
this, SLOT(slotRequestCleanupAndBlacklist(Activity)));
_notificationsLayout->addWidget(widget);
// _ui->_notifyScroll->setMinimumHeight( widget->height());
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
_ui->_notifyScroll->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow);
#endif
_widgetForNotifId[activity.ident()] = widget;
}
widget->setActivity( activity );
// remember the list account name for the strayCat handling below.
listAccountName = activity._accName;
// handle gui logs. In order to NOT annoy the user with every fetching of the
// notifications the notification id is stored in a Set. Only if an id
// is not in the set, it qualifies for guiLog.
// Important: The _guiLoggedNotifications set must be wiped regularly which
// will repeat the gui log.
// after one hour, clear the gui log notification store
if( _guiLogTimer.elapsed() > 60*60*1000 ) {
_guiLoggedNotifications.clear();
}
if( !_guiLoggedNotifications.contains(activity._id)) {
QString host = activity._accName;
// store the name of the account that sends the notification to be
// able to add it to the tray notification
// remove the user name from the account as that is not accurate here.
int indx = host.indexOf(QChar('@'));
if( indx>-1 ) {
host.remove(0, 1+indx);
}
if( !host.isEmpty() ) {
if( accNotified.contains(host)) {
accNotified[host] = accNotified[host]+1;
} else {
accNotified[host] = 1;
}
}
_guiLoggedNotifications.insert(activity._id);
}
}
// check if there are widgets that have no corresponding activity from
// the server any more. Collect them in a list
QList< Activity::Identifier > strayCats;
foreach( auto id, _widgetForNotifId.keys() ) {
NotificationWidget *widget = _widgetForNotifId[id];
bool found = false;
// do not mark widgets of other accounts to delete.
if( widget->activity()._accName != listAccountName ) {
continue;
}
foreach( auto activity, list ) {
if( activity.ident() == id ) {
// found an activity
found = true;
break;
}
}
if( ! found ) {
// the activity does not exist any more.
strayCats.append(id);
}
}
// .. and now delete all these stray cat widgets.
foreach( auto strayCatId, strayCats ) {
NotificationWidget *widgetToGo = _widgetForNotifId[strayCatId];
scheduleWidgetToRemove(widgetToGo, 0);
}
checkActivityTabVisibility();
int newGuiLogCount = accNotified.count();
if( newGuiLogCount > 0 ) {
// restart the gui log timer now that we show a notification
_guiLogTimer.restart();
// Assemble a tray notification
QString msg = tr("You received %n new notification(s) from %2.", "", accNotified[accNotified.keys().at(0)]).
arg(accNotified.keys().at(0));
if( newGuiLogCount >= 2 ) {
QString acc1 = accNotified.keys().at(0);
QString acc2 = accNotified.keys().at(1);
if( newGuiLogCount == 2 ) {
int notiCount = accNotified[ acc1 ] + accNotified[ acc2 ];
msg = tr("You received %n new notification(s) from %1 and %2.", "", notiCount).arg(acc1, acc2);
} else {
msg = tr("You received new notifications from %1, %2 and other accounts.").arg(acc1, acc2);
}
}
const QString log = tr("%1 Notifications - Action Required").arg(Theme::instance()->appNameGUI());
emit guiLog( log, msg);
}
}
void ActivityWidget::slotSendNotificationRequest(const QString& accountName, const QString& link, const QByteArray& verb)
{
qDebug() << Q_FUNC_INFO << "Server Notification Request " << verb << link << "on account" << accountName;
NotificationWidget *theSender = qobject_cast<NotificationWidget*>(sender());
const QStringList validVerbs = QStringList() << "GET" << "PUT" << "POST" << "DELETE";
if( validVerbs.contains(verb)) {
AccountStatePtr acc = AccountManager::instance()->account(accountName);
if( acc ) {
NotificationConfirmJob *job = new NotificationConfirmJob(acc->account());
QUrl l(link);
job->setLinkAndVerb(l, verb);
job->setWidget(theSender);
connect( job, SIGNAL( networkError(QNetworkReply*)),
this, SLOT(slotNotifyNetworkError(QNetworkReply*)));
connect( job, SIGNAL( jobFinished(QString, int)),
this, SLOT(slotNotifyServerFinished(QString, int)) );
job->start();
// count the number of running notification requests. If this member var
// is larger than zero, no new fetching of notifications is started
_notificationRequestsRunning++;
}
} else {
qDebug() << Q_FUNC_INFO << "Notification Links: Invalid verb:" << verb;
}
}
void ActivityWidget::endNotificationRequest( NotificationWidget *widget, int replyCode )
{
_notificationRequestsRunning--;
if( widget ) {
widget->slotNotificationRequestFinished(replyCode);
}
}
void ActivityWidget::slotNotifyNetworkError( QNetworkReply *reply)
{
NotificationConfirmJob *job = qobject_cast<NotificationConfirmJob*>(sender());
if( !job ) {
return;
}
int resultCode =0;
if( reply ) {
resultCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
}
endNotificationRequest(job->widget(), resultCode);
qDebug() << Q_FUNC_INFO << "Server notify job failed with code " << resultCode;
}
void ActivityWidget::slotNotifyServerFinished( const QString& reply, int replyCode )
{
NotificationConfirmJob *job = qobject_cast<NotificationConfirmJob*>(sender());
if( !job ) {
return;
}
endNotificationRequest(job->widget(), replyCode);
// FIXME: remove the widget after a couple of seconds
qDebug() << Q_FUNC_INFO << "Server Notification reply code"<< replyCode << reply;
// if the notification was successful start a timer that triggers
// removal of the done widgets in a few seconds
// Add 200 millisecs to the predefined value to make sure that the timer in
// widget's method readyToClose() has elapsed.
if( replyCode == OCS_SUCCESS_STATUS_CODE ) {
scheduleWidgetToRemove( job->widget() );
}
}
// blacklist the activity coming in here.
void ActivityWidget::slotRequestCleanupAndBlacklist(const Activity& blacklistActivity)
{
if ( ! _blacklistedNotifications.contains(blacklistActivity) ) {
_blacklistedNotifications.append(blacklistActivity);
}
NotificationWidget *widget = _widgetForNotifId[ blacklistActivity.ident() ];
scheduleWidgetToRemove(widget);
}
void ActivityWidget::scheduleWidgetToRemove(NotificationWidget *widget, int milliseconds)
{
if( !widget ) {
return;
}
// in five seconds from now, remove the widget.
QDateTime removeTime = QDateTime::currentDateTimeUtc().addMSecs(milliseconds);
QDateTime &it = _widgetsToRemove[widget];
if (!it.isValid() || it > removeTime) {
it = removeTime;
}
if( !_removeTimer.isActive() ) {
_removeTimer.start();
}
}
// Called every second to see if widgets need to be removed.
void ActivityWidget::slotCheckToCleanWidgets()
{
auto currentTime = QDateTime::currentDateTimeUtc();
auto it = _widgetsToRemove.begin();
while (it != _widgetsToRemove.end()) {
// loop over all widgets in the to-remove queue
QDateTime t = it.value();
NotificationWidget *widget = it.key();
if( currentTime > t ) {
// found one to remove!
Activity::Identifier id = widget->activity().ident();
_widgetForNotifId.remove(id);
widget->deleteLater();
it = _widgetsToRemove.erase(it);
} else {
++it;
}
}
if( _widgetsToRemove.isEmpty() ) {
_removeTimer.stop();
}
// check to see if the whole notification pane should be hidden
if( _widgetForNotifId.isEmpty() ) {
_ui->_notifyLabel->setHidden(true);
_ui->_notifyScroll->setHidden(true);
}
}
/* ==================================================================== */
ActivitySettings::ActivitySettings(QWidget *parent)
@@ -513,16 +405,13 @@ ActivitySettings::ActivitySettings(QWidget *parent)
_tab = new QTabWidget(this);
hbox->addWidget(_tab);
_activityWidget = new ActivityWidget(this);
_activityTabId = _tab->insertTab(0, _activityWidget, Theme::instance()->applicationIcon(), tr("Server Activity"));
_tab->addTab(_activityWidget, Theme::instance()->applicationIcon(), tr("Server Activity"));
connect(_activityWidget, SIGNAL(copyToClipboard()), this, SLOT(slotCopyToClipboard()));
connect(_activityWidget, SIGNAL(hideActivityTab(bool)), this, SLOT(setActivityTabHidden(bool)));
connect(_activityWidget, SIGNAL(guiLog(QString,QString)), this, SIGNAL(guiLog(QString,QString)));
_protocolWidget = new ProtocolWidget(this);
_tab->insertTab(1, _protocolWidget, Theme::instance()->syncStateIcon(SyncResult::Success), tr("Sync Protocol"));
_tab->addTab(_protocolWidget, Theme::instance()->syncStateIcon(SyncResult::Success), tr("Sync Protocol"));
connect(_protocolWidget, SIGNAL(copyToClipboard()), this, SLOT(slotCopyToClipboard()));
connect(_protocolWidget, SIGNAL(issueItemCountUpdated(int)),
this, SLOT(slotShowIssueItemCount(int)));
// Add the not-synced list into the tab
QWidget *w = new QWidget;
@@ -537,49 +426,14 @@ ActivitySettings::ActivitySettings(QWidget *parent)
connect(_copyBtn, SIGNAL(clicked()), this, SLOT(slotCopyToClipboard()));
w->setLayout(vbox2);
_syncIssueTabId = _tab->insertTab(2, w, Theme::instance()->syncStateIcon(SyncResult::Problem), QString());
slotShowIssueItemCount(0); // to display the label.
_tab->addTab(w, Theme::instance()->syncStateIcon(SyncResult::Problem), tr("Not Synced"));
// Add a progress indicator to spin if the acitivity list is updated.
_progressIndicator = new QProgressIndicator(this);
_tab->setCornerWidget(_progressIndicator);
connect(&_notificationCheckTimer, SIGNAL(timeout()),
this, SLOT(slotRegularNotificationCheck()));
// connect a model signal to stop the animation.
connect(_activityWidget, SIGNAL(rowsInserted()), _progressIndicator, SLOT(stopAnimation()));
// We want the protocol be the default
_tab->setCurrentIndex(1);
}
void ActivitySettings::setNotificationRefreshInterval( quint64 interval )
{
qDebug() << "Starting Notification refresh timer with " << interval/1000 << " sec interval";
_notificationCheckTimer.start(interval);
}
void ActivitySettings::setActivityTabHidden(bool hidden)
{
if( hidden && _activityTabId > -1 ) {
_tab->removeTab(_activityTabId);
_activityTabId = -1;
}
if( !hidden && _activityTabId == -1 ) {
_activityTabId = _tab->insertTab(0, _activityWidget, Theme::instance()->applicationIcon(), tr("Server Activity"));
}
}
void ActivitySettings::slotShowIssueItemCount(int cnt)
{
QString cntText = tr("Not Synced");
if( cnt ) {
//: %1 is the number of not synced files.
cntText = tr("Not Synced (%1)").arg(cnt);
}
_tab->setTabText(_syncIssueTabId, cntText);
}
void ActivitySettings::slotCopyToClipboard()
@@ -615,32 +469,10 @@ void ActivitySettings::slotRemoveAccount( AccountState *ptr )
void ActivitySettings::slotRefresh( AccountState* ptr )
{
// QElapsedTimer isn't actually constructed as invalid.
if ( !_timeSinceLastCheck.contains(ptr) ) {
_timeSinceLastCheck[ptr].invalidate();
}
QElapsedTimer & timer = _timeSinceLastCheck[ptr];
// Fetch Activities only if visible and if last check is longer than 15 secs ago
if( timer.isValid() && timer.elapsed() < NOTIFICATION_REQUEST_FREE_PERIOD ) {
qDebug() << Q_FUNC_INFO << "do not check as last check is only secs ago: " << timer.elapsed() / 1000;
return;
}
if( ptr && ptr->isConnected() ) {
if( isVisible() || !timer.isValid() ) {
_progressIndicator->startAnimation();
_activityWidget->slotRefreshActivities( ptr);
}
_activityWidget->slotRefreshNotifications(ptr);
timer.start();
}
}
void ActivitySettings::slotRegularNotificationCheck()
{
AccountManager *am = AccountManager::instance();
foreach (AccountStatePtr a, am->accounts()) {
slotRefresh(a.data());
if( ptr && ptr->isConnected() && isVisible()) {
qDebug() << "Refreshing Activity list for " << ptr->account()->displayName();
_progressIndicator->startAnimation();
_activityWidget->slotRefresh(ptr);
}
}
+88 -51
Ver Arquivo
@@ -22,7 +22,6 @@
#include "progressdispatcher.h"
#include "owncloudgui.h"
#include "account.h"
#include "activitydata.h"
#include "ui_activitywidget.h"
@@ -34,15 +33,97 @@ namespace OCC {
class Account;
class AccountStatusPtr;
class ProtocolWidget;
class JsonApiJob;
class NotificationWidget;
class ActivityListModel;
namespace Ui {
class ActivityWidget;
}
class Application;
/**
* @brief Activity Structure
* @ingroup gui
*
* contains all the information describing a single activity.
*/
class Activity
{
public:
qlonglong _id;
QString _subject;
QString _message;
QString _file;
QUrl _link;
QDateTime _dateTime;
QString _accName;
/**
* @brief Sort operator to sort the list youngest first.
* @param val
* @return
*/
bool operator<( const Activity& val ) const {
return _dateTime.toMSecsSinceEpoch() > val._dateTime.toMSecsSinceEpoch();
}
};
/**
* @brief The ActivityList
* @ingroup gui
*
* A QList based list of Activities
*/
class ActivityList:public QList<Activity>
{
public:
void setAccountName( const QString& name );
QString accountName() const;
private:
QString _accountName;
};
/**
* @brief The ActivityListModel
* @ingroup gui
*
* Simple list model to provide the list view with data.
*/
class ActivityListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit ActivityListModel(QWidget *parent=0);
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
bool canFetchMore(const QModelIndex& ) const Q_DECL_OVERRIDE;
void fetchMore(const QModelIndex&) Q_DECL_OVERRIDE;
ActivityList activityList() { return _finalList; }
public slots:
void slotRefreshActivity(AccountState* ast);
void slotRemoveAccount( AccountState *ast );
private slots:
void slotActivitiesReceived(const QVariantMap& json, int statusCode);
signals:
void accountWithoutActivityApp(AccountState* ast);
private:
void startFetchJob(AccountState* s);
void combineActivityLists();
QMap<AccountState*, ActivityList> _activityLists;
ActivityList _finalList;
QSet<AccountState*> _currentlyFetching;
};
/**
* @brief The ActivityWidget class
* @ingroup gui
@@ -60,37 +141,16 @@ public:
QSize sizeHint() const Q_DECL_OVERRIDE { return ownCloudGui::settingsDialogSize(); }
void storeActivityList(QTextStream &ts);
/**
* Adjusts the activity tab's and some widgets' visibility
*
* Based on whether activities are enabled and whether notifications are
* available.
*/
void checkActivityTabVisibility();
public slots:
void slotOpenFile(QModelIndex indx);
void slotRefreshActivities(AccountState* ptr);
void slotRefreshNotifications(AccountState *ptr);
void slotRefresh(AccountState* ptr);
void slotRemoveAccount( AccountState *ptr );
void slotAccountActivityStatus(AccountState *ast, int statusCode);
void slotRequestCleanupAndBlacklist(const Activity& blacklistActivity);
void slotAccountWithoutActivityApp(AccountState *ast);
signals:
void guiLog(const QString&, const QString&);
void copyToClipboard();
void rowsInserted();
void hideActivityTab(bool);
void newNotificationList(const ActivityList& list);
private slots:
void slotBuildNotificationDisplay(const ActivityList& list);
void slotSendNotificationRequest(const QString &accountName, const QString& link, const QByteArray &verb);
void slotNotifyNetworkError( QNetworkReply* );
void slotNotifyServerFinished( const QString& reply, int replyCode );
void endNotificationRequest(NotificationWidget *widget , int replyCode);
void scheduleWidgetToRemove(NotificationWidget *widget, int milliseconds = 4500);
void slotCheckToCleanWidgets();
private:
void showLabels();
@@ -99,21 +159,8 @@ private:
QPushButton *_copyBtn;
QSet<QString> _accountsWithoutActivities;
QMap<Activity::Identifier, NotificationWidget*> _widgetForNotifId;
QElapsedTimer _guiLogTimer;
QSet<int> _guiLoggedNotifications;
ActivityList _blacklistedNotifications;
QHash<NotificationWidget*, QDateTime> _widgetsToRemove;
QTimer _removeTimer;
// number of currently running notification requests. If non zero,
// no query for notifications is started.
int _notificationRequestsRunning;
ActivityListModel *_model;
QVBoxLayout *_notificationsLayout;
};
@@ -136,13 +183,7 @@ public slots:
void slotRefresh( AccountState* ptr );
void slotRemoveAccount( AccountState *ptr );
void setNotificationRefreshInterval( quint64 interval );
private slots:
void slotCopyToClipboard();
void setActivityTabHidden(bool hidden);
void slotRegularNotificationCheck();
void slotShowIssueItemCount(int cnt);
signals:
void guiLog(const QString&, const QString&);
@@ -151,14 +192,10 @@ private:
bool event(QEvent* e) Q_DECL_OVERRIDE;
QTabWidget *_tab;
int _activityTabId;
int _syncIssueTabId;
ActivityWidget *_activityWidget;
ProtocolWidget *_protocolWidget;
QProgressIndicator *_progressIndicator;
QTimer _notificationCheckTimer;
QHash<AccountState*, QElapsedTimer> _timeSinceLastCheck;
};
}
+3 -61
Ver Arquivo
@@ -15,81 +15,23 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="_notifyLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="_headerLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QScrollArea" name="_notifyScroll">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="_scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>677</width>
<height>70</height>
</rect>
</property>
</widget>
</widget>
<widget class="QListView" name="_activityList"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="_headerLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="_bottomLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QListView" name="_activityList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="_bottomLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QDialogButtonBox" name="_dialogButtonBox"/>
</item>
</layout>
-10
Ver Arquivo
@@ -219,14 +219,10 @@ void Application::slotAccountStateRemoved(AccountState *accountState)
if (_gui) {
disconnect(accountState, SIGNAL(stateChanged(int)),
_gui, SLOT(slotAccountStateChanged()));
disconnect(accountState->account().data(), SIGNAL(serverVersionChanged(Account*,QString,QString)),
_gui, SLOT(slotTrayMessageIfServerUnsupported(Account*)));
}
if (_folderManager) {
disconnect(accountState, SIGNAL(stateChanged(int)),
_folderManager.data(), SLOT(slotAccountStateChanged()));
disconnect(accountState->account().data(), SIGNAL(serverVersionChanged(Account*,QString,QString)),
_folderManager.data(), SLOT(slotServerVersionChanged(Account*)));
}
// if there is no more account, show the wizard.
@@ -241,14 +237,8 @@ void Application::slotAccountStateAdded(AccountState *accountState)
{
connect(accountState, SIGNAL(stateChanged(int)),
_gui, SLOT(slotAccountStateChanged()));
connect(accountState->account().data(), SIGNAL(serverVersionChanged(Account*,QString,QString)),
_gui, SLOT(slotTrayMessageIfServerUnsupported(Account*)));
connect(accountState, SIGNAL(stateChanged(int)),
_folderManager.data(), SLOT(slotAccountStateChanged()));
connect(accountState->account().data(), SIGNAL(serverVersionChanged(Account*,QString,QString)),
_folderManager.data(), SLOT(slotServerVersionChanged(Account*)));
_gui->slotTrayMessageIfServerUnsupported(accountState->account().data());
}
void Application::slotCleanup()

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