1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2026-04-03 18:11:32 +02:00

Compare commits

..

187 Commits

Author SHA1 Message Date
Daniel Molkentin
c1b92f9fed beta2 2013-05-31 16:25:57 +02:00
Daniel Molkentin
b028ca0738 Merge pull request #650 from manolopm/master
Fixes for windows client when setup server url customization
2013-05-31 07:25:09 -07:00
Daniel Molkentin
a9aab30d55 Display proxy errors 2013-05-31 16:16:56 +02:00
Daniel Molkentin
efbad3a3c8 Propagate proxy changes to csync at run time 2013-05-31 16:16:41 +02:00
Manuel Padron Martinez
b6ed959f98 Removes server url label if a custom url is defined
Signed-off-by: Manuel Padron Martinez <manolopm@gmail.com>
2013-05-31 04:46:26 +01:00
Manuel Padron Martinez
477953f965 Put wizard url customization before connect signals
Signed-off-by: Manuel Padron Martinez <manolopm@gmail.com>
2013-05-31 04:45:48 +01:00
Daniel Molkentin
aaf59cece5 Wizard: Normalize directory separators 2013-05-29 17:24:59 +02:00
Daniel Molkentin
e88b7e8ec2 Centralize User Agent string and use in UpdateDetector 2013-05-29 16:13:38 +02:00
Daniel Molkentin
078b09b5f4 Remove obsolete include 2013-05-29 16:12:42 +02:00
Daniel Molkentin
0d06fe764a Status dialog: Use correct font metrics
This avoids cutting charcters such as 'y'.
2013-05-29 14:46:02 +02:00
Daniel Molkentin
94f8c39a9e Proxy settings: Also keep proxy user/pwd
make sure not to use it when the user
has asked us not to.

Simplify setupProxy()
2013-05-29 12:56:23 +02:00
Daniel Molkentin
7d1bd9da86 Properly deal with SOCKS proxies
Fixes #10
2013-05-29 02:14:40 +02:00
Daniel Molkentin
ed8cdf6910 Remember proxy settings even after switching type
Fixes #649
2013-05-29 01:41:04 +02:00
Daniel Molkentin
7ee83847c8 Do not try to reset the wizard when visible 2013-05-29 01:30:00 +02:00
Daniel Molkentin
52eca1362f Delete QWizard on destruction 2013-05-29 01:29:56 +02:00
Daniel Molkentin
eec1af09c4 Wizard: Fix rich text label layouting 2013-05-29 01:17:12 +02:00
Daniel Molkentin
c651c8cbf9 Wizard: Improve wording. 2013-05-29 01:16:52 +02:00
Daniel Molkentin
da6a398624 Wizard: Warn on re-setup with multiple folders 2013-05-28 20:25:31 +02:00
Daniel Molkentin
1418512a9f More cheating on proxies: Add OS to User-Agent 2013-05-28 19:35:30 +02:00
Daniel Molkentin
dd2859880b Set User-Agent to contain Mozilla/5.0 string
A blatant lie for a blatant abuse of Firewall filters.
2013-05-28 15:44:41 +02:00
Daniel Molkentin
f38d8ba2e4 Improve wizard in edit mode 2013-05-28 14:51:49 +02:00
Daniel Molkentin
fdd52a2520 Kill non-boxed mode for now 2013-05-28 14:51:48 +02:00
Daniel Molkentin
e2c0792043 take local folder path from property
This gets set by slotSelectFolder() and from the wizards caller.
2013-05-28 14:51:41 +02:00
Daniel Molkentin
e8889530b0 Fix owncloud theme icon 2013-05-28 14:42:41 +02:00
Klaas Freitag
23f67d950a Handle password change correct, add "sync from scratch".
The setup wizard now destinguishes if there was already a configuration
or not. If yes, it's going to password-change mode. Also added a checkbox
that allows to start a sync from a cleared local directory.
2013-05-26 14:04:11 +02:00
Klaas Freitag
0bd1f507ab Added a checkbox "start sync from scratch". 2013-05-26 13:57:28 +02:00
Klaas Freitag
2bcfc143f6 Let the folderman create a new sync directory.
If a sync directory exists its moved to a backup path and created new.
That allows to start a sync "from scratch".
2013-05-26 13:56:51 +02:00
Klaas Freitag
9dc21bf8a3 Let the keychain return new creds during async save.
The credentials are asynchronously saved. The credentialstore now returns
the creds even if the saving has not yet finished but is running, for that
the new state AsyncWriting was added. That makes the start of the sync
after the password was changed more reliable.
2013-05-26 13:55:23 +02:00
Klaas Freitag
70f627ba06 Fix the folder setup wizard. 2013-05-24 09:54:48 +02:00
Daniel Molkentin
0683c26d41 Make setting custom folders work again
Also, ensure that opening the local directory from the wizard
will work on Windows.
2013-05-23 01:51:05 +02:00
Daniel Molkentin
dbc085d4d4 Fix systray class when built without FDO support 2013-05-22 17:39:49 +02:00
Daniel Molkentin
804eaa700e Remove bogus debug output 2013-05-22 15:58:54 +02:00
Daniel Molkentin
646922665d 1.3.0beta1 2013-05-22 15:34:19 +02:00
Daniel Molkentin
62ad2f19e3 Setup Wizard: Make server/folder buttons work 2013-05-21 14:25:31 +02:00
Daniel Molkentin
14f55420f9 Remove obsolete connect statement 2013-05-21 14:20:56 +02:00
Daniel Molkentin
d4ea0ba6ba Merge branch 'master' of git://github.com/gnumdk/mirall
Conflicts:
	CMakeLists.txt

