Compare commits
410 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cd2f39f82 | ||
|
|
949dd5db35 | ||
|
|
49a5c5bb8b | ||
|
|
48aa355eea | ||
|
|
644b2673e0 | ||
|
|
8eed62e639 | ||
|
|
04c8449e5f | ||
|
|
016868e95a | ||
|
|
a662c85728 | ||
|
|
12cc8bfd95 | ||
|
|
11c6f20c90 | ||
|
|
c602ec310d | ||
|
|
b206a3b8e2 | ||
|
|
3bff5a061b | ||
|
|
0bc9b6f44e | ||
|
|
905f70a186 | ||
|
|
a8707b681d | ||
|
|
5d8f9f5346 | ||
|
|
a441b1d562 | ||
|
|
6e2042cd55 | ||
|
|
bb8b58dc66 | ||
|
|
9cd099056b | ||
|
|
0adbc032ae | ||
|
|
22a679fb8c | ||
|
|
35a67fab0a | ||
|
|
fdc8117211 | ||
|
|
24208e6137 | ||
|
|
46c7026726 | ||
|
|
01ad3c4d81 | ||
|
|
4ac98bde73 | ||
|
|
f42a6d6ef6 | ||
|
|
9055c6ade7 | ||
|
|
1356a5bbaa | ||
|
|
3c320c2736 | ||
|
|
969757199e | ||
|
|
60f1c65a48 | ||
|
|
b87b0e16e6 | ||
|
|
8ed0b1be55 | ||
|
|
91b5f1076f | ||
|
|
8ec2457965 | ||
|
|
82d79b1188 | ||
|
|
e33601becd | ||
|
|
334443adbb | ||
|
|
99579e8a2a | ||
|
|
89438f7ace | ||
|
|
d323ec5dd9 | ||
|
|
bb5cf37330 | ||
|
|
4b0bdd648c | ||
|
|
5588fbe695 | ||
|
|
12ea381205 | ||
|
|
99fbf25fb2 | ||
|
|
b37645e14d | ||
|
|
1ec5a1aaa2 | ||
|
|
3eb7acde25 | ||
|
|
e53e39cfad | ||
|
|
1a17f40233 | ||
|
|
10094a997a | ||
|
|
2af38b093f | ||
|
|
b03c168175 | ||
|
|
1c6bc84d2d | ||
|
|
541239c17b | ||
|
|
74b4ade15a | ||
|
|
205502fd3b | ||
|
|
54e4217216 | ||
|
|
d2579a7754 | ||
|
|
76580840dd | ||
|
|
779e59156c | ||
|
|
b0f0d0b1cd | ||
|
|
858dcb53bd | ||
|
|
9d7db88fcb | ||
|
|
2099b7c6a0 | ||
|
|
4442564ad2 | ||
|
|
12148b5c9b | ||
|
|
d7d77a49fc | ||
|
|
b70c2f5c20 | ||
|
|
033249423f | ||
|
|
0c959e8661 | ||
|
|
79785241ea | ||
|
|
0090862313 | ||
|
|
a4a68c6622 | ||
|
|
49b4c341ae | ||
|
|
7c1f91abdd | ||
|
|
1f2ba7e254 | ||
|
|
8014bcb7c4 | ||
|
|
b1c8bf5954 | ||
|
|
0eb6740bac | ||
|
|
96531b548a | ||
|
|
f3371360ed | ||
|
|
c1b92f9fed | ||
|
|
b028ca0738 | ||
|
|
a9aab30d55 | ||
|
|
efbad3a3c8 | ||
|
|
b6ed959f98 | ||
|
|
477953f965 | ||
|
|
aaf59cece5 | ||
|
|
e88b7e8ec2 | ||
|
|
078b09b5f4 | ||
|
|
0d06fe764a | ||
|
|
94f8c39a9e | ||
|
|
7d1bd9da86 | ||
|
|
ed8cdf6910 | ||
|
|
7ee83847c8 | ||
|
|
52eca1362f | ||
|
|
eec1af09c4 | ||
|
|
c651c8cbf9 | ||
|
|
da6a398624 | ||
|
|
1418512a9f | ||
|
|
dd2859880b | ||
|
|
f38d8ba2e4 | ||
|
|
fdd52a2520 | ||
|
|
e2c0792043 | ||
|
|
e8889530b0 | ||
|
|
23f67d950a | ||
|
|
0bd1f507ab | ||
|
|
2bcfc143f6 | ||
|
|
9dc21bf8a3 | ||
|
|
70f627ba06 | ||
|
|
0683c26d41 | ||
|
|
dbc085d4d4 | ||
|
|
804eaa700e | ||
|
|
646922665d | ||
|
|
62ad2f19e3 | ||
|
|
14f55420f9 | ||
|
|
d4ea0ba6ba | ||
|
|
c06f7b7ecb | ||
|
|
3a50eece9e | ||
|
|
44f0fb0242 | ||
|
|
c210e2b72f | ||
|
|
7b5079f043 | ||
|
|
be4027fb36 | ||
|
|
0f03b47a46 | ||
|
|
c923e0803e | ||
|
|
bd74dbbfc5 | ||
|
|
a0599e75b7 | ||
|
|
f334b6349b | ||
|
|
2ff9fcfa1d | ||
|
|
aa23e4698b | ||
|
|
302fdeb1f9 | ||
|
|
eea8542fc0 | ||
|
|
a36d79e993 | ||
|
|
be5c1b2072 | ||
|
|
f0bd1ea48e | ||
|
|
90d0460a42 | ||
|
|
c15ce2b20b | ||
|
|
b51f210bfa | ||
|
|
105c76c055 | ||
|
|
6b15b7a58f | ||
|
|
fee0aae975 | ||
|
|
b33b638d2d | ||
|
|
1e677a5f0f | ||
|
|
3f3f6c0f39 | ||
|
|
5dd53b48ef | ||
|
|
a215e11b20 | ||
|
|
7d71f9dd2d | ||
|
|
183f1574ca | ||
|
|
504b651bb9 | ||
|
|
c848ff4bdb | ||
|
|
5aa8f5bc01 | ||
|
|
6c5d5a543c | ||
|
|
a8bc849b5d | ||
|
|
5f535b9661 | ||
|
|
eaf865539c | ||
|
|
75448c41d4 | ||
|
|
afc96e2021 | ||
|
|
d7bce80c7b | ||
|
|
7e07d20d31 | ||
|
|
238111be09 | ||
|
|
6f0820a3ed | ||
|
|
1d0d1c249b | ||
|
|
1b5ed68375 | ||
|
|
ce996b3fc8 | ||
|
|
2789522948 | ||
|
|
55a56cc275 | ||
|
|
20101527b2 | ||
|
|
311bd39100 | ||
|
|
fab77a15f0 | ||
|
|
09e7f5c618 | ||
|
|
c5a674b1df | ||
|
|
f83453cfc7 | ||
|
|
1ca8ebebd9 | ||
|
|
7cc73ed46c | ||
|
|
01b4694b47 | ||
|
|
bcc6d59c6b | ||
|
|
b4e2e5f586 | ||
|
|
43ed874789 | ||
|
|
8928c87fc3 | ||
|
|
e3f8a918d6 | ||
|
|
668bb94270 | ||
|
|
89e0543e0a | ||
|
|
6695b50965 | ||
|
|
5c02c85126 | ||
|
|
de99c0c7e7 | ||
|
|
9f0348979b | ||
|
|
5b5cd310b9 | ||
|
|
ea85d68a26 | ||
|
|
fb0a883f7b | ||
|
|
64a0efe29a | ||
|
|
1f361b7260 | ||
|
|
763b06477d | ||
|
|
cd7d2a0778 | ||
|
|
a4be3f304d | ||
|
|
88184d14d6 | ||
|
|
844d8eba47 | ||
|
|
5e65945a53 | ||
|
|
428040762f | ||
|
|
30e0a13bc5 | ||
|
|
275c2b1a6b | ||
|
|
e409814cb6 | ||
|
|
acdb624713 | ||
|
|
3cae8e7124 | ||
|
|
2595b9eae7 | ||
|
|
46a8561925 | ||
|
|
bb74cab887 | ||
|
|
dd7f58b9b9 | ||
|
|
ee080222d8 | ||
|
|
c7aaa3ab28 | ||
|
|
fcde01fd4c | ||
|
|
83be334ee8 | ||
|
|
819f76c2b9 | ||
|
|
783b16676f | ||
|
|
aa6160ab62 | ||
|
|
8bae06802b | ||
|
|
a20f572448 | ||
|
|
f74aa1e9a6 | ||
|
|
86525570aa | ||
|
|
d11ce781d0 | ||
|
|
be5a50a000 | ||
|
|
7309a894bc | ||
|
|
310f29d3fd | ||
|
|
07db03d6bc | ||
|
|
d68c4b379f | ||
|
|
396a12dfde | ||
|
|
c79f4f91a8 | ||
|
|
bec2f7c9b9 | ||
|
|
d4c8cad0e2 | ||
|
|
0ad2bd4b91 | ||
|
|
dcc8f9fa6c | ||
|
|
d7a93c74aa | ||
|
|
408547611b | ||
|
|
a8f0e79046 | ||
|
|
3e45147497 | ||
|
|
48310d3f5e | ||
|
|
1831a975eb | ||
|
|
a766a44bcf | ||
|
|
8165b83a27 | ||
|
|
fa62c270e6 | ||
|
|
c03199e78a | ||
|
|
f346503534 | ||
|
|
287f1c55ff | ||
|
|
1c6523bcec | ||
|
|
337c6d3e4e | ||
|
|
4a57957420 | ||
|
|
c633302f31 | ||
|
|
1315ca2a57 | ||
|
|
2f0474a467 | ||
|
|
db95e7291d | ||
|
|
ae54c27805 | ||
|
|
284285d441 | ||
|
|
2554a67cc7 | ||
|
|
e2cccd8615 | ||
|
|
948a98a871 | ||
|
|
b50d201154 | ||
|
|
25a3ceb94d | ||
|
|
c514fe371a | ||
|
|
9169c70efe | ||
|
|
3c07cea229 | ||
|
|
d3f51c611f | ||
|
|
21123bb029 | ||
|
|
fb8d11650c | ||
|
|
2c250050d5 | ||
|
|
e9b3cbf3f7 | ||
|
|
d31a6e6179 | ||
|
|
26d8c213b0 | ||
|
|
bcb9491f6a | ||
|
|
9d2c3ebad3 | ||
|
|
ad063b0634 | ||
|
|
8765538458 | ||
|
|
dd4aa14a8c | ||
|
|
99814539eb | ||
|
|
dbec98ff48 | ||
|
|
e2e14f2184 | ||
|
|
e85291c4ba | ||
|
|
58a5405343 | ||
|
|
4ba85311da | ||
|
|
3cf7003101 | ||
|
|
ae558a5889 | ||
|
|
0b0b762c6c | ||
|
|
55a4fd752d | ||
|
|
136b699106 | ||
|
|
fd83bf2089 | ||
|
|
75f075feb0 | ||
|
|
817039ddf3 | ||
|
|
6d6deaf6c4 | ||
|
|
9c63b89bac | ||
|
|
2a6e084219 | ||
|
|
ec120cd64c | ||
|
|
a9173b1aa1 | ||
|
|
89f7f75af2 | ||
|
|
8809ac0c4a | ||
|
|
7a03164a9a | ||
|
|
406254cd04 | ||
|
|
f01eeed9d0 | ||
|
|
5b6439e29d | ||
|
|
38954c2193 | ||
|
|
5954fb280c | ||
|
|
8e63652fb3 | ||
|
|
365dfd5380 | ||
|
|
1c70fb3ba4 | ||
|
|
e5af8e87b3 | ||
|
|
bfbec24f43 | ||
|
|
8dd97a358a | ||
|
|
7290afc6fe | ||
|
|
2ba20369ea | ||
|
|
804aef6548 | ||
|
|
85f49b6af4 | ||
|
|
68afc6011d | ||
|
|
524ffcd0e1 | ||
|
|
a7303205b4 | ||
|
|
8a06b2d136 | ||
|
|
7ba8a55fa5 | ||
|
|
ee7dc8e1c5 | ||
|
|
3556f90d68 | ||
|
|
6d984b505d | ||
|
|
8d9336f9f4 | ||
|
|
2b5e694181 | ||
|
|
aa983e4966 | ||
|
|
424b3a9dfc | ||
|
|
5a3bc7af9a | ||
|
|
4501ec10dc | ||
|
|
699ae176df | ||
|
|
9297b3b850 | ||
|
|
cac5f81388 | ||
|
|
28af8068e9 | ||
|
|
a1d64af7b1 | ||
|
|
edbb79b79c | ||
|
|
a000a7b52e | ||
|
|
0a427541d6 | ||
|
|
1c297c56a2 | ||
|
|
6f9bbc431d | ||
|
|
f62626e3eb | ||
|
|
28fcd75494 | ||
|
|
39a89e8fc7 | ||
|
|
38a8096732 | ||
|
|
d358c839ce | ||
|
|
17901e7bc7 | ||
|
|
0ea16c04cc | ||
|
|
f1e0cd1c9c | ||
|
|
e1f404a011 | ||
|
|
69715d2182 | ||
|
|
0285213140 | ||
|
|
1a907f23f0 | ||
|
|
1296be71ed | ||
|
|
0ebcdbbb3f | ||
|
|
891ced0fca | ||
|
|
6276bb3873 | ||
|
|
dbb0cbaff8 | ||
|
|
cfa777260c | ||
|
|
66fc273db6 | ||
|
|
9c9e377cf4 | ||
|
|
f75eb24bfe | ||
|
|
a617a04295 | ||
|
|
dc16f277ce | ||
|
|
07258deaaf | ||
|
|
7b53e0f953 | ||
|
|
2ac764bd1a | ||
|
|
82d2851a6b | ||
|
|
7a3be71452 | ||
|
|
977a513ee5 | ||
|
|
22cbebb7a7 | ||
|
|
72b2e6778a | ||
|
|
08babbf38d | ||
|
|
2ae5ae6962 | ||
|
|
fa6331a40a | ||
|
|
cece465947 | ||
|
|
3f97047abc | ||
|
|
b6d5213880 | ||
|
|
0bcb65db29 | ||
|
|
7734656ae3 | ||
|
|
c14e17e271 | ||
|
|
1f4ea2c60e | ||
|
|
edb4ff6b98 | ||
|
|
279bb47ab4 | ||
|
|
7ef92748ea | ||
|
|
0e6e614318 | ||
|
|
a5b6c3add7 | ||
|
|
fd30d8b0d1 | ||
|
|
5944acf8a6 | ||
|
|
58ace7c774 | ||
|
|
a07444412b | ||
|
|
339f59a4e8 | ||
|
|
4beb9b3efc | ||
|
|
a04cf32a69 | ||
|
|
746c0359d2 | ||
|
|
854852959c | ||
|
|
1e1751e451 | ||
|
|
7cd0179adc | ||
|
|
c0543cdbaf | ||
|
|
d681066dc2 | ||
|
|
b81939bff5 | ||
|
|
f8685c97f1 | ||
|
|
11e06c33db | ||
|
|
c0f2f5bcaa | ||
|
|
bfee6402a6 | ||
|
|
4fac62560e | ||
|
|
d780055b0e | ||
|
|
3f5c53425b | ||
|
|
4caca2ce1a | ||
|
|
e0645b4b63 | ||
|
|
591b71cf18 | ||
|
|
76e9687d6f |
@@ -4,7 +4,8 @@ project(mirall)
|
||||
set(PACKAGE "mirall")
|
||||
set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
|
||||
|
||||
if ( DEFINED OEM_THEME_DIR AND EXISTS ${OEM_THEME_DIR}/OEM.cmake )
|
||||
set(OEM_THEME_DIR "" CACHE STRING "Define directory containing a custom theme")
|
||||
if ( EXISTS ${OEM_THEME_DIR}/OEM.cmake )
|
||||
include ( ${OEM_THEME_DIR}/OEM.cmake )
|
||||
else ()
|
||||
include ( ${CMAKE_SOURCE_DIR}/OWNCLOUD.cmake )
|
||||
@@ -12,7 +13,7 @@ endif()
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
|
||||
configure_file( ${CMAKE_SOURCE_DIR}/src/mirall/version.h.in "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/version.h" )
|
||||
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/")
|
||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@@ -53,9 +54,19 @@ else()
|
||||
endif()
|
||||
#####
|
||||
|
||||
#####
|
||||
## handle DBUS for Fdo notifications
|
||||
if( UNIX AND NOT APPLE )
|
||||
add_definitions( -DUSE_FDO_NOTIFICATIONS)
|
||||
endif()
|
||||
####
|
||||
|
||||
#### find libs
|
||||
find_package(Qt4 4.6.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest REQUIRED )
|
||||
find_package(Csync)
|
||||
if( UNIX AND NOT APPLE ) # Fdo notifications
|
||||
find_package(Qt4 4.6.0 COMPONENTS QtDBus REQUIRED )
|
||||
endif()
|
||||
find_package(Csync REQUIRED)
|
||||
if(UNIX)
|
||||
find_package(INotify REQUIRED)
|
||||
else()
|
||||
@@ -65,7 +76,6 @@ find_package(Sphinx)
|
||||
find_package(PdfLatex)
|
||||
find_package(QtKeychain)
|
||||
|
||||
set(WITH_CSYNC CSYNC_FOUND)
|
||||
set(WITH_QTKEYCHAIN ${QTKEYCHAIN_FOUND})
|
||||
set(USE_INOTIFY ${INOTIFY_FOUND})
|
||||
|
||||
@@ -92,12 +102,6 @@ set(CPACK_SOURCE_IGNORE_FILES
|
||||
|
||||
include(OwnCloudCPack.cmake)
|
||||
|
||||
#
|
||||
# This cmake builds two targets (aka apps), mirall and owncloud. For the owncloud
|
||||
# target, OWNCLOUD_CLIENT needs to be a compile flag. It is set in src/CMakeLists.txt
|
||||
# but if that fails because cmake is too old, uncomment this here if you want to build
|
||||
# owncloud.
|
||||
# add_definitions(-DOWNCLOUD_CLIENT)
|
||||
add_definitions(-DUNICODE)
|
||||
add_definitions(-D_UNICODE)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ If you have questions about how to use the ownCloud Desktop Client, please
|
||||
direct these to the [mailing list][mailinglist] or our [forum][forum].
|
||||
We are also available on [IRC][irc].
|
||||
|
||||
### Guidelines
|
||||
* Report the issue using our [template][template], it includes all the
|
||||
### Bug Reporting Guidelines
|
||||
* Important: Report the issue using our [template][template], it includes all the
|
||||
informations we need to track down the issue.
|
||||
* This repository is *only* for issues within the ownCloud desktop client.
|
||||
Issues in other compontents should be reported in their own repositores:
|
||||
|
||||
84
ChangeLog
@@ -1,5 +1,84 @@
|
||||
ChangeLog
|
||||
=========
|
||||
version 1.3.0 (release 2013-06-25 ), csync 0.80.0 required
|
||||
|
||||
* Default proxy port to 8080
|
||||
* Don't lose proxy settings when changing passwords
|
||||
* Support SOCKS5 proxy (useful in combination with ssh *D)
|
||||
* Propagate proxy changes to csync at runtime
|
||||
* Improve proxy wizard
|
||||
* Display proxy errors
|
||||
* Solved problems with lock files
|
||||
* Warn if for some reason all files are scheduled for removal on either side
|
||||
* Avoid infinite loop if authentication fails in certain cases
|
||||
* Fix reading the password from the config in certain cases
|
||||
* Do not crash when configured sync target disappears
|
||||
* Make --help work on windows
|
||||
* Make sync feedback less ambiguous.
|
||||
* Fix icon tray tooltip sometimes showing repeated content
|
||||
* More use of native directory separators on Windows
|
||||
* Remove journal when reusing a directory that used to have a journal before
|
||||
* Visual clean up of status dialog items
|
||||
* Wizard: When changing the URL or user name, allow the user to push his data
|
||||
to the new location or wipe the folder and start from scratch
|
||||
* Wizard: Make setting a custom folder as a sync target work again
|
||||
* Fix application icon
|
||||
* User-Agent now contains "Mozilla/5.0" and the Platform name (for firewall/proxy compat)
|
||||
* Server side directory moves will be detected
|
||||
* New setup wizard, defaulting to root syncing (only for new setups)
|
||||
* Improved thread stop/termination
|
||||
|
||||
version 1.2.5 (release 2013-04-23 ), csync 0.70.7 required
|
||||
* [Fixes] NSIS installer fixes
|
||||
* [Fixes] Fix crash race by making certificateChain() thread safe
|
||||
* [Fixes] Build with older CMake versions (CentOS/RHEL 6)
|
||||
* [Fixes] Wording in GUI
|
||||
* [Fixes] Silently ignore "installed = true" status.php
|
||||
* Set log verbosity before calling csync_init.
|
||||
* GUI feedback for the statistics copy action
|
||||
* Safer approach for detecting duplicate sync runs
|
||||
|
||||
version 1.2.4 (release 2013-04-11 ), csync 0.70.6 required
|
||||
* [Fixes] Clarify string in folder wizard
|
||||
* [Fixes] Fixed some valgrind warnings
|
||||
* [Fixes] Ensure that only one sync thread can ever run
|
||||
* [Fixes] Fix default config storage path
|
||||
* [Fixes] Skip folders with no absolute path
|
||||
* [Fixes] Allow setting the configuration directory on command line
|
||||
|
||||
version 1.2.3 (release 2013-04-02 ), csync 0.70.5 required
|
||||
* [Fixes] Unbreak self-signed certificate handling
|
||||
|
||||
version 1.2.2 (release 2013-04-02 ), csync 0.70.5 required
|
||||
* [Fixes] Do not crash when local file tree contains symlinks
|
||||
* [Fixes] Correctly handle locked files on Windows
|
||||
* [Fixes] Display errors in all members of the SSL chain
|
||||
* [Fixes] Enable Accessibility features on Windows
|
||||
* [Fixes] Make setupFavLink work properly on Mac OS
|
||||
* [Fixes] Ignore temporary files created by MS Office
|
||||
* [Gui] Support Nautilus in setupFavLink
|
||||
|
||||
version 1.2.1 (release 2013-02-26 ), csync 0.70.4 required
|
||||
* [Fixes] Leave configured folders on configuration changes.
|
||||
* [Fixes] Do not allow to finish the setup dialog if connection can't be established.
|
||||
* [Fixes] Better handling of credentials in setup dialog.
|
||||
* [Fixes] Do not leak fd's to /dev/null when using gnutls
|
||||
* [Fixes] Stop sync scheduling when configuration wizard starts.
|
||||
* [Fixes] Clear pending network requests when stepping back in config wizard.
|
||||
* [Fixes] User password dialog asynchronous issues.
|
||||
* [Fixes] Make folderman starting and stoping the scheduling.
|
||||
* [Fixes] Various minor fixes and cleanups.
|
||||
* [Fixes] Crash on pausing sync
|
||||
* [Fixes] Stale lock file after pausing sync
|
||||
* [App] Load translations from app dir or bundle as well.
|
||||
* [Platform] Build fixes and simplifications, ie. build only one lib.
|
||||
* [Platform] Added some getter/setters for configuration values.
|
||||
* [Platform] Added man pages.
|
||||
* [Platform] Simplified/fixed credential store usage and custom configs.
|
||||
* [Platform] Added soname version to libowncloudsync.
|
||||
* [Platform] Pull in Qt translations
|
||||
* [Gui] Make sync result popups less annoyingq
|
||||
* [Gui] Fix for result popup
|
||||
|
||||
version 1.2.0 (release 2013-01-24 ), csync 0.70.2 required
|
||||
* [GUI] New status dialog to show a detailed list of synced files.
|
||||
@@ -51,10 +130,6 @@ version 1.1.1 (release 2012-10-18), csync 0.60.1 required
|
||||
* [Fixes] csync: Allow single quote (') in file names
|
||||
* [Fixes] csync: Remove stray temporary files
|
||||
|
||||
version 1.1.0 (release 2012-10-10), csync 0.60.0 required
|
||||
* [GUI] Added an about dialog
|
||||
* [GUI] Improved themeing capabilities of the client.
|
||||
* [GUI] Minor fixes in folder assistant.
|
||||
* [GUI] Reworked tray context menu.
|
||||
* [GUI] Users can now sync the server root folder.
|
||||
* [Fixes] Proxy support: now supports Proxy Auto-Configuration (PAC)
|
||||
@@ -149,4 +224,3 @@ version 1.0.1 (release 2012-04-18), csync 0.50.5 required
|
||||
* [Platform] MacOSX Bundle creation added
|
||||
* [Platform] Enabled ranslations on Windows.
|
||||
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ if(WIN32)
|
||||
# CPACK_INCLUDE_TOPLEVEL_DIRECTORY Controls whether CPack adds a top-level directory, usually of the form ProjectName-Version-OS, to the top of package tree. 0 to disable, 1 to enable
|
||||
# CPACK_INSTALL_CMAKE_PROJECTS List of four values: Build directory, Project Name, Project Component, Directory in the package /home/andy/vtk/CMake-bin;CMake;ALL;/
|
||||
set( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" ) # File used as a description of a project /path/to/project/ReadMe.txt
|
||||
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "ownCloud Syncing Client" ) # Description summary of a project
|
||||
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "${APPLICATION_NAME} Syncing Client" ) # Description summary of a project
|
||||
# CPACK_PACKAGE_EXECUTABLES List of pairs of executables and labels. Used by the NSIS generator to create Start Menu shortcuts. ccmake;CMake
|
||||
set( CPACK_PACKAGE_INSTALL_DIRECTORY ${APPLICATION_NAME} ) # Installation directory on the target system -> C:\Program Files\fellody
|
||||
set( CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${APPLICATION_NAME} ) # Registry key used when installing this project CMake 2.5.0
|
||||
set( CPACK_PACKAGE_NAME ${APPLICATION_NAME} ) # Package name, defaults to the project name
|
||||
set( CPACK_PACKAGE_VENDOR "http://owncloud.com" ) # Package vendor name
|
||||
set( CPACK_PACKAGE_VENDOR "http://${APPLICATION_DOMAIN}" ) # Package vendor name
|
||||
endif()
|
||||
|
||||
# set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt" ) # License file for the project, used by the STGZ, NSIS, and PackageMaker generators. /home/andy/vtk/CMake/Copyright.txt
|
||||
|
||||
61
README.md
@@ -2,50 +2,12 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
Mirall synchronizes your folders with another computer.
|
||||
|
||||
The ultimate goals of Mirall are:
|
||||
|
||||
* Network location aware: should not try to sync against your NAS if you are
|
||||
not in the home network
|
||||
* It is a zero-interaction tool. So forget about resolving conflicts.
|
||||
* It should work silently and realiably.
|
||||
|
||||
Mirall is in early stages of development, and may still eat your
|
||||
files or hang your computer.
|
||||
|
||||
* Network location awareness not implemented yet
|
||||
* Current version supports local and remote (sftp and smb) folders.
|
||||
* It is powered by csync (http://www.csync.org), however
|
||||
the user does not know and other tools will be incorporated to provide other
|
||||
functionality.
|
||||
|
||||
## Current issues
|
||||
|
||||
* No sane way to backup conflicting versions yet, this should be solved
|
||||
in a near csync release (--conflictcopy, available in Jann's branch).
|
||||
Right now the newest copy wins.
|
||||
* You can't remove folder configurations
|
||||
Workaround: delete ~/.local/share/data/Mirall/folders/$alias and restart
|
||||
* Some tasks block the GUI (initial setup of watchers)
|
||||
* May be some concurrency issues
|
||||
|
||||
## Roadmap
|
||||
|
||||
* Improve robustness to minimize user interaction
|
||||
* Improve feedback and sync results
|
||||
* Add support for other folder types: tarsnap, duplicity, git (SparkleShare)
|
||||
|
||||
## Requirements
|
||||
|
||||
* Linux (currently it uses inotify to detect file changes)
|
||||
* unison installed in the local and remote machine
|
||||
(you should not care if you got Mirall with your favorite
|
||||
distribution)
|
||||
Mirall is a tool to synchronize files from ownCloud Server with your computer.
|
||||
It uses OCSync as its syncing backend.
|
||||
|
||||
## Download
|
||||
|
||||
### openSUSE
|
||||
### Binary packages
|
||||
|
||||
* Refer to the download page http://owncloud.org/sync-clients/
|
||||
|
||||
@@ -55,23 +17,12 @@ files or hang your computer.
|
||||
|
||||
## Building the source code
|
||||
|
||||
You need Qt 4.7 and cmake:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make
|
||||
|
||||
To generate a tarball:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
make package_source
|
||||
Please refer to [Building the Client](http://doc.owncloud.org/desktop/1.2/building.html)
|
||||
in the ownCloud client manual.
|
||||
|
||||
## Authors
|
||||
|
||||
* Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
* Duncan Mac-Vicar P. <duncan@kde.org> (original Mirall author)
|
||||
* Klaas Freitag <freitag@owncloud.com>
|
||||
* Daniel Molkentin <danimo@owncloud.com>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
set( VERSION_MAJOR 1 )
|
||||
set( VERSION_MINOR 2 )
|
||||
set( VERSION_MINOR 3 )
|
||||
set( VERSION_PATCH 0 )
|
||||
set( VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
set( VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX})
|
||||
set( SOVERSION 0 )
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ mount="/Volumes/$(basename $src_dmg|cut -d"-" -f1)"
|
||||
test -e $tmp_dmg && rm -rf $tmp_dmg
|
||||
hdiutil convert $src_dmg -format UDRW -o $tmp_dmg
|
||||
open $tmp_dmg
|
||||
sleep 2s
|
||||
sleep 12s
|
||||
pushd $mount
|
||||
codesign -s "$identity" $mount/*.app
|
||||
popd
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
!define APPLICATION_LICENSE "@APPLICATION_LICENSE@"
|
||||
!define WIN_SETUP_BITMAP_PATH "@WIN_SETUP_BITMAP_PATH@"
|
||||
|
||||
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.${APPLICATION_DOMAIN}"
|
||||
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; Some installer script options (comment-out options not required)
|
||||
;-----------------------------------------------------------------------------
|
||||
@@ -34,9 +31,11 @@
|
||||
!endif
|
||||
!define MING_BIN "${MING_PATH}/bin"
|
||||
!define MING_LIB "${MING_PATH}/lib"
|
||||
!define MING_SHARE "${MING_PATH}/share"
|
||||
!define BUILD_PATH "@CMAKE_BINARY_DIR@"
|
||||
!define SOURCE_PATH "@CMAKE_SOURCE_DIR@"
|
||||
!define QT_DLL_PATH "${MING_BIN}"
|
||||
!define ACCESSIBLE_DLL_PATH "${MING_LIB}/qt4/plugins/accessible"
|
||||
!define SQLITE_DLL_PATH "${MING_LIB}/qt4/plugins/sqldrivers"
|
||||
!define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt4/plugins/imageformats"
|
||||
|
||||
@@ -64,7 +63,6 @@
|
||||
; Initial installer setup and definitions.
|
||||
;-----------------------------------------------------------------------------
|
||||
Name "@CPACK_NSIS_PACKAGE_NAME@"
|
||||
Caption "${APPLICATION_NAME} Setup"
|
||||
BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
|
||||
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
|
||||
InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
@@ -105,13 +103,11 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
|
||||
!define MUI_ICON ${NSI_PATH}\installer.ico
|
||||
!define MUI_UNICON ${NSI_PATH}\installer.ico
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/welcome.bmp
|
||||
!define MUI_WELCOMEPAGE_TITLE "Welcome to the @CPACK_PACKAGE_NAME@ ${VERSION} Setup Wizard"
|
||||
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation.$\r$\n$\r$\n$_CLICK"
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/page_header.bmp
|
||||
!define MUI_COMPONENTSPAGE_SMALLDESC
|
||||
!define MUI_FINISHPAGE_TITLE "@CPACK_PACKAGE_NAME@ Setup Completed"
|
||||
!define MUI_FINISHPAGE_LINK "Click here to visit the @CPACK_PACKAGE_NAME@ website."
|
||||
!define MUI_FINISHPAGE_LINK "www.${APPLICATION_DOMAIN}"
|
||||
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.${APPLICATION_DOMAIN}"
|
||||
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
|
||||
!ifdef OPTION_FINISHPAGE_RELEASE_NOTES
|
||||
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
||||
@@ -271,7 +267,7 @@ FunctionEnd
|
||||
# INSTALLER SECTIONS #
|
||||
# #
|
||||
##############################################################################
|
||||
Section "${APPLICATION_NAME}" SEC_OWNCLOUD
|
||||
Section "${APPLICATION_NAME}" SEC_APPLICATION
|
||||
SectionIn 1 2 3 RO
|
||||
SetDetailsPrint listonly
|
||||
|
||||
@@ -288,22 +284,83 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
|
||||
;Main executable.
|
||||
File "${BUILD_PATH}\bin\${APPLICATION_EXECUTABLE}"
|
||||
File "${BUILD_PATH}\src\libowncloudsync.dll"
|
||||
|
||||
File "${BUILD_PATH}\src\mirall_ca.qm"
|
||||
File "${BUILD_PATH}\src\mirall_cs_CZ.qm"
|
||||
File "${BUILD_PATH}\src\mirall_da.qm"
|
||||
File "${BUILD_PATH}\src\mirall_de.qm"
|
||||
File "${BUILD_PATH}\src\mirall_el.qm"
|
||||
File "${BUILD_PATH}\src\mirall_en.qm"
|
||||
File "${BUILD_PATH}\src\mirall_eo.qm"
|
||||
File "${BUILD_PATH}\src\mirall_es.qm"
|
||||
File "${BUILD_PATH}\src\mirall_es_AR.qm"
|
||||
File "${BUILD_PATH}\src\mirall_et_EE.qm"
|
||||
File "${BUILD_PATH}\src\mirall_eu.qm"
|
||||
File "${BUILD_PATH}\src\mirall_fa.qm"
|
||||
File "${BUILD_PATH}\src\mirall_fi_FI.qm"
|
||||
File "${BUILD_PATH}\src\mirall_fr.qm"
|
||||
File "${BUILD_PATH}\src\mirall_gl.qm"
|
||||
File "${BUILD_PATH}\src\mirall_he.qm"
|
||||
File "${BUILD_PATH}\src\mirall_hr.qm"
|
||||
File "${BUILD_PATH}\src\mirall_hu_HU.qm"
|
||||
File "${BUILD_PATH}\src\mirall_it.qm"
|
||||
File "${BUILD_PATH}\src\mirall_ja_JP.qm"
|
||||
File "${BUILD_PATH}\src\mirall_ko.qm"
|
||||
File "${BUILD_PATH}\src\mirall_lb.qm"
|
||||
File "${BUILD_PATH}\src\mirall_lt_LT.qm"
|
||||
File "${BUILD_PATH}\src\mirall_lv.qm"
|
||||
File "${BUILD_PATH}\src\mirall_mk.qm"
|
||||
File "${BUILD_PATH}\src\mirall_ms_MY.qm"
|
||||
File "${BUILD_PATH}\src\mirall_nb_NO.qm"
|
||||
File "${BUILD_PATH}\src\mirall_nl.qm"
|
||||
File "${BUILD_PATH}\src\mirall_oc.qm"
|
||||
File "${BUILD_PATH}\src\mirall_pl.qm"
|
||||
File "${BUILD_PATH}\src\mirall_pt_BR.qm"
|
||||
File "${BUILD_PATH}\src\mirall_pt_PT.qm"
|
||||
File "${BUILD_PATH}\src\mirall_ro.qm"
|
||||
File "${BUILD_PATH}\src\mirall_ru.qm"
|
||||
File "${BUILD_PATH}\src\mirall_ru_RU.qm"
|
||||
File "${BUILD_PATH}\src\mirall_si_LK.qm"
|
||||
File "${BUILD_PATH}\src\mirall_sk_SK.qm"
|
||||
File "${BUILD_PATH}\src\mirall_sl.qm"
|
||||
File "${BUILD_PATH}\src\mirall_sr@latin.qm"
|
||||
File "${BUILD_PATH}\src\mirall_sv.qm"
|
||||
File "${BUILD_PATH}\src\mirall_ta_LK.qm"
|
||||
File "${BUILD_PATH}\src\mirall_th_TH.qm"
|
||||
File "${BUILD_PATH}\src\mirall_tr.qm"
|
||||
File "${BUILD_PATH}\src\mirall_uk.qm"
|
||||
File "${BUILD_PATH}\src\mirall_vi.qm"
|
||||
File "${BUILD_PATH}\src\mirall_zh_CN.qm"
|
||||
File "${BUILD_PATH}\src\mirall_zh_TW.qm"
|
||||
|
||||
#File "${MING_SHARE}\qt4\translations\qt_ar.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_cs.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_da.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_de.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_es.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_fa.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_fr.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_gl.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_he.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_hu.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_ja.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_ko.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_lt.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_pl.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_pt.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_ru.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_sk.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_sl.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_sv.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_uk.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_zh_CN.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_zh_TW.qm"
|
||||
File "${MING_SHARE}\qt4\translations\qt_zh_TW.qm"
|
||||
|
||||
File "${MING_SHARE}\qt4\translations\qtkeychain_de.qm"
|
||||
|
||||
SetOutPath "$INSTDIR\accessible"
|
||||
File "${ACCESSIBLE_DLL_PATH}\qtaccessiblewidgets4.dll"
|
||||
|
||||
SetOutPath "$INSTDIR\modules"
|
||||
; FIXME: fix installation dir of module, currently needs manual copying to
|
||||
@@ -317,7 +374,7 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
|
||||
|
||||
;License & release notes.
|
||||
File "@CPACK_RESOURCE_FILE_LICENSE@"
|
||||
File /oname=NOTES.txt ${NSI_PATH}\RELEASE_NOTES.txt
|
||||
;File /oname=NOTES.txt ${NSI_PATH}\RELEASE_NOTES.txt
|
||||
|
||||
;QT stuff:
|
||||
File "${QT_DLL_PATH}\QtCore4.dll"
|
||||
@@ -349,11 +406,10 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
|
||||
;File "${MING_BIN}\libpng15-15.dll"
|
||||
;File "${MING_BIN}\libjpeg-8.dll"
|
||||
File "${MING_BIN}\zlib1.dll"
|
||||
File "${MING_BIN}\libcrypto-8.dll"
|
||||
File "${MING_BIN}\libssl-8.dll"
|
||||
File "${MING_BIN}\libcrypto-10.dll"
|
||||
File "${MING_BIN}\libssl-10.dll"
|
||||
|
||||
; CSync configs
|
||||
File "${CSYNC_CONFIG_DIR}/ocsync.conf"
|
||||
File "${SOURCE_PATH}/sync-exclude.lst"
|
||||
|
||||
SectionEnd
|
||||
@@ -369,9 +425,9 @@ SectionGroup "Shortcuts"
|
||||
SetShellVarContext all
|
||||
RMDir /r "$SMPROGRAMS\${APPLICATION_NAME}"
|
||||
CreateDirectory "$SMPROGRAMS\${APPLICATION_NAME}"
|
||||
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
|
||||
;CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
|
||||
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
|
||||
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Release notes.lnk" "$INSTDIR\NOTES.txt"
|
||||
;CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Release notes.lnk" "$INSTDIR\NOTES.txt"
|
||||
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
|
||||
SetShellVarContext current
|
||||
${MementoSectionEnd}
|
||||
@@ -406,7 +462,7 @@ SectionGroupEnd
|
||||
DetailPrint "Creating Windows Start Entry"
|
||||
SetDetailsPrint listonly
|
||||
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Run" \
|
||||
"${APPLICATION_NAME}" "$INSTDIR\${APPLICATION_EXECUTABLE}"
|
||||
"${APPLICATION_NAME}" "$INSTDIR\${APPLICATION_EXECUTABLE}"
|
||||
${MementoSectionEnd}
|
||||
!endif
|
||||
|
||||
@@ -419,7 +475,7 @@ ${MementoSectionDone}
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_START_MENU} "${APPLICATION_NAME} program group."
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} "Desktop shortcut for ${APPLICATION_NAME}."
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_LAUNCH} "Quick Launch shortcut for ${APPLICATION_NAME}."
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_AUTOSTART} "Register ${APPLICATION_NAME} to run on Windows startup."
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_AUTOSTART} "Register ${APPLICATION_NAME} to run on Windows startup."
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
Section -post
|
||||
|
||||
@@ -13,7 +13,15 @@ if(SPHINX_FOUND)
|
||||
set(LATEX_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/logo-blue.pdf")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" conf.py @ONLY)
|
||||
add_custom_target(doc DEPENDS doc-html doc-man COMMENT "Building documentation...")
|
||||
|
||||
if(WITH_DOC)
|
||||
add_custom_target(doc ALL DEPENDS doc-html doc-man COMMENT "Building documentation...")
|
||||
install(DIRECTORY ${SPHINX_HTML_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||
install(DIRECTORY ${SPHINX_MAN_DIR} DESTINATION ${CMAKE_INSTALL_MANDIR})
|
||||
else(WITH_DOC)
|
||||
add_custom_target(doc DEPENDS doc-html doc-man COMMENT "Building documentation...")
|
||||
endif(WITH_DOC)
|
||||
|
||||
if(PDFLATEX_FOUND)
|
||||
# if this still fails on Debian/Ubuntu, run
|
||||
# apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
|
||||
@@ -26,6 +34,9 @@ if(SPHINX_FOUND)
|
||||
add_custom_target(doc-pdf make -C ${SPHINX_PDF_DIR} all-pdf
|
||||
DEPENDS doc-latex )
|
||||
add_dependencies(doc doc-pdf)
|
||||
if (WITH_DOC)
|
||||
install(DIRECTORY ${SPHINX_PDF_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||
endif (WITH_DOC)
|
||||
endif(PDFLATEX_FOUND)
|
||||
if (EXISTS ${QT_QCOLLECTIONGENERATOR_EXECUTABLE})
|
||||
add_custom_target( doc-qch-sphinx ${SPHINX_EXECUTABLE}
|
||||
@@ -37,6 +48,9 @@ if(SPHINX_FOUND)
|
||||
${SPHINX_QCH_DIR}/*.qhcp
|
||||
DEPENDS doc-qch-sphinx )
|
||||
add_dependencies(doc doc-qch)
|
||||
if (WITH_DOC)
|
||||
install(DIRECTORY ${SPHINX_QCH_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||
endif (WITH_DOC)
|
||||
endif()
|
||||
add_custom_target( doc-html ${SPHINX_EXECUTABLE}
|
||||
-q -c . -b html
|
||||
@@ -48,6 +62,7 @@ if(SPHINX_FOUND)
|
||||
-d ${SPHINX_CACHE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${SPHINX_MAN_DIR} )
|
||||
|
||||
## Building CHM files requires HTML Help Workshop. Since it requires wine
|
||||
## with special dependencies, it's impossible to write a cmake check for it.
|
||||
## This is why doc-chm is not a dependency for doc. Instead, run
|
||||
|
||||
@@ -20,20 +20,24 @@ Linux
|
||||
Mac OS X
|
||||
--------
|
||||
|
||||
Follow the `generic build instructions`_.
|
||||
Next to XCode (and the command line tools!), you will need some
|
||||
extra dependencies.
|
||||
|
||||
You can install the missing dependencies via MacPorts_ or Homebrew_.
|
||||
You can install these dependencies via MacPorts_ or Homebrew_.
|
||||
This is only needed on the build machine, since non-standard libs
|
||||
will be deployed in the app bundle.
|
||||
|
||||
The only exception to this rule is libiniparser_, which lacks a decent
|
||||
build system. If you are using Homebrew_, you can just add it::
|
||||
The tested and preferred way is to use HomeBrew_. The ownCloud team has
|
||||
its own repository which contains non-standard recipes. Add it with::
|
||||
|
||||
brew tap dschmidt/owncloud
|
||||
brew install iniparser
|
||||
brew tap owncloud/owncloud
|
||||
|
||||
Otherwise, you need to copy the header and lib files to
|
||||
``/usr/local/include`` and ``/usr/local/lib`` respectively.
|
||||
Next, install the missing dependencies::
|
||||
|
||||
brew install $(brew deps ocsync)
|
||||
brew install $(brew deps mirall)
|
||||
|
||||
To build mirall and cmake, follow the `generic build instructions`_.
|
||||
|
||||
.. note::
|
||||
You should not call ``make install`` at any time, since the product of the
|
||||
@@ -51,18 +55,22 @@ if you do not have it installed already.
|
||||
In order to cross-compile, the following repositories need to be added
|
||||
via YaST or ``zypper ar`` (adjust when using openSUSE 12.2)::
|
||||
|
||||
http://download.opensuse.org/repositories/isv:/ownCloud:/devel:/mingw:/win32/openSUSE_12.1/
|
||||
http://download.opensuse.org/repositories/windows:/mingw/openSUSE_12.1/
|
||||
http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_12.1/
|
||||
zypper ar http://download.opensuse.org/repositories/isv:/ownCloud:/devel:/mingw:/win32/openSUSE_12.1/isv:ownCloud:devel:mingw:win32.repo
|
||||
zypper ar http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_12.1/windows:mingw:win32.repo
|
||||
zypper ar http://download.opensuse.org/repositories/windows:/mingw/openSUSE_12.1/windows:mingw.repo
|
||||
|
||||
Next, install the cross-compiler packages and the cross-compiled dependencies::
|
||||
|
||||
zypper si -d mingw32-csync
|
||||
zypper install kdewin-png2ico mingw32-libqt4 mingw32-libqt4-devel \
|
||||
mingw32-libgcrypt mingw32-libgnutls mingw32-libneon \
|
||||
mingw32-libbeecrypt mingw32-libopenssl mingw32-openssl \
|
||||
mingw32-libpng-devel mingw32-libsqlite mingw32-qtkeychain \
|
||||
mingw32-qtkeychain-devel mingw32-iniparser mingw32-dlfcn
|
||||
zypper 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-iniparser-devel \
|
||||
mingw32-libsqlite-devel mingw32-dlfcn-devel mingw32-libssh2-devel \
|
||||
kdewin-png2ico mingw32-libqt4 mingw32-libqt4-devel mingw32-libgcrypt \
|
||||
mingw32-libgnutls mingw32-libneon mingw32-libneon-devel mingw32-libbeecrypt \
|
||||
mingw32-libopenssl mingw32-openssl mingw32-libpng-devel mingw32-libsqlite \
|
||||
mingw32-qtkeychain mingw32-qtkeychain-devel mingw32-iniparser mingw32-dlfcn \
|
||||
mingw32-libintl-devel mingw32-libneon-devel mingw32-libopenssl-devel \
|
||||
mingw32-libproxy-devel mingw32-libxml2-devel mingw32-zlib-devel
|
||||
|
||||
For the installer, the NSIS installer package is also required::
|
||||
|
||||
@@ -76,18 +84,18 @@ For the installer, the NSIS installer package is also required::
|
||||
You will also need to manually download and install the following files with
|
||||
``rpm -ivh <package>`` (They will also work with OpenSUSE 12.2)::
|
||||
|
||||
http://pmbs.links2linux.org/download/mingw:/32/openSUSE_12.1/x86_64/mingw32-cross-nsis-plugin-processes-0-1.1.x86_64.rpm
|
||||
http://pmbs.links2linux.org/download/mingw:/32/openSUSE_12.1/x86_64/mingw32-cross-nsis-plugin-uac-0-3.1.x86_64.rpm
|
||||
rpm -ihv http://pmbs.links2linux.org/download/mingw:/32/openSUSE_12.1/x86_64/mingw32-cross-nsis-plugin-processes-0-1.1.x86_64.rpm
|
||||
rpm -ihv http://pmbs.links2linux.org/download/mingw:/32/openSUSE_12.1/x86_64/mingw32-cross-nsis-plugin-uac-0-3.1.x86_64.rpm
|
||||
|
||||
Now, follow the `generic build instructions`_, but pay attention to
|
||||
the following differences:
|
||||
|
||||
1. For building ``libocsync``, you need to use ``mingw32-cmake`` instead
|
||||
of cmake.
|
||||
2. Also, you need to specify *absolute pathes* for ``CSYNC_LIBRARY_PATH``
|
||||
and ``CSYNC_LIBRARY_PATH`` when running ``cmake`` on mirall.
|
||||
3. for building ``mirall``, you need to use ``cmake`` again, but make sure
|
||||
2. for building ``mirall``, you need to use ``cmake`` again, but make sure
|
||||
to append the following parameter::
|
||||
3. Also, you need to specify *absolute pathes* for ``CSYNC_LIBRARY_PATH``
|
||||
and ``CSYNC_LIBRARY_PATH`` when running ``cmake`` on mirall.
|
||||
|
||||
``-DCMAKE_TOOLCHAIN_FILE=../mirall/admin/win/Toolchain-mingw32-openSUSE.cmake``
|
||||
|
||||
@@ -147,14 +155,17 @@ directories. If this succeeds, call ``make``. The owncloud binary should appear
|
||||
in the ``bin`` directory. You can also run ``make install`` to install the client to
|
||||
``/usr/local/bin``.
|
||||
|
||||
To build in installer (requires the mingw32-cross-nsis packages)::
|
||||
To build an installer/app bundle (requires the mingw32-cross-nsis packages on Windows)::
|
||||
|
||||
make package
|
||||
|
||||
Known cmake parameters:
|
||||
|
||||
* WITH_DOC=TRUE: create doc and manpages via running ``make``; also adds install statements to be able to install it via ``make install``.
|
||||
|
||||
.. _`ownCloud repository from OBS`: http://software.opensuse.org/download/package?project=isv:ownCloud:devel&package=owncloud-client
|
||||
.. _CSync: http://www.csync.org
|
||||
.. _`Client Download Page`: http://owncloud.org/sync-clients/
|
||||
.. _Git: http://git-scm.com
|
||||
.. _MacPorts: http://www.macports.org
|
||||
.. _Homebrew: http://mxcl.github.com/homebrew/
|
||||
.. _libiniparser: http://ndevilla.free.fr/iniparser/
|
||||
|
||||
@@ -41,7 +41,7 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'ownCloud Client Manual'
|
||||
copyright = u'2012, The ownCloud developers'
|
||||
copyright = u'2013, The ownCloud developers'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
@@ -213,12 +213,12 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'owncloud', u'ownCloud Client Manual',
|
||||
[u'The ownCloud developers'], 1)
|
||||
('owncloud.1', 'owncloud', u'File synchronisation desktop utility.',
|
||||
[u'The ownCloud developers'], 1),
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
man_show_urls = True
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
@@ -248,7 +248,7 @@ texinfo_documents = [
|
||||
epub_title = u'ownCloud Client Manual'
|
||||
epub_author = u'The ownCloud developers'
|
||||
epub_publisher = u'The ownCloud developers'
|
||||
epub_copyright = u'2012, The ownCloud developers'
|
||||
epub_copyright = u'2013, The ownCloud developers'
|
||||
|
||||
# The language of the text. It defaults to the language option
|
||||
# or en if the language is not set.
|
||||
|
||||
26
doc/conffile.rst
Normal file
@@ -0,0 +1,26 @@
|
||||
ownCloud Client reads a configuration file.
|
||||
|
||||
On Linux it can be found in:
|
||||
``$HOME/.local/share/data/ownCloud/owncloud.cfg``
|
||||
|
||||
On Windows it can be found in:
|
||||
``%LOCALAPPDATA%\ownCloud\owncloud.cfg``
|
||||
|
||||
On Mac it can be found in:
|
||||
``$HOME/Library/Application Support/ownCloud``
|
||||
|
||||
|
||||
It contains settings in the ini file format known from Windows.
|
||||
|
||||
.. note:: Changes here should be done carefully as wrong settings can cause disfunctionality.
|
||||
|
||||
.. note:: Changes may be overwritten by using ownCloud's configuration dialog.
|
||||
|
||||
These are config settings that may be changed:
|
||||
|
||||
``remotePollinterval`` (default: ``30000``)
|
||||
Poll time for the remote repository in milliseconds
|
||||
|
||||
``maxLogLines`` (default: ``20000``)
|
||||
Maximum count of log lines shown in the log window
|
||||
|
||||
@@ -19,7 +19,7 @@ Mac OS X
|
||||
Installing the ownCloud client on your Mac follows the normal app installation
|
||||
pattern:
|
||||
|
||||
1. Download the installation file Click ownCloud-1.1.1.dmg, a window with the
|
||||
1. Download the installation file Click ownCloud-x.y.z.dmg, a window with the
|
||||
2. ownCloud icon opens In that window, drag the ownCloud application into the
|
||||
3. ‘Applications’ folder on the right hand side From ‘Applications’, choose
|
||||
ownCloud
|
||||
|
||||
17
doc/options.rst
Normal file
@@ -0,0 +1,17 @@
|
||||
ownCloud Client supports the following command line switches:
|
||||
|
||||
``--logwindow``
|
||||
open a window to show log output at startup.
|
||||
|
||||
``--logfile`` `<file>`
|
||||
write log output to a single file
|
||||
|
||||
``--logdir`` `<dir>`
|
||||
write log output to dir, one for each sync run.
|
||||
|
||||
``--flushlog``
|
||||
flush the log file after every write.
|
||||
|
||||
``--monoicons``
|
||||
Use black/white pictograms for systray.
|
||||
|
||||
37
doc/owncloud.1.rst
Normal file
@@ -0,0 +1,37 @@
|
||||
owncloud(1)
|
||||
-----------
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
========
|
||||
*owncloud* [`OPTIONS`...]
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
ownCloud is a file synchronisation desktop utility based on mirall.
|
||||
It synchronizes files on your local machine with an ownCloud Server. If you
|
||||
make a change to the files on one computer, it will flow across the others
|
||||
using this desktop sync clients.
|
||||
|
||||
Normally you start the client by click on the desktop icon or start from the
|
||||
application menu. After starting an ownCloud icon appears in the system tray.
|
||||
|
||||
Options
|
||||
=======
|
||||
.. include:: options.rst
|
||||
|
||||
Config File
|
||||
===========
|
||||
.. include:: conffile.rst
|
||||
|
||||
BUGS
|
||||
====
|
||||
|
||||
Please report bugs at https://github.com/owncloud/core/issues.
|
||||
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
`csync(1)`
|
||||
|
||||
@@ -4,9 +4,12 @@ Doc Build Convenience Scripts
|
||||
* ``htmlhelp.sh``: A script to install Microsoft HTML Workshop on Linux or Mac OS using Wine, along with some dependencies.
|
||||
* ``htmlhelp.reg``: Registry file to override some DLLs with their native version and set the right Windows version.
|
||||
|
||||
Those files have been taken from the HTML Help Project (http://code.google.com/p/htmlhelp/wiki/HHW4Wine).
|
||||
Those files have been taken from the `HTML Help Project`_.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
The HTML Help Project has licensed its software under LGPLv3 terms.
|
||||
The HTML Help Project has licensed_ its software under LGPLv2.1 terms
|
||||
|
||||
.. _HTML Help Project: http://code.google.com/p/htmlhelp/wiki/HHW4Wine
|
||||
.. _licensed: https://code.google.com/p/htmlhelp/source/browse/trunk/pyhtmlhelp/COPYING
|
||||
|
||||
@@ -1,28 +1,114 @@
|
||||
Troubleshooting
|
||||
===============
|
||||
|
||||
:All of my desktop clients fail to connect to ownCloud:
|
||||
If the client fails to start syncing it basically can have two
|
||||
basic reasons: Either the server setup has a problem or the client
|
||||
has a bug. When reporting bugs, it is crucial to find out what part
|
||||
of the system causes the problem.
|
||||
|
||||
Identifying basic functionality problems
|
||||
----------------------------------------
|
||||
|
||||
:Perform a general ownCloud Server test:
|
||||
A very first check is to verify that you can log on to ownClouds web
|
||||
application. Assuming your ownCloud instance is installed at
|
||||
``http://yourserver.com/owncloud``, type
|
||||
``http://yourserver.com/owncloud/`` into your browsers address bar.
|
||||
|
||||
If you are not prompted to enter your user name and password, or if you
|
||||
see a red warning box on the page, your server setup is not correct or needs
|
||||
fixes. Please verify that your server installation is working correctly.
|
||||
|
||||
:Ensure the WebDAV API is working:
|
||||
If all desktop clients fail to connect to ownCloud, but the access via the
|
||||
web interface works, the problem often is a mis-configuration of the WebDAV
|
||||
API.
|
||||
|
||||
The ownCloud client uses the built-in WebDAV access of the server content.
|
||||
Verify that you can log on to ownClouds WebDAV server. Assuming your ownCloud
|
||||
instance is installed at ``http://yourserver.com/owncloud``, type
|
||||
``http://yourserver.com/owncloud/remote.php/webdav`` into your browsers
|
||||
address bar.
|
||||
|
||||
If you are not prompted to enter your user name and password, please verify
|
||||
that your server installation is working correctly.
|
||||
address bar.
|
||||
|
||||
If you are prompted, but the authentication fails even though the credentials
|
||||
your provided are correct, please ensure that your authentication backend
|
||||
is configured properly.
|
||||
|
||||
:Use a WebDAV command line tool to test:
|
||||
A more sophisticated test is to use a WebDAV command line client and log
|
||||
into the ownCloud WebDAV server, such as a little app called cadaver,
|
||||
available on Linux. It can be used to further verify that the WebDAV server is
|
||||
running properly, for example by performing PROPFIND calls:
|
||||
|
||||
:The desktop client fails for an unknown reason:
|
||||
Start the client with ``--logwindow``. You can also open a log window for an
|
||||
already running session, by simply starting the client again with this
|
||||
parameter. Syntax:
|
||||
``propget .`` called within cadaver will return some properties of the current
|
||||
directory and thus be a successful WebDAV connect.
|
||||
|
||||
Isolating other issues
|
||||
----------------------
|
||||
|
||||
If the sync result is unreliable, please ensure that the folder synced with
|
||||
ownCloud is not shared with other syncing apps.
|
||||
|
||||
.. note:: Syncing the same directory with ownCloud and other sync software such
|
||||
as Unison, rsync, Microsoft Windows Offline Folders or cloud services
|
||||
such as DropBox or Microsoft SkyDrive is not supported and should
|
||||
not be attempted. In the worst case, doing so can result in data
|
||||
loss.
|
||||
|
||||
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.
|
||||
|
||||
.. note:: The data directory on the server is exclusive to ownCloud and must
|
||||
not be modified manually.
|
||||
|
||||
If you are using a different backend, you can try to exclude a bug in the
|
||||
backend by reverting to the local backend.
|
||||
|
||||
Logfiles
|
||||
========
|
||||
|
||||
Doing effective debugging requires to provide as much as relevant logs as
|
||||
possible. The log output can help you with tracking down problem, and if you
|
||||
report a bug, you're advised to include the output.
|
||||
|
||||
:Client Logfile:
|
||||
Start the client with ``--logwindow``. That opens a window providing a view
|
||||
on the current log. It provides a Save button to let you save the log to a
|
||||
file.
|
||||
|
||||
You can also open a log window for an already running session, by simply
|
||||
starting the client again with this parameter. Syntax:
|
||||
|
||||
* Windows: ``C:\Program Files (x86)\ownCloud\owncloud.exe --logwindow``
|
||||
* Mac OS X: ``/Applications/owncloud.app/Contents/MacOS/owncloud --logwindow``
|
||||
* Linux: ``owncloud --logwindow``
|
||||
|
||||
The log output can help you with tracking down problem, and if you report
|
||||
a bug, it's useful to include the output.
|
||||
It is also possible to directly log to a directory, which is an useful option
|
||||
in case the problem only happens ocassionally. In that case it is better to
|
||||
create a huge amount of data, as the log window has a limited buffer.
|
||||
|
||||
To write logs to disk, start the client with ``--logfile <file>``, where
|
||||
``<file`` is the file you want to log to, or ``--logdir <dir>``, where ``<dir>``
|
||||
is an existing directory. In case of ``--logdir``, each sync run will create a
|
||||
new file.
|
||||
|
||||
:ownCloud server Logfile:
|
||||
The ownCloud server maintains an ownCloud specific logfile as well. It can and
|
||||
must be enabled through the ownCloud Administration page. There you can adjust
|
||||
the loglevel. It is advisable to set it to a verbose level like ``Debug`` or
|
||||
``Info``.
|
||||
|
||||
The logfile can be viewed either in the web interface or can be found in the
|
||||
filesystem in the ownCloud server data dir.
|
||||
|
||||
:Webserver Logfiles:
|
||||
Also, please take a look at your webservers error log file to check if there
|
||||
are problems. For Apache on Linux, the error logs usually can be found at
|
||||
``/var/log/apache2``. A file called ``error_log`` shows errors like PHP code
|
||||
problems. A file called ``access_log`` usually records all requests handled
|
||||
by the server. Especially the access_log is a very good debugging tool as the
|
||||
log line contains a lot of information of every request and it's result.
|
||||
|
||||
More information about the apache logging can be found at
|
||||
``http://httpd.apache.org/docs/current/logs.html``.
|
||||
|
||||
|
||||
@@ -7,52 +7,49 @@ application menu. In the system tray, an ownCloud icon appears.
|
||||
|
||||
.. index:: start application
|
||||
|
||||
A left click on the tray icon open a status dialog which gives an overview on
|
||||
the configured sync folders and allows to add and remove more sync folder
|
||||
connections as well as pausing a sync connection.
|
||||
Overview
|
||||
--------
|
||||
|
||||
A right click on the tray icon gives other configuration options.
|
||||
ownCloud is represented by an icon in the Desktop's system tray, also known
|
||||
as notification area.
|
||||
|
||||
The clients menu is accessed with a right click (Windows, Linux) or left click
|
||||
(Mac OS).
|
||||
|
||||
Command line switches
|
||||
---------------------
|
||||
The status of the current sync can be observed in the Status dialog, available
|
||||
trough the ``Open status...`` option. On Windows, a left click on the tray icon
|
||||
also opens the status dialog.
|
||||
|
||||
.. note:: Until the intial setup has finished, the Connection Wizard will be
|
||||
shown instead when left-clicking on Windows.
|
||||
|
||||
The dialog provides an overview on the configured sync folders and allows to add
|
||||
and remove more sync folder connections as well as pausing a sync connection.
|
||||
|
||||
Changing your password
|
||||
----------------------
|
||||
|
||||
Use the ``Configure`` option. It will open the Connection Wizard, which next to
|
||||
reconfiguring your connection to use a different user or server also will allow
|
||||
to change the password for the local account, or to switch from HTTP to HTTPS.
|
||||
|
||||
Setting up a proxy
|
||||
------------------
|
||||
|
||||
By default, the configured system proxy will be picked up. This may not be
|
||||
working reliable on some Linux distributions, as only the ``http_proxy``
|
||||
variable gets parsed. You can configure a proxy different from your
|
||||
system default by choosing ``Configure proxy...`` from the menu.
|
||||
|
||||
By default, ownCloud expects a HTTP proxy. If you want to specify a SOCKS5
|
||||
proxy instead, tick the "Use as SOCKSv5 proxy" option.
|
||||
|
||||
Options
|
||||
-------
|
||||
.. index:: command line switches, command line, options, parameters
|
||||
|
||||
|
||||
ownCloud Client supports the following command line switches:
|
||||
|
||||
+--------------------------+------------------------------------------------+
|
||||
| Switch | Action |
|
||||
+==========================+================================================+
|
||||
| ``--logwindow`` | open a window to show log output at startup. |
|
||||
+--------------------------+------------------------------------------------+
|
||||
| ``--logfile <filename>`` | write log output to file. |
|
||||
+--------------------------+------------------------------------------------+
|
||||
| ``--flushlog`` | flush the log file after every write. |
|
||||
+--------------------------+------------------------------------------------+
|
||||
.. include:: options.rst
|
||||
|
||||
Config File
|
||||
-----------
|
||||
.. index:: config file
|
||||
|
||||
ownCloud Client reads a configuration file which on Linux can be found at ``$HOME/.local/share/data/ownCloud/owncloud.cfg``
|
||||
On Windows, it can be found in ``\Users\<name>\AppData\Local\ownCloud\owncloud.cfg``
|
||||
.. todo:: Mac?
|
||||
It contains settings in the ini file format known from Windows.
|
||||
|
||||
.. note:: Changes here should be done carefully as wrong settings can cause disfunctionality.
|
||||
|
||||
|
||||
These are config settings that may be changed:
|
||||
|
||||
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
|
||||
| Setting | Data Type | Unit | Default | Description |
|
||||
+===========================+===========+==============+===========+=====================================================+
|
||||
| ``remotePollinterval`` | integer | milliseconds | ``30000`` | Poll time for the remote repository |
|
||||
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
|
||||
| ``maxLogLines`` | integer | lines | ``20000`` | Maximum count of log lines shown in the log window |
|
||||
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
|
||||
|
||||
* ``remotePollinterval`` The frequency used for polling for remote changes on
|
||||
the ownCloud Server.
|
||||
|
||||
.. include:: conffile.rst
|
||||
|
||||
@@ -20,6 +20,8 @@ PHP version:
|
||||
|
||||
ownCloud version:
|
||||
|
||||
Storage backend:
|
||||
|
||||
### Client configuration
|
||||
Client version:
|
||||
|
||||
@@ -31,18 +33,14 @@ Installation path of client:
|
||||
|
||||
### Logs
|
||||
|
||||
#### output of `owncloud --logwindow` or `owncloud --logfile log.txt`
|
||||
```
|
||||
Insert your log output here
|
||||
```
|
||||
Please use Gist (https://gist.github.com/) or a similar code paster for longer
|
||||
logs.
|
||||
|
||||
#### Web server error log
|
||||
```
|
||||
Insert your webserver log here
|
||||
```
|
||||
```Template for output < 10 lines```
|
||||
|
||||
#### ownCloud log (data/owncloud.log)
|
||||
```
|
||||
Insert your ownCloud log here
|
||||
```
|
||||
1. Output of `owncloud --logwindow` or `owncloud --logfile log.txt`
|
||||
|
||||
2. Web server error log:
|
||||
|
||||
3. ownCloud log (data/owncloud.log):
|
||||
|
||||
|
||||
21
mirall.qrc
@@ -1,24 +1,15 @@
|
||||
<RCC>
|
||||
<qresource prefix="/mirall">
|
||||
<file>resources/mirall-32.png</file>
|
||||
<file>resources/mirall-64.png</file>
|
||||
<file>resources/mirall-128.png</file>
|
||||
<file>resources/folder-grey-32.png</file>
|
||||
<file>resources/folder-remote-32.png</file>
|
||||
<file>resources/folder-grey-22.png</file>
|
||||
<file>resources/folder-remote-22.png</file>
|
||||
<file>resources/mirall-22.png</file>
|
||||
<file>resources/mirall-48.png</file>
|
||||
<file>resources/folder-grey-48.png</file>
|
||||
<file>resources/folder-remote-48.png</file>
|
||||
<file>resources/dialog-close.png</file>
|
||||
<file>resources/dialog-ok.png</file>
|
||||
<file>resources/dialog-cancel.png</file>
|
||||
<file>resources/view-refresh.png</file>
|
||||
<file>resources/folder-favorites.png</file>
|
||||
<file>resources/folder-sync-48.png</file>
|
||||
<file>resources/folder-important.png</file>
|
||||
<file>resources/folder-remote-32.png</file>
|
||||
<file>resources/folder-remote.png</file>
|
||||
<file>resources/folder-sync.png</file>
|
||||
<file>resources/folder-grey.png</file>
|
||||
<file>resources/task-ongoing.png</file>
|
||||
<file>resources/view-refresh.png</file>
|
||||
<file>resources/warning-16.png</file>
|
||||
<file>resources/owncloud_logo_blue.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 668 B |
|
Before Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
resources/lock-http.png
Normal file
|
After Width: | Height: | Size: 739 B |
BIN
resources/lock-https.png
Normal file
|
After Width: | Height: | Size: 478 B |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 523 B |
|
Before Width: | Height: | Size: 698 B |
|
Before Width: | Height: | Size: 991 B |
|
Before Width: | Height: | Size: 1.3 KiB |
BIN
resources/owncloud_logo_blue.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
resources/warning-16.png
Normal file
|
After Width: | Height: | Size: 596 B |
22
src/3rdparty/LGPL_EXCEPTION.txt
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Digia Qt LGPL Exception version 1.1
|
||||
|
||||
As an additional permission to the GNU Lesser General Public License version
|
||||
2.1, the object code form of a "work that uses the Library" may incorporate
|
||||
material from a header file that is part of the Library. You may distribute
|
||||
such object code under terms of your choice, provided that:
|
||||
(i) the header files of the Library have not been modified; and
|
||||
(ii) the incorporated material is limited to numerical parameters, data
|
||||
structure layouts, accessors, macros, inline functions and
|
||||
templates; and
|
||||
(iii) you comply with the terms of Section 6 of the GNU Lesser General
|
||||
Public License version 2.1.
|
||||
|
||||
Moreover, you may apply this exception to a modified version of the Library,
|
||||
provided that such modification does not involve copying material from the
|
||||
Library into the modified Library's header files unless such material is
|
||||
limited to (i) numerical parameters; (ii) data structure layouts;
|
||||
(iii) accessors; and (iv) small macros, templates and inline functions of
|
||||
five lines or less in length.
|
||||
|
||||
Furthermore, you are not required to apply this additional permission to a
|
||||
modified version of the Library.
|
||||
165
src/3rdparty/QProgressIndicator/LICENSE
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
137
src/3rdparty/QProgressIndicator/QProgressIndicator.cpp
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of QProgressIndicator,
|
||||
* an open-source recent files menu widget
|
||||
*
|
||||
* Copyright (C) 2009 - 2010 Morgan Leborgne
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "QProgressIndicator.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
QProgressIndicator::QProgressIndicator(QWidget* parent)
|
||||
: QWidget(parent),
|
||||
m_angle(0),
|
||||
m_timerId(-1),
|
||||
m_delay(40),
|
||||
m_displayedWhenStopped(false),
|
||||
m_color(Qt::black)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
}
|
||||
|
||||
bool QProgressIndicator::isAnimated () const
|
||||
{
|
||||
return (m_timerId != -1);
|
||||
}
|
||||
|
||||
void QProgressIndicator::setDisplayedWhenStopped(bool state)
|
||||
{
|
||||
m_displayedWhenStopped = state;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
bool QProgressIndicator::isDisplayedWhenStopped() const
|
||||
{
|
||||
return m_displayedWhenStopped;
|
||||
}
|
||||
|
||||
void QProgressIndicator::startAnimation()
|
||||
{
|
||||
m_angle = 0;
|
||||
|
||||
if (m_timerId == -1)
|
||||
m_timerId = startTimer(m_delay);
|
||||
}
|
||||
|
||||
void QProgressIndicator::stopAnimation()
|
||||
{
|
||||
if (m_timerId != -1)
|
||||
killTimer(m_timerId);
|
||||
|
||||
m_timerId = -1;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QProgressIndicator::setAnimationDelay(int delay)
|
||||
{
|
||||
if (m_timerId != -1)
|
||||
killTimer(m_timerId);
|
||||
|
||||
m_delay = delay;
|
||||
|
||||
if (m_timerId != -1)
|
||||
m_timerId = startTimer(m_delay);
|
||||
}
|
||||
|
||||
void QProgressIndicator::setColor(const QColor & color)
|
||||
{
|
||||
m_color = color;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
QSize QProgressIndicator::sizeHint() const
|
||||
{
|
||||
return QSize(20,20);
|
||||
}
|
||||
|
||||
int QProgressIndicator::heightForWidth(int w) const
|
||||
{
|
||||
return w;
|
||||
}
|
||||
|
||||
void QProgressIndicator::timerEvent(QTimerEvent * /*event*/)
|
||||
{
|
||||
m_angle = (m_angle+30)%360;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void QProgressIndicator::paintEvent(QPaintEvent * /*event*/)
|
||||
{
|
||||
if (!m_displayedWhenStopped && !isAnimated())
|
||||
return;
|
||||
|
||||
int width = qMin(this->width(), this->height());
|
||||
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
int outerRadius = (width-1)*0.5;
|
||||
int innerRadius = (width-1)*0.5*0.38;
|
||||
|
||||
int capsuleHeight = outerRadius - innerRadius;
|
||||
int capsuleWidth = (width > 32 ) ? capsuleHeight *.23 : capsuleHeight *.35;
|
||||
int capsuleRadius = capsuleWidth/2;
|
||||
|
||||
for (int i=0; i<12; i++)
|
||||
{
|
||||
QColor color = m_color;
|
||||
color.setAlphaF(1.0f - (i/12.0f));
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(color);
|
||||
p.save();
|
||||
p.translate(rect().center());
|
||||
p.rotate(m_angle - i*30.0f);
|
||||
p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
|
||||
p.restore();
|
||||
}
|
||||
}
|
||||
108
src/3rdparty/QProgressIndicator/QProgressIndicator.h
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
*
|
||||
* This file is part of QProgressIndicator,
|
||||
* an open-source recent files menu widget
|
||||
*
|
||||
* Copyright (C) 2009 - 2010 Morgan Leborgne
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifndef QPROGRESSINDICATOR_H
|
||||
#define QPROGRESSINDICATOR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
|
||||
/*!
|
||||
\class QProgressIndicator
|
||||
\brief The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
|
||||
|
||||
Progress indicators are indeterminate and do nothing more than spin to show that the application is busy.
|
||||
\sa QProgressBar
|
||||
*/
|
||||
class QProgressIndicator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay)
|
||||
Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
public:
|
||||
QProgressIndicator(QWidget* parent = 0);
|
||||
|
||||
/*! Returns the delay between animation steps.
|
||||
\return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
|
||||
\sa setAnimationDelay
|
||||
*/
|
||||
int animationDelay() const { return m_delay; }
|
||||
|
||||
/*! Returns a Boolean value indicating whether the component is currently animated.
|
||||
\return Animation state.
|
||||
\sa startAnimation stopAnimation
|
||||
*/
|
||||
bool isAnimated () const;
|
||||
|
||||
/*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
|
||||
\return Return true if the progress indicator shows itself even when it is not animating. By default, it returns false.
|
||||
\sa setDisplayedWhenStopped
|
||||
*/
|
||||
bool isDisplayedWhenStopped() const;
|
||||
|
||||
/*! Returns the color of the component.
|
||||
\sa setColor
|
||||
*/
|
||||
const QColor & color() const { return m_color; }
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
int heightForWidth(int w) const;
|
||||
public slots:
|
||||
/*! Starts the spin animation.
|
||||
\sa stopAnimation isAnimated
|
||||
*/
|
||||
void startAnimation();
|
||||
|
||||
/*! Stops the spin animation.
|
||||
\sa startAnimation isAnimated
|
||||
*/
|
||||
void stopAnimation();
|
||||
|
||||
/*! Sets the delay between animation steps.
|
||||
Setting the \a delay to a value larger than 40 slows the animation, while setting the \a delay to a smaller value speeds it up.
|
||||
\param delay The delay, in milliseconds.
|
||||
\sa animationDelay
|
||||
*/
|
||||
void setAnimationDelay(int delay);
|
||||
|
||||
/*! Sets whether the component hides itself when it is not animating.
|
||||
\param state The animation state. Set false to hide the progress indicator when it is not animating; otherwise true.
|
||||
\sa isDisplayedWhenStopped
|
||||
*/
|
||||
void setDisplayedWhenStopped(bool state);
|
||||
|
||||
/*! Sets the color of the components to the given color.
|
||||
\sa color
|
||||
*/
|
||||
void setColor(const QColor & color);
|
||||
protected:
|
||||
virtual void timerEvent(QTimerEvent * event);
|
||||
virtual void paintEvent(QPaintEvent * event);
|
||||
private:
|
||||
int m_angle;
|
||||
int m_timerId;
|
||||
int m_delay;
|
||||
bool m_displayedWhenStopped;
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
#endif // QPROGRESSINDICATOR_H
|
||||
14
src/3rdparty/QProgressIndicator/README.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
## Description
|
||||
|
||||
The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
|
||||
Will work at any size.
|
||||
|
||||
<img src="https://raw.github.com/mojocorp/QProgressIndicator/master/screen-capture-1.png" >
|
||||
<img src="https://raw.github.com/mojocorp/QProgressIndicator/master/screen-capture-2.png" >
|
||||
|
||||
## Dependency
|
||||
Qt 4.4.x.
|
||||
|
||||
## License
|
||||
|
||||
LGPL
|
||||
353
src/3rdparty/fancylineedit/fancylineedit.cpp
vendored
Normal file
@@ -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);
|
||||
|
||||
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_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
src/3rdparty/fancylineedit/fancylineedit.h
vendored
Normal file
@@ -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);
|
||||
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);
|
||||
|
||||
private:
|
||||
void updateMargins();
|
||||
void updateButtonPositions();
|
||||
friend class Utils::FancyLineEditPrivate;
|
||||
|
||||
FancyLineEditPrivate *d;
|
||||
QString m_oldText;
|
||||
};
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
#endif // FANCYLINEEDIT_H
|
||||
@@ -3,7 +3,7 @@ include(${QT_USE_FILE})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
QT4_ADD_RESOURCES ( MIRALL_RC_SRC ../mirall.qrc)
|
||||
if ( DEFINED OEM_THEME_DIR)
|
||||
if ( IS_DIRECTORY ${OEM_THEME_DIR} )
|
||||
QT4_ADD_RESOURCES ( MIRALL_RC_SRC ${OEM_THEME_DIR}/theme.qrc)
|
||||
set(theme_dir ${OEM_THEME_DIR}/theme)
|
||||
else()
|
||||
@@ -14,13 +14,8 @@ endif()
|
||||
set(mirall_UI
|
||||
mirall/folderwizardsourcepage.ui
|
||||
mirall/folderwizardtargetpage.ui
|
||||
mirall/folderwizardnetworkpage.ui
|
||||
mirall/folderwizardowncloudpage.ui
|
||||
mirall/statusdialog.ui
|
||||
mirall/owncloudwizardselecttypepage.ui
|
||||
mirall/owncloudsetuppage.ui
|
||||
mirall/createanowncloudpage.ui
|
||||
mirall/owncloudftpaccesspage.ui
|
||||
mirall/owncloudsetuppage_ng.ui
|
||||
mirall/owncloudwizardresultpage.ui
|
||||
mirall/owncloudcredentialspage.ui
|
||||
mirall/sslerrordialog.ui
|
||||
@@ -30,20 +25,19 @@ mirall/fileitemdialog.ui
|
||||
|
||||
set(3rdparty_SRC
|
||||
3rdparty/qtsingleapplication/qtsingleapplication.cpp
|
||||
3rdparty/qtsingleapplication/qtlocalpeer.h
|
||||
3rdparty/qtsingleapplication/qtlocalpeer.cpp
|
||||
3rdparty/qtsingleapplication/qtsingleapplication.h
|
||||
3rdparty/qtsingleapplication/qtsinglecoreapplication.h
|
||||
3rdparty/qtsingleapplication/qtsinglecoreapplication.cpp
|
||||
|
||||
3rdparty/qtlockedfile/qtlockedfile.h
|
||||
3rdparty/qtlockedfile/qtlockedfile.cpp
|
||||
3rdparty/fancylineedit/fancylineedit.cpp
|
||||
3rdparty/QProgressIndicator/QProgressIndicator.cpp
|
||||
)
|
||||
|
||||
set(3rdparty_HEADER
|
||||
3rdparty/qtsingleapplication/qtlocalpeer.h
|
||||
3rdparty/qtsingleapplication/qtsingleapplication.h
|
||||
3rdparty/qtsingleapplication/qtsinglecoreapplication.h
|
||||
3rdparty/fancylineedit/fancylineedit.h
|
||||
3rdparty/QProgressIndicator/QProgressIndicator.h
|
||||
)
|
||||
qt4_wrap_cpp(3rdparty_MOC ${3rdparty_HEADER})
|
||||
|
||||
@@ -56,6 +50,8 @@ endif()
|
||||
set(3rdparty_INC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qtlockedfile
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qtsingleapplication
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/QProgressIndicator
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/fancylineedit
|
||||
)
|
||||
|
||||
qt4_wrap_ui(mirall_UI_SRCS ${mirall_UI})
|
||||
@@ -64,35 +60,30 @@ set(libsync_SRCS
|
||||
mirall/folderman.cpp
|
||||
mirall/folder.cpp
|
||||
mirall/folderwatcher.cpp
|
||||
mirall/gitfolder.cpp
|
||||
mirall/syncresult.cpp
|
||||
mirall/unisonfolder.cpp
|
||||
mirall/networklocation.cpp
|
||||
mirall/mirallconfigfile.cpp
|
||||
mirall/credentialstore.cpp
|
||||
mirall/csyncfolder.cpp
|
||||
mirall/owncloudfolder.cpp
|
||||
mirall/csyncthread.cpp
|
||||
mirall/fileutils.cpp
|
||||
mirall/theme.cpp
|
||||
mirall/owncloudtheme.cpp
|
||||
mirall/miralltheme.cpp
|
||||
mirall/owncloudinfo.cpp
|
||||
mirall/logger.cpp
|
||||
mirall/utility.cpp
|
||||
mirall/connectionvalidator.cpp
|
||||
)
|
||||
set(libsync_HEADERS
|
||||
mirall/folderman.h
|
||||
mirall/folder.h
|
||||
mirall/folderwatcher.h
|
||||
mirall/gitfolder.h
|
||||
mirall/unisonfolder.h
|
||||
mirall/csyncfolder.h
|
||||
mirall/owncloudfolder.h
|
||||
mirall/csyncthread.h
|
||||
mirall/owncloudinfo.h
|
||||
mirall/credentialstore.h
|
||||
mirall/logger.h
|
||||
mirall/connectionvalidator.h
|
||||
)
|
||||
|
||||
IF( INOTIFY_FOUND )
|
||||
@@ -115,6 +106,7 @@ qt4_wrap_cpp(syncMoc ${libsync_HEADERS})
|
||||
list(APPEND libsync_LINK_TARGETS
|
||||
${QT_LIBRARIES}
|
||||
${CSYNC_LIBRARY}
|
||||
dl
|
||||
)
|
||||
|
||||
if(QTKEYCHAIN_FOUND)
|
||||
@@ -122,35 +114,36 @@ if(QTKEYCHAIN_FOUND)
|
||||
include_directories(${QTKEYCHAIN_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
add_library(mirallsync SHARED ${libsync_SRCS} ${syncMoc})
|
||||
add_library(owncloudsync SHARED ${libsync_SRCS} ${syncMoc})
|
||||
set_target_properties( owncloudsync PROPERTIES COMPILE_DEFINITIONS OWNCLOUD_CLIENT)
|
||||
set_target_properties( owncloudsync PROPERTIES
|
||||
VERSION ${VERSION}
|
||||
SOVERSION ${SOVERSION}
|
||||
)
|
||||
|
||||
target_link_libraries(mirallsync ${libsync_LINK_TARGETS} )
|
||||
target_link_libraries(owncloudsync ${libsync_LINK_TARGETS} )
|
||||
|
||||
if ( APPLE )
|
||||
target_link_libraries(mirallsync /System/Library/Frameworks/CoreServices.framework)
|
||||
target_link_libraries(owncloudsync /System/Library/Frameworks/CoreServices.framework)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
|
||||
install(TARGETS mirallsync owncloudsync
|
||||
install(TARGETS owncloudsync
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
if(NOT WIN32)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/mirall.desktop.in
|
||||
${APPLICATION_SHORTNAME}.desktop)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_SHORTNAME}.desktop)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_SHORTNAME}.desktop DESTINATION share/applications )
|
||||
endif()
|
||||
else()
|
||||
install(TARGETS mirallsync owncloudsync DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
|
||||
install(TARGETS owncloudsync DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
|
||||
endif()
|
||||
|
||||
set(mirall_SRCS
|
||||
mirall/application.cpp
|
||||
mirall/systray.cpp
|
||||
mirall/folderwizard.cpp
|
||||
mirall/statusdialog.cpp
|
||||
mirall/owncloudwizard.cpp
|
||||
@@ -165,6 +158,7 @@ set(mirall_SRCS
|
||||
|
||||
set(mirall_HEADERS
|
||||
mirall/application.h
|
||||
mirall/systray.h
|
||||
mirall/folderwizard.h
|
||||
mirall/owncloudsetupwizard.h
|
||||
mirall/owncloudwizard.h
|
||||
@@ -183,7 +177,7 @@ if( UNIX AND NOT APPLE)
|
||||
endif()
|
||||
|
||||
# csync is required.
|
||||
include_directories(${CSYNC_INCLUDE_DIR}/csync ${CSYNC_INCLUDE_DIR} ${CMAKE_BINARY_DIR})
|
||||
include_directories(${CSYNC_INCLUDE_DIR}/csync ${CSYNC_INCLUDE_DIR} ${CSYNC_BUILD_PATH}/src)
|
||||
include_directories(${3rdparty_INC})
|
||||
|
||||
qt4_wrap_cpp(mirallMoc ${mirall_HEADERS})
|
||||
@@ -214,8 +208,6 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
|
||||
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
if(NOT WIN32)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/resources/mirall-48.png
|
||||
DESTINATION share/icons/hicolor/48x48/apps/ RENAME mirall.png)
|
||||
install(FILES
|
||||
${theme_dir}/colored/${APPLICATION_SHORTNAME}-icon-48.png
|
||||
DESTINATION share/icons/hicolor/48x48/apps/ RENAME ${APPLICATION_SHORTNAME}.png)
|
||||
@@ -227,22 +219,7 @@ endif(NOT WIN32)
|
||||
|
||||
# add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src})
|
||||
add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src})
|
||||
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES COMPILE_DEFINITIONS OWNCLOUD_CLIENT)
|
||||
|
||||
# mirall is not built for the bundle
|
||||
add_executable( mirall WIN32 main.cpp ${final_src})
|
||||
|
||||
target_link_libraries(mirall ${QT_LIBRARIES} )
|
||||
target_link_libraries(mirall mirallsync)
|
||||
target_link_libraries(mirall ${CSYNC_LIBRARY})
|
||||
|
||||
set_target_properties( mirall PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} )
|
||||
install(TARGETS mirall
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
else()
|
||||
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
include(DeployQt4)
|
||||
@@ -252,7 +229,6 @@ else()
|
||||
|
||||
# we must add MACOSX_BUNDLE only if building a bundle
|
||||
add_executable( ${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${final_src})
|
||||
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES COMPILE_DEFINITIONS OWNCLOUD_CLIENT)
|
||||
|
||||
#FIXME: hardcoded path
|
||||
if ( EXISTS ${CSYNC_BINARY_DIR}/modules/ocsync_owncloud.so )
|
||||
@@ -260,8 +236,13 @@ else()
|
||||
else()
|
||||
install(FILES /usr/local/lib/ocsync-0/ocsync_owncloud.so DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Plugins)
|
||||
endif()
|
||||
install(FILES ${mirall_I18N} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/translations)
|
||||
|
||||
set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
|
||||
install(FILES ${mirall_I18N} DESTINATION ${QM_DIR})
|
||||
file(GLOB qt_I18N ${QT_TRANSLATIONS_DIR}/qt_??.qm ${QT_TRANSLATIONS_DIR}/qt_??_??.qm)
|
||||
install(FILES ${qt_I18N} DESTINATION ${QM_DIR})
|
||||
file(GLOB qtkeychain_I18N ${QT_TRANSLATIONS_DIR}/qtkeychain*.qm)
|
||||
install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR})
|
||||
list(APPEND dirs "/usr/local/lib")
|
||||
endif()
|
||||
|
||||
@@ -280,7 +261,7 @@ install(TARGETS ${APPLICATION_EXECUTABLE}
|
||||
BUNDLE DESTINATION "."
|
||||
)
|
||||
|
||||
#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unneccessary
|
||||
#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
|
||||
# currently it needs to be done because the code right above needs to be executed no matter
|
||||
# if building a bundle or not and the install_qt4_executable needs to be called afterwards
|
||||
if(BUILD_OWNCLOUD_OSX_BUNDLE)
|
||||
|
||||
@@ -32,8 +32,10 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
// if help requested, show on command line and exit.
|
||||
if( ! app.giveHelp() )
|
||||
if( ! app.giveHelp() ) {
|
||||
return app.exec();
|
||||
|
||||
} else {
|
||||
app.showHelp();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#define APPLICATION_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QNetworkReply>
|
||||
#include <QSslError>
|
||||
|
||||
@@ -27,6 +26,7 @@
|
||||
#include "mirall/logbrowser.h"
|
||||
#include "mirall/folderman.h"
|
||||
#include "mirall/fileitemdialog.h"
|
||||
#include "mirall/systray.h"
|
||||
|
||||
class QAction;
|
||||
class QMenu;
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
~Application();
|
||||
|
||||
bool giveHelp();
|
||||
void showHelp();
|
||||
|
||||
signals:
|
||||
|
||||
@@ -60,6 +61,7 @@ protected slots:
|
||||
void slotAddFolder();
|
||||
void slotOpenStatus();
|
||||
void slotRemoveFolder( const QString& );
|
||||
void slotResetFolder( const QString& );
|
||||
void slotEnableFolder( const QString&, const bool );
|
||||
void slotInfoFolder( const QString& );
|
||||
void slotConfigure();
|
||||
@@ -72,15 +74,22 @@ protected slots:
|
||||
protected:
|
||||
|
||||
void parseOptions(const QStringList& );
|
||||
void setupTranslations();
|
||||
void setupActions();
|
||||
void setupSystemTray();
|
||||
void setupContextMenu();
|
||||
void setupLogBrowser();
|
||||
void setupProxy();
|
||||
void enterNextLogFile();
|
||||
|
||||
//folders have to be disabled while making config changes
|
||||
void computeOverallSyncStatus();
|
||||
|
||||
// reimplemented
|
||||
#if defined(Q_WS_WIN)
|
||||
bool winEventFilter( MSG * message, long * result );
|
||||
#endif
|
||||
|
||||
protected slots:
|
||||
void slotTrayClicked( QSystemTrayIcon::ActivationReason );
|
||||
void slotFolderOpenAction(const QString & );
|
||||
@@ -98,11 +107,11 @@ protected slots:
|
||||
void slotStartUpdateDetector();
|
||||
|
||||
private:
|
||||
void showHelp();
|
||||
void setHelp();
|
||||
void raiseDialog( QWidget* );
|
||||
|
||||
// configuration file -> folder
|
||||
QSystemTrayIcon *_tray;
|
||||
Systray *_tray;
|
||||
QAction *_actionQuit;
|
||||
QAction *_actionAddFolder;
|
||||
QAction *_actionOpenStatus;
|
||||
@@ -116,7 +125,7 @@ private:
|
||||
#endif
|
||||
|
||||
FolderWizard *_folderWizard;
|
||||
OwncloudSetupWizard *_owncloudSetupWizard;
|
||||
QScopedPointer<OwncloudSetupWizard> _owncloudSetupWizard;
|
||||
SslErrorDialog *_sslErrorDialog;
|
||||
|
||||
// tray's menu
|
||||
@@ -128,9 +137,10 @@ private:
|
||||
Theme *_theme;
|
||||
QSignalMapper *_folderOpenActionMapper;
|
||||
UpdateDetector *_updateDetector;
|
||||
QMap<QString, QString> _overallStatusStrings;
|
||||
LogBrowser *_logBrowser;
|
||||
QString _logFile;
|
||||
QString _logDirectory;
|
||||
int _logExpire;
|
||||
bool _showLogWindow;
|
||||
bool _logFlush;
|
||||
bool _helpOnly;
|
||||
|
||||
193
src/mirall/connectionvalidator.cpp
Normal file
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* 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 "mirall/connectionvalidator.h"
|
||||
#include "mirall/owncloudinfo.h"
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/theme.h"
|
||||
#include "mirall/credentialstore.h"
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
ConnectionValidator::ConnectionValidator(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ConnectionValidator::ConnectionValidator(const QString& connection, QObject *parent)
|
||||
:_connection(connection)
|
||||
{
|
||||
ownCloudInfo::instance()->setCustomConfigHandle(_connection);
|
||||
}
|
||||
|
||||
QStringList ConnectionValidator::errors() const
|
||||
{
|
||||
return _errors;
|
||||
}
|
||||
|
||||
QString ConnectionValidator::statusString( Status )
|
||||
{
|
||||
return QLatin1String("Get your street creds!");
|
||||
}
|
||||
|
||||
|
||||
void ConnectionValidator::checkConnection()
|
||||
{
|
||||
if( ownCloudInfo::instance()->isConfigured() ) {
|
||||
connect( ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
SLOT(slotStatusFound(QString,QString,QString,QString)));
|
||||
|
||||
connect( ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
SLOT(slotNoStatusFound(QNetworkReply*)));
|
||||
|
||||
// checks for status.php
|
||||
ownCloudInfo::instance()->checkInstallation();
|
||||
} else {
|
||||
emit connectionResult( NotConfigured );
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionValidator::slotStatusFound( const QString& url, const QString& versionStr, const QString& version, const QString& edition)
|
||||
{
|
||||
// status.php was found.
|
||||
qDebug() << "** Application: ownCloud found: " << url << " with version " << versionStr << "(" << version << ")";
|
||||
// now check the authentication
|
||||
MirallConfigFile cfgFile(_connection);
|
||||
|
||||
cfgFile.setOwnCloudVersion( version );
|
||||
// disconnect from ownCloudInfo
|
||||
disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
this, SLOT(slotStatusFound(QString,QString,QString,QString)));
|
||||
|
||||
disconnect( ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
this, SLOT(slotNoStatusFound(QNetworkReply*)));
|
||||
|
||||
if( version.startsWith("4.0") ) {
|
||||
_errors.append( tr("<p>The configured server for this client is too old.</p>"
|
||||
"<p>Please update to the latest server and restart the client.</p>"));
|
||||
emit connectionResult( ServerVersionMismatch );
|
||||
return;
|
||||
}
|
||||
|
||||
QTimer::singleShot( 0, this, SLOT( slotFetchCredentials() ));
|
||||
}
|
||||
|
||||
// status.php could not be loaded.
|
||||
void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
|
||||
{
|
||||
// disconnect from ownCloudInfo
|
||||
disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
this, SLOT(slotStatusFound(QString,QString,QString,QString)));
|
||||
|
||||
disconnect( ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
this, SLOT(slotNoStatusFound(QNetworkReply*)));
|
||||
|
||||
_errors.append( reply->errorString() );
|
||||
emit connectionResult( StatusNotFound );
|
||||
|
||||
}
|
||||
|
||||
void ConnectionValidator::slotFetchCredentials()
|
||||
{
|
||||
if( _connection.isEmpty() ) {
|
||||
if( CredentialStore::instance()->canTryAgain() ) {
|
||||
connect( CredentialStore::instance(), SIGNAL(fetchCredentialsFinished(bool)),
|
||||
this, SLOT(slotCredentialsFetched(bool)) );
|
||||
CredentialStore::instance()->fetchCredentials();
|
||||
}
|
||||
|
||||
if( CredentialStore::instance()->state() == CredentialStore::TooManyAttempts ) {
|
||||
_errors << tr("Too many attempts to get a valid password.");
|
||||
emit connectionResult( CredentialsTooManyAttempts );
|
||||
}
|
||||
} else {
|
||||
// Pull credentials from Mirall config.
|
||||
slotCredentialsFetched( true );
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionValidator::slotCredentialsFetched( bool ok )
|
||||
{
|
||||
qDebug() << "Credentials successfully fetched: " << ok;
|
||||
disconnect( CredentialStore::instance(), SIGNAL(fetchCredentialsFinished(bool)) );
|
||||
|
||||
if( ! ok ) {
|
||||
Status stat;
|
||||
_errors << tr("Error: Could not retrieve the password!");
|
||||
|
||||
if( CredentialStore::instance()->state() == CredentialStore::UserCanceled ) {
|
||||
_errors << tr("Password dialog was canceled!");
|
||||
stat = CredentialsUserCanceled;
|
||||
} else {
|
||||
_errors << CredentialStore::instance()->errorMessage();
|
||||
stat = CredentialError;
|
||||
}
|
||||
|
||||
qDebug() << "Could not fetch credentials" << _errors;
|
||||
|
||||
emit connectionResult( stat );
|
||||
} else {
|
||||
QString user, pwd;
|
||||
if( _connection.isEmpty() ) {
|
||||
user = CredentialStore::instance()->user();
|
||||
pwd = CredentialStore::instance()->password();
|
||||
} else {
|
||||
// in case of reconfiguration, the _connection is set.
|
||||
MirallConfigFile cfg(_connection);
|
||||
user = cfg.ownCloudUser();
|
||||
pwd = cfg.ownCloudPasswd();
|
||||
}
|
||||
ownCloudInfo::instance()->setCredentials( user, pwd );
|
||||
|
||||
// Credential fetched ok.
|
||||
QTimer::singleShot( 0, this, SLOT( slotCheckAuthentication() ));
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionValidator::slotCheckAuthentication()
|
||||
{
|
||||
connect( ownCloudInfo::instance(), SIGNAL(ownCloudDirExists(QString,QNetworkReply*)),
|
||||
this, SLOT(slotAuthCheck(QString,QNetworkReply*)));
|
||||
|
||||
qDebug() << "# checking for authentication settings.";
|
||||
ownCloudInfo::instance()->getRequest(QLatin1String("/"), true ); // this call needs to be authenticated.
|
||||
// simply GET the webdav root, will fail if credentials are wrong.
|
||||
// continue in slotAuthCheck here :-)
|
||||
}
|
||||
|
||||
void ConnectionValidator::slotAuthCheck( const QString& ,QNetworkReply *reply )
|
||||
{
|
||||
bool ok = true;
|
||||
Status stat = Connected;
|
||||
|
||||
if( reply->error() == QNetworkReply::AuthenticationRequiredError ||
|
||||
reply->error() == QNetworkReply::OperationCanceledError ) { // returned if the user is wrong.
|
||||
qDebug() << "******** Password is wrong!";
|
||||
_errors << "The provided credentials are wrong.";
|
||||
stat = CredentialsWrong;
|
||||
ok = false;
|
||||
}
|
||||
|
||||
// disconnect from ownCloud Info signals
|
||||
disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudDirExists(QString,QNetworkReply*)),
|
||||
this,SLOT(slotAuthCheck(QString,QNetworkReply*)));
|
||||
|
||||
emit connectionResult( stat );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
73
src/mirall/connectionvalidator.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 CONNECTIONVALIDATOR_H
|
||||
#define CONNECTIONVALIDATOR_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
class ConnectionValidator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConnectionValidator(QObject *parent = 0);
|
||||
explicit ConnectionValidator(const QString& connection, QObject *parent = 0);
|
||||
|
||||
enum Status {
|
||||
Undefined,
|
||||
Connected,
|
||||
NotConfigured,
|
||||
ServerVersionMismatch,
|
||||
CredentialsTooManyAttempts,
|
||||
CredentialError,
|
||||
CredentialsUserCanceled,
|
||||
CredentialsWrong,
|
||||
StatusNotFound
|
||||
|
||||
};
|
||||
|
||||
QStringList errors() const;
|
||||
|
||||
void checkConnection();
|
||||
|
||||
QString statusString( Status );
|
||||
|
||||
signals:
|
||||
void connectionResult( ConnectionValidator::Status );
|
||||
void connectionAvailable();
|
||||
void connectionFailed();
|
||||
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
void slotStatusFound( const QString&, const QString&, const QString&, const QString& );
|
||||
void slotNoStatusFound(QNetworkReply *);
|
||||
|
||||
void slotFetchCredentials();
|
||||
void slotCredentialsFetched( bool );
|
||||
void slotCheckAuthentication();
|
||||
void slotAuthCheck( const QString& ,QNetworkReply * );
|
||||
|
||||
private:
|
||||
QStringList _errors;
|
||||
QString _connection;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // CONNECTIONVALIDATOR_H
|
||||
@@ -1,213 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CreateAnOwncloudPage</class>
|
||||
<widget class="QWidget" name="CreateAnOwncloudPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>539</width>
|
||||
<height>346</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../mirall.qrc">:/mirall/resources/mirall-32.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create a new ownCloud</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Where do you want to create your ownCloud?</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="createLocalRadioBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>create ownCloud on this computer</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#585858;">installs the ownCloud on this computer. Other people will not be able to access your data by default.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="createPerFTPRadioBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<underline>false</underline>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>create ownCloud on my internet domain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#585858;">installs ownCloud on a domain you control. You need the FTP credentials for the installation.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#585858;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#585858;">This ownCloud will be accessible from the internet.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&Domain:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>myDomainEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLineEdit" name="myDomainEdit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>388</width>
|
||||
<height>72</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../mirall.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@@ -19,6 +20,11 @@
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/theme.h"
|
||||
|
||||
#ifdef WITH_QTKEYCHAIN
|
||||
#include <qtkeychain/keychain.h>
|
||||
using namespace QKeychain;
|
||||
#endif
|
||||
|
||||
#define MAX_LOGIN_ATTEMPTS 3
|
||||
|
||||
namespace Mirall {
|
||||
@@ -47,11 +53,11 @@ CredentialStore *CredentialStore::instance()
|
||||
return CredentialStore::_instance;
|
||||
}
|
||||
|
||||
QString CredentialStore::password( const QString& ) const
|
||||
QString CredentialStore::password() const
|
||||
{
|
||||
return _passwd;
|
||||
}
|
||||
QString CredentialStore::user( const QString& ) const
|
||||
QString CredentialStore::user() const
|
||||
{
|
||||
return _user;
|
||||
}
|
||||
@@ -63,30 +69,18 @@ CredentialStore::CredState CredentialStore::state()
|
||||
|
||||
bool CredentialStore::canTryAgain()
|
||||
{
|
||||
bool canDoIt = false;
|
||||
|
||||
if( _tries > MAX_LOGIN_ATTEMPTS ) {
|
||||
qDebug() << "canTryAgain: Max attempts reached.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if( _state == NotFetched ) {
|
||||
/* Since QtKeyChain is required now, it makes sense to only query once. */
|
||||
if( _state == NotFetched || _state == AsyncWriting ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch( _type ) {
|
||||
case CredentialStore::User:
|
||||
canDoIt = true;
|
||||
break;
|
||||
case CredentialStore::Settings:
|
||||
break;
|
||||
case CredentialStore::KeyChain:
|
||||
canDoIt = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return canDoIt;
|
||||
}
|
||||
|
||||
void CredentialStore::fetchCredentials()
|
||||
@@ -103,6 +97,9 @@ void CredentialStore::fetchCredentials()
|
||||
QString pwd;
|
||||
_user = cfgFile.ownCloudUser();
|
||||
_url = cfgFile.ownCloudUrl();
|
||||
if( !cfgFile.passwordStorageAllowed() ) {
|
||||
_type = CredentialStore::User;
|
||||
}
|
||||
|
||||
QString key = keyChainKey(_url);
|
||||
|
||||
@@ -117,15 +114,16 @@ void CredentialStore::fetchCredentials()
|
||||
case CredentialStore::User: {
|
||||
/* Ask the user for the password */
|
||||
/* Fixme: Move user interaction out here. */
|
||||
_state = Fetching;
|
||||
pwd = QInputDialog::getText(0, QApplication::translate("MirallConfigFile","Password Required"),
|
||||
QApplication::translate("MirallConfigFile","Please enter your %1 password:")
|
||||
.arg(Theme::instance()->appName()),
|
||||
QLineEdit::Password,
|
||||
QString::null, &ok);
|
||||
if( !ok ) {
|
||||
_state = UserCanceled;
|
||||
}
|
||||
_state = AsyncFetching;
|
||||
_inputDialog = new QInputDialog;
|
||||
_inputDialog->setWindowTitle(QApplication::translate("MirallConfigFile","Password Required") );
|
||||
_inputDialog->setLabelText( QApplication::translate("MirallConfigFile","Please enter your %1 password:")
|
||||
.arg(Theme::instance()->appNameGUI()));
|
||||
_inputDialog->setInputMode( QInputDialog::TextInput );
|
||||
_inputDialog->setTextEchoMode( QLineEdit::Password );
|
||||
|
||||
connect(_inputDialog, SIGNAL(finished(int)), SLOT(slotUserDialogDone(int)));
|
||||
_inputDialog->open();
|
||||
break;
|
||||
}
|
||||
case CredentialStore::Settings: {
|
||||
@@ -137,7 +135,7 @@ void CredentialStore::fetchCredentials()
|
||||
}
|
||||
case CredentialStore::KeyChain: {
|
||||
// If the credentials are here already, return.
|
||||
if( _state == Ok ) {
|
||||
if( _state == Ok || _state == AsyncWriting ) {
|
||||
emit(fetchCredentialsFinished(true));
|
||||
return;
|
||||
}
|
||||
@@ -179,6 +177,19 @@ void CredentialStore::fetchCredentials()
|
||||
}
|
||||
}
|
||||
|
||||
void CredentialStore::slotUserDialogDone( int result )
|
||||
{
|
||||
if( result == QDialog::Accepted ) {
|
||||
_passwd = _inputDialog->textValue();
|
||||
_state = Ok;
|
||||
} else {
|
||||
_state = UserCanceled;
|
||||
_passwd = QString::null;
|
||||
}
|
||||
_inputDialog->deleteLater();
|
||||
emit(fetchCredentialsFinished(_state == Ok));
|
||||
}
|
||||
|
||||
void CredentialStore::reset()
|
||||
{
|
||||
_state = NotFetched;
|
||||
@@ -281,19 +292,20 @@ QString CredentialStore::errorMessage()
|
||||
return _errorMsg;
|
||||
}
|
||||
|
||||
QByteArray CredentialStore::basicAuthHeader() const
|
||||
{
|
||||
QString concatenated = _user + QLatin1Char(':') + _passwd;
|
||||
const QString b(QLatin1String("Basic "));
|
||||
QByteArray data = b.toLocal8Bit() + concatenated.toLocal8Bit().toBase64();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void CredentialStore::setCredentials( const QString& url, const QString& user, const QString& pwd )
|
||||
void CredentialStore::setCredentials( const QString& url, const QString& user,
|
||||
const QString& pwd, bool allowToStore )
|
||||
{
|
||||
_passwd = pwd;
|
||||
_user = user;
|
||||
if( allowToStore ) {
|
||||
#ifdef WITH_QTKEYCHAIN
|
||||
_type = KeyChain;
|
||||
#else
|
||||
_type = Settings;
|
||||
#endif
|
||||
} else {
|
||||
_type = User;
|
||||
}
|
||||
_url = url;
|
||||
_state = Ok;
|
||||
}
|
||||
@@ -323,6 +335,7 @@ void CredentialStore::saveCredentials( )
|
||||
|
||||
connect( job, SIGNAL(finished(QKeychain::Job*)), this,
|
||||
SLOT(slotKeyChainWriteFinished(QKeychain::Job*)));
|
||||
_state = AsyncWriting;
|
||||
job->start();
|
||||
#endif
|
||||
break;
|
||||
@@ -347,17 +360,23 @@ void CredentialStore::slotKeyChainWriteFinished( QKeychain::Job *job )
|
||||
qDebug() << "Error with keychain: " << pwdJob->errorString();
|
||||
if( err == NoBackendAvailable || err == NotImplemented ||
|
||||
pwdJob->errorString().contains(QLatin1String("Could not open wallet"))) {
|
||||
_state = NoKeychainBackend;
|
||||
_type = Settings;
|
||||
saveCredentials();
|
||||
} else {
|
||||
_state = Error;
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Successfully stored password for user " << _user;
|
||||
// Try to remove password formerly stored in the config file.
|
||||
MirallConfigFile cfgFile;
|
||||
cfgFile.clearPasswordFromConfig();
|
||||
_state = NotFetched;
|
||||
_tries = 0;
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Error: KeyChain Write Password Job failed!";
|
||||
_state = Error;
|
||||
}
|
||||
#else
|
||||
(void) job;
|
||||
|
||||
@@ -14,21 +14,12 @@
|
||||
#ifndef CREDENTIALSTORE_H
|
||||
#define CREDENTIALSTORE_H
|
||||
|
||||
#include "config.h"
|
||||
#include <QObject>
|
||||
#include <QInputDialog>
|
||||
|
||||
#ifdef WITH_QTKEYCHAIN
|
||||
#include "qtkeychain/keychain.h"
|
||||
|
||||
using namespace QKeychain;
|
||||
#else
|
||||
// FIXME: If the slot definition below is ifdefed for some reason the slot is
|
||||
// not there even if WITH_QTKEYCHAIN is defined.
|
||||
namespace QKeychain {
|
||||
typedef void Job;
|
||||
class Job;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
@@ -66,6 +57,7 @@ public:
|
||||
AccessDenied,
|
||||
NoKeychainBackend,
|
||||
Error,
|
||||
AsyncWriting,
|
||||
TooManyAttempts };
|
||||
|
||||
enum CredentialType {
|
||||
@@ -74,8 +66,8 @@ public:
|
||||
KeyChain
|
||||
};
|
||||
|
||||
QString password( const QString& connection = QString::null ) const;
|
||||
QString user( const QString& connection = QString::null ) const;
|
||||
QString password( ) const;
|
||||
QString user( ) const;
|
||||
|
||||
/**
|
||||
* @brief state
|
||||
@@ -91,12 +83,6 @@ public:
|
||||
*/
|
||||
void fetchCredentials();
|
||||
|
||||
/**
|
||||
* @brief basicAuthHeader - return a basic authentication header.
|
||||
* @return a QByteArray with a ready to use Header for HTTP basic auth.
|
||||
*/
|
||||
QByteArray basicAuthHeader() const;
|
||||
|
||||
/**
|
||||
* @brief instance - singleton pointer.
|
||||
* @return the singleton pointer to access the object.
|
||||
@@ -109,10 +95,11 @@ public:
|
||||
* This function is called from the setup wizard to set the credentials
|
||||
* int this store. Note that it does not store the password.
|
||||
* The function also sets the state to ok.
|
||||
* @param url - the connection url
|
||||
* @param user - the user name
|
||||
* @param password - the password.
|
||||
*/
|
||||
void setCredentials( const QString&, const QString&, const QString& );
|
||||
void setCredentials( const QString&, const QString&, const QString&, bool );
|
||||
|
||||
void saveCredentials( );
|
||||
|
||||
@@ -138,6 +125,7 @@ signals:
|
||||
protected slots:
|
||||
void slotKeyChainReadFinished( QKeychain::Job* );
|
||||
void slotKeyChainWriteFinished( QKeychain::Job* );
|
||||
void slotUserDialogDone(int);
|
||||
|
||||
private:
|
||||
explicit CredentialStore(QObject *parent = 0);
|
||||
@@ -152,6 +140,7 @@ private:
|
||||
static QString _errorMsg;
|
||||
static int _tries;
|
||||
static CredentialType _type;
|
||||
QInputDialog *_inputDialog;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 "mirall/csyncfolder.h"
|
||||
#include "mirall/csyncthread.h"
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
|
||||
#include <csync.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QMutexLocker>
|
||||
#include <QThread>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
CSyncFolder::CSyncFolder(const QString &alias,
|
||||
const QString &path,
|
||||
const QString &secondPath,
|
||||
QObject *parent)
|
||||
: Folder(alias, path, secondPath, parent)
|
||||
, _csync(0)
|
||||
, _thread(0)
|
||||
, _csyncError(false)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
CSyncFolder::~CSyncFolder()
|
||||
{
|
||||
}
|
||||
|
||||
bool CSyncFolder::isBusy() const
|
||||
{
|
||||
return (_csync && _thread && _thread->isRunning() );
|
||||
}
|
||||
|
||||
void CSyncFolder::startSync(const QStringList &pathList)
|
||||
{
|
||||
if (_thread && _thread->isRunning()) {
|
||||
qCritical() << "* ERROR csync is still running and new sync requested.";
|
||||
return;
|
||||
}
|
||||
delete _csync;
|
||||
delete _thread;
|
||||
_errors.clear();
|
||||
_csyncError = false;
|
||||
|
||||
_thread = new QThread(this);
|
||||
_csync = new CSyncThread( path(), secondPath() );
|
||||
connect(_csync, SIGNAL(started()), SLOT(slotCSyncStarted()), Qt::QueuedConnection);
|
||||
connect(_csync, SIGNAL(finished()), SLOT(slotCSyncFinished()), Qt::QueuedConnection);
|
||||
connect(_csync, SIGNAL(csyncError(QString)), SLOT(slotCSyncError(QString)), Qt::QueuedConnection);
|
||||
_csync->moveToThread(_thread);
|
||||
_thread->start();
|
||||
QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void CSyncFolder::slotTerminateSync()
|
||||
{
|
||||
if( _thread ) {
|
||||
_thread->terminate();
|
||||
}
|
||||
}
|
||||
|
||||
void CSyncFolder::slotCSyncStarted()
|
||||
{
|
||||
qDebug() << " * csync thread started";
|
||||
emit syncStarted();
|
||||
}
|
||||
|
||||
void CSyncFolder::slotCSyncFinished()
|
||||
{
|
||||
SyncResult res(SyncResult::Success);
|
||||
if( _csyncError ) {
|
||||
res.setStatus( SyncResult::Error );
|
||||
res.setErrorString( _errors.join(QLatin1String("\n")));
|
||||
}
|
||||
emit syncFinished( res );
|
||||
}
|
||||
|
||||
void CSyncFolder::slotCSyncError( const QString& errorStr )
|
||||
{
|
||||
_errors.append( errorStr );
|
||||
_csyncError = true;
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#ifndef CSYNCFOLDER_H
|
||||
#define CSYNCFOLDER_H
|
||||
|
||||
/*
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
* 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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
|
||||
#include "mirall/csyncthread.h"
|
||||
#include "mirall/folder.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QString>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
|
||||
class CSyncFolder : public Folder
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSyncFolder(const QString &alias,
|
||||
const QString &path,
|
||||
const QString &secondPath, QObject *parent = 0L);
|
||||
virtual ~CSyncFolder();
|
||||
virtual void startSync(const QStringList &pathList);
|
||||
virtual bool isBusy() const;
|
||||
|
||||
public slots:
|
||||
void slotTerminateSync();
|
||||
|
||||
protected slots:
|
||||
void slotCSyncStarted();
|
||||
void slotCSyncFinished();
|
||||
void slotCSyncError( const QString& );
|
||||
private:
|
||||
bool _csyncError;
|
||||
CSyncThread *_csync;
|
||||
QThread *_thread;
|
||||
QStringList _errors;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/theme.h"
|
||||
#include "mirall/logger.h"
|
||||
#include "mirall/utility.h"
|
||||
#include "mirall/owncloudinfo.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -26,6 +25,8 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QSslSocket>
|
||||
#include <QDir>
|
||||
@@ -41,30 +42,14 @@
|
||||
namespace Mirall {
|
||||
|
||||
/* static variables to hold the credentials */
|
||||
QString CSyncThread::_user;
|
||||
QString CSyncThread::_passwd;
|
||||
QNetworkProxy CSyncThread::_proxy;
|
||||
|
||||
QString CSyncThread::_csyncConfigDir; // to be able to remove the lock file.
|
||||
|
||||
QMutex CSyncThread::_mutex;
|
||||
QMutex CSyncThread::_syncMutex;
|
||||
|
||||
void csyncLogCatcher(CSYNC *ctx,
|
||||
int verbosity,
|
||||
const char *function,
|
||||
const char *buffer,
|
||||
void *userdata)
|
||||
{
|
||||
Logger::instance()->csyncLog( QString::fromUtf8(buffer) );
|
||||
}
|
||||
|
||||
CSyncThread::CSyncThread(const QString &source, const QString &target)
|
||||
: _source(source)
|
||||
, _target(target)
|
||||
|
||||
CSyncThread::CSyncThread(CSYNC *csync)
|
||||
{
|
||||
_mutex.lock();
|
||||
if( ! _source.endsWith(QLatin1Char('/'))) _source.append(QLatin1Char('/'));
|
||||
_csync_ctx = csync;
|
||||
_mutex.unlock();
|
||||
}
|
||||
|
||||
@@ -73,6 +58,8 @@ CSyncThread::~CSyncThread()
|
||||
|
||||
}
|
||||
|
||||
//Convert an error code from csync to a user readable string.
|
||||
// Keep that function thread safe as it can be called from the sync thread or the main thread
|
||||
QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errString )
|
||||
{
|
||||
QString errStr;
|
||||
@@ -91,7 +78,7 @@ QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errSt
|
||||
errStr = tr("CSync failed to load the state db.");
|
||||
break;
|
||||
case CSYNC_ERR_MODULE:
|
||||
errStr = tr("<p>The %1 plugin for csync could not be loaded.<br/>Please verify the installation!</p>").arg(Theme::instance()->appName());
|
||||
errStr = tr("<p>The %1 plugin for csync could not be loaded.<br/>Please verify the installation!</p>").arg(Theme::instance()->appNameGUI());
|
||||
break;
|
||||
case CSYNC_ERR_TIMESKEW:
|
||||
errStr = tr("The system time on this client is different than the system time on the server. "
|
||||
@@ -120,9 +107,7 @@ QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errSt
|
||||
errStr = tr("CSync processing step propagate failed.");
|
||||
break;
|
||||
case CSYNC_ERR_ACCESS_FAILED:
|
||||
errStr = tr("<p>The target directory %1 does not exist.</p><p>Please check the sync setup.</p>").arg(_target);
|
||||
// this is critical. The database has to be removed.
|
||||
emit wipeDb();
|
||||
errStr = tr("<p>The target directory does not exist.</p><p>Please check the sync setup.</p>");
|
||||
break;
|
||||
case CSYNC_ERR_REMOTE_CREATE:
|
||||
case CSYNC_ERR_REMOTE_STAT:
|
||||
@@ -139,7 +124,7 @@ QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errSt
|
||||
errStr = tr("CSync failed to lookup proxy or server.");
|
||||
break;
|
||||
case CSYNC_ERR_AUTH_SERVER:
|
||||
errStr = tr("CSync failed to authenticate at the %1 server.").arg(Theme::instance()->appName());
|
||||
errStr = tr("CSync failed to authenticate at the %1 server.").arg(Theme::instance()->appNameGUI());
|
||||
break;
|
||||
case CSYNC_ERR_AUTH_PROXY:
|
||||
errStr = tr("CSync failed to authenticate at the proxy.");
|
||||
@@ -163,7 +148,7 @@ QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errSt
|
||||
errStr = tr("CSync tried to create a directory that already exists.");
|
||||
break;
|
||||
case CSYNC_ERR_NOSPC:
|
||||
errStr = tr("CSync: No space on %1 server available.").arg(Theme::instance()->appName());
|
||||
errStr = tr("CSync: No space on %1 server available.").arg(Theme::instance()->appNameGUI());
|
||||
break;
|
||||
case CSYNC_ERR_UNSPEC:
|
||||
errStr = tr("CSync unspecified error.");
|
||||
@@ -179,26 +164,6 @@ QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errSt
|
||||
|
||||
}
|
||||
|
||||
const char* CSyncThread::proxyTypeToCStr(QNetworkProxy::ProxyType type)
|
||||
{
|
||||
switch (type) {
|
||||
case QNetworkProxy::NoProxy:
|
||||
return "NoProxy";
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
return "DefaultProxy";
|
||||
case QNetworkProxy::Socks5Proxy:
|
||||
return "Socks5Proxy";
|
||||
case QNetworkProxy::HttpProxy:
|
||||
return "HttpProxy";
|
||||
case QNetworkProxy::HttpCachingProxy:
|
||||
return "HttpCachingProxy";
|
||||
case QNetworkProxy::FtpCachingProxy:
|
||||
return "FtpCachingProxy";
|
||||
default:
|
||||
return "NoProxy";
|
||||
}
|
||||
}
|
||||
|
||||
int CSyncThread::treewalkLocal( TREE_WALK_FILE* file, void *data )
|
||||
{
|
||||
return static_cast<CSyncThread*>(data)->treewalkFile( file, false );
|
||||
@@ -226,6 +191,19 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
|
||||
|
||||
int re = 0;
|
||||
|
||||
if (file->instruction != CSYNC_INSTRUCTION_IGNORE
|
||||
&& file->instruction != CSYNC_INSTRUCTION_REMOVE) {
|
||||
_hasFiles = true;
|
||||
}
|
||||
|
||||
switch(file->instruction) {
|
||||
case CSYNC_INSTRUCTION_NONE:
|
||||
case CSYNC_INSTRUCTION_IGNORE:
|
||||
break;
|
||||
default:
|
||||
if (!_needsUpdate)
|
||||
_needsUpdate = true;
|
||||
}
|
||||
switch(file->instruction) {
|
||||
case CSYNC_INSTRUCTION_NONE:
|
||||
// No need to do anything.
|
||||
@@ -271,214 +249,129 @@ int CSyncThread::treewalkError(TREE_WALK_FILE* file)
|
||||
if ( indx == -1 )
|
||||
return 0;
|
||||
|
||||
if( item._instruction == CSYNC_INSTRUCTION_STAT_ERROR ||
|
||||
item._instruction == CSYNC_INSTRUCTION_ERROR ) {
|
||||
if( file &&
|
||||
(file->instruction == CSYNC_INSTRUCTION_STAT_ERROR ||
|
||||
file->instruction == CSYNC_INSTRUCTION_ERROR) ) {
|
||||
_mutex.lock();
|
||||
_syncedItems[indx]._instruction = item._instruction;
|
||||
_syncedItems[indx]._instruction = file->instruction;
|
||||
_mutex.unlock();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct CSyncRunScopeHelper {
|
||||
CSyncRunScopeHelper(CSYNC *ctx, CSyncThread *parent)
|
||||
: _ctx(ctx), _parent(parent)
|
||||
{
|
||||
_t.start();
|
||||
}
|
||||
~CSyncRunScopeHelper() {
|
||||
csync_commit(_ctx);
|
||||
|
||||
qDebug() << "CSync run took " << _t.elapsed() << " Milliseconds";
|
||||
emit(_parent->finished());
|
||||
_parent->_syncMutex.unlock();
|
||||
}
|
||||
CSYNC *_ctx;
|
||||
QTime _t;
|
||||
CSyncThread *_parent;
|
||||
};
|
||||
|
||||
void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
|
||||
CSYNC_ERROR_CODE err = csync_get_error( ctx );
|
||||
const char *errMsg = csync_get_error_string( ctx );
|
||||
QString errStr = csyncErrorToString(err, errMsg);
|
||||
qDebug() << " #### ERROR during "<< state << ": " << errStr;
|
||||
switch (err) {
|
||||
case CSYNC_ERR_SERVICE_UNAVAILABLE:
|
||||
case CSYNC_ERR_CONNECT:
|
||||
emit csyncUnavailable();
|
||||
break;
|
||||
default:
|
||||
emit csyncError(errStr);
|
||||
}
|
||||
}
|
||||
|
||||
void CSyncThread::startSync()
|
||||
{
|
||||
qDebug() << "starting to sync " << qApp->thread() << QThread::currentThread();
|
||||
CSYNC *csync;
|
||||
bool doTreeWalk = true;
|
||||
int proxyPort = _proxy.port();
|
||||
if (!_syncMutex.tryLock()) {
|
||||
qDebug() << Q_FUNC_INFO << "WARNING: Another sync seems to be running. Not starting a new one.";
|
||||
return;
|
||||
}
|
||||
|
||||
emit(started());
|
||||
if( ! _csync_ctx ) {
|
||||
qDebug() << "XXXXXXXXXXXXXXXX FAIL: do not have csync_ctx!";
|
||||
}
|
||||
qDebug() << Q_FUNC_INFO << "Sync started";
|
||||
|
||||
qDebug() << "starting to sync " << qApp->thread() << QThread::currentThread();
|
||||
|
||||
_mutex.lock();
|
||||
_syncedItems.clear();
|
||||
|
||||
if( csync_create(&csync,
|
||||
_source.toUtf8().data(),
|
||||
_target.toUtf8().data()) < 0 ) {
|
||||
emit csyncError( tr("CSync create failed.") );
|
||||
}
|
||||
_csyncConfigDir = QString::fromUtf8( csync_get_config_dir( csync ));
|
||||
_needsUpdate = false;
|
||||
_mutex.unlock();
|
||||
|
||||
csync_enable_conflictcopys(csync);
|
||||
// cleans up behind us and emits finished() to ease error handling
|
||||
CSyncRunScopeHelper helper(_csync_ctx, this);
|
||||
|
||||
MirallConfigFile cfg;
|
||||
QString excludeList = cfg.excludeFile();
|
||||
csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx);
|
||||
csync_set_userdata(_csync_ctx, this);
|
||||
|
||||
if( !excludeList.isEmpty() ) {
|
||||
qDebug() << "==== added CSync exclude List: " << excludeList.toUtf8();
|
||||
csync_add_exclude_list( csync, excludeList.toUtf8() );
|
||||
}
|
||||
|
||||
csync_set_config_dir( csync, cfg.configPath().toUtf8() );
|
||||
|
||||
QTime t;
|
||||
t.start();
|
||||
|
||||
csync_set_userdata(csync, this);
|
||||
|
||||
csync_set_log_callback( csync, csyncLogCatcher );
|
||||
csync_set_auth_callback( csync, getauth );
|
||||
csync_set_progress_callback( csync, progress );
|
||||
|
||||
if( csync_init(csync) < 0 ) {
|
||||
CSYNC_ERROR_CODE err = csync_get_error( csync );
|
||||
const char *errMsg = csync_get_error_string( csync );
|
||||
QString errStr = csyncErrorToString(err, errMsg );
|
||||
qDebug() << " #### ERROR csync_init: " << errStr;
|
||||
emit csyncError(errStr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// set module properties, mainly the proxy information.
|
||||
// do not use QLatin1String here because that has to be real const char* for C.
|
||||
csync_set_log_verbosity(csync, 11);
|
||||
csync_set_module_property(csync, "csync_context", csync);
|
||||
csync_set_module_property(csync, "proxy_type", (char*) proxyTypeToCStr(_proxy.type()) );
|
||||
csync_set_module_property(csync, "proxy_host", _proxy.hostName().toUtf8().data() );
|
||||
csync_set_module_property(csync, "proxy_port", &proxyPort );
|
||||
csync_set_module_property(csync, "proxy_user", _proxy.user().toUtf8().data() );
|
||||
csync_set_module_property(csync, "proxy_pwd" , _proxy.password().toUtf8().data() );
|
||||
// csync_set_auth_callback( _csync_ctx, getauth );
|
||||
csync_set_progress_callback( _csync_ctx, progress );
|
||||
|
||||
qDebug() << "#### Update start #################################################### >>";
|
||||
if( csync_update(csync) < 0 ) {
|
||||
CSYNC_ERROR_CODE err = csync_get_error( csync );
|
||||
const char *errMsg = csync_get_error_string( csync );
|
||||
QString errStr = csyncErrorToString(err, errMsg);
|
||||
qDebug() << " #### ERROR csync_update: " << errStr;
|
||||
if (err == CSYNC_ERR_SERVICE_UNAVAILABLE)
|
||||
emit csyncUnavailable();
|
||||
else
|
||||
emit csyncError(errStr);
|
||||
goto cleanup;
|
||||
if( csync_update(_csync_ctx) < 0 ) {
|
||||
handleSyncError(_csync_ctx, "csync_update");
|
||||
return;
|
||||
}
|
||||
qDebug() << "<<#### Update end ###########################################################";
|
||||
|
||||
|
||||
|
||||
if( csync_reconcile(csync) < 0 ) {
|
||||
CSYNC_ERROR_CODE err = csync_get_error( csync );
|
||||
const char *errMsg = csync_get_error_string( csync );
|
||||
QString errStr = csyncErrorToString(err, errMsg);
|
||||
qDebug() << " #### ERROR csync_reconcile: " << errStr;
|
||||
emit csyncError(errStr);
|
||||
goto cleanup;
|
||||
if( csync_reconcile(_csync_ctx) < 0 ) {
|
||||
handleSyncError(_csync_ctx, "cysnc_reconcile");
|
||||
return;
|
||||
}
|
||||
|
||||
if( csync_walk_local_tree(csync, &treewalkLocal, 0) < 0 ) {
|
||||
qDebug() << "Error in local treewalk.";
|
||||
doTreeWalk = false;
|
||||
_hasFiles = false;
|
||||
bool walkOk = true;
|
||||
if( csync_walk_local_tree(_csync_ctx, &treewalkLocal, 0) < 0 ) {
|
||||
qDebug() << "Error in local treewalk.";
|
||||
walkOk = false;
|
||||
}
|
||||
if( doTreeWalk && csync_walk_remote_tree(csync, &treewalkRemote, 0) < 0 ) {
|
||||
qDebug() << "Error in remote treewalk.";
|
||||
doTreeWalk = false;
|
||||
if( walkOk && csync_walk_remote_tree(_csync_ctx, &treewalkRemote, 0) < 0 ) {
|
||||
qDebug() << "Error in remote treewalk.";
|
||||
}
|
||||
|
||||
if( csync_propagate(csync) < 0 ) {
|
||||
CSYNC_ERROR_CODE err = csync_get_error( csync );
|
||||
const char *errMsg = csync_get_error_string( csync );
|
||||
QString errStr = csyncErrorToString(err, errMsg);
|
||||
qDebug() << " #### ERROR csync_propagate: " << errStr;
|
||||
if (err == CSYNC_ERR_SERVICE_UNAVAILABLE)
|
||||
emit csyncUnavailable();
|
||||
else
|
||||
emit csyncError(errStr);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if( csync_walk_local_tree(csync, &walkFinalize, 0) < 0 ||
|
||||
csync_walk_remote_tree( csync, &walkFinalize, 0 ) < 0 ) {
|
||||
qDebug() << "Error in finalize treewalk.";
|
||||
} else {
|
||||
// emit the treewalk results.
|
||||
emit treeWalkResult(_syncedItems);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
csync_destroy(csync);
|
||||
|
||||
qDebug() << "CSync run took " << t.elapsed() << " Milliseconds";
|
||||
emit(finished());
|
||||
}
|
||||
|
||||
void CSyncThread::setConnectionDetails( const QString &user, const QString &passwd, const QNetworkProxy &proxy )
|
||||
{
|
||||
_mutex.lock();
|
||||
_user = user;
|
||||
_passwd = passwd;
|
||||
_proxy = proxy;
|
||||
_mutex.unlock();
|
||||
}
|
||||
|
||||
QString CSyncThread::csyncConfigDir()
|
||||
{
|
||||
return _csyncConfigDir;
|
||||
}
|
||||
|
||||
int CSyncThread::getauth(const char *prompt,
|
||||
char *buf,
|
||||
size_t len,
|
||||
int echo,
|
||||
int verify,
|
||||
void *userdata
|
||||
)
|
||||
{
|
||||
int re = 0;
|
||||
|
||||
QString qPrompt = QString::fromLatin1( prompt ).trimmed();
|
||||
|
||||
if( qPrompt == QLatin1String("Enter your username:") ) {
|
||||
// qDebug() << "OOO Username requested!";
|
||||
QMutexLocker locker( &_mutex );
|
||||
qstrncpy( buf, _user.toUtf8().constData(), len );
|
||||
} else if( qPrompt == QLatin1String("Enter your password:") ) {
|
||||
QMutexLocker locker( &_mutex );
|
||||
// qDebug() << "OOO Password requested!";
|
||||
qstrncpy( buf, _passwd.toUtf8().constData(), len );
|
||||
} else {
|
||||
if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) {
|
||||
// SSL is requested. If the program came here, the SSL check was done by mirall
|
||||
// It needs to be checked if the chain is still equal to the one which
|
||||
// was verified by the user.
|
||||
QRegExp regexp("fingerprint: ([\\w\\d:]+)");
|
||||
bool certOk = false;
|
||||
|
||||
int pos = 0;
|
||||
|
||||
|
||||
// This is the set of certificates which QNAM accepted, so we should accept
|
||||
// them as well
|
||||
QList<QSslCertificate> certs = ownCloudInfo::instance()->certificateChain();
|
||||
|
||||
while (!certOk && (pos = regexp.indexIn(qPrompt, 1+pos)) != -1) {
|
||||
QString neon_fingerprint = regexp.cap(1);
|
||||
|
||||
foreach( const QSslCertificate& c, certs ) {
|
||||
QString verified_shasum = Utility::formatFingerprint(c.digest(QCryptographicHash::Sha1).toHex());
|
||||
qDebug() << "SSL Fingerprint from neon: " << neon_fingerprint << " compared to verified: " << verified_shasum;
|
||||
if( verified_shasum == neon_fingerprint ) {
|
||||
certOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// certOk = false; DEBUG setting, keep disabled!
|
||||
if( !certOk ) { // Problem!
|
||||
qstrcpy( buf, "no" );
|
||||
re = -1;
|
||||
} else {
|
||||
qstrcpy( buf, "yes" ); // Certificate is fine!
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Unknown prompt: <" << prompt << ">";
|
||||
re = -1;
|
||||
if (!_hasFiles && !_syncedItems.isEmpty()) {
|
||||
qDebug() << Q_FUNC_INFO << "All the files are going to be removed, asking the user";
|
||||
bool cancel = true;
|
||||
emit aboutToRemoveAllFiles(_syncedItems.first()._dir, &cancel);
|
||||
if (cancel) {
|
||||
qDebug() << Q_FUNC_INFO << "Abort sync";
|
||||
return;
|
||||
}
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
if (_needsUpdate)
|
||||
emit(started());
|
||||
|
||||
if( csync_propagate(_csync_ctx) < 0 ) {
|
||||
handleSyncError(_csync_ctx, "cysnc_reconcile");
|
||||
return;
|
||||
}
|
||||
|
||||
if( walkOk ) {
|
||||
if( csync_walk_local_tree(_csync_ctx, &walkFinalize, 0) < 0 ||
|
||||
csync_walk_remote_tree( _csync_ctx, &walkFinalize, 0 ) < 0 ) {
|
||||
qDebug() << "Error in finalize treewalk.";
|
||||
} else {
|
||||
// emit the treewalk results.
|
||||
emit treeWalkResult(_syncedItems);
|
||||
}
|
||||
}
|
||||
qDebug() << Q_FUNC_INFO << "Sync finished";
|
||||
}
|
||||
|
||||
void CSyncThread::progress(const char *remote_url, enum csync_notify_type_e kind,
|
||||
long long o1, long long o2, void *userdata)
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#ifndef CSYNCTHREAD_H
|
||||
#define CSYNCTHREAD_H
|
||||
|
||||
/*
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
|
||||
@@ -16,6 +13,9 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef CSYNCTHREAD_H
|
||||
#define CSYNCTHREAD_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QMutex>
|
||||
@@ -35,14 +35,10 @@ class CSyncThread : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSyncThread(const QString &source, const QString &target);
|
||||
CSyncThread(CSYNC *);
|
||||
~CSyncThread();
|
||||
|
||||
static void setConnectionDetails( const QString&, const QString&, const QNetworkProxy& );
|
||||
static QString csyncConfigDir();
|
||||
|
||||
const char* proxyTypeToCStr(QNetworkProxy::ProxyType);
|
||||
QString csyncErrorToString( CSYNC_ERROR_CODE, const char * );
|
||||
static QString csyncErrorToString( CSYNC_ERROR_CODE, const char * );
|
||||
|
||||
Q_INVOKABLE void startSync();
|
||||
|
||||
@@ -60,7 +56,10 @@ signals:
|
||||
void finished();
|
||||
void started();
|
||||
|
||||
void aboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel);
|
||||
|
||||
private:
|
||||
void handleSyncError(CSYNC *ctx, const char *state);
|
||||
static void progress(const char *remote_url,
|
||||
enum csync_notify_type_e kind,
|
||||
long long o1, long long o2,
|
||||
@@ -73,25 +72,18 @@ private:
|
||||
|
||||
static int walkFinalize(TREE_WALK_FILE*, void* );
|
||||
|
||||
static int getauth(const char *prompt,
|
||||
char *buf,
|
||||
size_t len,
|
||||
int echo,
|
||||
int verify,
|
||||
void *userdata
|
||||
);
|
||||
|
||||
|
||||
static QMutex _mutex;
|
||||
static QString _user;
|
||||
static QString _passwd;
|
||||
static QNetworkProxy _proxy;
|
||||
|
||||
static QString _csyncConfigDir;
|
||||
|
||||
static QMutex _syncMutex;
|
||||
SyncFileItemVector _syncedItems;
|
||||
|
||||
QString _source;
|
||||
QString _target;
|
||||
CSYNC *_csync_ctx;
|
||||
bool _needsUpdate;
|
||||
|
||||
bool _hasFiles; // true if there is at least one file that is not ignored or removed
|
||||
|
||||
friend class CSyncRunScopeHelper;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "mirall/fileitemdialog.h"
|
||||
#include "mirall/theme.h"
|
||||
#include "mirall/syncresult.h"
|
||||
#include "mirall/logger.h"
|
||||
|
||||
#define TYPE_SUCCESS 1
|
||||
#define TYPE_CONFLICT 2
|
||||
@@ -46,6 +47,7 @@ FileItemDialog::FileItemDialog(Theme *theme, QWidget *parent) :
|
||||
_treeWidget->setColumnWidth(0, 480);
|
||||
_timer.setInterval(1000);
|
||||
connect(&_timer, SIGNAL(timeout()), this, SLOT(slotSetFolderMessage()));
|
||||
connect(this, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(guiLog(QString,QString)));
|
||||
|
||||
QPushButton *copyBtn = _dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
|
||||
connect(copyBtn, SIGNAL(clicked()), SLOT(copyToClipboard()));
|
||||
@@ -66,6 +68,9 @@ void FileItemDialog::setSyncResult( const SyncResult& result )
|
||||
case SyncResult::NotYetStarted:
|
||||
folderMessage = tr( "The folder waits to start syncing." );
|
||||
break;
|
||||
case SyncResult::SyncPrepare:
|
||||
folderMessage = tr( "Determining which files to sync." );
|
||||
break;
|
||||
case SyncResult::Unavailable:
|
||||
folderMessage = tr( "Server is currently not available." );
|
||||
break;
|
||||
@@ -118,7 +123,10 @@ void FileItemDialog::slotSetFolderMessage()
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
int secs = _lastSyncTime.secsTo(now);
|
||||
|
||||
_timelabel->setText(tr("%1 (finished %2 sec. ago)").arg(_folderMessage).arg(secs));
|
||||
if (secs < 60)
|
||||
_timelabel->setText(tr("%1 (last finished %n sec. ago)", "", secs).arg(_folderMessage));
|
||||
else
|
||||
_timelabel->setText(tr("%1 (last finished %n min. ago)", "", secs/60).arg(_folderMessage));
|
||||
}
|
||||
|
||||
void FileItemDialog::copyToClipboard()
|
||||
@@ -147,6 +155,7 @@ void FileItemDialog::copyToClipboard()
|
||||
}
|
||||
|
||||
QApplication::clipboard()->setText(text);
|
||||
emit guiLog(tr("Copied to clipboard"), tr("The sync protocol has been copied to the clipboard."));
|
||||
}
|
||||
|
||||
void FileItemDialog::accept()
|
||||
@@ -219,8 +228,8 @@ void FileItemDialog::setSyncFileItems( const SyncFileItemVector& list )
|
||||
|
||||
QString dir;
|
||||
QStringList str( item._file );
|
||||
if( item._dir == SyncFileItem::Up ) dir = tr("Up");
|
||||
if( item._dir == SyncFileItem::Down ) dir = tr("Down");
|
||||
if( item._dir == SyncFileItem::Up ) dir = tr("Uploaded");
|
||||
if( item._dir == SyncFileItem::Down ) dir = tr("Downloaded");
|
||||
str << dir;
|
||||
|
||||
switch( item._instruction ) {
|
||||
|
||||
@@ -43,6 +43,9 @@ protected slots:
|
||||
void slotSetFolderMessage();
|
||||
void copyToClipboard();
|
||||
|
||||
signals:
|
||||
void guiLog(const QString&, const QString&);
|
||||
|
||||
private:
|
||||
void setSyncFileItems( const SyncFileItemVector& list );
|
||||
void formatHeaderItem( QTreeWidgetItem *, const QList<QTreeWidgetItem*>& );
|
||||
|
||||
@@ -25,7 +25,7 @@ QStringList FileUtils::subFoldersList(QString folder,
|
||||
SubFolderListOptions options)
|
||||
{
|
||||
QDir dir(folder);
|
||||
dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
dir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
|
||||
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
QStringList dirList;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include "mirall/folder.h"
|
||||
#include "mirall/folderwatcher.h"
|
||||
@@ -138,11 +139,6 @@ QString Folder::nativePath() const
|
||||
return QDir::toNativeSeparators(_path);
|
||||
}
|
||||
|
||||
QString Folder::nativeSecondPath() const
|
||||
{
|
||||
return secondPath();
|
||||
}
|
||||
|
||||
bool Folder::syncEnabled() const
|
||||
{
|
||||
return _enabled;
|
||||
@@ -192,6 +188,11 @@ int Folder::pollInterval() const
|
||||
return _pollTimer->interval();
|
||||
}
|
||||
|
||||
void Folder::setSyncState(SyncResult::Status state)
|
||||
{
|
||||
_syncResult.setStatus(state);
|
||||
}
|
||||
|
||||
void Folder::setPollInterval(int milliseconds)
|
||||
{
|
||||
_pollTimer->setInterval( milliseconds );
|
||||
@@ -247,12 +248,6 @@ void Folder::evaluateSync(const QStringList &pathList)
|
||||
|
||||
}
|
||||
|
||||
void Folder::startSync( const QStringList &pathList )
|
||||
{
|
||||
_syncResult.setStatus( SyncResult::SyncRunning );
|
||||
emit syncStateChange();
|
||||
}
|
||||
|
||||
void Folder::slotPollTimerTimeout()
|
||||
{
|
||||
qDebug() << "* Polling" << alias() << "for changes. Ignoring all pending events until now";
|
||||
@@ -282,7 +277,7 @@ void Folder::slotSyncFinished(const SyncResult &result)
|
||||
{
|
||||
_watcher->setEventsEnabledDelayed(2000);
|
||||
|
||||
qDebug() << "OO folder slotSyncFinished: result: " << int(result.status()) << " local: " << result.localRunOnly();
|
||||
qDebug() << "OO folder slotSyncFinished: result: " << int(result.status());
|
||||
emit syncStateChange();
|
||||
|
||||
// reenable the poll timer if folder is sync enabled
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#ifndef MIRALL_FOLDER_H
|
||||
#define MIRALL_FOLDER_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
@@ -46,6 +45,7 @@ public:
|
||||
virtual ~Folder();
|
||||
|
||||
typedef QHash<QString, Folder*> Map;
|
||||
typedef QHashIterator<QString, Folder*> MapIterator;
|
||||
|
||||
/**
|
||||
* alias or nickname
|
||||
@@ -62,7 +62,6 @@ public:
|
||||
* local folder path with native separators
|
||||
*/
|
||||
QString nativePath() const;
|
||||
virtual QString nativeSecondPath() const;
|
||||
/**
|
||||
* switch sync on or off
|
||||
* If the sync is switched off, the startSync method is not going to
|
||||
@@ -149,6 +148,12 @@ public:
|
||||
QIcon icon( int size ) const;
|
||||
QTimer *_pollTimer;
|
||||
|
||||
signals:
|
||||
void syncStateChange();
|
||||
void syncStarted();
|
||||
void syncFinished(const SyncResult &result);
|
||||
void scheduleToSync( const QString& );
|
||||
|
||||
public slots:
|
||||
void slotSyncFinished(const SyncResult &);
|
||||
|
||||
@@ -162,30 +167,45 @@ public slots:
|
||||
*/
|
||||
virtual void slotTerminateSync() = 0;
|
||||
|
||||
/**
|
||||
* Sets minimum amounts of milliseconds that will separate
|
||||
* poll intervals
|
||||
*/
|
||||
void setPollInterval( int );
|
||||
|
||||
/**
|
||||
* If folder is network-based, reimplement to react to proxy changes
|
||||
*/
|
||||
virtual void setProxy() {}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The minimum amounts of seconds to wait before
|
||||
* doing a full sync to see if the remote changed
|
||||
*/
|
||||
int pollInterval() const;
|
||||
void setSyncState(SyncResult::Status state);
|
||||
|
||||
/**
|
||||
* Sets minimum amounts of milliseconds that will separate
|
||||
* poll intervals
|
||||
*/
|
||||
void setPollInterval( int );
|
||||
|
||||
signals:
|
||||
void syncStateChange();
|
||||
void syncStarted();
|
||||
void syncFinished(const SyncResult &result);
|
||||
void scheduleToSync( const QString& );
|
||||
|
||||
protected:
|
||||
FolderWatcher *_watcher;
|
||||
int _errorCount;
|
||||
SyncResult _syncResult;
|
||||
|
||||
protected slots:
|
||||
|
||||
void slotOnlineChanged(bool online);
|
||||
|
||||
void slotPollTimerTimeout();
|
||||
|
||||
/* called when the watcher detect a list of changed
|
||||
paths */
|
||||
|
||||
void slotSyncStarted();
|
||||
|
||||
/**
|
||||
* Triggered by a file system watcher on the local sync dir
|
||||
*/
|
||||
virtual void slotLocalPathChanged( const QString& );
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
@@ -212,22 +232,6 @@ private:
|
||||
bool _enabled;
|
||||
QString _backend;
|
||||
|
||||
protected slots:
|
||||
|
||||
void slotOnlineChanged(bool online);
|
||||
|
||||
void slotPollTimerTimeout();
|
||||
|
||||
/* called when the watcher detect a list of changed
|
||||
paths */
|
||||
|
||||
void slotSyncStarted();
|
||||
|
||||
/**
|
||||
* Triggered by a file system watcher on the local sync dir
|
||||
*/
|
||||
virtual void slotLocalPathChanged( const QString& );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
|
||||
#include "mirall/folderman.h"
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/unisonfolder.h"
|
||||
#include "mirall/csyncfolder.h"
|
||||
#include "mirall/owncloudfolder.h"
|
||||
#include "mirall/syncresult.h"
|
||||
#include "mirall/inotify.h"
|
||||
@@ -29,18 +27,21 @@
|
||||
#endif
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QtCore>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
FolderMan::FolderMan(QObject *parent) :
|
||||
QObject(parent)
|
||||
QObject(parent),
|
||||
_syncEnabled( true )
|
||||
{
|
||||
// if QDir::mkpath would not be so stupid, I would not need to have this
|
||||
// duplication of folderConfigPath() here
|
||||
QDir storageDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
|
||||
MirallConfigFile cfg;
|
||||
QDir storageDir(cfg.configPath());
|
||||
storageDir.mkpath(QLatin1String("folders"));
|
||||
_folderConfigPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/folders");
|
||||
_folderConfigPath = cfg.configPath() + QLatin1String("folders");
|
||||
|
||||
_folderChangeSignalMapper = new QSignalMapper(this);
|
||||
connect(_folderChangeSignalMapper, SIGNAL(mapped(const QString &)),
|
||||
@@ -79,12 +80,28 @@ void FolderMan::slotReparseConfiguration()
|
||||
setupKnownFolders();
|
||||
}
|
||||
|
||||
int FolderMan::unloadAllFolders()
|
||||
{
|
||||
// first terminate sync jobs.
|
||||
terminateCurrentSync();
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
// clear the list of existing folders.
|
||||
Folder::MapIterator i(_folderMap);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
delete _folderMap.take( i.key() );
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
int FolderMan::setupKnownFolders()
|
||||
{
|
||||
qDebug() << "* Setup folders from " << _folderConfigPath;
|
||||
|
||||
_folderMap.clear(); // FIXME: check if delete of folder structure happens
|
||||
unloadAllFolders();
|
||||
|
||||
QDir dir( _folderConfigPath );
|
||||
dir.setFilter(QDir::Files);
|
||||
@@ -100,6 +117,42 @@ int FolderMan::setupKnownFolders()
|
||||
return _folderMap.size();
|
||||
}
|
||||
|
||||
void FolderMan::wipeAllJournals()
|
||||
{
|
||||
terminateCurrentSync();
|
||||
|
||||
foreach( Folder *f, _folderMap.values() ) {
|
||||
f->wipe();
|
||||
}
|
||||
}
|
||||
|
||||
bool FolderMan::ensureJournalGone(const QString &localPath)
|
||||
{
|
||||
|
||||
// remove old .csync_journal file
|
||||
QString stateDbFile = localPath+QLatin1String("/.csync_journal.db");
|
||||
while (QFile::exists(stateDbFile) && !QFile::remove(stateDbFile)) {
|
||||
int ret = QMessageBox::warning(0, tr("Could not reset folder state"),
|
||||
tr("An old sync journal '%1' was found, "
|
||||
"but could not be removed. Please make sure "
|
||||
"that no application is currently using it.")
|
||||
.arg(QDir::fromNativeSeparators(QDir::cleanPath(stateDbFile))),
|
||||
QMessageBox::Retry|QMessageBox::Abort);
|
||||
if (ret == QMessageBox::Abort) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FolderMan::terminateCurrentSync()
|
||||
{
|
||||
if( !_currentSyncFolder.isEmpty() ) {
|
||||
qDebug() << "Terminating syncing on folder " << _currentSyncFolder;
|
||||
terminateSyncProcess( _currentSyncFolder );
|
||||
}
|
||||
}
|
||||
|
||||
#define SLASH_TAG QLatin1String("__SLASH__")
|
||||
#define BSLASH_TAG QLatin1String("__BSLASH__")
|
||||
#define QMARK_TAG QLatin1String("__QMARK__")
|
||||
@@ -152,38 +205,6 @@ QString FolderMan::unescapeAlias( const QString& alias ) const
|
||||
return a;
|
||||
}
|
||||
|
||||
void FolderMan::setupFavLink(const QString &folder)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
// Windows Explorer: Place under "Favorites" (Links)
|
||||
wchar_t path[MAX_PATH];
|
||||
SHGetSpecialFolderPath(0, path, CSIDL_PROFILE, FALSE);
|
||||
QString profile = QDir::fromNativeSeparators(QString::fromWCharArray(path));
|
||||
QDir folderDir(QDir::fromNativeSeparators(folder));
|
||||
QString linkName = profile+QLatin1String("/Links/") + folderDir.dirName() + QLatin1String(".lnk");
|
||||
if (!QFile::link(folder, linkName))
|
||||
qDebug() << Q_FUNC_INFO << "linking" << folder << "to" << linkName << "failed!";
|
||||
#elif defined (Q_OS_MAC)
|
||||
// Finder: Place under "Places"
|
||||
QString folderUrl = QUrl::fromLocalFile(folder).toString();
|
||||
CFStringRef folderCFStr = CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(folderUrl.unicode()),
|
||||
folder.length());
|
||||
CFURLRef urlRef = CFURLCreateWithString(NULL, folderCFStr, 0);
|
||||
LSSharedFileListRef placesItems = LSSharedFileListCreate(0, kLSSharedFileListFavoriteItems, 0);
|
||||
if (placesItems) {
|
||||
//Insert an item to the list.
|
||||
LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(placesItems,
|
||||
kLSSharedFileListItemBeforeFirst, 0, 0,
|
||||
urlRef, 0, 0);
|
||||
if (item)
|
||||
CFRelease(item);
|
||||
}
|
||||
CFRelease(placesItems);
|
||||
CFRelease(folderCFStr);
|
||||
CFRelease(urlRef);
|
||||
#endif
|
||||
}
|
||||
|
||||
// filename is the name of the file only, it does not include
|
||||
// the configuration directory path
|
||||
Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
|
||||
@@ -227,17 +248,7 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
|
||||
|
||||
if (!backend.isEmpty()) {
|
||||
|
||||
if (backend == QLatin1String("unison")) {
|
||||
folder = new UnisonFolder(alias, path, targetPath, this );
|
||||
} else if (backend == QLatin1String("csync")) {
|
||||
#ifdef WITH_CSYNC
|
||||
folder = new CSyncFolder(alias, path, targetPath, this );
|
||||
#else
|
||||
qCritical() << "* csync support not enabled!! ignoring:" << file;
|
||||
#endif
|
||||
} else if( backend == QLatin1String("owncloud") ) {
|
||||
#ifdef WITH_CSYNC
|
||||
|
||||
if( backend == QLatin1String("owncloud") ) {
|
||||
MirallConfigFile cfgFile;
|
||||
|
||||
// assemble the owncloud url to pass to csync, incl. webdav
|
||||
@@ -245,18 +256,14 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
|
||||
|
||||
// cut off the leading slash, oCUrl always has a trailing.
|
||||
if( targetPath.startsWith(QLatin1Char('/')) ) {
|
||||
|
||||
targetPath.remove(0,1);
|
||||
}
|
||||
|
||||
folder = new ownCloudFolder( alias, path, oCUrl + targetPath, this );
|
||||
folder->setConfigFile(file);
|
||||
#else
|
||||
qCritical() << "* owncloud support not enabled!! ignoring:" << file;
|
||||
#endif
|
||||
} else {
|
||||
qWarning() << "unknown backend" << backend;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,25 +286,6 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
|
||||
return folder;
|
||||
}
|
||||
|
||||
void FolderMan::disableFoldersWithRestore()
|
||||
{
|
||||
_folderEnabledMap.clear();
|
||||
foreach( Folder *f, _folderMap ) {
|
||||
// store the enabled state, then make sure it is disabled
|
||||
_folderEnabledMap.insert(f->alias(), f->syncEnabled());
|
||||
f->setSyncEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void FolderMan::restoreEnabledFolders()
|
||||
{
|
||||
foreach( Folder *f, _folderMap ) {
|
||||
if (_folderEnabledMap.contains( f->alias() )) {
|
||||
f->setSyncEnabled( _folderEnabledMap.value( f->alias() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FolderMan::slotEnableFolder( const QString& alias, bool enable )
|
||||
{
|
||||
if( ! _folderMap.contains( alias ) ) {
|
||||
@@ -315,9 +303,18 @@ void FolderMan::slotEnableFolder( const QString& alias, bool enable )
|
||||
// csync still remains in a stable state, regardless of that.
|
||||
void FolderMan::terminateSyncProcess( const QString& alias )
|
||||
{
|
||||
Folder *f = _folderMap[alias];
|
||||
if( f ) {
|
||||
f->slotTerminateSync();
|
||||
QString folderAlias = alias;
|
||||
if( alias.isEmpty() ) {
|
||||
folderAlias = _currentSyncFolder;
|
||||
}
|
||||
if( ! folderAlias.isEmpty() ) {
|
||||
Folder *f = _folderMap[folderAlias];
|
||||
if( f ) {
|
||||
f->slotTerminateSync();
|
||||
|
||||
if(_currentSyncFolder == folderAlias )
|
||||
_currentSyncFolder = QString::null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,6 +339,13 @@ SyncResult FolderMan::syncResult( const QString& alias )
|
||||
return res;
|
||||
}
|
||||
|
||||
void FolderMan::slotScheduleAllFolders()
|
||||
{
|
||||
foreach( Folder *f, _folderMap.values() ) {
|
||||
slotScheduleSync( f->alias() );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if a folder wants to be synced, it calls this slot and is added
|
||||
* to the queue. The slot to actually start a sync is called afterwards.
|
||||
@@ -353,15 +357,22 @@ void FolderMan::slotScheduleSync( const QString& alias )
|
||||
qDebug() << "Schedule folder " << alias << " to sync!";
|
||||
if( _currentSyncFolder == alias ) {
|
||||
// the current folder is currently syncing.
|
||||
return;
|
||||
}
|
||||
|
||||
if( _scheduleQueue.contains( alias ) ) {
|
||||
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
|
||||
if( ! _scheduleQueue.contains(alias )) {
|
||||
_scheduleQueue.append(alias);
|
||||
} else {
|
||||
_scheduleQueue.append( alias );
|
||||
|
||||
slotScheduleFolderSync();
|
||||
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
|
||||
}
|
||||
|
||||
slotScheduleFolderSync();
|
||||
|
||||
}
|
||||
|
||||
void FolderMan::setSyncEnabled( bool enabled )
|
||||
{
|
||||
_syncEnabled = enabled;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -376,6 +387,11 @@ void FolderMan::slotScheduleFolderSync()
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! _syncEnabled ) {
|
||||
qDebug() << "FolderMan: Syncing is disabled, no scheduling.";
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduleQueue.count();
|
||||
if( ! _scheduleQueue.isEmpty() ) {
|
||||
const QString alias = _scheduleQueue.takeFirst();
|
||||
@@ -427,8 +443,6 @@ void FolderMan::addFolderDefinition( const QString& backend, const QString& alia
|
||||
settings.setValue(QString::fromLatin1("%1/connection").arg(escapedAlias), Theme::instance()->appName());
|
||||
settings.setValue(QString::fromLatin1("%1/onlyThisLAN").arg(escapedAlias), onlyThisLAN );
|
||||
settings.sync();
|
||||
|
||||
setupFavLink(sourceFolder);
|
||||
}
|
||||
|
||||
void FolderMan::removeAllFolderDefinitions()
|
||||
@@ -457,6 +471,8 @@ void FolderMan::removeFolder( const QString& alias )
|
||||
{
|
||||
Folder *f = 0;
|
||||
|
||||
_scheduleQueue.removeAll(alias);
|
||||
|
||||
if( _folderMap.contains( alias )) {
|
||||
qDebug() << "Removing " << alias;
|
||||
f = _folderMap.take( alias );
|
||||
@@ -475,4 +491,53 @@ void FolderMan::removeFolder( const QString& alias )
|
||||
}
|
||||
}
|
||||
|
||||
QString FolderMan::getBackupName( const QString& fullPathName ) const
|
||||
{
|
||||
if( fullPathName.isEmpty() ) return QString::null;
|
||||
|
||||
QString newName = fullPathName + QLatin1String(".oC_bak");
|
||||
QFileInfo fi( newName );
|
||||
int cnt = 1;
|
||||
do {
|
||||
if( fi.exists() ) {
|
||||
newName = fullPathName + QString( ".oC_bak_%1").arg(cnt++);
|
||||
fi.setFile(newName);
|
||||
}
|
||||
} while( fi.exists() );
|
||||
|
||||
return newName;
|
||||
}
|
||||
|
||||
bool FolderMan::startFromScratch( const QString& localFolder )
|
||||
{
|
||||
if( localFolder.isEmpty() ) return false;
|
||||
|
||||
QFileInfo fi( localFolder );
|
||||
if( fi.exists() && fi.isDir() ) {
|
||||
QDir file = fi.dir();
|
||||
|
||||
// check if there are files in the directory.
|
||||
if( file.count() == 0 ) {
|
||||
// directory is existing, but its empty. Use it.
|
||||
qDebug() << "startFromScratch: Directory is empty!";
|
||||
return true;
|
||||
}
|
||||
QString newName = getBackupName( fi.absoluteFilePath() );
|
||||
|
||||
if( file.rename( fi.absoluteFilePath(), newName )) {
|
||||
if( file.mkdir( fi.absoluteFilePath() ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void FolderMan::setProxy()
|
||||
{
|
||||
foreach( Folder *f, _folderMap.values() ) {
|
||||
f->setProxy();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ public:
|
||||
~FolderMan();
|
||||
|
||||
int setupFolders();
|
||||
void disableFoldersWithRestore();
|
||||
void restoreEnabledFolders();
|
||||
|
||||
Mirall::Folder::Map map();
|
||||
|
||||
@@ -73,6 +71,28 @@ public:
|
||||
*/
|
||||
void removeAllFolderDefinitions();
|
||||
|
||||
/**
|
||||
* Removes csync journals from all folders.
|
||||
*/
|
||||
void wipeAllJournals();
|
||||
|
||||
/**
|
||||
* Ensures that a given directory does not contain a .csync_journal.
|
||||
*
|
||||
* @returns false if the journal could not be removed, false otherwise.
|
||||
*/
|
||||
static bool ensureJournalGone(const QString &path);
|
||||
|
||||
/**
|
||||
* Creates a new and empty local directory.
|
||||
*/
|
||||
bool startFromScratch( const QString& );
|
||||
|
||||
/**
|
||||
* called whenever proxy configuration changes
|
||||
*/
|
||||
void setProxy();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* signal to indicate a folder named by alias has changed its sync state.
|
||||
@@ -89,7 +109,16 @@ public slots:
|
||||
|
||||
void slotReparseConfiguration();
|
||||
|
||||
void terminateSyncProcess( const QString& );
|
||||
void terminateSyncProcess( const QString& alias = QString::null );
|
||||
|
||||
/* delete all folder objects */
|
||||
int unloadAllFolders();
|
||||
|
||||
// if enabled is set to false, no new folders will start to sync.
|
||||
// the current one will finish.
|
||||
void setSyncEnabled( bool );
|
||||
|
||||
void slotScheduleAllFolders();
|
||||
|
||||
private slots:
|
||||
// slot to add a folder to the syncing queue
|
||||
@@ -102,7 +131,8 @@ private:
|
||||
// finds all folder configuration files
|
||||
// and create the folders
|
||||
int setupKnownFolders();
|
||||
void setupFavLink(const QString& folder);
|
||||
void terminateCurrentSync();
|
||||
QString getBackupName( const QString& ) const;
|
||||
|
||||
// Escaping of the alias which is used in QSettings AND the file
|
||||
// system, thus need to be escaped.
|
||||
@@ -113,11 +143,11 @@ private:
|
||||
|
||||
FolderWatcher *_configFolderWatcher;
|
||||
Folder::Map _folderMap;
|
||||
QHash<QString, bool> _folderEnabledMap;
|
||||
QString _folderConfigPath;
|
||||
QSignalMapper *_folderChangeSignalMapper;
|
||||
QString _currentSyncFolder;
|
||||
QStringList _scheduleQueue;
|
||||
bool _syncEnabled;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ FolderWatcher::FolderWatcher(const QString &root, QObject *parent)
|
||||
_eventsEnabled(true),
|
||||
_eventInterval(DEFAULT_EVENT_INTERVAL_MSEC),
|
||||
_root(root),
|
||||
_processTimer(new QTimer(this)),
|
||||
_initialSyncDone(false)
|
||||
_processTimer(new QTimer(this))
|
||||
{
|
||||
_d = new FolderWatcherPrivate(this);
|
||||
|
||||
@@ -147,13 +146,12 @@ void FolderWatcher::slotProcessTimerTimeout()
|
||||
{
|
||||
qDebug() << "* Processing of event queue for" << root();
|
||||
|
||||
if (!_pendingPathes.empty() || !_initialSyncDone) {
|
||||
if (!_pendingPathes.empty() ) {
|
||||
QStringList notifyPaths = _pendingPathes.keys();
|
||||
_pendingPathes.clear();
|
||||
//qDebug() << lastEventTime << eventTime;
|
||||
qDebug() << " * Notify" << notifyPaths.size() << "change items for" << root();
|
||||
emit folderChanged(notifyPaths);
|
||||
_initialSyncDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +170,7 @@ void FolderWatcher::setProcessTimer()
|
||||
void FolderWatcher::changeDetected(const QString& f)
|
||||
{
|
||||
if( ! eventsEnabled() ) {
|
||||
qDebug() << "FolderWatcher::changeDetected when eventsEnabled() -> ignore";
|
||||
// qDebug() << "FolderWatcher::changeDetected when eventsEnabled() -> ignore";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,9 +134,6 @@ private:
|
||||
// QStringList _pendingPaths;
|
||||
QTimer *_processTimer;
|
||||
QStringList _ignores;
|
||||
// for the initial synchronization, without
|
||||
// any file changed
|
||||
bool _initialSyncDone;
|
||||
|
||||
friend class FolderWatcherPrivate;
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@ void WatcherThread::run()
|
||||
_handle = 0;
|
||||
return;
|
||||
}
|
||||
qDebug() << Q_FUNC_INFO << "Change detected in" << _path << "from" << QThread::currentThread ();
|
||||
// qDebug() << Q_FUNC_INFO << "Change detected in" << _path << "from" << QThread::currentThread ();
|
||||
emit changed(_path);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -36,9 +36,10 @@ FolderWizardSourcePage::FolderWizardSourcePage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
registerField(QLatin1String("sourceFolder*"), _ui.localFolderLineEdit);
|
||||
_ui.localFolderLineEdit->setText( QString::fromLatin1( "%1/%2").arg( QDir::homePath() ).arg(Theme::instance()->appName() ) );
|
||||
QString defaultPath = QString::fromLatin1( "%1/%2").arg( QDir::homePath() ).arg(Theme::instance()->appName() );
|
||||
_ui.localFolderLineEdit->setText( QDir::toNativeSeparators( defaultPath ) );
|
||||
registerField(QLatin1String("alias*"), _ui.aliasLineEdit);
|
||||
_ui.aliasLineEdit->setText( Theme::instance()->appName() );
|
||||
_ui.aliasLineEdit->setText( Theme::instance()->appNameGUI() );
|
||||
|
||||
_ui.warnLabel->hide();
|
||||
#if QT_VERSION >= 0x040700
|
||||
@@ -64,7 +65,7 @@ void FolderWizardSourcePage::cleanupPage()
|
||||
|
||||
bool FolderWizardSourcePage::isComplete() const
|
||||
{
|
||||
QFileInfo selFile( _ui.localFolderLineEdit->text() );
|
||||
QFileInfo selFile( QDir::fromNativeSeparators(_ui.localFolderLineEdit->text()) );
|
||||
QString userInput = selFile.canonicalFilePath();
|
||||
|
||||
QString warnString;
|
||||
@@ -82,12 +83,20 @@ bool FolderWizardSourcePage::isComplete() const
|
||||
while( isOk && i != map->constEnd() ) {
|
||||
Folder *f = static_cast<Folder*>(i.value());
|
||||
QString folderDir = QDir( f->path() ).canonicalPath();
|
||||
if( folderDir.isEmpty() )
|
||||
{
|
||||
isOk = true;
|
||||
qDebug() << "Absolute path for folder: " << f->path() << " doesn't exist. Skipping.";
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if( ! folderDir.endsWith(QLatin1Char('/')) ) folderDir.append(QLatin1Char('/'));
|
||||
|
||||
qDebug() << "Checking local path: " << folderDir << " <-> " << userInput;
|
||||
if( QFileInfo( f->path() ) == userInput ) {
|
||||
isOk = false;
|
||||
warnString.append( tr("The local path %1 is already an upload folder.<br/>Please pick another one!").arg(userInput) );
|
||||
warnString.append( tr("The local path %1 is already an upload folder.<br/>Please pick another one!")
|
||||
.arg(QDir::toNativeSeparators(userInput)) );
|
||||
}
|
||||
if( isOk && folderDir.startsWith( userInput )) {
|
||||
qDebug() << "A already configured folder is child of the current selected";
|
||||
@@ -141,7 +150,7 @@ void FolderWizardSourcePage::on_localFolderChooseBtn_clicked()
|
||||
tr("Select the source folder"),
|
||||
QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
|
||||
if (!dir.isEmpty()) {
|
||||
_ui.localFolderLineEdit->setText(dir);
|
||||
_ui.localFolderLineEdit->setText(QDir::toNativeSeparators(dir));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,12 +168,7 @@ FolderWizardTargetPage::FolderWizardTargetPage()
|
||||
_ui.setupUi(this);
|
||||
_ui.warnFrame->hide();
|
||||
|
||||
registerField(QLatin1String("local?"), _ui.localFolderRadioBtn);
|
||||
registerField(QLatin1String("remote?"), _ui.urlFolderRadioBtn);
|
||||
registerField(QLatin1String("OC?"), _ui.OCRadioBtn);
|
||||
registerField(QLatin1String("targetLocalFolder"), _ui.localFolder2LineEdit);
|
||||
registerField(QLatin1String("targetURLFolder"), _ui.urlFolderLineEdit);
|
||||
registerField(QLatin1String("targetOCFolder"), _ui.OCFolderLineEdit);
|
||||
registerField(QLatin1String("OCFolderLineEdit"), _ui.OCFolderLineEdit);
|
||||
|
||||
connect( _ui.OCFolderLineEdit, SIGNAL(textChanged(QString)),
|
||||
SLOT(slotFolderTextChanged(QString)));
|
||||
@@ -172,12 +176,6 @@ FolderWizardTargetPage::FolderWizardTargetPage()
|
||||
_timer = new QTimer(this);
|
||||
_timer->setSingleShot( true );
|
||||
connect( _timer, SIGNAL(timeout()), SLOT(slotTimerFires()));
|
||||
|
||||
#if QT_Version >= 0x040700
|
||||
_ui.OCFolderLineEdit->setPlaceholderText(QApplication::translate("FolderWizardTargetPage", "root", 0, QApplication::UnicodeUTF8));
|
||||
_ui.localFolder2LineEdit->setPlaceholderText(QApplication::translate("FolderWizardTargetPage", "/home/local", 0, QApplication::UnicodeUTF8));
|
||||
_ui.urlFolderLineEdit->setPlaceholderText(QApplication::translate("FolderWizardTargetPage", "scp://john@host.com//myfolder", 0, QApplication::UnicodeUTF8));
|
||||
#endif
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::slotFolderTextChanged( const QString& t)
|
||||
@@ -209,7 +207,7 @@ void FolderWizardTargetPage::slotDirCheckReply(const QString &url, QNetworkReply
|
||||
showWarn();
|
||||
} else {
|
||||
showWarn( tr("The folder is not available on your %1.<br/>Click to create it." )
|
||||
.arg( Theme::instance()->appName() ), true );
|
||||
.arg( Theme::instance()->appNameGUI() ), true );
|
||||
}
|
||||
|
||||
emit completeChanged();
|
||||
@@ -217,11 +215,10 @@ void FolderWizardTargetPage::slotDirCheckReply(const QString &url, QNetworkReply
|
||||
|
||||
void FolderWizardTargetPage::slotCreateRemoteFolder()
|
||||
{
|
||||
_ui.OCFolderLineEdit->setEnabled( false );
|
||||
|
||||
const QString folder = _ui.OCFolderLineEdit->text();
|
||||
if( folder.isEmpty() ) return;
|
||||
|
||||
_ui.OCFolderLineEdit->setEnabled( false );
|
||||
qDebug() << "creating folder on ownCloud: " << folder;
|
||||
ownCloudInfo::instance()->mkdirRequest( folder );
|
||||
}
|
||||
@@ -234,10 +231,10 @@ void FolderWizardTargetPage::slotCreateRemoteFolderFinished( QNetworkReply::Netw
|
||||
// the webDAV server seems to return a 202 even if mkdir was successful.
|
||||
if( error == QNetworkReply::NoError ||
|
||||
error == QNetworkReply::ContentOperationNotPermittedError) {
|
||||
showWarn( tr("Folder was successfully created on %1.").arg( Theme::instance()->appName() ), false );
|
||||
showWarn( tr("Folder was successfully created on %1.").arg( Theme::instance()->appNameGUI() ), false );
|
||||
slotTimerFires();
|
||||
} else {
|
||||
showWarn( tr("Failed to create the folder on %1.<br/>Please check manually.").arg( Theme::instance()->appName() ), false );
|
||||
showWarn( tr("Failed to create the folder on %1.<br/>Please check manually.").arg( Theme::instance()->appNameGUI() ), false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,26 +244,16 @@ FolderWizardTargetPage::~FolderWizardTargetPage()
|
||||
|
||||
bool FolderWizardTargetPage::isComplete() const
|
||||
{
|
||||
if (_ui.localFolderRadioBtn->isChecked()) {
|
||||
return QFileInfo(_ui.localFolder2LineEdit->text()).isDir();
|
||||
} else if (_ui.urlFolderRadioBtn->isChecked()) {
|
||||
QUrl url(_ui.urlFolderLineEdit->text());
|
||||
return url.isValid() && (url.scheme() == QLatin1String("sftp")
|
||||
|| url.scheme() == QLatin1String("smb"));
|
||||
} else if( _ui.OCRadioBtn->isChecked()) {
|
||||
/* owncloud selected */
|
||||
QString dir = _ui.OCFolderLineEdit->text();
|
||||
if( dir.isEmpty() ) {
|
||||
showWarn( tr("Better do not use the remote root directory.<br/>If you do, you can <b>not</b> mirror another local folder."), false);
|
||||
QString dir = _ui.OCFolderLineEdit->text();
|
||||
if( dir.isEmpty() || dir == QLatin1String("/") ) {
|
||||
showWarn( tr("If you sync the root folder, you can <b>not</b> configure another sync directory."), false);
|
||||
return true;
|
||||
} else {
|
||||
} else {
|
||||
if( _dirChecked ) {
|
||||
showWarn();
|
||||
showWarn();
|
||||
}
|
||||
return _dirChecked;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::cleanupPage()
|
||||
@@ -276,35 +263,31 @@ void FolderWizardTargetPage::cleanupPage()
|
||||
|
||||
void FolderWizardTargetPage::initializePage()
|
||||
{
|
||||
slotToggleItems();
|
||||
showWarn();
|
||||
|
||||
/* check the owncloud configuration file and query the ownCloud */
|
||||
ownCloudInfo *ocInfo = ownCloudInfo::instance();
|
||||
if( ocInfo->isConfigured() ) {
|
||||
connect( ocInfo, SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
|
||||
connect( ocInfo, SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
SLOT(slotNoOwnCloudFound(QNetworkReply*)));
|
||||
connect( ocInfo, SIGNAL(ownCloudDirExists(QString,QNetworkReply*)),
|
||||
SLOT(slotDirCheckReply(QString,QNetworkReply*)));
|
||||
connect( ocInfo, SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),
|
||||
SLOT(slotCreateRemoteFolderFinished( QNetworkReply::NetworkError )));
|
||||
connect( ocInfo, SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
|
||||
connect( ocInfo, SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
SLOT(slotNoOwnCloudFound(QNetworkReply*)));
|
||||
connect( ocInfo, SIGNAL(ownCloudDirExists(QString,QNetworkReply*)),
|
||||
SLOT(slotDirCheckReply(QString,QNetworkReply*)));
|
||||
connect( ocInfo, SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),
|
||||
SLOT(slotCreateRemoteFolderFinished( QNetworkReply::NetworkError )));
|
||||
|
||||
connect(_ui._buttCreateFolder, SIGNAL(clicked()), SLOT(slotCreateRemoteFolder()));
|
||||
ocInfo->checkInstallation();
|
||||
connect(_ui._buttCreateFolder, SIGNAL(clicked()), SLOT(slotCreateRemoteFolder()));
|
||||
ocInfo->checkInstallation();
|
||||
|
||||
} else {
|
||||
_ui.OCRadioBtn->setEnabled( false );
|
||||
_ui.OCFolderLineEdit->setEnabled( false );
|
||||
}
|
||||
_ui.OCFolderLineEdit->setEnabled( false );
|
||||
|
||||
QString dir = _ui.OCFolderLineEdit->text();
|
||||
if( !dir.isEmpty() ) {
|
||||
slotFolderTextChanged( dir );
|
||||
QString dir = _ui.OCFolderLineEdit->text();
|
||||
if( !dir.isEmpty() ) {
|
||||
slotFolderTextChanged( dir );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::slotOwnCloudFound( const QString& url, const QString& infoStr, const QString& version, const QString& edition)
|
||||
{
|
||||
Q_UNUSED(version);
|
||||
@@ -312,10 +295,9 @@ void FolderWizardTargetPage::slotOwnCloudFound( const QString& url, const QStrin
|
||||
|
||||
if( infoStr.isEmpty() ) {
|
||||
} else {
|
||||
_ui.OCLabel->setText( tr("to your <a href=\"%1\">%2</a> (version %3)").arg(url)
|
||||
.arg(Theme::instance()->appName()).arg(infoStr));
|
||||
// _ui.OCLabel->setText( tr("to your <a href=\"%1\">%2</a> (version %3)").arg(url)
|
||||
// .arg(Theme::instance()->appNameGUI()).arg(infoStr));
|
||||
_ui.OCFolderLineEdit->setEnabled( true );
|
||||
_ui.OCRadioBtn->setEnabled( true );
|
||||
qDebug() << "ownCloud found on " << url << " with version: " << infoStr;
|
||||
}
|
||||
}
|
||||
@@ -323,10 +305,9 @@ void FolderWizardTargetPage::slotOwnCloudFound( const QString& url, const QStrin
|
||||
void FolderWizardTargetPage::slotNoOwnCloudFound( QNetworkReply* error )
|
||||
{
|
||||
qDebug() << "No ownCloud configured: " << error->error();
|
||||
_ui.OCLabel->setText( tr("no configured %1 found!").arg(Theme::instance()->appName()) );
|
||||
// _ui.OCLabel->setText( tr("no configured %1 found!").arg(Theme::instance()->appNameGUI()) );
|
||||
showWarn( tr("%1 could not be reached:<br/><tt>%2</tt>")
|
||||
.arg(Theme::instance()->appName()).arg(error->errorString()));
|
||||
_ui.OCRadioBtn->setEnabled( false );
|
||||
.arg(Theme::instance()->appNameGUI()).arg(error->errorString()));
|
||||
_ui.OCFolderLineEdit->setEnabled( false );
|
||||
}
|
||||
|
||||
@@ -343,132 +324,37 @@ void FolderWizardTargetPage::showWarn( const QString& msg, bool showCreateButton
|
||||
}
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::on_localFolderRadioBtn_toggled()
|
||||
{
|
||||
slotToggleItems();
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::on_urlFolderRadioBtn_toggled()
|
||||
{
|
||||
slotToggleItems();
|
||||
emit completeChanged();
|
||||
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::on_localFolder2LineEdit_textChanged()
|
||||
{
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::on_urlFolderLineEdit_textChanged()
|
||||
{
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::slotToggleItems()
|
||||
{
|
||||
|
||||
bool enabled = _ui.localFolderRadioBtn->isChecked();
|
||||
_ui.localFolder2LineEdit->setEnabled(enabled);
|
||||
_ui.localFolder2ChooseBtn->setEnabled(enabled);
|
||||
if( enabled ) {
|
||||
_warnWasVisible = _ui.warnFrame->isVisible();
|
||||
_ui.warnFrame->hide();
|
||||
}
|
||||
|
||||
enabled = _ui.urlFolderRadioBtn->isChecked();
|
||||
_ui.urlFolderLineEdit->setEnabled(enabled);
|
||||
if( enabled ) {
|
||||
_warnWasVisible = _ui.warnFrame->isVisible();
|
||||
_ui.warnFrame->hide();
|
||||
}
|
||||
|
||||
enabled = _ui.OCRadioBtn->isChecked();
|
||||
_ui.OCFolderLineEdit->setEnabled(enabled);
|
||||
if( enabled ) _ui.warnFrame->setVisible( _warnWasVisible );
|
||||
}
|
||||
|
||||
void FolderWizardTargetPage::on_localFolder2ChooseBtn_clicked()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select the target folder"),
|
||||
QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
|
||||
if (!dir.isEmpty()) {
|
||||
_ui.localFolder2LineEdit->setText(dir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================================
|
||||
|
||||
FolderWizardNetworkPage::FolderWizardNetworkPage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
registerField(QLatin1String("onlyNetwork*"), _ui.checkBoxOnlyOnline);
|
||||
registerField(QLatin1String("onlyLocalNetwork*"), _ui.checkBoxOnlyThisLAN );
|
||||
}
|
||||
|
||||
FolderWizardNetworkPage::~FolderWizardNetworkPage()
|
||||
{
|
||||
}
|
||||
|
||||
bool FolderWizardNetworkPage::isComplete() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
FolderWizardOwncloudPage::FolderWizardOwncloudPage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
registerField(QLatin1String("OCUrl*"), _ui.lineEditOCUrl);
|
||||
registerField(QLatin1String("OCUser*"), _ui.lineEditOCUser );
|
||||
registerField(QLatin1String("OCPasswd"), _ui.lineEditOCPasswd);
|
||||
registerField(QLatin1String("OCSiteAlias*"), _ui.lineEditOCAlias);
|
||||
}
|
||||
|
||||
FolderWizardOwncloudPage::~FolderWizardOwncloudPage()
|
||||
{
|
||||
}
|
||||
|
||||
void FolderWizardOwncloudPage::initializePage()
|
||||
{
|
||||
_ui.lineEditOCAlias->setText( QLatin1String("ownCloud") );
|
||||
_ui.lineEditOCUrl->setText( QLatin1String("http://localhost/owncloud") );
|
||||
QString user = QString::fromLocal8Bit(qgetenv("USER"));
|
||||
_ui.lineEditOCUser->setText( user );
|
||||
}
|
||||
|
||||
bool FolderWizardOwncloudPage::isComplete() const
|
||||
{
|
||||
|
||||
bool hasAlias = !(_ui.lineEditOCAlias->text().isEmpty());
|
||||
QUrl u( _ui.lineEditOCUrl->text() );
|
||||
bool hasUrl = u.isValid();
|
||||
|
||||
return hasAlias && hasUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Folder wizard itself
|
||||
*/
|
||||
|
||||
FolderWizard::FolderWizard( QWidget *parent )
|
||||
: QWizard(parent),
|
||||
_folderWizardSourcePage(0)
|
||||
_folderWizardSourcePage(0),
|
||||
_folderWizardTargetPage(0)
|
||||
{
|
||||
_folderWizardSourcePage = new FolderWizardSourcePage();
|
||||
setPage(Page_Source, _folderWizardSourcePage );
|
||||
if (!Theme::instance()->singleSyncFolder())
|
||||
setPage(Page_Target, new FolderWizardTargetPage());
|
||||
// setPage(Page_Network, new FolderWizardNetworkPage());
|
||||
// setPage(Page_Owncloud, new FolderWizardOwncloudPage());
|
||||
setWindowTitle( tr( "%1 Folder Wizard" ).arg( Theme::instance()->appName() ) );
|
||||
if (!Theme::instance()->singleSyncFolder()) {
|
||||
_folderWizardTargetPage = new FolderWizardTargetPage();
|
||||
setPage(Page_Target, _folderWizardTargetPage );
|
||||
}
|
||||
|
||||
setWindowTitle( tr( "%1 Folder Wizard" ).arg( Theme::instance()->appNameGUI() ) );
|
||||
#ifdef Q_WS_MAC
|
||||
setWizardStyle( QWizard::ModernStyle );
|
||||
#endif
|
||||
}
|
||||
|
||||
FolderWizard::~FolderWizard()
|
||||
{
|
||||
delete _folderWizardSourcePage;
|
||||
if( _folderWizardTargetPage )
|
||||
delete _folderWizardTargetPage;
|
||||
}
|
||||
|
||||
void FolderWizard::setFolderMap( Folder::Map *fm)
|
||||
{
|
||||
if( _folderWizardSourcePage ) {
|
||||
|
||||
@@ -23,14 +23,10 @@
|
||||
|
||||
#include "ui_folderwizardsourcepage.h"
|
||||
#include "ui_folderwizardtargetpage.h"
|
||||
#include "ui_folderwizardnetworkpage.h"
|
||||
#include "ui_folderwizardowncloudpage.h"
|
||||
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
class ownCloudInfo;
|
||||
class ownCloudDirCheck;
|
||||
|
||||
/**
|
||||
* page to ask for the local source folder
|
||||
@@ -74,15 +70,6 @@ public:
|
||||
virtual void cleanupPage();
|
||||
|
||||
protected slots:
|
||||
void slotToggleItems();
|
||||
void on_localFolder2ChooseBtn_clicked();
|
||||
|
||||
void on_localFolderRadioBtn_toggled();
|
||||
void on_urlFolderRadioBtn_toggled();
|
||||
|
||||
void on_localFolder2LineEdit_textChanged();
|
||||
void on_urlFolderLineEdit_textChanged();
|
||||
|
||||
void slotOwnCloudFound( const QString&, const QString&, const QString&, const QString& );
|
||||
void slotNoOwnCloudFound(QNetworkReply*);
|
||||
|
||||
@@ -101,38 +88,6 @@ private:
|
||||
bool _warnWasVisible;
|
||||
};
|
||||
|
||||
class FolderWizardNetworkPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FolderWizardNetworkPage();
|
||||
~FolderWizardNetworkPage();
|
||||
|
||||
virtual bool isComplete() const;
|
||||
|
||||
protected slots:
|
||||
|
||||
private:
|
||||
Ui_FolderWizardNetworkPage _ui;
|
||||
};
|
||||
|
||||
class FolderWizardOwncloudPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FolderWizardOwncloudPage();
|
||||
~FolderWizardOwncloudPage();
|
||||
|
||||
virtual bool isComplete() const;
|
||||
void initializePage();
|
||||
|
||||
protected slots:
|
||||
|
||||
private:
|
||||
Ui_FolderWizardOwncloudPage _ui;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -143,17 +98,17 @@ public:
|
||||
|
||||
enum {
|
||||
Page_Source,
|
||||
Page_Target,
|
||||
Page_Network,
|
||||
Page_Owncloud
|
||||
Page_Target
|
||||
};
|
||||
|
||||
FolderWizard(QWidget *parent = 0);
|
||||
~FolderWizard();
|
||||
void setFolderMap( Folder::Map* );
|
||||
|
||||
private:
|
||||
|
||||
FolderWizardSourcePage *_folderWizardSourcePage;
|
||||
FolderWizardTargetPage *_folderWizardTargetPage;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FolderWizardNetworkPage</class>
|
||||
<widget class="QWidget" name="FolderWizardNetworkPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>435</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Network Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Set networking options:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxOnlyOnline">
|
||||
<property name="text">
|
||||
<string>Only enable if network is available</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxOnlyThisLAN">
|
||||
<property name="text">
|
||||
<string>restrict to this local network</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>172</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,101 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FolderWizardOwncloudPage</class>
|
||||
<widget class="QWidget" name="FolderWizardOwncloudPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>435</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>ownCloud Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditOCUrl"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>User:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditOCUser"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditOCPasswd">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditOCAlias"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Alias:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>172</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ownCloud</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<height>360</height>
|
||||
<height>367</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -48,7 +48,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Select a destination folder for your data</string>
|
||||
<string>Select a destination folder</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
@@ -57,7 +57,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
@@ -73,31 +73,12 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="OCLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>on your &ownCloud server</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>OCRadioBtn</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Folder on ownCloud:</string>
|
||||
<string>Remote folder:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -109,163 +90,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../mirall.qrc">:/mirall/resources/folder-grey-32.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="LocalFolderLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>to a &local folder</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>localFolderRadioBtn</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Folder name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="localFolder2LineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="localFolder2ChooseBtn">
|
||||
<property name="text">
|
||||
<string>C&hoose..</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../mirall.qrc">:/mirall/resources/folder-remote-32.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QLabel" name="OCLabel_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>to a &remote folder (URL)</string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>urlFolderRadioBtn</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="urlFolderLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="OCRadioBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="localFolderRadioBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="urlFolderRadioBtn">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -405,8 +229,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../mirall.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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 "mirall/gitfolder.h"
|
||||
|
||||
#include <QMutexLocker>
|
||||
#include <QProcess>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
GitFolder::GitFolder(const QString &alias,
|
||||
const QString &path,
|
||||
const QString &secondPath,
|
||||
QObject *parent)
|
||||
: Folder(alias, path, secondPath, parent)
|
||||
{
|
||||
_syncProcess = new QProcess();
|
||||
}
|
||||
|
||||
GitFolder::~GitFolder()
|
||||
{
|
||||
}
|
||||
|
||||
void GitFolder::startSync()
|
||||
{
|
||||
QMutexLocker locker(&_syncMutex);
|
||||
emit syncStarted();
|
||||
emit syncFinished(SyncResult(SyncResult::Success));
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef MIRALL_GITFOLDER_H
|
||||
#define MIRALL_GITFOLDER_H
|
||||
|
||||
#include <QMutex>
|
||||
#include "mirall/folder.h"
|
||||
|
||||
class QProcess;
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
class GitFolder : public Folder
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* path : Local folder to be keep in sync
|
||||
* remote: git repo url to sync from/to
|
||||
*/
|
||||
GitFolder(const QString &alias,
|
||||
const QString &path,
|
||||
const QString &secondPath, QObject *parent = 0L);
|
||||
virtual ~GitFolder();
|
||||
|
||||
virtual void startSync();
|
||||
private:
|
||||
QMutex _syncMutex;
|
||||
QProcess *_syncProcess;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -39,8 +39,10 @@ INotify::INotify(QObject *parent, int mask)
|
||||
_mask(mask)
|
||||
{
|
||||
_fd = inotify_init();
|
||||
if (_fd == -1)
|
||||
qDebug() << Q_FUNC_INFO << "notify_init() failed: " << strerror(errno);
|
||||
_notifier = new QSocketNotifier(_fd, QSocketNotifier::Read);
|
||||
QObject::connect(_notifier, SIGNAL(activated(int)), SLOT(slotActivated(int)));
|
||||
connect(_notifier, SIGNAL(activated(int)), SLOT(slotActivated(int)));
|
||||
_buffer_size = DEFAULT_READ_BUFFERSIZE;
|
||||
_buffer = (char *) malloc(_buffer_size);
|
||||
}
|
||||
@@ -95,8 +97,6 @@ void INotify::slotActivated(int fd)
|
||||
foreach (QString path, paths)
|
||||
emit notifyEvent(event->mask, event->cookie, path + "/" + QString::fromUtf8(event->name));
|
||||
}
|
||||
else
|
||||
qWarning() << "n is NULL";
|
||||
|
||||
// increment counter
|
||||
i += sizeof(struct inotify_event) + event->len;
|
||||
@@ -112,6 +112,7 @@ INotify::~INotify()
|
||||
|
||||
close(_fd);
|
||||
free(_buffer);
|
||||
delete _notifier;
|
||||
}
|
||||
|
||||
void INotify::addPath(const QString &path)
|
||||
@@ -121,7 +122,7 @@ void INotify::addPath(const QString &path)
|
||||
if( wd > -1 )
|
||||
_wds[path] = wd;
|
||||
else
|
||||
qDebug() << "WRN: Could not watch " << path;
|
||||
qDebug() << "WRN: Could not watch " << path << ':' << strerror(errno);
|
||||
}
|
||||
|
||||
void INotify::removePath(const QString &path)
|
||||
|
||||
@@ -113,15 +113,12 @@ LogBrowser::LogBrowser(QWidget *parent) :
|
||||
|
||||
setModal(false);
|
||||
|
||||
// needs to be a queued connection as logs from other threads come in
|
||||
connect(Logger::instance(), SIGNAL(newLog(QString)),this,SLOT(slotNewLog(QString)), Qt::QueuedConnection);
|
||||
// Direct connection for log comming from this thread, and queued for the one in a different thread
|
||||
connect(Logger::instance(), SIGNAL(newLog(QString)),this,SLOT(slotNewLog(QString)), Qt::AutoConnection);
|
||||
}
|
||||
|
||||
LogBrowser::~LogBrowser()
|
||||
{
|
||||
if( _logstream ) {
|
||||
_logFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
void LogBrowser::slotNewLog( const QString& msg )
|
||||
@@ -138,6 +135,9 @@ void LogBrowser::slotNewLog( const QString& msg )
|
||||
|
||||
void LogBrowser::setLogFile( const QString & name, bool flush )
|
||||
{
|
||||
if( _logstream ) {
|
||||
_logFile.close();
|
||||
}
|
||||
_logFile.setFileName( name );
|
||||
|
||||
if(!_logFile.open(QIODevice::WriteOnly)) {
|
||||
@@ -150,7 +150,7 @@ void LogBrowser::setLogFile( const QString & name, bool flush )
|
||||
return;
|
||||
}
|
||||
_doFileFlush = flush;
|
||||
_logstream = new QTextStream( &_logFile );
|
||||
_logstream.reset(new QTextStream( &_logFile ));
|
||||
}
|
||||
|
||||
void LogBrowser::slotFind()
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
QFile _logFile;
|
||||
bool _doFileFlush;
|
||||
QTextStream *_logstream;
|
||||
QScopedPointer<QTextStream> _logstream;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/owncloudinfo.h"
|
||||
#include "mirall/owncloudtheme.h"
|
||||
#include "mirall/miralltheme.h"
|
||||
#include "mirall/theme.h"
|
||||
#include "mirall/credentialstore.h"
|
||||
|
||||
#include <QtCore>
|
||||
@@ -29,6 +30,7 @@
|
||||
namespace Mirall {
|
||||
|
||||
QString MirallConfigFile::_oCVersion;
|
||||
QString MirallConfigFile::_confDir = QString::null;
|
||||
bool MirallConfigFile::_askedUser = false;
|
||||
|
||||
MirallConfigFile::MirallConfigFile( const QString& appendix )
|
||||
@@ -36,9 +38,40 @@ MirallConfigFile::MirallConfigFile( const QString& appendix )
|
||||
{
|
||||
}
|
||||
|
||||
void MirallConfigFile::setConfDir(const QString &value)
|
||||
{
|
||||
if( value.isEmpty() ) return;
|
||||
|
||||
QFileInfo fi(value);
|
||||
if( fi.exists() && fi.isDir() ) {
|
||||
qDebug() << "** Using custom config dir " << value;
|
||||
_confDir=value;
|
||||
}
|
||||
}
|
||||
|
||||
QString MirallConfigFile::seenVersion() const
|
||||
{
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
settings.beginGroup(QLatin1String("Updater"));
|
||||
return settings.value(QLatin1String("seenVersion")).toString();
|
||||
}
|
||||
|
||||
void MirallConfigFile::setSeenVersion(const QString &version)
|
||||
{
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
settings.beginGroup(QLatin1String("Updater"));
|
||||
settings.setValue(QLatin1String("seenVersion"), version);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
QString MirallConfigFile::configPath() const
|
||||
{
|
||||
QString dir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
QString dir = _confDir;
|
||||
if( _confDir.isEmpty() )
|
||||
_confDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||
|
||||
if( !dir.endsWith(QLatin1Char('/')) ) dir.append(QLatin1Char('/'));
|
||||
return dir;
|
||||
}
|
||||
@@ -83,7 +116,7 @@ QString MirallConfigFile::excludeFile() const
|
||||
QString MirallConfigFile::configFile() const
|
||||
{
|
||||
if( qApp->applicationName().isEmpty() ) {
|
||||
qApp->setApplicationName( Theme::instance()->appName() );
|
||||
qApp->setApplicationName( Theme::instance()->appNameGUI() );
|
||||
}
|
||||
QString dir = configPath() + Theme::instance()->configFileName();
|
||||
if( !_customHandle.isEmpty() ) {
|
||||
@@ -120,30 +153,19 @@ bool MirallConfigFile::connectionExists( const QString& conn )
|
||||
void MirallConfigFile::writeOwncloudConfig( const QString& connection,
|
||||
const QString& url,
|
||||
const QString& user,
|
||||
const QString& passwd,
|
||||
bool https, bool skipPwd )
|
||||
const QString& passwd )
|
||||
{
|
||||
const QString file = configFile();
|
||||
bool skipPwd = false; // can be refactored - remove it.
|
||||
qDebug() << "*** writing mirall config to " << file << " Skippwd: " << skipPwd;
|
||||
QString pwd( passwd );
|
||||
|
||||
QSettings settings( file, QSettings::IniFormat);
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
QString cloudsUrl( url );
|
||||
|
||||
if( !cloudsUrl.startsWith( QLatin1String("http")) ) {
|
||||
if (https)
|
||||
cloudsUrl.prepend(QLatin1String("https://"));
|
||||
else
|
||||
cloudsUrl.prepend(QLatin1String("http://"));
|
||||
}
|
||||
|
||||
settings.beginGroup( connection );
|
||||
settings.setValue( QLatin1String("url"), cloudsUrl );
|
||||
settings.setValue( QLatin1String("url"), url );
|
||||
settings.setValue( QLatin1String("user"), user );
|
||||
if( skipPwd ) {
|
||||
pwd.clear();
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_QTKEYCHAIN
|
||||
// Password is stored to QtKeyChain now by default in CredentialStore
|
||||
@@ -154,13 +176,18 @@ void MirallConfigFile::writeOwncloudConfig( const QString& connection,
|
||||
if( !skipPwd )
|
||||
writePassword( passwd );
|
||||
#endif
|
||||
if( !skipPwd )
|
||||
writePassword( passwd );
|
||||
else
|
||||
clearPasswordFromConfig(); // wipe the password.
|
||||
|
||||
settings.setValue( QLatin1String("nostoredpassword"), QVariant(skipPwd) );
|
||||
settings.sync();
|
||||
// check the perms, only read-write for the owner.
|
||||
QFile::setPermissions( file, QFile::ReadOwner|QFile::WriteOwner );
|
||||
|
||||
// Store credentials temporar until the config is finalized.
|
||||
CredentialStore::instance()->setCredentials( cloudsUrl, user, passwd );
|
||||
ownCloudInfo::instance()->setCredentials( user, passwd, _customHandle );
|
||||
|
||||
}
|
||||
|
||||
@@ -197,6 +224,8 @@ bool MirallConfigFile::writePassword( const QString& passwd, const QString& conn
|
||||
QByteArray pwdba = pwd.toUtf8();
|
||||
settings.setValue( QLatin1String("passwd"), QVariant(pwdba.toBase64()) );
|
||||
settings.sync();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// set the url, called from redirect handling.
|
||||
@@ -264,13 +293,6 @@ QString MirallConfigFile::ownCloudUrl( const QString& connection, bool webdav )
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
settings.beginGroup( con );
|
||||
|
||||
// For the WebDAV connect it is required to know which version the server is running
|
||||
// because the url changed :-/
|
||||
if( webdav && _oCVersion.isEmpty() ) {
|
||||
qDebug() << "######## Config does not yet know the ownCloud server version #########";
|
||||
qDebug() << "###################### THIS SHOULD NOT HAPPEN! ########################";
|
||||
}
|
||||
|
||||
QString url = settings.value( QLatin1String("url") ).toString();
|
||||
if( ! url.isEmpty() ) {
|
||||
if( ! url.endsWith(QLatin1Char('/'))) url.append(QLatin1String("/"));
|
||||
@@ -314,6 +336,22 @@ int MirallConfigFile::remotePollInterval( const QString& connection ) const
|
||||
return remoteInterval;
|
||||
}
|
||||
|
||||
void MirallConfigFile::setRemotePollInterval(int interval, const QString &connection )
|
||||
{
|
||||
QString con( connection );
|
||||
if( connection.isEmpty() ) con = defaultConnection();
|
||||
|
||||
if( interval < 5000 ) {
|
||||
qDebug() << "Remote Poll interval of " << interval << " is below fife seconds.";
|
||||
return;
|
||||
}
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
settings.beginGroup( con );
|
||||
settings.setValue("remotePollInterval", interval );
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
bool MirallConfigFile::passwordStorageAllowed( const QString& connection )
|
||||
{
|
||||
QString con( connection );
|
||||
@@ -336,26 +374,23 @@ QString MirallConfigFile::ownCloudPasswd( const QString& connection ) const
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
settings.beginGroup( con );
|
||||
|
||||
QString pwd;
|
||||
|
||||
QByteArray pwdba = settings.value(QLatin1String("passwd")).toByteArray();
|
||||
if( pwdba.isEmpty() ) {
|
||||
// check the password entry, cleartext from before
|
||||
// read it and convert to base64, delete the cleartext entry.
|
||||
QString p = settings.value(QLatin1String("password")).toString();
|
||||
|
||||
if( ! p.isEmpty() ) {
|
||||
// its there, save base64-encoded and delete.
|
||||
|
||||
pwdba = p.toUtf8();
|
||||
settings.setValue( QLatin1String("passwd"), QVariant(pwdba.toBase64()) );
|
||||
settings.remove( QLatin1String("password") );
|
||||
settings.sync();
|
||||
}
|
||||
if( !pwdba.isEmpty() ) {
|
||||
return QString::fromUtf8( QByteArray::fromBase64(pwdba) );
|
||||
}
|
||||
pwd = QString::fromUtf8( QByteArray::fromBase64(pwdba) );
|
||||
|
||||
return pwd;
|
||||
// check the password entry, cleartext from before
|
||||
// read it and convert to base64, delete the cleartext entry.
|
||||
QString p = settings.value(QLatin1String("password")).toString();
|
||||
|
||||
if( ! p.isEmpty() ) {
|
||||
// its there, save base64-encoded and delete.
|
||||
pwdba = p.toUtf8();
|
||||
settings.setValue( QLatin1String("passwd"), QVariant(pwdba.toBase64()) );
|
||||
settings.remove( QLatin1String("password") );
|
||||
settings.sync();
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
QString MirallConfigFile::ownCloudVersion() const
|
||||
@@ -384,6 +419,20 @@ bool MirallConfigFile::ownCloudSkipUpdateCheck( const QString& connection ) cons
|
||||
return skipIt;
|
||||
}
|
||||
|
||||
void MirallConfigFile::setOwnCloudSkipUpdateCheck( bool skip, const QString& connection )
|
||||
{
|
||||
QString con( connection );
|
||||
if( connection.isEmpty() ) con = defaultConnection();
|
||||
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
settings.beginGroup( con );
|
||||
|
||||
settings.setValue( QLatin1String("skipUpdateCheck"), QVariant(skip) );
|
||||
settings.sync();
|
||||
|
||||
}
|
||||
|
||||
int MirallConfigFile::maxLogLines() const
|
||||
{
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
@@ -393,6 +442,16 @@ int MirallConfigFile::maxLogLines() const
|
||||
return logLines;
|
||||
}
|
||||
|
||||
void MirallConfigFile::setMaxLogLines( int lines )
|
||||
{
|
||||
QSettings settings( configFile(), QSettings::IniFormat );
|
||||
settings.setIniCodec( "UTF-8" );
|
||||
|
||||
settings.beginGroup(QLatin1String("Logging"));
|
||||
settings.setValue(QLatin1String("maxLogLines"), lines);
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
// remove a custom config file.
|
||||
void MirallConfigFile::cleanupCustomConfig()
|
||||
{
|
||||
@@ -438,12 +497,22 @@ void MirallConfigFile::acceptCustomConfig()
|
||||
QFile::remove( targetBak );
|
||||
|
||||
// inform the credential store about the password change.
|
||||
CredentialStore::instance()->saveCredentials( );
|
||||
QString url = ownCloudUrl();
|
||||
QString user = ownCloudUser();
|
||||
QString pwd = ownCloudPasswd();
|
||||
bool allow = passwordStorageAllowed();
|
||||
|
||||
if( pwd.isEmpty() ) {
|
||||
qDebug() << "Password is empty, skipping to write cred store.";
|
||||
} else {
|
||||
CredentialStore::instance()->setCredentials(url, user, pwd, allow);
|
||||
CredentialStore::instance()->saveCredentials();
|
||||
}
|
||||
}
|
||||
|
||||
void MirallConfigFile::setProxyType(int proxyType,
|
||||
const QString& host,
|
||||
int port,
|
||||
int port, bool needsAuth,
|
||||
const QString& user,
|
||||
const QString& pass)
|
||||
{
|
||||
@@ -452,11 +521,15 @@ void MirallConfigFile::setProxyType(int proxyType,
|
||||
settings.beginGroup(QLatin1String("proxy"));
|
||||
|
||||
settings.setValue(QLatin1String("type"), proxyType);
|
||||
settings.setValue(QLatin1String("host"), host);
|
||||
settings.setValue(QLatin1String("port"), port);
|
||||
settings.setValue(QLatin1String("user"), user);
|
||||
settings.setValue(QLatin1String("pass"), pass.toUtf8().toBase64());
|
||||
|
||||
if (proxyType == QNetworkProxy::HttpProxy ||
|
||||
proxyType == QNetworkProxy::Socks5Proxy) {
|
||||
settings.setValue(QLatin1String("host"), host);
|
||||
settings.setValue(QLatin1String("port"), port);
|
||||
settings.setValue(QLatin1String("needsAuth"), needsAuth);
|
||||
settings.setValue(QLatin1String("user"), user);
|
||||
settings.setValue(QLatin1String("pass"), pass.toUtf8().toBase64());
|
||||
}
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
@@ -484,6 +557,11 @@ int MirallConfigFile::proxyPort() const
|
||||
return getValue(QLatin1String("port"), QLatin1String("proxy")).toInt();
|
||||
}
|
||||
|
||||
bool MirallConfigFile::proxyNeedsAuth() const
|
||||
{
|
||||
return getValue(QLatin1String("needsAuth"), QLatin1String("proxy")).toBool();
|
||||
}
|
||||
|
||||
QString MirallConfigFile::proxyUser() const
|
||||
{
|
||||
return getValue(QLatin1String("user"), QLatin1String("proxy")).toString();
|
||||
|
||||
@@ -27,6 +27,7 @@ class MirallConfigFile
|
||||
/* let only CredentialStore read the password from the file. All other classes
|
||||
* should work with CredentialStore to get the credentials. */
|
||||
friend class CredentialStore;
|
||||
friend class ConnectionValidator;
|
||||
public:
|
||||
MirallConfigFile( const QString& appendix = QString() );
|
||||
|
||||
@@ -50,11 +51,11 @@ public:
|
||||
void writeOwncloudConfig( const QString& connection,
|
||||
const QString& url,
|
||||
const QString& user,
|
||||
const QString& passwd,
|
||||
bool https, bool skipPwd );
|
||||
const QString& passwd );
|
||||
|
||||
void removeConnection( const QString& connection = QString() );
|
||||
|
||||
QString ownCloudUser( const QString& connection = QString() ) const;
|
||||
QString ownCloudUrl( const QString& connection = QString(), bool webdav = false ) const;
|
||||
|
||||
void setOwnCloudUrl(const QString &connection, const QString& );
|
||||
@@ -63,18 +64,22 @@ public:
|
||||
QByteArray caCerts();
|
||||
void setCaCerts( const QByteArray& );
|
||||
|
||||
bool passwordStorageAllowed(const QString &);
|
||||
bool passwordStorageAllowed(const QString &connection = QString::null );
|
||||
|
||||
QString ownCloudVersion() const;
|
||||
void setOwnCloudVersion( const QString& );
|
||||
|
||||
// max count of lines in the log window
|
||||
int maxLogLines() const;
|
||||
void setMaxLogLines(int);
|
||||
|
||||
bool ownCloudSkipUpdateCheck( const QString& connection = QString() ) const;
|
||||
void setOwnCloudSkipUpdateCheck( bool, const QString& );
|
||||
|
||||
/* Server poll interval in milliseconds */
|
||||
int remotePollInterval( const QString& connection = QString() ) const;
|
||||
/* Set poll interval. Value in microseconds has to be larger than 5000 */
|
||||
void setRemotePollInterval(int interval, const QString& connection = QString() );
|
||||
|
||||
// Custom Config: accept the custom config to become the main one.
|
||||
void acceptCustomConfig();
|
||||
@@ -84,20 +89,24 @@ public:
|
||||
// proxy settings
|
||||
void setProxyType(int proxyType,
|
||||
const QString& host = QString(),
|
||||
int port = 0,
|
||||
int port = 0, bool needsAuth = false,
|
||||
const QString& user = QString(),
|
||||
const QString& pass = QString());
|
||||
|
||||
int proxyType() const;
|
||||
QString proxyHostName() const;
|
||||
int proxyPort() const;
|
||||
bool proxyNeedsAuth() const;
|
||||
QString proxyUser() const;
|
||||
QString proxyPassword() const;
|
||||
|
||||
static void setConfDir(const QString &value);
|
||||
|
||||
QString seenVersion() const;
|
||||
void setSeenVersion(const QString &version);
|
||||
protected:
|
||||
// these classes can only be access from CredentialStore as a friend class.
|
||||
QString ownCloudPasswd( const QString& connection = QString() ) const;
|
||||
QString ownCloudUser( const QString& connection = QString() ) const;
|
||||
void clearPasswordFromConfig( const QString& connect = QString() );
|
||||
bool writePassword( const QString& passwd, const QString& connection = QString() );
|
||||
|
||||
@@ -108,6 +117,7 @@ private:
|
||||
private:
|
||||
static bool _askedUser;
|
||||
static QString _oCVersion;
|
||||
static QString _confDir;
|
||||
QString _customHandle;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,107 +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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "miralltheme.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
mirallTheme::mirallTheme()
|
||||
{
|
||||
qDebug() << " ** running mirall theme!";
|
||||
}
|
||||
|
||||
QString mirallTheme::appName() const
|
||||
{
|
||||
return QLatin1String("Mirall");
|
||||
}
|
||||
|
||||
QString mirallTheme::configFileName() const
|
||||
{
|
||||
return QLatin1String("mirall.cfg");
|
||||
}
|
||||
|
||||
QPixmap mirallTheme::splashScreen() const
|
||||
{
|
||||
return QPixmap(QLatin1String(":/mirall/resources/owncloud_splash.png")); // FIXME: mirall splash!
|
||||
}
|
||||
|
||||
QIcon mirallTheme::folderIcon( const QString& backend ) const
|
||||
{
|
||||
QString name;
|
||||
|
||||
if( backend == QString::fromLatin1("owncloud")) {
|
||||
name = QLatin1String( "mirall" );
|
||||
}
|
||||
if( backend == QString::fromLatin1("unison" )) {
|
||||
name = QLatin1String( "folder-sync" );
|
||||
}
|
||||
if( backend == QString::fromLatin1("csync" )) {
|
||||
name = QLatin1String( "folder-remote" );
|
||||
}
|
||||
if( backend.isEmpty() || backend == QString::fromLatin1("none") ) {
|
||||
name = QLatin1String("folder-grey.png");
|
||||
}
|
||||
|
||||
qDebug() << "==> load folder icon " << name;
|
||||
return themeIcon( name );
|
||||
}
|
||||
|
||||
QIcon mirallTheme::syncStateIcon( SyncResult::Status status, bool sysTray ) const
|
||||
{
|
||||
QString statusIcon;
|
||||
|
||||
switch( status ) {
|
||||
case SyncResult::Undefined:
|
||||
statusIcon = QLatin1String("dialog-close");
|
||||
break;
|
||||
case SyncResult::NotYetStarted:
|
||||
statusIcon = QLatin1String("task-ongoing");
|
||||
break;
|
||||
case SyncResult::SyncRunning:
|
||||
statusIcon = QLatin1String("view-refresh");
|
||||
break;
|
||||
case SyncResult::Success:
|
||||
statusIcon = QLatin1String("dialog-ok");
|
||||
break;
|
||||
case SyncResult::Error:
|
||||
statusIcon = QLatin1String("dialog-close");
|
||||
break;
|
||||
case SyncResult::SetupError:
|
||||
statusIcon = QLatin1String("dialog-cancel");
|
||||
break;
|
||||
default:
|
||||
statusIcon = QLatin1String("dialog-close");
|
||||
}
|
||||
return themeIcon( statusIcon, sysTray );
|
||||
}
|
||||
|
||||
|
||||
QIcon mirallTheme::folderDisabledIcon() const
|
||||
{
|
||||
// Fixme: Do we really want the dialog-canel from theme here?
|
||||
return themeIcon( QLatin1String("dialog-cancel") );
|
||||
}
|
||||
|
||||
QIcon mirallTheme::applicationIcon( ) const
|
||||
{
|
||||
return themeIcon( QLatin1String("mirall"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,42 +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; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef MIRALL_THEME_H
|
||||
#define MIRALL_THEME_H
|
||||
|
||||
#include "theme.h"
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
class mirallTheme : public Theme
|
||||
{
|
||||
public:
|
||||
mirallTheme();
|
||||
|
||||
virtual QString appName() const;
|
||||
virtual QString configFileName() const;
|
||||
QPixmap splashScreen() const;
|
||||
|
||||
QIcon folderIcon( const QString& ) const;
|
||||
QIcon syncStateIcon(SyncResult::Status, bool) const;
|
||||
QIcon folderDisabledIcon() const;
|
||||
QIcon applicationIcon() const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif // MIRALL_THEME_H
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <QtCore/QtDebug>
|
||||
#include <QtCore/QFile>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
void Owncloudclient::setVersion( const QString &v )
|
||||
{
|
||||
mVersion = v;
|
||||
@@ -147,4 +149,4 @@ bool Owncloudclient::writeFile( const QString &filename )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace Mirall
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <QDomElement>
|
||||
#include <QtXml/QXmlStreamWriter>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
class Owncloudclient
|
||||
{
|
||||
public:
|
||||
@@ -31,4 +33,6 @@ class Owncloudclient
|
||||
QString mWeb;
|
||||
};
|
||||
|
||||
} // namespace Mirall
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "mirall/owncloudinfo.h"
|
||||
#include "mirall/credentialstore.h"
|
||||
#include "mirall/logger.h"
|
||||
#include "mirall/utility.h"
|
||||
|
||||
#include <csync.h>
|
||||
|
||||
@@ -32,9 +33,19 @@
|
||||
#include <QNetworkProxy>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkProxyFactory>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
void csyncLogCatcher(CSYNC *ctx,
|
||||
int verbosity,
|
||||
const char *function,
|
||||
const char *buffer,
|
||||
void *userdata)
|
||||
{
|
||||
Logger::instance()->csyncLog( QString::fromUtf8(buffer) );
|
||||
}
|
||||
|
||||
static QString replaceScheme(const QString &urlStr)
|
||||
{
|
||||
@@ -50,29 +61,178 @@ static QString replaceScheme(const QString &urlStr)
|
||||
}
|
||||
|
||||
ownCloudFolder::ownCloudFolder(const QString &alias,
|
||||
const QString &path,
|
||||
const QString &mpath,
|
||||
const QString &secondPath,
|
||||
QObject *parent)
|
||||
: Folder(alias, path, secondPath, parent)
|
||||
, _secondPath(secondPath)
|
||||
: Folder(alias, mpath, secondPath, parent)
|
||||
, _thread(0)
|
||||
, _csync(0)
|
||||
, _csyncError(false)
|
||||
, _csyncUnavail(false)
|
||||
, _wipeDb(false)
|
||||
{
|
||||
_notifier = new DownloadNotifier(QDir::fromNativeSeparators(path),
|
||||
replaceScheme(secondPath), this);
|
||||
connect(_notifier, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(guiLog(QString,QString)));
|
||||
ServerActionNotifier *notifier = new ServerActionNotifier(this);
|
||||
connect(notifier, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(guiLog(QString,QString)));
|
||||
connect(this, SIGNAL(syncFinished(SyncResult)), notifier, SLOT(slotSyncFinished(SyncResult)));
|
||||
qDebug() << "****** ownCloud folder using watcher *******";
|
||||
// The folder interval is set in the folder parent class.
|
||||
|
||||
QString url = replaceScheme(secondPath);
|
||||
QString localpath = path();
|
||||
|
||||
if( csync_create( &_csync_ctx, localpath.toUtf8().data(), url.toUtf8().data() ) < 0 ) {
|
||||
qDebug() << "Unable to create csync-context!";
|
||||
_csync_ctx = 0;
|
||||
} else {
|
||||
csync_set_log_callback( _csync_ctx, csyncLogCatcher );
|
||||
csync_set_log_verbosity(_csync_ctx, 11);
|
||||
|
||||
MirallConfigFile cfgFile;
|
||||
csync_set_config_dir( _csync_ctx, cfgFile.configPath().toUtf8() );
|
||||
|
||||
csync_enable_conflictcopys(_csync_ctx);
|
||||
QString excludeList = cfgFile.excludeFile();
|
||||
if( !excludeList.isEmpty() ) {
|
||||
qDebug() << "==== added CSync exclude List: " << excludeList.toUtf8();
|
||||
csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() );
|
||||
}
|
||||
csync_set_auth_callback( _csync_ctx, getauth );
|
||||
|
||||
if( csync_init( _csync_ctx ) < 0 ) {
|
||||
qDebug() << "Could not initialize csync!" << csync_get_error(_csync_ctx) << csync_get_error_string(_csync_ctx);
|
||||
slotCSyncError(CSyncThread::csyncErrorToString(csync_get_error(_csync_ctx), csync_get_error_string(_csync_ctx)));
|
||||
csync_destroy(_csync_ctx);
|
||||
_csync_ctx = 0;
|
||||
}
|
||||
setProxy();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ownCloudFolder::~ownCloudFolder()
|
||||
{
|
||||
|
||||
if( _thread ) {
|
||||
_thread->quit();
|
||||
csync_request_abort(_csync_ctx);
|
||||
_thread->wait();
|
||||
}
|
||||
delete _csync;
|
||||
// Destroy csync here.
|
||||
csync_destroy(_csync_ctx);
|
||||
}
|
||||
|
||||
void ownCloudFolder::setProxy()
|
||||
{
|
||||
if( _csync_ctx ) {
|
||||
/* Store proxy */
|
||||
MirallConfigFile cfgFile;
|
||||
QUrl proxyUrl(cfgFile.ownCloudUrl());
|
||||
QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(proxyUrl);
|
||||
// We set at least one in Application
|
||||
Q_ASSERT(proxies.count() > 0);
|
||||
QNetworkProxy proxy = proxies.first();
|
||||
if (proxy.type() == QNetworkProxy::NoProxy) {
|
||||
qDebug() << "Passing NO proxy to csync for" << cfgFile.ownCloudUrl();
|
||||
} else {
|
||||
qDebug() << "Passing" << proxy.hostName() << "of proxy type " << proxy.type()
|
||||
<< " to csync for" << cfgFile.ownCloudUrl();
|
||||
}
|
||||
int proxyPort = proxy.port();
|
||||
|
||||
csync_set_module_property(_csync_ctx, "proxy_type", (char*) proxyTypeToCStr(proxy.type()) );
|
||||
csync_set_module_property(_csync_ctx, "proxy_host", proxy.hostName().toUtf8().data() );
|
||||
csync_set_module_property(_csync_ctx, "proxy_port", &proxyPort );
|
||||
csync_set_module_property(_csync_ctx, "proxy_user", proxy.user().toUtf8().data() );
|
||||
csync_set_module_property(_csync_ctx, "proxy_pwd" , proxy.password().toUtf8().data() );
|
||||
|
||||
csync_set_module_property(_csync_ctx, "csync_context", _csync_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
const char* ownCloudFolder::proxyTypeToCStr(QNetworkProxy::ProxyType type)
|
||||
{
|
||||
switch (type) {
|
||||
case QNetworkProxy::NoProxy:
|
||||
return "NoProxy";
|
||||
case QNetworkProxy::DefaultProxy:
|
||||
return "DefaultProxy";
|
||||
case QNetworkProxy::Socks5Proxy:
|
||||
return "Socks5Proxy";
|
||||
case QNetworkProxy::HttpProxy:
|
||||
return "HttpProxy";
|
||||
case QNetworkProxy::HttpCachingProxy:
|
||||
return "HttpCachingProxy";
|
||||
case QNetworkProxy::FtpCachingProxy:
|
||||
return "FtpCachingProxy";
|
||||
default:
|
||||
return "NoProxy";
|
||||
}
|
||||
}
|
||||
|
||||
int ownCloudFolder::getauth(const char *prompt,
|
||||
char *buf,
|
||||
size_t len,
|
||||
int echo,
|
||||
int verify,
|
||||
void *userdata
|
||||
)
|
||||
{
|
||||
int re = 0;
|
||||
QMutex mutex;
|
||||
|
||||
QString qPrompt = QString::fromLatin1( prompt ).trimmed();
|
||||
QString user = CredentialStore::instance()->user();
|
||||
QString pwd = CredentialStore::instance()->password();
|
||||
|
||||
if( qPrompt == QLatin1String("Enter your username:") ) {
|
||||
// qDebug() << "OOO Username requested!";
|
||||
QMutexLocker locker( &mutex );
|
||||
qstrncpy( buf, user.toUtf8().constData(), len );
|
||||
} else if( qPrompt == QLatin1String("Enter your password:") ) {
|
||||
QMutexLocker locker( &mutex );
|
||||
// qDebug() << "OOO Password requested!";
|
||||
qstrncpy( buf, pwd.toUtf8().constData(), len );
|
||||
} else {
|
||||
if( qPrompt.startsWith( QLatin1String("There are problems with the SSL certificate:"))) {
|
||||
// SSL is requested. If the program came here, the SSL check was done by mirall
|
||||
// It needs to be checked if the chain is still equal to the one which
|
||||
// was verified by the user.
|
||||
QRegExp regexp("fingerprint: ([\\w\\d:]+)");
|
||||
bool certOk = false;
|
||||
|
||||
int pos = 0;
|
||||
|
||||
// This is the set of certificates which QNAM accepted, so we should accept
|
||||
// them as well
|
||||
QList<QSslCertificate> certs = ownCloudInfo::instance()->certificateChain();
|
||||
|
||||
while (!certOk && (pos = regexp.indexIn(qPrompt, 1+pos)) != -1) {
|
||||
QString neon_fingerprint = regexp.cap(1);
|
||||
|
||||
foreach( const QSslCertificate& c, certs ) {
|
||||
QString verified_shasum = Utility::formatFingerprint(c.digest(QCryptographicHash::Sha1).toHex());
|
||||
qDebug() << "SSL Fingerprint from neon: " << neon_fingerprint << " compared to verified: " << verified_shasum;
|
||||
if( verified_shasum == neon_fingerprint ) {
|
||||
certOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// certOk = false; DEBUG setting, keep disabled!
|
||||
if( !certOk ) { // Problem!
|
||||
qstrcpy( buf, "no" );
|
||||
re = -1;
|
||||
} else {
|
||||
qstrcpy( buf, "yes" ); // Certificate is fine!
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Unknown prompt: <" << prompt << ">";
|
||||
re = -1;
|
||||
}
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
|
||||
bool ownCloudFolder::isBusy() const
|
||||
{
|
||||
return ( _thread && _thread->isRunning() );
|
||||
@@ -80,9 +240,12 @@ bool ownCloudFolder::isBusy() const
|
||||
|
||||
QString ownCloudFolder::secondPath() const
|
||||
{
|
||||
QString re(_secondPath);
|
||||
QString re(Folder::secondPath());
|
||||
MirallConfigFile cfg;
|
||||
const QString ocUrl = cfg.ownCloudUrl(QString::null, true);
|
||||
QString ocUrl = cfg.ownCloudUrl(QString::null, true);
|
||||
if (ocUrl.endsWith(QLatin1Char('/')))
|
||||
ocUrl.chop(1);
|
||||
|
||||
// qDebug() << "**** " << ocUrl << " <-> " << re;
|
||||
if( re.startsWith( ocUrl ) ) {
|
||||
re.remove( ocUrl );
|
||||
@@ -91,15 +254,6 @@ QString ownCloudFolder::secondPath() const
|
||||
return re;
|
||||
}
|
||||
|
||||
QString ownCloudFolder::nativeSecondPath() const
|
||||
{
|
||||
// TODO: fold into secondPath() after 1.1.0 release
|
||||
QString path = secondPath();
|
||||
if (!path.startsWith(QLatin1Char('/')) || path.isEmpty())
|
||||
path.prepend(QLatin1Char('/'));
|
||||
return path;
|
||||
}
|
||||
|
||||
void ownCloudFolder::startSync()
|
||||
{
|
||||
startSync( QStringList() );
|
||||
@@ -107,40 +261,40 @@ void ownCloudFolder::startSync()
|
||||
|
||||
void ownCloudFolder::startSync(const QStringList &pathList)
|
||||
{
|
||||
if (!_csync_ctx) {
|
||||
qDebug() << Q_FUNC_INFO << "_csync_ctx is empty. probably because csync_init has failed.";
|
||||
// the error should already be set
|
||||
QMetaObject::invokeMethod(this, "slotCSyncFinished", Qt::QueuedConnection);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_thread && _thread->isRunning()) {
|
||||
qCritical() << "* ERROR csync is still running and new sync requested.";
|
||||
return;
|
||||
}
|
||||
if (_thread)
|
||||
_thread->quit();
|
||||
delete _csync;
|
||||
delete _thread;
|
||||
_errors.clear();
|
||||
_csyncError = false;
|
||||
_csyncUnavail = false;
|
||||
_wipeDb = false;
|
||||
|
||||
MirallConfigFile cfgFile;
|
||||
|
||||
_syncResult.clearErrors();
|
||||
// we now have watchers for everything, so every sync is remote.
|
||||
_syncResult.setLocalRunOnly( false );
|
||||
Folder::startSync( pathList );
|
||||
_syncResult.setStatus( SyncResult::SyncPrepare );
|
||||
emit syncStateChange();
|
||||
|
||||
QString url = replaceScheme(_secondPath);
|
||||
|
||||
qDebug() << "*** Start syncing url to ownCloud: " << url;
|
||||
qDebug() << "*** Start syncing";
|
||||
_thread = new QThread(this);
|
||||
_csync = new CSyncThread( path(), url);
|
||||
_csync = new CSyncThread( _csync_ctx );
|
||||
_csync->moveToThread(_thread);
|
||||
|
||||
QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QUrl(cfgFile.ownCloudUrl()));
|
||||
// We set at least one in Application
|
||||
Q_ASSERT(proxies.count() > 0);
|
||||
QNetworkProxy proxy = proxies.first();
|
||||
|
||||
_csync->setConnectionDetails( CredentialStore::instance()->user(),
|
||||
CredentialStore::instance()->password(),
|
||||
proxy );
|
||||
qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector");
|
||||
qRegisterMetaType<SyncFileItem::Direction>("SyncFileItem::Direction");
|
||||
|
||||
connect( _csync, SIGNAL(treeWalkResult(const SyncFileItemVector&)),
|
||||
this, SLOT(slotThreadTreeWalkResult(const SyncFileItemVector&)), Qt::QueuedConnection);
|
||||
|
||||
@@ -148,18 +302,21 @@ void ownCloudFolder::startSync(const QStringList &pathList)
|
||||
connect(_csync, SIGNAL(finished()), SLOT(slotCSyncFinished()), Qt::QueuedConnection);
|
||||
connect(_csync, SIGNAL(csyncError(QString)), SLOT(slotCSyncError(QString)), Qt::QueuedConnection);
|
||||
connect(_csync, SIGNAL(csyncUnavailable()), SLOT(slotCsyncUnavailable()), Qt::QueuedConnection);
|
||||
connect(_csync, SIGNAL(fileReceived(QString)),
|
||||
_notifier, SLOT(slotFileReceived(QString)), Qt::QueuedConnection);
|
||||
|
||||
//blocking connection so the message box happens in this thread, but block the csync thread.
|
||||
connect(_csync, SIGNAL(aboutToRemoveAllFiles(SyncFileItem::Direction,bool*)),
|
||||
SLOT(slotAboutToRemoveAllFiles(SyncFileItem::Direction,bool*)), Qt::BlockingQueuedConnection);
|
||||
|
||||
_thread->start();
|
||||
QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection);
|
||||
|
||||
emit syncStarted();
|
||||
}
|
||||
|
||||
void ownCloudFolder::slotCSyncStarted()
|
||||
{
|
||||
qDebug() << " * csync thread started";
|
||||
emit syncStarted();
|
||||
_syncResult.setStatus(SyncResult::SyncRunning);
|
||||
emit syncStateChange();
|
||||
}
|
||||
|
||||
void ownCloudFolder::slotCSyncError(const QString& err)
|
||||
@@ -183,7 +340,6 @@ void ownCloudFolder::slotCSyncFinished()
|
||||
qDebug() << " ** error Strings: " << _errors;
|
||||
_syncResult.setErrorStrings( _errors );
|
||||
qDebug() << " * owncloud csync thread finished with error";
|
||||
if( _wipeDb ) wipe();
|
||||
} else if (_csyncUnavail) {
|
||||
_syncResult.setStatus(SyncResult::Unavailable);
|
||||
} else {
|
||||
@@ -204,19 +360,19 @@ void ownCloudFolder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
|
||||
void ownCloudFolder::slotTerminateSync()
|
||||
{
|
||||
qDebug() << "folder " << alias() << " Terminating!";
|
||||
QString configDir = _csync->csyncConfigDir();
|
||||
MirallConfigFile cfg;
|
||||
QString configDir = cfg.configPath();
|
||||
qDebug() << "csync's Config Dir: " << configDir;
|
||||
|
||||
if( _thread ) {
|
||||
_thread->terminate();
|
||||
if( _thread && _csync ) {
|
||||
csync_request_abort(_csync_ctx);
|
||||
_thread->quit();
|
||||
_thread->wait();
|
||||
// TODO: crashes on win, leak for now, fix properly after 1.1.0
|
||||
#ifndef Q_OS_WIN
|
||||
delete _csync;
|
||||
#endif
|
||||
_csync->deleteLater();
|
||||
delete _thread;
|
||||
_csync = 0;
|
||||
_thread = 0;
|
||||
csync_resume(_csync_ctx);
|
||||
}
|
||||
|
||||
if( ! configDir.isEmpty() ) {
|
||||
@@ -277,43 +433,100 @@ void ownCloudFolder::wipe()
|
||||
if( ctmpFile.exists() ) {
|
||||
ctmpFile.remove();
|
||||
}
|
||||
_wipeDb = false;
|
||||
}
|
||||
|
||||
DownloadNotifier::DownloadNotifier(const QString &localPrefix, const QString &remotePrefix, QObject *parent)
|
||||
: QObject(parent), _timer(new QTimer(this)), _items(0)
|
||||
ServerActionNotifier::ServerActionNotifier(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
_timer->setSingleShot(true);
|
||||
connect(_timer, SIGNAL(timeout()), SLOT(sendResults()));
|
||||
|
||||
_localPrefix = localPrefix;
|
||||
_remotePrefix = remotePrefix;
|
||||
}
|
||||
|
||||
void DownloadNotifier::slotFileReceived(const QString & url)
|
||||
void ServerActionNotifier::slotSyncFinished(const SyncResult &result)
|
||||
{
|
||||
if (_url.isEmpty())
|
||||
_url = url;
|
||||
_items++;
|
||||
_timer->stop();
|
||||
_timer->start(1000);
|
||||
SyncFileItemVector items = result.syncFileItemVector();
|
||||
if (items.count() == 0)
|
||||
return;
|
||||
|
||||
int newItems = 0;
|
||||
int removedItems = 0;
|
||||
int updatedItems = 0;
|
||||
SyncFileItem firstItemNew;
|
||||
SyncFileItem firstItemDeleted;
|
||||
SyncFileItem firstItemUpdated;
|
||||
foreach (const SyncFileItem &item, items) {
|
||||
if (item._dir == SyncFileItem::Down) {
|
||||
switch (item._instruction) {
|
||||
case CSYNC_INSTRUCTION_NEW:
|
||||
newItems++;
|
||||
if (firstItemNew.isEmpty())
|
||||
firstItemNew = item;
|
||||
break;
|
||||
case CSYNC_INSTRUCTION_REMOVE:
|
||||
removedItems++;
|
||||
if (firstItemDeleted.isEmpty())
|
||||
firstItemDeleted = item;
|
||||
break;
|
||||
case CSYNC_INSTRUCTION_UPDATED:
|
||||
updatedItems++;
|
||||
if (firstItemUpdated.isEmpty())
|
||||
firstItemUpdated = item;
|
||||
break;
|
||||
default:
|
||||
// nothing.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newItems > 0) {
|
||||
QString file = QDir::toNativeSeparators(firstItemNew._file);
|
||||
if (newItems == 1)
|
||||
emit guiLog(tr("New file available"), tr("'%1' has been synced to this machine.").arg(file));
|
||||
else
|
||||
emit guiLog(tr("New files available"), tr("'%1' and %n other file(s) have been synced to this machine.",
|
||||
"", newItems-1).arg(file));
|
||||
}
|
||||
if (removedItems > 0) {
|
||||
QString file = QDir::toNativeSeparators(firstItemDeleted._file);
|
||||
if (removedItems == 1)
|
||||
emit guiLog(tr("File removed"), tr("'%1' has been removed.").arg(file));
|
||||
else
|
||||
emit guiLog(tr("Files removed"), tr("'%1' and %n other file(s) have been removed.",
|
||||
"", removedItems-1).arg(file));
|
||||
}
|
||||
if (updatedItems > 0) {
|
||||
QString file = QDir::toNativeSeparators(firstItemUpdated._file);
|
||||
if (updatedItems == 1)
|
||||
emit guiLog(tr("File updated"), tr("'%1' has been updated.").arg(file));
|
||||
else
|
||||
emit guiLog(tr("Files updated"), tr("'%1' and %n other file(s) have been updated.",
|
||||
"", updatedItems-1).arg(file));
|
||||
}
|
||||
}
|
||||
|
||||
void DownloadNotifier::sendResults()
|
||||
void ownCloudFolder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel)
|
||||
{
|
||||
QString file = _url;
|
||||
file.replace(_remotePrefix, _localPrefix);
|
||||
file = QDir::toNativeSeparators(QDir::cleanPath(file));
|
||||
if (_items == 1)
|
||||
emit guiLog(tr("New file available"), tr("'%1' has been synced to this machine.").arg(file));
|
||||
else
|
||||
emit guiLog(tr("New files available"), tr("'%1' and %n other file(s) have been synced to this machine.",
|
||||
"", _items-1).arg(file).arg(_items));
|
||||
|
||||
// reset
|
||||
_items = 0;
|
||||
_url = QString::null;
|
||||
QString msg = direction == SyncFileItem::Down ?
|
||||
tr("This sync would remove all the files in the local sync folder '%1'.\n"
|
||||
"If you or your administrator have reset your account on the server, choose "
|
||||
"\"Keep files\". If you want your data to be removed, choose \"Remove all files\".") :
|
||||
tr("This sync would remove all the files in the sync folder '%1'.\n"
|
||||
"This might be because the folder was silently reconfigured, or that all "
|
||||
"the file were manually removed.\n"
|
||||
"Are you sure you want to perform this operation?");
|
||||
QMessageBox msgBox(QMessageBox::Warning, tr("Remove All Files?"),
|
||||
msg.arg(alias()));
|
||||
msgBox.addButton(tr("Remove all files"), QMessageBox::DestructiveRole);
|
||||
QPushButton* keepBtn = msgBox.addButton(tr("Keep files"), QMessageBox::ActionRole);
|
||||
if (msgBox.exec() == -1) {
|
||||
*cancel = true;
|
||||
return;
|
||||
}
|
||||
*cancel = msgBox.clickedButton() == keepBtn;
|
||||
if (*cancel) {
|
||||
wipe();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -42,23 +42,17 @@ enum SyncFileStatus_s {
|
||||
};
|
||||
typedef SyncFileStatus_s SyncFileStatus;
|
||||
|
||||
class DownloadNotifier : public QObject
|
||||
class ServerActionNotifier : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DownloadNotifier(const QString &localPrefix, const QString &remotePrefix, QObject *parent = 0);
|
||||
ServerActionNotifier(QObject *parent = 0);
|
||||
public slots:
|
||||
void slotFileReceived(const QString&);
|
||||
void slotSyncFinished(const SyncResult &result);
|
||||
signals:
|
||||
void guiLog(const QString&, const QString&);
|
||||
private slots:
|
||||
void sendResults();
|
||||
private:
|
||||
QTimer *_timer;
|
||||
QString _url;
|
||||
QString _localPrefix;
|
||||
QString _remotePrefix;
|
||||
int _items;
|
||||
};
|
||||
|
||||
class ownCloudFolder : public Folder
|
||||
@@ -70,7 +64,6 @@ public:
|
||||
const QString &secondPath, QObject *parent = 0L);
|
||||
virtual ~ownCloudFolder();
|
||||
QString secondPath() const;
|
||||
QString nativeSecondPath() const;
|
||||
virtual bool isBusy() const;
|
||||
virtual void startSync(const QStringList &pathList);
|
||||
|
||||
@@ -79,9 +72,12 @@ public:
|
||||
/* get status about a singel file. */
|
||||
SyncFileStatus fileStatus( const QString& );
|
||||
|
||||
void setProxy();
|
||||
|
||||
public slots:
|
||||
void startSync();
|
||||
void slotTerminateSync();
|
||||
void slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool*);
|
||||
|
||||
protected slots:
|
||||
void slotLocalPathChanged( const QString& );
|
||||
@@ -94,7 +90,15 @@ private slots:
|
||||
void slotCSyncFinished();
|
||||
|
||||
private:
|
||||
DownloadNotifier *_notifier;
|
||||
static int getauth(const char *prompt,
|
||||
char *buf,
|
||||
size_t len,
|
||||
int echo,
|
||||
int verify,
|
||||
void *userdata
|
||||
);
|
||||
const char* proxyTypeToCStr(QNetworkProxy::ProxyType type);
|
||||
|
||||
QString _secondPath;
|
||||
QThread *_thread;
|
||||
CSyncThread *_csync;
|
||||
@@ -103,6 +107,8 @@ private:
|
||||
bool _csyncUnavail;
|
||||
bool _wipeDb;
|
||||
SyncFileItemVector _items;
|
||||
|
||||
CSYNC *_csync_ctx;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OwncloudFTPAccessPage</class>
|
||||
<widget class="QWidget" name="OwncloudFTPAccessPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>548</width>
|
||||
<height>324</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>FTP Access to your Webaccount:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>FTP Details and Credentials</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#585858;">The details here are used to install the owncloud data on your web space which is accessible over ftp. </span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>FTP-URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="ftpUrlEdit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>FTP-User:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="ftpUserEdit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="ftpPasswdEdit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>530</width>
|
||||
<height>114</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
#include "mirall/owncloudinfo.h"
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/version.h"
|
||||
#include "mirall/theme.h"
|
||||
#include "mirall/credentialstore.h"
|
||||
#include "mirall/utility.h"
|
||||
#include "mirall/logger.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
@@ -26,9 +26,22 @@
|
||||
#include <QHttp>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CONNECTION QLatin1String("default");
|
||||
|
||||
namespace Mirall
|
||||
{
|
||||
|
||||
class oCCookieJar : public QNetworkCookieJar
|
||||
{
|
||||
public:
|
||||
QList<QNetworkCookie> cookiesForUrl ( const QUrl & url ) const {
|
||||
QList<QNetworkCookie> list;
|
||||
return list;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
ownCloudInfo *ownCloudInfo::_instance = 0;
|
||||
|
||||
ownCloudInfo* ownCloudInfo::instance()
|
||||
@@ -48,24 +61,40 @@ ownCloudInfo* ownCloudInfo::instance()
|
||||
}
|
||||
|
||||
ownCloudInfo::ownCloudInfo() :
|
||||
QObject(0)
|
||||
QObject(0),
|
||||
_manager(0)
|
||||
{
|
||||
_connection = Theme::instance()->appName();
|
||||
connect(this, SIGNAL(guiLog(QString,QString)),
|
||||
Logger::instance(), SIGNAL(guiLog(QString,QString)));
|
||||
setNetworkAccessManager( new QNetworkAccessManager( this ) );
|
||||
|
||||
_manager = new QNetworkAccessManager( this );
|
||||
}
|
||||
|
||||
void ownCloudInfo::setNetworkAccessManager( QNetworkAccessManager* qnam )
|
||||
{
|
||||
delete _manager;
|
||||
qnam->setParent( this );
|
||||
_manager = qnam;
|
||||
|
||||
MirallConfigFile cfg( _configHandle );
|
||||
QSettings settings( cfg.configFile(), QSettings::IniFormat);
|
||||
QByteArray certs = settings.value(QLatin1String("CaCertificates")).toByteArray();
|
||||
QSslSocket::addDefaultCaCertificates(QSslCertificate::fromData(certs));
|
||||
QSslSocket::addDefaultCaCertificates(QSslCertificate::fromData(cfg.caCerts()));
|
||||
|
||||
connect( _manager, SIGNAL( sslErrors(QNetworkReply*, QList<QSslError>)),
|
||||
this, SIGNAL(sslFailed(QNetworkReply*, QList<QSslError>)) );
|
||||
|
||||
// The authenticationRequired signal is not handled because the creds are set
|
||||
// in the request header.
|
||||
#if 0
|
||||
connect( _manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
|
||||
this, SLOT(slotAuthentication(QNetworkReply*,QAuthenticator*)));
|
||||
#endif
|
||||
|
||||
// no cookie jar so far.
|
||||
_manager->setCookieJar(new oCCookieJar);
|
||||
|
||||
_certsUntrusted = false;
|
||||
|
||||
}
|
||||
|
||||
ownCloudInfo::~ownCloudInfo()
|
||||
@@ -85,18 +114,18 @@ bool ownCloudInfo::isConfigured()
|
||||
return cfgFile.connectionExists( _connection );
|
||||
}
|
||||
|
||||
void ownCloudInfo::checkInstallation()
|
||||
QNetworkReply *ownCloudInfo::checkInstallation()
|
||||
{
|
||||
/* No authentication required for this. */
|
||||
getRequest( QLatin1String("status.php"), false );
|
||||
return getRequest( QLatin1String("status.php"), false );
|
||||
}
|
||||
|
||||
void ownCloudInfo::getWebDAVPath( const QString& path )
|
||||
QNetworkReply* ownCloudInfo::getWebDAVPath( const QString& path )
|
||||
{
|
||||
getRequest( path, true );
|
||||
return getRequest( path, true );
|
||||
}
|
||||
|
||||
void ownCloudInfo::getRequest( const QString& path, bool webdav )
|
||||
QNetworkReply* ownCloudInfo::getRequest( const QString& path, bool webdav )
|
||||
{
|
||||
qDebug() << "Get Request to " << path;
|
||||
|
||||
@@ -117,10 +146,11 @@ void ownCloudInfo::getRequest( const QString& path, bool webdav )
|
||||
|
||||
connect( reply, SIGNAL( error(QNetworkReply::NetworkError )),
|
||||
this, SLOT(slotError( QNetworkReply::NetworkError )));
|
||||
return reply;
|
||||
}
|
||||
|
||||
#if QT46_IMPL
|
||||
void ownCloudInfo::mkdirRequest( const QString& dir )
|
||||
QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir )
|
||||
{
|
||||
qDebug() << "OCInfo Making dir " << dir;
|
||||
|
||||
@@ -131,23 +161,31 @@ void ownCloudInfo::mkdirRequest( const QString& dir )
|
||||
conMode = QHttp::ConnectionModeHttps;
|
||||
|
||||
QHttp* qhttp = new QHttp(QString(url.encodedHost()), conMode, 0, this);
|
||||
qhttp->setUser( CredentialStore::instance()->user(_connection),
|
||||
CredentialStore::instance()->password(_connection) );
|
||||
|
||||
connect(qhttp, SIGNAL(requestStarted(int)), this,SLOT(qhttpRequestStarted(int)));
|
||||
connect(qhttp, SIGNAL(requestFinished(int, bool)), this,SLOT(qhttpRequestFinished(int,bool)));
|
||||
connect(qhttp, SIGNAL(responseHeaderReceived(QHttpResponseHeader)), this, SLOT(qhttpResponseHeaderReceived(QHttpResponseHeader)));
|
||||
//connect(qhttp, SIGNAL(authenticationRequired(QString,quint16,QAuthenticator*)), this, SLOT(qhttpAuthenticationRequired(QString,quint16,QAuthenticator*)));
|
||||
|
||||
QHttpRequestHeader header("MKCOL", QString(url.encodedPath()), 1,1); /* header */
|
||||
header.setValue("Host", QString(url.encodedHost()));
|
||||
header.setValue("User-Agent", QString("mirall-%1").arg(MIRALL_STRINGIFY(MIRALL_VERSION)).toAscii() );
|
||||
header.setValue("User-Agent", Utility::userAgentString());
|
||||
header.setValue("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
|
||||
header.setValue("Accept-Language", "it,de-de;q=0.8,it-it;q=0.6,en-us;q=0.4,en;q=0.2");
|
||||
header.setValue("Connection", "keep-alive");
|
||||
header.setContentType("application/x-www-form-urlencoded"); //important
|
||||
header.setContentLength(0);
|
||||
header.setValue("Authorization", CredentialStore::instance()->basicAuthHeader());
|
||||
|
||||
QString con = _configHandle;
|
||||
if( con.isEmpty() ) con = DEFAULT_CONNECTION;
|
||||
if( _credentials.contains(con)) {
|
||||
oCICredentials creds = _credentials.value(con);
|
||||
QString concatenated = creds.user + QLatin1Char(':') + creds.passwd;
|
||||
const QString b(QLatin1String("Basic "));
|
||||
QByteArray data = b.toLocal8Bit() + concatenated.toLocal8Bit().toBase64();
|
||||
header.setValue("Authorization", data);
|
||||
|
||||
qhttp->setUser( creds.user, creds.passwd );
|
||||
}
|
||||
|
||||
int david = qhttp->request(header,0,0);
|
||||
//////////////// connect(davinfo, SIGNAL(dataSendProgress(int,int)), this, SLOT(SendStatus(int, int)));
|
||||
@@ -155,7 +193,7 @@ void ownCloudInfo::mkdirRequest( const QString& dir )
|
||||
//connect(_http, SIGNAL(requestFinished(int, bool)), this,SLOT(qhttpRequestFinished(int,bool)));
|
||||
///////////connect(davinfo, SIGNAL(responseHeaderReceived(constQHttpResponseHeader &)), this, SLOT(RegisterBackHeader(constQHttpResponseHeader &)));
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ownCloudInfo::qhttpResponseHeaderReceived(const QHttpResponseHeader& header)
|
||||
@@ -184,7 +222,7 @@ void ownCloudInfo::qhttpRequestFinished(int id, bool success )
|
||||
}
|
||||
}
|
||||
#else
|
||||
void ownCloudInfo::mkdirRequest( const QString& dir )
|
||||
QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir )
|
||||
{
|
||||
qDebug() << "OCInfo Making dir " << dir;
|
||||
_authAttempts = 0;
|
||||
@@ -205,6 +243,7 @@ void ownCloudInfo::mkdirRequest( const QString& dir )
|
||||
connect( reply, SIGNAL(finished()), SLOT(slotMkdirFinished()) );
|
||||
connect( reply, SIGNAL( error(QNetworkReply::NetworkError )),
|
||||
this, SLOT(slotError(QNetworkReply::NetworkError )));
|
||||
return reply;
|
||||
}
|
||||
|
||||
void ownCloudInfo::slotMkdirFinished()
|
||||
@@ -226,6 +265,8 @@ void ownCloudInfo::slotMkdirFinished()
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: remove this later, once the new connection dialog has settled.
|
||||
#if 0
|
||||
void ownCloudInfo::slotAuthentication( QNetworkReply *reply, QAuthenticator *auth )
|
||||
{
|
||||
if( !(auth && reply) ) return;
|
||||
@@ -242,17 +283,27 @@ void ownCloudInfo::slotAuthentication( QNetworkReply *reply, QAuthenticator *aut
|
||||
MirallConfigFile cfgFile( configHandle );
|
||||
qDebug() << "Authenticating request for " << reply->url();
|
||||
if( reply->url().toString().startsWith( cfgFile.ownCloudUrl( _connection, true )) ) {
|
||||
auth->setUser( CredentialStore::instance()->user() ); //_connection ) );
|
||||
auth->setPassword( CredentialStore::instance()->password() ); // _connection ));
|
||||
|
||||
QString con = configHandle;
|
||||
if( con.isEmpty() ) con = DEFAULT_CONNECTION;
|
||||
if( _credentials.contains(con)) {
|
||||
oCICredentials creds = _credentials.value(con);
|
||||
|
||||
auth->setUser( creds.user );
|
||||
auth->setPassword( creds.passwd );
|
||||
} else {
|
||||
qDebug() << "Unable to get Credentials, not set!";
|
||||
reply->close();
|
||||
}
|
||||
} else {
|
||||
qDebug() << "WRN: attempt to authenticate to different url - attempt " <<_authAttempts;
|
||||
}
|
||||
if( _authAttempts > 10 ) {
|
||||
if( _authAttempts > 1) {
|
||||
qDebug() << "Too many attempts to authenticate. Stop request.";
|
||||
reply->close();
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
QString ownCloudInfo::configHandle(QNetworkReply *reply)
|
||||
{
|
||||
@@ -265,6 +316,7 @@ QString ownCloudInfo::configHandle(QNetworkReply *reply)
|
||||
|
||||
QList<QSslCertificate> ownCloudInfo::certificateChain() const
|
||||
{
|
||||
QMutexLocker lock(const_cast<QMutex*>(&_certChainMutex));
|
||||
return _certificateChain;
|
||||
}
|
||||
|
||||
@@ -292,6 +344,7 @@ void ownCloudInfo::slotReplyFinished()
|
||||
QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
|
||||
QSslConfiguration sslConfig = reply->sslConfiguration();
|
||||
if (!sslConfig.isNull()) {
|
||||
QMutexLocker lock(&_certChainMutex);
|
||||
_certificateChain = sslConfig.peerCertificateChain();
|
||||
}
|
||||
|
||||
@@ -385,7 +438,9 @@ void ownCloudInfo::slotReplyFinished()
|
||||
} else if( key == QLatin1String( "edition") ) {
|
||||
// get version out
|
||||
edition = val;
|
||||
} else {
|
||||
} else if(key == QLatin1String("installed")) {
|
||||
// Silently ignoring "installed = true" information
|
||||
} else {
|
||||
qDebug() << "Unknown info from ownCloud status.php: "<< key << "=" << val;
|
||||
}
|
||||
}
|
||||
@@ -428,7 +483,57 @@ bool ownCloudInfo::certsUntrusted()
|
||||
|
||||
void ownCloudInfo::slotError( QNetworkReply::NetworkError err)
|
||||
{
|
||||
qDebug() << "ownCloudInfo Network Error: " << err;
|
||||
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
|
||||
|
||||
qDebug() << "ownCloudInfo Network Error"
|
||||
<< err << ":" << reply->errorString();
|
||||
|
||||
switch (err) {
|
||||
case QNetworkReply::ProxyConnectionRefusedError:
|
||||
emit guiLog(tr("Proxy Refused Connection "),
|
||||
tr("The configured proxy has refused the connection. "
|
||||
"Please check the proxy settings."));
|
||||
break;
|
||||
case QNetworkReply::ProxyConnectionClosedError:
|
||||
emit guiLog(tr("Proxy Closed Connection"),
|
||||
tr("The configured proxy has closed the connection. "
|
||||
"Please check the proxy settings."));
|
||||
break;
|
||||
case QNetworkReply::ProxyNotFoundError:
|
||||
emit guiLog(tr("Proxy Not Found"),
|
||||
tr("The configured proxy could not be found. "
|
||||
"Please check the proxy settings."));
|
||||
break;
|
||||
case QNetworkReply::ProxyAuthenticationRequiredError:
|
||||
emit guiLog(tr("Proxy Authentication Error"),
|
||||
tr("The configured proxy requires login but the proxy credentials "
|
||||
"are invalid. Please check the proxy settings."));
|
||||
break;
|
||||
case QNetworkReply::ProxyTimeoutError:
|
||||
emit guiLog(tr("Proxy Connection Timed Out"),
|
||||
tr("The connection to the configured proxy has timed out."));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ownCloudInfo::setCredentials( const QString& user, const QString& passwd,
|
||||
const QString& configHandle )
|
||||
{
|
||||
QString con( configHandle );
|
||||
if( configHandle.isEmpty() )
|
||||
con = DEFAULT_CONNECTION;
|
||||
|
||||
if( _credentials.contains(con) ) {
|
||||
qDebug() << "Overwriting credentials for connection " << con;
|
||||
}
|
||||
|
||||
oCICredentials creds;
|
||||
creds.user = user;
|
||||
creds.passwd = passwd;
|
||||
creds.connection = con;
|
||||
_credentials[con] = creds;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -439,9 +544,17 @@ void ownCloudInfo::setupHeaders( QNetworkRequest & req, quint64 size )
|
||||
QUrl url( cfgFile.ownCloudUrl( QString::null, false ) );
|
||||
qDebug() << "Setting up host header: " << url.host();
|
||||
req.setRawHeader( QByteArray("Host"), url.host().toUtf8() );
|
||||
req.setRawHeader( QByteArray("User-Agent"), QString::fromLatin1("mirall-%1")
|
||||
.arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION))).toAscii());
|
||||
req.setRawHeader( QByteArray("Authorization"), CredentialStore::instance()->basicAuthHeader() );
|
||||
req.setRawHeader( QByteArray("User-Agent"), Utility::userAgentString());
|
||||
|
||||
QString con = _configHandle;
|
||||
if( con.isEmpty() ) con = DEFAULT_CONNECTION;
|
||||
if( _credentials.contains(con)) {
|
||||
oCICredentials creds = _credentials.value(con);
|
||||
QString concatenated = creds.user + QLatin1Char(':') + creds.passwd;
|
||||
const QString b(QLatin1String("Basic "));
|
||||
QByteArray data = b.toUtf8() + concatenated.toUtf8().toBase64();
|
||||
req.setRawHeader( QByteArray("Authorization"), data );
|
||||
}
|
||||
|
||||
if (size) {
|
||||
req.setHeader( QNetworkRequest::ContentLengthHeader, size);
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
namespace Mirall
|
||||
{
|
||||
|
||||
typedef struct {
|
||||
QString user;
|
||||
QString passwd;
|
||||
QString connection;
|
||||
} oCICredentials;
|
||||
|
||||
class ownCloudInfo : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -39,18 +45,18 @@ public:
|
||||
/**
|
||||
* call status.php
|
||||
*/
|
||||
void checkInstallation();
|
||||
QNetworkReply* checkInstallation();
|
||||
|
||||
/**
|
||||
* a general GET request to the ownCloud. If the second bool parameter is
|
||||
* true, the WebDAV server is queried.
|
||||
*/
|
||||
void getRequest( const QString&, bool );
|
||||
QNetworkReply* getRequest( const QString&, bool );
|
||||
|
||||
/**
|
||||
* convenience: GET request to the WebDAV server.
|
||||
*/
|
||||
void getWebDAVPath( const QString& );
|
||||
QNetworkReply* getWebDAVPath( const QString& );
|
||||
|
||||
/**
|
||||
* There is a global flag here if the user once decided against trusting the
|
||||
@@ -68,10 +74,18 @@ public:
|
||||
*/
|
||||
bool certsUntrusted();
|
||||
|
||||
/**
|
||||
* Set a NetworkAccessManager to be used
|
||||
*
|
||||
* This method will take ownership of the NetworkAccessManager, so you can just
|
||||
* set it initially and forget about its memory management.
|
||||
*/
|
||||
void setNetworkAccessManager( QNetworkAccessManager *qnam );
|
||||
|
||||
/**
|
||||
* Create a collection via owncloud. Provide a relative path.
|
||||
*/
|
||||
void mkdirRequest( const QString& );
|
||||
QNetworkReply* mkdirRequest( const QString& );
|
||||
|
||||
/**
|
||||
* Use a custom ownCloud configuration file identified by handle
|
||||
@@ -89,6 +103,13 @@ public:
|
||||
*/
|
||||
QList<QSslCertificate> certificateChain() const;
|
||||
|
||||
/**
|
||||
* Store credentials for a given connection. Empty connection parameter
|
||||
* means "default connection".
|
||||
*/
|
||||
void setCredentials( const QString&, const QString&,
|
||||
const QString& configHandle = QString::null );
|
||||
|
||||
signals:
|
||||
// result signal with url- and version string.
|
||||
void ownCloudInfoFound( const QString&, const QString&, const QString&, const QString& );
|
||||
@@ -97,13 +118,13 @@ signals:
|
||||
|
||||
void webdavColCreated( QNetworkReply::NetworkError );
|
||||
void sslFailed( QNetworkReply *reply, QList<QSslError> errors );
|
||||
|
||||
void guiLog( const QString& title, const QString& content );
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
void slotReplyFinished( );
|
||||
void slotError( QNetworkReply::NetworkError );
|
||||
void slotAuthentication( QNetworkReply*, QAuthenticator *);
|
||||
// void slotAuthentication( QNetworkReply*, QAuthenticator *);
|
||||
|
||||
#if QT46_IMPL
|
||||
void qhttpRequestFinished(int id, bool success );
|
||||
@@ -138,6 +159,8 @@ private:
|
||||
QList<QSslCertificate> _certificateChain;
|
||||
bool _certsUntrusted;
|
||||
int _authAttempts;
|
||||
QMap<QString, oCICredentials> _credentials;
|
||||
QMutex _certChainMutex;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<string>Do not allow the local storage of the password.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Do not store password on local machine.</string>
|
||||
<string>&Do not store password on local machine</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
478
src/mirall/owncloudsetuppage_ng.ui
Normal file
@@ -0,0 +1,478 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OwncloudSetupPage</class>
|
||||
<widget class="QWidget" name="OwncloudSetupPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<height>448</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QLabel" name="topLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>68</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="resultLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QWidget" name="advancedBox" native="true">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Local Folder</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>pbSelectLocalFolder</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pbSelectLocalFolder">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>pbSelectLocalFolder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="resolutionWidget" native="true">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string>&Keep local data</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><small>Syncs your existing data to new location.</small></string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QRadioButton" name="cbSyncFromScratch">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>If this box is checked, existing content in the local directory will be erased to start a clean sync from the server.</p><p>Do not check this if the local content should be uploaded to the servers directory.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Start a clean sync</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><small>Erases the contents of the local folder before syncing using the new settings.</small></string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Server &Address</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>leUrl</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Utils::FancyLineEdit" name="leUrl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter the url of the ownCloud you want to connect to (without http or https).</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>https://...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>&Username</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>leUsername</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Utils::FancyLineEdit" name="leUsername">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter the ownCloud username.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>&Password</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lePassword</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Utils::FancyLineEdit" name="lePassword">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter the ownCloud password.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="errorLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Error Label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbAdvanced">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Advanced &Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="3">
|
||||
<widget class="QLabel" name="syncModeLabel">
|
||||
<property name="text">
|
||||
<string>Status message</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="bottomLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::FancyLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">fancylineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>lePassword</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -12,16 +12,17 @@
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <QtCore>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "mirall/owncloudsetupwizard.h"
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/owncloudinfo.h"
|
||||
#include "mirall/folderman.h"
|
||||
#include "mirall/credentialstore.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
#include "mirall/utility.h"
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
@@ -29,98 +30,151 @@ class Theme;
|
||||
|
||||
OwncloudSetupWizard::OwncloudSetupWizard( FolderMan *folderMan, Theme *theme, QObject *parent ) :
|
||||
QObject( parent ),
|
||||
_mkdirRequestReply(0),
|
||||
_checkInstallationRequest(0),
|
||||
_folderMan(folderMan)
|
||||
{
|
||||
_process = new QProcess( this );
|
||||
|
||||
QObject::connect(_process, SIGNAL(readyReadStandardOutput()),
|
||||
SLOT(slotReadyReadStandardOutput()));
|
||||
|
||||
QObject::connect(_process, SIGNAL(readyReadStandardError()),
|
||||
SLOT(slotReadyReadStandardError()));
|
||||
|
||||
QObject::connect(_process, SIGNAL(stateChanged(QProcess::ProcessState)),
|
||||
SLOT(slotStateChanged(QProcess::ProcessState)));
|
||||
|
||||
QObject::connect(_process, SIGNAL(error(QProcess::ProcessError)),
|
||||
SLOT(slotError(QProcess::ProcessError)));
|
||||
|
||||
QObject::connect(_process, SIGNAL(started()),
|
||||
SLOT(slotStarted()));
|
||||
|
||||
QObject::connect(_process, SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
SLOT(slotProcessFinished(int, QProcess::ExitStatus)));
|
||||
|
||||
|
||||
_ocWizard = new OwncloudWizard();
|
||||
|
||||
connect( _ocWizard, SIGNAL(connectToOCUrl( const QString& ) ),
|
||||
this, SLOT(slotConnectToOCUrl( const QString& )));
|
||||
|
||||
connect( _ocWizard, SIGNAL(installOCServer()),
|
||||
this, SLOT(slotInstallOCServer()));
|
||||
|
||||
connect( _ocWizard, SIGNAL(installOCLocalhost()),
|
||||
this, SLOT(slotCreateOCLocalhost()));
|
||||
|
||||
connect( _ocWizard, SIGNAL(finished(int)),this,SLOT(slotAssistantFinished(int)));
|
||||
|
||||
// in case of cancel, terminate the owncloud-admin script.
|
||||
connect( _ocWizard, SIGNAL(rejected()), _process, SLOT(terminate()));
|
||||
|
||||
_ocWizard->setWindowTitle( tr("%1 Connection Wizard").arg( theme ? theme->appName() : QLatin1String("Mirall") ) );
|
||||
connect( _ocWizard, SIGNAL(clearPendingRequests()),
|
||||
this, SLOT(slotClearPendingRequests()));
|
||||
|
||||
_ocWizard->setWindowTitle( tr("%1 Connection Wizard").arg( theme->appNameGUI() ) );
|
||||
}
|
||||
|
||||
OwncloudSetupWizard::~OwncloudSetupWizard()
|
||||
{
|
||||
|
||||
_ocWizard->deleteLater();
|
||||
}
|
||||
|
||||
OwncloudWizard *OwncloudSetupWizard::wizard() {
|
||||
return _ocWizard;
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::startWizard()
|
||||
{
|
||||
// Set useful default values.
|
||||
MirallConfigFile cfgFile;
|
||||
// Fill the entry fields with existing values.
|
||||
QString url = cfgFile.ownCloudUrl();
|
||||
QString user = cfgFile.ownCloudUser();
|
||||
bool configExists = !( url.isEmpty() || user.isEmpty() );
|
||||
_ocWizard->setConfigExists( configExists );
|
||||
|
||||
if( !user.isEmpty() ) {
|
||||
_ocWizard->setOCUser( user );
|
||||
}
|
||||
|
||||
if( !url.isEmpty() ) {
|
||||
_ocWizard->setOCUrl( url );
|
||||
}
|
||||
|
||||
_remoteFolder = Theme::instance()->defaultServerFolder();
|
||||
// remoteFolder may be empty, which means /
|
||||
|
||||
QString localFolder = Theme::instance()->defaultClientFolder();
|
||||
|
||||
// if its a relative path, prepend with users home dir, otherwise use as absolute path
|
||||
if( !localFolder.startsWith(QLatin1Char('/')) ) {
|
||||
localFolder = QDir::homePath() + QDir::separator() + Theme::instance()->defaultClientFolder();
|
||||
}
|
||||
_ocWizard->setProperty("localFolder", localFolder);
|
||||
_ocWizard->setRemoteFolder(_remoteFolder);
|
||||
|
||||
_ocWizard->setStartId(OwncloudWizard::Page_oCSetup);
|
||||
|
||||
_ocWizard->restart();
|
||||
|
||||
// settings re-initialized in initPage must be set here after restart
|
||||
_ocWizard->setMultipleFoldersExist(_folderMan->map().count() > 1);
|
||||
|
||||
_ocWizard->show();
|
||||
_ocWizard->raise();
|
||||
}
|
||||
|
||||
|
||||
// Method executed when the user ends the wizard, either with 'accept' or 'reject'.
|
||||
// accept the custom config to be the main one if Accepted.
|
||||
void OwncloudSetupWizard::slotAssistantFinished( int result )
|
||||
{
|
||||
MirallConfigFile cfg( _configHandle );
|
||||
|
||||
|
||||
if( result == QDialog::Rejected ) {
|
||||
// the old config remains valid. Remove the temporary one.
|
||||
cfg.cleanupCustomConfig();
|
||||
qDebug() << "Rejected the new config, use the old!";
|
||||
} else if( result == QDialog::Accepted ) {
|
||||
qDebug() << "Config Changes were accepted!";
|
||||
// save the user credentials and afterwards clear the cred store.
|
||||
cfg.acceptCustomConfig();
|
||||
|
||||
// wipe all folder definitions so far.
|
||||
if( _folderMan ) _folderMan->removeAllFolderDefinitions();
|
||||
// go through all folders and remove the journals if the server changed.
|
||||
MirallConfigFile prevCfg;
|
||||
QUrl prevUrl( prevCfg.ownCloudUrl() );
|
||||
QUrl newUrl( cfg.ownCloudUrl() );
|
||||
|
||||
// Now write the resulting folder definition if folder names are set.
|
||||
if( !( _localFolder.isEmpty() || _remoteFolder.isEmpty() ) ) { // both variables are set.
|
||||
if( _folderMan ) {
|
||||
_folderMan->addFolderDefinition( QLatin1String("owncloud"), Theme::instance()->appName(),
|
||||
_localFolder, _remoteFolder, false );
|
||||
_ocWizard->appendToResultWidget(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(_localFolder));
|
||||
} else {
|
||||
qDebug() << "WRN: Folderman is zero in Setup Wizzard.";
|
||||
bool urlHasChanged = (prevUrl.host() != newUrl.host() || prevUrl.path() != newUrl.path());
|
||||
|
||||
// if the user changed, its also a changed url.
|
||||
if( prevCfg.ownCloudUser() != cfg.ownCloudUser() ) {
|
||||
urlHasChanged = true;
|
||||
qDebug() << "The User has changed, same as url change.";
|
||||
}
|
||||
|
||||
const QString localFolder = _ocWizard->localFolder();
|
||||
bool acceptCfg = true;
|
||||
|
||||
if( urlHasChanged ) {
|
||||
_folderMan->unloadAllFolders();
|
||||
|
||||
bool startFromScratch = _ocWizard->field( "OCSyncFromScratch" ).toBool();
|
||||
if( startFromScratch ) {
|
||||
// first try to rename (backup) the current local dir.
|
||||
bool renameOk = false;
|
||||
while( !renameOk ) {
|
||||
renameOk = _folderMan->startFromScratch(localFolder);
|
||||
if( ! renameOk ) {
|
||||
QMessageBox::StandardButton but;
|
||||
but = QMessageBox::question( 0, tr("Folder rename failed"),
|
||||
tr("Can't remove and back up the folder because the folder or a file in it is open in another program."
|
||||
"Please close the folder or file and hit retry or cancel the setup."), QMessageBox::Retry | QMessageBox::Abort, QMessageBox::Retry);
|
||||
if( but == QMessageBox::Abort ) {
|
||||
renameOk = true;
|
||||
acceptCfg = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// save the user credentials and afterwards clear the cred store.
|
||||
if( acceptCfg ) {
|
||||
cfg.acceptCustomConfig();
|
||||
}
|
||||
|
||||
// Now write the resulting folder definition if folder names are set.
|
||||
if( acceptCfg && urlHasChanged ) {
|
||||
_folderMan->removeAllFolderDefinitions();
|
||||
_folderMan->addFolderDefinition( QLatin1String("owncloud"), Theme::instance()->appName(),
|
||||
localFolder, _remoteFolder, false );
|
||||
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
|
||||
} else {
|
||||
// url is unchanged. Only the password was changed.
|
||||
if( acceptCfg ) {
|
||||
qDebug() << "Only password was changed, no changes to folder configuration.";
|
||||
} else {
|
||||
qDebug() << "User interrupted change of configuration.";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qDebug() << "WRN: Got unknown dialog result code " << result;
|
||||
}
|
||||
|
||||
// clear the custom config handle
|
||||
_configHandle.clear();
|
||||
ownCloudInfo::instance()->setCustomConfigHandle( QString::null );
|
||||
|
||||
// disconnect the ocInfo object
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
this, SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
this, SLOT(slotNoOwnCloudFound(QNetworkReply*)));
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),
|
||||
this, SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError)));
|
||||
|
||||
// notify others.
|
||||
emit ownCloudWizardDone( result );
|
||||
}
|
||||
@@ -129,25 +183,62 @@ void OwncloudSetupWizard::slotConnectToOCUrl( const QString& url )
|
||||
{
|
||||
qDebug() << "Connect to url: " << url;
|
||||
_ocWizard->setField(QLatin1String("OCUrl"), url );
|
||||
_ocWizard->appendToResultWidget(tr("Trying to connect to %1 at %2...")
|
||||
.arg( Theme::instance()->appName() ).arg(url) );
|
||||
_ocWizard->appendToConfigurationLog(tr("Trying to connect to %1 at %2...")
|
||||
.arg( Theme::instance()->appNameGUI() ).arg(url) );
|
||||
testOwnCloudConnect();
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotClearPendingRequests()
|
||||
{
|
||||
qDebug() << "Pending request: " << _mkdirRequestReply;
|
||||
if( _mkdirRequestReply && _mkdirRequestReply->isRunning() ) {
|
||||
qDebug() << "ABORTing pending mkdir request.";
|
||||
_mkdirRequestReply->abort();
|
||||
}
|
||||
if( _checkInstallationRequest && _checkInstallationRequest->isRunning() ) {
|
||||
qDebug() << "ABORTing pending check installation request.";
|
||||
_checkInstallationRequest->abort();
|
||||
}
|
||||
if( _checkRemoteFolderRequest && _checkRemoteFolderRequest->isRunning() ) {
|
||||
qDebug() << "ABORTing pending remote folder check request.";
|
||||
_checkRemoteFolderRequest->abort();
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::testOwnCloudConnect()
|
||||
{
|
||||
// write a temporary config.
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
|
||||
// remove a possibly existing custom config.
|
||||
if( ! _configHandle.isEmpty() ) {
|
||||
// remove the old config file.
|
||||
MirallConfigFile oldConfig( _configHandle );
|
||||
oldConfig.cleanupCustomConfig();
|
||||
}
|
||||
|
||||
_configHandle = now.toString(QLatin1String("MMddyyhhmmss"));
|
||||
|
||||
MirallConfigFile cfgFile( _configHandle );
|
||||
|
||||
QString url = _ocWizard->field(QLatin1String("OCUrl")).toString();
|
||||
if( url.isEmpty() ) return;
|
||||
if( !( url.startsWith(QLatin1String("https://")) || url.startsWith(QLatin1String("http://"))) ) {
|
||||
qDebug() << "url does not start with a valid protocol, assuming https.";
|
||||
url.prepend(QLatin1String("https://"));
|
||||
// FIXME: give a hint about the auto completion
|
||||
_ocWizard->setOCUrl(url);
|
||||
}
|
||||
cfgFile.writeOwncloudConfig( Theme::instance()->appName(),
|
||||
_ocWizard->field(QLatin1String("OCUrl")).toString(),
|
||||
url,
|
||||
_ocWizard->field(QLatin1String("OCUser")).toString(),
|
||||
_ocWizard->field(QLatin1String("OCPasswd")).toString(),
|
||||
_ocWizard->field(QLatin1String("secureConnect")).toBool(),
|
||||
_ocWizard->field(QLatin1String("PwdNoLocalStore")).toBool() );
|
||||
_ocWizard->field(QLatin1String("OCPasswd")).toString() );
|
||||
|
||||
// If there is already a config, take its proxy config.
|
||||
if( ownCloudInfo::instance()->isConfigured() ) {
|
||||
MirallConfigFile prevCfg;
|
||||
cfgFile.setProxyType( prevCfg.proxyType(), prevCfg.proxyHostName(), prevCfg.proxyPort(),
|
||||
prevCfg.proxyNeedsAuth(), prevCfg.proxyUser(), prevCfg.proxyPassword() );
|
||||
}
|
||||
|
||||
// now start ownCloudInfo to check the connection.
|
||||
ownCloudInfo* info = ownCloudInfo::instance();
|
||||
@@ -155,7 +246,11 @@ void OwncloudSetupWizard::testOwnCloudConnect()
|
||||
if( info->isConfigured() ) {
|
||||
// reset the SSL Untrust flag to let the SSL dialog appear again.
|
||||
info->resetSSLUntrust();
|
||||
info->checkInstallation();
|
||||
connect(info, SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
|
||||
connect(info, SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
SLOT(slotNoOwnCloudFound(QNetworkReply*)));
|
||||
_checkInstallationRequest = info->checkInstallation();
|
||||
} else {
|
||||
qDebug() << " ownCloud seems not to be configured, can not start test connect.";
|
||||
}
|
||||
@@ -163,8 +258,13 @@ void OwncloudSetupWizard::testOwnCloudConnect()
|
||||
|
||||
void OwncloudSetupWizard::slotOwnCloudFound( const QString& url, const QString& infoString, const QString& version, const QString& )
|
||||
{
|
||||
_ocWizard->appendToResultWidget(tr("<font color=\"green\">Successfully connected to %1: %2 version %3 (%4)</font><br/><br/>")
|
||||
.arg( url ).arg(Theme::instance()->appName()).arg(infoString).arg(version));
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
this, SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
this, SLOT(slotNoOwnCloudFound(QNetworkReply*)));
|
||||
|
||||
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\">Successfully connected to %1: %2 version %3 (%4)</font><br/><br/>")
|
||||
.arg( url ).arg(Theme::instance()->appNameGUI()).arg(infoString).arg(version));
|
||||
|
||||
// enable the finish button.
|
||||
_ocWizard->button( QWizard::FinishButton )->setEnabled( true );
|
||||
@@ -175,9 +275,13 @@ void OwncloudSetupWizard::slotOwnCloudFound( const QString& url, const QString&
|
||||
|
||||
void OwncloudSetupWizard::slotNoOwnCloudFound( QNetworkReply *err )
|
||||
{
|
||||
_ocWizard->appendToResultWidget(tr("<font color=\"red\">Failed to connect to %1!</font>")
|
||||
.arg(Theme::instance()->appName()));
|
||||
_ocWizard->appendToResultWidget(tr("Error: <tt>%1</tt>").arg(err->errorString()) );
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),
|
||||
this, SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||
this, SLOT(slotNoOwnCloudFound(QNetworkReply*)));
|
||||
|
||||
_ocWizard->displayError(tr("Failed to connect to %1:<br/>%2").
|
||||
arg(Theme::instance()->appNameGUI()).arg(err->errorString()));
|
||||
|
||||
// remove the config file again
|
||||
MirallConfigFile cfgFile( _configHandle );
|
||||
@@ -185,264 +289,134 @@ void OwncloudSetupWizard::slotNoOwnCloudFound( QNetworkReply *err )
|
||||
finalizeSetup( false );
|
||||
}
|
||||
|
||||
bool OwncloudSetupWizard::isBusy()
|
||||
{
|
||||
return _process->state() > 0;
|
||||
}
|
||||
|
||||
OwncloudWizard *OwncloudSetupWizard::wizard()
|
||||
{
|
||||
return _ocWizard;
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotCreateOCLocalhost()
|
||||
{
|
||||
if( isBusy() ) {
|
||||
qDebug() << "Can not install now, busy. Come back later.";
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "Install OC on localhost";
|
||||
|
||||
QStringList args;
|
||||
|
||||
args << QLatin1String("install");
|
||||
args << QLatin1String("--server-type") << QLatin1String("local");
|
||||
args << QLatin1String("--root_helper") << QLatin1String("kdesu -c");
|
||||
|
||||
const QString adminUser = _ocWizard->field(QLatin1String("OCUser")).toString();
|
||||
const QString adminPwd = _ocWizard->field(QLatin1String("OCPasswd")).toString();
|
||||
|
||||
args << QLatin1String("--admin-user") << adminUser;
|
||||
args << QLatin1String("--admin-password") << adminPwd;
|
||||
|
||||
runOwncloudAdmin( args );
|
||||
|
||||
// define
|
||||
_ocWizard->setField( QLatin1String("OCUrl"), QLatin1String( "http://localhost/owncloud/") );
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotInstallOCServer()
|
||||
{
|
||||
if( isBusy() ) {
|
||||
qDebug() << "Can not install now, busy. Come back later.";
|
||||
return;
|
||||
}
|
||||
|
||||
const QString server = _ocWizard->field(QLatin1String("ftpUrl")).toString();
|
||||
const QString user = _ocWizard->field(QLatin1String("ftpUser")).toString();
|
||||
const QString passwd = _ocWizard->field(QLatin1String("ftpPasswd")).toString();
|
||||
const QString adminUser = _ocWizard->field(QLatin1String("OCUser")).toString();
|
||||
const QString adminPwd = _ocWizard->field(QLatin1String("OCPasswd")).toString();
|
||||
|
||||
qDebug() << "Install OC on " << server << " as user " << user;
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("install");
|
||||
args << QLatin1String("--server-type") << QLatin1String("ftp");
|
||||
args << QLatin1String("--server") << server;
|
||||
args << QLatin1String("--ftp-user") << user;
|
||||
if( ! passwd.isEmpty() ) {
|
||||
args << QLatin1String("--ftp-password") << passwd;
|
||||
}
|
||||
args << QLatin1String("--admin-user") << adminUser;
|
||||
args << QLatin1String("--admin-password") << adminPwd;
|
||||
|
||||
runOwncloudAdmin( args );
|
||||
_ocWizard->setField( QLatin1String("OCUrl"), QString::fromLatin1( "%1/owncloud/")
|
||||
.arg(_ocWizard->field(QLatin1String("myOCDomain")).toString() ));
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::runOwncloudAdmin( const QStringList& args )
|
||||
{
|
||||
const QString bin(QLatin1String("/usr/bin/owncloud-admin"));
|
||||
qDebug() << "starting " << bin << " with args. " << args;
|
||||
if( _process->state() != QProcess::NotRunning ) {
|
||||
qDebug() << "Owncloud admin is still running, skip!";
|
||||
return;
|
||||
}
|
||||
if( checkOwncloudAdmin( bin )) {
|
||||
_ocWizard->appendToResultWidget( tr("Starting script owncloud-admin...") );
|
||||
_process->start( bin, args );
|
||||
} else {
|
||||
slotProcessFinished( 1, QProcess::NormalExit );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OwncloudSetupWizard::slotReadyReadStandardOutput()
|
||||
{
|
||||
QByteArray arr = _process->readAllStandardOutput();
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
// render the output to status line
|
||||
QString string = codec->toUnicode( arr );
|
||||
_ocWizard->appendToResultWidget( string, OwncloudWizard::LogPlain );
|
||||
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotReadyReadStandardError()
|
||||
{
|
||||
qDebug() << "!! " <<_process->readAllStandardError();
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotStateChanged( QProcess::ProcessState )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotError( QProcess::ProcessError err )
|
||||
{
|
||||
qDebug() << "An Error happend with owncloud-admin: " << err << ", exit-Code: " << _process->exitCode();
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotStarted()
|
||||
{
|
||||
_ocWizard->button( QWizard::FinishButton )->setEnabled( false );
|
||||
_ocWizard->button( QWizard::BackButton )->setEnabled( false );
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void OwncloudSetupWizard::slotProcessFinished( int res, QProcess::ExitStatus )
|
||||
{
|
||||
_ocWizard->button( QWizard::FinishButton )->setEnabled( true );
|
||||
_ocWizard->button( QWizard::BackButton)->setEnabled( true );
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
qDebug() << "exit code: " << res;
|
||||
if( res ) {
|
||||
_ocWizard->appendToResultWidget( tr("<font color=\"red\">Installation of %1 failed!</font>").arg(Theme::instance()->appName()));
|
||||
_ocWizard->showOCUrlLabel( false );
|
||||
emit ownCloudSetupFinished( false );
|
||||
} else {
|
||||
// Successful installation. Write the config.
|
||||
_ocWizard->appendToResultWidget( tr("<font color=\"green\">Installation of %1 succeeded!</font>").arg(Theme::instance()->appName()));
|
||||
_ocWizard->showOCUrlLabel( true );
|
||||
|
||||
testOwnCloudConnect();
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::startWizard(bool intro)
|
||||
{
|
||||
// create the ocInfo object
|
||||
connect(ownCloudInfo::instance(),SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),SLOT(slotOwnCloudFound(QString,QString,QString,QString)));
|
||||
connect(ownCloudInfo::instance(),SIGNAL(noOwncloudFound(QNetworkReply*)),SLOT(slotNoOwnCloudFound(QNetworkReply*)));
|
||||
connect(ownCloudInfo::instance(),SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError)));
|
||||
|
||||
MirallConfigFile cfgFile;
|
||||
|
||||
QString url = cfgFile.ownCloudUrl();
|
||||
if( !url.isEmpty() ) {
|
||||
_ocWizard->setOCUrl( url );
|
||||
}
|
||||
#ifdef OWNCLOUD_CLIENT
|
||||
if (intro)
|
||||
_ocWizard->setStartId(OwncloudWizard::Page_oCWelcome);
|
||||
else
|
||||
_ocWizard->setStartId(OwncloudWizard::Page_oCSetup);
|
||||
#endif
|
||||
_ocWizard->restart();
|
||||
_ocWizard->show();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* method to check the if the owncloud admin script is existing
|
||||
*/
|
||||
bool OwncloudSetupWizard::checkOwncloudAdmin( const QString& bin )
|
||||
{
|
||||
QFileInfo fi( bin );
|
||||
qDebug() << "checking owncloud-admin " << bin;
|
||||
if( ! (fi.exists() && fi.isExecutable() ) ) {
|
||||
_ocWizard->appendToResultWidget( tr("The owncloud admin script can not be found.\n"
|
||||
"Setup can not be done.") );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::setupLocalSyncFolder()
|
||||
{
|
||||
_localFolder = QDir::homePath() + QDir::separator() + Theme::instance()->defaultClientFolder();
|
||||
|
||||
if( ! _folderMan ) return;
|
||||
|
||||
qDebug() << "Setup local sync folder for new oC connection " << _localFolder;
|
||||
QDir fi( _localFolder );
|
||||
const QString localFolder = _ocWizard->property("localFolder").toString();
|
||||
qDebug() << "Setup local sync folder for new oC connection " << localFolder;
|
||||
QDir fi( localFolder );
|
||||
// FIXME: Show problems with local folder properly.
|
||||
|
||||
bool localFolderOk = true;
|
||||
if( fi.exists() ) {
|
||||
// there is an existing local folder. If its non empty, it can only be synced if the
|
||||
// ownCloud is newly created.
|
||||
_ocWizard->appendToResultWidget( tr("Local sync folder %1 already exists, setting it up for sync.<br/><br/>").arg(_localFolder));
|
||||
_ocWizard->appendToConfigurationLog( tr("Local sync folder %1 already exists, setting it up for sync.<br/><br/>").arg(localFolder));
|
||||
} else {
|
||||
QString res = tr("Creating local sync folder %1... ").arg(_localFolder);
|
||||
if( fi.mkpath( _localFolder ) ) {
|
||||
QString res = tr("Creating local sync folder %1... ").arg(localFolder);
|
||||
if( fi.mkpath( localFolder ) ) {
|
||||
Utility::setupFavLink( localFolder );
|
||||
// FIXME: Create a local sync folder.
|
||||
res += tr("ok");
|
||||
} else {
|
||||
res += tr("failed.");
|
||||
qDebug() << "Failed to create " << fi.path();
|
||||
localFolderOk = false;
|
||||
_ocWizard->displayError(tr("Could not create local folder %1").arg(localFolder));
|
||||
}
|
||||
_ocWizard->appendToResultWidget( res );
|
||||
_ocWizard->appendToConfigurationLog( res );
|
||||
}
|
||||
|
||||
if( localFolderOk ) {
|
||||
_remoteFolder = Theme::instance()->defaultServerFolder();
|
||||
slotCreateRemoteFolder(true);
|
||||
checkRemoteFolder();
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotCreateRemoteFolder(bool credentialsOk )
|
||||
void OwncloudSetupWizard::checkRemoteFolder()
|
||||
{
|
||||
if( ! credentialsOk ) {
|
||||
// User pressed cancel while being asked for password.
|
||||
_ocWizard->appendToResultWidget("User canceled password dialog. Can not connect.");
|
||||
return;
|
||||
}
|
||||
connect( ownCloudInfo::instance(),SIGNAL(ownCloudDirExists(QString,QNetworkReply*)),
|
||||
this,SLOT(slotAuthCheckReply(QString,QNetworkReply*)));
|
||||
|
||||
if( createRemoteFolder( _remoteFolder ) ) {
|
||||
qDebug() << "Started remote folder creation ok";
|
||||
qDebug() << "# checking for authentication settings.";
|
||||
ownCloudInfo::instance()->setCustomConfigHandle(_configHandle);
|
||||
_checkRemoteFolderRequest = ownCloudInfo::instance()->getRequest(_remoteFolder, true ); // this call needs to be authenticated.
|
||||
// continue in slotAuthCheckReply
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotAuthCheckReply( const QString&, QNetworkReply *reply )
|
||||
{
|
||||
// disconnect from ownCloud Info signals
|
||||
disconnect( ownCloudInfo::instance(),SIGNAL(ownCloudDirExists(QString,QNetworkReply*)),
|
||||
this,SLOT(slotAuthCheckReply(QString,QNetworkReply*)));
|
||||
|
||||
bool ok = true;
|
||||
QString error;
|
||||
QNetworkReply::NetworkError errId = reply->error();
|
||||
|
||||
if( errId == QNetworkReply::NoError ) {
|
||||
qDebug() << "******** Remote folder found, all cool!";
|
||||
} else if( errId == QNetworkReply::AuthenticationRequiredError ) { // returned if the user is wrong.
|
||||
qDebug() << "******** Password is wrong!";
|
||||
error = tr("The given credentials do not authenticate.");
|
||||
ok = false;
|
||||
} else if( errId == QNetworkReply::OperationCanceledError ) {
|
||||
// the username was wrong and ownCloudInfo was closing the request after a couple of auth tries.
|
||||
qDebug() << "******** Username or password is wrong!";
|
||||
error = tr("Username or password is wrong!");
|
||||
ok = false;
|
||||
} else if( errId == QNetworkReply::ContentNotFoundError ) {
|
||||
// FIXME try to create the remote folder!
|
||||
if( !createRemoteFolder() ) {
|
||||
error = tr("The remote folder could not be accessed!");
|
||||
ok = false;
|
||||
} else {
|
||||
return; // Finish here, the mkdir request will go on.
|
||||
}
|
||||
} else {
|
||||
_ocWizard->appendToResultWidget(tr("Creation of remote folder %1 could not be started.").arg(_remoteFolder));
|
||||
error = tr("Error: %1").arg(reply->errorString());
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if( !ok ) {
|
||||
_ocWizard->displayError(error);
|
||||
} else {
|
||||
_ocWizard->setRemoteFolder( _remoteFolder );
|
||||
}
|
||||
|
||||
finalizeSetup( ok );
|
||||
}
|
||||
|
||||
bool OwncloudSetupWizard::createRemoteFolder( const QString& folder )
|
||||
bool OwncloudSetupWizard::createRemoteFolder()
|
||||
{
|
||||
if( folder.isEmpty() ) return false;
|
||||
if( _remoteFolder.isEmpty() ) return false;
|
||||
|
||||
qDebug() << "creating folder on ownCloud: " << folder;
|
||||
_ocWizard->appendToConfigurationLog( tr("creating folder on ownCloud: %1" ).arg( _remoteFolder ));
|
||||
connect(ownCloudInfo::instance(), SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),
|
||||
this, SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError)));
|
||||
|
||||
ownCloudInfo::instance()->mkdirRequest( folder );
|
||||
_mkdirRequestReply = ownCloudInfo::instance()->mkdirRequest( _remoteFolder );
|
||||
|
||||
return true;
|
||||
return (_mkdirRequestReply != NULL);
|
||||
}
|
||||
|
||||
void OwncloudSetupWizard::slotCreateRemoteFolderFinished( QNetworkReply::NetworkError error )
|
||||
{
|
||||
qDebug() << "** webdav mkdir request finished " << error;
|
||||
disconnect(ownCloudInfo::instance(), SIGNAL(webdavColCreated(QNetworkReply::NetworkError)),
|
||||
this, SLOT(slotCreateRemoteFolderFinished(QNetworkReply::NetworkError)));
|
||||
|
||||
bool success = true;
|
||||
|
||||
if( error == QNetworkReply::NoError ) {
|
||||
_ocWizard->appendToResultWidget( tr("Remote folder %1 created successfully.").arg(_remoteFolder));
|
||||
_ocWizard->appendToConfigurationLog( tr("Remote folder %1 created successfully.").arg(_remoteFolder));
|
||||
} else if( error == 202 ) {
|
||||
_ocWizard->appendToResultWidget( tr("The remote folder %1 already exists. Connecting it for syncing.").arg(_remoteFolder));
|
||||
_ocWizard->appendToConfigurationLog( tr("The remote folder %1 already exists. Connecting it for syncing.").arg(_remoteFolder));
|
||||
} else if( error > 202 && error < 300 ) {
|
||||
_ocWizard->appendToResultWidget( tr("The folder creation resulted in HTTP error code %1").arg((int)error) );
|
||||
_ocWizard->displayError( tr("The folder creation resulted in HTTP error code %1").arg((int)error ));
|
||||
|
||||
_ocWizard->appendToConfigurationLog( tr("The folder creation resulted in HTTP error code %1").arg((int)error) );
|
||||
} else if( error == QNetworkReply::OperationCanceledError ) {
|
||||
_ocWizard->appendToResultWidget( tr("<p><font color=\"red\">Remote folder creation failed probably because the provided credentials are wrong.</font>"
|
||||
_ocWizard->displayError( tr("The remote folder creation failed because the provided credentials "
|
||||
"are wrong!"
|
||||
"<br/>Please go back and check your credentials.</p>"));
|
||||
_ocWizard->appendToConfigurationLog( tr("<p><font color=\"red\">Remote folder creation failed probably because the provided credentials are wrong.</font>"
|
||||
"<br/>Please go back and check your credentials.</p>"));
|
||||
_localFolder.clear();
|
||||
_remoteFolder.clear();
|
||||
success = false;
|
||||
} else {
|
||||
_ocWizard->appendToResultWidget( tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(_remoteFolder).arg(error));
|
||||
_localFolder.clear();
|
||||
_ocWizard->appendToConfigurationLog( tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(_remoteFolder).arg(error));
|
||||
_ocWizard->displayError( tr("Remote folder %1 creation failed with error <tt>%2</tt>.").arg(_remoteFolder).arg(error) );
|
||||
_remoteFolder.clear();
|
||||
success = false;
|
||||
}
|
||||
@@ -452,23 +426,27 @@ void OwncloudSetupWizard::slotCreateRemoteFolderFinished( QNetworkReply::Network
|
||||
|
||||
void OwncloudSetupWizard::finalizeSetup( bool success )
|
||||
{
|
||||
// enable/disable the finish button.
|
||||
_ocWizard->enableFinishOnResultWidget(success);
|
||||
|
||||
const QString localFolder = _ocWizard->property("localFolder").toString();
|
||||
if( success ) {
|
||||
if( !(_localFolder.isEmpty() || _remoteFolder.isEmpty() )) {
|
||||
_ocWizard->appendToResultWidget( tr("A sync connection from %1 to remote directory %2 was set up.")
|
||||
.arg(_localFolder).arg(_remoteFolder));
|
||||
if( !(localFolder.isEmpty() || _remoteFolder.isEmpty() )) {
|
||||
_ocWizard->appendToConfigurationLog( tr("A sync connection from %1 to remote directory %2 was set up.")
|
||||
.arg(localFolder).arg(_remoteFolder));
|
||||
}
|
||||
_ocWizard->appendToResultWidget( QLatin1String(" "));
|
||||
_ocWizard->appendToResultWidget( QLatin1String("<p><font color=\"green\"><b>")
|
||||
+ tr("Succesfully connected to %1!")
|
||||
.arg(Theme::instance()->appName())
|
||||
_ocWizard->appendToConfigurationLog( QLatin1String(" "));
|
||||
_ocWizard->appendToConfigurationLog( QLatin1String("<p><font color=\"green\"><b>")
|
||||
+ tr("Successfully connected to %1!")
|
||||
.arg(Theme::instance()->appNameGUI())
|
||||
+ QLatin1String("</b></font></p>"));
|
||||
_ocWizard->appendToResultWidget( tr("Press Finish to permanently accept this connection."));
|
||||
} else {
|
||||
_ocWizard->appendToResultWidget(QLatin1String("<p><font color=\"red\">")
|
||||
_ocWizard->appendToConfigurationLog(QLatin1String("<p><font color=\"red\">")
|
||||
+ tr("Connection to %1 could not be established. Please check again.")
|
||||
.arg(Theme::instance()->appName())
|
||||
.arg(Theme::instance()->appNameGUI())
|
||||
+ QLatin1String("</font></p>"));
|
||||
}
|
||||
_ocWizard->successfullyConnected(success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <QWidget>
|
||||
#include <QProcess>
|
||||
#include <QNetworkReply>
|
||||
#include <QPointer>
|
||||
|
||||
#include "mirall/owncloudwizard.h"
|
||||
#include "mirall/theme.h"
|
||||
@@ -41,7 +42,7 @@ public:
|
||||
/**
|
||||
* @intro wether or not to show the intro wizard page
|
||||
*/
|
||||
void startWizard(bool intro = false);
|
||||
void startWizard();
|
||||
|
||||
void installServer();
|
||||
|
||||
@@ -67,42 +68,33 @@ signals:
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
// QProcess related slots:
|
||||
void slotReadyReadStandardOutput();
|
||||
void slotReadyReadStandardError();
|
||||
void slotStateChanged( QProcess::ProcessState );
|
||||
void slotError( QProcess::ProcessError );
|
||||
void slotStarted();
|
||||
void slotProcessFinished( int, QProcess::ExitStatus );
|
||||
|
||||
// wizard dialog signals
|
||||
void slotInstallOCServer();
|
||||
void slotConnectToOCUrl( const QString& );
|
||||
void slotCreateOCLocalhost();
|
||||
|
||||
void slotCreateRemoteFolder(bool);
|
||||
|
||||
private slots:
|
||||
void slotOwnCloudFound( const QString&, const QString&, const QString&, const QString& );
|
||||
void slotNoOwnCloudFound( QNetworkReply* );
|
||||
void slotCreateRemoteFolderFinished( QNetworkReply::NetworkError );
|
||||
void slotAssistantFinished( int );
|
||||
|
||||
void slotClearPendingRequests();
|
||||
void slotAuthCheckReply( const QString&, QNetworkReply * );
|
||||
private:
|
||||
bool checkOwncloudAdmin( const QString& );
|
||||
void runOwncloudAdmin( const QStringList& );
|
||||
bool createRemoteFolder( const QString& );
|
||||
bool createRemoteFolder();
|
||||
void checkRemoteFolder();
|
||||
|
||||
void finalizeSetup( bool );
|
||||
|
||||
/* Start a request to the newly installed ownCloud to check the connection */
|
||||
void testOwnCloudConnect();
|
||||
|
||||
OwncloudWizard *_ocWizard;
|
||||
QPointer<QNetworkReply> _mkdirRequestReply;
|
||||
QPointer<QNetworkReply> _checkInstallationRequest;
|
||||
QPointer<QNetworkReply> _checkRemoteFolderRequest;
|
||||
|
||||
FolderMan *_folderMan;
|
||||
QProcess *_process;
|
||||
|
||||
QString _configHandle;
|
||||
QString _localFolder;
|
||||
QString _remoteFolder;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,12 +15,14 @@
|
||||
#include "owncloudtheme.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include <QVariant>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
#include <QStyle>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "mirall/version.h"
|
||||
#include "config.h"
|
||||
|
||||
@@ -78,64 +80,12 @@ QString ownCloudTheme::about() const
|
||||
.arg(devString);
|
||||
}
|
||||
|
||||
QPixmap ownCloudTheme::splashScreen() const
|
||||
{
|
||||
return QPixmap(QLatin1String(":/mirall/resources/owncloud_splash.png"));
|
||||
}
|
||||
|
||||
QIcon ownCloudTheme::folderIcon( const QString& backend ) const
|
||||
{
|
||||
QString name;
|
||||
|
||||
if( backend == QLatin1String("owncloud")) {
|
||||
name = QLatin1String( "owncloud-framed" );
|
||||
}
|
||||
if( backend == QLatin1String("unison" )) {
|
||||
name = QLatin1String( "folder-sync" );
|
||||
}
|
||||
if( backend == QLatin1String("csync" )) {
|
||||
name = QLatin1String( "folder-remote" );
|
||||
}
|
||||
if( backend.isEmpty() || backend == QLatin1String("none") ) {
|
||||
name = QLatin1String("folder-grey");
|
||||
}
|
||||
|
||||
qDebug() << "==> load folder icon " << name;
|
||||
return themeIcon( name );
|
||||
}
|
||||
|
||||
QIcon ownCloudTheme::trayFolderIcon( const QString& ) const
|
||||
{
|
||||
QPixmap fallback = qApp->style()->standardPixmap(QStyle::SP_FileDialogNewFolder);
|
||||
return QIcon::fromTheme("folder", fallback);
|
||||
}
|
||||
|
||||
QIcon ownCloudTheme::syncStateIcon( SyncResult::Status status, bool sysTray ) const
|
||||
{
|
||||
// FIXME: Mind the size!
|
||||
QString statusIcon;
|
||||
|
||||
switch( status ) {
|
||||
case SyncResult::Undefined:
|
||||
case SyncResult::NotYetStarted:
|
||||
case SyncResult::Unavailable:
|
||||
statusIcon = QLatin1String("state-offline");
|
||||
break;
|
||||
case SyncResult::SyncRunning:
|
||||
statusIcon = QLatin1String("state-sync");
|
||||
break;
|
||||
case SyncResult::Success:
|
||||
statusIcon = QLatin1String("state-ok");
|
||||
break;
|
||||
case SyncResult::Error:
|
||||
case SyncResult::SetupError:
|
||||
default:
|
||||
statusIcon = QLatin1String("state-error");
|
||||
}
|
||||
|
||||
return themeIcon( statusIcon, sysTray );
|
||||
}
|
||||
|
||||
QIcon ownCloudTheme::folderDisabledIcon( ) const
|
||||
{
|
||||
// Fixme: Do we really want the dialog-canel from theme here?
|
||||
@@ -144,7 +94,29 @@ QIcon ownCloudTheme::folderDisabledIcon( ) const
|
||||
|
||||
QIcon ownCloudTheme::applicationIcon( ) const
|
||||
{
|
||||
return themeIcon( QLatin1String("owncloud") );
|
||||
return themeIcon( QLatin1String("owncloud-icon") );
|
||||
}
|
||||
|
||||
QVariant ownCloudTheme::customMedia(Theme::CustomMediaType type)
|
||||
{
|
||||
if (type == Theme::oCSetupTop) {
|
||||
return QCoreApplication::translate("ownCloudTheme",
|
||||
"If you don't have an ownCloud server yet, "
|
||||
"see <a href=\"https://owncloud.com\">owncloud.com</a> for more info.",
|
||||
"Top text in setup wizard. Keep short!");
|
||||
} else {
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
QColor ownCloudTheme::wizardHeaderBackgroundColor() const
|
||||
{
|
||||
return QColor("#1d2d42");
|
||||
}
|
||||
|
||||
QColor ownCloudTheme::wizardHeaderTitleColor() const
|
||||
{
|
||||
return QColor("#ffffff");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,10 +31,14 @@ public:
|
||||
|
||||
QIcon folderIcon( const QString& ) const;
|
||||
QIcon trayFolderIcon( const QString& ) const;
|
||||
QIcon syncStateIcon( SyncResult::Status, bool sysTray ) const;
|
||||
QIcon folderDisabledIcon() const;
|
||||
QIcon applicationIcon() const;
|
||||
|
||||
QVariant customMedia(CustomMediaType type);
|
||||
|
||||
QColor wizardHeaderBackgroundColor() const;
|
||||
QColor wizardHeaderTitleColor() const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
@@ -16,16 +16,10 @@
|
||||
#include "mirall/mirallconfigfile.h"
|
||||
#include "mirall/theme.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QUrl>
|
||||
#include <QValidator>
|
||||
#include <QWizardPage>
|
||||
#include <QDir>
|
||||
#include <QScrollBar>
|
||||
#include <QSslSocket>
|
||||
#include "QProgressIndicator.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtGui>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -54,366 +48,397 @@ void setupCustomMedia( QVariant variant, QLabel *label )
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
OwncloudWelcomePage::OwncloudWelcomePage()
|
||||
{
|
||||
setTitle(tr("Welcome to %1").arg(Theme::instance()->appName()));
|
||||
|
||||
QVBoxLayout *lay = new QVBoxLayout(this);
|
||||
QLabel *content = new QLabel;
|
||||
lay->addWidget(content, 100, Qt::AlignTop);
|
||||
content->setAlignment(Qt::AlignTop);
|
||||
content->setTextFormat(Qt::RichText);
|
||||
content->setWordWrap(true);
|
||||
Theme *theme = Theme::instance();
|
||||
if (theme->overrideServerUrl().isEmpty()) {
|
||||
content->setText(tr("<p>In order to connect to your %1 server, you need to provide the server address "
|
||||
"as well as your credentials.</p><p>This wizard will guide you through the process.<p>"
|
||||
"<p>If you have not received this information, please contact your %1 provider.</p>")
|
||||
.arg(theme->appName()));
|
||||
} else {
|
||||
content->setText(tr("<p>In order to connect to your %1 server, you need to provide "
|
||||
"your credentials.</p><p>This wizard will guide you through "
|
||||
"the setup process.</p>").arg(theme->appName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
OwncloudSetupPage::OwncloudSetupPage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
|
||||
setTitle(tr("Create Connection to %1").arg(Theme::instance()->appName()));
|
||||
Theme *theme = Theme::instance();
|
||||
setTitle( tr("<font color=\"%1\" size=\"5\">Connect to %2</font>")
|
||||
.arg(theme->wizardHeaderTitleColor().name()).arg( theme->appNameGUI()));
|
||||
setSubTitle( tr("<font color=\"%1\">Enter user credentials</font>")
|
||||
.arg(theme->wizardHeaderTitleColor().name()));
|
||||
|
||||
connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(handleNewOcUrl(QString)));
|
||||
|
||||
registerField( QLatin1String("OCUrl"), _ui.leUrl );
|
||||
registerField( QLatin1String("OCUrl"), _ui.leUrl );
|
||||
registerField( QLatin1String("OCUser"), _ui.leUsername );
|
||||
registerField( QLatin1String("OCPasswd"), _ui.lePassword);
|
||||
registerField( QLatin1String("connectMyOC"), _ui.cbConnectOC );
|
||||
registerField( QLatin1String("secureConnect"), _ui.cbSecureConnect );
|
||||
registerField( QLatin1String("PwdNoLocalStore"), _ui.cbNoPasswordStore );
|
||||
registerField( QLatin1String("OCSyncFromScratch"), _ui.cbSyncFromScratch);
|
||||
|
||||
_ui.cbSecureConnect->setEnabled(QSslSocket::supportsSsl());
|
||||
_ui.errorLabel->setVisible(true);
|
||||
_ui.advancedBox->setVisible(false);
|
||||
|
||||
_progressIndi = new QProgressIndicator;
|
||||
_ui.resultLayout->addWidget( _progressIndi );
|
||||
_progressIndi->setVisible(false);
|
||||
_ui.resultLayout->setEnabled(false);
|
||||
|
||||
// Error label
|
||||
QString style = QLatin1String("border: 1px solid #eed3d7; border-radius: 5px; padding: 3px;"
|
||||
"background-color: #f2dede; color: #b94a48;");
|
||||
|
||||
|
||||
_ui.errorLabel->setStyleSheet( style );
|
||||
_ui.errorLabel->setWordWrap(true);
|
||||
_ui.errorLabel->setVisible(false);
|
||||
|
||||
_checking = false;
|
||||
|
||||
setupCustomization();
|
||||
|
||||
connect(_ui.leUrl, SIGNAL(textChanged(QString)), SLOT(slotUrlChanged(QString)));
|
||||
connect( _ui.leUsername, SIGNAL(textChanged(QString)), this, SLOT(slotUserChanged(QString)));
|
||||
|
||||
connect( _ui.lePassword, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
|
||||
connect( _ui.leUsername, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
|
||||
|
||||
connect( _ui.cbNoPasswordStore, SIGNAL(stateChanged(int)), this, SLOT(slotPwdStoreChanged(int)));
|
||||
connect( _ui.cbSecureConnect, SIGNAL(stateChanged(int)), this, SLOT(slotSecureConChanged(int)));
|
||||
|
||||
_ui.cbConnectOC->hide();
|
||||
setupCustomization();
|
||||
connect( _ui.cbAdvanced, SIGNAL(stateChanged (int)), SLOT(slotToggleAdvanced(int)));
|
||||
connect( _ui.pbSelectLocalFolder, SIGNAL(clicked()), SLOT(slotSelectFolder()));
|
||||
}
|
||||
|
||||
OwncloudSetupPage::~OwncloudSetupPage()
|
||||
{
|
||||
delete _progressIndi;
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::setOCUrl( const QString& newUrl )
|
||||
void OwncloudSetupPage::slotToggleAdvanced(int state)
|
||||
{
|
||||
QString url( newUrl );
|
||||
if( url.isEmpty() ) {
|
||||
_ui.advancedBox->setVisible( state == Qt::Checked );
|
||||
slotHandleUserInput();
|
||||
QSize size = wizard()->sizeHint();
|
||||
// need to substract header for some reason
|
||||
size -= QSize(0, 63);
|
||||
|
||||
wizard()->setMinimumSize(size);
|
||||
wizard()->resize(size);
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::setOCUser( const QString & user )
|
||||
{
|
||||
_ocUser = user;
|
||||
_ui.leUsername->setText(user);
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::setServerUrl( const QString& newUrl )
|
||||
{
|
||||
_oCUrl = newUrl;
|
||||
if( _oCUrl.isEmpty() ) {
|
||||
_ui.leUrl->clear();
|
||||
return;
|
||||
}
|
||||
if( url.startsWith( QLatin1String("https"))) {
|
||||
_ui.cbSecureConnect->setChecked( true );
|
||||
url.remove(0,5);
|
||||
} else if( url.startsWith( QLatin1String("http"))) {
|
||||
_ui.cbSecureConnect->setChecked( false );
|
||||
url.remove(0,4);
|
||||
}
|
||||
if( url.startsWith( QLatin1String("://"))) url.remove(0,3);
|
||||
|
||||
_ui.leUrl->setText( url );
|
||||
_ui.leUrl->setText( _oCUrl );
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::setupCustomization()
|
||||
{
|
||||
// set defaults for the customize labels.
|
||||
_ui.sideLabel->setText( QString::null );
|
||||
_ui.sideLabel->setFixedWidth(160);
|
||||
|
||||
_ui.topLabel->hide();
|
||||
_ui.bottomLabel->hide();
|
||||
|
||||
Theme *theme = Theme::instance();
|
||||
QVariant variant = theme->customMedia( Theme::oCSetupTop );
|
||||
setupCustomMedia( variant, _ui.topLabel );
|
||||
variant = theme->customMedia( Theme::oCSetupSide );
|
||||
setupCustomMedia( variant, _ui.sideLabel );
|
||||
if( !variant.isNull() ) {
|
||||
setupCustomMedia( variant, _ui.topLabel );
|
||||
}
|
||||
|
||||
variant = theme->customMedia( Theme::oCSetupBottom );
|
||||
setupCustomMedia( variant, _ui.bottomLabel );
|
||||
|
||||
QString fixUrl = theme->overrideServerUrl();
|
||||
if( !fixUrl.isEmpty() ) {
|
||||
setOCUrl( fixUrl );
|
||||
_ui.label_2->hide();
|
||||
setServerUrl( fixUrl );
|
||||
_ui.leUrl->setEnabled( false );
|
||||
_ui.cbSecureConnect->hide();
|
||||
_ui.leUrl->hide();
|
||||
_ui.protocolLabel->hide();
|
||||
_ui.serverAddressLabel->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::slotPwdStoreChanged( int state )
|
||||
void OwncloudSetupPage::slotUserChanged(const QString& user )
|
||||
{
|
||||
_ui.lePassword->setEnabled( state == Qt::Unchecked );
|
||||
emit completeChanged();
|
||||
slotHandleUserInput();
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::slotSecureConChanged( int state )
|
||||
// slot hit from textChanged of the url entry field.
|
||||
void OwncloudSetupPage::slotUrlChanged(const QString& ocUrl)
|
||||
{
|
||||
if( state == Qt::Checked ) {
|
||||
_ui.protocolLabel->setText(QLatin1String("https://"));
|
||||
} else {
|
||||
_ui.protocolLabel->setText(QLatin1String("http://"));
|
||||
}
|
||||
}
|
||||
slotHandleUserInput();
|
||||
|
||||
void OwncloudSetupPage::handleNewOcUrl(const QString& ocUrl)
|
||||
{
|
||||
#if 0
|
||||
QString url = ocUrl;
|
||||
int len = 0;
|
||||
bool visible = false;
|
||||
|
||||
if (url.startsWith(QLatin1String("https://"))) {
|
||||
_ui.cbSecureConnect->setChecked(true);
|
||||
len = 8;
|
||||
_ui.urlLabel->setPixmap( QPixmap(":/mirall/resources/security-high.png"));
|
||||
_ui.urlLabel->setToolTip(tr("This url is secure. You can use it."));
|
||||
visible = true;
|
||||
}
|
||||
if (url.startsWith(QLatin1String("http://"))) {
|
||||
_ui.cbSecureConnect->setChecked(false);
|
||||
len = 7;
|
||||
}
|
||||
if( len ) {
|
||||
int pos = _ui.leUrl->cursorPosition();
|
||||
url.remove(0, len);
|
||||
_ui.leUrl->setText(url);
|
||||
_ui.leUrl->setCursorPosition(qMax(0, pos-len));
|
||||
|
||||
_ui.urlLabel->setPixmap( QPixmap(":/mirall/resources/security-low.png"));
|
||||
_ui.urlLabel->setToolTip(tr("This url is NOT secure. You should not use it."));
|
||||
visible = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OwncloudSetupPage::isComplete() const
|
||||
{
|
||||
if( _ui.leUrl->text().isEmpty() ) return false;
|
||||
if( _checking ) return false;
|
||||
|
||||
if( _ui.cbNoPasswordStore->checkState() == Qt::Checked ) {
|
||||
return !(_ui.leUsername->text().isEmpty());
|
||||
}
|
||||
return !(_ui.leUsername->text().isEmpty() || _ui.lePassword->text().isEmpty() );
|
||||
return !( _ui.lePassword->text().isEmpty() || _ui.leUsername->text().isEmpty() );
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::initializePage()
|
||||
{
|
||||
_connected = false;
|
||||
_checking = false;
|
||||
_multipleFoldersExist = false;
|
||||
|
||||
// call to init label
|
||||
slotHandleUserInput();
|
||||
|
||||
if( _configExists ) {
|
||||
_ui.lePassword->setFocus();
|
||||
} else {
|
||||
_ui.leUrl->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
bool OwncloudSetupPage::urlHasChanged()
|
||||
{
|
||||
bool change = false;
|
||||
const QChar slash('/');
|
||||
|
||||
QUrl currentUrl( url() );
|
||||
QUrl initialUrl( _oCUrl );
|
||||
|
||||
QString currentPath = currentUrl.path();
|
||||
QString initialPath = initialUrl.path();
|
||||
|
||||
// add a trailing slash.
|
||||
if( ! currentPath.endsWith( slash )) currentPath += slash;
|
||||
if( ! initialPath.endsWith( slash )) initialPath += slash;
|
||||
|
||||
if( currentUrl.host() != initialUrl.host() ||
|
||||
currentPath != initialPath ) {
|
||||
change = true;
|
||||
}
|
||||
|
||||
if( !change) { // no change yet, check the user.
|
||||
QString user = _ui.leUsername->text().simplified();
|
||||
if( user != _ocUser ) change = true;
|
||||
}
|
||||
|
||||
return change;
|
||||
}
|
||||
|
||||
// Called if the user changes the user- or url field. Adjust the texts and
|
||||
// evtl. warnings on the dialog.
|
||||
void OwncloudSetupPage::slotHandleUserInput()
|
||||
{
|
||||
// if the url has not changed, return.
|
||||
if( ! urlHasChanged() ) {
|
||||
// disable the advanced button as nothing has changed.
|
||||
_ui.cbAdvanced->setEnabled(false);
|
||||
_ui.advancedBox->setEnabled(false);
|
||||
} else {
|
||||
// Enable advanced stuff for new connection configuration.
|
||||
_ui.cbAdvanced->setEnabled(true);
|
||||
_ui.advancedBox->setEnabled(true);
|
||||
}
|
||||
|
||||
const QString locFolder = localFolder();
|
||||
|
||||
// check if the local folder exists. If so, and if its not empty, show a warning.
|
||||
QDir dir( locFolder );
|
||||
QStringList entries = dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot);
|
||||
|
||||
QString t;
|
||||
|
||||
if( !urlHasChanged() && _configExists ) {
|
||||
// This is the password change mode: No change to the url and a config
|
||||
// to an ownCloud exists.
|
||||
t = tr("Change the Password for your configured account.");
|
||||
} else {
|
||||
// Complete new setup.
|
||||
_ui.pbSelectLocalFolder->setText(QDir::toNativeSeparators(locFolder));
|
||||
|
||||
if( _remoteFolder.isEmpty() || _remoteFolder == QLatin1String("/") ) {
|
||||
t = tr("Your entire account will be synced to the local folder '%1'.")
|
||||
.arg(QDir::toNativeSeparators(locFolder));
|
||||
} else {
|
||||
t = tr("%1 folder '%2' is synced to local folder '%3'")
|
||||
.arg(Theme::instance()->appName()).arg(_remoteFolder)
|
||||
.arg(QDir::toNativeSeparators(locFolder));
|
||||
}
|
||||
|
||||
if ( _multipleFoldersExist ) {
|
||||
t += tr("<p><small><strong>Warning:</strong> You currently have multiple folders "
|
||||
"configured. If you continue with the current settings, the folder configurations "
|
||||
"will be discarded and a single root folder sync will be created!</small></p>");
|
||||
}
|
||||
|
||||
if( entries.count() > 0) {
|
||||
// the directory is not empty
|
||||
if (!_ui.cbAdvanced->isChecked()) {
|
||||
t += tr("<p><small><strong>Warning:</strong> The local directory is not empty. "
|
||||
"Pick a resolution in the advanced settings!</small></p>");
|
||||
}
|
||||
_ui.resolutionWidget->setVisible(true);
|
||||
} else {
|
||||
// the dir is empty, which means that there is no problem.
|
||||
_ui.resolutionWidget->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
_ui.syncModeLabel->setText(t);
|
||||
_ui.syncModeLabel->setFixedHeight(_ui.syncModeLabel->sizeHint().height());
|
||||
}
|
||||
|
||||
int OwncloudSetupPage::nextId() const
|
||||
{
|
||||
return OwncloudWizard::Page_Install;
|
||||
return OwncloudWizard::Page_Result;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
OwncloudWizardSelectTypePage::OwncloudWizardSelectTypePage()
|
||||
QString OwncloudSetupPage::url() const
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
registerField( QLatin1String("connectMyOC"), _ui.connectMyOCRadioBtn );
|
||||
registerField( QLatin1String("createNewOC"), _ui.createNewOCRadioBtn );
|
||||
registerField( QLatin1String("OCUrl"), _ui.OCUrlLineEdit );
|
||||
|
||||
connect( _ui.connectMyOCRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
|
||||
connect( _ui.createNewOCRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
|
||||
connect( _ui.OCUrlLineEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
|
||||
#ifdef OWNCLOUD_CLIENT
|
||||
_ui.createNewOCRadioBtn->setVisible( false );
|
||||
_ui.createNewOwncloudLabel->setVisible( false );
|
||||
#endif
|
||||
|
||||
#if QT_VERSION >= 0x040700
|
||||
_ui.OCUrlLineEdit->setPlaceholderText(tr("http://owncloud.mydomain.org"));
|
||||
#endif
|
||||
QString url = _ui.leUrl->text().simplified();
|
||||
return url;
|
||||
}
|
||||
|
||||
OwncloudWizardSelectTypePage::~OwncloudWizardSelectTypePage()
|
||||
QString OwncloudSetupPage::localFolder() const
|
||||
{
|
||||
QString folder = wizard()->property("localFolder").toString();
|
||||
return folder;
|
||||
}
|
||||
|
||||
void OwncloudWizardSelectTypePage::initializePage()
|
||||
void OwncloudSetupPage::setConnected( bool comp )
|
||||
{
|
||||
|
||||
_connected = comp;
|
||||
_ui.resultLayout->setEnabled(true);
|
||||
_progressIndi->setVisible(false);
|
||||
_progressIndi->stopAnimation();
|
||||
}
|
||||
|
||||
int OwncloudWizardSelectTypePage::nextId() const
|
||||
bool OwncloudSetupPage::validatePage()
|
||||
{
|
||||
if( _ui.connectMyOCRadioBtn->isChecked() ) {
|
||||
return OwncloudWizard::Page_OC_Credentials;
|
||||
}
|
||||
return OwncloudWizard::Page_Create_OC;
|
||||
}
|
||||
bool re = false;
|
||||
|
||||
bool OwncloudWizardSelectTypePage::isComplete() const
|
||||
{
|
||||
if( _ui.connectMyOCRadioBtn->isChecked() ) {
|
||||
// a valid url is needed.
|
||||
QString u = _ui.OCUrlLineEdit->text();
|
||||
QUrl url( u );
|
||||
if( url.isValid() ) {
|
||||
return true;
|
||||
if( ! _connected) {
|
||||
setErrorString(QString::null);
|
||||
_checking = true;
|
||||
_ui.resultLayout->setEnabled(true);
|
||||
_progressIndi->setVisible(true);
|
||||
_progressIndi->startAnimation();
|
||||
emit completeChanged();
|
||||
|
||||
emit connectToOCUrl( url() );
|
||||
return false;
|
||||
} else {
|
||||
// connecting is running
|
||||
stopSpinner();
|
||||
_checking = false;
|
||||
emit completeChanged();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void OwncloudWizardSelectTypePage::setOCUrl( const QString& url )
|
||||
void OwncloudSetupPage::setErrorString( const QString& err )
|
||||
{
|
||||
_ui.OCUrlLineEdit->setText( url );
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
OwncloudCredentialsPage::OwncloudCredentialsPage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
registerField( QLatin1String("OCUser"), _ui.OCUserEdit );
|
||||
registerField( QLatin1String("OCPasswd"), _ui.OCPasswdEdit );
|
||||
registerField( QLatin1String("PwdNoLocalStore"), _ui.cbPwdNoLocalStore );
|
||||
|
||||
connect( _ui.OCPasswdEdit, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
|
||||
|
||||
connect( _ui.cbPwdNoLocalStore, SIGNAL(stateChanged(int)), this, SLOT(slotPwdStoreChanged(int)));
|
||||
}
|
||||
|
||||
OwncloudCredentialsPage::~OwncloudCredentialsPage()
|
||||
{
|
||||
}
|
||||
|
||||
void OwncloudCredentialsPage::slotPwdStoreChanged( int state )
|
||||
{
|
||||
_ui.OCPasswdEdit->setEnabled( state == Qt::Unchecked );
|
||||
if( err.isEmpty()) {
|
||||
_ui.errorLabel->setVisible(false);
|
||||
} else {
|
||||
_ui.errorLabel->setVisible(true);
|
||||
_ui.errorLabel->setText(err);
|
||||
}
|
||||
_checking = false;
|
||||
emit completeChanged();
|
||||
stopSpinner();
|
||||
}
|
||||
|
||||
bool OwncloudCredentialsPage::isComplete() const
|
||||
void OwncloudSetupPage::stopSpinner()
|
||||
{
|
||||
if( _ui.cbPwdNoLocalStore->checkState() == Qt::Checked ) {
|
||||
return !(_ui.OCUserEdit->text().isEmpty());
|
||||
_ui.resultLayout->setEnabled(false);
|
||||
_progressIndi->setVisible(false);
|
||||
_progressIndi->stopAnimation();
|
||||
}
|
||||
|
||||
OwncloudSetupPage::SyncMode OwncloudSetupPage::syncMode()
|
||||
{
|
||||
return BoxMode;
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::setRemoteFolder( const QString& remoteFolder )
|
||||
{
|
||||
if( !remoteFolder.isEmpty() ) {
|
||||
_remoteFolder = remoteFolder;
|
||||
}
|
||||
return !(_ui.OCUserEdit->text().isEmpty() || _ui.OCPasswdEdit->text().isEmpty() );
|
||||
}
|
||||
|
||||
void OwncloudCredentialsPage::initializePage()
|
||||
void OwncloudSetupPage::setMultipleFoldersExist(bool exist)
|
||||
{
|
||||
_multipleFoldersExist = exist;
|
||||
}
|
||||
|
||||
int OwncloudCredentialsPage::nextId() const
|
||||
{
|
||||
return OwncloudWizard::Page_Install;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
OwncloudFTPAccessPage::OwncloudFTPAccessPage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
registerField( QLatin1String("ftpUrl"), _ui.ftpUrlEdit );
|
||||
registerField( QLatin1String("ftpUser"), _ui.ftpUserEdit );
|
||||
registerField( QLatin1String("ftpPasswd"), _ui.ftpPasswdEdit );
|
||||
// registerField( QLatin1String("ftpDir"), _ui.ftpDir );
|
||||
|
||||
#if QT_VERSION >= 0x040700
|
||||
_ui.ftpUrlEdit->setPlaceholderText(tr("ftp.mydomain.org"));
|
||||
#endif
|
||||
}
|
||||
|
||||
OwncloudFTPAccessPage::~OwncloudFTPAccessPage()
|
||||
{
|
||||
}
|
||||
|
||||
void OwncloudFTPAccessPage::initializePage()
|
||||
{
|
||||
// _ui.lineEditOCAlias->setText( "Owncloud" );
|
||||
}
|
||||
|
||||
void OwncloudFTPAccessPage::setFTPUrl( const QString& url )
|
||||
{
|
||||
_ui.ftpUrlEdit->setText( url );
|
||||
}
|
||||
|
||||
int OwncloudFTPAccessPage::nextId() const
|
||||
{
|
||||
return OwncloudWizard::Page_OC_Credentials;
|
||||
}
|
||||
|
||||
bool OwncloudFTPAccessPage::isComplete() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
CreateAnOwncloudPage::CreateAnOwncloudPage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
registerField(QLatin1String("createLocalOC"), _ui.createLocalRadioBtn );
|
||||
registerField(QLatin1String("createOnDomain"), _ui.createPerFTPRadioBtn );
|
||||
registerField(QLatin1String("myOCDomain"), _ui.myDomainEdit );
|
||||
|
||||
connect( _ui.createLocalRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
|
||||
connect( _ui.createPerFTPRadioBtn, SIGNAL(clicked()), SIGNAL(completeChanged()));
|
||||
connect( _ui.myDomainEdit, SIGNAL(textChanged(QString)), SIGNAL(completeChanged()));
|
||||
|
||||
#if QT_VERSION >= 0x040700
|
||||
_ui.myDomainEdit->setPlaceholderText(tr("mydomain.org"));
|
||||
#endif
|
||||
}
|
||||
|
||||
CreateAnOwncloudPage::~CreateAnOwncloudPage()
|
||||
{
|
||||
}
|
||||
|
||||
void CreateAnOwncloudPage::initializePage()
|
||||
{
|
||||
// _ui.lineEditOCAlias->setText( "Owncloud" );
|
||||
}
|
||||
|
||||
int CreateAnOwncloudPage::nextId() const
|
||||
{
|
||||
if( _ui.createLocalRadioBtn->isChecked() ) {
|
||||
return OwncloudWizard::Page_OC_Credentials;
|
||||
}
|
||||
|
||||
return OwncloudWizard::Page_FTP;
|
||||
}
|
||||
|
||||
bool CreateAnOwncloudPage::isComplete() const
|
||||
void OwncloudSetupPage::slotSelectFolder()
|
||||
{
|
||||
|
||||
if( _ui.createPerFTPRadioBtn->isChecked() ) {
|
||||
QString dom = _ui.myDomainEdit->text();
|
||||
qDebug() << "check is Complete with " << dom;
|
||||
return (!dom.isEmpty() && dom.contains( QLatin1Char('.'))
|
||||
&& dom.lastIndexOf(QLatin1Char('.')) < dom.length()-2 );
|
||||
}
|
||||
return true;
|
||||
QString dir = QFileDialog::getExistingDirectory(0, tr("Local Sync Folder"), QDir::homePath());
|
||||
if( !dir.isEmpty() ) {
|
||||
_ui.pbSelectLocalFolder->setText(dir);
|
||||
wizard()->setProperty("localFolder", dir);
|
||||
slotHandleUserInput();
|
||||
}
|
||||
}
|
||||
|
||||
QString CreateAnOwncloudPage::domain() const
|
||||
OwncloudSetupPage::SyncMode OwncloudWizard::syncMode()
|
||||
{
|
||||
return _ui.myDomainEdit->text();
|
||||
return _setupPage->syncMode();
|
||||
return OwncloudSetupPage::BoxMode;
|
||||
}
|
||||
|
||||
void OwncloudWizard::setMultipleFoldersExist(bool exist)
|
||||
{
|
||||
_setupPage->setMultipleFoldersExist(exist);
|
||||
}
|
||||
|
||||
void OwncloudSetupPage::setConfigExists( bool config )
|
||||
{
|
||||
_configExists = config;
|
||||
|
||||
if (config == true) {
|
||||
setSubTitle( tr("<font color=\"%1\">Change your user credentials</font>")
|
||||
.arg(Theme::instance()->wizardHeaderTitleColor().name()));
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
OwncloudWizardResultPage::OwncloudWizardResultPage()
|
||||
{
|
||||
_ui.setupUi(this);
|
||||
// no fields to register.
|
||||
_ui.resultTextEdit->setAcceptRichText(true);
|
||||
_ui.ocLinkLabel->setVisible( false );
|
||||
|
||||
Theme *theme = Theme::instance();
|
||||
setTitle( tr("<font color=\"%1\" size=\"5\">Everything set up!</font>")
|
||||
.arg(theme->wizardHeaderTitleColor().name()));
|
||||
// required to show header in QWizard's modern style
|
||||
setSubTitle( QLatin1String(" ") );
|
||||
|
||||
_ui.pbOpenLocal->setText("Open local folder");
|
||||
_ui.pbOpenServer->setText(tr("Open %1").arg(Theme::instance()->appNameGUI()));
|
||||
|
||||
_ui.pbOpenLocal->setIcon(QIcon(":/mirall/resources/folder-sync.png"));
|
||||
_ui.pbOpenLocal->setText(tr("Open Local Folder"));
|
||||
_ui.pbOpenLocal->setIconSize(QSize(48, 48));
|
||||
connect(_ui.pbOpenLocal, SIGNAL(clicked()), SLOT(slotOpenLocal()));
|
||||
|
||||
_ui.pbOpenLocal->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
|
||||
QIcon appIcon = theme->applicationIcon();
|
||||
_ui.pbOpenServer->setIcon(appIcon.pixmap(48));
|
||||
_ui.pbOpenServer->setText(tr("Open %1").arg(theme->appNameGUI()));
|
||||
_ui.pbOpenServer->setIconSize(QSize(48, 48));
|
||||
_ui.pbOpenServer->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
connect(_ui.pbOpenServer, SIGNAL(clicked()), SLOT(slotOpenServer()));
|
||||
setupCustomization();
|
||||
}
|
||||
|
||||
@@ -421,42 +446,35 @@ OwncloudWizardResultPage::~OwncloudWizardResultPage()
|
||||
{
|
||||
}
|
||||
|
||||
void OwncloudWizardResultPage::initializePage()
|
||||
void OwncloudWizardResultPage::setComplete(bool complete)
|
||||
{
|
||||
// _ui.lineEditOCAlias->setText( "Owncloud" );
|
||||
_complete = complete;
|
||||
emit completeChanged();
|
||||
}
|
||||
|
||||
bool OwncloudWizardResultPage::isComplete() const
|
||||
{
|
||||
return true;
|
||||
return _complete;
|
||||
}
|
||||
|
||||
void OwncloudWizardResultPage::appendResultText( const QString& msg, OwncloudWizard::LogType type )
|
||||
void OwncloudWizardResultPage::initializePage()
|
||||
{
|
||||
if( msg.isEmpty() ) {
|
||||
_ui.resultTextEdit->clear();
|
||||
} else {
|
||||
if( type == OwncloudWizard::LogParagraph ) {
|
||||
_ui.resultTextEdit->append( msg );
|
||||
const QString localFolder = wizard()->property("localFolder").toString();
|
||||
QString text;
|
||||
if( _remoteFolder == QLatin1String("/") || _remoteFolder.isEmpty() ) {
|
||||
text = tr("Your entire account is synced to the local folder <i>%1</i>")
|
||||
.arg(QDir::toNativeSeparators(localFolder));
|
||||
} else {
|
||||
// _ui.resultTextEdit->append( msg );
|
||||
_ui.resultTextEdit->insertPlainText(msg );
|
||||
text = tr("ownCloud folder <i>%1</i> is synced to local folder <i>%2</i>")
|
||||
.arg(_remoteFolder).arg(QDir::toNativeSeparators(localFolder));
|
||||
}
|
||||
_ui.resultTextEdit->verticalScrollBar()->setValue( _ui.resultTextEdit->verticalScrollBar()->maximum() );
|
||||
}
|
||||
_ui.localFolderLabel->setText( text );
|
||||
|
||||
}
|
||||
|
||||
void OwncloudWizardResultPage::showOCUrlLabel( const QString& url, bool show )
|
||||
void OwncloudWizardResultPage::setRemoteFolder(const QString &remoteFolder)
|
||||
{
|
||||
_ui.ocLinkLabel->setText( tr("Congratulations! Your <a href=\"%1\" title=\"%1\">new %2</a> is now up and running!")
|
||||
.arg(url).arg( Theme::instance()->appName()));
|
||||
_ui.ocLinkLabel->setOpenExternalLinks( true );
|
||||
|
||||
if( show ) {
|
||||
_ui.ocLinkLabel->setVisible( true );
|
||||
} else {
|
||||
_ui.ocLinkLabel->setVisible( false );
|
||||
}
|
||||
_remoteFolder = remoteFolder;
|
||||
}
|
||||
|
||||
void OwncloudWizardResultPage::setupCustomization()
|
||||
@@ -476,100 +494,133 @@ void OwncloudWizardResultPage::setupCustomization()
|
||||
*/
|
||||
|
||||
OwncloudWizard::OwncloudWizard(QWidget *parent)
|
||||
: QWizard(parent)
|
||||
: QWizard(parent),
|
||||
_configExists(false)
|
||||
{
|
||||
#ifdef OWNCLOUD_CLIENT
|
||||
setPage(Page_oCWelcome, new OwncloudWelcomePage() );
|
||||
setPage(Page_oCSetup, new OwncloudSetupPage() );
|
||||
#else
|
||||
setPage(Page_SelectType, new OwncloudWizardSelectTypePage() );
|
||||
setPage(Page_OC_Credentials, new OwncloudCredentialsPage() );
|
||||
#endif
|
||||
setPage(Page_Create_OC, new CreateAnOwncloudPage() );
|
||||
setPage(Page_FTP, new OwncloudFTPAccessPage() );
|
||||
setPage(Page_Install, new OwncloudWizardResultPage() );
|
||||
_setupPage = new OwncloudSetupPage;
|
||||
_resultPage = new OwncloudWizardResultPage;
|
||||
setPage(Page_oCSetup, _setupPage );
|
||||
setPage(Page_Result, _resultPage );
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
// note: start Id is set by the calling class depending on if the
|
||||
// welcome text is to be shown or not.
|
||||
setWizardStyle( QWizard::ModernStyle );
|
||||
#endif
|
||||
setField(QLatin1String("connectMyOC"), true);
|
||||
|
||||
connect( this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int)));
|
||||
|
||||
connect( _setupPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString)));
|
||||
|
||||
|
||||
Theme *theme = Theme::instance();
|
||||
setWizardStyle(QWizard::ModernStyle);
|
||||
setPixmap( QWizard::BannerPixmap, theme->wizardHeaderBanner() );
|
||||
setPixmap( QWizard::LogoPixmap, theme->wizardHeaderLogo() );
|
||||
setOption( QWizard::NoBackButtonOnStartPage );
|
||||
setOption( QWizard::NoBackButtonOnLastPage );
|
||||
setOption( QWizard::NoCancelButton );
|
||||
setTitleFormat(Qt::RichText);
|
||||
setSubTitleFormat(Qt::RichText);
|
||||
}
|
||||
|
||||
QString OwncloudWizard::localFolder() const
|
||||
{
|
||||
return(_setupPage->localFolder());
|
||||
}
|
||||
|
||||
QString OwncloudWizard::ocUrl() const
|
||||
{
|
||||
QString url = field("OCUrl").toString().simplified();
|
||||
if( field("secureConnect").toBool() ) {
|
||||
url.prepend(QLatin1String("https://"));
|
||||
} else {
|
||||
url.prepend(QLatin1String("http://"));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
void OwncloudWizard::enableFinishOnResultWidget(bool enable)
|
||||
{
|
||||
_resultPage->setComplete(enable);
|
||||
}
|
||||
|
||||
void OwncloudWizard::setRemoteFolder( const QString& remoteFolder )
|
||||
{
|
||||
_setupPage->setRemoteFolder( remoteFolder );
|
||||
_resultPage->setRemoteFolder( remoteFolder );
|
||||
}
|
||||
|
||||
void OwncloudWizard::showConnectInfo( const QString& msg )
|
||||
{
|
||||
if( _setupPage ) {
|
||||
_setupPage->setErrorString( msg );
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudWizard::successfullyConnected(bool enable)
|
||||
{
|
||||
_setupPage->setConnected( enable );
|
||||
|
||||
if( enable ) {
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudWizard::slotCurrentPageChanged( int id )
|
||||
{
|
||||
qDebug() << "Current Wizard page changed to " << id;
|
||||
qDebug() << "Page_install is " << Page_Install;
|
||||
qDebug() << "Current Wizard page changed to " << id;
|
||||
|
||||
if( id == Page_oCSetup ) {
|
||||
setButtonText( QWizard::NextButton, tr("Connect...") );
|
||||
emit clearPendingRequests();
|
||||
_setupPage->initializePage();
|
||||
|
||||
if( id == Page_FTP ) {
|
||||
// preset the ftp url field
|
||||
CreateAnOwncloudPage *p = static_cast<CreateAnOwncloudPage*> (page( Page_Create_OC ));
|
||||
QString domain = p->domain();
|
||||
if( domain.startsWith( QLatin1String("http://") )) {
|
||||
domain = domain.right( domain.length()-7 );
|
||||
}
|
||||
if( domain.startsWith( QLatin1String("https://") )) {
|
||||
domain = domain.right( domain.length()-8 );
|
||||
}
|
||||
|
||||
QString host = QLatin1String("ftp.") +domain;
|
||||
OwncloudFTPAccessPage *p1 = static_cast<OwncloudFTPAccessPage*> (page( Page_FTP ));
|
||||
p1->setFTPUrl( host );
|
||||
}
|
||||
if( id == Page_Install ) {
|
||||
appendToResultWidget( QString::null );
|
||||
showOCUrlLabel( false );
|
||||
if( field(QLatin1String("connectMyOC")).toBool() ) {
|
||||
// check the url and connect.
|
||||
_oCUrl = ocUrl();
|
||||
emit connectToOCUrl( _oCUrl);
|
||||
} else if( field(QLatin1String("createLocalOC")).toBool() ) {
|
||||
qDebug() << "Connect to local!";
|
||||
emit installOCLocalhost();
|
||||
} else if( field(QLatin1String("createNewOC")).toBool() ) {
|
||||
// call in installation mode and install to ftp site.
|
||||
emit installOCServer();
|
||||
} else {
|
||||
if( id == Page_Result ) {
|
||||
appendToConfigurationLog( QString::null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudWizard::showOCUrlLabel( bool show )
|
||||
void OwncloudWizard::displayError( const QString& msg )
|
||||
{
|
||||
OwncloudWizardResultPage *p = static_cast<OwncloudWizardResultPage*> (page( Page_Install ));
|
||||
p->showOCUrlLabel( _oCUrl, show );
|
||||
_setupPage->setErrorString( msg );
|
||||
}
|
||||
|
||||
void OwncloudWizard::appendToResultWidget( const QString& msg, LogType type )
|
||||
void OwncloudWizard::appendToConfigurationLog( const QString& msg, LogType type )
|
||||
{
|
||||
OwncloudWizardResultPage *p = static_cast<OwncloudWizardResultPage*> (page( Page_Install ));
|
||||
p->appendResultText( msg, type );
|
||||
_setupLog << msg;
|
||||
qDebug() << "Setup-Log: " << msg;
|
||||
}
|
||||
|
||||
void OwncloudWizard::setOCUrl( const QString& url )
|
||||
{
|
||||
_oCUrl = url;
|
||||
#ifdef OWNCLOUD_CLIENT
|
||||
OwncloudSetupPage *p = static_cast<OwncloudSetupPage*>(page(Page_oCSetup));
|
||||
#else
|
||||
OwncloudWizardSelectTypePage *p = static_cast<OwncloudWizardSelectTypePage*>(page( Page_SelectType ));
|
||||
#endif
|
||||
if( p )
|
||||
p->setOCUrl( url );
|
||||
|
||||
_setupPage->setServerUrl( url );
|
||||
}
|
||||
|
||||
void OwncloudWizard::setOCUser( const QString& user )
|
||||
{
|
||||
_oCUser = user;
|
||||
_setupPage->setOCUser( user );
|
||||
}
|
||||
|
||||
void OwncloudWizard::setConfigExists( bool config )
|
||||
{
|
||||
_configExists = config;
|
||||
_setupPage->setConfigExists( config );
|
||||
}
|
||||
|
||||
bool OwncloudWizard::configExists()
|
||||
{
|
||||
return _configExists;
|
||||
}
|
||||
|
||||
void OwncloudWizardResultPage::slotOpenLocal()
|
||||
{
|
||||
const QString localFolder = wizard()->property("localFolder").toString();
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(localFolder));
|
||||
}
|
||||
|
||||
void OwncloudWizardResultPage::slotOpenServer()
|
||||
{
|
||||
QUrl url = field("OCUrl").toUrl();
|
||||
qDebug() << Q_FUNC_INFO << url;
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace
|
||||
|
||||
@@ -18,18 +18,18 @@
|
||||
|
||||
#include <QWizard>
|
||||
|
||||
#include "ui_owncloudwizardselecttypepage.h"
|
||||
#include "ui_createanowncloudpage.h"
|
||||
#include "ui_owncloudftpaccesspage.h"
|
||||
#include "ui_owncloudsetuppage_ng.h"
|
||||
#include "ui_owncloudwizardresultpage.h"
|
||||
#include "ui_owncloudcredentialspage.h"
|
||||
#include "ui_owncloudsetuppage.h"
|
||||
|
||||
class QLabel;
|
||||
class QVariant;
|
||||
class QProgressIndicator;
|
||||
|
||||
namespace Mirall {
|
||||
|
||||
class OwncloudSetupPage;
|
||||
class OwncloudWizardResultPage;
|
||||
|
||||
class OwncloudSetupPage: public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -37,18 +37,62 @@ public:
|
||||
OwncloudSetupPage();
|
||||
~OwncloudSetupPage();
|
||||
|
||||
enum SyncMode {
|
||||
SelectiveMode,
|
||||
BoxMode
|
||||
};
|
||||
|
||||
virtual bool isComplete() const;
|
||||
virtual void initializePage();
|
||||
virtual int nextId() const;
|
||||
void setOCUrl( const QString& );
|
||||
void setServerUrl( const QString& );
|
||||
void setOCUser( const QString& );
|
||||
void setAllowPasswordStorage( bool );
|
||||
bool validatePage();
|
||||
QString url() const;
|
||||
QString localFolder() const;
|
||||
void setConnected(bool complete);
|
||||
void setRemoteFolder( const QString& remoteFolder);
|
||||
void setMultipleFoldersExist( bool exist );
|
||||
|
||||
SyncMode syncMode();
|
||||
|
||||
public slots:
|
||||
void setErrorString( const QString& );
|
||||
void setConfigExists( bool );
|
||||
void stopSpinner();
|
||||
|
||||
protected slots:
|
||||
void slotPwdStoreChanged( int );
|
||||
void slotSecureConChanged( int );
|
||||
void handleNewOcUrl(const QString& ocUrl);
|
||||
void slotUrlChanged(const QString&);
|
||||
void slotUserChanged(const QString&);
|
||||
|
||||
void setupCustomization();
|
||||
void slotToggleAdvanced(int state);
|
||||
void slotSelectFolder();
|
||||
|
||||
signals:
|
||||
void connectToOCUrl( const QString& );
|
||||
|
||||
protected:
|
||||
void updateFoldersInfo();
|
||||
|
||||
private slots:
|
||||
void slotHandleUserInput();
|
||||
|
||||
private:
|
||||
bool urlHasChanged();
|
||||
|
||||
Ui_OwncloudSetupPage _ui;
|
||||
QString _oCUrl;
|
||||
QString _ocUser;
|
||||
bool _connected;
|
||||
bool _checking;
|
||||
bool _configExists;
|
||||
bool _multipleFoldersExist;
|
||||
|
||||
QProgressIndicator *_progressIndi;
|
||||
QButtonGroup *_selectiveSyncButtons;
|
||||
QString _remoteFolder;
|
||||
};
|
||||
|
||||
class OwncloudWizard: public QWizard
|
||||
@@ -57,13 +101,8 @@ class OwncloudWizard: public QWizard
|
||||
public:
|
||||
|
||||
enum {
|
||||
Page_oCWelcome,
|
||||
Page_oCSetup,
|
||||
Page_SelectType,
|
||||
Page_Create_OC,
|
||||
Page_OC_Credentials,
|
||||
Page_FTP,
|
||||
Page_Install
|
||||
Page_Result
|
||||
};
|
||||
|
||||
enum LogType {
|
||||
@@ -71,40 +110,43 @@ public:
|
||||
LogParagraph
|
||||
};
|
||||
|
||||
OwncloudWizard(QWidget *parent = 0L);
|
||||
OwncloudWizard(QWidget *parent = 0);
|
||||
|
||||
void setOCUrl( const QString& );
|
||||
void setOCUser( const QString& );
|
||||
|
||||
void setupCustomMedia( QVariant, QLabel* );
|
||||
QString ocUrl() const;
|
||||
QString localFolder() const;
|
||||
|
||||
void enableFinishOnResultWidget(bool enable);
|
||||
|
||||
void displayError( const QString& );
|
||||
OwncloudSetupPage::SyncMode syncMode();
|
||||
void setMultipleFoldersExist( bool );
|
||||
void setConfigExists( bool );
|
||||
bool configExists();
|
||||
|
||||
public slots:
|
||||
void appendToResultWidget( const QString& msg, LogType type = LogParagraph );
|
||||
void setRemoteFolder( const QString& );
|
||||
void appendToConfigurationLog( const QString& msg, LogType type = LogParagraph );
|
||||
void slotCurrentPageChanged( int );
|
||||
void showOCUrlLabel( bool );
|
||||
|
||||
void showConnectInfo( const QString& );
|
||||
void successfullyConnected(bool);
|
||||
|
||||
signals:
|
||||
void clearPendingRequests();
|
||||
void connectToOCUrl( const QString& );
|
||||
void installOCServer();
|
||||
void installOCLocalhost();
|
||||
|
||||
private:
|
||||
OwncloudSetupPage *_setupPage;
|
||||
OwncloudWizardResultPage *_resultPage;
|
||||
|
||||
QString _configFile;
|
||||
QString _oCUrl;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* page for first launch only
|
||||
*/
|
||||
class OwncloudWelcomePage: public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OwncloudWelcomePage();
|
||||
|
||||
virtual int nextId() const { return OwncloudWizard::Page_oCSetup; }
|
||||
QString _oCUser;
|
||||
QStringList _setupLog;
|
||||
bool _configExists;
|
||||
};
|
||||
|
||||
|
||||
@@ -112,79 +154,6 @@ public:
|
||||
* page to ask for the type of Owncloud to connect to
|
||||
*/
|
||||
|
||||
class OwncloudWizardSelectTypePage: public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OwncloudWizardSelectTypePage();
|
||||
~OwncloudWizardSelectTypePage();
|
||||
|
||||
virtual bool isComplete() const;
|
||||
virtual void initializePage();
|
||||
int nextId() const;
|
||||
void setOCUrl( const QString& );
|
||||
void showOCUrlLabel( const QString& );
|
||||
|
||||
private:
|
||||
Ui_OwncloudWizardSelectTypePage _ui;
|
||||
};
|
||||
|
||||
class CreateAnOwncloudPage: public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CreateAnOwncloudPage();
|
||||
~CreateAnOwncloudPage();
|
||||
|
||||
virtual bool isComplete() const;
|
||||
virtual void initializePage();
|
||||
virtual int nextId() const;
|
||||
|
||||
QString domain() const;
|
||||
|
||||
private:
|
||||
Ui_CreateAnOwncloudPage _ui;
|
||||
|
||||
};
|
||||
|
||||
class OwncloudCredentialsPage: public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OwncloudCredentialsPage();
|
||||
~OwncloudCredentialsPage();
|
||||
|
||||
virtual bool isComplete() const;
|
||||
virtual void initializePage();
|
||||
virtual int nextId() const;
|
||||
|
||||
protected slots:
|
||||
void slotPwdStoreChanged( int );
|
||||
|
||||
private:
|
||||
Ui_OwncloudCredentialsPage _ui;
|
||||
|
||||
};
|
||||
/**
|
||||
* page to ask for the ftp credentials etc. for ftp install
|
||||
*/
|
||||
class OwncloudFTPAccessPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OwncloudFTPAccessPage();
|
||||
~OwncloudFTPAccessPage();
|
||||
|
||||
virtual bool isComplete() const;
|
||||
virtual void initializePage();
|
||||
void setFTPUrl( const QString& );
|
||||
virtual int nextId() const;
|
||||
|
||||
private:
|
||||
Ui_OwncloudFTPAccessPage _ui;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* page to display the install result
|
||||
*/
|
||||
@@ -195,19 +164,26 @@ public:
|
||||
OwncloudWizardResultPage();
|
||||
~OwncloudWizardResultPage();
|
||||
|
||||
virtual bool isComplete() const;
|
||||
virtual void initializePage();
|
||||
bool isComplete() const;
|
||||
void initializePage();
|
||||
void setRemoteFolder( const QString& remoteFolder);
|
||||
|
||||
public slots:
|
||||
void appendResultText( const QString&, OwncloudWizard::LogType type = OwncloudWizard::LogParagraph );
|
||||
void showOCUrlLabel( const QString&, bool );
|
||||
void setComplete(bool complete);
|
||||
|
||||
protected slots:
|
||||
void slotOpenLocal();
|
||||
void slotOpenServer();
|
||||
|
||||
protected:
|
||||
void setupCustomization();
|
||||
|
||||
private:
|
||||
Ui_OwncloudWizardResultPage _ui;
|
||||
QString _localFolder;
|
||||
QString _remoteFolder;
|
||||
bool _complete;
|
||||
|
||||
Ui_OwncloudWizardResultPage _ui;
|
||||
};
|
||||
|
||||
} // ns Mirall
|
||||
|
||||
@@ -6,79 +6,14 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>526</width>
|
||||
<height>357</height>
|
||||
<width>469</width>
|
||||
<height>325</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QTextEdit" name="resultTextEdit">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="ocLinkLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Result</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#585858;">This page shows the status of the connection.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="topLabel">
|
||||
<property name="text">
|
||||
@@ -86,6 +21,140 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="localFolderLabel">
|
||||
<property name="text">
|
||||
<string>Your entire account is synced to the local folder </string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="pbOpenLocal">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="pbOpenServer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OwncloudWizardSelectTypePage</class>
|
||||
<widget class="QWidget" name="OwncloudWizardSelectTypePage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<height>321</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create an ownCloud Connection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Select the ownCloud you want to connect to</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="connectMyOCRadioBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>connect my ownCloud</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; color:#585858;">Specify the ownCloud you want to connect to.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; color:#585858;">Enter the web address of your ownCloud server below.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>ownCloud-Link:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="OCUrlLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Note: To specify an SSL secured connection, start the url with https.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QRadioButton" name="createNewOCRadioBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>create a new ownCloud</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QLabel" name="createNewOwncloudLabel">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#585858;">Select if you want to create a new ownCloud either on the local machine or on your server. </span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; color:#585858;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#585858;">This wizard will guide you through all neccessary steps.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>512</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||