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

Compare commits

..

479 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
Daniel Molkentin
bcb9491f6a RC1 -> final 2013-02-26 11:32:32 +01:00
Klaas Freitag
9d2c3ebad3 Move config.h out of header files. 2013-02-25 09:54:19 +01:00
Daniel Molkentin
ad063b0634 Make chinese translations work on OS X
... by mapping chinese script codes to country
 codes as used by Qt and Transifex.
2013-02-24 15:44:38 +01:00
Daniel Molkentin
8765538458 Be more permission when loading languages
Accept languages when they only exist for mirall,
but not for Qt and QtKeychain (Fixes #359). This
is more permissive than before, but while fixing
#359, it became evident that supporting "partial"
translations might actually be beneficial.
2013-02-24 15:44:38 +01:00
Jenkins for ownCloud
dd4aa14a8c [tx-robot] updated from transifex 2013-02-23 00:06:50 +01:00
Jenkins for ownCloud
99814539eb [tx-robot] updated from transifex 2013-02-22 00:10:10 +01:00
Daniel Molkentin
dbec98ff48 Manual update of avail translations 2013-02-21 18:35:33 +03:00
Daniel Molkentin
e2e14f2184 Do not install docs on OS X 2013-02-21 15:26:31 +01:00
Daniel Molkentin
e85291c4ba en language is implied 2013-02-21 15:17:13 +01:00
Klaas Freitag
58a5405343 Dont do the doc build step on every build. 2013-02-21 14:01:16 +01:00
Klaas Freitag
4ba85311da Handle all cases in switches. 2013-02-21 13:36:51 +01:00
Daniel Molkentin
3cf7003101 Load UI languages instead of locales where possible
Load Qt translations consistently along the way.
This only has been verified on mac and needs adoption
for win32.
2013-02-21 13:19:54 +01:00
Klaas Freitag
ae558a5889 Add a appNameGUI method to the theming. 2013-02-21 12:21:42 +01:00
Jenkins for ownCloud
0b0b762c6c [tx-robot] updated from transifex 2013-02-21 00:13:24 +01:00
Klaas Freitag
55a4fd752d Fix commit fd83bf - add treewalk success check. 2013-02-20 17:26:07 +01:00
Klaas Freitag
136b699106 Make sure to restart sync after folder add. 2013-02-20 16:06:46 +01:00
Klaas Freitag
fd83bf2089 Remove unused variable doTreeWalk. 2013-02-20 10:06:45 +01:00
Jenkins for ownCloud
75f075feb0 [tx-robot] updated from transifex 2013-02-20 00:04:39 +01:00
Klaas Freitag
817039ddf3 Simplify and fix startup: Steer starting of sync from folderman. 2013-02-19 17:24:10 +01:00
Klaas Freitag
6d6deaf6c4 Setup folders added after setup wizard ended. 2013-02-19 12:04:36 +01:00
Klaas Freitag
9c63b89bac Removed useless warning. 2013-02-19 09:34:33 +01:00
Jenkins for ownCloud
2a6e084219 [tx-robot] updated from transifex 2013-02-19 00:08:08 +01:00
Klaas Freitag
ec120cd64c Make folderman load folders at start and update later. 2013-02-18 18:31:29 +02:00
Klaas Freitag
a9173b1aa1 Add setters for update check and max log lines 2013-02-18 17:17:03 +02:00
Klaas Freitag
89f7f75af2 If a new server is configured, take the proxy config to the new config
file.
2013-02-18 17:16:10 +02:00
Daniel Molkentin
8809ac0c4a remove unused connect 2013-02-18 14:56:50 +01:00
Daniel Molkentin
7a03164a9a Handle server offline state on application start gracefully 2013-02-18 14:56:50 +01:00
Jenkins for ownCloud
406254cd04 [tx-robot] updated from transifex 2013-02-18 00:07:57 +01:00
Jenkins for ownCloud
f01eeed9d0 [tx-robot] updated from transifex 2013-02-17 00:27:55 +01:00
Jenkins for ownCloud
5b6439e29d [tx-robot] updated from transifex 2013-02-16 00:07:02 +01:00
Daniel Molkentin
38954c2193 Remove obsolete signal. 2013-02-15 19:29:38 +01:00
Daniel Molkentin
5954fb280c Centralize error handling for csync steps
...as a preparation for offline handling.
As a side-effect, removed the last instance
of goto in mirall.
2013-02-15 19:29:27 +01:00
Daniel Molkentin
8e63652fb3 Send OEM string to update detector. 2013-02-15 18:39:25 +01:00
Jenkins for ownCloud
365dfd5380 [tx-robot] updated from transifex 2013-02-15 00:08:10 +01:00
Daniel Molkentin
1c70fb3ba4 Set csync config dir in mirall properly
Otherwise canceling the sync cannot remove the lock file
2013-02-14 17:36:11 +01:00
Daniel Molkentin
e5af8e87b3 Fix crash when pausing mirall. 2013-02-14 17:36:11 +01:00
Daniel Molkentin
bfbec24f43 Add more debug in case inotify fails
We should probably make this at least a visible error, because it's a
limitation set by the kernel/the distro and we would require root
permissions to adjust the value.

Right now all that happens is that syncing is not immediate, but only
run every 30 secs (due to server polling).
2013-02-14 17:36:11 +01:00
Daniel Molkentin
8dd97a358a Introduce SyncPrepare state
SyncPrepare is when the folder class prepares the actual syncing,
i.e. does treewalks and runs the reconceiler in case of mirall. The actual
SyncRunning state will only be entered if there is actually anything to
sync.

Fixes #289
2013-02-14 17:36:11 +01:00
Daniel Molkentin
7290afc6fe Minimize Sync notification notification
Notifies only in the end of a complete sync run now

Migitates/fixes #314
2013-02-14 17:36:11 +01:00
Daniel Molkentin
2ba20369ea Remove unused gitfolder class for now 2013-02-14 17:36:11 +01:00
Daniel Molkentin
804aef6548 Remove stray code 2013-02-14 17:36:11 +01:00
Daniel Molkentin
85f49b6af4 Fix guard position 2013-02-14 17:36:11 +01:00
Daniel Molkentin
68afc6011d proxy dialog: no extra heading 2013-02-14 17:36:11 +01:00
Daniel Molkentin
524ffcd0e1 owncloud setup: Fix label style 2013-02-14 17:36:11 +01:00
Jenkins for ownCloud
a7303205b4 [tx-robot] updated from transifex 2013-02-14 00:08:08 +01:00
Jenkins for ownCloud
8a06b2d136 [tx-robot] updated from transifex 2013-02-13 00:06:54 +01:00
Daniel Molkentin
7ba8a55fa5 Merge pull request #313 from hefee/doc2default
creating doc to default target
2013-02-12 11:48:00 -08:00
Daniel Molkentin
ee7dc8e1c5 Merge pull request #312 from hefee/master
usefull manpages for owncloud and mirall
2013-02-12 11:47:41 -08:00
Jenkins for ownCloud
3556f90d68 [tx-robot] updated from transifex 2013-02-12 00:20:28 +01:00
Klaas Freitag
6d984b505d Handle not stored password correctly. 2013-02-11 14:21:53 +01:00
Klaas Freitag
8d9336f9f4 Removed obsolete scheduler start. 2013-02-11 14:21:21 +01:00
Klaas Freitag
2b5e694181 Set default argument to method. 2013-02-11 14:20:32 +01:00
Klaas Freitag
aa983e4966 Make user password dialog real async working. 2013-02-11 14:18:45 +01:00
Klaas Freitag
424b3a9dfc cleanup comments and dupes. 2013-02-11 14:18:16 +01:00
Jenkins for ownCloud
5a3bc7af9a [tx-robot] updated from transifex 2013-02-11 00:05:57 +01:00
Klaas Freitag
4501ec10dc Make sure that journals are wiped if server changes + some utility
functions.
2013-02-10 20:04:03 +01:00
Klaas Freitag
699ae176df Revert "Allow setting of custom poll interval through status.php"
This reverts commit 39a89e8fc7.

Conflicts:
	src/mirall/folderman.cpp
	src/mirall/folderman.h
2013-02-10 14:57:57 +01:00
Klaas Freitag
9297b3b850 Add chrome download file to exclude list 2013-02-10 14:48:17 +01:00
Klaas Freitag
cac5f81388 Clear pending network requests in setup wizard on back. 2013-02-10 14:03:09 +01:00
Klaas Freitag
28af8068e9 Always return QNetworkReply* on mkdir and also on checkInstall. 2013-02-10 14:01:38 +01:00
Sebastian Kügler
a1d64af7b1 API additions for the Plasma client
This patch contains a few (source-compatible) API additions needed for
the Plasma client.

* return QNetworkReply* to caller for tracking status and error of
  requests such as mkdir, getWebDAVPath and getRequest
* Add a setter for the QNetworkAccessManager. This allows us to route at
  least some of the network requests through KIO in the Plasma client
* Add a setter for the remotePollInterval. This should be enough API to
* make it possible to adapt the polling interval to the client's machine
  state, e.g. sync less often on battery, or somesuch
2013-02-10 13:10:53 +01:00
dragotin
edbb79b79c Merge pull request #5 from sebasje/mkdirreply
Return QNetworkReply from remote mkdir
2013-02-10 02:34:36 -08:00
dragotin
a000a7b52e Merge pull request #4 from sebasje/requestreply
Return QNetworkReply from getRequests
2013-02-10 02:34:14 -08:00
Klaas Freitag
0a427541d6 Added config file setter for poll interval. Thx for pull request. 2013-02-10 11:27:21 +01:00
Klaas Freitag
1c297c56a2 Stop authentication tries already after the first attempt without
success.
2013-02-10 11:02:39 +01:00
Klaas Freitag
6f9bbc431d Properly stop syncing when connection manager opens. 2013-02-10 11:02:39 +01:00
Klaas Freitag
f62626e3eb Delete existing folders properly before adding new ones. 2013-02-10 11:02:38 +01:00
Jenkins for ownCloud
28fcd75494 [tx-robot] updated from transifex 2013-02-10 00:11:52 +01:00
Klaas Freitag
39a89e8fc7 Allow setting of custom poll interval through status.php 2013-02-09 14:04:04 +01:00
Klaas Freitag
38a8096732 Fixed sorting of header entries, ie. public / protected / private. 2013-02-09 14:03:05 +01:00
Klaas Freitag
d358c839ce Fixed typos. 2013-02-09 12:46:08 +01:00
hefee
17901e7bc7 fixing typo in mirall.1.rst 2013-02-09 12:28:43 +01:00
hefee
0ea16c04cc moving description of config file and client optinos to own files.
* split usage to three files: usage, conffile, options
* fixing minor typos in mirall.1.rst and owncloud1.rst
* owncloud.1 uses include conffile, options
* mirall.1 uses include conffile, options
* Fixes: #183
2013-02-09 12:23:32 +01:00
Klaas Freitag
f1e0cd1c9c Cleaned up used icons. 2013-02-09 10:32:29 +01:00
hefee
e1f404a011 adding maclocation 2013-02-09 10:30:56 +01:00
hefee
69715d2182 merging from owncloud/master 2013-02-09 10:16:38 +01:00
hefee
0285213140 removing asciidoc, now creating manpages via sphinx again 2013-02-09 10:10:23 +01:00
hefee
1a907f23f0 moving generation of manpages to sphinx
--HG--
rename : doc/mirall.1.txt => doc/mirall.1.rst
rename : doc/owncloud.1.txt => doc/owncloud.1.rst
2013-02-09 10:05:45 +01:00
Jenkins for ownCloud
1296be71ed [tx-robot] updated from transifex 2013-02-09 00:15:51 +01:00
hefee
0ebcdbbb3f no more different cmake parameter is needed 2013-02-08 18:57:25 +01:00
dragotin
891ced0fca Merge pull request #318 from LukeOwncloud/patch-1
Update doc/usage.rst
2013-02-08 09:45:30 -08:00
dragotin
6276bb3873 Merge pull request #322 from hefee/soname
adding soname version to libowncloudsync and libmirallsync
2013-02-08 09:42:32 -08:00
Klaas Freitag
dbb0cbaff8 Removed build of obsolete mirallsync lib which is equal to owncloudsync. 2013-02-08 19:18:36 +01:00
Sandro Knauß
cfa777260c removing version for mirallsync (it is'nt build anymore :) 2013-02-08 18:37:29 +01:00
Sandro Knauß
66fc273db6 merging with default 2013-02-08 18:36:26 +01:00
hefee
9c9e377cf4 adding soname version to libowncloudsync and libmirallsync 2013-02-08 18:21:59 +01:00
Jenkins for ownCloud
f75eb24bfe [tx-robot] updated from transifex 2013-02-08 00:14:28 +01:00
LukeOwncloud
a617a04295 Update doc/usage.rst 2013-02-07 08:50:49 +01:00
Jenkins for ownCloud
dc16f277ce [tx-robot] updated from transifex 2013-02-07 00:12:34 +01:00
Klaas Freitag
07258deaaf Fix build for mirall target. 2013-02-06 15:05:34 +01:00
Klaas Freitag
7b53e0f953 Fix return from non void function. 2013-02-06 14:58:31 +01:00
Klaas Freitag
2ac764bd1a Fix compile without OWNCLOUD_CLIENT define, thx Jenkins 2013-02-06 11:58:14 +02:00
Klaas Freitag
82d2851a6b Set username in connection dialog if there. 2013-02-06 11:42:36 +02:00
Klaas Freitag
7a3be71452 The user name is not really to be protected. 2013-02-06 11:41:47 +02:00
Klaas Freitag
977a513ee5 Always set the connect result to en/disable the Finish button. 2013-02-06 11:21:50 +02:00
Klaas Freitag
22cbebb7a7 Fix build on debian with ancient Qt, thanks Mr. Jenkins for notifying. 2013-02-06 10:41:25 +02:00
Klaas Freitag
72b2e6778a Use new ownCloudInfo / CredentialStore interface. 2013-02-06 10:09:02 +02:00
Klaas Freitag
08babbf38d Set credentials in ownCloudInfo after these have been fetched. 2013-02-06 10:09:02 +02:00
Klaas Freitag
2ae5ae6962 Change interface to not support customHandles. 2013-02-06 10:09:02 +02:00
Klaas Freitag
fa6331a40a Removed use of CredentialStore from class and added setter for
credentials.

This makes handling of temporar credentials for the setup dialog easier
and streamlines the code.
2013-02-06 10:09:02 +02:00
Klaas Freitag
cece465947 Link libdl explicitely. 2013-02-06 10:09:02 +02:00
Jenkins for ownCloud
3f97047abc [tx-robot] updated from transifex 2013-02-06 00:07:36 +01:00
Daniel Molkentin
b6d5213880 Add suffix, to be added with -DVERSION_SUFFIX=... 2013-02-05 15:42:53 +01:00
Daniel Molkentin
0bcb65db29 Do not allow to press Finished if connection to the server fails
This does not yet consider cases where the connection
succeeds but webdav fails.
2013-02-05 15:40:59 +01:00
Klaas Freitag
7734656ae3 Make mirall packager for win bundle the new openSSL dlls. 2013-02-05 14:37:39 +01:00
Klaas Freitag
c14e17e271 Set to version 1.2.1pre 2013-02-05 14:37:39 +01:00
hefee
1f4ea2c60e only add instalation dir if we are creating doc 2013-02-04 18:31:48 +01:00
hefee
edb4ff6b98 adding doc to default if CREATEDOC is set 2013-02-04 18:10:51 +01:00
Sandro Knauß
279bb47ab4 add creating manpages to CMakeLists 2013-02-04 17:36:56 +01:00
Sandro Knauß
7ef92748ea adding manpages for mirall and owncloud 2013-02-04 16:56:39 +01:00
Sandro Knauß
0e6e614318 adding --monoicons option to usage.rst 2013-02-04 16:55:50 +01:00
Jenkins for ownCloud
a5b6c3add7 [tx-robot] updated from transifex 2013-02-04 00:07:05 +01:00
Daniel Molkentin
fd30d8b0d1 Typo 2013-02-03 13:39:34 +01:00
Daniel Molkentin
5944acf8a6 Hack: Do not leak FDs when neon is built with gnutls (Linux)
Previously, this would cause Mirall to crash sooner or later.

Fixes #154
2013-02-03 13:37:03 +01:00
Jenkins for ownCloud
58ace7c774 [tx-robot] updated from transifex 2013-02-02 00:09:05 +01:00
Jenkins for ownCloud
a07444412b [tx-robot] updated from transifex 2013-02-01 00:20:42 +01:00
mjkent
339f59a4e8 Merge pull request #284 from mjkent/854852959c95935efd8902f05d9935b04bb9f04c
Improve command line argument handling
2013-01-31 15:00:37 -08:00
Jenkins for ownCloud
4beb9b3efc [tx-robot] updated from transifex 2013-01-31 00:33:28 +01:00
Daniel Molkentin
a04cf32a69 No need to ship ocsync.conf 2013-01-30 09:48:45 +01:00
Jenkins for ownCloud
746c0359d2 [tx-robot] updated from transifex 2013-01-30 00:27:40 +01:00
Michael Kent
854852959c Changes to handling of command line options. Fix a segmentation fault with owncloud --help. Add -h as help short. If a commandline argument isn't recognized, print that it isn't recognized, print help, and abort. 2013-01-28 22:19:14 -06:00
Daniel Molkentin
1e1751e451 sign_dmg.sh: increase wait time for dmg mount 2013-01-28 21:04:43 +01:00
Jenkins for ownCloud
7cd0179adc [tx-robot] updated from transifex 2013-01-28 00:06:52 +01:00
Jenkins for ownCloud
c0543cdbaf [tx-robot] updated from transifex 2013-01-27 00:07:31 +01:00
Daniel Molkentin
d681066dc2 Results bubble: _localPrefix might not end in a separator 2013-01-26 20:47:20 +01:00
Jenkins for ownCloud
b81939bff5 [tx-robot] updated from transifex 2013-01-26 00:11:18 +01:00
Daniel Molkentin
f8685c97f1 CPack: more parameterization 2013-01-25 15:59:13 +01:00
Daniel Molkentin
11e06c33db Fix compilation on win/mac 2013-01-25 15:46:23 +01:00
Daniel Molkentin
c0f2f5bcaa Load Qt translations from app dir/bundle, too 2013-01-25 15:41:18 +01:00
Daniel Molkentin
bfee6402a6 Simplify NSIS template 2013-01-25 12:56:00 +01:00
Klaas Freitag
4fac62560e Removed remove of list of configured sync folder on reconfiguration.
The removal of the configured folders was needed as long as the
csync journal was based in on the folder name of the sync folder.
Now that every folder has its own sync journal its not longer needed.
2013-01-25 11:33:00 +01:00
Jenkins for ownCloud
d780055b0e [tx-robot] updated from transifex 2013-01-25 00:07:05 +01:00
Jenkins for ownCloud
3f5c53425b [tx-robot] updated from transifex 2013-01-24 00:08:40 +01:00
Jenkins for ownCloud
08f90ce3a6 [tx-robot] updated from transifex 2013-01-23 16:25:33 +01:00
Jenkins for ownCloud
6ee70a852a [tx-robot] updated from transifex 2013-01-23 16:06:47 +01:00
Klaas Freitag
4908dbdee8 Updated Changelog for the 1.2.0 release. 2013-01-23 16:04:29 +01:00
Jenkins for ownCloud
a6573c21e7 [tx-robot] updated from transifex 2013-01-23 15:30:18 +01:00
Daniel Molkentin
aca965f111 Fix favlink generation on windows 2013-01-23 17:22:38 +03:00
Klaas Freitag
01a8ab7bf0 Set version to final version 1.2.0 2013-01-23 15:19:26 +01:00
Daniel Molkentin
5dbd987df3 Mirall != owncloud client. Move about dialog to theme. 2013-01-23 13:45:50 +01:00
Daniel Molkentin
e37fc8c6e5 tr: Don't hardcode app name in string 2013-01-23 13:45:50 +01:00
Klaas Freitag
7614776e10 Fixed isComplete() for credential setup dialog. 2013-01-23 10:57:45 +01:00
Klaas Freitag
4ea4c70443 Minor: Fixed a typo. 2013-01-23 10:57:45 +01:00
Jenkins for ownCloud
ec1946a9ff [tx-robot] updated from transifex 2013-01-23 00:07:29 +01:00
Daniel Molkentin
e0332deffc SSL: Use better test.
The other one was not working anyway.
2013-01-22 15:29:14 +01:00
Daniel Molkentin
afe6caf406 Remove stray object 2013-01-22 15:29:14 +01:00
Klaas Freitag
1385aab65d Changed FindCSync module to not check relative pathes + docu. 2013-01-22 15:08:56 +01:00
Klaas Freitag
862a9d938c Handle missed case in switch statement. 2013-01-22 15:08:04 +01:00
Klaas Freitag
80108727c4 Linux: Work around keychain shortcoming if chain does not contain
a password entry.
2013-01-22 12:08:56 +01:00
Klaas Freitag
84e3d6278d Check for empty user in keychain key. 2013-01-21 18:36:03 +01:00
Klaas Freitag
a1bf324f47 normilize url before writing, error checks. 2013-01-21 16:33:52 +01:00
Klaas Freitag
1b8f7059e3 Fix pre initialization of _state in fetchCredentials(). 2013-01-21 15:23:44 +01:00
Daniel Molkentin
b9fe6f2aed bump version (pre-beta3) 2013-01-21 13:35:42 +01:00
Daniel Molkentin
7794480da0 csync: Put up the QNAM key chain for comparison
Comparing with the CA certs will not help with
intermediates, and other cases.
2013-01-21 13:33:33 +01:00
Daniel Molkentin
0171b8b998 Make hash formatting static
no need for class instanciation.
2013-01-21 13:33:33 +01:00
Klaas Freitag
915764cc52 If credentials are ok, do not fetch them again from store. 2013-01-21 13:32:52 +01:00
Klaas Freitag
381aa701ce Add a another default Category to make desktop file check happy. 2013-01-21 11:43:40 +01:00
Klaas Freitag
76653fcedb Minor: removed bogus stuff. 2013-01-21 11:43:39 +01:00
Jenkins for ownCloud
dd0cfec225 [tx-robot] updated from transifex 2013-01-21 00:06:38 +01:00
Jenkins for ownCloud
67b64e0816 [tx-robot] updated from transifex 2013-01-20 00:07:44 +01:00
Jenkins for ownCloud
7552f5e5da [tx-robot] updated from transifex 2013-01-19 00:06:40 +01:00
Daniel Molkentin
9af862b455 Fix make install, clean up 2013-01-18 22:15:08 +01:00
Jenkins for ownCloud
f26f7646ba [tx-robot] updated from transifex 2013-01-18 00:05:58 +01:00
Daniel Molkentin
0f36dc03c4 FileItemDialog: Add copy to clipboard functionality 2013-01-17 10:35:08 +01:00
Jenkins for ownCloud
36b385ed54 [tx-robot] updated from transifex 2013-01-17 00:29:16 +01:00
Daniel Molkentin
5e3f2cf25a Remove legacy configuration options.
They were not used anyway.
2013-01-16 18:03:40 +01:00
Daniel Molkentin
8b0cfab2b2 Ignore Mac OS custom folder icons 2013-01-16 17:51:25 +01:00
Daniel Molkentin
f678629734 Fix proxy auth
- The port was not set correctly
- The password was read base64 encoded, but not read stored as such
2013-01-16 17:50:26 +01:00
Daniel Molkentin
635cb4dc7c NSIS: Remove GnuTLS remainders 2013-01-16 14:41:12 +01:00
Daniel Molkentin
87df74e4d0 Fix: pause icon not visible 2013-01-16 14:41:12 +01:00
Daniel Molkentin
45c82a2746 Go offline when server is in maintenance. 2013-01-16 14:41:12 +01:00
Jenkins for ownCloud
d3c55c2b7c [tx-robot] updated from transifex 2013-01-16 00:22:56 +01:00
Klaas Freitag
bc3938daa7 A new sync file protocol dialog. 2013-01-15 20:42:09 +01:00
Jenkins for ownCloud
4d4b509ac3 [tx-robot] updated from transifex 2013-01-15 00:06:13 +01:00
Lukas Reschke
304b484529 Typo 2013-01-14 16:40:01 +01:00
Daniel Molkentin
7025d612c1 Fix c&p error 2013-01-14 16:28:07 +01:00
Daniel Molkentin
2eb9406611 add CONTRIBUTING.md and reporting template for mirall 2013-01-14 12:33:49 +01:00
Klaas Freitag
07034daffe Take valid caList from QSslSocket::defaultCA. 2013-01-14 12:13:51 +01:00
Klaas Freitag
dca8ecb929 Remove bogus spaces. 2013-01-14 12:13:50 +01:00
Klaas Freitag
dd2eecec42 Remove bogus reset after creds were written. 2013-01-14 12:13:50 +01:00
Klaas Freitag
72ba4213d5 Push to beta version 2. 2013-01-14 12:13:50 +01:00
Klaas Freitag
11dbacab60 Exclude desktop file handling for windows platform. 2013-01-14 12:13:50 +01:00
Sebastian Meßmer
4caca2ce1a The configuration directory is a static attribute in mirallconfigfile class 2013-01-14 00:48:26 +01:00
Jenkins for ownCloud
90e39e34e9 [tx-robot] updated from transifex 2013-01-14 00:19:22 +01:00
Jenkins for ownCloud
9a7171068d [tx-robot] updated from transifex 2013-01-13 00:09:52 +01:00
Jenkins for ownCloud
bb2a3590ad [tx-robot] updated from transifex 2013-01-12 00:12:20 +01:00
Daniel Molkentin
280dd205d9 setup wizard: Improve wording and context 2013-01-11 17:10:31 +01:00
Jenkins for ownCloud
2a722644b2 [tx-robot] updated from transifex 2013-01-11 00:07:26 +01:00
Daniel Molkentin
de69bb9448 build fix 2013-01-10 17:24:06 +01:00
Daniel Molkentin
5c495265f4 Consolidate theming support.
This implements out-of-repository-theming, and removes the old
custom.ini theming that never worked on all platforms and had
no straight deployment story.

The new approach requires the CMAKE variable OEM_THEME_DIR to
point to a directory that must at least contain an OEM.cmake file
(check OWNCLOUD.cmake for possible options) as well as a themes.qrc
and a themes/ directory that directly correspond to the ones in
the source tree.
2013-01-10 17:16:59 +01:00
Daniel Molkentin
9cdf2d8150 Remove potentially dangerous processEvent calls 2013-01-10 17:16:58 +01:00
Jenkins for ownCloud
6af1a52305 [tx-robot] updated from transifex 2013-01-10 00:06:57 +01:00
Klaas Freitag
703002bafa Set path to neon-config file in cmake toolchain file. 2013-01-09 15:08:25 +01:00
Jenkins for ownCloud
8104e4bde9 [tx-robot] updated from transifex 2013-01-08 00:33:20 +01:00
Jenkins for ownCloud
763dbfc397 [tx-robot] updated from transifex 2013-01-04 13:26:11 +01:00
Sebastian Meßmer
e0645b4b63 Allow setting the configuration directory on command line 2013-01-02 19:08:14 +01:00
Jenkins for ownCloud
f714759ec7 [tx-robot] updated from transifex 2013-01-02 00:06:16 +01:00
Jenkins for ownCloud
8168e9cca1 [tx-robot] updated from transifex 2012-12-31 00:06:30 +01:00
Jenkins for ownCloud
be470b71ea [tx-robot] updated from transifex 2012-12-30 00:06:49 +01:00
Jenkins for ownCloud
216f39e9bc [tx-robot] updated from transifex 2012-12-29 00:09:42 +01:00
Jenkins for ownCloud
486c4481d8 [tx-robot] updated from transifex 2012-12-28 00:21:26 +01:00
Jenkins for ownCloud
6a154c139f [tx-robot] updated from transifex 2012-12-27 00:06:31 +01:00
Jenkins for ownCloud
d559ac513e [tx-robot] updated from transifex 2012-12-26 00:13:40 +01:00
Jenkins for ownCloud
c2c89c6c6b [tx-robot] updated from transifex 2012-12-25 00:12:20 +01:00
Jenkins for ownCloud
af76c77b18 [tx-robot] updated from transifex 2012-12-24 00:13:14 +01:00
Jenkins for ownCloud
c4be5107df [tx-robot] updated from transifex 2012-12-23 00:11:23 +01:00
Jenkins for ownCloud
c13218d647 [tx-robot] updated from transifex 2012-12-22 00:28:19 +01:00
Daniel Molkentin
4ce55a44ba Klaas > Danimo, I am rather unpolite...
Also, fix whitespace errors
2012-12-21 01:16:54 +01:00
Jenkins for ownCloud
905891683b [tx-robot] updated from transifex 2012-12-21 00:13:21 +01:00
Klaas Freitag
f4019f5a5a Show backend error messages to user. 2012-12-20 20:51:43 +01:00
Daniel Molkentin
b7aec51ed8 Bump to 1.2.0beta1 2012-12-20 20:43:41 +01:00
Daniel Molkentin
e6b9c16d04 Update About dialog 2012-12-20 20:35:21 +01:00
Daniel Molkentin
488943aaa0 Correct inheritance in status dialog 2012-12-20 17:36:10 +01:00
Klaas Freitag
c3f6153f94 Fixed QString -> const char* conversions to handle UTF8 correctly. 2012-12-20 16:49:29 +01:00
Klaas Freitag
87aa3d7c60 More detailed error handling. 2012-12-20 16:49:29 +01:00
Klaas Freitag
144a2832b9 Loop over all certificates to match the approved one. 2012-12-20 16:49:29 +01:00
Daniel Molkentin
26c01cefa7 New icons for ownCloud client
--monoicons shows platform-specific monochrome icons
for now until we have a proper settings dialog.
2012-12-20 16:41:54 +01:00
Jenkins for ownCloud
91b58bdb3f [tx-robot] updated from transifex 2012-12-20 00:14:32 +01:00
Jenkins for ownCloud
b97d9a4fa9 [tx-robot] updated from transifex 2012-12-19 00:05:10 +01:00
Jenkins for ownCloud
83a1663750 [tx-robot] updated from transifex 2012-12-18 00:17:17 +01:00
Jenkins for ownCloud
76f571f9a9 [tx-robot] updated from transifex 2012-12-16 00:13:18 +01:00
Jenkins for ownCloud
8c53f6ff49 [tx-robot] updated from transifex 2012-12-15 00:13:14 +01:00
Daniel Molkentin
08ab13dc4b Doc: More missing packages 2012-12-14 21:11:19 +01:00
Daniel Molkentin
aac9b770fc Details on windows builds 2012-12-14 20:42:59 +01:00
Jenkins for ownCloud
552d979039 [tx-robot] updated from transifex 2012-12-14 00:18:50 +01:00
Klaas Freitag
30494eee75 Added utility class with format fingerprint method.
Removed other obsolete formatting method.
2012-12-13 21:36:44 +01:00
Klaas Freitag
eb0782ec90 Check certificate fingerprints reported back from neon. 2012-12-13 19:52:22 +01:00
Klaas Freitag
c6edde1365 Fix merging. 2012-12-13 19:52:07 +01:00
Jenkins for ownCloud
5c918a486c [tx-robot] updated from transifex 2012-12-13 00:16:51 +01:00
Daniel Molkentin
6e3b5e075a Fix crash 2012-12-12 20:06:59 +01:00
Daniel Molkentin
8b8d78f456 Improved version of popup-notify 2012-12-12 19:30:37 +01:00
Daniel Molkentin
3cb2e74d12 Notify user about new files.
Let's see if its too annoying,
we can still add a timer later
2012-12-12 15:00:38 +01:00
Daniel Molkentin
41082c5e81 Fix proxy error
This was caused by an incorrect translation to a string type.
2012-12-12 15:00:38 +01:00
Jenkins for ownCloud
e939c6f91a [tx-robot] updated from transifex 2012-12-12 00:15:35 +01:00
Klaas Freitag
5da634ed70 Transparent fallback to the former password storage if keychain is not
there.
2012-12-11 15:08:20 +01:00
Jenkins for ownCloud
bee3605275 [tx-robot] updated from transifex 2012-12-11 00:05:32 +01:00
Jenkins for ownCloud
243567bdbb [tx-robot] updated from transifex 2012-12-10 00:13:29 +01:00
Jenkins for ownCloud
52b22b3c58 [tx-robot] updated from transifex 2012-12-09 00:14:14 +01:00
Klaas Freitag
edfefabcf8 Use two step process to store credentials through config file. 2012-12-08 22:56:48 +01:00
Klaas Freitag
9c627782d4 Use a two step process to store credentials for setup dialog. 2012-12-08 22:55:46 +01:00
Jenkins for ownCloud
cb1a9aef3c [tx-robot] updated from transifex 2012-12-08 00:12:08 +01:00
Daniel Molkentin
ba9f46ef49 Make Windows-version of Add to Favorites work
I committed a WiP before...
2012-12-07 20:20:40 +01:00
Daniel Molkentin
5502087017 Fix windows build 2012-12-07 19:53:36 +01:00
Daniel Molkentin
5510135084 Fix formatting hashes 2012-12-07 19:51:11 +01:00
Daniel Molkentin
ddecca47fd osx/win: add sync folders to favorite folders 2012-12-07 19:51:11 +01:00
Klaas Freitag
1eabdee253 Enable logging through new csync logging api 2012-12-07 09:03:24 +01:00
Klaas Freitag
029535bcea Removed another scary thing: qstrdup for proxy type. 2012-12-06 19:05:25 +01:00
Daniel Molkentin
4ef89abac7 Compile on Mac 2012-12-06 18:48:36 +01:00
Klaas Freitag
8af257a4cd Start fs watching with a delay of 2 seconds to don't catch the journal changes. 2012-12-06 18:38:45 +01:00
Klaas Freitag
a124dcd4e8 More cleanups that were possible by the new notify api. 2012-12-06 18:38:06 +01:00
Klaas Freitag
fbae2d7330 Further cleanups that were possible by new change notification. 2012-12-06 18:35:02 +01:00
Klaas Freitag
f296fad4bb Set csync context as module parameter 2012-12-06 17:57:00 +01:00
Daniel Molkentin
e2d8105f0d Remove debug 2012-12-06 17:54:44 +01:00
Daniel Molkentin
287c073f00 Remove code for local sync runs
Rely entirely on folderwatcher. Local
sync runs can be implemented in terms
of a dummy folderwatcher if we want
to support systems without fs monitoring
again..
2012-12-06 17:53:04 +01:00
Daniel Molkentin
ff1706c729 Add libqtkeychain dll to NSIS 2012-12-06 17:53:04 +01:00
Daniel Molkentin
138a060df2 Fix Windows folder watcher 2012-12-06 17:53:04 +01:00
Daniel Molkentin
6678beadab Hack: Sleep 2 secs after sync run
This avoids that we get notified by the system
about writing of the csync db (IO has latency).
2012-12-06 17:53:04 +01:00
Daniel Molkentin
09793fcd59 Bump version to 1.2.0pre 2012-12-06 17:53:04 +01:00
Daniel Molkentin
cab503bb2b CredentialStore: Fix off-by-one 2012-12-06 17:53:04 +01:00
Daniel Molkentin
f20db6bbc1 Implement folder watching for OS X using FSEvents 2012-12-06 17:53:04 +01:00
Daniel Molkentin
d50d4d1a6f Add windows backend, require Inotify on Linux
Dummy-backend yanked for now, no support for other Unixes...
2012-12-06 17:53:04 +01:00
Jenkins for ownCloud
59b722f663 [tx-robot] updated from transifex 2012-12-06 00:13:28 +01:00
Daniel Molkentin
b65fd11a36 Remove superfluous include 2012-12-05 16:46:27 +01:00
Daniel Molkentin
36c9a29a7b Move Logger into its own file, move it to libsync.
This fixes a linker error.
2012-12-05 16:45:28 +01:00
Klaas Freitag
6ba098d26d Make use of the new csync_set_module_properties and remove stuff from
before.
2012-12-05 12:30:28 +01:00
Jenkins for ownCloud
fbf25c1529 [tx-robot] updated from transifex 2012-12-05 00:06:11 +01:00
Daniel Molkentin
214261e764 pimpl folderwatcher 2012-12-04 18:24:25 +01:00
Klaas Freitag
b74cfcfec5 Add missing ifdef QTKEYCHAIN. 2012-12-04 18:11:24 +01:00
Daniel Molkentin
bc67756ff6 Fix typo 2012-12-04 17:48:14 +01:00
Daniel Molkentin
eccd12923b factor inotify out of folderwatcher 2012-12-04 17:48:14 +01:00
Daniel Molkentin
8f9ad524c2 Find inotify on multiarch debian/ubuntu 2012-12-04 17:48:14 +01:00
Klaas Freitag
5d958a4c07 Make use of QKeyChain if its there. 2012-12-04 17:27:59 +01:00
Klaas Freitag
22128781be Use new logging api of csync. 2012-12-04 17:24:46 +01:00
Klaas Freitag
34dcff4ce2 Add a ownCloudWizard finished slot. 2012-12-04 17:05:17 +01:00
Klaas Freitag
bcbdfdd7ab Some cleanups to avoid build warnings under win32. 2012-12-04 17:05:17 +01:00
Jenkins for ownCloud
ee0125eff6 [tx-robot] updated from transifex 2012-12-04 00:08:09 +01:00
Jenkins for ownCloud
e6409b09a3 [tx-robot] updated from transifex 2012-12-03 00:06:39 +01:00
Jenkins for ownCloud
9c015de00b [tx-robot] updated from transifex 2012-12-02 00:04:29 +01:00
Jenkins for ownCloud
3a04778f97 [tx-robot] updated from transifex 2012-11-30 00:06:15 +01:00
Daniel Molkentin
53aea61184 doc: Fix PDF generation here, too 2012-11-29 12:25:32 +01:00
Jenkins for ownCloud
b424247daf [tx-robot] updated from transifex 2012-11-29 00:06:14 +01:00
Dominik Schmidt
097be61c9f Fix QT_STRICT_ITERATOR errors 2012-11-28 23:31:03 +01:00
Daniel Molkentin
b349caeab1 Build with ancient GCC (4.2 on Mac OS) 2012-11-28 12:03:36 +01:00
Klaas Freitag
593636f135 User feedback on wrong passwd from KeyStore. 2012-11-28 10:44:25 +01:00
Klaas Freitag
70ea325c75 Do not commit devel hardcoded to KeyChain 2012-11-28 10:44:25 +01:00
Klaas Freitag
1a9a9cb402 More QtKeyChain integration. 2012-11-28 10:44:25 +01:00
Klaas Freitag
9d05a53c89 Fix cmake checks on QtKeyChain. 2012-11-28 10:44:25 +01:00
Jenkins for ownCloud
56794e8d7c [tx-robot] updated from transifex 2012-11-28 00:12:19 +01:00
Dominik Schmidt
2b2eb853fc Add qtkeychain to cmake - WIP read password from keychain.
Conflicts:

	CMakeLists.txt
2012-11-27 19:28:03 +01:00
Klaas Freitag
bf2181f111 Minor doc fix. 2012-11-27 15:46:17 +01:00
Jenkins for ownCloud
bd0882ccd5 [tx-robot] updated from transifex 2012-11-27 00:11:51 +01:00
Klaas Freitag
0c2564df86 Ready for 1.1.2 Release: Set version. 2012-11-26 14:44:38 +01:00
Sebastian Kügler
591b71cf18 Return QNetworkReply from remote mkdir
This patch allows the client implementation to react to specific results
of mkdir requests

I need this patch to be able to catch errors from creating remote
folders.
2012-09-11 05:26:07 +02:00
Sebastian Kügler
76e9687d6f Return QNetworkReply from getRequests
This patch allows the client implementation to react to specific
getRequests, such as folder checks, etc. It allows to connect
client-specific slots to requests, catch its errors and handle them
separately.

I need this patch to be able to check more than one remote folder on the
server, and not mix up their job's signal handling.
2012-09-11 03:35:32 +02:00
242 changed files with 31382 additions and 14589 deletions

View File

@@ -4,17 +4,34 @@ project(mirall)
set(PACKAGE "mirall")
set( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
if ( EXISTS ${CMAKE_SOURCE_DIR}/OEM.cmake )
include ( ${CMAKE_SOURCE_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 )
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)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
# if we cannot get it from git, directly try .tag (packages)
# this will work if the tar balls have been properly created
# via git-archive.
if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
file(READ ${CMAKE_SOURCE_DIR}/.tag sha1_candidate)
string(REPLACE "\n" "" sha1_candidate ${sha1_candidate})
if (NOT ${sha1_candidate} STREQUAL "$Format:%H$")
message("${sha1_candidate}")
set (GIT_SHA1 "${sha1_candidate}")
endif()
endif()
## stupid, we should upstream this
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT CMAKE_INSTALL_SYSCONFDIR)
set(CMAKE_INSTALL_SYSCONFDIR "/etc")
@@ -37,13 +54,29 @@ 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()
find_package(INotify)
endif()
find_package(Sphinx)
find_package(PdfLatex)
find_package(QtKeychain)
set(WITH_CSYNC CSYNC_FOUND)
set(WITH_QTKEYCHAIN ${QTKEYCHAIN_FOUND})
set(USE_INOTIFY ${INOTIFY_FOUND})
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
@@ -69,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)

48
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,48 @@
## Submitting Desktop Client issues
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].
### 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:
- [ownCloud server](https://github.com/owncloud/core/issues)
- [ownCloud apps](https://github.com/owncloud/apps/issues) (e.g. Calendar,
Contacts...)
- [Android client](https://github.com/owncloud/android/issues)
- [iOS client](https://github.com/owncloud/ios-issues/issues)
* Search the existing issues first, it's likely that your issue was already
reported.
If your issue appears to be a bug, and hasn't been reported, open a new issue.
Help us to maximize the effort we can spend fixing issues and adding new
features, by not reporting duplicate issues.
[template]: https://raw.github.com/owncloud/mirall/master/issue_template.md
[mailinglist]: https://mail.kde.org/mailman/listinfo/owncloud
[forum]: http://forum.owncloud.org/
[irc]: http://webchat.freenode.net/?channels=owncloud&uio=d4
## Contributing to Source Code
Thanks for wanting to contribute source code to ownCloud. That's great!
Before we're able to merge your code to mirall, you need to sign
our [Contributor Agreement][agreement].
Please read the [Desktop Client Manual][mirallman] and the [Developer
Manuals][devmanual] to get useful infos like how to create your first
application or how to test the ownCloud code with phpunit.
[agreement]: http://owncloud.org/about/contributor-agreement/
[devmanual]: http://owncloud.org/dev/
[mirallman]: http://doc.owncloud.org/desktop/1.1/
## Translations
Please submit translations via [Transifex][transifex].
[transifex]: https://www.transifex.com/projects/p/owncloud/

View File

@@ -9,9 +9,10 @@ endif(CPACK_GENERATOR MATCHES "NSIS")
set( CMAKE_SOURCE_DIR @CMAKE_SOURCE_DIR@ )
set( CMAKE_BINARY_DIR @CMAKE_BINARY_DIR@ )
set( OEM_THEME_DIR @OEM_THEME_DIR@ )
if ( EXISTS "${CMAKE_SOURCE_DIR}/OEM.cmake" )
include ( "${CMAKE_SOURCE_DIR}/OEM.cmake" )
if ( DEFINED OEM_THEME_DIR AND EXISTS ${OEM_THEME_DIR}/OEM.cmake )
include ( ${OEM_THEME_DIR}/OEM.cmake )
else ()
include ( "${CMAKE_SOURCE_DIR}/OWNCLOUD.cmake" )
endif()

103
ChangeLog
View File

@@ -1,6 +1,78 @@
ChangeLog
=========
version 1.1.2 (release 2012-11- ), csync 0.60.2 required
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.
* [GUI] New platform specific icon set.
* [App] Using cross platform QtKeychain library to store credentials crypted.
* [App] Use cross platform notification for changes in the local file system rather than regular poll.
* [Fixes] Improved SSL Certificate handling and SSL fixes troughout syncing.
* [Fixes] Fixed proxy authentication.
* [Fixes] Allow brackets in folder name alias.
* [Fixes] Lots of other minor fixes.
* [Platform] cmake fixes.
* [Platform] Improved, more detailed error reporting.
version 1.1.4 (release 2012-12-19 ), csync 0.60.4 required
* No changes to mirall, only csync fixes.
version 1.1.3 (release 2012-11-30 ), csync 0.60.3 required
* No changes to mirall, only csync fixes.
version 1.1.2 (release 2012-11-26 ), csync 0.60.2 required
* [Fixes] Allow to properly cancel the password dialog.
* [Fixes] Share folder name correctly percent encoded with old Qt
4.6 builds ie. Debian.
@@ -18,23 +90,19 @@ version 1.1.2 (release 2012-11- ), csync 0.60.2 required
* [Platform] Fix Mac building
version 1.1.1 (release 2012-10-18), csync 0.60.1 required
* [GUI] Allow changing folder name in single folder mode
* [GUI] Allow changing folder name in single folder mode
* [GUI] Windows: Add license to installer
* [GUI] owncloud --logwindow will bring up the log window
in an already running instance
* [Fixes] Make sure SSL errors are always handled
* [Fixes] Allow special characters in folder alias
* [Fixes] Proper workaround for Menu bug in Ubuntu
* [Fixes] Allow special characters in folder alias
* [Fixes] Proper workaround for Menu bug in Ubuntu
* [Fixes] csync: Fix improper memory cleanup which could
cause memory leaks and crashes
* [Fixes] csync: Fix memory leak
* [Fixes] csync: Allow single quote (') in file names
* [Fixes] csync: Remove stray temporary files
* [Fixes] csync: Fix memory leak
* [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)
@@ -53,7 +121,7 @@ version 1.1.0 (release 2012-10-10), csync 0.60.0 required
* [Platform] csync conf file and database were moved to the users app data
directory, away from the .csync dir.
* Renamed exclude.lst to sync-exclude.lst and moved it to
/etc/appName()/ for more clean packaging. From the user path,
/etc/appName()/ for more clean packaging. From the user path,
still exclude.lst is read if sync-exclude.lst is not existing.
* Placed custom.ini with customization options to /etc/appName()
@@ -62,7 +130,7 @@ version 1.0.5 (release 2012-08-14), csync 0.50.8 required
version 1.0.4 (release 2012-08-10), csync 0.50.8 required
* [APP] ownCloud is now a single instance app, can not start twice any more.
* [APP] Proxy support
* [APP] Proxy support
* [APP] Handle HTTP redirection correctly, note new url.
* [APP] More relaxed handling of read only directories in the sync paths.
* [APP] Started to split off a library with sync functionality, eg for KDE
@@ -73,13 +141,13 @@ version 1.0.4 (release 2012-08-10), csync 0.50.8 required
* [GUI] Removed Log Window Button, log available through command line.
* [GUI] Proxy configuration dialog added.
* [GUI] Added Translations to languages Slovenian, Polish, Catalan,
Portuguese (Brazil), German, Greek, Spanish, Czech, Italian, Slovak,
French, Russian, Japanese, Swedish, Portuguese (Portugal)
Portuguese (Brazil), German, Greek, Spanish, Czech, Italian, Slovak,
French, Russian, Japanese, Swedish, Portuguese (Portugal)
all with translation rate >90%.
* [Fixes] Loading of self signed certs into Networkmanager (#oc-843)
* [Fixes] Win32: Handle SSL dll loading correctly.
* [Fixes] Many other small fixes and improvements.
version 1.0.3 (release 2012-06-19), csync 0.50.7 required
* [GUI] Added a log window which catches the logging if required and
allows to save for information.
@@ -88,7 +156,7 @@ version 1.0.3 (release 2012-06-19), csync 0.50.7 required
* [Fixes] Do not use csync database files from a sync before.
* [Fixes] In Connection wizard, write the final config onyl if
the user really accepted. Also remove the former database.
* [Fixes] More user expected behaviour deletion of sync folder local
* [Fixes] More user expected behaviour deletion of sync folder local
and remote.
* [Fixes] Allow special characters in the sync directory names
* [Fixes] Win32: Fixed directory removal with special character dirs.
@@ -129,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

@@ -1,7 +1,10 @@
set( APPLICATION_SHORTNAME "owncloud" )
set( APPLICATION_NAME "ownCloud" )
set( APPLICATION_EXECUTABLE "owncloud" )
set( APPLICATION_DOMAIN "owncloud.org" )
set( APPLICATION_VENDOR "ownCloud.org" )
set( APPLICATION_DOMAIN "owncloud.com" )
set( APPLICATION_VENDOR "ownCloud, Inc" )
set( THEME_CLASS "ownCloudTheme" )
set( APPLICATION_REV_DOMAIN "org.owncloud.desktopclient" )
set( APPLICATION_REV_DOMAIN "com.owncloud.desktopclient" )
set( WIN_SETUP_BITMAP_PATH "${CMAKE_SOURCE_DIR}/admin/win/nsi" )
# set( THEME_INCLUDE "${OEM_THEME_DIR}/mytheme.h" )
# set( APPLICATION_LICENSE "${OEM_THEME_DIR}/license.txt )

View File

@@ -2,8 +2,8 @@ include( InstallRequiredSystemLibraries )
set( CPACK_PACKAGE_CONTACT "Dominik Schmidt <domme@tomahawk-player.org>" )
if ( EXISTS "${CMAKE_SOURCE_DIR}/OEM.cmake" )
include ( "${CMAKE_SOURCE_DIR}/OEM.cmake" )
if ( DEFINED OEM_THEME_DIR AND EXISTS ${OEM_THEME_DIR}/OEM.cmake )
include ( "${OEM_THEME_DIR}/OEM.cmake" )
else ()
include ( "${CMAKE_SOURCE_DIR}/OWNCLOUD.cmake" )
endif()
@@ -45,12 +45,12 @@ if(WIN32)
# CPACK_INCLUDE_TOPLEVEL_DIRECTORY Controls whether CPack adds a top-level directory, usually of the form ProjectName-Version-OS, to the top of package tree. 0 to disable, 1 to enable
# CPACK_INSTALL_CMAKE_PROJECTS List of four values: Build directory, Project Name, Project Component, Directory in the package /home/andy/vtk/CMake-bin;CMake;ALL;/
set( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" ) # File used as a description of a project /path/to/project/ReadMe.txt
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "ownCloud Syncing Client" ) # Description summary of a project
set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "${APPLICATION_NAME} Syncing Client" ) # Description summary of a project
# CPACK_PACKAGE_EXECUTABLES List of pairs of executables and labels. Used by the NSIS generator to create Start Menu shortcuts. ccmake;CMake
set( CPACK_PACKAGE_INSTALL_DIRECTORY ${APPLICATION_NAME} ) # Installation directory on the target system -> C:\Program Files\fellody
set( CPACK_PACKAGE_INSTALL_REGISTRY_KEY ${APPLICATION_NAME} ) # Registry key used when installing this project CMake 2.5.0
set( CPACK_PACKAGE_NAME ${APPLICATION_NAME} ) # Package name, defaults to the project name
set( CPACK_PACKAGE_VENDOR "http://owncloud.com" ) # Package vendor name
set( CPACK_PACKAGE_VENDOR "http://${APPLICATION_DOMAIN}" ) # Package vendor name
endif()
# set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt" ) # License file for the project, used by the STGZ, NSIS, and PackageMaker generators. /home/andy/vtk/CMake/Copyright.txt

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,5 +1,6 @@
set( VERSION_MAJOR 1 )
set( VERSION_MINOR 1 )
set( VERSION_PATCH 2 )
set( VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}rc )
set( VERSION_MINOR 3 )
set( VERSION_PATCH 0 )
set( VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}beta2)
set( SOVERSION 0 )

View File

@@ -11,7 +11,7 @@ mount="/Volumes/$(basename $src_dmg|cut -d"-" -f1)"
test -e $tmp_dmg && rm -rf $tmp_dmg
hdiutil convert $src_dmg -format UDRW -o $tmp_dmg
open $tmp_dmg
sleep 2s
sleep 12s
pushd $mount
codesign -s "$identity" $mount/*.app
popd

View File

@@ -32,3 +32,7 @@ SET(QT_MOC_EXECUTABLE ${MINGW_PREFIX}-moc)
SET(QT_RCC_EXECUTABLE ${MINGW_PREFIX}-rcc)
SET(QT_UIC_EXECUTABLE ${MINGW_PREFIX}-uic)
SET(QT_LRELEASE_EXECUTABLE ${MINGW_PREFIX}-lrelease)
# neon config
SET(NEON_CONFIG_EXECUTABLE ${CMAKE_FIND_ROOT_PATH}/bin/neon-config)
# /usr/i686-w64-mingw32/sys-root/mingw/bin/neon-config

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

@@ -1,28 +1,28 @@
IF(EXISTS "${CMAKE_SOURCE_DIR}/../csync/src/csync.h")
SET(CSYNC_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/../csync/src/)
ELSE()
FIND_PATH(CSYNC_INCLUDE_PATH NAMES csync.h HINTS $ENV{CSYNC_DIR} )
ENDIF()
IF( DEFINED CSYNC_LIBRARY_PATH AND DEFINED CSYNC_INCLUDE_PATH )
IF( WIN32 )
SET(CSYNC_LIBRARY ${CSYNC_LIBRARY_PATH}/src/libocsync.dll)
ELSEIF ( APPLE )
SET(CSYNC_LIBRARY ${CSYNC_LIBRARY_PATH}/src/libocsync.dylib)
IF( DEFINED CSYNC_BUILD_PATH )
SET(CSYNC_LIBRARY_PATH ${CSYNC_BUILD_PATH})
SET(CSYNC_BINARY_DIR ${CSYNC_BUILD_PATH})
IF(WIN32)
SET(CSYNC_LIBRARY ${CSYNC_BUILD_PATH}/src/libocsync.dll)
ELSEIF( APPLE )
SET(CSYNC_LIBRARY ${CSYNC_BUILD_PATH}/src/libocsync.dylib)
ELSE()
SET(CSYNC_LIBRARY ${CSYNC_LIBRARY_PATH}/src/libocsync.so)
ENDIF( )
SET(CSYNC_BINARY_DIR ${CSYNC_LIBRARY_PATH})
SET(CSYNC_LIBRARY ${CSYNC_BUILD_PATH}/src/libocsync.so)
ENDIF()
ELSE()
FIND_LIBRARY(CSYNC_LIBRARY NAMES ocsync HINTS $ENV{CSYNC_DIR})
ENDIF()
IF(NOT DEFINED CSYNC_INCLUDE_PATH)
FIND_PATH(CSYNC_INCLUDE_PATH NAMES csync.h HINTS $ENV{CSYNC_DIR} )
ENDIF()
SET(CSYNC_INCLUDE_DIR ${CSYNC_INCLUDE_PATH})
# handle the QUIETLY and REQUIRED arguments and set CSYNC_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Csync DEFAULT_MSG
CSYNC_LIBRARY CSYNC_INCLUDE_PATH)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Csync DEFAULT_MSG CSYNC_LIBRARY CSYNC_INCLUDE_PATH)
MARK_AS_ADVANCED( CSYNC_INCLUDE_PATH CSYNC_LIBRARY )

View File

@@ -4,12 +4,12 @@
# also defined, but not for general use are
# INOTIFY_LIBRARY, where to find the inotify library.
find_path(INOTIFY_INCLUDE_DIR sys/inotify.h)
find_path(INOTIFY_INCLUDE_DIR sys/inotify.h
HINTS /usr/include/${CMAKE_LIBRARY_ARCHITECTURE})
mark_as_advanced(INOTIFY_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set INOTIFY_FOUND to TRUE if
# all listed variables are TRUE
# handle the QUIETLY and REQUIRED arguments and set INOTIFY_FOUND to TRUE if
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(INOTIFY DEFAULT_MSG INOTIFY_INCLUDE_DIR)

View File

@@ -0,0 +1,18 @@
# - Try to find QtKeyChain
# Once done this will define
# QTKEYCHAIN_FOUND - System has QtKeyChain
# QTKEYCHAIN_INCLUDE_DIRS - The QtKeyChain include directories
# QTKEYCHAIN_LIBRARIES - The libraries needed to use QtKeyChain
# QTKEYCHAIN_DEFINITIONS - Compiler switches required for using LibXml2
find_path(QTKEYCHAIN_INCLUDE_DIR qtkeychain/keychain.h)
find_library(QTKEYCHAIN_LIBRARY NAMES libqtkeychain qtkeychain)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set QTKEYCHAIN_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(QtKeyChain DEFAULT_MSG
QTKEYCHAIN_LIBRARY QTKEYCHAIN_INCLUDE_DIR)
mark_as_advanced(QTKEYCHAIN_INCLUDE_DIR QTKEYCHAIN_LIBRARY )

View File

@@ -0,0 +1,123 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()

View File

@@ -0,0 +1,38 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
set(HEAD_HASH "${HEAD_REF}")
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

@@ -6,9 +6,7 @@
!define APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@.exe"
!define APPLICATION_DOMAIN "@APPLICATION_DOMAIN@"
!define APPLICATION_LICENSE "@APPLICATION_LICENSE@"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.${APPLICATION_DOMAIN}"
!define WIN_SETUP_BITMAP_PATH "@WIN_SETUP_BITMAP_PATH@"
;-----------------------------------------------------------------------------
; Some installer script options (comment-out options not required)
@@ -33,9 +31,11 @@
!endif
!define MING_BIN "${MING_PATH}/bin"
!define MING_LIB "${MING_PATH}/lib"
!define MING_SHARE "${MING_PATH}/share"
!define BUILD_PATH "@CMAKE_BINARY_DIR@"
!define SOURCE_PATH "@CMAKE_SOURCE_DIR@"
!define QT_DLL_PATH "${MING_BIN}"
!define ACCESSIBLE_DLL_PATH "${MING_LIB}/qt4/plugins/accessible"
!define SQLITE_DLL_PATH "${MING_LIB}/qt4/plugins/sqldrivers"
!define IMAGEFORMATS_DLL_PATH "${MING_LIB}/qt4/plugins/imageformats"
@@ -63,7 +63,6 @@
; Initial installer setup and definitions.
;-----------------------------------------------------------------------------
Name "@CPACK_NSIS_PACKAGE_NAME@"
Caption "${APPLICATION_NAME} Setup"
BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
@@ -103,14 +102,12 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
!define MUI_ABORTWARNING
!define MUI_ICON ${NSI_PATH}\installer.ico
!define MUI_UNICON ${NSI_PATH}\installer.ico
!define MUI_WELCOMEFINISHPAGE_BITMAP ${NSI_PATH}\welcome_${APPLICATION_SHORTNAME}.bmp
!define MUI_WELCOMEPAGE_TITLE "Welcome to the @CPACK_PACKAGE_NAME@ ${VERSION} Setup Wizard"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation.$\r$\n$\r$\n$_CLICK"
!define MUI_WELCOMEFINISHPAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/welcome.bmp
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ${NSI_PATH}\page_header_${APPLICATION_SHORTNAME}.bmp
!define MUI_HEADERIMAGE_BITMAP ${WIN_SETUP_BITMAP_PATH}/page_header.bmp
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_TITLE "@CPACK_PACKAGE_NAME@ Setup Completed"
!define MUI_FINISHPAGE_LINK "Click here to visit the @CPACK_PACKAGE_NAME@ website."
!define MUI_FINISHPAGE_LINK "www.${APPLICATION_DOMAIN}"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.${APPLICATION_DOMAIN}"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!ifdef OPTION_FINISHPAGE_RELEASE_NOTES
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
@@ -128,7 +125,7 @@ ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
;-----------------------------------------------------------------------------
!insertmacro MUI_PAGE_WELCOME
!ifdef OPTION_LICENSE_AGREEMENT
!insertmacro MUI_PAGE_LICENSE "${source_path}/${APPLICATION_LICENSE}"
!insertmacro MUI_PAGE_LICENSE "${APPLICATION_LICENSE}"
!endif
Page custom PageReinstall PageLeaveReinstall
!insertmacro MUI_PAGE_COMPONENTS
@@ -270,7 +267,7 @@ FunctionEnd
# INSTALLER SECTIONS #
# #
##############################################################################
Section "${APPLICATION_NAME}" SEC_OWNCLOUD
Section "${APPLICATION_NAME}" SEC_APPLICATION
SectionIn 1 2 3 RO
SetDetailsPrint listonly
@@ -287,22 +284,83 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
;Main executable.
File "${BUILD_PATH}\bin\${APPLICATION_EXECUTABLE}"
File "${BUILD_PATH}\src\libowncloudsync.dll"
File "${BUILD_PATH}\src\mirall_ca.qm"
File "${BUILD_PATH}\src\mirall_cs_CZ.qm"
File "${BUILD_PATH}\src\mirall_da.qm"
File "${BUILD_PATH}\src\mirall_de.qm"
File "${BUILD_PATH}\src\mirall_el.qm"
File "${BUILD_PATH}\src\mirall_en.qm"
File "${BUILD_PATH}\src\mirall_eo.qm"
File "${BUILD_PATH}\src\mirall_es.qm"
File "${BUILD_PATH}\src\mirall_es_AR.qm"
File "${BUILD_PATH}\src\mirall_et_EE.qm"
File "${BUILD_PATH}\src\mirall_eu.qm"
File "${BUILD_PATH}\src\mirall_fa.qm"
File "${BUILD_PATH}\src\mirall_fi_FI.qm"
File "${BUILD_PATH}\src\mirall_fr.qm"
File "${BUILD_PATH}\src\mirall_gl.qm"
File "${BUILD_PATH}\src\mirall_he.qm"
File "${BUILD_PATH}\src\mirall_hr.qm"
File "${BUILD_PATH}\src\mirall_hu_HU.qm"
File "${BUILD_PATH}\src\mirall_it.qm"
File "${BUILD_PATH}\src\mirall_ja_JP.qm"
File "${BUILD_PATH}\src\mirall_ko.qm"
File "${BUILD_PATH}\src\mirall_lb.qm"
File "${BUILD_PATH}\src\mirall_lt_LT.qm"
File "${BUILD_PATH}\src\mirall_lv.qm"
File "${BUILD_PATH}\src\mirall_mk.qm"
File "${BUILD_PATH}\src\mirall_ms_MY.qm"
File "${BUILD_PATH}\src\mirall_nb_NO.qm"
File "${BUILD_PATH}\src\mirall_nl.qm"
File "${BUILD_PATH}\src\mirall_oc.qm"
File "${BUILD_PATH}\src\mirall_pl.qm"
File "${BUILD_PATH}\src\mirall_pt_BR.qm"
File "${BUILD_PATH}\src\mirall_pt_PT.qm"
File "${BUILD_PATH}\src\mirall_ro.qm"
File "${BUILD_PATH}\src\mirall_ru.qm"
File "${BUILD_PATH}\src\mirall_ru_RU.qm"
File "${BUILD_PATH}\src\mirall_si_LK.qm"
File "${BUILD_PATH}\src\mirall_sk_SK.qm"
File "${BUILD_PATH}\src\mirall_sl.qm"
File "${BUILD_PATH}\src\mirall_sr@latin.qm"
File "${BUILD_PATH}\src\mirall_sv.qm"
File "${BUILD_PATH}\src\mirall_ta_LK.qm"
File "${BUILD_PATH}\src\mirall_th_TH.qm"
File "${BUILD_PATH}\src\mirall_tr.qm"
File "${BUILD_PATH}\src\mirall_uk.qm"
File "${BUILD_PATH}\src\mirall_vi.qm"
File "${BUILD_PATH}\src\mirall_zh_CN.qm"
File "${BUILD_PATH}\src\mirall_zh_TW.qm"
#File "${MING_SHARE}\qt4\translations\qt_ar.qm"
File "${MING_SHARE}\qt4\translations\qt_cs.qm"
File "${MING_SHARE}\qt4\translations\qt_da.qm"
File "${MING_SHARE}\qt4\translations\qt_de.qm"
File "${MING_SHARE}\qt4\translations\qt_es.qm"
File "${MING_SHARE}\qt4\translations\qt_fa.qm"
File "${MING_SHARE}\qt4\translations\qt_fr.qm"
File "${MING_SHARE}\qt4\translations\qt_gl.qm"
File "${MING_SHARE}\qt4\translations\qt_he.qm"
File "${MING_SHARE}\qt4\translations\qt_hu.qm"
File "${MING_SHARE}\qt4\translations\qt_ja.qm"
File "${MING_SHARE}\qt4\translations\qt_ko.qm"
File "${MING_SHARE}\qt4\translations\qt_lt.qm"
File "${MING_SHARE}\qt4\translations\qt_pl.qm"
File "${MING_SHARE}\qt4\translations\qt_pt.qm"
File "${MING_SHARE}\qt4\translations\qt_ru.qm"
File "${MING_SHARE}\qt4\translations\qt_sk.qm"
File "${MING_SHARE}\qt4\translations\qt_sl.qm"
File "${MING_SHARE}\qt4\translations\qt_sv.qm"
File "${MING_SHARE}\qt4\translations\qt_uk.qm"
File "${MING_SHARE}\qt4\translations\qt_zh_CN.qm"
File "${MING_SHARE}\qt4\translations\qt_zh_TW.qm"
File "${MING_SHARE}\qt4\translations\qt_zh_TW.qm"
File "${MING_SHARE}\qt4\translations\qtkeychain_de.qm"
SetOutPath "$INSTDIR\accessible"
File "${ACCESSIBLE_DLL_PATH}\qtaccessiblewidgets4.dll"
SetOutPath "$INSTDIR\modules"
; FIXME: fix installation dir of module, currently needs manual copying to
@@ -316,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"
@@ -324,6 +382,9 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
File "${QT_DLL_PATH}\QtNetwork4.dll"
File "${QT_DLL_PATH}\QtXml4.dll"
;QtKeyChain stuff
File "${MING_BIN}\libqtkeychain.dll"
File "${CSYNC_LIBRARY_DIR}/libocsync.dll"
File "${MING_BIN}\libsqlite3-0.dll"
File "${MING_BIN}\libiniparser.dll"
@@ -331,14 +392,10 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
File "${MING_BIN}\libpng15-15.dll"
; ownCloud plugin
File "${MING_BIN}\libgcrypt-11.dll"
File "${MING_BIN}\libgnutls-26.dll"
File "${MING_BIN}\libgpg-error-0.dll"
File "${MING_BIN}\libintl-8.dll"
File "${MING_BIN}\libneon-27.dll"
File "${MING_BIN}\libproxy.dll"
File "${MING_BIN}\libmodman.dll"
File "${MING_BIN}\libtasn1-3.dll"
File "${MING_BIN}\libxml2-2.dll"
;MinGW stuff
@@ -349,11 +406,10 @@ Section "${APPLICATION_NAME}" SEC_OWNCLOUD
;File "${MING_BIN}\libpng15-15.dll"
;File "${MING_BIN}\libjpeg-8.dll"
File "${MING_BIN}\zlib1.dll"
File "${MING_BIN}\libcrypto-8.dll"
File "${MING_BIN}\libssl-8.dll"
File "${MING_BIN}\libcrypto-10.dll"
File "${MING_BIN}\libssl-10.dll"
; CSync configs
File "${CSYNC_CONFIG_DIR}/ocsync.conf"
File "${SOURCE_PATH}/sync-exclude.lst"
SectionEnd
@@ -369,9 +425,9 @@ SectionGroup "Shortcuts"
SetShellVarContext all
RMDir /r "$SMPROGRAMS\${APPLICATION_NAME}"
CreateDirectory "$SMPROGRAMS\${APPLICATION_NAME}"
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
;CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_EXECUTABLE}"
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Release notes.lnk" "$INSTDIR\NOTES.txt"
;CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Release notes.lnk" "$INSTDIR\NOTES.txt"
CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
SetShellVarContext current
${MementoSectionEnd}
@@ -406,7 +462,7 @@ SectionGroupEnd
DetailPrint "Creating Windows Start Entry"
SetDetailsPrint listonly
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Run" \
"${APPLICATION_NAME}" "$INSTDIR\${APPLICATION_EXECUTABLE}"
"${APPLICATION_NAME}" "$INSTDIR\${APPLICATION_EXECUTABLE}"
${MementoSectionEnd}
!endif
@@ -419,7 +475,7 @@ ${MementoSectionDone}
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_START_MENU} "${APPLICATION_NAME} program group."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} "Desktop shortcut for ${APPLICATION_NAME}."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_LAUNCH} "Quick Launch shortcut for ${APPLICATION_NAME}."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_AUTOSTART} "Register ${APPLICATION_NAME} to run on Windows startup."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_AUTOSTART} "Register ${APPLICATION_NAME} to run on Windows startup."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section -post

View File

@@ -3,6 +3,10 @@
#cmakedefine USE_INOTIFY 1
#cmakedefine WITH_CSYNC 1
#cmakedefine WITH_QTKEYCHAIN 1
#cmakedefine GIT_SHA1 "@GIT_SHA1@"
#cmakedefine APPLICATION_DOMAIN @APPLICATION_DOMAIN@
#cmakedefine THEME_CLASS @THEME_CLASS@
#cmakedefine THEME_INCLUDE @THEME_INCLUDE@
#endif

View File

@@ -9,20 +9,34 @@ if(SPHINX_FOUND)
set(SPHINX_QCH_DIR "${CMAKE_CURRENT_BINARY_DIR}/qthelp")
set(SPHINX_HTMLHELP_DIR "${CMAKE_CURRENT_BINARY_DIR}/htmlhelp")
set(MSHTML_COMPILER wine 'C:\\Program Files\\HTML Help Workshop\\hhc.exe')
# assets
set(LATEX_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/logo-blue.pdf")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in" conf.py @ONLY)
add_custom_target(doc DEPENDS doc-html doc-man COMMENT "Building documentation...")
if(WITH_DOC)
add_custom_target(doc ALL DEPENDS doc-html doc-man COMMENT "Building documentation...")
install(DIRECTORY ${SPHINX_HTML_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY ${SPHINX_MAN_DIR} DESTINATION ${CMAKE_INSTALL_MANDIR})
else(WITH_DOC)
add_custom_target(doc DEPENDS doc-html doc-man COMMENT "Building documentation...")
endif(WITH_DOC)
if(PDFLATEX_FOUND)
# if this still fails on Debian/Ubuntu, run
# apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
add_custom_target(doc-latex ${SPHINX_EXECUTABLE}
-q -c . -b latex
-d ${SPHINX_CACHE_DIR}
-D latex_logo=${LATEX_LOGO}
${CMAKE_CURRENT_SOURCE_DIR}
${SPHINX_PDF_DIR} )
add_custom_target(doc-pdf make -C ${SPHINX_PDF_DIR} all-pdf
DEPENDS doc-latex )
add_dependencies(doc doc-pdf)
if (WITH_DOC)
install(DIRECTORY ${SPHINX_PDF_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif (WITH_DOC)
endif(PDFLATEX_FOUND)
if (EXISTS ${QT_QCOLLECTIONGENERATOR_EXECUTABLE})
add_custom_target( doc-qch-sphinx ${SPHINX_EXECUTABLE}
@@ -34,6 +48,9 @@ if(SPHINX_FOUND)
${SPHINX_QCH_DIR}/*.qhcp
DEPENDS doc-qch-sphinx )
add_dependencies(doc doc-qch)
if (WITH_DOC)
install(DIRECTORY ${SPHINX_QCH_DIR} DESTINATION ${CMAKE_INSTALL_DOCDIR})
endif (WITH_DOC)
endif()
add_custom_target( doc-html ${SPHINX_EXECUTABLE}
-q -c . -b html
@@ -45,6 +62,7 @@ if(SPHINX_FOUND)
-d ${SPHINX_CACHE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${SPHINX_MAN_DIR} )
## Building CHM files requires HTML Help Workshop. Since it requires wine
## with special dependencies, it's impossible to write a cmake check for it.
## This is why doc-chm is not a dependency for doc. Instead, run

View File

@@ -1,87 +0,0 @@
Adding 3rd-Party Branding
=========================
The ownCloud Client supports theming in the setup assistant dialog in both the
account setting and the result window. These customizations do not require a
recompile of the client.
The dialogs have places where custom content can be inserted. Please take a look
on the screenshot below. For example the connection wizard has the two green
rectangles as well as the area at the bottom with the black line and the red
text.
The content places can be altered by a file called ``custom.ini`` which contains
content for the specific places in the dialogs.
On windows, the custom.ini has to be stored at
+-----------------+------------------------------------------------------------+
| OS | Path |
+=================+============================================================+
| Windows (64 bit)| ``%ProgramFiles(x86)%\ownCloud\custom.ini`` |
+-----------------+------------------------------------------------------------+
| Windows (32 bit)| ``%ProgramFiles%\ownCloud\custom.ini`` |
+-----------------+------------------------------------------------------------+
| Mac OS | ``owncloud.app/Contents/Resources/custom.ini`` |
+-----------------+------------------------------------------------------------+
| Linux | ``/etc/ownCloud/custom.ini`` |
+-----------------+------------------------------------------------------------+
The config file needs to be in a usual `Windows INI file format`_.
Under the group definition [GUICustomize] the following keys can be set:
* ``oCSetupTop``: The top area of the connect wizard, account page.
* ``oCSetupSide``: The side area of the connect wizard, account page.
* ``ocSetupBottom``: The bottom area of the connect wizard, account page
* ``oCSetupResultTop``: The top area of the connect wizard result page.
* ``oCSetupFixUrl``: A fixed url to the ownCloud instance. If this is set, the
user can not access the url entry field and it is hidden.
The keys can be set to either an image file or a `rich text`_ snippet, which
must be enclosed with double quotes. Image files must be addressed by the
complete file name. On windows, the pathes should be noted with slashes
instead of backslashes. Instead of absolute file pathes, you can use
the ``%RESOURCES`` placeholder (note the single ``%``!).
Example::
%RESOURCES/custom/myimage_top.png
.. note:: ``%RESOURCES`` is currently undefined on Linux, it points to the
directory location of ``custom.ini`` on all other platforms.
Example
~~~~~~~
A config file ``custom.ini`` like this::
[GUICustomize]
oCSetupTop=/home/kf/owncloud.com/topimg.png
oCSetupSide=/home/kf/owncloud.com/sideimg.png
oCSetupBottom="
<hr />
The Power of now: ownCloud Client
This nice ownCloud Client was presented by <a
href="http://owncloud.com">ownCloud Inc.</a>
"
oCSetupResultTop=/home/kf/owncloud.com/topimg.png
will produce this setup dialog:
.. figure:: images/branding_setup.png
Setup Dialog Customization
Packaging remarks
~~~~~~~~~~~~~~~~~
While you do not need to rebuild the client, you will need to repackage
the client on your own. This also means you will have to resign those
packages with your own signing key.
.. _`Windows INI file format`: http://en.wikipedia.org/wiki/INI_file
.. _`rich text`: http://qt-project.org/doc/qt-5.0/richtext-html-subset.html

View File

@@ -20,20 +20,24 @@ Linux
Mac OS X
--------
Follow the `generic build instructions`_.
You can install the missing dependencies via MacPorts_ or Homebrew_.
Next to XCode (and the command line tools!), you will need some
extra dependencies.
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,32 +55,47 @@ 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/isv:ownCloud:devel:mingw:win32.repo
http://download.opensuse.org/repositories/windows:/mingw/openSUSE_12.1/windows:mingw.repo
http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_12.1/windows:mingw:win32.repo
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-gnutls \
mingw32-libneon mingw32-libbeecrypt mingw32-libopenssl \
mingw32-openssl
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 packages are also required::
For the installer, the NSIS installer package is also required::
zypper install mingw32-cross-nsis mingw32-cross-nsis-plugin-processes \
mingw32-cross-nsis-plugin-uac
zypper install mingw32-cross-nsis
.. Usually, the following would be needed as well, but due to a bug in mingw, they
will currently not build properly from source.
mingw32-cross-nsis-plugin-processes mingw32-cross-nsis-plugin-uac
You will also need to manually download and install the following files with
``rpm -ivh <package>`` (They will also work with OpenSUSE 12.2)::
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``
@@ -111,37 +130,42 @@ Next, make sure to check out the 'dav' branch in the newly checked out
cd ocsync
git checkout dav
The first package to buidld is CSync::
The first package to build is CSync::
cd ocsync-build
cmake -DCMAKE_BUILD_TYPE="Debug" -DLOG_TO_CALLBACK=ON -DWITH_LOG4C=OFF ../ocsync
cmake -DCMAKE_BUILD_TYPE="Debug" ../ocsync
make
You probably have to satisfy some dependencies. Make sure to install all the
needed development packages. You will need ``iniparser``, ``sqlite3`` as well as
``neon`` for the ownCloud module. ``libssh`` and ``libsmbclient`` are optional
and not required for the client to work. If you want to install the client, run
``make install`` as a final step.
``neon`` for the ownCloud module. Take special care about ``neon``. If that is
missing, the cmake run will succeed but silently not build the ownCloud module.
``libssh`` and ``libsmbclient`` are optional and not required for the client
to work. If you want to install the client, run ``make install`` as a final step.
Next, we build mirall::
cd ../mirall-build
cmake -DCMAKE_BUILD_TYPE="Debug" ../mirall \
-DCSYNC_LIBRARY_PATH=../ocsync-build \
-DCSYNC_INCLUDE_PATH=../ocsync/src
-DCSYNC_BUILD_PATH=/path/to/ocsync-build \
-DCSYNC_INCLUDE_PATH=/path/to/ocsync/src
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
Note that it is important to use absolute pathes for the include- and library
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

@@ -213,12 +213,14 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'owncloud', u'ownCloud Client Manual',
('owncloud.1', 'owncloud', u'File synchronisation desktop utility.',
[u'The ownCloud developers'], 1),
('mirall.1', 'mirall', u'File synchronisation desktop utility.',
[u'The ownCloud developers'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
man_show_urls = True
# -- Options for Texinfo output ------------------------------------------------

31
doc/conffile.rst Normal file
View File

@@ -0,0 +1,31 @@
ownCloud Client reads a configuration file.
On Linux it can be found in:
``$HOME/.local/share/data/ownCloud/owncloud.cfg``
On Windows it can be found in:
``%LOCALAPPDATA%\ownCloud\owncloud.cfg``
On Mac it can be found in:
``$HOME/Library/Application Support/ownCloud``
It contains settings in the ini file format known from Windows.
.. note:: Changes here should be done carefully as wrong settings can cause disfunctionality.
.. note:: Changes may be overwritten by using ownCloud's configuration dialog.
.. note:: The new version is less precise in this regard.
These are config settings that may be changed:
``remotePollinterval`` (default: ``30000``)
Poll time for the remote repository in milliseconds
``maxLogLines`` (default: ``20000``)
Maximum count of log lines shown in the log window
``remotePollinterval``
The frequency used for polling for remote changes on the ownCloud Server.

View File

@@ -1,10 +1,4 @@
.. ownCloud Documentation documentation master file, created by
sphinx-quickstart on Mon Oct 22 23:16:40 2012.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
ownCloud Desktop Client
***********************
.. _contents:
Contents
========
@@ -15,7 +9,6 @@ Contents
install
usage
building
branding
architecture
troubleshooting
glossary

BIN
doc/logo-blue.pdf Normal file

Binary file not shown.

38
doc/mirall.1.rst Normal file
View File

@@ -0,0 +1,38 @@
mirall(1)
---------
SYNOPSIS
========
*mirall* [`OPTIONS`...]
DESCRIPTION
===========
mirall is a file synchronisation desktop utility.
It synchronizes files on your local machine with an ownCloud Server. If you
make a change to the files on one computer, it will flow across the others
using this desktop sync clients.
Normally you start the client by click on the desktop icon or start from the
application menu. After starting an ownCloud icon appears in the system tray.
Options
=======
.. include:: options.rst
Config File
===========
.. include:: conffile.rst
BUGS
====
Please report bugs at https://github.com/owncloud/core/issues.
SEE ALSO
========
`csync(1)`, `mirall(1)`

15
doc/options.rst Normal file
View File

@@ -0,0 +1,15 @@
ownCloud Client supports the following command line switches:
``--logwindow``
open a window to show log output at startup.
``--logfile`` `<filename>`
write log output to file.
``--flushlog``
flush the log file after every write.
``--monoicons``
Use black/white pictograms for systray.

37
doc/owncloud.1.rst Normal file
View File

@@ -0,0 +1,37 @@
owncloud(1)
-----------
SYNOPSIS
========
*owncloud* [`OPTIONS`...]
DESCRIPTION
===========
owncloud is a file synchronisation desktop utility it is based on mirall.
It synchronizes files on your local machine with an ownCloud Server. If you
make a change to the files on one computer, it will flow across the others
using this desktop sync clients.
Normally you start the client by click on the desktop icon or start from the
application menu. After starting an ownCloud icon appears in the system tray.
Options
=======
.. include:: options.rst
Config File
===========
.. include:: conffile.rst
BUGS
====
Please report bugs at https://github.com/owncloud/core/issues.
SEE ALSO
========
`csync(1)`, `mirall(1)`

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

@@ -13,54 +13,12 @@ connections as well as pausing a sync connection.
A right click on the tray icon gives other configuration options.
Command line switches
---------------------
Options
-------
.. index:: command line switches, command line, options, parameters
ownCloud Client supports the following command line switches:
+--------------------------+------------------------------------------------+
| Switch | Action |
+==========================+================================================+
| ``--logwindow`` | open a window to show log output at startup. |
+--------------------------+------------------------------------------------+
| ``--logfile <filename>`` | write log output to file. |
+--------------------------+------------------------------------------------+
| ``--flushlog`` | flush the log file after every write. |
+--------------------------+------------------------------------------------+
.. include:: options.rst
Config File
-----------
.. index:: config file
ownCloud Client reads a configuration file which on Linux can be found at ``$HOME/.local/share/data/ownCloud/owncloud.cfg``
.. todo:: Windows, Mac?
It contains settings in the ini file format known from Windows.
.. note:: Changes here should be done carefully as wrong settings can cause disfunctionality.
These are config settings that may be changed:
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
| Setting | Data Type | Unit | Default | Description |
+===========================+===========+==============+===========+=====================================================+
| ``remotePollinterval`` | integer | milliseconds | ``30000`` | Poll time for the remote repository |
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
| ``localPollinterval`` | integer | milliseconds | ``10000`` | Poll time for local repository |
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
| ``PollTimerExceedFactor`` | integer | n/a | ``10`` | Poll Timer Exceed Factor |
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
| ``maxLogLines`` | integer | lines | ``20000`` | Maximum count of log lines shown in the log window |
+---------------------------+-----------+--------------+-----------+-----------------------------------------------------+
* ``remotePollinterval`` is for systems which have notify for local file system changes (Linux only currently)
this is the frequency it polls for remote changes. The following two values are ignored.
* ``localPollinterval`` is for systems which poll the local file system (currently Win and Mac) this is the
frequency they poll locally. The ``remotePollInterval`` is ignored on these systems.
* ``PollTimerExceedFactor`` sets the exceed factor is the factor after which a remote poll is done. That means the effective
frequency for remote poll is ``localPollInterval * pollTimerExceedFactor``.
.. include:: conffile.rst

48
issue_template.md Normal file
View File

@@ -0,0 +1,48 @@
### Expected behaviour
Tell us what should happen
### Actual behaviour
Tell us what happens instead
### Steps to reproduce
1.
2.
3.
### Server configuration
Operating system:
Web server:
Database:
PHP version:
ownCloud version:
### Client configuration
Client version:
Operating system:
OS language:
Installation path of client:
### Logs
#### output of `owncloud --logwindow` or `owncloud --logfile log.txt`
```
Insert your log output here
```
#### Web server error log
```
Insert your webserver log here
```
#### ownCloud log (data/owncloud.log)
```
Insert your ownCloud log here
```

7
mirall.desktop.in Normal file
View File

@@ -0,0 +1,7 @@
[Desktop Entry]
Categories=Utility;X-SuSE-SyncUtility;
Type=Application
Exec=@APPLICATION_EXECUTABLE@
Name=@APPLICATION_NAME@ desktop sync client
GenericName=Folder Sync
Icon=@APPLICATION_SHORTNAME@

View File

@@ -1,37 +1,14 @@
<RCC>
<qresource prefix="/mirall">
<file>resources/mirall-32.png</file>
<file>resources/mirall-64.png</file>
<file>resources/mirall-128.png</file>
<file>resources/folder-grey-32.png</file>
<file>resources/folder-remote-32.png</file>
<file>resources/folder-grey-22.png</file>
<file>resources/folder-remote-22.png</file>
<file>resources/mirall-22.png</file>
<file>resources/mirall-48.png</file>
<file>resources/folder-grey-48.png</file>
<file>resources/folder-remote-48.png</file>
<file>resources/dialog-close.png</file>
<file>resources/dialog-ok.png</file>
<file>resources/dialog-cancel.png</file>
<file>resources/view-refresh.png</file>
<file>resources/folder-favorites.png</file>
<file>resources/folder-sync-48.png</file>
<file>resources/folder-important.png</file>
<file>resources/folder-remote-32.png</file>
<file>resources/folder-remote.png</file>
<file>resources/folder-sync.png</file>
<file>resources/folder-grey.png</file>
<file>resources/owncloud_splash.png</file>
<file>resources/task-ongoing.png</file>
<file>resources/owncloud-icon-22.png</file>
<file>resources/owncloud-icon-32.png</file>
<file>resources/owncloud-icon-48.png</file>
<file>resources/owncloud-icon-64.png</file>
<file>resources/owncloud-icon-128.png</file>
<file>resources/owncloud-framed-64.png</file>
<file>resources/owncloud-error-48.png</file>
<file>resources/owncloud-sync-48.png</file>
<file>resources/owncloud-sync-ok-48.png</file>
<file>resources/warning-16.png</file>
<file>resources/view-refresh.png</file>
<file>resources/owncloud_logo_blue.png</file>
</qresource>
</RCC>

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

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: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 991 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

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,39 +3,41 @@ include(${QT_USE_FILE})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
QT4_ADD_RESOURCES ( MIRALL_RC_SRC ../mirall.qrc)
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()
QT4_ADD_RESOURCES ( MIRALL_RC_SRC ../theme.qrc)
set(theme_dir ${CMAKE_CURRENT_SOURCE_DIR}/../theme)
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
mirall/proxydialog.ui
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})
@@ -48,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})
@@ -56,59 +60,90 @@ set(libsync_SRCS
mirall/folderman.cpp
mirall/folder.cpp
mirall/folderwatcher.cpp
mirall/gitfolder.cpp
mirall/syncresult.cpp
mirall/unisonfolder.cpp
mirall/networklocation.cpp
mirall/mirallconfigfile.cpp
mirall/credentialstore.cpp
mirall/csyncfolder.cpp
mirall/owncloudfolder.cpp
mirall/csyncthread.cpp
mirall/fileutils.cpp
mirall/theme.cpp
mirall/owncloudtheme.cpp
mirall/miralltheme.cpp
mirall/owncloudinfo.cpp
mirall/logger.cpp
mirall/utility.cpp
mirall/connectionvalidator.cpp
)
set(libsync_HEADERS
mirall/folderman.h
mirall/folder.h
mirall/folderwatcher.h
mirall/gitfolder.h
mirall/unisonfolder.h
mirall/csyncfolder.h
mirall/owncloudfolder.h
mirall/csyncthread.h
mirall/owncloudinfo.h
mirall/credentialstore.h
mirall/logger.h
mirall/connectionvalidator.h
)
IF( INOTIFY_FOUND )
set(libsync_SRCS ${libsync_SRCS} mirall/inotify.cpp)
set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_inotify.cpp)
set(libsync_HEADERS ${libsync_HEADERS} mirall/inotify.h)
set(libsync_HEADERS ${libsync_HEADERS} mirall/folderwatcher_inotify.h)
ENDIF()
IF( WIN32 )
set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_win.cpp)
set(libsync_HEADERS ${libsync_HEADERS} mirall/folderwatcher_win.h)
ENDIF()
IF( APPLE )
set(libsync_SRCS ${libsync_SRCS} mirall/folderwatcher_mac.cpp)
ENDIF()
qt4_wrap_cpp(syncMoc ${libsync_HEADERS})
add_library(mirallsync SHARED ${libsync_SRCS} ${syncMoc})
list(APPEND libsync_LINK_TARGETS
${QT_LIBRARIES}
${CSYNC_LIBRARY}
dl
)
if(QTKEYCHAIN_FOUND)
list(APPEND libsync_LINK_TARGETS ${QTKEYCHAIN_LIBRARY})
include_directories(${QTKEYCHAIN_INCLUDE_DIR})
endif()
add_library(owncloudsync SHARED ${libsync_SRCS} ${syncMoc})
set_target_properties( owncloudsync PROPERTIES COMPILE_DEFINITIONS OWNCLOUD_CLIENT)
target_link_libraries(mirallsync ${QT_LIBRARIES} ${CSYNC_LIBRARY} )
target_link_libraries(owncloudsync ${QT_LIBRARIES} ${CSYNC_LIBRARY} )
set_target_properties( owncloudsync PROPERTIES
VERSION ${VERSION}
SOVERSION ${SOVERSION}
)
target_link_libraries(owncloudsync ${libsync_LINK_TARGETS} )
if ( APPLE )
target_link_libraries(owncloudsync /System/Library/Frameworks/CoreServices.framework)
endif()
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
install(TARGETS mirallsync owncloudsync
install(TARGETS owncloudsync
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
if(NOT WIN32)
configure_file(${CMAKE_SOURCE_DIR}/mirall.desktop.in
${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_SHORTNAME}.desktop)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_SHORTNAME}.desktop DESTINATION share/applications )
endif()
else()
install(TARGETS mirallsync owncloudsync DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
install(TARGETS owncloudsync DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
endif()
set(mirall_SRCS
mirall/application.cpp
mirall/systray.cpp
mirall/folderwizard.cpp
mirall/statusdialog.cpp
mirall/owncloudwizard.cpp
@@ -118,10 +153,12 @@ set(mirall_SRCS
mirall/sslerrordialog.cpp
mirall/logbrowser.cpp
mirall/proxydialog.cpp
mirall/fileitemdialog.cpp
)
set(mirall_HEADERS
mirall/application.h
mirall/systray.h
mirall/folderwizard.h
mirall/owncloudsetupwizard.h
mirall/owncloudwizard.h
@@ -130,6 +167,7 @@ set(mirall_HEADERS
mirall/sslerrordialog.h
mirall/logbrowser.h
mirall/proxydialog.h
mirall/fileitemdialog.h
)
if( UNIX AND NOT APPLE)
@@ -139,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})
@@ -161,15 +199,19 @@ set( final_src
# add executable icon on windows and osx
include( AddAppIconMacro )
set(ownCloud_old ${ownCloud})
kde4_add_app_icon( ownCloud "${CMAKE_CURRENT_SOURCE_DIR}/../resources/owncloud-icon-*.png")
kde4_add_app_icon( ownCloud "${theme_dir}/colored/${APPLICATION_SHORTNAME}-icon*.png")
list(APPEND final_src ${ownCloud})
set(ownCloud ${ownCloud_old})
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
install(FILES ${CMAKE_SOURCE_DIR}/resources/mirall-48.png DESTINATION share/icons/hicolor/48x48/apps/ RENAME mirall.png)
install(FILES ${CMAKE_SOURCE_DIR}/resources/owncloud-icon-48.png DESTINATION share/icons/hicolor/48x48/apps/ RENAME owncloud.png)
if(NOT WIN32)
install(FILES
${theme_dir}/colored/${APPLICATION_SHORTNAME}-icon-48.png
DESTINATION share/icons/hicolor/48x48/apps/ RENAME ${APPLICATION_SHORTNAME}.png)
endif(NOT WIN32)
install(FILES ${mirall_I18N} DESTINATION share/mirall/i18n)
@@ -177,22 +219,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
# add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src})
add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src})
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES COMPILE_DEFINITIONS OWNCLOUD_CLIENT)
# mirall is not built for the bundle
add_executable( mirall WIN32 main.cpp ${final_src})
target_link_libraries(mirall ${QT_LIBRARIES} )
target_link_libraries(mirall mirallsync)
target_link_libraries(mirall ${CSYNC_LIBRARY})
set_target_properties( mirall PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} )
install(TARGETS mirall
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
else()
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
include(DeployQt4)
@@ -202,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 )
@@ -210,8 +236,13 @@ else()
else()
install(FILES /usr/local/lib/ocsync-0/ocsync_owncloud.so DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Plugins)
endif()
install(FILES ${mirall_I18N} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/translations)
set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
install(FILES ${mirall_I18N} DESTINATION ${QM_DIR})
file(GLOB qt_I18N ${QT_TRANSLATIONS_DIR}/qt_??.qm ${QT_TRANSLATIONS_DIR}/qt_??_??.qm)
install(FILES ${qt_I18N} DESTINATION ${QM_DIR})
file(GLOB qtkeychain_I18N ${QT_TRANSLATIONS_DIR}/qtkeychain*.qm)
install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR})
list(APPEND dirs "/usr/local/lib")
endif()
@@ -230,7 +261,7 @@ install(TARGETS ${APPLICATION_EXECUTABLE}
BUNDLE DESTINATION "."
)
#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unneccessary
#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
# currently it needs to be done because the code right above needs to be executed no matter
# if building a bundle or not and the install_qt4_executable needs to be called afterwards
if(BUILD_OWNCLOUD_OSX_BUNDLE)

View File

@@ -32,8 +32,10 @@ int main(int argc, char **argv)
return 0;
}
// if help requested, show on command line and exit.
if( ! app.giveHelp() )
if( ! app.giveHelp() ) {
return app.exec();
} else {
app.showHelp();
}
}

View File

@@ -12,15 +12,14 @@
* for more details.
*/
#define LOG_TO_CALLBACK // FIXME: This should be in csync.
#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"
@@ -30,16 +29,11 @@
#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 <csync.h>
#include <QtCore>
#include <QtGui>
#include <QHash>
@@ -59,9 +53,20 @@ void mirallLogCatcher(QtMsgType type, const char *msg)
Logger::instance()->mirallLog( QString::fromUtf8(msg) );
}
void csyncLogCatcher(const char *msg)
namespace {
QString applicationTrPath()
{
Logger::instance()->csyncLog( QString::fromUtf8(msg) );
#ifdef Q_OS_LINUX
// FIXME - proper path!
return QLatin1String("/usr/share/mirall/i18n/");
#endif
#ifdef Q_OS_MAC
return QApplication::applicationDirPath()+QLatin1String("/../Resources/Translations"); // path defaults to app dir.
#endif
#ifdef Q_OS_WIN32
return QApplication::applicationDirPath();
#endif
}
}
// ----------------------------------------------------------------------------------
@@ -69,56 +74,37 @@ void csyncLogCatcher(const char *msg)
Application::Application(int &argc, char **argv) :
SharedTools::QtSingleApplication(argc, argv),
_tray(0),
_sslErrorDialog(0),
#if QT_VERSION >= 0x040700
_networkMgr(new QNetworkConfigurationManager(this)),
#endif
_sslErrorDialog(0),
_contextMenu(0),
_theme(Theme::instance()),
_updateDetector(0),
_logBrowser(0),
_showLogWindow(false),
_logFlush(false),
_helpOnly(false),
_logBrowser(0)
_fileItemDialog(0),
_statusDialog(0)
{
setApplicationName( _theme->appName() );
setApplicationName( _theme->appNameGUI() );
setWindowIcon( _theme->applicationIcon() );
parseOptions(arguments());
setupTranslations();
setupLogBrowser();
//no need to waste time;
if ( _helpOnly ) return;
processEvents();
QTranslator *qtTranslator = new QTranslator(this);
qtTranslator->load(QLatin1String("qt_") + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
installTranslator(qtTranslator);
QTranslator *mirallTranslator = new QTranslator(this);
QString locale = Theme::instance()->enforcedLocale();
if (locale.isEmpty()) locale = QLocale::system().name();
#ifdef Q_OS_LINUX
// FIXME - proper path!
mirallTranslator->load(QLatin1String("mirall_") + locale, QLatin1String("/usr/share/mirall/i18n/"));
#endif
#ifdef Q_OS_MAC
mirallTranslator->load(QLatin1String("mirall_") + locale, applicationDirPath()+QLatin1String("/../translations") ); // path defaults to app dir.
#endif
#ifdef Q_OS_WIN32
mirallTranslator->load(QLatin1String("mirall_") + locale, applicationDirPath());
#endif
installTranslator(mirallTranslator);
connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString)));
connect( Logger::instance(), SIGNAL(guiLog(QString,QString)),
this, SLOT(slotShowTrayMessage(QString,QString)));
// create folder manager for sync folder management
_folderMan = new FolderMan(this);
connect( _folderMan, SIGNAL(folderSyncStateChange(QString)),
this,SLOT(slotSyncStateChange(QString)));
_folderMan->setSyncEnabled(false);
/* use a signal mapper to map the open requests to the alias names */
_folderOpenActionMapper = new QSignalMapper(this);
@@ -130,16 +116,14 @@ Application::Application(int &argc, char **argv) :
_folderWizard = new FolderWizard;
_owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme, this );
connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), SLOT(slotStartFolderSetup(int)));
connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)),
this, SLOT(slotownCloudWizardDone(int)));
_statusDialog = new StatusDialog( _theme );
connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) );
connect( _statusDialog, SIGNAL(removeFolderAlias( const QString&)),
SLOT(slotRemoveFolder(const QString&)));
connect( _statusDialog, SIGNAL(openLogBrowser()), this, SLOT(slotOpenLogBrowser()));
connect( _statusDialog, SIGNAL(enableFolderAlias(QString,bool)),
SLOT(slotEnableFolder(QString,bool)));
connect( _statusDialog, SIGNAL(infoFolderAlias(const QString&)),
@@ -147,17 +131,21 @@ Application::Application(int &argc, char **argv) :
connect( _statusDialog, SIGNAL(openFolderAlias(const QString&)),
SLOT(slotFolderOpenAction(QString)));
#if 0
#if QT_VERSION >= 0x040700
qDebug() << "* Network is" << (_networkMgr->isOnline() ? "online" : "offline");
foreach (const QNetworkConfiguration& netCfg, _networkMgr->allConfigurations(QNetworkConfiguration::Active)) {
//qDebug() << "Network:" << netCfg.identifier();
}
#endif
#endif
setupActions();
setupSystemTray();
setupProxy();
processEvents();
int cnt = _folderMan->setupFolders();
_statusDialog->setFolderList( _folderMan->map() );
QObject::connect( this, SIGNAL(messageReceived(QString)),
this, SLOT(slotOpenStatus()) );
@@ -178,6 +166,8 @@ Application::Application(int &argc, char **argv) :
Application::~Application()
{
delete _tray; // needed, see ctor
delete _fileItemDialog;
delete _statusDialog;
qDebug() << "* Mirall shutdown";
}
@@ -200,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.";
@@ -221,9 +211,9 @@ void Application::slotOwnCloudFound( const QString& url, const QString& versionS
this, SLOT(slotNoOwnCloudFound(QNetworkReply*)));
if( version.startsWith("4.0") ) {
QMessageBox::warning(0, tr("%1 Server Mismatch").arg(_theme->appName()),
QMessageBox::warning(0, tr("%1 Server Mismatch").arg(_theme->appNameGUI()),
tr("<p>The configured server for this client is too old.</p>"
"<p>Please update to the latest %1 server and restart the client.</p>").arg(_theme->appName()));
"<p>Please update to the latest %1 server and restart the client.</p>").arg(_theme->appNameGUI()));
return;
}
@@ -232,17 +222,10 @@ void Application::slotOwnCloudFound( const QString& url, const QString& versionS
void Application::slotNoOwnCloudFound( QNetworkReply* reply )
{
qDebug() << "** Application: NO ownCloud found!";
QString msg;
if( reply ) {
QString url( reply->url().toString() );
url.remove( QLatin1String("/status.php") );
msg = tr("<p>The %1 at %2 could not be reached.</p>").arg(_theme->appName()).arg( url );
msg += tr("<p>The detailed error message is<br/><tt>%1</tt></p>").arg( reply->errorString() );
}
msg += tr("<p>Please check your configuration by clicking on the tray icon.</p>");
Q_UNUSED(reply)
qDebug() << "** Application: NO ownCloud found! Going offline";
QMessageBox::warning(0, tr("%1 Connection Failed").arg(_theme->appName()), msg );
_actionAddFolder->setEnabled( false );
// Disconnect.
@@ -256,15 +239,27 @@ void Application::slotNoOwnCloudFound( QNetworkReply* reply )
this,SLOT(slotAuthCheck(QString,QNetworkReply*)));
setupContextMenu();
QTimer::singleShot( 30*1000, this, SLOT( slotStartFolderSetup() ));
}
void Application::slotFetchCredentials()
{
connect( CredentialStore::instance(), SIGNAL(fetchCredentialsFinished(bool)),
this, SLOT(slotCredentialsFetched(bool)) );
CredentialStore::instance()->fetchCredentials();
if( CredentialStore::instance()->state() == CredentialStore::TooManyAttempts ) {
QString trayMessage = tr("Too many user attempts to enter password.");
QString trayMessage;
if( CredentialStore::instance()->canTryAgain() ) {
connect( CredentialStore::instance(), SIGNAL(fetchCredentialsFinished(bool)),
this, SLOT(slotCredentialsFetched(bool)) );
CredentialStore::instance()->fetchCredentials();
if( CredentialStore::instance()->state() == CredentialStore::TooManyAttempts ) {
trayMessage = tr("Too many incorrect password attempts.");
}
} else {
qDebug() << "Can not try again to fetch Credentials.";
trayMessage = tr("%1 user credentials are wrong. Please check configuration.")
.arg(Theme::instance()->appNameGUI());
}
if( !trayMessage.isEmpty() ) {
_tray->showMessage(tr("Credentials"), trayMessage);
_actionOpenStatus->setEnabled( false );
_actionAddFolder->setEnabled( false );
@@ -279,6 +274,8 @@ void Application::slotCredentialsFetched(bool ok)
trayMessage = tr("Error: Could not retrieve the password!");
if( CredentialStore::instance()->state() == CredentialStore::UserCanceled ) {
trayMessage = tr("Password dialog was canceled!");
} else {
trayMessage = CredentialStore::instance()->errorMessage();
}
if( !trayMessage.isEmpty() ) {
@@ -289,6 +286,8 @@ void Application::slotCredentialsFetched(bool ok)
_actionAddFolder->setEnabled( false );
_actionOpenStatus->setEnabled( false );
} else {
ownCloudInfo::instance()->setCredentials( CredentialStore::instance()->user(),
CredentialStore::instance()->password() );
// Credential fetched ok.
QTimer::singleShot( 0, this, SLOT( slotCheckAuthentication() ));
}
@@ -312,16 +311,16 @@ void Application::slotAuthCheck( const QString& ,QNetworkReply *reply )
if( reply->error() == QNetworkReply::AuthenticationRequiredError ) { // returned if the user is wrong.
qDebug() << "******** Password is wrong!";
QMessageBox::warning(0, tr("No %1 Connection").arg(_theme->appName()),
QMessageBox::warning(0, tr("No %1 Connection").arg(_theme->appNameGUI()),
tr("<p>Your %1 credentials are not correct.</p>"
"<p>Please correct them by starting the configuration dialog from the tray!</p>")
.arg(_theme->appName()));
.arg(_theme->appNameGUI()));
_actionAddFolder->setEnabled( false );
ok = false;
} else if( reply->error() == QNetworkReply::OperationCanceledError ) {
// the username was wrong and ownCloudInfo was closing the request after a couple of auth tries.
qDebug() << "******** Username or password is wrong!";
QMessageBox::warning(0, tr("No %1 Connection").arg(_theme->appName()),
QMessageBox::warning(0, tr("No %1 Connection").arg(_theme->appNameGUI()),
tr("<p>Either your user name or your password are not correct.</p>"
"<p>Please correct it by starting the configuration dialog from the tray!</p>"));
_actionAddFolder->setEnabled( false );
@@ -334,20 +333,24 @@ void Application::slotAuthCheck( const QString& ,QNetworkReply *reply )
if( ok ) {
qDebug() << "######## Credentials are ok!";
int cnt = _folderMan->setupFolders();
if( cnt ) {
_tray->setIcon(_theme->applicationIcon());
_tray->show();
processEvents();
_folderMan->setSyncEnabled(true);
QMetaObject::invokeMethod(_folderMan, "slotScheduleFolderSync");
if( _tray )
_tray->showMessage(tr("%1 Sync Started").arg(_theme->appName()),
tr("Sync started for %1 configured sync folder(s).").arg(cnt));
_tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) );
_tray->show();
int cnt = _folderMan->map().size();
if( _tray )
_tray->showMessage(tr("%1 Sync Started").arg(_theme->appNameGUI()),
tr("Sync started for %1 configured sync folder(s).").arg(cnt));
// queue up the sync for all folders.
_folderMan->slotScheduleAllFolders();
computeOverallSyncStatus();
_statusDialog->setFolderList( _folderMan->map() );
computeOverallSyncStatus();
}
_actionAddFolder->setEnabled( true );
_actionOpenStatus->setEnabled( true );
setupContextMenu();
} else {
slotFetchCredentials();
@@ -390,12 +393,24 @@ void Application::slotSSLFailed( QNetworkReply *reply, QList<QSslError> errors )
}
}
void Application::slotownCloudWizardDone( int res )
{
if( res == QDialog::Accepted ) {
int cnt = _folderMan->setupFolders();
qDebug() << "Set up " << cnt << " folders.";
_statusDialog->setFolderList( _folderMan->map() );
}
_folderMan->setSyncEnabled( true );
slotStartFolderSetup( res );
}
void Application::setupActions()
{
_actionOpenoC = new QAction(tr("Open %1 in browser...").arg(_theme->appName()), this);
_actionOpenoC = new QAction(tr("Open %1 in browser...").arg(_theme->appNameGUI()), this);
QObject::connect(_actionOpenoC, SIGNAL(triggered(bool)), SLOT(slotOpenOwnCloud()));
_actionOpenStatus = new QAction(tr("Open status..."), this);
QObject::connect(_actionOpenStatus, SIGNAL(triggered(bool)), SLOT(slotOpenStatus()));
_actionOpenStatus->setEnabled( false );
_actionAddFolder = new QAction(tr("Add folder..."), this);
QObject::connect(_actionAddFolder, SIGNAL(triggered(bool)), SLOT(slotAddFolder()));
_actionConfigure = new QAction(tr("Configure..."), this);
@@ -412,8 +427,8 @@ 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->setIcon( _theme->applicationIcon() ); // load the grey icon
_tray = new Systray();
_tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) );
connect(_tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)));
@@ -439,7 +454,7 @@ void Application::setupContextMenu()
// it will trigger a bug in Ubuntu's SNI bridge patch (11.10, 12.04).
_tray->setContextMenu(_contextMenu);
}
_contextMenu->setTitle(_theme->appName() );
_contextMenu->setTitle(_theme->appNameGUI() );
_contextMenu->addAction(_actionOpenStatus);
_contextMenu->addAction(_actionOpenoC);
@@ -458,7 +473,7 @@ void Application::setupContextMenu()
Folder *folder = _folderMan->map().value(li.first());
if( folder ) {
// if there is singleFolder mode, a generic open action is displayed.
QAction *action = new QAction( tr("Open %1 folder").arg(_theme->appName()), this);
QAction *action = new QAction( tr("Open %1 folder").arg(_theme->appNameGUI()), this);
action->setIcon( _theme->trayFolderIcon( folder->backend()) );
connect( action, SIGNAL(triggered()),_folderOpenActionMapper,SLOT(map()));
@@ -489,8 +504,11 @@ void Application::setupContextMenu()
_contextMenu->addAction(_actionConfigure);
_contextMenu->addAction(_actionConfigureProxy);
_contextMenu->addSeparator();
_contextMenu->addAction(_actionAbout);
_contextMenu->addSeparator();
if (!Theme::instance()->about().isEmpty()) {
_contextMenu->addAction(_actionAbout);
_contextMenu->addSeparator();
}
_contextMenu->addAction(_actionQuit);
}
@@ -502,7 +520,6 @@ void Application::setupLogBrowser()
// init the log browser.
_logBrowser = new LogBrowser;
qInstallMsgHandler( mirallLogCatcher );
csync_set_log_callback( csyncLogCatcher );
// ## TODO: allow new log name maybe?
if (!_logFile.isEmpty()) {
qDebug() << "Logging into logfile: " << _logFile << " with flush " << _logFlush;
@@ -513,44 +530,50 @@ void Application::setupLogBrowser()
if (_showLogWindow)
slotOpenLogBrowser();
qDebug() << QString::fromLatin1( "################## %1 %2 %3 ").arg(_theme->appName())
qDebug() << QString::fromLatin1( "################## %1 %2 (%3) %4").arg(_theme->appName())
.arg( QLocale::system().name() )
.arg(property("ui_lang").toString())
.arg(_theme->version());
}
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();
}
/*
@@ -590,7 +613,8 @@ void Application::slotTrayClicked( QSystemTrayIcon::ActivationReason reason )
// A click on the tray icon should only open the status window on Win and
// Linux, not on Mac. They want a menu entry.
// If the user canceled login, rather open the login window.
if( CredentialStore::instance()->state() == CredentialStore::UserCanceled ) {
if( CredentialStore::instance()->state() == CredentialStore::UserCanceled ||
CredentialStore::instance()->state() == CredentialStore::Error ) {
slotFetchCredentials();
}
#if defined Q_WS_WIN || defined Q_WS_X11
@@ -602,7 +626,7 @@ void Application::slotTrayClicked( QSystemTrayIcon::ActivationReason reason )
void Application::slotAddFolder()
{
_folderMan->disableFoldersWithRestore();
_folderMan->setSyncEnabled(false); // do not start more syncs.
Folder::Map folderMap = _folderMan->map();
@@ -617,28 +641,13 @@ 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();
} 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.
if( goodData ) {
_folderMan->addFolderDefinition( backend, alias, sourceFolder, targetPath, onlyThisLAN );
@@ -653,7 +662,8 @@ void Application::slotAddFolder()
} else {
qDebug() << "* Folder wizard cancelled";
}
_folderMan->restoreEnabledFolders();
_folderMan->setSyncEnabled(true);
_folderMan->slotScheduleAllFolders();
}
void Application::slotOpenStatus()
@@ -673,14 +683,19 @@ void Application::slotOpenStatus()
if( !cfgFile.exists() ) {
qDebug() << "No configured folders yet, start the Owncloud integration dialog.";
_owncloudSetupWizard->startWizard(true); // with intro
_folderMan->setSyncEnabled(false);
_owncloudSetupWizard->startWizard();
} else {
qDebug() << "#============# Status dialog starting #=============#";
raiseWidget = _statusDialog;
_statusDialog->setFolderList( _folderMan->map() );
}
}
raiseDialog( raiseWidget );
}
void Application::raiseDialog( QWidget *raiseWidget )
{
// viel hilft viel ;-)
if( raiseWidget ) {
#if defined(Q_WS_WIN) || defined (Q_OS_MAC)
@@ -705,10 +720,8 @@ void Application::slotOpenLogBrowser()
void Application::slotAbout()
{
QMessageBox::about(0, tr("About %1").arg(_theme->appName()),
tr("%1 client, version %2\n\nCopyright 2012, the ownCloud developers.")
.arg(_theme->appName())
.arg(MIRALL_STRINGIFY(MIRALL_VERSION)));
QMessageBox::about(0, tr("About %1").arg(_theme->appNameGUI()),
Theme::instance()->about());
}
/*
@@ -735,80 +748,19 @@ void Application::slotRemoveFolder( const QString& alias )
setupContextMenu();
}
// Open the File list info dialog.
void Application::slotInfoFolder( const QString& alias )
{
qDebug() << "details of folder with alias " << alias;
if( !_fileItemDialog ) {
_fileItemDialog = new FileItemDialog(_theme);
}
SyncResult folderResult = _folderMan->syncResult( alias );
bool enabled = true;
Folder *f = _folderMan->folder( alias );
if( f && ! f->syncEnabled() ) {
enabled = false;
}
QString folderMessage;
SyncResult::Status syncStatus = folderResult.status();
switch( syncStatus ) {
case SyncResult::Undefined:
folderMessage = tr( "Undefined Folder State" );
break;
case SyncResult::NotYetStarted:
folderMessage = tr( "The folder waits to start syncing." );
break;
case SyncResult::SyncRunning:
folderMessage = tr("Sync is running.");
break;
case SyncResult::Success:
folderMessage = tr("Last Sync was successful.");
break;
case SyncResult::Error:
folderMessage = tr( "Syncing Error." );
break;
case SyncResult::SetupError:
folderMessage = tr( "Setup Error." );
break;
default:
folderMessage = tr( "Undefined Error State." );
}
folderMessage = QLatin1String("<b>") + folderMessage + QLatin1String("</b><br/>");
QMessageBox infoBox( QMessageBox::Information, tr( "Folder information" ), alias, QMessageBox::Ok );
QStringList li = folderResult.errorStrings();
foreach( const QString& l, li ) {
folderMessage += QString::fromLatin1("<p>%1</p>").arg( l );
}
infoBox.setText( folderMessage );
// qDebug() << "informative text: " << infoBox.informativeText();
if ( !folderResult.syncChanges().isEmpty() ) {
QString details;
QHash < QString, QStringList > changes = folderResult.syncChanges();
QHash< QString, QStringList >::const_iterator change_it = changes.constBegin();
for(; change_it != changes.constEnd(); ++change_it ) {
QString changeType = tr( "Unknown" );
if ( change_it.key() == QLatin1String("changed") ) {
changeType = tr( "Changed files:\n" );
} else if ( change_it.key() == QLatin1String("added") ) {
changeType = tr( "Added files:\n" );
} else if ( change_it.key() == QLatin1String("deleted") ) {
changeType = tr( "New files in the server, or files deleted locally:\n");
}
QStringList files = change_it.value();
QString fileList;
foreach( const QString& file, files) {
fileList += file + QLatin1Char('\n');
}
details += changeType + fileList;
}
infoBox.setDetailedText(details);
qDebug() << "detailed text: " << infoBox.detailedText();
}
infoBox.exec();
_fileItemDialog->setSyncResult( folderResult );
raiseDialog( _fileItemDialog );
}
void Application::slotEnableFolder(const QString& alias, const bool enable)
@@ -842,9 +794,11 @@ void Application::slotEnableFolder(const QString& alias, const bool enable)
void Application::slotConfigure()
{
_folderMan->disableFoldersWithRestore();
_owncloudSetupWizard->startWizard(false);
_folderMan->restoreEnabledFolders();
_folderMan->setSyncEnabled(false); // do not start more syncs.
if (!_owncloudSetupWizard->wizard()->isVisible())
_owncloudSetupWizard->startWizard();
else
raiseDialog(_owncloudSetupWizard->wizard());
}
void Application::slotConfigureProxy()
@@ -863,13 +817,19 @@ void Application::slotParseOptions(const QString &opts)
setupLogBrowser();
}
void Application::slotShowTrayMessage(const QString &title, const QString &msg)
{
_tray->showMessage(title, msg);
}
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) );
}
computeOverallSyncStatus();
@@ -882,10 +842,12 @@ void Application::parseOptions(const QStringList &options)
// skip file name;
if (it.hasNext()) it.next();
//parse options; if help or bad option exit
while (it.hasNext()) {
QString option = it.next();
if (option == QLatin1String("--help")) {
showHelp();
if (option == QLatin1String("--help") || option == QLatin1String("-h")) {
setHelp();
break;
} else if (option == QLatin1String("--logwindow") ||
option == QLatin1String("-l")) {
_showLogWindow = true;
@@ -893,12 +855,24 @@ void Application::parseOptions(const QStringList &options)
if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) {
_logFile = it.next();
} else {
showHelp();
setHelp();
}
} else if (option == QLatin1String("--logflush")) {
_logFlush = true;
} else if (option == QLatin1String("--monoicons")) {
_theme->setSystrayUseMonoIcons(true);
} 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()
@@ -915,46 +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::SyncRunning:
folderMessage = tr( "Sync is running." );
overallResult.setStatus( SyncResult::SyncRunning );
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();
@@ -972,7 +952,7 @@ void Application::computeOverallSyncStatus()
else
trayMessage = tr("No sync folders configured.");
QIcon statusIcon = _theme->syncStateIcon( overallResult.status()); // size 48 before
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), true); // size 48 before
_tray->setIcon( statusIcon );
_tray->setToolTip(trayMessage);
@@ -981,19 +961,97 @@ void Application::computeOverallSyncStatus()
void Application::showHelp()
{
setHelp();
std::cout << _theme->appName().toLatin1().constData() << " version " <<
_theme->version().toLatin1().constData() << std::endl << std::endl;
std::cout << "File synchronisation desktop utility." << std::endl << std::endl;
std::cout << "Options:" << std::endl;
std::cout << " -h --help : show this help screen." << std::endl;
std::cout << " --logwindow : open a window to show log output." << std::endl;
std::cout << " --logfile <filename> : write log output to file <filename>." << std::endl;
std::cout << " --flushlog : flush the log file after every write." << 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;
}
void Application::setHelp()
{
_helpOnly = true;
}
QString substLang(const QString &lang)
{
// Map the more apropriate script codes
// to country codes as used by Qt and
// transifex translation conventions.
// Simplified Chinese
if (lang == QLatin1String("zh_Hans"))
return QLatin1String("zh_CN");
// Traditional Chinese
if (lang == QLatin1String("zh_Hant"))
return QLatin1String("zh_TW");
return lang;
}
void Application::setupTranslations()
{
QStringList uiLanguages;
// uiLanguages crashes on Windows with 4.8.0 release builds
#if (QT_VERSION >= 0x040801) || (QT_VERSION >= 0x040800 && !defined(Q_OS_WIN))
uiLanguages = QLocale::system().uiLanguages();
#else
// older versions need to fall back to the systems locale
uiLanguages << QLocale::system().name();
#endif
QString enforcedLocale = Theme::instance()->enforcedLocale();
if (!enforcedLocale.isEmpty())
uiLanguages.prepend(enforcedLocale);
QTranslator *translator = new QTranslator(this);
QTranslator *qtTranslator = new QTranslator(this);
QTranslator *qtkeychainTranslator = new QTranslator(this);
foreach(QString lang, uiLanguages) {
lang.replace(QLatin1Char('-'), QLatin1Char('_')); // work around QTBUG-25973
lang = substLang(lang);
const QString trPath = applicationTrPath();
const QString trFile = QLatin1String("mirall_") + lang;
if (translator->load(trFile, trPath) ||
lang.startsWith(QLatin1String("en"))) {
// Permissive approach: Qt and keychain translations
// may be missing, but Qt translations must be there in order
// for us to accept the language. Otherwise, we try with the next.
// "en" is an exeption as it is the default language and may not
// have a translation file provided.
qDebug() << Q_FUNC_INFO << "Using" << lang << "translation";
setProperty("ui_lang", lang);
const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
const QString qtTrFile = QLatin1String("qt_") + lang;
if (qtTranslator->load(qtTrFile, qtTrPath)) {
qtTranslator->load(qtTrFile, trPath);
}
const QString qtkeychainFile = QLatin1String("qt_") + lang;
if (!qtkeychainTranslator->load(qtkeychainFile, qtTrPath)) {
qtkeychainTranslator->load(qtkeychainFile, trPath);
}
if (!translator->isEmpty())
installTranslator(translator);
if (!qtTranslator->isEmpty())
installTranslator(qtTranslator);
if (!qtkeychainTranslator->isEmpty())
installTranslator(qtkeychainTranslator);
break;
}
if (property("ui_lang").isNull())
setProperty("ui_lang", "C");
}
}
bool Application::giveHelp()
{
return _helpOnly;

View File

@@ -16,7 +16,6 @@
#define APPLICATION_H
#include <QApplication>
#include <QSystemTrayIcon>
#include <QNetworkReply>
#include <QSslError>
@@ -26,6 +25,8 @@
#include "mirall/folder.h"
#include "mirall/logbrowser.h"
#include "mirall/folderman.h"
#include "mirall/fileitemdialog.h"
#include "mirall/systray.h"
class QAction;
class QMenu;
@@ -52,6 +53,7 @@ public:
~Application();
bool giveHelp();
void showHelp();
signals:
@@ -64,11 +66,14 @@ protected slots:
void slotConfigure();
void slotConfigureProxy();
void slotParseOptions( const QString& );
void slotShowTrayMessage(const QString&, const QString&);
void slotSyncStateChange( const QString& );
void slotownCloudWizardDone(int);
protected:
void parseOptions(const QStringList& );
void setupTranslations();
void setupActions();
void setupSystemTray();
void setupContextMenu();
@@ -95,10 +100,11 @@ protected slots:
void slotStartUpdateDetector();
private:
void showHelp();
void setHelp();
void raiseDialog( QWidget* );
// configuration file -> folder
QSystemTrayIcon *_tray;
Systray *_tray;
QAction *_actionQuit;
QAction *_actionAddFolder;
QAction *_actionOpenStatus;
@@ -118,6 +124,7 @@ private:
// tray's menu
QMenu *_contextMenu;
StatusDialog *_statusDialog;
FileItemDialog *_fileItemDialog;
FolderMan *_folderMan;
Theme *_theme;
@@ -128,7 +135,7 @@ private:
QString _logFile;
bool _showLogWindow;
bool _logFlush;
bool _helpOnly;
bool _helpOnly;
};
} // namespace Mirall

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

@@ -12,18 +12,35 @@
*/
#include <QtGui>
#include <QInputDialog>
#include "config.h"
#include "mirall/credentialstore.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/theme.h"
#ifdef WITH_QTKEYCHAIN
#include <qtkeychain/keychain.h>
using namespace QKeychain;
#endif
#define MAX_LOGIN_ATTEMPTS 3
namespace Mirall {
CredentialStore *CredentialStore::_instance=0;
CredentialStore::CredState CredentialStore::_state = NotFetched;
QString CredentialStore::_passwd = QString::null;
QString CredentialStore::_user = QString::null;
int CredentialStore::_tries = 0;
QString CredentialStore::_passwd = QString::null;
QString CredentialStore::_user = QString::null;
QString CredentialStore::_url = QString::null;
QString CredentialStore::_errorMsg = QString::null;
int CredentialStore::_tries = 0;
#ifdef WITH_QTKEYCHAIN
CredentialStore::CredentialType CredentialStore::_type = KeyChain;
#else
CredentialStore::CredentialType CredentialStore::_type = Settings;
#endif
CredentialStore::CredentialStore(QObject *parent) :
QObject(parent)
@@ -36,11 +53,11 @@ CredentialStore *CredentialStore::instance()
return CredentialStore::_instance;
}
QString CredentialStore::password( const QString& ) const
QString CredentialStore::password() const
{
return _passwd;
}
QString CredentialStore::user( const QString& ) const
QString CredentialStore::user() const
{
return _user;
}
@@ -50,58 +67,95 @@ CredentialStore::CredState CredentialStore::state()
return _state;
}
bool CredentialStore::canTryAgain()
{
bool canDoIt = false;
if( _tries > MAX_LOGIN_ATTEMPTS ) {
qDebug() << "canTryAgain: Max attempts reached.";
return false;
}
/* Since QtKeyChain is required now, it makes to only
* query once. */
if( _state == NotFetched || _state == AsyncWriting ) {
return true;
} else {
return false;
}
}
void CredentialStore::fetchCredentials()
{
_state = Fetching;
MirallConfigFile cfgFile;
MirallConfigFile::CredentialType t;
if( _tries++ == 3 ) {
if( ++_tries > MAX_LOGIN_ATTEMPTS ) {
qDebug() << "Too many attempts to enter password!";
_state = TooManyAttempts;
emit( fetchCredentialsFinished(false) );
return;
}
t = cfgFile.credentialType();
bool ok = false;
QString pwd;
_state = Fetching;
_user = cfgFile.ownCloudUser();
_url = cfgFile.ownCloudUrl();
if( !cfgFile.passwordStorageAllowed() ) {
_type = CredentialStore::User;
}
switch( t ) {
case MirallConfigFile::User: {
QString key = keyChainKey(_url);
if( key.isNull() ) {
qDebug() << "Can not fetch credentials, url is zero!";
_state = Error;
emit( fetchCredentialsFinished(false) );
return;
}
switch( _type ) {
case CredentialStore::User: {
/* Ask the user for the password */
/* Fixme: Move user interaction out here. */
pwd = QInputDialog::getText(0, QApplication::translate("MirallConfigFile","Password Required"),
QApplication::translate("MirallConfigFile","Please enter your %1 password:")
.arg(Theme::instance()->appName()),
QLineEdit::Password,
QString::null, &ok);
if( !ok ) {
_state = UserCanceled;
}
_state = AsyncFetching;
_inputDialog = new QInputDialog;
_inputDialog->setWindowTitle(QApplication::translate("MirallConfigFile","Password Required") );
_inputDialog->setLabelText( QApplication::translate("MirallConfigFile","Please enter your %1 password:")
.arg(Theme::instance()->appNameGUI()));
_inputDialog->setInputMode( QInputDialog::TextInput );
_inputDialog->setTextEchoMode( QLineEdit::Password );
connect(_inputDialog, SIGNAL(finished(int)), SLOT(slotUserDialogDone(int)));
_inputDialog->exec();
break;
}
case MirallConfigFile::Settings: {
case CredentialStore::Settings: {
/* Read from config file. */
_state = Fetching;
pwd = cfgFile.ownCloudPasswd();
ok = true;
break;
}
case MirallConfigFile::KeyChain: {
/* Qt Keychain is not yet implemented. */
#ifdef HAVE_QTKEYCHAIN
case CredentialStore::KeyChain: {
// If the credentials are here already, return.
if( _state == Ok || _state == AsyncWriting ) {
emit(fetchCredentialsFinished(true));
return;
}
// otherwise fetch asynchronious.
#ifdef WITH_QTKEYCHAIN
_state = AsyncFetching;
if( !_user.isEmpty() ) {
ReadPasswordJoei b job( QLatin1String(Theme::instance()->appName()) );
job.setAutoDelete( false );
job.setKey( _user );
ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName());
job->setKey( key );
job.connect( &job, SIGNAL(finished(QKeychain::Job*)), this,
SLOT(slotKeyChainFinished(QKeyChain::Job*)));
job.start();
connect( job, SIGNAL(finished(QKeychain::Job*)), this,
SLOT(slotKeyChainReadFinished(QKeychain::Job*)));
job->start();
}
#else
qDebug() << "QtKeyChain: Not yet implemented!";
_state = Error;
#endif
break;
}
@@ -110,45 +164,237 @@ void CredentialStore::fetchCredentials()
}
}
if( ok ) {
_passwd = pwd;
_state = Ok;
}
if( !ok && _state == Fetching ) {
_state = Error;
}
emit( fetchCredentialsFinished(ok) );
}
#ifdef HAVE_QTKEYCHAIN
void CredentialsStore::slotKeyChainFinished(QKeyChain::Job* job)
{
if( job ) {
if( job->error() ) {
qDebug() << "Error mit keychain: " << job->errorString();
} else {
_passwd = job.textData();
if( _state == Fetching ) { // ...but not AsyncFetching
if( ok ) {
_passwd = pwd;
_state = Ok;
}
if( !ok && _state == Fetching ) {
_state = Error;
}
emit( fetchCredentialsFinished(ok) );
} else {
// in case of AsyncFetching nothing happens here. The finished-Slot
// will emit the finish signal.
}
}
#endif
QByteArray CredentialStore::basicAuthHeader() const
void CredentialStore::slotUserDialogDone( int result )
{
QString concatenated = _user + QLatin1Char(':') + _passwd;
const QString b(QLatin1String("Basic "));
QByteArray data = b.toLocal8Bit() + concatenated.toLocal8Bit().toBase64();
return data;
if( result == QDialog::Accepted ) {
_passwd = _inputDialog->textValue();
_state = Ok;
} else {
_state = UserCanceled;
_passwd = QString::null;
}
_inputDialog->deleteLater();
emit(fetchCredentialsFinished(_state == Ok));
}
void CredentialStore::setCredentials( const QString& user, const QString& pwd )
void CredentialStore::reset()
{
_state = NotFetched;
_user = QString::null;
_passwd = QString::null;
_tries = 0;
}
QString CredentialStore::keyChainKey( const QString& url ) const
{
QString u(url);
if( u.isEmpty() ) {
qDebug() << "Empty url in keyChain, error!";
return QString::null;
}
if( _user.isEmpty() ) {
qDebug() << "Error: User is emty!";
return QString::null;
}
if( !u.endsWith(QChar('/')) ) {
u.append(QChar('/'));
}
QString key = _user+QLatin1Char(':')+u;
return key;
}
void CredentialStore::slotKeyChainReadFinished(QKeychain::Job* job)
{
#ifdef WITH_QTKEYCHAIN
ReadPasswordJob *pwdJob = static_cast<ReadPasswordJob*>(job);
if( pwdJob ) {
switch( pwdJob->error() ) {
case QKeychain::NoError:
_passwd = pwdJob->textData();
#ifdef Q_OS_LINUX
// Currently there is a bug in the keychain on linux that if no
// entry is there, an empty password comes back, but no error.
if( _passwd.isEmpty() ) {
_state = EntryNotFound;
_errorMsg = tr("No password entry found in keychain. Please reconfigure.");
} else
#endif
_state = Ok;
break;
case QKeychain::EntryNotFound:
_state = EntryNotFound;
break;
case QKeychain::CouldNotDeleteEntry:
_state = Error;
break;
case QKeychain::AccessDeniedByUser:
_state = AccessDeniedByUser;
break;
case QKeychain::AccessDenied:
_state = AccessDenied;
break;
case QKeychain::NoBackendAvailable:
_state = NoKeychainBackend;
break;
case QKeychain::NotImplemented:
_state = NoKeychainBackend;
break;
case QKeychain::OtherError:
default:
_state = Error;
}
/* In case there is no backend, tranparentely switch to Settings file. */
if( _state == NoKeychainBackend ) {
qDebug() << "No Storage Backend, falling back to Settings mode.";
_type = CredentialStore::Settings;
fetchCredentials();
return;
}
if( _state == EntryNotFound ) {
// try to migrate.
}
if( _state != Ok ) {
qDebug() << "Error with keychain: " << pwdJob->errorString();
if(_errorMsg.isEmpty()) _errorMsg = pwdJob->errorString();
} else {
_errorMsg = QString::null;
}
} else {
_state = Error;
qDebug() << "Error: KeyChain Read Password Job failed!";
}
emit(fetchCredentialsFinished(_state == Ok));
#else
(void) job;
#endif
}
QString CredentialStore::errorMessage()
{
return _errorMsg;
}
void CredentialStore::setCredentials( const QString& url, const QString& user,
const QString& pwd, bool allowToStore )
{
_passwd = pwd;
_user = user;
if( allowToStore ) {
#ifdef WITH_QTKEYCHAIN
_type = KeyChain;
#else
_type = Settings;
#endif
} else {
_type = User;
}
_url = url;
_state = Ok;
}
void CredentialStore::saveCredentials( )
{
MirallConfigFile cfgFile;
QString key = keyChainKey(_url);
if( key.isNull() ) {
qDebug() << "Error: Can not save credentials, URL is zero!";
return;
}
#ifdef WITH_QTKEYCHAIN
WritePasswordJob *job = NULL;
#endif
switch( _type ) {
case CredentialStore::User:
deleteKeyChainCredential( key );
break;
case CredentialStore::KeyChain:
#ifdef WITH_QTKEYCHAIN
// Set password in KeyChain
job = new WritePasswordJob(Theme::instance()->appName());
job->setKey( key );
job->setTextData(_passwd);
connect( job, SIGNAL(finished(QKeychain::Job*)), this,
SLOT(slotKeyChainWriteFinished(QKeychain::Job*)));
_state = AsyncWriting;
job->start();
#endif
break;
case CredentialStore::Settings:
cfgFile.writePassword( _passwd );
reset();
break;
default:
// unsupported.
break;
}
}
void CredentialStore::slotKeyChainWriteFinished( QKeychain::Job *job )
{
#ifdef WITH_QTKEYCHAIN
WritePasswordJob *pwdJob = static_cast<WritePasswordJob*>(job);
if( pwdJob ) {
QKeychain::Error err = pwdJob->error();
if( err != QKeychain::NoError ) {
qDebug() << "Error with keychain: " << pwdJob->errorString();
if( err == NoBackendAvailable || err == NotImplemented ||
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;
#endif
}
// Called if a user chooses to not store the password locally.
void CredentialStore::deleteKeyChainCredential( const QString& key )
{
#ifdef WITH_QTKEYCHAIN
// Start the remove job, do not care so much about the result.
DeletePasswordJob *job = new DeletePasswordJob(Theme::instance()->appName());
job->setKey( key );
job->start();
#endif
}
}

View File

@@ -15,6 +15,11 @@
#define CREDENTIALSTORE_H
#include <QObject>
#include <QInputDialog>
namespace QKeychain {
class Job;
}
namespace Mirall {
@@ -42,10 +47,27 @@ class CredentialStore : public QObject
{
Q_OBJECT
public:
enum CredState { NotFetched = 0, Ok, UserCanceled, Fetching, Error, TooManyAttempts };
enum CredState { NotFetched = 0,
Ok,
UserCanceled,
Fetching,
AsyncFetching,
EntryNotFound,
AccessDeniedByUser,
AccessDenied,
NoKeychainBackend,
Error,
AsyncWriting,
TooManyAttempts };
QString password( const QString& connection = QString::null ) const;
QString user( const QString& connection = QString::null ) const;
enum CredentialType {
User = 0,
Settings,
KeyChain
};
QString password( ) const;
QString user( ) const;
/**
* @brief state
@@ -61,12 +83,6 @@ public:
*/
void fetchCredentials();
/**
* @brief basicAuthHeader - return a basic authentication header.
* @return a QByteArray with a ready to use Header for HTTP basic auth.
*/
QByteArray basicAuthHeader() const;
/**
* @brief instance - singleton pointer.
* @return the singleton pointer to access the object.
@@ -77,11 +93,24 @@ public:
* @brief setCredentials - sets the user credentials.
*
* This function is called from the setup wizard to set the credentials
* int this store. The function also sets the state to ok.
* int this store. Note that it does not store the password.
* The function also sets the state to ok.
* @param url - the connection url
* @param user - the user name
* @param password - the password.
*/
void setCredentials( const QString&, const QString& );
void setCredentials( const QString&, const QString&, const QString&, bool );
void saveCredentials( );
QString errorMessage();
/**
* @brief canTryAgain - check if another try to get credentials makes sense.
*/
bool canTryAgain();
void reset();
signals:
/**
* @brief fetchCredentialsFinished
@@ -93,19 +122,25 @@ signals:
*/
void fetchCredentialsFinished(bool);
private slots:
#ifdef HAVE_QTKEYCHAIN
void slotKeyChainFinished(QKeyChain::Job* job);
#endif
protected slots:
void slotKeyChainReadFinished( QKeychain::Job* );
void slotKeyChainWriteFinished( QKeychain::Job* );
void slotUserDialogDone(int);
private:
explicit CredentialStore(QObject *parent = 0);
void deleteKeyChainCredential( const QString& );
QString keyChainKey( const QString& ) const;
static CredentialStore *_instance;
static CredState _state;
static QString _passwd;
static QString _user;
static QString _url;
static QString _errorMsg;
static int _tries;
static CredentialType _type;
QInputDialog *_inputDialog;
};
}

View File

@@ -1,102 +0,0 @@
/*
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "mirall/csyncfolder.h"
#include "mirall/csyncthread.h"
#include "mirall/mirallconfigfile.h"
#include <csync.h>
#include <QDebug>
#include <QDir>
#include <QMutexLocker>
#include <QThread>
#include <QStringList>
#include <QTextStream>
namespace Mirall {
CSyncFolder::CSyncFolder(const QString &alias,
const QString &path,
const QString &secondPath,
QObject *parent)
: Folder(alias, path, secondPath, parent)
, _csync(0)
, _thread(0)
, _csyncError(false)
{
}
CSyncFolder::~CSyncFolder()
{
}
bool CSyncFolder::isBusy() const
{
return (_csync && _thread && _thread->isRunning() );
}
void CSyncFolder::startSync(const QStringList &pathList)
{
if (_thread && _thread->isRunning()) {
qCritical() << "* ERROR csync is still running and new sync requested.";
return;
}
delete _csync;
delete _thread;
_errors.clear();
_csyncError = false;
_thread = new QThread(this);
_csync = new CSyncThread( path(), secondPath() );
connect(_csync, SIGNAL(started()), SLOT(slotCSyncStarted()), Qt::QueuedConnection);
connect(_csync, SIGNAL(finished()), SLOT(slotCSyncFinished()), Qt::QueuedConnection);
connect(_csync, SIGNAL(csyncError(QString)), SLOT(slotCSyncError(QString)), Qt::QueuedConnection);
_csync->moveToThread(_thread);
_thread->start();
QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection);
}
void CSyncFolder::slotTerminateSync()
{
if( _thread ) {
_thread->terminate();
}
}
void CSyncFolder::slotCSyncStarted()
{
qDebug() << " * csync thread started";
emit syncStarted();
}
void CSyncFolder::slotCSyncFinished()
{
SyncResult res(SyncResult::Success);
if( _csyncError ) {
res.setStatus( SyncResult::Error );
res.setErrorString( _errors.join(QLatin1String("\\n")));
}
emit syncFinished( res );
}
void CSyncFolder::slotCSyncError( const QString& errorStr )
{
_errors.append( errorStr );
_csyncError = true;
}
} // ns

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

@@ -16,8 +16,19 @@
#include "mirall/csyncthread.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/theme.h"
#include "mirall/logger.h"
#include "mirall/owncloudinfo.h"
#ifdef Q_OS_WIN
#include <windows.h>
#else
#include <unistd.h>
#endif
#include <assert.h>
#include <QDebug>
#include <QSslSocket>
#include <QDir>
#include <QMutexLocker>
#include <QThread>
@@ -25,138 +36,20 @@
#include <QTextStream>
#include <QTime>
#include <QApplication>
#include <QUrl>
#include <QSslCertificate>
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;
struct proxyInfo_s {
char *proxyType;
char *proxyHost;
char *proxyPort;
char *proxyUser;
char *proxyPwd;
};
typedef proxyInfo_s ProxyInfo;
walkStats_s::walkStats_s() {
errorType = 0;
eval = 0;
removed = 0;
renamed = 0;
newFiles = 0;
conflicts = 0;
ignores = 0;
sync = 0;
error = 0;
dirPermErrors = 0;
seenFiles = 0;
}
int CSyncThread::recordStats( TREE_WALK_FILE* file )
{
if( ! file ) return -1;
_mutex.lock();
_walkStats.seenFiles++;
switch(file->instruction) {
case CSYNC_INSTRUCTION_NONE:
break;
case CSYNC_INSTRUCTION_EVAL:
_walkStats.eval++;
break;
case CSYNC_INSTRUCTION_REMOVE:
_walkStats.removed++;
break;
case CSYNC_INSTRUCTION_RENAME:
_walkStats.renamed++;
break;
case CSYNC_INSTRUCTION_NEW:
_walkStats.newFiles++;
break;
case CSYNC_INSTRUCTION_CONFLICT:
_walkStats.conflicts++;
break;
case CSYNC_INSTRUCTION_IGNORE:
_walkStats.ignores++;
break;
case CSYNC_INSTRUCTION_SYNC:
_walkStats.sync++;
break;
case CSYNC_INSTRUCTION_STAT_ERROR:
case CSYNC_INSTRUCTION_ERROR:
/* instructions for the propagator */
case CSYNC_INSTRUCTION_DELETED:
case CSYNC_INSTRUCTION_UPDATED:
_walkStats.error++;
_walkStats.errorType = WALK_ERROR_INSTRUCTIONS;
break;
default:
_walkStats.error++;
_walkStats.errorType = WALK_ERROR_WALK;
break;
}
int re = 0;
// qDebug() << _walkStats.seenFiles << ". Path: " << file->path << ": uid= " << file->uid << " - type: " << file->type;
if( !( _walkStats.errorType == WALK_ERROR_NONE || _walkStats.errorType == WALK_ERROR_DIR_PERMS )) {
re = -1;
}
_mutex.unlock();
return re;
}
int CSyncThread::treewalk( TREE_WALK_FILE* file, void *data )
{
int re = static_cast<CSyncThread*>(data)->recordStats( file );
if( re > -1 )
return static_cast<CSyncThread*>(data)->treewalkFile( file );
return -1;
}
int CSyncThread::treewalkFile( TREE_WALK_FILE *file )
{
if( ! file ) return -1;
SyncFileItem item;
item.file = QString::fromUtf8( file->path );
item.instruction = file->instruction;
QFileInfo fi( _source, item.file );
if( !(fi.isWritable() && fi.isExecutable()) ) {
_walkStats.dirPermErrors++;
}
_mutex.lock();
_syncedItems.append(item);
_mutex.unlock();
return 0;
}
CSyncThread::CSyncThread(const QString &source, const QString &target, bool localCheckOnly)
: _source(source)
, _target(target)
, _localCheckOnly( localCheckOnly )
CSyncThread::CSyncThread(CSYNC *csync)
{
_mutex.lock();
if( ! _source.endsWith(QLatin1Char('/'))) _source.append(QLatin1Char('/'));
_csync_ctx = csync;
_mutex.unlock();
}
@@ -165,266 +58,314 @@ CSyncThread::~CSyncThread()
}
static char* proxyTypeToCStr(QNetworkProxy::ProxyType type)
QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errString )
{
switch (type) {
case QNetworkProxy::NoProxy:
return qstrdup("NoProxy");
case QNetworkProxy::DefaultProxy:
return qstrdup("DefaultProxy");
case QNetworkProxy::Socks5Proxy:
return qstrdup("Socks5Proxy");
case QNetworkProxy::HttpProxy:
return qstrdup("HttpProxy");
case QNetworkProxy::HttpCachingProxy:
return qstrdup("HttpCachingProxy");
case QNetworkProxy::FtpCachingProxy:
return qstrdup("FtpCachingProxy");
QString errStr;
switch( err ) {
case CSYNC_ERR_NONE:
errStr = tr("Success.");
break;
case CSYNC_ERR_LOG:
errStr = tr("CSync Logging setup failed.");
break;
case CSYNC_ERR_LOCK:
errStr = tr("CSync failed to create a lock file.");
break;
case CSYNC_ERR_STATEDB_LOAD:
errStr = tr("CSync failed to load the state db.");
break;
case CSYNC_ERR_MODULE:
errStr = tr("<p>The %1 plugin for csync could not be loaded.<br/>Please verify the installation!</p>").arg(Theme::instance()->appNameGUI());
break;
case CSYNC_ERR_TIMESKEW:
errStr = tr("The system time on this client is different than the system time on the server. "
"Please use a time synchronization service (NTP) on the server and client machines "
"so that the times remain the same.");
break;
case CSYNC_ERR_FILESYSTEM:
errStr = tr("CSync could not detect the filesystem type.");
break;
case CSYNC_ERR_TREE:
errStr = tr("CSync got an error while processing internal trees.");
break;
case CSYNC_ERR_MEM:
errStr = tr("CSync failed to reserve memory.");
break;
case CSYNC_ERR_PARAM:
errStr = tr("CSync fatal parameter error.");
break;
case CSYNC_ERR_UPDATE:
errStr = tr("CSync processing step update failed.");
break;
case CSYNC_ERR_RECONCILE:
errStr = tr("CSync processing step reconcile failed.");
break;
case CSYNC_ERR_PROPAGATE:
errStr = tr("CSync processing step propagate failed.");
break;
case CSYNC_ERR_ACCESS_FAILED:
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;
case CSYNC_ERR_REMOTE_CREATE:
case CSYNC_ERR_REMOTE_STAT:
errStr = tr("A remote file can not be written. Please check the remote access.");
break;
case CSYNC_ERR_LOCAL_CREATE:
case CSYNC_ERR_LOCAL_STAT:
errStr = tr("The local filesystem can not be written. Please check permissions.");
break;
case CSYNC_ERR_PROXY:
errStr = tr("CSync failed to connect through a proxy.");
break;
case CSYNC_ERR_LOOKUP:
errStr = tr("CSync failed to lookup proxy or server.");
break;
case CSYNC_ERR_AUTH_SERVER:
errStr = tr("CSync failed to authenticate at the %1 server.").arg(Theme::instance()->appNameGUI());
break;
case CSYNC_ERR_AUTH_PROXY:
errStr = tr("CSync failed to authenticate at the proxy.");
break;
case CSYNC_ERR_CONNECT:
errStr = tr("CSync failed to connect to the network.");
break;
case CSYNC_ERR_TIMEOUT:
errStr = tr("A network connection timeout happend.");
break;
case CSYNC_ERR_HTTP:
errStr = tr("A HTTP transmission error happened.");
break;
case CSYNC_ERR_PERM:
errStr = tr("CSync failed due to not handled permission deniend.");
break;
case CSYNC_ERR_NOT_FOUND:
errStr = tr("CSync failed to find a specific file.");
break;
case CSYNC_ERR_EXISTS:
errStr = tr("CSync tried to create a directory that already exists.");
break;
case CSYNC_ERR_NOSPC:
errStr = tr("CSync: No space on %1 server available.").arg(Theme::instance()->appNameGUI());
break;
case CSYNC_ERR_UNSPEC:
errStr = tr("CSync unspecified error.");
default:
return qstrdup("NoProxy");
errStr = tr("An internal error number %1 happend.").arg( (int) err );
}
if( errString ) {
errStr += tr("<br/>Backend Message: ")+QString::fromUtf8(errString);
}
return errStr;
}
int CSyncThread::treewalkLocal( TREE_WALK_FILE* file, void *data )
{
return static_cast<CSyncThread*>(data)->treewalkFile( file, false );
}
int CSyncThread::treewalkRemote( TREE_WALK_FILE* file, void *data )
{
return static_cast<CSyncThread*>(data)->treewalkFile( file, true );
}
int CSyncThread::walkFinalize(TREE_WALK_FILE* file, void *data )
{
return static_cast<CSyncThread*>(data)->treewalkError( file);
}
int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
{
if( ! file ) return -1;
SyncFileItem item;
item._file = QString::fromUtf8( file->path );
item._instruction = file->instruction;
item._dir = SyncFileItem::None;
SyncFileItem::Direction dir;
int re = 0;
switch(file->instruction) {
case CSYNC_INSTRUCTION_NONE:
case CSYNC_INSTRUCTION_IGNORE:
break;
default:
if (!_needsUpdate)
_needsUpdate = true;
}
switch(file->instruction) {
case CSYNC_INSTRUCTION_NONE:
// No need to do anything.
return re;
break;
case CSYNC_INSTRUCTION_RENAME:
dir = !remote ? SyncFileItem::Down : SyncFileItem::Up;
item._renameTarget = QString::fromUtf8( file->rename_path );
break;
case CSYNC_INSTRUCTION_REMOVE:
dir = !remote ? SyncFileItem::Down : SyncFileItem::Up;
break;
case CSYNC_INSTRUCTION_CONFLICT:
case CSYNC_INSTRUCTION_IGNORE:
case CSYNC_INSTRUCTION_ERROR:
dir = SyncFileItem::None;
break;
case CSYNC_INSTRUCTION_EVAL:
case CSYNC_INSTRUCTION_NEW:
case CSYNC_INSTRUCTION_SYNC:
case CSYNC_INSTRUCTION_STAT_ERROR:
case CSYNC_INSTRUCTION_DELETED:
case CSYNC_INSTRUCTION_UPDATED:
default:
dir = remote ? SyncFileItem::Down : SyncFileItem::Up;
break;
}
item._dir = dir;
_mutex.lock();
_syncedItems.append(item);
_mutex.unlock();
return re;
}
int CSyncThread::treewalkError(TREE_WALK_FILE* file)
{
SyncFileItem item;
item._file= QString::fromUtf8(file->path);
int indx = _syncedItems.indexOf(item);
if ( indx == -1 )
return 0;
if( file &&
file->instruction == CSYNC_INSTRUCTION_STAT_ERROR ||
file->instruction == CSYNC_INSTRUCTION_ERROR ) {
_mutex.lock();
_syncedItems[indx]._instruction = file->instruction;
_mutex.unlock();
}
return 0;
}
struct CSyncRunScopeHelper {
CSyncRunScopeHelper(CSYNC *ctx, CSyncThread *parent)
: _ctx(ctx), _parent(parent)
{
_t.start();
}
~CSyncRunScopeHelper() {
csync_commit(_ctx);
qDebug() << "CSync run took " << _t.elapsed() << " Milliseconds";
emit(_parent->finished());
_parent->_syncMutex.unlock();
}
CSYNC *_ctx;
QTime _t;
CSyncThread *_parent;
};
void CSyncThread::handleSyncError(CSYNC *ctx, const char *state) {
CSYNC_ERROR_CODE err = csync_get_error( ctx );
const char *errMsg = csync_get_error_string( ctx );
QString errStr = csyncErrorToString(err, errMsg);
qDebug() << " #### ERROR during "<< state << ": " << errStr;
switch (err) {
case CSYNC_ERR_SERVICE_UNAVAILABLE:
case CSYNC_ERR_CONNECT:
emit csyncUnavailable();
break;
default:
emit csyncError(errStr);
}
}
void CSyncThread::startSync()
{
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;
QTime walkTime;
ProxyInfo proxyInfo;
emit(started());
_mutex.lock();
proxyInfo.proxyType = proxyTypeToCStr( _proxy.type() );
proxyInfo.proxyHost = qstrdup( _proxy.hostName().toAscii().constData() );
proxyInfo.proxyPort = qstrdup( QByteArray::number( _proxy.port() ).constData() );
proxyInfo.proxyUser = qstrdup( _proxy.user().toAscii().constData() );
proxyInfo.proxyPwd = qstrdup( _proxy.password().toAscii().constData() );
if( csync_create(&csync,
_source.toUtf8().data(),
_target.toUtf8().data()) < 0 ) {
emit csyncError( tr("CSync create failed.") );
}
_csyncConfigDir = QString::fromUtf8( csync_get_config_dir( csync ));
_syncedItems.clear();
_needsUpdate = false;
_mutex.unlock();
qDebug() << "## CSync Thread local only: " << _localCheckOnly;
csync_set_auth_callback( csync, getauth );
csync_enable_conflictcopys(csync);
// cleans up behind us and emits finished() to ease error handling
CSyncRunScopeHelper helper(_csync_ctx, this);
csync_set_userdata(_csync_ctx, this);
MirallConfigFile cfg;
QString excludeList = cfg.excludeFile();
if( !excludeList.isEmpty() ) {
qDebug() << "==== added CSync exclude List: " << excludeList.toAscii();
csync_add_exclude_list( csync, excludeList.toAscii() );
}
csync_set_config_dir( csync, cfg.configPath().toUtf8() );
QTime t;
t.start();
_mutex.lock();
if( _localCheckOnly ) {
csync_set_local_only( csync, true );
}
csync_set_userdata(csync, (void*) &proxyInfo);
_mutex.unlock();
if( csync_init(csync) < 0 ) {
CSYNC_ERROR_CODE err = csync_get_error( csync );
QString errStr;
switch( err ) {
case CSYNC_ERR_LOCK:
errStr = tr("CSync failed to create a lock file.");
break;
case CSYNC_ERR_STATEDB_LOAD:
errStr = tr("CSync failed to load the state db.");
break;
case CSYNC_ERR_TIMESKEW:
errStr = tr("The system time on this client is different than the system time on the server. "
"Please use a time synchronization service (NTP) on the server and client machines "
"so that the times remain the same.");
break;
case CSYNC_ERR_FILESYSTEM:
errStr = tr("CSync could not detect the filesystem type.");
break;
case CSYNC_ERR_TREE:
errStr = tr("CSync got an error while processing internal trees.");
break;
case CSYNC_ERR_ACCESS_FAILED:
errStr = tr("<p>The target directory %1 does not exist.</p><p>Please check the sync setup.</p>").arg(_target);
// this is critical. The database has to be removed.
emitStateDb(csync); // to make the name of the csync db known.
emit wipeDb();
break;
case CSYNC_ERR_MODULE:
errStr = tr("<p>The %1 plugin for csync could not be loaded.<br/>Please verify the installation!</p>").arg(Theme::instance()->appName());
break;
case CSYNC_ERR_LOCAL_CREATE:
case CSYNC_ERR_LOCAL_STAT:
errStr = tr("The local filesystem can not be written. Please check permissions.");
break;
case CSYNC_ERR_REMOTE_CREATE:
case CSYNC_ERR_REMOTE_STAT:
errStr = tr("A remote file can not be written. Please check the remote access.");
break;
default:
errStr = tr("An internal error number %1 happend.").arg( (int) err );
}
qDebug() << " #### ERROR String emitted: " << errStr;
emit csyncError(errStr);
goto cleanup;
}
emitStateDb(csync);
// csync_set_auth_callback( _csync_ctx, getauth );
csync_set_progress_callback( _csync_ctx, progress );
qDebug() << "#### Update start #################################################### >>";
if( csync_update(csync) < 0 ) {
CSYNC_ERROR_CODE err = csync_get_error( csync );
QString errStr;
switch( err ) {
case CSYNC_ERR_PROXY:
errStr = tr("CSync failed to reach the host. Either host or proxy settings are not valid.");
break;
default:
errStr = tr("CSync Update failed.");
break;
}
emit csyncError( errStr );
goto cleanup;
if( csync_update(_csync_ctx) < 0 ) {
handleSyncError(_csync_ctx, "csync_update");
return;
}
qDebug() << "<<#### Update end ###########################################################";
csync_set_userdata(csync, this);
walkTime.start();
if( csync_walk_local_tree(csync, &treewalk, 0) < 0 ) {
qDebug() << "Error in treewalk.";
if( _walkStats.errorType == WALK_ERROR_WALK ) {
emit csyncError(tr("CSync encountered an error while examining the file system.\n"
"Syncing is not possible."));
} else if( _walkStats.errorType == WALK_ERROR_INSTRUCTIONS ) {
emit csyncError(tr("CSync update generated a strange instruction.\n"
"Please write a bug report."));
}
emit csyncError(tr("Local filesystem problems. Better disable Syncing and check."));
goto cleanup;
} else {
// only warn, do not stop the sync process.
if( _walkStats.errorType == WALK_ERROR_DIR_PERMS ) {
emit csyncError(tr("The local filesystem has %1 write protected directories."
"That can hinder successful syncing.<p/>"
"Please make sure that all local directories are writeable.").arg(_walkStats.dirPermErrors));
}
if( csync_reconcile(_csync_ctx) < 0 ) {
handleSyncError(_csync_ctx, "cysnc_reconcile");
return;
}
// emit the treewalk results.
emit treeWalkResult(_syncedItems, _walkStats);
_mutex.lock();
if( _localCheckOnly ) {
_mutex.unlock();
qDebug() << " ..... Local only walk finished: " << walkTime.elapsed();
// we have to go out here as its local check only.
goto cleanup;
} else {
_mutex.unlock();
// check if we can write all over.
if( csync_reconcile(csync) < 0 ) {
emit csyncError(tr("CSync reconcile failed."));
goto cleanup;
}
if( csync_propagate(csync) < 0 ) {
emit csyncError(tr("File exchange with ownCloud failed. Sync was stopped."));
goto cleanup;
}
bool walkOk = true;
if( csync_walk_local_tree(_csync_ctx, &treewalkLocal, 0) < 0 ) {
qDebug() << "Error in local treewalk.";
walkOk = false;
}
cleanup:
csync_destroy(csync);
if( proxyInfo.proxyType ) delete[] proxyInfo.proxyType;
if( proxyInfo.proxyHost ) delete[] proxyInfo.proxyHost;
if( proxyInfo.proxyPort ) delete[] proxyInfo.proxyPort;
if( proxyInfo.proxyUser ) delete[] proxyInfo.proxyUser;
if( proxyInfo.proxyPwd ) delete[] proxyInfo.proxyPwd ;
/*
* Attention: do not delete the wStat memory here. it is deleted in the
* slot catching the signel treeWalkResult because this thread can faster
* die than the slot has read out the data.
*/
qDebug() << "CSync run took " << t.elapsed() << " Milliseconds";
emit(finished());
}
void CSyncThread::emitStateDb( CSYNC *csync )
{
// After csync_init the statedb file name can be emitted
const char *statedb = csync_get_statedb_file( csync );
if( statedb ) {
QString stateDbFile = QString::fromUtf8(statedb);
free((void*)statedb);
emit csyncStateDbFile( stateDbFile );
} else {
qDebug() << "WRN: Unable to get csync statedb file name";
if( walkOk && csync_walk_remote_tree(_csync_ctx, &treewalkRemote, 0) < 0 ) {
qDebug() << "Error in remote treewalk.";
}
}
void CSyncThread::setConnectionDetails( const QString &user, const QString &passwd, const QNetworkProxy &proxy )
{
_mutex.lock();
_user = user;
_passwd = passwd;
_proxy = proxy;
_mutex.unlock();
}
if (_needsUpdate)
emit(started());
QString CSyncThread::csyncConfigDir()
{
return _csyncConfigDir;
}
if( csync_propagate(_csync_ctx) < 0 ) {
handleSyncError(_csync_ctx, "cysnc_reconcile");
return;
}
int CSyncThread::getauth(const char *prompt,
char *buf,
size_t len,
int echo,
int verify,
void *userdata
)
{
int re = 0;
QString qPrompt = QString::fromLocal8Bit( prompt ).trimmed();
_mutex.lock();
if( qPrompt == QLatin1String("Enter your username:") ) {
// qDebug() << "OOO Username requested!";
qstrncpy( buf, _user.toUtf8().constData(), len );
} else if( qPrompt == QLatin1String("Enter your password:") ) {
// 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
// the answer is simply yes here.
qstrcpy( buf, "yes" );
if( walkOk ) {
if( csync_walk_local_tree(_csync_ctx, &walkFinalize, 0) < 0 ||
csync_walk_remote_tree( _csync_ctx, &walkFinalize, 0 ) < 0 ) {
qDebug() << "Error in finalize treewalk.";
} else {
qDebug() << "Unknown prompt: <" << prompt << ">";
re = -1;
// emit the treewalk results.
emit treeWalkResult(_syncedItems);
}
}
_mutex.unlock();
return re;
qDebug() << Q_FUNC_INFO << "Sync finished";
}
void CSyncThread::progress(const char *remote_url, enum csync_notify_type_e kind,
long long o1, long long o2, void *userdata)
{
(void) o1; (void) o2;
if (kind == CSYNC_NOTIFY_FINISHED_DOWNLOAD) {
QString path = QUrl::fromEncoded(remote_url).toString();
CSyncThread *thread = static_cast<CSyncThread*>(userdata);
thread->fileReceived(path);
}
}
}

View File

@@ -1,6 +1,3 @@
#ifndef CSYNCTHREAD_H
#define CSYNCTHREAD_H
/*
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
@@ -16,6 +13,9 @@
* for more details.
*/
#ifndef CSYNCTHREAD_H
#define CSYNCTHREAD_H
#include <stdint.h>
#include <QMutex>
@@ -25,61 +25,30 @@
#include <csync.h>
#include "mirall/syncfileitem.h"
class QProcess;
namespace Mirall {
enum walkErrorTypes {
WALK_ERROR_NONE = 0,
WALK_ERROR_WALK,
WALK_ERROR_INSTRUCTIONS,
WALK_ERROR_DIR_PERMS
};
struct walkStats_s {
walkStats_s();
int errorType;
ulong eval;
ulong removed;
ulong renamed;
ulong newFiles;
ulong conflicts;
ulong ignores;
ulong sync;
ulong error;
ulong dirPermErrors;
ulong seenFiles;
};
typedef walkStats_s WalkStats;
struct syncFileItem_s {
QString file;
csync_instructions_e instruction;
};
typedef syncFileItem_s SyncFileItem;
typedef QVector<SyncFileItem> SyncFileItemVector;
class CSyncThread : public QObject
{
Q_OBJECT
public:
CSyncThread(const QString &source, const QString &target, bool = false);
CSyncThread(CSYNC *);
~CSyncThread();
static void setConnectionDetails( const QString&, const QString&, const QNetworkProxy& );
static QString csyncConfigDir();
QString csyncErrorToString( CSYNC_ERROR_CODE, const char * );
Q_INVOKABLE void startSync();
signals:
void treeWalkResult(const SyncFileItemVector&, const WalkStats&);
void fileReceived( const QString& );
void fileRemoved( const QString& );
void csyncError( const QString& );
void csyncWarning( const QString& );
void csyncUnavailable();
void treeWalkResult(const SyncFileItemVector&);
void csyncStateDbFile( const QString& );
void wipeDb();
@@ -88,32 +57,29 @@ signals:
void started();
private:
static int treewalk( TREE_WALK_FILE* file, void *data );
int recordStats( TREE_WALK_FILE* file);
void emitStateDb( CSYNC *csync );
int treewalkFile( TREE_WALK_FILE* );
void handleSyncError(CSYNC *ctx, const char *state);
static void progress(const char *remote_url,
enum csync_notify_type_e kind,
long long o1, long long o2,
void *userdata);
static int treewalkLocal( TREE_WALK_FILE*, void *);
static int treewalkRemote( TREE_WALK_FILE*, void *);
int treewalkFile( TREE_WALK_FILE*, bool );
int treewalkError( TREE_WALK_FILE* );
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 QMutex _syncMutex;
SyncFileItemVector _syncedItems;
static QString _csyncConfigDir;
CSYNC *_csync_ctx;
bool _needsUpdate;
QString _source;
QString _target;
bool _localCheckOnly;
QVector <SyncFileItem> _syncedItems;
WalkStats _walkStats;
friend class CSyncRunScopeHelper;
};
}

View File

@@ -0,0 +1,301 @@
/*
* 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 <QtGui>
#include "mirall/fileitemdialog.h"
#include "mirall/theme.h"
#include "mirall/syncresult.h"
#include "mirall/logger.h"
#define TYPE_SUCCESS 1
#define TYPE_CONFLICT 2
#define TYPE_NEW 3
#define TYPE_DELETED 4
#define TYPE_ERROR 5
#define TYPE_RENAME 6
#define TYPE_IGNORE 7
#define FILE_TYPE 100
namespace Mirall {
FileItemDialog::FileItemDialog(Theme *theme, QWidget *parent) :
QDialog(parent),
_theme(theme)
{
setupUi(this);
connect(_dialogButtonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()),
this, SLOT(accept()));
QStringList header;
header << tr("Files");
QString firstColString = tr("File Count");
header << firstColString;
_treeWidget->setHeaderLabels( header );
_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()));
setWindowTitle(tr("Sync Protocol"));
}
void FileItemDialog::setSyncResult( const SyncResult& result )
{
QString folderMessage;
SyncResult::Status syncStatus = result.status();
switch( syncStatus ) {
case SyncResult::Undefined:
folderMessage = tr( "Undefined Folder State" );
break;
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;
case SyncResult::SyncRunning:
folderMessage = tr("Sync is running.");
break;
case SyncResult::Success:
folderMessage = tr("Last Sync was successful.");
break;
case SyncResult::Error:
folderMessage = tr( "Syncing Error." );
break;
case SyncResult::SetupError:
folderMessage = tr( "Setup Error." );
break;
default:
folderMessage = tr( "Undefined Error State." );
}
_folderMessage = folderMessage;
_lastSyncTime = result.syncTime();
if( result.errorStrings().count() ) {
_errorLabel->setVisible(true);
_errorLabel->setTextFormat(Qt::RichText);
QString errStr;
foreach( QString err, result.errorStrings() ) {
errStr.append(QString("<p>%1</p>").arg(err));
}
_errorLabel->setText(errStr);
} else {
_errorLabel->setText(QString::null);
_errorLabel->setVisible(false);
}
slotSetFolderMessage();
if( syncStatus == SyncResult::SyncRunning ) {
_timer.stop();
} else {
_timer.start();
}
setSyncFileItems( result.syncFileItemVector() );
}
void FileItemDialog::slotSetFolderMessage()
{
QDateTime now = QDateTime::currentDateTime();
int secs = _lastSyncTime.secsTo(now);
_timelabel->setText(tr("%1 (finished %n sec. ago)", "", secs).arg(_folderMessage));
}
void FileItemDialog::copyToClipboard()
{
QString text;
QTextStream ts(&text);
int topLevelItems = _treeWidget->topLevelItemCount();
for (int i = 0; i < topLevelItems; i++) {
QTreeWidgetItem *item = _treeWidget->topLevelItem(i);
ts << left << qSetFieldWidth(50)
<< item->data(0, Qt::DisplayRole).toString()
<< right << qSetFieldWidth(6)
<< item->data(1, Qt::DisplayRole).toString()
<< endl;
int childItems = item->childCount();
for (int j = 0; j < childItems; j++) {
QTreeWidgetItem *child =item->child(j);
ts << left << qSetFieldWidth(0) << QLatin1String(" ")
<< child->data(0,Qt::DisplayRole).toString()
<< QString::fromLatin1(" (%1)").arg(
child->data(1, Qt::DisplayRole).toString()
)
<< endl;
}
}
QApplication::clipboard()->setText(text);
emit guiLog(tr("Copied to clipboard"), tr("The sync protocol has been copied to the clipboard."));
}
void FileItemDialog::accept()
{
_timer.stop();
QDialog::accept();
}
void FileItemDialog::setSyncFileItems( const SyncFileItemVector& list )
{
_treeWidget->clear();
QStringList strings;
QFont headerFont;
headerFont.setWeight(QFont::Bold);
strings.clear();
strings.append(tr("Synced Files"));
_syncedFileItem = new QTreeWidgetItem( _treeWidget, strings, TYPE_SUCCESS );
_syncedFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_treeWidget->addTopLevelItem(_syncedFileItem);
strings.clear();
strings.append(tr("New Files"));
_newFileItem = new QTreeWidgetItem( _treeWidget, strings, TYPE_NEW );
_newFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_treeWidget->addTopLevelItem(_newFileItem);
strings.clear();
strings.append(tr("Deleted Files"));
_deletedFileItem = new QTreeWidgetItem( _treeWidget, strings, TYPE_DELETED );
_deletedFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_treeWidget->addTopLevelItem(_deletedFileItem);
strings.clear();
strings.append(tr("Renamed Files"));
_renamedFileItem = new QTreeWidgetItem( _treeWidget, strings, TYPE_RENAME);
_renamedFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_treeWidget->addTopLevelItem(_renamedFileItem);
strings.clear();
strings.append(tr("Ignored Files"));
_ignoredFileItem = new QTreeWidgetItem( _treeWidget, strings, TYPE_IGNORE);
_ignoredFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_treeWidget->addTopLevelItem(_renamedFileItem);
strings.clear();
strings.append(tr("Errors"));
_errorFileItem = new QTreeWidgetItem( _treeWidget, strings, TYPE_ERROR );
_errorFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_treeWidget->addTopLevelItem(_errorFileItem);
strings.clear();
strings.append(tr("Conflicts"));
_conflictFileItem = new QTreeWidgetItem( _treeWidget, strings, TYPE_CONFLICT);
_conflictFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_treeWidget->addTopLevelItem(_conflictFileItem);
QList<QTreeWidgetItem*> syncedItems;
QList<QTreeWidgetItem*> renamedItems;
QList<QTreeWidgetItem*> newItems;
QList<QTreeWidgetItem*> deletedItems;
QList<QTreeWidgetItem*> ignoredItems;
QList<QTreeWidgetItem*> conflictItems;
QList<QTreeWidgetItem*> errorItems;
quint64 overall_files = 0;
foreach( SyncFileItem item, list ) {
overall_files++;
QString dir;
QStringList str( item._file );
if( item._dir == SyncFileItem::Up ) dir = tr("Uploaded");
if( item._dir == SyncFileItem::Down ) dir = tr("Downloaded");
str << dir;
switch( item._instruction ) {
case CSYNC_INSTRUCTION_NONE:
// do nothing.
break;
case CSYNC_INSTRUCTION_EVAL:
// should not happen
break;
case CSYNC_INSTRUCTION_REMOVE:
case CSYNC_INSTRUCTION_DELETED:
deletedItems.append( new QTreeWidgetItem(_deletedFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_RENAME:
renamedItems.append( new QTreeWidgetItem(_renamedFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_NEW:
newItems.append( new QTreeWidgetItem(_newFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_CONFLICT:
conflictItems.append( new QTreeWidgetItem(_conflictFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_IGNORE:
ignoredItems.append( new QTreeWidgetItem(_ignoredFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_SYNC:
case CSYNC_INSTRUCTION_UPDATED:
syncedItems.append( new QTreeWidgetItem(_syncedFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_STAT_ERROR:
case CSYNC_INSTRUCTION_ERROR:
errorItems.append( new QTreeWidgetItem(_errorFileItem, str, FILE_TYPE) );
break;
default:
break;
}
}
formatHeaderItem( _syncedFileItem, syncedItems );
formatHeaderItem( _newFileItem, newItems );
formatHeaderItem( _deletedFileItem, deletedItems );
formatHeaderItem( _renamedFileItem, renamedItems );
formatHeaderItem( _errorFileItem, errorItems );
formatHeaderItem( _conflictFileItem, conflictItems );
formatHeaderItem( _ignoredFileItem, ignoredItems );
}
void FileItemDialog::formatHeaderItem( QTreeWidgetItem *header, const QList<QTreeWidgetItem*>& list )
{
if( !header ) return;
header->addChildren( list );
int count = list.count();
#if LEAVE_THAT_TO_DESIGNERS
QColor col("#adc5d3");
header->setBackgroundColor(0, col);
header->setBackgroundColor(1, col);
#endif
header->setText(1, QString::number( count ));
if( count ) {
QFont font;
font.setWeight( QFont::Bold );
header->setFont(0, font);
header->setFont(1, font);
header->setExpanded(true);
} else {
header->setExpanded(false);
}
}
}

View File

@@ -0,0 +1,68 @@
/*
* 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 FILEITEMDIALOG_H
#define FILEITEMDIALOG_H
#include <QDialog>
#include <QDateTime>
#include <QTimer>
#include "mirall/syncfileitem.h"
#include "ui_fileitemdialog.h"
namespace Mirall {
class Theme;
class SyncResult;
class FileItemDialog : public QDialog, public Ui::_fileItemDialog
{
Q_OBJECT
public:
explicit FileItemDialog(Theme*, QWidget *parent = 0);
void setSyncResult( const SyncResult& );
signals:
public slots:
void accept();
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*>& );
QTreeWidgetItem *_newFileItem;
QTreeWidgetItem *_syncedFileItem;
QTreeWidgetItem *_deletedFileItem;
QTreeWidgetItem *_renamedFileItem;
QTreeWidgetItem *_errorFileItem;
QTreeWidgetItem *_conflictFileItem;
QTreeWidgetItem *_ignoredFileItem;
Theme *_theme;
QString _folderMessage;
QDateTime _lastSyncTime;
QTimer _timer;
};
}
#endif // FILEITEMDIALOG_H

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>_fileItemDialog</class>
<widget class="QWidget" name="_fileItemDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>612</width>
<height>543</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Detailed Sync Protocol</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="_treeWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated">
<bool>true</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="_timelabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="_errorLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="_dialogButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

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

@@ -11,6 +11,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "config.h"
#include "mirall/folder.h"
#include "mirall/folderwatcher.h"
@@ -48,7 +49,6 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
QObject::connect(_pollTimer, SIGNAL(timeout()), this, SLOT(slotPollTimerTimeout()));
_pollTimer->start();
#ifdef USE_INOTIFY
_watcher = new Mirall::FolderWatcher(path, this);
MirallConfigFile cfg;
@@ -57,7 +57,6 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
QObject::connect(_watcher, SIGNAL(folderChanged(const QStringList &)),
SLOT(slotChanged(const QStringList &)));
#endif
QObject::connect(this, SIGNAL(syncStarted()),
SLOT(slotSyncStarted()));
QObject::connect(this, SIGNAL(syncFinished(const SyncResult &)),
@@ -140,11 +139,6 @@ QString Folder::nativePath() const
return QDir::toNativeSeparators(_path);
}
QString Folder::nativeSecondPath() const
{
return secondPath();
}
bool Folder::syncEnabled() const
{
return _enabled;
@@ -153,9 +147,7 @@ bool Folder::syncEnabled() const
void Folder::setSyncEnabled( bool doit )
{
_enabled = doit;
#ifdef USE_INOTIFY
_watcher->setEventsEnabled( doit );
#endif
if( doit && ! _pollTimer->isActive() ) {
_pollTimer->start();
}
@@ -196,6 +188,11 @@ int Folder::pollInterval() const
return _pollTimer->interval();
}
void Folder::setSyncState(SyncResult::Status state)
{
_syncResult.setStatus(state);
}
void Folder::setPollInterval(int milliseconds)
{
_pollTimer->setInterval( milliseconds );
@@ -217,12 +214,10 @@ void Folder::incrementErrorCount()
// of the watcher is doubled.
_errorCount++;
if( _errorCount > 1 ) {
#ifdef USE_INOTIFY
int interval = _watcher->eventInterval();
int newInt = 2*interval;
qDebug() << "Set new watcher interval to " << newInt;
_watcher->setEventInterval( newInt );
#endif
_errorCount = 0;
}
}
@@ -253,18 +248,10 @@ void Folder::evaluateSync(const QStringList &pathList)
}
void Folder::startSync( const QStringList &pathList )
{
_syncResult.setStatus( SyncResult::SyncRunning );
emit syncStateChange();
}
void Folder::slotPollTimerTimeout()
{
qDebug() << "* Polling" << alias() << "for changes. Ignoring all pending events until now";
#ifdef USE_INOTIFY
_watcher->clearPendingEvents();
#endif
evaluateSync(QStringList());
}
@@ -283,18 +270,14 @@ void Folder::slotChanged(const QStringList &pathList)
void Folder::slotSyncStarted()
{
// disable events until syncing is done
#ifdef USE_INOTIFY
_watcher->setEventsEnabled(false);
#endif
}
void Folder::slotSyncFinished(const SyncResult &result)
{
#ifdef USE_INOTIFY
_watcher->setEventsEnabled(true);
#endif
_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

@@ -15,12 +15,12 @@
#ifndef MIRALL_FOLDER_H
#define MIRALL_FOLDER_H
#include "config.h"
#include <QObject>
#include <QString>
#include <QStringList>
#include <QHash>
#include <QTimer>
#if QT_VERSION >= 0x040700
#include <QNetworkConfigurationManager>
@@ -29,15 +29,12 @@
#include "mirall/syncresult.h"
class QAction;
class QTimer;
class QIcon;
class QFileSystemWatcher;
namespace Mirall {
#ifdef USE_INOTIFY
class FolderWatcher;
#endif
class Folder : public QObject
{
@@ -48,6 +45,7 @@ public:
virtual ~Folder();
typedef QHash<QString, Folder*> Map;
typedef QHashIterator<QString, Folder*> MapIterator;
/**
* alias or nickname
@@ -64,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
@@ -151,6 +148,12 @@ public:
QIcon icon( int size ) const;
QTimer *_pollTimer;
signals:
void syncStateChange();
void syncStarted();
void syncFinished(const SyncResult &result);
void scheduleToSync( const QString& );
public slots:
void slotSyncFinished(const SyncResult &);
@@ -164,32 +167,45 @@ public slots:
*/
virtual void slotTerminateSync() = 0;
/**
* Sets minimum amounts of milliseconds that will separate
* poll intervals
*/
void setPollInterval( int );
/**
* If folder is network-based, reimplement to react to proxy changes
*/
virtual void setProxy() {}
protected:
/**
* The minimum amounts of seconds to wait before
* doing a full sync to see if the remote changed
*/
int pollInterval() const;
void setSyncState(SyncResult::Status state);
/**
* Sets minimum amounts of milliseconds that will separate
* poll intervals
*/
void setPollInterval( int );
signals:
void syncStateChange();
void syncStarted();
void syncFinished(const SyncResult &result);
void scheduleToSync( const QString& );
protected:
#ifdef USE_INOTIFY
FolderWatcher *_watcher;
#endif
int _errorCount;
SyncResult _syncResult;
protected slots:
void slotOnlineChanged(bool online);
void slotPollTimerTimeout();
/* called when the watcher detect a list of changed
paths */
void slotSyncStarted();
/**
* Triggered by a file system watcher on the local sync dir
*/
virtual void slotLocalPathChanged( const QString& );
private:
/**
@@ -216,22 +232,6 @@ private:
bool _enabled;
QString _backend;
protected slots:
void slotOnlineChanged(bool online);
void slotPollTimerTimeout();
/* called when the watcher detect a list of changed
paths */
void slotSyncStarted();
/**
* Triggered by a file system watcher on the local sync dir
*/
virtual void slotLocalPathChanged( const QString& );
};
}

View File

@@ -14,26 +14,33 @@
#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"
#include "mirall/theme.h"
#ifdef Q_OS_MAC
#include <CoreServices/CoreServices.h>
#endif
#ifdef Q_OS_WIN
#include <shlobj.h>
#endif
#include <QDesktopServices>
#include <QtCore>
namespace Mirall {
FolderMan::FolderMan(QObject *parent) :
QObject(parent)
QObject(parent),
_syncEnabled( true )
{
// if QDir::mkpath would not be so stupid, I would not need to have this
// duplication of folderConfigPath() here
QDir storageDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
MirallConfigFile cfg;
QDir storageDir(cfg.configPath());
storageDir.mkpath(QLatin1String("folders"));
_folderConfigPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/folders");
_folderConfigPath = cfg.configPath() + QLatin1String("folders");
_folderChangeSignalMapper = new QSignalMapper(this);
connect(_folderChangeSignalMapper, SIGNAL(mapped(const QString &)),
@@ -77,7 +84,15 @@ int FolderMan::setupKnownFolders()
{
qDebug() << "* Setup folders from " << _folderConfigPath;
_folderMap.clear(); // FIXME: check if delete of folder structure happens
// first terminate sync jobs.
terminateCurrentSync();
// clear the list of existing folders.
Folder::MapIterator i(_folderMap);
while (i.hasNext()) {
i.next();
delete _folderMap.take( i.key() );
}
QDir dir( _folderConfigPath );
dir.setFilter(QDir::Files);
@@ -93,6 +108,23 @@ int FolderMan::setupKnownFolders()
return _folderMap.size();
}
void FolderMan::wipeAllJournals()
{
terminateCurrentSync();
foreach( Folder *f, _folderMap.values() ) {
f->wipe();
}
}
void FolderMan::terminateCurrentSync()
{
if( !_currentSyncFolder.isEmpty() ) {
qDebug() << "Terminating syncing on folder " << _currentSyncFolder;
terminateSyncProcess( _currentSyncFolder );
}
}
#define SLASH_TAG QLatin1String("__SLASH__")
#define BSLASH_TAG QLatin1String("__BSLASH__")
#define QMARK_TAG QLatin1String("__QMARK__")
@@ -188,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
@@ -206,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;
@@ -240,25 +258,6 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
return folder;
}
void FolderMan::disableFoldersWithRestore()
{
_folderEnabledMap.clear();
foreach( Folder *f, _folderMap ) {
// store the enabled state, then make sure it is disabled
_folderEnabledMap.insert(f->alias(), f->syncEnabled());
f->setSyncEnabled(false);
}
}
void FolderMan::restoreEnabledFolders()
{
foreach( Folder *f, _folderMap ) {
if (_folderEnabledMap.contains( f->alias() )) {
f->setSyncEnabled( _folderEnabledMap.value( f->alias() ) );
}
}
}
void FolderMan::slotEnableFolder( const QString& alias, bool enable )
{
if( ! _folderMap.contains( alias ) ) {
@@ -279,6 +278,9 @@ void FolderMan::terminateSyncProcess( const QString& alias )
Folder *f = _folderMap[alias];
if( f ) {
f->slotTerminateSync();
if(_currentSyncFolder == alias )
_currentSyncFolder = QString::null;
}
}
@@ -303,6 +305,13 @@ SyncResult FolderMan::syncResult( const QString& alias )
return res;
}
void FolderMan::slotScheduleAllFolders()
{
foreach( Folder *f, _folderMap.values() ) {
slotScheduleSync( f->alias() );
}
}
/*
* if a folder wants to be synced, it calls this slot and is added
* to the queue. The slot to actually start a sync is called afterwards.
@@ -314,15 +323,22 @@ void FolderMan::slotScheduleSync( const QString& alias )
qDebug() << "Schedule folder " << alias << " to sync!";
if( _currentSyncFolder == alias ) {
// the current folder is currently syncing.
return;
}
if( _scheduleQueue.contains( alias ) ) {
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
if( ! _scheduleQueue.contains(alias )) {
_scheduleQueue.append(alias);
} else {
_scheduleQueue.append( alias );
slotScheduleFolderSync();
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
}
slotScheduleFolderSync();
}
void FolderMan::setSyncEnabled( bool enabled )
{
_syncEnabled = enabled;
}
/*
@@ -337,6 +353,11 @@ void FolderMan::slotScheduleFolderSync()
return;
}
if( ! _syncEnabled ) {
qDebug() << "FolderMan: Syncing is disabled, no scheduling.";
return;
}
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduleQueue.count();
if( ! _scheduleQueue.isEmpty() ) {
const QString alias = _scheduleQueue.takeFirst();
@@ -388,7 +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();
}
void FolderMan::removeAllFolderDefinitions()
@@ -435,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

@@ -21,6 +21,7 @@
#include "mirall/folder.h"
#include "mirall/folderwatcher.h"
#include "mirall/syncfileitem.h"
class QSignalMapper;
@@ -36,8 +37,6 @@ public:
~FolderMan();
int setupFolders();
void disableFoldersWithRestore();
void restoreEnabledFolders();
Mirall::Folder::Map map();
@@ -72,6 +71,21 @@ public:
*/
void removeAllFolderDefinitions();
/**
* Removes csync journals from all folders.
*/
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.
@@ -90,6 +104,12 @@ public slots:
void terminateSyncProcess( const QString& );
// if enabled is set to false, no new folders will start to sync.
// the current one will finish.
void setSyncEnabled( bool );
void slotScheduleAllFolders();
private slots:
// slot to add a folder to the syncing queue
void slotScheduleSync( const QString & );
@@ -101,6 +121,8 @@ private:
// finds all folder configuration files
// and create the folders
int setupKnownFolders();
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.
@@ -111,11 +133,11 @@ private:
FolderWatcher *_configFolderWatcher;
Folder::Map _folderMap;
QHash<QString, bool> _folderEnabledMap;
QString _folderConfigPath;
QSignalMapper *_folderChangeSignalMapper;
QString _currentSyncFolder;
QStringList _scheduleQueue;
bool _syncEnabled;
};
}

View File

@@ -28,20 +28,18 @@
#include <QStringList>
#include <QTimer>
#ifdef USE_INOTIFY
#include <sys/inotify.h>
#endif
static const uint32_t standard_event_mask =
#ifdef USE_INOTIFY
IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVE | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | IN_ONLYDIR | IN_DONT_FOLLOW;
#else
0;
#endif
/* minimum amount of seconds between two
events to consider it a new event */
#define DEFAULT_EVENT_INTERVAL_MSEC 1000
#if defined(Q_OS_WIN)
#include "mirall/folderwatcher_win.h"
#elif defined(Q_OS_MAC)
#include "mirall/folderwatcher_mac.h"
#elif defined(USE_INOTIFY)
#include "mirall/folderwatcher_inotify.h"
#endif
namespace Mirall {
FolderWatcher::FolderWatcher(const QString &root, QObject *parent)
@@ -49,19 +47,13 @@ FolderWatcher::FolderWatcher(const QString &root, QObject *parent)
_eventsEnabled(true),
_eventInterval(DEFAULT_EVENT_INTERVAL_MSEC),
_root(root),
_processTimer(new QTimer(this)),
_lastMask(0),
_initialSyncDone(false)
_processTimer(new QTimer(this))
{
#ifdef USE_INOTIFY
_d = new FolderWatcherPrivate(this);
_processTimer->setSingleShot(true);
QObject::connect(_processTimer, SIGNAL(timeout()), this, SLOT(slotProcessTimerTimeout()));
_inotify = new INotify(standard_event_mask);
slotAddFolderRecursive(root);
QObject::connect(_inotify, SIGNAL(notifyEvent(int, int, const QString &)),
this, SLOT(slotINotifyEvent(int, int, const QString &)));
#endif
// do a first synchronization to get changes while
// the application was not running
setProcessTimer();
@@ -69,7 +61,7 @@ FolderWatcher::FolderWatcher(const QString &root, QObject *parent)
FolderWatcher::~FolderWatcher()
{
delete _d;
}
QString FolderWatcher::root() const
@@ -99,11 +91,22 @@ void FolderWatcher::addIgnore(const QString &pattern)
_ignores.append(pattern);
}
QStringList FolderWatcher::ignores() const
{
return _ignores;
}
bool FolderWatcher::eventsEnabled() const
{
return _eventsEnabled;
}
void FolderWatcher::setEventsEnabledDelayed( int delay_msec )
{
qDebug() << "Starting Event logging again in " << delay_msec << " milliseconds";
QTimer::singleShot( delay_msec, this, SLOT(setEventsEnabled()));
}
void FolderWatcher::setEventsEnabled(bool enabled)
{
qDebug() << " * event notification " << (enabled ? "enabled" : "disabled");
@@ -139,142 +142,16 @@ void FolderWatcher::setEventInterval(int seconds)
_eventInterval = seconds;
}
QStringList FolderWatcher::folders() const
{
#ifdef USE_INOTIFY
return _inotify->directories();
#else
return QStringList();
#endif
}
void FolderWatcher::slotAddFolderRecursive(const QString &path)
{
int subdirs = 0;
qDebug() << "(+) Watcher:" << path;
#ifdef USE_INOTIFY
_inotify->addPath(path);
QStringList watchedFolders(_inotify->directories());
// qDebug() << "currently watching " << watchedFolders;
QStringListIterator subfoldersIt(FileUtils::subFoldersList(path, FileUtils::SubFolderRecursive));
while (subfoldersIt.hasNext()) {
QString subfolder = subfoldersIt.next();
// qDebug() << " (**) subfolder: " << subfolder;
QDir folder (subfolder);
if (folder.exists() && !watchedFolders.contains(folder.path())) {
subdirs++;
// check that it does not match the ignore list
foreach ( const QString& pattern, _ignores) {
QRegExp regexp(pattern);
regexp.setPatternSyntax(QRegExp::Wildcard);
if ( regexp.exactMatch(folder.path()) ) {
qDebug() << "* Not adding" << folder.path();
continue;
}
}
_inotify->addPath(folder.path());
}
else
qDebug() << " `-> discarded:" << folder.path();
}
if (subdirs >0)
qDebug() << " `-> and" << subdirs << "subdirectories";
#else
qDebug() << "** Watcher is not compiled in!";
#endif
}
void FolderWatcher::slotINotifyEvent(int mask, int cookie, const QString &path)
{
int lastMask = _lastMask;
QString lastPath = _lastPath;
_lastMask = mask;
_lastPath = path;
if( ! eventsEnabled() ) return;
#ifdef USE_INOTIFY
qDebug() << "** Inotify Event " << mask << " on " << path;
// cancel close write events that come after create
if (lastMask == IN_CREATE && mask == IN_CLOSE_WRITE
&& lastPath == path ) {
return;
}
if (IN_IGNORED & mask) {
//qDebug() << "IGNORE event";
return;
}
if (IN_Q_OVERFLOW & mask) {
//qDebug() << "OVERFLOW";
}
if (mask & IN_CREATE) {
//qDebug() << cookie << " CREATE: " << path;
if (QFileInfo(path).isDir()) {
//setEventsEnabled(false);
slotAddFolderRecursive(path);
//setEventsEnabled(true);
}
}
else if (mask & IN_DELETE) {
//qDebug() << cookie << " DELETE: " << path;
if ( QFileInfo(path).isDir() && _inotify->directories().contains(path) ) {
qDebug() << "(-) Watcher:" << path;
_inotify->removePath(path);
}
}
else if (mask & IN_CLOSE_WRITE) {
//qDebug() << cookie << " WRITABLE CLOSED: " << path;
}
else if (mask & IN_MOVE) {
//qDebug() << cookie << " MOVE: " << path;
}
else {
//qDebug() << cookie << " OTHER " << mask << " :" << path;
}
foreach (const QString& pattern, _ignores) {
QRegExp regexp(pattern);
regexp.setPatternSyntax(QRegExp::Wildcard);
if (regexp.exactMatch(path)) {
qDebug() << "* Discarded by ignore pattern: " << path;
return;
}
QFileInfo fInfo(path);
if( regexp.exactMatch(fInfo.fileName())) {
qDebug() << "* Discarded by ignore pattern:" << path;
return;
}
if( fInfo.isHidden() ) {
qDebug() << "* Discarded as is hidden!";
return;
}
}
if( !_pendingPathes.contains( path )) {
_pendingPathes[path] = 0;
}
_pendingPathes[path] = _pendingPathes[path]+mask;
#endif
setProcessTimer();
}
void FolderWatcher::slotProcessTimerTimeout()
{
qDebug() << "* Processing of event queue for" << root();
if (!_pendingPathes.empty() || !_initialSyncDone) {
if (!_pendingPathes.empty() ) {
QStringList notifyPaths = _pendingPathes.keys();
_pendingPathes.clear();
//qDebug() << lastEventTime << eventTime;
qDebug() << " * Notify" << notifyPaths.size() << "changed items for" << root();
qDebug() << " * Notify" << notifyPaths.size() << "change items for" << root();
emit folderChanged(notifyPaths);
_initialSyncDone = true;
}
}
@@ -283,12 +160,23 @@ void FolderWatcher::setProcessTimer()
if (!_processTimer->isActive()) {
qDebug() << "* Pending events for" << root()
<< "will be processed after events stop for"
<< eventInterval() << "seconds ("
<< eventInterval() << "milliseconds ("
<< QTime::currentTime().addSecs(eventInterval()).toString(QLatin1String("HH:mm:ss"))
<< ")." << _pendingPathes.size() << "events until now )";
}
_processTimer->start(eventInterval());
}
void FolderWatcher::changeDetected(const QString& f)
{
if( ! eventsEnabled() ) {
// qDebug() << "FolderWatcher::changeDetected when eventsEnabled() -> ignore";
return;
}
_pendingPathes[f] = 1; //_pendingPathes[path]+mask;
setProcessTimer();
}
} // namespace Mirall

View File

@@ -30,9 +30,7 @@ class QTimer;
namespace Mirall {
#ifdef USE_INOTIFY
class INotify;
#endif
class FolderWatcherPrivate;
/**
* Watches a folder and sub folders for changes
@@ -53,11 +51,6 @@ public:
FolderWatcher(const QString &root, QObject *parent = 0L);
~FolderWatcher();
/**
* All watched folders and subfolders
*/
QStringList folders() const;
/**
* Root path being monitored
*/
@@ -82,13 +75,6 @@ public:
*/
bool eventsEnabled() const;
/**
* Enabled or disables folderChanged() events.
* If disabled, events are accumulated and emptied
* the next time a folderChanged() event happens.
*/
void setEventsEnabled(bool enabled);
/**
* Clear all pending events
*/
@@ -106,6 +92,22 @@ public:
*/
void setEventInterval(int seconds);
QStringList ignores() const;
public slots:
/**
* Enabled or disables folderChanged() events.
* If disabled, events are accumulated and emptied
* the next time a folderChanged() event happens.
*/
void setEventsEnabled(bool enabled=true);
/**
* @brief setEventsEnabledDelayed - start event logging after a while
* @param delay - delay time in milliseconds
* @param enabled - enable the events.
*/
void setEventsEnabledDelayed( int );
signals:
/**
* Emitted when one of the paths is changed
@@ -116,32 +118,24 @@ protected:
void setProcessTimer();
protected slots:
void slotINotifyEvent(int mask, int cookie, const QString &path);
void slotAddFolderRecursive(const QString &path);
// called when the manually process timer triggers
void slotProcessTimerTimeout();
void changeDetected(const QString &f);
protected:
QHash<QString, int> _pendingPathes;
private:
bool _eventsEnabled;
int _eventInterval;
#ifdef USE_INOTIFY
INotify *_inotify;
#endif
FolderWatcherPrivate *_d;
QString _root;
// paths pending to notified
// QStringList _pendingPaths;
QHash<QString, int> _pendingPathes;
QTimer *_processTimer;
// to cancel events that belong to the same action
int _lastMask;
QString _lastPath;
QStringList _ignores;
// for the initial synchronization, without
// any file changed
bool _initialSyncDone;
friend class FolderWatcherPrivate;
};
}

View File

@@ -0,0 +1,158 @@
/*
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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 <sys/inotify.h>
#include "mirall/inotify.h"
#include "mirall/folderwatcher.h"
#include "mirall/fileutils.h"
#include "mirall/folderwatcher_inotify.h"
#include <QDir>
#include <QFileInfo>
#include <QDebug>
namespace Mirall {
static const uint32_t standard_event_mask =
IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVE |
IN_CREATE |IN_DELETE | IN_DELETE_SELF |
IN_MOVE_SELF |IN_UNMOUNT |IN_ONLYDIR |
IN_DONT_FOLLOW;
FolderWatcherPrivate::FolderWatcherPrivate(FolderWatcher *p)
: QObject(), _parent(p), _lastMask(0)
{
_inotify = new INotify(this, standard_event_mask);
slotAddFolderRecursive(_parent->root());
QObject::connect(_inotify, SIGNAL(notifyEvent(int, int, const QString &)),
this, SLOT(slotINotifyEvent(int, int, const QString &)));
}
void FolderWatcherPrivate::slotAddFolderRecursive(const QString &path)
{
int subdirs = 0;
qDebug() << "(+) Watcher:" << path;
_inotify->addPath(path);
QStringList watchedFolders(_inotify->directories());
// qDebug() << "currently watching " << watchedFolders;
QStringListIterator subfoldersIt(FileUtils::subFoldersList(path, FileUtils::SubFolderRecursive));
while (subfoldersIt.hasNext()) {
QString subfolder = subfoldersIt.next();
// qDebug() << " (**) subfolder: " << subfolder;
QDir folder (subfolder);
if (folder.exists() && !watchedFolders.contains(folder.path())) {
subdirs++;
// check that it does not match the ignore list
foreach ( const QString& pattern, _parent->ignores()) {
QRegExp regexp(pattern);
regexp.setPatternSyntax(QRegExp::Wildcard);
if ( regexp.exactMatch(folder.path()) ) {
qDebug() << "* Not adding" << folder.path();
continue;
}
}
_inotify->addPath(folder.path());
}
else
qDebug() << " `-> discarded:" << folder.path();
}
if (subdirs >0)
qDebug() << " `-> and" << subdirs << "subdirectories";
}
void FolderWatcherPrivate::slotINotifyEvent(int mask, int cookie, const QString &path)
{
int lastMask = _lastMask;
QString lastPath = _lastPath;
_lastMask = mask;
_lastPath = path;
// TODO: Unify behaviour acress backends!
if( ! _parent->eventsEnabled() ) return;
qDebug() << "** Inotify Event " << mask << " on " << path;
// cancel close write events that come after create
if (lastMask == IN_CREATE && mask == IN_CLOSE_WRITE
&& lastPath == path ) {
return;
}
if (IN_IGNORED & mask) {
//qDebug() << "IGNORE event";
return;
}
if (IN_Q_OVERFLOW & mask) {
//qDebug() << "OVERFLOW";
}
if (mask & IN_CREATE) {
//qDebug() << cookie << " CREATE: " << path;
if (QFileInfo(path).isDir()) {
//setEventsEnabled(false);
slotAddFolderRecursive(path);
//setEventsEnabled(true);
}
}
else if (mask & IN_DELETE) {
//qDebug() << cookie << " DELETE: " << path;
if ( QFileInfo(path).isDir() && _inotify->directories().contains(path) ) {
qDebug() << "(-) Watcher:" << path;
_inotify->removePath(path);
}
}
else if (mask & IN_CLOSE_WRITE) {
//qDebug() << cookie << " WRITABLE CLOSED: " << path;
}
else if (mask & IN_MOVE) {
//qDebug() << cookie << " MOVE: " << path;
}
else {
//qDebug() << cookie << " OTHER " << mask << " :" << path;
}
foreach (const QString& pattern, _parent->ignores()) {
QRegExp regexp(pattern);
regexp.setPatternSyntax(QRegExp::Wildcard);
if (regexp.exactMatch(path)) {
qDebug() << "* Discarded by ignore pattern: " << path;
return;
}
QFileInfo fInfo(path);
if( regexp.exactMatch(fInfo.fileName())) {
qDebug() << "* Discarded by ignore pattern:" << path;
return;
}
if( fInfo.isHidden() ) {
qDebug() << "* Discarded as is hidden!";
return;
}
}
if( !_parent->_pendingPathes.contains( path )) {
_parent->_pendingPathes[path] = 0;
}
_parent->_pendingPathes[path] = _parent->_pendingPathes[path]+mask;
_parent->setProcessTimer();
}
} // namespace Mirall

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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_FOLDERWATCHER_INOTIFY_H
#define MIRALL_FOLDERWATCHER_INOTIFY_H
#include <QObject>
namespace Mirall {
class INotify;
class FolderWatcher;
class FolderWatcherPrivate : public QObject {
Q_OBJECT
public:
FolderWatcherPrivate(FolderWatcher *p);
private slots:
void slotAddFolderRecursive(const QString &path);
void slotINotifyEvent(int mask, int cookie, const QString &path);
private:
INotify *_inotify;
FolderWatcher *_parent;
// to cancel events that belong to the same action
int _lastMask;
QString _lastPath;
};
}
#endif // MIRALL_FOLDERWATCHER_INOTIFY_H

View File

@@ -0,0 +1,86 @@
/*
* Copyright (C) by Markus Goetz <markus@woboq.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 "config.h"
#include "mirall/folder.h"
#include "mirall/folderwatcher.h"
#include "mirall/folderwatcher_mac.h"
#include <cerrno>
#include <QDebug>
#include <QStringList>
namespace Mirall {
FolderWatcherPrivate::FolderWatcherPrivate(FolderWatcher *p)
: parent(p)
{
folder = parent->root();
this->startWatching();
}
FolderWatcherPrivate::~FolderWatcherPrivate()
{
FSEventStreamStop(stream);
FSEventStreamInvalidate(stream);
}
static void callback(
ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
{
qDebug() << "FolderWatcherPrivate::callback by OS X";
reinterpret_cast<FolderWatcherPrivate*>(clientCallBackInfo)->doNotifyParent();
}
void FolderWatcherPrivate::startWatching()
{
qDebug() << "FolderWatcherPrivate::startWatching()" << folder;
CFStringRef folderCF = CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(folder.unicode()),
folder.length());
CFArrayRef pathsToWatch = CFStringCreateArrayBySeparatingStrings (NULL, folderCF, CFSTR(":"));
//CFStringCreateArrayBySeparatingStrings (NULL, folderCF, CFSTR(":"));
FSEventStreamContext ctx = {0, this, NULL, NULL, NULL};
// TODO: Add kFSEventStreamCreateFlagFileEvents ?
stream = FSEventStreamCreate(NULL,
&callback,
&ctx,
pathsToWatch,
kFSEventStreamEventIdSinceNow,
0, // latency
kFSEventStreamCreateFlagNone
);
FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
FSEventStreamStart(stream);
}
void FolderWatcherPrivate::doNotifyParent() {
parent->changeDetected(folder);
}
} // ns mirall

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
* Copyright (C) by Markus Goetz <markus@woboq.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
@@ -12,31 +12,36 @@
* for more details.
*/
#ifndef MIRALL_THEME_H
#define MIRALL_THEME_H
#ifndef MIRALL_FOLDERWATCHER_MAC_H
#define MIRALL_FOLDERWATCHER_MAC_H
#include "theme.h"
#include <QObject>
#include <QString>
namespace Mirall {
#include <CoreServices/CoreServices.h>
class mirallTheme : public Theme
namespace Mirall
{
class FolderWatcherPrivate
{
public:
mirallTheme();
virtual QString appName() const;
virtual QString configFileName() const;
QPixmap splashScreen() const;
FolderWatcherPrivate(FolderWatcher *p);
~FolderWatcherPrivate();
QIcon folderIcon( const QString& ) const;
QIcon syncStateIcon(SyncResult::Status) const;
QIcon folderDisabledIcon() const;
QIcon applicationIcon() const;
void startWatching();
void doNotifyParent();
private:
FolderWatcher *parent;
QString folder;
FSEventStreamRef stream;
};
}
#endif // MIRALL_THEME_H
#endif

View File

@@ -0,0 +1,91 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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 <QThread>
#include <QDebug>
#include "mirall/folderwatcher.h"
#include "mirall/folderwatcher_win.h"
#include <stdlib.h>
#include <stdio.h>
#include <tchar.h>
namespace Mirall {
void WatcherThread::run()
{
_handle = FindFirstChangeNotification((wchar_t*)_path.utf16(),
true, // recursive watch
FILE_NOTIFY_CHANGE_FILE_NAME |
FILE_NOTIFY_CHANGE_DIR_NAME |
FILE_NOTIFY_CHANGE_LAST_WRITE);
if (_handle == INVALID_HANDLE_VALUE)
{
qDebug() << Q_FUNC_INFO << "FindFirstChangeNotification function failed, stopping watcher!";
FindCloseChangeNotification(_handle);
_handle = 0;
return;
}
if (_handle == NULL)
{
qDebug() << Q_FUNC_INFO << "FindFirstChangeNotification returned null, stopping watcher!";
FindCloseChangeNotification(_handle);
_handle = 0;
return;
}
while(true) {
switch(WaitForSingleObject(_handle, /*wait*/ INFINITE)) {
case WAIT_OBJECT_0:
if (FindNextChangeNotification(_handle) == false) {
qDebug() << Q_FUNC_INFO << "FindFirstChangeNotification returned FALSE, stopping watcher!";
FindCloseChangeNotification(_handle);
_handle = 0;
return;
}
// qDebug() << Q_FUNC_INFO << "Change detected in" << _path << "from" << QThread::currentThread ();
emit changed(_path);
break;
default:
qDebug() << Q_FUNC_INFO << "Error while watching";
}
}
}
WatcherThread::~WatcherThread()
{
if (_handle)
FindCloseChangeNotification(_handle);
}
FolderWatcherPrivate::FolderWatcherPrivate(FolderWatcher *p)
: _parent(p)
{
_thread = new WatcherThread(p->root());
connect(_thread, SIGNAL(changed(const QString&)),
_parent,SLOT(changeDetected(const QString&)));
_thread->start();
}
FolderWatcherPrivate::~FolderWatcherPrivate()
{
_thread->terminate();
_thread->wait();
delete _thread;
}
} // namespace Mirall

View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) by Daniel Molkentin <danimo@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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_FOLDERWATCHER_WIN_H
#define MIRALL_FOLDERWATCHER_WIN_H
#include <QThread>
#include <windows.h>
namespace Mirall {
class FolderWatcher;
// watcher thread
class WatcherThread : public QThread {
Q_OBJECT
public:
WatcherThread(const QString &path) :
QThread(), _path(path), _handle(0) {}
~WatcherThread();
protected:
void run();
signals:
void changed(const QString &path);
private:
QString _path;
HANDLE _handle;
};
class FolderWatcherPrivate : public QObject {
Q_OBJECT
public:
FolderWatcherPrivate(FolderWatcher *p);
~FolderWatcherPrivate();
private:
FolderWatcher *_parent;
WatcherThread *_thread;
};
}
#endif // MIRALL_FOLDERWATCHER_WIN_H

View File

@@ -38,7 +38,7 @@ FolderWizardSourcePage::FolderWizardSourcePage()
registerField(QLatin1String("sourceFolder*"), _ui.localFolderLineEdit);
_ui.localFolderLineEdit->setText( QString::fromLatin1( "%1/%2").arg( QDir::homePath() ).arg(Theme::instance()->appName() ) );
registerField(QLatin1String("alias*"), _ui.aliasLineEdit);
_ui.aliasLineEdit->setText( Theme::instance()->appName() );
_ui.aliasLineEdit->setText( Theme::instance()->appNameGUI() );
_ui.warnLabel->hide();
#if QT_VERSION >= 0x040700
@@ -78,10 +78,17 @@ bool FolderWizardSourcePage::isComplete() const
if( ! map ) return false;
if( isOk ) {
Folder::Map::const_iterator i = map->begin();
Folder::Map::const_iterator i = map->constBegin();
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;
@@ -110,7 +117,7 @@ bool FolderWizardSourcePage::isComplete() const
isOk = false;
}
Folder::Map::const_iterator i = map->begin();
Folder::Map::const_iterator i = map->constBegin();
bool goon = true;
while( goon && i != map->constEnd() ) {
Folder *f = static_cast<Folder*>(i.value());
@@ -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)
@@ -209,7 +205,7 @@ void FolderWizardTargetPage::slotDirCheckReply(const QString &url, QNetworkReply
showWarn();
} else {
showWarn( tr("The folder is not available on your %1.<br/>Click to create it." )
.arg( Theme::instance()->appName() ), true );
.arg( Theme::instance()->appNameGUI() ), true );
}
emit completeChanged();
@@ -217,11 +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 );
}
@@ -234,10 +229,10 @@ void FolderWizardTargetPage::slotCreateRemoteFolderFinished( QNetworkReply::Netw
// the webDAV server seems to return a 202 even if mkdir was successful.
if( error == QNetworkReply::NoError ||
error == QNetworkReply::ContentOperationNotPermittedError) {
showWarn( tr("Folder was successfully created on %1.").arg( Theme::instance()->appName() ), false );
showWarn( tr("Folder was successfully created on %1.").arg( Theme::instance()->appNameGUI() ), false );
slotTimerFires();
} else {
showWarn( tr("Failed to create the folder on %1.<br/>Please check manually.").arg( Theme::instance()->appName() ), false );
showWarn( tr("Failed to create the folder on %1.<br/>Please check manually.").arg( Theme::instance()->appNameGUI() ), false );
}
}
@@ -247,26 +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()->appName()).arg(infoStr));
// _ui.OCLabel->setText( tr("to your <a href=\"%1\">%2</a> (version %3)").arg(url)
// .arg(Theme::instance()->appNameGUI()).arg(infoStr));
_ui.OCFolderLineEdit->setEnabled( true );
_ui.OCRadioBtn->setEnabled( true );
qDebug() << "ownCloud found on " << url << " with version: " << infoStr;
}
}
@@ -323,10 +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()->appName()) );
// _ui.OCLabel->setText( tr("no configured %1 found!").arg(Theme::instance()->appNameGUI()) );
showWarn( tr("%1 could not be reached:<br/><tt>%2</tt>")
.arg(Theme::instance()->appName()).arg(error->errorString()));
_ui.OCRadioBtn->setEnabled( false );
.arg(Theme::instance()->appNameGUI()).arg(error->errorString()));
_ui.OCFolderLineEdit->setEnabled( false );
}
@@ -343,132 +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());
setWindowTitle( tr( "%1 Folder Wizard" ).arg( Theme::instance()->appName() ) );
if (!Theme::instance()->singleSyncFolder()) {
_folderWizardTargetPage = new FolderWizardTargetPage();
setPage(Page_Target, _folderWizardTargetPage );
}
setWindowTitle( tr( "%1 Folder Wizard" ).arg( Theme::instance()->appNameGUI() ) );
#ifdef Q_WS_MAC
setWizardStyle( QWizard::ModernStyle );
#endif
}
FolderWizard::~FolderWizard()
{
delete _folderWizardSourcePage;
if( _folderWizardTargetPage )
delete _folderWizardTargetPage;
}
void FolderWizard::setFolderMap( Folder::Map *fm)
{
if( _folderWizardSourcePage ) {

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