As per PR 457
2013-05-20 16:54:49 +02:00
Daniel Molkentin
c06f7b7ecb Update README.md
Fixes #182.
2013-05-20 11:00:29 +02:00
Daniel Molkentin
3a50eece9e More theming refactoring 2013-05-17 20:56:17 +02:00
Daniel Molkentin
44f0fb0242 Fix broken include 2013-05-17 20:12:31 +02:00
Daniel Molkentin
c210e2b72f Remove obsolete miralltheme 2013-05-17 20:11:16 +02:00
Daniel Molkentin
7b5079f043 Amendment to previous commit 2013-05-17 18:27:07 +02:00
Daniel Molkentin
be4027fb36 Remove deleted file from resources 2013-05-17 18:13:14 +02:00
Daniel Molkentin
0f03b47a46 Make new connection wizard themable 2013-05-17 18:05:22 +02:00
Daniel Molkentin
c923e0803e Add SyncResult::SyncPrepare case to FileItemDialog 2013-05-17 12:33:02 +02:00
Daniel Molkentin
bd74dbbfc5 doc: markup fixes 2013-05-17 12:02:40 +02:00
Daniel Molkentin
a0599e75b7 Update build instructions for Mac OS 2013-05-17 11:42:19 +02:00
Klaas Freitag
f334b6349b Add a call to quit to make the thread ending the loop 2013-05-16 17:35:40 +02:00
Klaas Freitag
2ff9fcfa1d Fix crash if _thread is not initialized before. 2013-05-16 13:26:05 +02:00
Daniel Molkentin
aa23e4698b Correct spelling of some mac os meta files
Fixes #619
2013-05-14 23:15:22 +02:00
Daniel Molkentin
302fdeb1f9 Use UTF-8 for basic auth
Slightly off-specs, and fails for non UTF-8 setups,
but the ownCloud server itself expects UTF-8 encoding.
2013-05-09 22:01:39 +02:00
Daniel Molkentin
eea8542fc0 Quit app/abort sync gracefully. 2013-05-09 21:55:28 +02:00
Daniel Molkentin
a36d79e993 Fix make install 2013-05-04 17:01:14 +02:00
Daniel Molkentin
be5c1b2072 Fix build 2013-05-04 16:38:39 +02:00
Daniel Molkentin
f0bd1ea48e Add connectionvalidator class 2013-05-04 16:01:45 +02:00
Daniel Molkentin
90d0460a42 Remove dummy artwork, dead switches 2013-05-04 15:55:04 +02:00
Daniel Molkentin
c15ce2b20b Remove last traces of localRun 2013-05-04 15:16:53 +02:00
Daniel Molkentin
b51f210bfa Drop (broken) mirall binary
This remove all non-ownCloud backends, as well
as all obsolete wizard pages. CSync is now
a mandatory dependency.
2013-05-04 14:03:51 +02:00
Daniel Molkentin
105c76c055 Fix sizing problems in the new wizard dialog. 2013-04-30 21:51:48 +02:00
Daniel Molkentin
6b15b7a58f Update detector: make it possible to skip updates.
Fixes issue #588.
2013-04-30 17:46:07 +02:00
Daniel Molkentin
fee0aae975 new wizard: Better separate folder names in strings. 2013-04-30 17:46:07 +02:00
Klaas Freitag
b33b638d2d A bit more verbose troubleshooting documentation. 2013-04-30 13:53:33 +02:00
Klaas Freitag
1e677a5f0f Fixed default target dir to / and fixed logging text. 2013-04-30 13:53:13 +02:00
Klaas Freitag
3f3f6c0f39 Move setPlaceholderText to correct class. 2013-04-29 14:09:05 +02:00
Klaas Freitag
5dd53b48ef Add missing lineedit method for ancient Qt versions 2013-04-29 11:08:37 +02:00
Klaas Freitag
a215e11b20 Merge development branch with new setup dialog. 2013-04-29 10:20:01 +02:00
Daniel Molkentin
7d71f9dd2d Merge pull request #582 from ghmer/master
Fix messed formatting in build documentation
2013-04-29 00:34:53 -07:00
Jenkins for ownCloud
183f1574ca [tx-robot] updated from transifex 2013-04-29 01:26:56 +02:00
Jenkins for ownCloud
504b651bb9 [tx-robot] updated from transifex 2013-04-28 01:27:25 +02:00
Klaas Freitag
c848ff4bdb New setup dialog, simplified version. 2013-04-27 22:24:32 +02:00
Klaas Freitag
5aa8f5bc01 Added own CookieJar to not return a Session Cookie, rem Auth Callback
The auth callback is not needed as we send an Basic Auth header.
2013-04-27 22:22:20 +02:00
Klaas Freitag
6c5d5a543c Simplified config file write method, removed don't store pwd. 2013-04-27 22:21:28 +02:00
Klaas Freitag
a8bc849b5d Add blue ownCloud logo. 2013-04-27 22:20:33 +02:00
Klaas Freitag
5f535b9661 owncloud logo pixmap. 2013-04-27 21:07:39 +02:00
Klaas Freitag
eaf865539c Added owncloud logo for new setup dialog. 2013-04-27 21:07:00 +02:00
Mario Enrico Ragucci
75448c41d4 Verified format cleanup (really...)
Signed-off-by: Mario Enrico Ragucci <github@ragucci.de>
2013-04-26 17:02:55 +02:00
Mario Enrico Ragucci
afc96e2021 Format cleanup
Signed-off-by: Mario Enrico Ragucci <github@ragucci.de>
2013-04-26 15:47:49 +02:00
Daniel Molkentin
d7bce80c7b Merge pull request #580 from ghmer/master
Documentation Update cross-compiling section to include all libs needed to build the Windows Package
2013-04-26 04:41:20 -07:00
Mario Enrico Ragucci
7e07d20d31 Remove LOG4C information as this is not needed anymore
Signed-off-by: Mario Enrico Ragucci <github@ragucci.de>
2013-04-26 13:32:35 +02:00
Daniel Molkentin
238111be09 Find csync_version.h, local config.h 2013-04-26 10:48:02 +02:00
Klaas Freitag
6f0820a3ed Add QProgressIndicator to source list 2013-04-26 10:47:17 +02:00
Jenkins for ownCloud
1d0d1c249b [tx-robot] updated from transifex 2013-04-26 01:26:32 +02:00
Mario Enrico Ragucci
1b5ed68375 Formatting cleanup 2013-04-26 01:00:50 +02:00
Mario Enrico Ragucci
ce996b3fc8 - Update Cross-Compiling section: Listing of all needed libraries to successfully build the Windows installer package
- Adding a note about the missing cross-compiled LOG4C package
- Minor changes to the documentation to be more specific about building the Windows package
2013-04-26 00:45:19 +02:00
Daniel Molkentin
2789522948 Folder/ownCloudFolder: Clean up secondPath stuff 2013-04-25 16:06:31 +02:00
Daniel Molkentin
55a56cc275 Find csync_version.h, local config.h 2013-04-25 13:19:38 +02:00
Jenkins for ownCloud
20101527b2 [tx-robot] updated from transifex 2013-04-25 01:27:34 +02:00
Daniel Molkentin
311bd39100 Add simplified FancyLineEdit from Qt Creator to 3rdparty 2013-04-24 13:36:25 +02:00
Klaas Freitag
fab77a15f0 Fix build after merge 2013-04-24 13:33:26 +02:00
Klaas Freitag
09e7f5c618 Add qprogressindicator widget 2013-04-24 11:45:53 +02:00
Klaas Freitag
c5a674b1df More work on new Connection dialog. First working version. 2013-04-24 11:40:29 +02:00
Jenkins for ownCloud
f83453cfc7 [tx-robot] updated from transifex 2013-04-24 01:27:36 +02:00
Daniel Molkentin
1ca8ebebd9 Do not add shortcuts to non-existent files 2013-04-23 17:19:27 +02:00
Klaas Freitag
7cc73ed46c Merge feature branch that introduces non terminating csync. 2013-04-23 16:52:02 +02:00
Daniel Molkentin
01b4694b47 Bump version to distinguish nightlies 2013-04-23 16:49:15 +02:00
dragotin
bcc6d59c6b Update CONTRIBUTING.md 2013-04-23 12:35:44 +03:00
Daniel Molkentin
b4e2e5f586 1.2.5 ChangeLog 2013-04-22 15:48:21 +02:00
Jenkins for ownCloud
43ed874789 [tx-robot] updated from transifex 2013-04-22 15:28:38 +02:00
Klaas Freitag
8928c87fc3 Removed silly configDir hack from thread. 2013-04-22 15:06:28 +02:00
Daniel Molkentin
e3f8a918d6 Merge pull request #559 from ghmer/master
Fix for Issue #424
2013-04-22 04:01:22 -07:00
Daniel Molkentin
668bb94270 1.2.5 2013-04-22 12:46:16 +02:00
Daniel Molkentin
89e0543e0a Merge pull request #562 from fastfwd/master
Fix Issue #382 (Minor Windows Installer Issue: Missing descriptions on the "Choose Components" screen).
2013-04-22 03:41:17 -07:00
fastfwd
6695b50965 Fix Issue #382
Just a couple of typo/cut-and-paste errors.
2013-04-22 01:22:16 -07:00
Jenkins for ownCloud
5c02c85126 [tx-robot] updated from transifex 2013-04-21 01:26:18 +02:00
Mario Enrico Ragucci
de99c0c7e7 Silently ignore "installed = true" string in JSON string returned by status.php 2013-04-21 00:46:37 +02:00
Klaas Freitag
9f0348979b Simplify csyncthread with keeping csync ctx intact 2013-04-20 13:15:27 +03:00
Jenkins for ownCloud
5b5cd310b9 [tx-robot] updated from transifex 2013-04-20 01:27:05 +02:00
Daniel Molkentin
ea85d68a26 Revert non-working hack 2013-04-19 16:20:30 +02:00
Daniel Molkentin
fb0a883f7b Init member to 0, remove nonsensical if (foo) delete foo 2013-04-19 16:20:30 +02:00
Jenkins for ownCloud
64a0efe29a [tx-robot] updated from transifex 2013-04-19 01:26:30 +02:00
Daniel Molkentin
1f361b7260 Make certificateChain() thread safe
Fixes #487, #491, #454
2013-04-18 14:02:20 +02:00
Jenkins for ownCloud
763b06477d [tx-robot] updated from transifex 2013-04-18 01:28:59 +02:00
Klaas Freitag
cd7d2a0778 Set path for configure_file of desktop file. 2013-04-17 16:21:05 +02:00
Klaas Freitag
a4be3f304d Set log verbosity before calling csync_init. 2013-04-17 15:29:44 +02:00
Jenkins for ownCloud
88184d14d6 [tx-robot] updated from transifex 2013-04-17 01:53:47 +02:00
Daniel Molkentin
844d8eba47 Fix tr plural usage 2013-04-17 01:21:15 +02:00
Daniel Molkentin
5e65945a53 filitemdialog: more wording changes 2013-04-16 17:28:03 +02:00
Daniel Molkentin
428040762f fileitemdialog: GUI feedback for the copy action 2013-04-16 16:49:53 +02:00
Daniel Molkentin
30e0a13bc5 invalid password: Improve wording 2013-04-16 14:28:00 +02:00
Daniel Molkentin
275c2b1a6b Fix misleading balloon titles
Fixes #546
2013-04-16 11:24:07 +02:00
Jenkins for ownCloud
e409814cb6 [tx-robot] updated from transifex 2013-04-16 01:03:40 +02:00
Daniel Molkentin
acdb624713 safer approach for detecting duplicate sync runs 2013-04-15 15:55:54 +02:00
Daniel Molkentin
3cae8e7124 Remove debugging code 2013-04-15 14:32:23 +02:00
Jenkins for ownCloud
2595b9eae7 [tx-robot] updated from transifex 2013-04-15 01:02:18 +02:00
Jenkins for ownCloud
46a8561925 [tx-robot] updated from transifex 2013-04-14 01:02:45 +02:00
Jenkins for ownCloud
bb74cab887 [tx-robot] updated from transifex 2013-04-13 01:02:28 +02:00
Jenkins for ownCloud
dd7f58b9b9 [tx-robot] updated from transifex 2013-04-12 01:02:18 +02:00
Daniel Molkentin
ee080222d8 Bump version 2013-04-11 12:52:58 +04:00
Daniel Molkentin
c7aaa3ab28 Add 1.2.4 changelog 2013-04-11 12:34:33 +04:00
Daniel Molkentin
fcde01fd4c Clarify string in folder wizard 2013-04-11 10:57:19 +04:00
Jenkins for ownCloud
83be334ee8 [tx-robot] updated from transifex 2013-04-11 01:02:21 +02:00
Jenkins for ownCloud
819f76c2b9 [tx-robot] updated from transifex 2013-04-10 01:02:30 +02:00
Jenkins for ownCloud
783b16676f [tx-robot] updated from transifex 2013-04-09 01:09:43 +02:00
Klaas Freitag
aa6160ab62 Fixed some valgrind warnings. 2013-04-08 14:50:47 +02:00
Jenkins for ownCloud
8bae06802b [tx-robot] updated from transifex 2013-04-06 00:06:25 +02:00
Jenkins for ownCloud
a20f572448 [tx-robot] updated from transifex 2013-04-05 00:24:21 +02:00
Daniel Molkentin
f74aa1e9a6 terminate if more than one thread is being started. 2013-04-04 17:25:53 +02:00
Klaas Freitag
86525570aa Fix default config storage path. 2013-04-04 15:19:45 +02:00
Jenkins for ownCloud
d11ce781d0 [tx-robot] updated from transifex 2013-04-04 00:07:40 +02:00
Klaas Freitag
be5a50a000 Merge branch 'confdir' of https://github.com/smessmer/mirall into smessmer-confdir 2013-04-03 14:42:13 +02:00
dragotin
7309a894bc Merge pull request #477 from rominf/master
Fix for bug with folders adding
2013-04-03 04:39:17 -07:00
Jenkins for ownCloud
310f29d3fd [tx-robot] updated from transifex 2013-04-03 00:04:53 +02:00
Daniel Molkentin
07db03d6bc 1.2.3 2013-04-02 15:27:37 +02:00
Daniel Molkentin
d68c4b379f Unbreak self-signed certificate handling 2013-04-02 15:22:27 +02:00
Daniel Molkentin
396a12dfde Amend ChangeLog 2013-04-02 10:14:02 +02:00
Jenkins for ownCloud
c79f4f91a8 [tx-robot] updated from transifex 2013-04-02 00:05:14 +02:00
Klaas Freitag
bec2f7c9b9 Removed verbose logging on Win32. 2013-03-28 11:14:16 +01:00
Jenkins for ownCloud
d4c8cad0e2 [tx-robot] updated from transifex 2013-03-27 00:11:52 +01:00
Daniel Molkentin
0ad2bd4b91 Add favlink generation support for Nautilus 2013-03-25 18:00:58 +01:00
Daniel Molkentin
dcc8f9fa6c Fix favlink manual test 2013-03-25 18:00:25 +01:00
Markus Goetz
d7a93c74aa OS X: Fix creation of Finder Favorite 2013-03-25 14:57:34 +01:00
Daniel Molkentin
408547611b Manual test for favlinks 2013-03-25 12:53:40 +01:00
rominf
a8f0e79046 Skipping folders with no absolute path. 2013-03-23 10:48:37 +04:00
Jenkins for ownCloud
3e45147497 [tx-robot] updated from transifex 2013-03-23 00:07:09 +01:00
Daniel Molkentin
48310d3f5e Add 1.2.2 changelog 2013-03-22 14:59:22 +01:00
Daniel Molkentin
1831a975eb SSLErrorDialog: We cannot use the existing key chain
... use the one returned by the new server instead.
2013-03-22 14:59:22 +01:00
Jenkins for ownCloud
a766a44bcf [tx-robot] updated from transifex 2013-03-22 12:08:57 +01:00
Cedric Bellegarde
8165b83a27 Check for service availability 2013-03-22 11:58:55 +01:00
Cedric Bellegarde
fa62c270e6 Merge git://github.com/owncloud/mirall 2013-03-22 11:40:58 +01:00
Cedric Bellegarde
c03199e78a Re add space 2013-03-22 11:35:25 +01:00
Cedric Bellegarde
f346503534 Better fdo detection 2013-03-22 11:34:21 +01:00
Jenkins for ownCloud
287f1c55ff [tx-robot] updated from transifex 2013-03-22 00:05:37 +01:00
Daniel Molkentin
1c6523bcec Add plugin for screenreader support 2013-03-21 17:49:03 +03:00
Daniel Molkentin
337c6d3e4e Try to avoid crash on Mac OS during setup
... by moving setupFavLink to a place only called
if the folder to be referenced exists for sure.
2013-03-21 12:50:47 +01:00
Jenkins for ownCloud
4a57957420 [tx-robot] updated from transifex 2013-03-21 00:05:23 +01:00
Daniel Molkentin
c633302f31 Use the certificateChain() in the SSL error dialog
This includes the self-signed certificate anyway, and the previous
behavior led to funny side-effects.
2013-03-20 15:53:55 +01:00
Cedric Bellegarde
1315ca2a57 Move files to correct location 2013-03-20 10:19:55 +01:00
Cedric Bellegarde
2f0474a467 Add support for freedesktop notifications 2013-03-20 10:03:49 +01:00
Daniel Molkentin
db95e7291d bump version 2013-03-19 16:30:17 +01:00
Klaas Freitag
ae54c27805 Added office doc lock files. 2013-03-19 16:20:00 +01:00
Daniel Molkentin
284285d441 Do not follow symlinks when recursing
We do not support symlinks anyway
2013-03-18 14:12:25 +01:00
Jenkins for ownCloud
2554a67cc7 [tx-robot] updated from transifex 2013-03-15 00:08:00 +01:00
Jenkins for ownCloud
e2cccd8615 [tx-robot] updated from transifex 2013-03-13 00:07:52 +01:00
Jenkins for ownCloud
948a98a871 [tx-robot] updated from transifex 2013-03-12 00:15:38 +01:00
Daniel Molkentin
b50d201154 Merge pull request #423 from hefee/master
adding WITH_DOC parameter to cmake
2013-03-11 08:28:51 -07:00
hefee
25a3ceb94d adding WITH_DOC parameter to cmake
Fixes #412
2013-03-11 16:18:20 +01:00
Jenkins for ownCloud
c514fe371a [tx-robot] updated from transifex 2013-03-10 00:08:00 +01:00
Jenkins for ownCloud
9169c70efe [tx-robot] updated from transifex 2013-03-09 00:07:47 +01:00
Jenkins for ownCloud
3c07cea229 [tx-robot] updated from transifex 2013-03-08 00:27:56 +01:00
Klaas Freitag
d3f51c611f Some more troubleshooting details. 2013-03-06 08:51:04 +01:00
Jenkins for ownCloud
21123bb029 [tx-robot] updated from transifex 2013-03-04 00:09:00 +01:00
Jenkins for ownCloud
fb8d11650c [tx-robot] updated from transifex 2013-03-03 00:08:15 +01:00
Jan-Christoph Borchardt
2c250050d5 add http and https icons for connection feedback 2013-03-01 16:09:10 +01:00
Jenkins for ownCloud
e9b3cbf3f7 [tx-robot] updated from transifex 2013-02-28 00:07:02 +01:00
Jenkins for ownCloud
d31a6e6179 [tx-robot] updated from transifex 2013-02-27 00:10:59 +01:00
Klaas Freitag
26d8c213b0 Updated Changelog. 2013-02-26 12:08:40 +01:00
Sebastian Meßmer
4caca2ce1a The configuration directory is a static attribute in mirallconfigfile class 2013-01-14 00:48:26 +01:00
Sebastian Meßmer
e0645b4b63 Allow setting the configuration directory on command line 2013-01-02 19:08:14 +01:00
126 changed files with 14760 additions and 10781 deletions

View File

@@ -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)

View File

@@ -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:

View File

@@ -1,6 +1,58 @@
ChangeLog
=========
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.
* [GUI] New tray notifications about synced files.
@@ -51,10 +103,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 +197,3 @@ version 1.0.1 (release 2012-04-18), csync 0.50.5 required
* [Platform] MacOSX Bundle creation added
* [Platform] Enabled ranslations on Windows.

View File

@@ -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>

View File

@@ -1,6 +1,6 @@
set( VERSION_MAJOR 1 )
set( VERSION_MINOR 2 )
set( VERSION_PATCH 1 )
set( VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX})
set( VERSION_MINOR 3 )
set( VERSION_PATCH 0 )
set( VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}beta2)
set( SOVERSION 0 )

View File

@@ -35,6 +35,7 @@
!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"
@@ -266,7 +267,7 @@ FunctionEnd
# INSTALLER SECTIONS #
# #
##############################################################################
Section "${APPLICATION_NAME}" SEC_OWNCLOUD
Section "${APPLICATION_NAME}" SEC_APPLICATION
SectionIn 1 2 3 RO
SetDetailsPrint listonly
@@ -358,6 +359,9 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
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
; /usr/i686-w64-mingw32/sys-root/mingw/bin/csync_modules/
@@ -370,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"
@@ -421,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}
@@ -458,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
@@ -471,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

View File

@@ -14,11 +14,13 @@ if(SPHINX_FOUND)
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 (UNIX AND (NOT APPLE))
install(DIRECTORY ${SPHINX_HTML_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY ${SPHINX_MAN_DIR} DESTINATION ${CMAKE_INSTALL_MANDIR})
endif (UNIX AND (NOT APPLE))
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
@@ -32,9 +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 (UNIX AND (NOT APPLE))
install(DIRECTORY ${SPHINX_PDF_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif (UNIX AND (NOT APPLE))
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}
@@ -46,9 +48,9 @@ if(SPHINX_FOUND)
${SPHINX_QCH_DIR}/*.qhcp
DEPENDS doc-qch-sphinx )
add_dependencies(doc doc-qch)
if (UNIX AND (NOT APPLE))
install(DIRECTORY ${SPHINX_QCH_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif (UNIX AND (NOT APPLE))
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

View File

@@ -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/

View File

@@ -1,28 +1,85 @@
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.
Here are a couple of useful steps to isolate the problem.
: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.
:All desktop clients fail to connect to ownCloud:
The ownCloud syncing use the built in WebDAV server of ownCloud.
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.
Logfiles
========
Doing effective debugging requires to provide as much as relevant logfiles 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 into a file, which is an useful option
in case the problem only happens ocassionally. In that case it is better to
create a huge logfile than piping the whole log through the log window.
To create a log file, start the client with ``--logfile <filename>``.
: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``.

View File

@@ -7,10 +7,8 @@
<file>resources/folder-remote.png</file>
<file>resources/folder-sync.png</file>
<file>resources/folder-grey.png</file>
<file>resources/mirall-32.png</file>
<file>resources/mirall-128.png</file>
<file>resources/mirall-48.png</file>
<file>resources/task-ongoing.png</file>
<file>resources/view-refresh.png</file>
<file>resources/owncloud_logo_blue.png</file>
</qresource>
</RCC>

BIN
resources/lock-http.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

BIN
resources/lock-https.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 991 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

165
src/3rdparty/QProgressIndicator/LICENSE vendored Normal file
View 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.

View 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();
}
}

View 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

View 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

View 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

View 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

View File

@@ -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})
@@ -65,32 +61,29 @@ set(libsync_SRCS
mirall/folder.cpp
mirall/folderwatcher.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/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 )
@@ -122,7 +115,6 @@ if(QTKEYCHAIN_FOUND)
endif()
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}
@@ -142,7 +134,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
)
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()
@@ -151,6 +143,7 @@ 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 owncloudsync)
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 )

View File

@@ -15,11 +15,11 @@
#include <iostream>
#include "mirall/application.h"
#include "mirall/systray.h"
#include "mirall/folder.h"
#include "mirall/folderwatcher.h"
#include "mirall/folderwizard.h"
#include "mirall/networklocation.h"
#include "mirall/unisonfolder.h"
#include "mirall/owncloudfolder.h"
#include "mirall/statusdialog.h"
#include "mirall/owncloudsetupwizard.h"
@@ -29,13 +29,9 @@
#include "mirall/mirallconfigfile.h"
#include "mirall/updatedetector.h"
#include "mirall/proxydialog.h"
#include "mirall/version.h"
#include "mirall/credentialstore.h"
#include "mirall/logger.h"
#ifdef WITH_CSYNC
#include "mirall/csyncfolder.h"
#endif
#include "mirall/inotify.h"
#include <QtCore>
@@ -48,10 +44,6 @@
#include <QNetworkProxy>
#include <QNetworkProxyFactory>
#ifdef Q_OS_LINUX
#include <dlfcn.h>
#endif
namespace Mirall {
// application logging handler.
@@ -93,7 +85,8 @@ Application::Application(int &argc, char **argv) :
_showLogWindow(false),
_logFlush(false),
_helpOnly(false),
_fileItemDialog(0)
_fileItemDialog(0),
_statusDialog(0)
{
setApplicationName( _theme->appNameGUI() );
setWindowIcon( _theme->applicationIcon() );
@@ -104,16 +97,6 @@ Application::Application(int &argc, char **argv) :
//no need to waste time;
if ( _helpOnly ) return;
#ifdef Q_OS_LINUX
// HACK: bump the refcount for libgnutls by calling dlopen()
// so gnutls, which is an dependency of libneon on some linux
// distros, and does not cleanup it's FDs properly, does
// not get unloaded. This works around a FD exhaustion crash
// (#154). We are not using gnutls at all and it's fine
// if loading fails, so no error handling is performed here.
dlopen("libgnutls.so", RTLD_LAZY|RTLD_NODELETE);
#endif
connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString)));
connect( Logger::instance(), SIGNAL(guiLog(QString,QString)),
this, SLOT(slotShowTrayMessage(QString,QString)));
@@ -183,8 +166,8 @@ Application::Application(int &argc, char **argv) :
Application::~Application()
{
delete _tray; // needed, see ctor
if( _fileItemDialog) delete _fileItemDialog;
if( _statusDialog && ! _helpOnly) delete _statusDialog;
delete _fileItemDialog;
delete _statusDialog;
qDebug() << "* Mirall shutdown";
}
@@ -207,7 +190,7 @@ void Application::slotStartFolderSetup( int result )
ownCloudInfo::instance()->checkInstallation();
} else {
_owncloudSetupWizard->startWizard(true); // with intro
_owncloudSetupWizard->startWizard();
}
} else {
qDebug() << "Setup Wizard was canceled. No reparsing of config.";
@@ -268,7 +251,7 @@ void Application::slotFetchCredentials()
this, SLOT(slotCredentialsFetched(bool)) );
CredentialStore::instance()->fetchCredentials();
if( CredentialStore::instance()->state() == CredentialStore::TooManyAttempts ) {
trayMessage = tr("Too many attempts to get a valid password.");
trayMessage = tr("Too many incorrect password attempts.");
}
} else {
qDebug() << "Can not try again to fetch Credentials.";
@@ -444,7 +427,7 @@ void Application::setupSystemTray()
{
// Setting a parent heres will crash on X11 since by the time qapp runs
// its childrens dtors, the X11->screen variable queried for is gone -> crash
_tray = new QSystemTrayIcon;
_tray = new Systray();
_tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) );
connect(_tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
@@ -554,38 +537,43 @@ void Application::setupLogBrowser()
}
void Application::setupProxy()
QNetworkProxy proxyFromConfig(const MirallConfigFile& cfg)
{
//
Mirall::MirallConfigFile cfg;
int proxy = cfg.proxyType();
switch(proxy) {
case QNetworkProxy::NoProxy: {
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
break;
}
case QNetworkProxy::DefaultProxy: {
QNetworkProxyFactory::setUseSystemConfiguration(true);
break;
}
case QNetworkProxy::Socks5Proxy: {
proxy = QNetworkProxy::HttpProxy;
cfg.setProxyType(proxy);
// fall through
}
case QNetworkProxy::HttpProxy:{
QNetworkProxy proxy;
proxy.setType(QNetworkProxy::HttpProxy);
proxy.setHostName(cfg.proxyHostName());
proxy.setPort(cfg.proxyPort());
QNetworkProxy proxy;
proxy.setHostName(cfg.proxyHostName());
proxy.setPort(cfg.proxyPort());
if (cfg.proxyNeedsAuth()) {
proxy.setUser(cfg.proxyUser());
proxy.setPassword(cfg.proxyPassword());
}
return proxy;
}
void Application::setupProxy()
{
Mirall::MirallConfigFile cfg;
int proxyType = cfg.proxyType();
QNetworkProxy proxy = proxyFromConfig(cfg);
switch(proxyType) {
case QNetworkProxy::NoProxy:
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
break;
case QNetworkProxy::DefaultProxy:
QNetworkProxyFactory::setUseSystemConfiguration(true);
break;
case QNetworkProxy::Socks5Proxy:
proxy.setType(QNetworkProxy::Socks5Proxy);
QNetworkProxy::setApplicationProxy(proxy);
break;
case QNetworkProxy::HttpProxy:
proxy.setType(QNetworkProxy::HttpProxy);
QNetworkProxy::setApplicationProxy(proxy);
break;
default:
break;
}
}
_folderMan->setProxy();
}
/*
@@ -653,30 +641,11 @@ void Application::slotAddFolder()
QString alias = _folderWizard->field(QLatin1String("alias")).toString();
QString sourceFolder = _folderWizard->field(QLatin1String("sourceFolder")).toString();
QString backend = QLatin1String("csync");
QString backend = QLatin1String("owncloud");
QString targetPath;
bool onlyThisLAN = false;
bool onlyOnline = false;
if (_folderWizard->field(QLatin1String("local?")).toBool()) {
// setup a local csync folder
targetPath = _folderWizard->field(QLatin1String("targetLocalFolder")).toString();
} else if (_folderWizard->field(QLatin1String("remote?")).toBool()) {
// setup a remote csync folder
targetPath = _folderWizard->field(QLatin1String("targetURLFolder")).toString();
onlyOnline = _folderWizard->field(QLatin1String("onlyOnline?")).toBool();
onlyThisLAN = _folderWizard->field(QLatin1String("onlyThisLAN?")).toBool();
(void) onlyOnline;
(void) onlyThisLAN;
} else if( _folderWizard->field(QLatin1String("OC?")).toBool() ||
Theme::instance()->singleSyncFolder()) {
// setup a ownCloud folder
backend = QLatin1String("owncloud");
targetPath = _folderWizard->field(QLatin1String("targetOCFolder")).toString(); //empty in single folder mode
} else {
qWarning() << "* Folder not local and note remote?";
goodData = false;
}
targetPath = _folderWizard->field(QLatin1String("OCFolderLineEdit")).toString();
_folderMan->setSyncEnabled(true); // do start sync again.
@@ -715,7 +684,7 @@ void Application::slotOpenStatus()
if( !cfgFile.exists() ) {
qDebug() << "No configured folders yet, start the Owncloud integration dialog.";
_folderMan->setSyncEnabled(false);
_owncloudSetupWizard->startWizard(true); // with intro
_owncloudSetupWizard->startWizard();
} else {
qDebug() << "#============# Status dialog starting #=============#";
raiseWidget = _statusDialog;
@@ -826,7 +795,10 @@ void Application::slotEnableFolder(const QString& alias, const bool enable)
void Application::slotConfigure()
{
_folderMan->setSyncEnabled(false); // do not start more syncs.
_owncloudSetupWizard->startWizard(false);
if (!_owncloudSetupWizard->wizard()->isVisible())
_owncloudSetupWizard->startWizard();
else
raiseDialog(_owncloudSetupWizard->wizard());
}
void Application::slotConfigureProxy()
@@ -854,13 +826,10 @@ void Application::slotSyncStateChange( const QString& alias )
{
SyncResult result = _folderMan->syncResult( alias );
// do not promote LocalSyncState to the status dialog.
if( !result.localRunOnly() ) {
_statusDialog->slotUpdateFolderState( _folderMan->folder(alias) );
_statusDialog->slotUpdateFolderState( _folderMan->folder(alias) );
if( _fileItemDialog && _fileItemDialog->isVisible() ) {
_fileItemDialog->setSyncResult( _folderMan->syncResult(alias) );
}
if( _fileItemDialog && _fileItemDialog->isVisible() ) {
_fileItemDialog->setSyncResult( _folderMan->syncResult(alias) );
}
computeOverallSyncStatus();
@@ -892,12 +861,18 @@ void Application::parseOptions(const QStringList &options)
_logFlush = true;
} else if (option == QLatin1String("--monoicons")) {
_theme->setSystrayUseMonoIcons(true);
} else {
setHelp();
std::cout << "Option not recognized: " << option.toStdString() << std::endl;
break;
} else if (option == QLatin1String("--confdir")) {
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
QString confDir = it.next();
MirallConfigFile::setConfDir( confDir );
} else {
showHelp();
}
} else {
setHelp();
break;
}
}
}
}
void Application::computeOverallSyncStatus()
@@ -914,54 +889,52 @@ void Application::computeOverallSyncStatus()
SyncResult folderResult = syncedFolder->syncResult();
SyncResult::Status syncStatus = folderResult.status();
if( ! folderResult.localRunOnly() ) { // skip local runs, use the last message.
switch( syncStatus ) {
case SyncResult::Undefined:
if ( overallResult.status() != SyncResult::Error ) {
overallResult.setStatus(SyncResult::Error);
}
folderMessage = tr( "Undefined State." );
break;
case SyncResult::NotYetStarted:
folderMessage = tr( "Waits to start syncing." );
overallResult.setStatus( SyncResult::NotYetStarted );
break;
case SyncResult::SyncPrepare:
folderMessage = tr( "Preparing for sync." );
overallResult.setStatus( SyncResult::SyncPrepare );
break;
case SyncResult::SyncRunning:
folderMessage = tr( "Sync is running." );
overallResult.setStatus( SyncResult::SyncRunning );
break;
case SyncResult::Unavailable:
folderMessage = tr( "Server is currently not available." );
overallResult.setStatus( SyncResult::Unavailable );
break;
case SyncResult::Success:
if( overallResult.status() == SyncResult::Undefined ) {
folderMessage = tr( "Last Sync was successful." );
overallResult.setStatus( SyncResult::Success );
}
break;
case SyncResult::Error:
overallResult.setStatus( SyncResult::Error );
folderMessage = tr( "Syncing Error." );
break;
case SyncResult::SetupError:
if ( overallResult.status() != SyncResult::Error ) {
overallResult.setStatus( SyncResult::SetupError );
}
folderMessage = tr( "Setup Error." );
break;
default:
folderMessage = tr( "Undefined Error State." );
overallResult.setStatus( SyncResult::Error );
switch( syncStatus ) {
case SyncResult::Undefined:
if ( overallResult.status() != SyncResult::Error ) {
overallResult.setStatus(SyncResult::Error);
}
if( !syncedFolder->syncEnabled() ) {
// sync is disabled.
folderMessage += tr( " (Sync is paused)" );
folderMessage = tr( "Undefined State." );
break;
case SyncResult::NotYetStarted:
folderMessage = tr( "Waits to start syncing." );
overallResult.setStatus( SyncResult::NotYetStarted );
break;
case SyncResult::SyncPrepare:
folderMessage = tr( "Preparing for sync." );
overallResult.setStatus( SyncResult::SyncPrepare );
break;
case SyncResult::SyncRunning:
folderMessage = tr( "Sync is running." );
overallResult.setStatus( SyncResult::SyncRunning );
break;
case SyncResult::Unavailable:
folderMessage = tr( "Server is currently not available." );
overallResult.setStatus( SyncResult::Unavailable );
break;
case SyncResult::Success:
if( overallResult.status() == SyncResult::Undefined ) {
folderMessage = tr( "Last Sync was successful." );
overallResult.setStatus( SyncResult::Success );
}
break;
case SyncResult::Error:
overallResult.setStatus( SyncResult::Error );
folderMessage = tr( "Syncing Error." );
break;
case SyncResult::SetupError:
if ( overallResult.status() != SyncResult::Error ) {
overallResult.setStatus( SyncResult::SetupError );
}
folderMessage = tr( "Setup Error." );
break;
default:
folderMessage = tr( "Undefined Error State." );
overallResult.setStatus( SyncResult::Error );
}
if( !syncedFolder->syncEnabled() ) {
// sync is disabled.
folderMessage += tr( " (Sync is paused)" );
}
qDebug() << "Folder in overallStatus Message: " << syncedFolder << " with name " << syncedFolder->alias();
@@ -998,6 +971,7 @@ setHelp();
std::cout << " --logfile <filename> : write log output to file <filename>." << std::endl;
std::cout << " --logflush : flush the log file after every write." << std::endl;
std::cout << " --monoicons : Use black/white pictograms for systray." << std::endl;
std::cout << " --confdir <dirname> : Use the given configuration directory." << std::endl;
std::cout << std::endl;
if (_theme->appName() == QLatin1String("ownCloud"))
std::cout << "For more information, see http://www.owncloud.org" << std::endl;

View File

@@ -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;
@@ -104,7 +104,7 @@ private:
void raiseDialog( QWidget* );
// configuration file -> folder
QSystemTrayIcon *_tray;
Systray *_tray;
QAction *_actionQuit;
QAction *_actionAddFolder;
QAction *_actionOpenStatus;

View 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 );
}
}

View 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

View File

@@ -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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;installs the ownCloud on this computer. Other people will not be able to access your data by default.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;installs ownCloud on a domain you control. You need the FTP credentials for the installation.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;This ownCloud will be accessible from the internet.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&amp;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>

View File

@@ -76,23 +76,14 @@ bool CredentialStore::canTryAgain()
return false;
}
if( _state == NotFetched ) {
/* Since QtKeyChain is required now, it makes 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()
@@ -147,7 +138,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;
}
@@ -347,6 +338,7 @@ void CredentialStore::saveCredentials( )
connect( job, SIGNAL(finished(QKeychain::Job*)), this,
SLOT(slotKeyChainWriteFinished(QKeychain::Job*)));
_state = AsyncWriting;
job->start();
#endif
break;
@@ -373,15 +365,21 @@ void CredentialStore::slotKeyChainWriteFinished( QKeychain::Job *job )
pwdJob->errorString().contains(QLatin1String("Could not open wallet"))) {
_type = Settings;
saveCredentials();
_state = NoKeychainBackend;
} 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;

View File

@@ -57,6 +57,7 @@ public:
AccessDenied,
NoKeychainBackend,
Error,
AsyncWriting,
TooManyAttempts };
enum CredentialType {

View File

@@ -1,104 +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;
_syncResult.setStatus( SyncResult::SyncRunning );
emit syncStateChange();
_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

View File

@@ -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

View File

@@ -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();
}
@@ -120,7 +105,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);
errStr = tr("<p>The target directory does not exist.</p><p>Please check the sync setup.</p>");
// this is critical. The database has to be removed.
emit wipeDb();
break;
@@ -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 );
@@ -279,10 +244,11 @@ 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();
}
@@ -290,20 +256,21 @@ int CSyncThread::treewalkError(TREE_WALK_FILE* file)
}
struct CSyncRunScopeHelper {
CSyncRunScopeHelper(CSYNC *_ctx, CSyncThread *_parent)
: ctx(_ctx), parent(_parent)
CSyncRunScopeHelper(CSYNC *ctx, CSyncThread *parent)
: _ctx(ctx), _parent(parent)
{
t.start();
_t.start();
}
~CSyncRunScopeHelper() {
csync_destroy(ctx);
csync_commit(_ctx);
qDebug() << "CSync run took " << t.elapsed() << " Milliseconds";
emit(parent->finished());
qDebug() << "CSync run took " << _t.elapsed() << " Milliseconds";
emit(_parent->finished());
_parent->_syncMutex.unlock();
}
CSYNC *ctx;
QTime t;
CSyncThread *parent;
CSYNC *_ctx;
QTime _t;
CSyncThread *_parent;
};
void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
@@ -323,176 +290,72 @@ void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
void CSyncThread::startSync()
{
if (!_syncMutex.tryLock()) {
qDebug() << Q_FUNC_INFO << "WARNING: Another sync seems to be running. Not starting a new one.";
return;
}
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();
CSYNC *csync;
int proxyPort = _proxy.port();
_mutex.lock();
_syncedItems.clear();
_needsUpdate = false;
_mutex.unlock();
if( csync_create(&csync,
_source.toUtf8().data(),
_target.toUtf8().data()) < 0 ) {
emit csyncError( tr("CSync create failed.") );
}
MirallConfigFile cfg;
csync_set_config_dir( csync, cfg.configPath().toUtf8() );
_mutex.lock();
_csyncConfigDir = cfg.configPath();
_mutex.unlock();
csync_enable_conflictcopys(csync);
QString excludeList = cfg.excludeFile();
if( !excludeList.isEmpty() ) {
qDebug() << "==== added CSync exclude List: " << excludeList.toUtf8();
csync_add_exclude_list( csync, excludeList.toUtf8() );
}
// cleans up behind us and emits finished() to ease error handling
CSyncRunScopeHelper helper(csync, this);
CSyncRunScopeHelper helper(_csync_ctx, this);
csync_set_userdata(csync, this);
csync_set_userdata(_csync_ctx, this);
csync_set_log_callback( csync, csyncLogCatcher );
csync_set_auth_callback( csync, getauth );
csync_set_progress_callback( csync, progress );
if( csync_init(csync) < 0 ) {
handleSyncError(csync, "csync_init");
return;
}
// 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 ) {
handleSyncError(csync, "csync_update");
if( csync_update(_csync_ctx) < 0 ) {
handleSyncError(_csync_ctx, "csync_update");
return;
}
qDebug() << "<<#### Update end ###########################################################";
if( csync_reconcile(csync) < 0 ) {
handleSyncError(csync, "cysnc_reconcile");
if( csync_reconcile(_csync_ctx) < 0 ) {
handleSyncError(_csync_ctx, "cysnc_reconcile");
return;
}
bool walkOk = true;
if( csync_walk_local_tree(csync, &treewalkLocal, 0) < 0 ) {
if( csync_walk_local_tree(_csync_ctx, &treewalkLocal, 0) < 0 ) {
qDebug() << "Error in local treewalk.";
walkOk = false;
}
if( walkOk && csync_walk_remote_tree(csync, &treewalkRemote, 0) < 0 ) {
if( walkOk && csync_walk_remote_tree(_csync_ctx, &treewalkRemote, 0) < 0 ) {
qDebug() << "Error in remote treewalk.";
}
if (_needsUpdate)
emit(started());
if( csync_propagate(csync) < 0 ) {
handleSyncError(csync, "cysnc_reconcile");
if( csync_propagate(_csync_ctx) < 0 ) {
handleSyncError(_csync_ctx, "cysnc_reconcile");
return;
}
if( walkOk ) {
if( csync_walk_local_tree(csync, &walkFinalize, 0) < 0 ||
csync_walk_remote_tree( csync, &walkFinalize, 0 ) < 0 ) {
qDebug() << "Error in finalize treewalk.";
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::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;
}
}
return re;
}
void CSyncThread::progress(const char *remote_url, enum csync_notify_type_e kind,
long long o1, long long o2, void *userdata)
{

View File

@@ -35,13 +35,9 @@ 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 * );
Q_INVOKABLE void startSync();
@@ -74,25 +70,13 @@ 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;
friend class CSyncRunScopeHelper;

View File

@@ -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,7 @@ void FileItemDialog::slotSetFolderMessage()
QDateTime now = QDateTime::currentDateTime();
int secs = _lastSyncTime.secsTo(now);
_timelabel->setText(tr("%1 (finished %2 sec. ago)").arg(_folderMessage).arg(secs));
_timelabel->setText(tr("%1 (finished %n sec. ago)", "", secs).arg(_folderMessage));
}
void FileItemDialog::copyToClipboard()
@@ -147,6 +152,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 +225,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 ) {

View File

@@ -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*>& );

View File

@@ -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;

View File

@@ -139,11 +139,6 @@ QString Folder::nativePath() const
return QDir::toNativeSeparators(_path);
}
QString Folder::nativeSecondPath() const
{
return secondPath();
}
bool Folder::syncEnabled() const
{
return _enabled;
@@ -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

View File

@@ -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
@@ -174,6 +173,11 @@ public slots:
*/
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

View File

@@ -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"
@@ -39,9 +37,10 @@ FolderMan::FolderMan(QObject *parent) :
{
// 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 &)),
@@ -178,38 +177,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) {
@@ -253,17 +220,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
@@ -271,15 +228,11 @@ 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;
@@ -456,8 +409,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()
@@ -504,4 +455,46 @@ 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();
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();
}
}
}

View File

@@ -76,6 +76,16 @@ public:
*/
void wipeAllJournals();
/**
* 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.
@@ -111,8 +121,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.

View File

@@ -170,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;
}

View File

@@ -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:

View File

@@ -82,6 +82,13 @@ 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;
@@ -159,12 +166,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 +174,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)
@@ -217,11 +213,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 );
}
@@ -247,26 +242,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 +261,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 +293,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()->appNameGUI()).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 +303,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()->appNameGUI()) );
// _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()->appNameGUI()).arg(error->errorString()));
_ui.OCRadioBtn->setEnabled( false );
_ui.OCFolderLineEdit->setEnabled( false );
}
@@ -343,132 +322,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());
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 ) {

View File

@@ -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;
};
/**
*
*/
@@ -149,11 +104,13 @@ public:
};
FolderWizard(QWidget *parent = 0);
~FolderWizard();
void setFolderMap( Folder::Map* );
private:
FolderWizardSourcePage *_folderWizardSourcePage;
FolderWizardTargetPage *_folderWizardTargetPage;
};

View File

@@ -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>

View File

@@ -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>

View File

@@ -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 &amp;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 &amp;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&amp;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 &amp;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>

View File

@@ -97,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;
@@ -114,6 +112,7 @@ INotify::~INotify()
close(_fd);
free(_buffer);
delete _notifier;
}
void INotify::addPath(const QString &path)

View File

@@ -17,7 +17,7 @@
#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>
@@ -30,6 +30,7 @@
namespace Mirall {
QString MirallConfigFile::_oCVersion;
QString MirallConfigFile::_confDir = QString::null;
bool MirallConfigFile::_askedUser = false;
MirallConfigFile::MirallConfigFile( const QString& appendix )
@@ -37,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;
}
@@ -121,25 +153,17 @@ 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;
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 );
@@ -491,7 +515,7 @@ void MirallConfigFile::acceptCustomConfig()
void MirallConfigFile::setProxyType(int proxyType,
const QString& host,
int port,
int port, bool needsAuth,
const QString& user,
const QString& pass)
{
@@ -500,11 +524,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();
}
@@ -532,6 +560,11 @@ int MirallConfigFile::proxyPort() const
return getValue(QLatin1String("port"), QLatin1String("proxy")).toInt();
}
bool MirallConfigFile::proxyNeedsAuth() const
{
return getValue(QLatin1String("needsAuth"), QLatin1String("proxy")).toInt();
}
QString MirallConfigFile::proxyUser() const
{
return getValue(QLatin1String("user"), QLatin1String("proxy")).toString();

View File

@@ -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,8 +51,7 @@ 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() );
@@ -89,16 +89,21 @@ 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;
@@ -112,6 +117,7 @@ private:
private:
static bool _askedUser;
static QString _oCVersion;
static QString _confDir;
QString _customHandle;
};

View File

@@ -1,108 +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:
case SyncResult::SyncPrepare:
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"));
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -18,6 +18,7 @@
#include "mirall/owncloudinfo.h"
#include "mirall/credentialstore.h"
#include "mirall/logger.h"
#include "mirall/utility.h"
#include <csync.h>
@@ -35,6 +36,14 @@
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,11 +59,10 @@ 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)
@@ -66,13 +74,161 @@ ownCloudFolder::ownCloudFolder(const QString &alias,
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_ctx = 0;
}
setProxy();
}
}
ownCloudFolder::~ownCloudFolder()
{
if( _thread ) {
_thread->quit();
csync_request_abort(_csync_ctx);
_thread->wait();
}
// 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 +236,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 +250,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() );
@@ -111,7 +261,8 @@ void ownCloudFolder::startSync(const QStringList &pathList)
qCritical() << "* ERROR csync is still running and new sync requested.";
return;
}
if (_thread)
_thread->quit();
delete _csync;
delete _thread;
_errors.clear();
@@ -122,26 +273,15 @@ void ownCloudFolder::startSync(const QStringList &pathList)
MirallConfigFile cfgFile;
_syncResult.clearErrors();
// we now have watchers for everything, so every sync is remote.
_syncResult.setLocalRunOnly( false );
_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");
connect( _csync, SIGNAL(treeWalkResult(const SyncFileItemVector&)),
this, SLOT(slotThreadTreeWalkResult(const SyncFileItemVector&)), Qt::QueuedConnection);
@@ -204,16 +344,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();
_csync->deleteLater();
delete _thread;
_csync = 0;
_thread = 0;
csync_resume(_csync_ctx);
}
if( ! configDir.isEmpty() ) {
@@ -332,15 +475,15 @@ void ServerActionNotifier::slotSyncFinished(const SyncResult &result)
if (removedItems == 1)
emit guiLog(tr("File removed"), tr("'%1' has been removed.").arg(file));
else
emit guiLog(tr("New files available"), tr("'%1' and %n other file(s) have been removed.",
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 removed"), tr("'%1' has been updated.").arg(file));
emit guiLog(tr("File updated"), tr("'%1' has been updated.").arg(file));
else
emit guiLog(tr("New files available"), tr("'%1' and %n other file(s) have been updated.",
emit guiLog(tr("Files updated"), tr("'%1' and %n other file(s) have been updated.",
"", updatedItems-1).arg(file));
}
}

View File

@@ -64,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);
@@ -73,6 +72,8 @@ public:
/* get status about a singel file. */
SyncFileStatus fileStatus( const QString& );
void setProxy();
public slots:
void startSync();
void slotTerminateSync();
@@ -88,6 +89,15 @@ private slots:
void slotCSyncFinished();
private:
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;
@@ -96,6 +106,8 @@ private:
bool _csyncUnavail;
bool _wipeDb;
SyncFileItemVector _items;
CSYNC *_csync_ctx;
};
}

View File

@@ -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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;The details here are used to install the owncloud data on your web space which is accessible over ftp. &lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@@ -14,8 +14,9 @@
#include "mirall/owncloudinfo.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/version.h"
#include "mirall/theme.h"
#include "mirall/utility.h"
#include "mirall/logger.h"
#include <QtCore>
#include <QtGui>
@@ -30,6 +31,17 @@
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()
@@ -53,7 +65,8 @@ ownCloudInfo::ownCloudInfo() :
_manager(0)
{
_connection = Theme::instance()->appName();
connect(this, SIGNAL(guiLog(QString,QString)),
Logger::instance(), SIGNAL(guiLog(QString,QString)));
setNetworkAccessManager( new QNetworkAccessManager( this ) );
}
@@ -65,15 +78,20 @@ void ownCloudInfo::setNetworkAccessManager( QNetworkAccessManager* qnam )
_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;
@@ -148,10 +166,9 @@ QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir )
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");
@@ -248,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;
@@ -284,6 +303,7 @@ void ownCloudInfo::slotAuthentication( QNetworkReply *reply, QAuthenticator *aut
reply->close();
}
}
#endif
QString ownCloudInfo::configHandle(QNetworkReply *reply)
{
@@ -296,6 +316,7 @@ QString ownCloudInfo::configHandle(QNetworkReply *reply)
QList<QSslCertificate> ownCloudInfo::certificateChain() const
{
QMutexLocker lock(const_cast<QMutex*>(&_certChainMutex));
return _certificateChain;
}
@@ -323,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();
}
@@ -416,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;
}
}
@@ -459,7 +483,36 @@ bool ownCloudInfo::certsUntrusted()
void ownCloudInfo::slotError( QNetworkReply::NetworkError err)
{
qDebug() << "ownCloudInfo Network Error: " << err;
qDebug() << "ownCloudInfo Network Error: " << err;
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,
@@ -488,8 +541,7 @@ 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("User-Agent"), Utility::userAgentString());
QString con = _configHandle;
if( con.isEmpty() ) con = DEFAULT_CONNECTION;
@@ -497,7 +549,7 @@ void ownCloudInfo::setupHeaders( QNetworkRequest & req, quint64 size )
oCICredentials creds = _credentials.value(con);
QString concatenated = creds.user + QLatin1Char(':') + creds.passwd;
const QString b(QLatin1String("Basic "));
QByteArray data = b.toLocal8Bit() + concatenated.toLocal8Bit().toBase64();
QByteArray data = b.toUtf8() + concatenated.toUtf8().toBase64();
req.setRawHeader( QByteArray("Authorization"), data );
}

View File

@@ -118,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 );
@@ -160,6 +160,7 @@ private:
bool _certsUntrusted;
int _authAttempts;
QMap<QString, oCICredentials> _credentials;
QMutex _certChainMutex;
};
};

View File

@@ -0,0 +1,475 @@
<?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>&amp;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>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="radioButton">
<property name="text">
<string>&amp;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="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;small&gt;Syncs your existing data to new location.&lt;/small&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If this box is checked, existing content in the local directory will be erased to start a clean sync from the server.&lt;/p&gt;&lt;p&gt;Do not check this if the local content should be uploaded to the servers directory.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>&amp;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="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;small&gt;Erases the contents of the local folder before syncing using the new settings.&lt;/small&gt;</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 &amp;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>&amp;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>&amp;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 &amp;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>

View File

@@ -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 {
@@ -33,61 +34,76 @@ OwncloudSetupWizard::OwncloudSetupWizard( FolderMan *folderMan, Theme *theme, QO
_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()));
connect( _ocWizard, SIGNAL(clearPendingRequests()),
this, SLOT(slotClearPendingRequests()));
_ocWizard->setWindowTitle( tr("%1 Connection Wizard").arg( theme ? theme->appNameGUI() : QLatin1String("Mirall") ) );
_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();
}
// 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();
@@ -97,22 +113,41 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
// go through all folders and remove the journals if the server changed.
MirallConfigFile prevCfg;
if( prevCfg.ownCloudUrl() != cfg.ownCloudUrl() ) {
qDebug() << "ownCloud URL has changed, journals needs to be wiped.";
_folderMan->wipeAllJournals();
QUrl prevUrl( prevCfg.ownCloudUrl() );
QUrl newUrl( cfg.ownCloudUrl() );
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.";
}
// save the user credentials and afterwards clear the cred store.
cfg.acceptCustomConfig();
// Now write the resulting folder definition if folder names are set.
if( !( _localFolder.isEmpty() || _remoteFolder.isEmpty() ) ) { // both variables are set.
if( _folderMan ) {
const QString localFolder = _ocWizard->localFolder();
if( !( localFolder.isEmpty() || _remoteFolder.isEmpty() ) ) { // both variables are set.
if( urlHasChanged ) {
_folderMan->removeAllFolderDefinitions();
_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));
localFolder, _remoteFolder, false );
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
bool startFromScratch = _ocWizard->field( "OCSyncFromScratch" ).toBool();
if( startFromScratch ) {
// clean the entire directory.
if( _folderMan->startFromScratch( localFolder ) ) {
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\">Successfully prepared syncing from scratch!</font>"));
} else {
_ocWizard->appendToConfigurationLog(tr("<font color=\"red\">Failed to prepare syncing from scratch!</font>"));
}
}
} else {
qDebug() << "WRN: Folderman is zero in Setup Wizzard.";
// url is unchanged. Only the password was changed.
qDebug() << "Only password was changed, no changes to folder configuration.";
}
}
} else {
@@ -123,14 +158,6 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
_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 );
}
@@ -139,7 +166,7 @@ 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...")
_ocWizard->appendToConfigurationLog(tr("Trying to connect to %1 at %2...")
.arg( Theme::instance()->appNameGUI() ).arg(url) );
testOwnCloudConnect();
}
@@ -155,29 +182,46 @@ void OwncloudSetupWizard::slotClearPendingRequests()
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;
if( prevCfg.proxyType() != QNetworkProxy::DefaultProxy ) {
cfgFile.setProxyType( prevCfg.proxyType(), prevCfg.proxyHostName(), prevCfg.proxyPort(),
prevCfg.proxyUser(), prevCfg.proxyPassword() );
prevCfg.proxyNeedsAuth(), prevCfg.proxyUser(), prevCfg.proxyPassword() );
}
}
@@ -187,6 +231,10 @@ void OwncloudSetupWizard::testOwnCloudConnect()
if( info->isConfigured() ) {
// reset the SSL Untrust flag to let the SSL dialog appear again.
info->resetSSLUntrust();
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.";
@@ -195,7 +243,12 @@ 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/>")
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.
@@ -207,9 +260,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()->appNameGUI()));
_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 );
@@ -217,272 +274,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()->appNameGUI()));
_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()->appNameGUI()));
_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
QString user = cfgFile.ownCloudUser();
if( !user.isEmpty() ) {
_ocWizard->setOCUser( user );
}
bool doStore = cfgFile.passwordStorageAllowed();
_ocWizard->setAllowPasswordStorage( doStore );
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)));
_mkdirRequestReply = 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;
}
@@ -495,23 +414,24 @@ 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>")
_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()->appNameGUI())
+ QLatin1String("</font></p>"));
}
_ocWizard->successfullyConnected(success);
}
}

View File

@@ -42,7 +42,7 @@ public:
/**
* @intro wether or not to show the intro wizard page
*/
void startWizard(bool intro = false);
void startWizard();
void installServer();
@@ -68,20 +68,8 @@ 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& );
@@ -89,11 +77,11 @@ private slots:
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 */
@@ -102,11 +90,11 @@ private:
OwncloudWizard *_ocWizard;
QPointer<QNetworkReply> _mkdirRequestReply;
QPointer<QNetworkReply> _checkInstallationRequest;
QPointer<QNetworkReply> _checkRemoteFolderRequest;
FolderMan *_folderMan;
QProcess *_process;
QString _configHandle;
QString _localFolder;
QString _remoteFolder;
};

View File

@@ -110,33 +110,6 @@ QIcon ownCloudTheme::trayFolderIcon( const QString& ) const
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::SyncPrepare:
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?
@@ -145,7 +118,17 @@ QIcon ownCloudTheme::folderDisabledIcon( ) const
QIcon ownCloudTheme::applicationIcon( ) const
{
return themeIcon( QLatin1String("owncloud") );
return themeIcon( QLatin1String("owncloud-icon") );
}
QColor ownCloudTheme::wizardHeaderBackgroundColor() const
{
return QColor("#1d2d42");
}
QColor ownCloudTheme::wizardHeaderTitleColor() const
{
return QColor("#ffffff");
}
}

View File

@@ -31,10 +31,12 @@ public:
QIcon folderIcon( const QString& ) const;
QIcon trayFolderIcon( const QString& ) const;
QIcon syncStateIcon( SyncResult::Status, bool sysTray ) const;
QIcon folderDisabledIcon() const;
QIcon applicationIcon() const;
QColor wizardHeaderBackgroundColor() const;
QColor wizardHeaderTitleColor() const;
private:

View File

@@ -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,378 +48,395 @@ void setupCustomMedia( QVariant variant, QLabel *label )
// ======================================================================
OwncloudWelcomePage::OwncloudWelcomePage()
{
setTitle(tr("Welcome to %1").arg(Theme::instance()->appNameGUI()));
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->appNameGUI()));
} 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->appNameGUI()));
}
}
OwncloudSetupPage::OwncloudSetupPage()
{
_ui.setupUi(this);
setTitle(tr("Create Connection to %1").arg(Theme::instance()->appNameGUI()));
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::slotToggleAdvanced(int state)
{
_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 )
{
if( _ui.leUsername->text().isEmpty() ) {
_ui.leUsername->setText(user);
}
_ocUser = user;
_ui.leUsername->setText(user);
}
void OwncloudSetupPage::setAllowPasswordStorage( bool allow )
void OwncloudSetupPage::setServerUrl( const QString& newUrl )
{
_ui.cbNoPasswordStore->setChecked( ! allow );
}
void OwncloudSetupPage::setOCUrl( const QString& newUrl )
{
QString url( newUrl );
if( url.isEmpty() ) {
_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.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() ) {
_ui.topLabel->setOpenExternalLinks(true);
_ui.topLabel->setText("If you don't have an ownCloud server yet, see <a href=\"https://owncloud.com\">owncloud.com</a> for more info.");
} else {
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;
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(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;
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();
}
@@ -433,12 +444,6 @@ OwncloudWizardResultPage::~OwncloudWizardResultPage()
{
}
void OwncloudWizardResultPage::initializePage()
{
_complete = false;
// _ui.lineEditOCAlias->setText( "Owncloud" );
}
void OwncloudWizardResultPage::setComplete(bool complete)
{
_complete = complete;
@@ -450,32 +455,24 @@ bool OwncloudWizardResultPage::isComplete() const
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()->appNameGUI()));
_ui.ocLinkLabel->setOpenExternalLinks( true );
if( show ) {
_ui.ocLinkLabel->setVisible( true );
} else {
_ui.ocLinkLabel->setVisible( false );
}
_remoteFolder = remoteFolder;
}
void OwncloudWizardResultPage::setupCustomization()
@@ -495,130 +492,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)
{
OwncloudWizardResultPage *p = static_cast<OwncloudWizardResultPage*> (page( Page_Install ));
p->setComplete(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 );
}
}
if( id == Page_oCSetup ) {
emit clearPendingRequests();
}
}
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;
#ifdef OWNCLOUD_CLIENT
OwncloudSetupPage *p = static_cast<OwncloudSetupPage*>(page(Page_oCSetup));
if( p )
p->setOCUser( user );
#else
OwncloudWizardSelectTypePage *p = static_cast<OwncloudWizardSelectTypePage*>(page( Page_SelectType ));
#endif
_setupPage->setOCUser( user );
}
void OwncloudWizard::setAllowPasswordStorage( bool allow )
void OwncloudWizard::setConfigExists( bool config )
{
#ifdef OWNCLOUD_CLIENT
OwncloudSetupPage *p = static_cast<OwncloudSetupPage*>(page(Page_oCSetup));
if( p )
p->setAllowPasswordStorage( allow );
#endif
_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

View File

@@ -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,20 +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
@@ -59,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 {
@@ -73,46 +110,43 @@ public:
LogParagraph
};
OwncloudWizard(QWidget *parent = 0L);
OwncloudWizard(QWidget *parent = 0);
void setOCUrl( const QString& );
void setOCUser( const QString& );
void setAllowPasswordStorage( bool );
void setupCustomMedia( QVariant, QLabel* );
QString ocUrl() const;
QString localFolder() const;
void enableFinishOnResultWidget(bool enable);
public slots:
void appendToResultWidget( const QString& msg, LogType type = LogParagraph );
void slotCurrentPageChanged( int );
void showOCUrlLabel( bool );
void displayError( const QString& );
OwncloudSetupPage::SyncMode syncMode();
void setMultipleFoldersExist( bool );
void setConfigExists( bool );
bool configExists();
public slots:
void setRemoteFolder( const QString& );
void appendToConfigurationLog( const QString& msg, LogType type = LogParagraph );
void slotCurrentPageChanged( int );
void showConnectInfo( const QString& );
void successfullyConnected(bool);
signals:
void connectToOCUrl( const QString& );
void installOCServer();
void installOCLocalhost();
void clearPendingRequests();
void connectToOCUrl( const QString& );
private:
OwncloudSetupPage *_setupPage;
OwncloudWizardResultPage *_resultPage;
QString _configFile;
QString _oCUrl;
QString _oCUser;
};
/**
* page for first launch only
*/
class OwncloudWelcomePage: public QWizardPage
{
Q_OBJECT
public:
OwncloudWelcomePage();
virtual int nextId() const { return OwncloudWizard::Page_oCSetup; }
QStringList _setupLog;
bool _configExists;
};
@@ -120,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
*/
@@ -203,22 +164,26 @@ public:
OwncloudWizardResultPage();
~OwncloudWizardResultPage();
virtual bool isComplete() const;
virtual void initializePage();
void setComplete(bool complete);
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:
QString _localFolder;
QString _remoteFolder;
bool _complete;
Ui_OwncloudWizardResultPage _ui;
Ui_OwncloudWizardResultPage _ui;
};
} // ns Mirall

View File

@@ -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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;This page shows the status of the connection.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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/>

View File

@@ -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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt; color:#585858;&quot;&gt;Specify the ownCloud you want to connect to.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:11pt; color:#585858;&quot;&gt;Enter the web address of your ownCloud server below.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;Select if you want to create a new ownCloud either on the local machine or on your server. &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-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;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#585858;&quot;&gt;This wizard will guide you through all necessary steps.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

@@ -35,21 +35,31 @@ Mirall::ProxyDialog::ProxyDialog( QWidget* parent )
// load current proxy settings
Mirall::MirallConfigFile cfgFile;
if (cfgFile.proxyType() == QNetworkProxy::NoProxy)
switch (cfgFile.proxyType()) {
case QNetworkProxy::NoProxy:
noProxyRadioButton->setChecked(true);
if (cfgFile.proxyType() == QNetworkProxy::DefaultProxy)
break;
case QNetworkProxy::DefaultProxy:
systemProxyRadioButton->setChecked(true);
if (cfgFile.proxyType() == QNetworkProxy::HttpProxy)
{
break;
case QNetworkProxy::Socks5Proxy:
cbSocks->setChecked(true);
// fall through
case QNetworkProxy::HttpProxy:
case QNetworkProxy::HttpCachingProxy:
manualProxyRadioButton->setChecked(true);
hostLineEdit->setText(cfgFile.proxyHostName());
portSpinBox->setValue(cfgFile.proxyPort());
if (!cfgFile.proxyUser().isEmpty())
{
authRequiredcheckBox->setChecked(true);
userLineEdit->setText(cfgFile.proxyUser());
passwordLineEdit->setText(cfgFile.proxyPassword());
}
break;
default:
break;
}
hostLineEdit->setText(cfgFile.proxyHostName());
portSpinBox->setValue(cfgFile.proxyPort());
if (!cfgFile.proxyUser().isEmpty())
{
authRequiredcheckBox->setChecked(true);
userLineEdit->setText(cfgFile.proxyUser());
passwordLineEdit->setText(cfgFile.proxyPassword());
}
}
@@ -67,18 +77,14 @@ void Mirall::ProxyDialog::saveSettings()
}
if (manualProxyRadioButton->isChecked())
{
if (authRequiredcheckBox->isChecked())
{
QString user = userLineEdit->text();
QString pass = passwordLineEdit->text();
cfgFile.setProxyType(QNetworkProxy::HttpProxy, hostLineEdit->text(),
portSpinBox->value(), user, pass);
}
else
{
cfgFile.setProxyType(QNetworkProxy::HttpProxy, hostLineEdit->text(),
portSpinBox->value(), QString::null, QString::null);
}
int proxyType = cbSocks->isChecked() ? QNetworkProxy::Socks5Proxy
: QNetworkProxy::HttpProxy;
QString user = userLineEdit->text();
QString pass = passwordLineEdit->text();
cfgFile.setProxyType(proxyType, hostLineEdit->text(),
portSpinBox->value(),
authRequiredcheckBox->isChecked(),
user, pass);
}
}

View File

@@ -6,38 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>465</width>
<height>291</height>
<width>405</width>
<height>319</height>
</rect>
</property>
<property name="windowTitle">
<string>Proxy Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<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>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -76,18 +53,82 @@
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>40</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="hostLabel">
<property name="text">
<string>Host</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hostLineEdit">
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="portSpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>8080</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbSocks">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use as SOCKSv5 proxy</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="authRequiredcheckBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Proxy server requires password</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="proxyUserLabel">
<property name="enabled">
@@ -143,70 +184,34 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="portLabel">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="hostLabel">
<property name="text">
<string>Host</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="hostLineEdit">
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="authRequiredcheckBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Proxy server requires password</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="portSpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>8080</number>
</property>
</widget>
</item>
</layout>
</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>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@@ -14,14 +14,13 @@
#include "mirall/mirallconfigfile.h"
#include "mirall/utility.h"
#include "mirall/sslerrordialog.h"
#include "mirall/owncloudinfo.h"
#include <QtGui>
#include <QtNetwork>
namespace Mirall
{
#define CA_CERTS_KEY QLatin1String("CaCertificates")
SslErrorDialog::SslErrorDialog(QWidget *parent) :
QDialog(parent), _allTrusted(false)
{
@@ -42,14 +41,6 @@ SslErrorDialog::SslErrorDialog(QWidget *parent) :
}
}
QList<QSslCertificate> SslErrorDialog::storedCACerts()
{
MirallConfigFile cfg( _customConfigHandle );
QList<QSslCertificate> cacerts = QSslCertificate::fromData(cfg.caCerts());
return cacerts;
}
QString SslErrorDialog::styleSheet() const
{
@@ -66,17 +57,25 @@ QString SslErrorDialog::styleSheet() const
}
#define QL(x) QLatin1String(x)
QList<QSslCertificate> SslErrorDialog::storedCACerts()
{
MirallConfigFile cfg( _customConfigHandle );
QList<QSslCertificate> cacerts = QSslCertificate::fromData(cfg.caCerts());
return cacerts;
}
bool SslErrorDialog::setErrorList( QList<QSslError> errors )
{
QList<QSslCertificate> ourCerts = storedCACerts();
// check if unknown certs caused errors.
_unknownCerts.clear();
QStringList errorStrings;
QList<QSslCertificate> trustedCerts = SslErrorDialog::storedCACerts();
for (int i = 0; i < errors.count(); ++i) {
if (ourCerts.contains(errors.at(i).certificate()) ||
_unknownCerts.contains(errors.at(i).certificate() ))
if (trustedCerts.contains(errors.at(i).certificate()) ||
_unknownCerts.contains(errors.at(i).certificate() ))
continue;
errorStrings += errors.at(i).errorString();
if (!errors.at(i).certificate().isNull()) {
@@ -191,9 +190,7 @@ void SslErrorDialog::accept()
QSslSocket::addDefaultCaCertificates(_unknownCerts);
MirallConfigFile cfg( _customConfigHandle );
QByteArray certs = cfg.caCerts();
qDebug() << "Saving " << _unknownCerts.count() << " unknown certs.";
foreach( const QSslCertificate& cert, _unknownCerts ) {
certs += cert.toPem() + '\n';

View File

@@ -22,6 +22,7 @@
#include "ui_sslerrordialog.h"
class QSslError;
class QSslCertificate;
namespace Mirall
@@ -39,13 +40,14 @@ public:
void setCustomConfigHandle( const QString& );
QList<QSslCertificate> storedCACerts();
signals:
public slots:
void accept();
private:
QList<QSslCertificate> storedCACerts();
QString styleSheet() const;
bool _allTrusted;

View File

@@ -146,7 +146,7 @@ void FolderViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
aliasRect.setLeft(iconRect.right()+margin);
aliasRect.setTop(aliasRect.top() + aliasFm.height()/2 );
aliasRect.setBottom(aliasRect.top()+subFm.height());
aliasRect.setBottom(aliasRect.top()+aliasFm.height());
// local directory box
QRect localPathRect = aliasRect;
@@ -227,9 +227,9 @@ StatusDialog::StatusDialog( Theme *theme, QWidget *parent) :
setWindowTitle( QString::fromLatin1( "%1 %2" ).arg(_theme->appNameGUI(), _theme->version() ) );
_model = new FolderStatusModel();
FolderViewDelegate *delegate = new FolderViewDelegate();
_delegate = new FolderViewDelegate();
_folderList->setItemDelegate( delegate );
_folderList->setItemDelegate( _delegate );
_folderList->setModel( _model );
_folderList->setMinimumWidth( 300 );
_folderList->setEditTriggers( QAbstractItemView::NoEditTriggers );
@@ -259,6 +259,8 @@ StatusDialog::StatusDialog( Theme *theme, QWidget *parent) :
StatusDialog::~StatusDialog()
{
delete _model;
delete _delegate;
}
void StatusDialog::slotFolderActivated( const QModelIndex& indx )
@@ -370,7 +372,7 @@ void StatusDialog::folderToModelItem( QStandardItem *item, Folder *f )
QIcon icon = _theme->folderIcon( f->backend() );
item->setData( icon, FolderViewDelegate::FolderIconRole );
item->setData( f->nativePath(), FolderViewDelegate::FolderPathRole );
item->setData( f->nativeSecondPath(), FolderViewDelegate::FolderSecondPathRole );
item->setData( f->secondPath(), FolderViewDelegate::FolderSecondPathRole );
item->setData( f->alias(), FolderViewDelegate::FolderAliasRole );
item->setData( f->syncEnabled(), FolderViewDelegate::FolderSyncEnabled );

View File

@@ -106,6 +106,7 @@ private:
void folderToModelItem( QStandardItem*, Folder* );
QStandardItemModel *_model;
FolderViewDelegate *_delegate;
QUrl _OCUrl;
Theme *_theme;
};

View File

@@ -19,13 +19,11 @@ namespace Mirall
SyncResult::SyncResult()
: _status( Undefined )
, _localRunOnly(false)
{
}
SyncResult::SyncResult(SyncResult::Status status )
: _status(status)
, _localRunOnly(false)
{
}
@@ -115,16 +113,6 @@ void SyncResult::clearErrors()
_errors.clear();
}
bool SyncResult::localRunOnly() const
{
return _localRunOnly;
}
void SyncResult::setLocalRunOnly( bool lor )
{
_localRunOnly = lor;
}
SyncResult::~SyncResult()
{
}

View File

@@ -57,8 +57,6 @@ public:
QString statusString() const;
QDateTime syncTime() const;
bool localRunOnly() const;
void setLocalRunOnly( bool );
private:
Status _status;
SyncFileItemVector _syncItems;
@@ -67,8 +65,6 @@ private:
* when the sync tool support this...
*/
QStringList _errors;
bool _localRunOnly;
};
}

42
src/mirall/systray.cpp Normal file
View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) by Cédric Bellegarde <gnumdk@gmail.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 "systray.h"
#ifdef USE_FDO_NOTIFICATIONS
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusPendingCall>
#define NOTIFICATIONS_SERVICE "org.freedesktop.Notifications"
#define NOTIFICATIONS_PATH "/org/freedesktop/Notifications"
#define NOTIFICATIONS_IFACE "org.freedesktop.Notifications"
#endif
void Systray::showMessage(const QString & title, const QString & message, MessageIcon icon, int millisecondsTimeoutHint)
{
#ifdef USE_FDO_NOTIFICATIONS
if(QDBusInterface(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE).isValid()) {
QList<QVariant> args = QList<QVariant>() << "owncloud" << quint32(0) << "owncloud"
<< title << message << QStringList () << QVariantMap() << qint32(-1);
QDBusMessage method = QDBusMessage::createMethodCall(NOTIFICATIONS_SERVICE, NOTIFICATIONS_PATH, NOTIFICATIONS_IFACE, "Notify");
method.setArguments(args);
QDBusConnection::sessionBus().asyncCall(method);
} else
#endif
{
QSystemTrayIcon::showMessage(title, message, icon, millisecondsTimeoutHint);
}
}

29
src/mirall/systray.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) by Cédric Bellegarde <gnumdk@gmail.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 SYSTRAY_H
#define SYSTRAY_H
#include <QSystemTrayIcon>
class QIcon;
class Systray : public QSystemTrayIcon
{
Q_OBJECT
public:
void showMessage(const QString & title, const QString & message, MessageIcon icon = Information, int millisecondsTimeoutHint = 10000);
};
#endif //SYSTRAY_H

View File

@@ -19,7 +19,6 @@
#include <QtCore>
#include <QtGui>
#include "mirall/miralltheme.h"
#include "mirall/owncloudtheme.h"
#ifdef THEME_INCLUDE
@@ -136,7 +135,7 @@ bool Theme::singleSyncFolder() const {
QString Theme::defaultServerFolder() const
{
return QLatin1String("clientsync");
return QLatin1String("/");
}
QString Theme::overrideServerUrl() const
@@ -198,5 +197,58 @@ QVariant Theme::customMedia( CustomMediaType type )
return re;
}
QIcon Theme::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::SyncPrepare:
case SyncResult::Success:
statusIcon = QLatin1String("state-ok");
break;
case SyncResult::Error:
case SyncResult::SetupError:
default:
statusIcon = QLatin1String("state-error");
}
return themeIcon( statusIcon, sysTray );
}
QColor Theme::wizardHeaderTitleColor() const
{
return qApp->palette().text().color();
}
QColor Theme::wizardHeaderBackgroundColor() const
{
return QColor();
}
QPixmap Theme::wizardHeaderLogo() const
{
return QPixmap(":/mirall/theme/colored/wizard_logo.png");
}
QPixmap Theme::wizardHeaderBanner() const
{
QColor c = wizardHeaderBackgroundColor();
if (!c.isValid())
return QPixmap();
QPixmap pix(QSize(600, 78));
pix.fill(wizardHeaderBackgroundColor());
return pix;
}
} // end namespace mirall

View File

@@ -22,6 +22,7 @@ class QIcon;
class QString;
class QObject;
class QPixmap;
class QColor;
namespace Mirall {
@@ -82,7 +83,7 @@ public:
/**
* get an sync state icon
*/
virtual QIcon syncStateIcon( SyncResult::Status, bool sysTray = false ) const = 0;
virtual QIcon syncStateIcon( SyncResult::Status, bool sysTray = false ) const;
virtual QIcon folderDisabledIcon() const = 0;
virtual QPixmap splashScreen() const = 0;
@@ -127,6 +128,24 @@ public:
*/
virtual QVariant customMedia( CustomMediaType type );
/** @return color for the setup wizard */
virtual QColor wizardHeaderTitleColor() const;
/** @return color for the setup wizard. */
virtual QColor wizardHeaderBackgroundColor() const;
/** @return logo for the setup wizard. */
virtual QPixmap wizardHeaderLogo() const;
/**
* The default implementation creates a
* background based on
* \ref wizardHeaderTitleColor().
*
* @return banner for the setup wizard.
*/
virtual QPixmap wizardHeaderBanner() const;
/**
* About dialog contents
*/

View File

@@ -1,155 +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/unisonfolder.h"
#include <QDebug>
#include <QDir>
#include <QMutexLocker>
#include <QStringList>
#include <QTextStream>
namespace Mirall {
UnisonFolder::UnisonFolder(const QString &alias,
const QString &path,
const QString &secondPath,
QObject *parent)
: Folder(alias, path, secondPath, parent),
_unison(new QProcess(this)),
_syncCount(0)
{
QObject::connect(_unison, SIGNAL(readyReadStandardOutput()),
SLOT(slotReadyReadStandardOutput()));
QObject::connect(_unison, SIGNAL(readyReadStandardError()),
SLOT(slotReadyReadStandardError()));
QObject::connect(_unison, SIGNAL(stateChanged(QProcess::ProcessState)),
SLOT(slotStateChanged(QProcess::ProcessState)));
QObject::connect(_unison, SIGNAL(error(QProcess::ProcessError)),
SLOT(slotError(QProcess::ProcessError)));
QObject::connect(_unison, SIGNAL(started()),
SLOT(slotStarted()));
QObject::connect(_unison, SIGNAL(finished(int, QProcess::ExitStatus)),
SLOT(slotFinished(int, QProcess::ExitStatus)));
}
UnisonFolder::~UnisonFolder()
{
}
bool UnisonFolder::isBusy() const
{
return (_unison->state() != QProcess::NotRunning);
}
void UnisonFolder::startSync(const QStringList &pathList)
{
QMutexLocker locker(&_syncMutex);
_syncResult.setStatus( SyncResult::SyncRunning );
emit syncStateChange();
emit syncStarted();
QString program = QLatin1String("unison");
QStringList args;
args << QLatin1String("-ui") << QLatin1String("text");
args << QLatin1String("-auto") << QLatin1String("-batch");
args << QLatin1String("-confirmbigdel=false");
// only use -path in after a full synchronization
// already happened, which we do only on the first
// sync when the program is started
if (_syncCount > 0 ) {
// may be we should use a QDir in the API itself?
QDir root(path());
foreach( const QString& changedPath, pathList) {
args << QLatin1String("-path") << root.relativeFilePath(changedPath);
}
}
args << path();
args << secondPath();
qDebug() << " * Unison: will use" << pathList.size() << "path arguments";
_unison->start(program, args);
}
void UnisonFolder::slotTerminateSync()
{
if( _unison )
_unison->terminate();
}
void UnisonFolder::slotStarted()
{
qDebug() << " * Unison process started ( PID " << _unison->pid() << ")";
_syncCount++;
//qDebug() << _unison->readAllStandardOutput();;
}
void UnisonFolder::slotFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
qDebug() << " * Unison process finished with status" << exitCode;
//if (exitCode != 0) {
qDebug() << _lastOutput;
//}
// parse a summary from here:
//[BGN] Copying zw.png from //piscola//space/store/folder1 to /space/mirall/folder1
//[BGN] Deleting gn.png from /space/mirall/folder1
//[END] Deleting gn.png
// from stderr:
//Reconciling changes
// <---- new file Package.h
_lastOutput.clear();
emit syncFinished((exitCode != 0) ?
SyncResult(SyncResult::Error)
: SyncResult(SyncResult::Success));
}
void UnisonFolder::slotReadyReadStandardOutput()
{
QTextStream stream(&_lastOutput);
stream << _unison->readAllStandardOutput();;
}
void UnisonFolder::slotReadyReadStandardError()
{
QTextStream stream(&_lastOutput);
stream << _unison->readAllStandardError();;
}
void UnisonFolder::slotStateChanged(QProcess::ProcessState state)
{
//qDebug() << "changed: " << state;
}
void UnisonFolder::slotError(QProcess::ProcessError error)
{
//qDebug() << "error: " << error;
}
} // ns

View File

@@ -1,62 +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_UNISONFOLDER_H
#define MIRALL_UNISONFOLDER_H
#include <QMutex>
#include <QProcess>
#include <QStringList>
#include "mirall/folder.h"
class QProcess;
namespace Mirall {
class UnisonFolder : public Folder
{
Q_OBJECT
public:
UnisonFolder(const QString &alias,
const QString &path,
const QString &secondPath, QObject *parent = 0L);
virtual ~UnisonFolder();
virtual void startSync(const QStringList &pathList);
virtual bool isBusy() const;
public slots:
void slotTerminateSync();
protected slots:
void slotReadyReadStandardOutput();
void slotReadyReadStandardError();
void slotStateChanged(QProcess::ProcessState);
void slotFinished(int exitCode, QProcess::ExitStatus exitStatus);
void slotStarted();
void slotError(QProcess::ProcessError);
private:
QMutex _syncMutex;
QProcess *_unison;
int _syncCount;
QString _lastOutput;
};
}
#endif

View File

@@ -15,7 +15,9 @@
#include "mirall/updatedetector.h"
#include "mirall/theme.h"
#include "mirall/version.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/occinfo.h"
#include "mirall/utility.h"
#include <QtCore>
#include <QtNetwork>
@@ -55,9 +57,24 @@ void UpdateDetector::versionCheck( Theme *theme )
}
url.addQueryItem( QLatin1String("version"), ver );
url.addQueryItem( QLatin1String("platform"), platform );
url.addQueryItem( QLatin1String("oem"), theme->appName());
url.addQueryItem( QLatin1String("oem"), theme->appName() );
_accessManager->get( QNetworkRequest( url ));
QNetworkRequest req( url );
req.setRawHeader( QByteArray("Host"), url.host().toUtf8() );
req.setRawHeader( QByteArray("User-Agent"), Utility::userAgentString() );
_accessManager->get( req );
}
void UpdateDetector::slotOpenUpdateUrl()
{
QDesktopServices::openUrl(ocClient.web());
}
void UpdateDetector::slotSetVersionSeen()
{
MirallConfigFile cfg;
cfg.setSeenVersion(ocClient.version());
}
QString UpdateDetector::getSystemInfo()
@@ -76,6 +93,57 @@ QString UpdateDetector::getSystemInfo()
#endif
}
void UpdateDetector::showDialog()
{
// if the version tag is set, there is a newer version.
QString ver = QString::fromLatin1("%1.%2.%3")
.arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
QDialog *msgBox = new QDialog;
QIcon info = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0);
int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0);
msgBox->setWindowIcon(info);
QVBoxLayout *layout = new QVBoxLayout(msgBox);
QHBoxLayout *hlayout = new QHBoxLayout;
layout->addLayout(hlayout);
msgBox->setWindowTitle(tr("New Version Available"));
QLabel *ico = new QLabel;
ico->setFixedSize(iconSize, iconSize);
ico->setPixmap(info.pixmap(iconSize));
QLabel *lbl = new QLabel;
QString txt = tr("<p>A new version of the %1 Client is available.</p>"
"<p><b>%2</b> is available for download. The installed version is %3.<p>")
.arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring()).arg(ver);
lbl->setText(txt);
lbl->setTextFormat(Qt::RichText);
lbl->setWordWrap(true);
hlayout->addWidget(ico);
hlayout->addWidget(lbl);
QDialogButtonBox *bb = new QDialogButtonBox;
QPushButton *skip = bb->addButton(tr("Skip update"), QDialogButtonBox::ResetRole);
QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole);
QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole);
connect(skip, SIGNAL(clicked()), msgBox, SLOT(reject()));
connect(reject, SIGNAL(clicked()), msgBox, SLOT(reject()));
connect(getupdate, SIGNAL(clicked()), msgBox, SLOT(accept()));
connect(skip, SIGNAL(clicked()), SLOT(slotSetVersionSeen()));
connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl()));
layout->addWidget(bb);
msgBox->open();
msgBox->resize(400, msgBox->sizeHint().height());
}
void UpdateDetector::slotVersionInfoArrived( QNetworkReply* reply )
{
if( reply->error() != QNetworkReply::NoError ) {
@@ -83,10 +151,10 @@ void UpdateDetector::slotVersionInfoArrived( QNetworkReply* reply )
return;
}
QString xml = QString::fromAscii( reply->readAll() );
QString xml = QString::fromUtf8(reply->readAll());
bool ok;
Owncloudclient ocClient = Owncloudclient::parseString( xml, &ok );
ocClient = Owncloudclient::parseString( xml, &ok );
if( ok ) {
// Thats how it looks like if a new version is available:
@@ -104,24 +172,11 @@ void UpdateDetector::slotVersionInfoArrived( QNetworkReply* reply )
// <versionstring></versionstring>
// <web></web>
// </owncloudclient>
if( ocClient.version().isEmpty() ) {
MirallConfigFile cfg;
if( ocClient.version().isEmpty() || ocClient.version() == cfg.seenVersion() ) {
qDebug() << "Client is on latest version!";
} else {
// if the version tag is set, there is a newer version.
QString ver = QString::fromLatin1("%1.%2.%3")
.arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO);
QMessageBox msgBox;
msgBox.setTextFormat( Qt::RichText );
msgBox.setWindowTitle(tr("Client Version Check"));
msgBox.setIcon( QMessageBox::Information );
msgBox.setText(tr("<p>A new version of the %1 client is available.").arg(Theme::instance()->appNameGUI()));
QString txt = tr("%1 is available. The installed version is %3.<p/><p>For more information see <a href=\"%2\">%2</a></p>")
.arg(ocClient.versionstring()).arg(ocClient.web()).arg(ver);
msgBox.setInformativeText( txt );
msgBox.setStandardButtons( QMessageBox::Ok );
msgBox.setDefaultButton( QMessageBox::Ok );
msgBox.exec();
showDialog();
}
} else {
qDebug() << "Could not parse update information.";

View File

@@ -17,6 +17,8 @@
#include <QObject>
#include "mirall/occinfo.h"
class QNetworkAccessManager;
class QNetworkReply;
@@ -35,13 +37,17 @@ signals:
public slots:
protected slots:
private slots:
void slotOpenUpdateUrl();
void slotSetVersionSeen();
void slotVersionInfoArrived( QNetworkReply* );
private:
QString getSystemInfo();
void showDialog();
QNetworkAccessManager *_accessManager;
Owncloudclient ocClient;
};
}

View File

@@ -12,6 +12,23 @@
*/
#include "utility.h"
#include "mirall/version.h"
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QUrl>
#include <QDebug>
#ifdef Q_OS_MAC
#include <CoreServices/CoreServices.h>
#endif
#ifdef Q_OS_WIN
#include <shlobj.h>
#endif
namespace Mirall {
QString Utility::formatFingerprint( const QByteArray& fmhash )
@@ -30,4 +47,82 @@ QString Utility::formatFingerprint( const QByteArray& fmhash )
return fp;
}
void Utility::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"/"Favorites" on the left sidebar
CFStringRef folderCFStr = CFStringCreateWithCString(0, folder.toUtf8().data(), kCFStringEncodingUTF8);
CFURLRef urlRef = CFURLCreateWithFileSystemPath (0, folderCFStr, kCFURLPOSIXPathStyle, true);
LSSharedFileListRef placesItems = LSSharedFileListCreate(0, kLSSharedFileListFavoriteItems, 0);
if (placesItems) {
//Insert an item to the list.
LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(placesItems,
kLSSharedFileListItemLast, 0, 0,
urlRef, 0, 0);
if (item)
CFRelease(item);
}
CFRelease(placesItems);
CFRelease(folderCFStr);
CFRelease(urlRef);
#elif defined (Q_OS_UNIX)
// Nautilus: add to ~/.gtk-bookmarks
QFile gtkBookmarks(QDir::homePath()+QLatin1String("/.gtk-bookmarks"));
QByteArray folderUrl = "file://" + folder.toUtf8();
if (gtkBookmarks.open(QFile::ReadWrite)) {
QByteArray places = gtkBookmarks.readAll();
if (!places.contains(folderUrl)) {
places += folderUrl;
gtkBookmarks.reset();
gtkBookmarks.write(places + '\n');
}
}
#endif
}
// Qtified version of get_platforms() in csync_owncloud.c
QString Utility::platform()
{
#if defined(Q_OS_WIN32)
return QLatin1String("Windows");
#elif defined(Q_OS_MAC)
return QLatin1String("Macintosh");
#elif defined(Q_OS_LINUX)
return QLatin1String("Linux");
#elif defined(__DragonFly__) // Q_OS_FREEBSD also defined
return "DragonFlyBSD";
#elif defined(Q_OS_FREEBSD)
return QLatin1String("FreeBSD");
#elif defined(Q_OS_NETBSD)
return QLatin1String("NetBSD");
#elif defined(Q_OS_OPENBSD)
return QLatin1String("OpenBSD");
#elif defined(Q_OS_SOLARIS)
return "Solaris";
#else
return "Unknown OS"
#endif
}
QByteArray Utility::userAgentString()
{
return QString::fromLatin1("Mozilla/5.0 (%1) mirall/%2")
.arg(Utility::platform())
.arg(QLatin1String(MIRALL_STRINGIFY(MIRALL_VERSION)))
.toLatin1();
}
} // namespace Mirall

View File

@@ -24,6 +24,9 @@ class Utility
{
public:
static QString formatFingerprint( const QByteArray& );
static void setupFavLink( const QString &folder );
static QString platform();
static QByteArray userAgentString();
};
}

View File

@@ -22,12 +22,15 @@ Thumbs.db
*_conflict-*
.Temporary Items
.TemporaryItems
.Trashes
.Document Revisions-V100
.DocumentRevisions-V100
.fseventd
.apdisk
.htaccess
Icon\r*
~$*
.~lock.*

View File

@@ -0,0 +1,16 @@
######################################################################
# Automatically generated by qmake (2.01a) Do. Mär 21 15:22:28 2013
######################################################################
TEMPLATE = app
CONFIG -= app_bundle
DEPENDPATH += .
INCLUDEPATH += .
macx {
LIBS += -framework CoreFoundation -framework CoreServices
}
# Input
HEADERS += ../../../src/mirall/utility.h
SOURCES += main.cpp ../../../src/mirall/utility.cpp

View File

@@ -0,0 +1,10 @@
#include "../../../src/mirall/utility.h"
#include <QDir>
int main(int argc, char* argv[])
{
QString dir="/tmp/linktest/";
QDir().mkpath(dir);
Mirall::Utility::setupFavLink(dir);
}

View File

@@ -15,7 +15,6 @@
<file>theme/white/state-ok-32.png</file>
<file>theme/white/state-offline-32.png</file>
<file>theme/white/state-error-32.png</file>
<file>theme/colored/state-sync-64.png</file>
<file>theme/colored/state-pause-64.png</file>
<file>theme/colored/state-ok-64.png</file>
@@ -31,13 +30,12 @@
<file>theme/white/state-ok-64.png</file>
<file>theme/white/state-offline-64.png</file>
<file>theme/white/state-error-64.png</file>
<file>theme/colored/owncloud-icon-22.png</file>
<file>theme/colored/owncloud-icon-32.png</file>
<file>theme/colored/owncloud-icon-48.png</file>
<file>theme/colored/owncloud-icon-64.png</file>
<file>theme/colored/owncloud-icon-128.png</file>
<file>theme/colored/owncloud-framed-64.png</file>
<file>theme/colored/wizard_logo.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More