1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2026-04-04 20:34:17 +02:00

Compare commits

..

218 Commits

Author SHA1 Message Date
Daniel Molkentin
1d8900dc19 OS X: write a qt.conf file 2014-10-01 23:57:14 +02:00
Daniel Molkentin
171fd22d91 Fix rpath for libraries 2014-10-01 21:41:56 +02:00
Daniel Molkentin
78d50f4033 CPack is still needed for Windows
This partially reverts commit dafd9c308f.
This partially reverts commit 7f836cc01b.
2014-10-01 21:16:18 +02:00
Klaas Freitag
fee18dd457 Push version to beta2 2014-10-01 21:04:13 +02:00
Klaas Freitag
81d3ce8257 cmake: Commented setting of the INSTALL_PREFIX var on Mac 2014-10-01 20:55:39 +02:00
Daniel Molkentin
5213970c3d OSX: fix signing script 2014-10-01 17:57:51 +02:00
Daniel Molkentin
bcc06af904 fix last commit 2014-10-01 17:46:29 +02:00
Daniel Molkentin
a98242a2b8 fix install target for macdeployqt 2014-10-01 17:32:17 +02:00
Daniel Molkentin
5f715ca063 OSX: fix Frameworks path in signing script 2014-10-01 16:04:24 +02:00
Daniel Molkentin
0ceeff62d6 Fix app signing on OS X 2014-10-01 15:34:42 +02:00
Daniel Molkentin
f53a7c0e4a Improve macdeploy script 2014-10-01 15:34:42 +02:00
Daniel Molkentin
41b07d045a OS X: Use a python script to fix for bundle fixup...
...rather than relying on cmake magic
2014-10-01 15:34:42 +02:00
Olivier Goffart
0d303f1d1f SelectiveSync: sort the item instead of using the order from the server
Task #2259
2014-10-01 13:47:24 +02:00
Jenkins for ownCloud
3e982ad34c [tx-robot] updated from transifex 2014-10-01 06:54:46 -04:00
Daniel Molkentin
dafd9c308f More removal of obsolete CMake code 2014-10-01 12:51:38 +02:00
Daniel Molkentin
7f836cc01b Kill obsolete Mac deployment code 2014-10-01 12:35:21 +02:00
Olivier Goffart
147fa60f81 Merge branch 'socketapi_localsocket' into 1.7 2014-10-01 12:34:22 +02:00
Olivier Goffart
a1b9405e2e Windows has not been ported back to QLocalSocket 2014-10-01 12:33:54 +02:00
Olivier Goffart
db02d44c6a No need to update mtime and etag after a move
The server keeps the mtime and etag anyway.
And changing the mtime also changes the etag and so make other clients re-download
the file instead of detecting the move
2014-10-01 11:22:00 +02:00
Klaas Freitag
dff1f77dfa SocketAPI: remove nonsense FIXME's. 2014-09-30 17:12:07 +02:00
Daniel Molkentin
1a2fff8ed8 OS X: Use a python script to fix for bundle fixup...
...rather than relying on cmake magic
2014-09-30 17:09:16 +02:00
Markus Goetz
52c12b33c3 OS X: CMD+H should hide the dialog 2014-09-30 15:21:55 +02:00
Klaas Freitag
29987ca2aa Overlays Linux: Add the state to the cache to save calls to add_emblem
The SocketAPI sends status updates for files without being asked for.
And in order to not draw the emblem again if it had not changed, the
state is compared before calling add_emblem
2014-09-30 13:57:06 +02:00
Markus Goetz
02f971b534 OS X Overlay Icons: Fix request for sync dir itself 2014-09-30 12:53:35 +02:00
Klaas Freitag
479b340d75 Folderman: Check if socketApi member is non zero, no crashes. 2014-09-30 12:33:51 +02:00
Klaas Freitag
06c48f58cc SyncEngine: Use proper start indicator, max unit64.
This avoids a warning.
2014-09-30 12:29:24 +02:00
Klaas Freitag
0ee81a2865 SocketAPI: Set permission of the socket Directory.
Set that to be accessible by the owner only.
2014-09-30 11:23:49 +02:00
Klaas Freitag
e78c251832 SocketAPI: Split up for specific linux and mac implementation. 2014-09-30 11:23:49 +02:00
Klaas Freitag
efbc495f79 overlays Nautilus: Adopt to the use a local unix socket not TCP.
Also, use the appname to find the correct branded icons.
2014-09-30 11:17:05 +02:00
Markus Goetz
f8b73eb9d9 SocketApi: Port OS X to use local sockets 2014-09-30 07:36:20 +02:00
Jenkins for ownCloud
f25a590af5 [tx-robot] updated from transifex 2014-09-30 01:25:39 -04:00
Markus Goetz
0539098371 OS X: Update GCDAsyncSocket
The two files are from the fork from
https://github.com/jdiehl/CocoaAsyncSocket/tree/socketUN
It supports unix domain sockets.

SHA1 was 7e97fc876522c7bf2a2a434cf40579ae9daf9da5
2014-09-30 07:09:39 +02:00
Klaas Freitag
788c27bf2f cmake: Fix installation of overlay icons on linux 2014-09-29 16:08:49 +02:00
Olivier Goffart
a587148c73 SocketApi: Save the socket in $XDG_RUNTIME/<appname>/socket 2014-09-29 13:54:13 +02:00
Olivier Goffart
9acd3a58ee SocketApi: Use QLocalSocket after all for windows and linux
Relates issue #2189
2014-09-29 12:19:33 +02:00
Jenkins for ownCloud
449f5adaba [tx-robot] updated from transifex 2014-09-28 01:25:20 -04:00
Jenkins for ownCloud
2380b7af3d [tx-robot] updated from transifex 2014-09-27 01:25:22 -04:00
Olivier Goffart
10989d13e4 Folder: Remove slotTerminateAndPauseSync
This make no sens to just set the pause config flag here. It make selective sync to mark
the folder as posed on restart
2014-09-26 12:43:54 +02:00
Olivier Goffart
fe1653ede6 csync_update: don't recurse into ignored directory.
This save some time when selective sync deselected a large tree
2014-09-26 12:35:56 +02:00
Olivier Goffart
b4071cec01 DiscoveryPhase: fix the name of a function
It was renamed from white list to black list long ago
2014-09-26 12:35:56 +02:00
Klaas Freitag
b1c842373d Add OWNCLOUDSYNC_EXPORT to make building on windows. 2014-09-26 10:07:50 +02:00
Olivier Goffart
a3d70b3cf6 Attempt to fix a crash
The reply might be null at the point we are timing out.
Issue #2246
2014-09-26 10:04:36 +02:00
Jenkins for ownCloud
70912c44de [tx-robot] updated from transifex 2014-09-26 01:25:28 -04:00
Klaas Freitag
98d9f7924d SocketAPI: Before reporting something new check for parent permissions.
In case it is not allowed to create files or dirs because of missing
permissions in shares, the socket API has to report an error state
rather than the NEW state.

As discussed in mirall issue #1931
2014-09-25 21:52:20 +02:00
Klaas Freitag
172295289e Permissions: If a top level shared dir is removed, do not restore files in it
A top level shared dir can always be removed on the client, even if it is
read only shared. In that case, the removal means "unsharing". Fixed the
permission check accordingly.

See bug #1918 for more information.
2014-09-25 15:39:14 +02:00
Klaas Freitag
8ba08d7e87 Activity View: honor error string even if no warning
that allows to specify a more specific user message to be displayed.
2014-09-25 15:03:54 +02:00
Klaas Freitag
8915f94931 Mac Overlays: handle filenames with slashes properly.
There are filenames with slashes on MacOSX, they can be created
in Finder. Internally they are converted to colons.
2014-09-25 12:24:32 +02:00
Klaas Freitag
31bf844452 DownloadJob: Refresh the FileInfo after renaming the target file.
Otherwise the activity view reports file size 0.
2014-09-25 10:59:08 +02:00
Jenkins for ownCloud
0c8b74a025 [tx-robot] updated from transifex 2014-09-25 01:25:30 -04:00
Olivier Goffart
dad8c1c27c propagator: Do not check for case clash when renaming
Issue #1385

When renaming, we would normaly already have an error if the file already exist.
And we want to allow the renaming to chang ethe case (Eg. "hello" -> "HELLO"
2014-09-24 16:43:01 +02:00
Klaas Freitag
2e12acdf32 doc: add a memo about the issue that defines the permission flags. 2014-09-24 16:35:50 +02:00
Jenkins for ownCloud
d6156dd755 [tx-robot] updated from transifex 2014-09-24 01:25:22 -04:00
Klaas Freitag
2c67a7ca71 progress: Set a clear start indication in the progress.
Before, 0 was used to indicate the sync start which wipes the activity
window. However, if there _are_ no synced items but only ignored items
the overall counter stays zero which wipes the list all the time.

This fixes bug #2171
2014-09-23 15:58:06 +02:00
Klaas Freitag
688b8dcc38 MacOverlays: Pass isDir flag to isRegisteredPath method
With that, a path can be added to directories to also detect the
sync top directory.

This fixes bug #2053
2014-09-23 10:25:11 +02:00
Klaas Freitag
280edee1db cmake: fix typo 2014-09-23 10:25:11 +02:00
Jenkins for ownCloud
b9ea72f189 [tx-robot] updated from transifex 2014-09-23 01:49:01 -04:00
Klaas Freitag
8f8265b219 Mac Installer: Add file name quoting. 2014-09-22 16:45:33 +02:00
Klaas Freitag
00ae3c3120 Mac Installer: Rename the final package to branded. 2014-09-22 16:38:51 +02:00
Klaas Freitag
1e49f152be Mac create pkg: Adjust background image path 2014-09-22 16:25:23 +02:00
Klaas Freitag
f72ca4d83e Mac installer: Use template value for bundle name 2014-09-22 16:18:30 +02:00
Klaas Freitag
5b10a9f3a7 Minor: Remove unused definition 2014-09-22 13:47:45 +02:00
Klaas Freitag
d0fb1acebb Win32: Define HANDLE variable, make win compile again. 2014-09-22 13:47:17 +02:00
Klaas Freitag
09be4d22ee Nautilus: Renamed nautilus plugin script to make it branding friendly 2014-09-22 12:24:06 +02:00
Klaas Freitag
11a64320f0 git: fix entry in .gitattributes to not export binary dir. 2014-09-22 11:24:24 +02:00
Jenkins for ownCloud
4eac66b84a [tx-robot] updated from transifex 2014-09-22 01:25:21 -04:00
Jenkins for ownCloud
497b7808b6 [tx-robot] updated from transifex 2014-09-21 01:25:21 -04:00
Jenkins for ownCloud
b10c2b5946 [tx-robot] updated from transifex 2014-09-20 01:25:29 -04:00
Christian Kamm
fa881ba1c7 Notifications: Don't emit one per error. #1777 2014-09-19 15:59:03 +02:00
Christian Kamm
eb1b17e8e4 CSync tests: Add t1.cfg to gitignore. 2014-09-19 14:21:14 +02:00
Christian Kamm
2eec85a97c NetworkJobs: Propagator jobs keep others from expiring. #2155
In some owncloud server setups multiple concurrent connections for the
same session are not supported: owncloud/core#11153

This causes issues with multiple uploads and downloads. A usual symptom
is the quota job failing and the sync aborting.

This workaround lets activity on the propagator's GET and PUT jobs
reset the timeout of all network jobs. That way, queries like the quota
job would not time out while a large up/download is in progress.
2014-09-19 11:22:57 +02:00
Jenkins for ownCloud
c85b6193d5 [tx-robot] updated from transifex 2014-09-19 01:25:29 -04:00
Klaas Freitag
fc36e7eccf tests: Add a csync exclude test to check toplevel excludes. 2014-09-18 15:34:24 +02:00
Klaas Freitag
0cc2bbf5d9 csync exclude: Export the csync_exclude_add function in debug mode 2014-09-18 15:34:24 +02:00
Jürgen Weigert
d2669debb9 Merge branch '1.7' of https://github.com/owncloud/mirall into 1.7 2014-09-18 12:37:17 +02:00
Jürgen Weigert
637fb449c6 Fixed https://github.com/owncloud/mirall/issues/1699
Added missing copyright headers.
2014-09-18 12:30:42 +02:00
Daniel Molkentin
e82b319ee7 Fix owncloud man page formatting 2014-09-18 12:30:20 +02:00
Klaas Freitag
e9248066df SyncJournal: Better error report for sql statements in updateDbStructure
Also, even if the updateDatabaseStructure fails, precompile the sql
statements.

This will help to debug and maybe solve bug #2106
2014-09-18 12:02:28 +02:00
Daniel Molkentin
819472d366 Fix owncloud man page formatting 2014-09-18 11:44:25 +02:00
Daniel Molkentin
21bbdd6f49 Update owncloudcmd documentation 2014-09-18 11:36:14 +02:00
Christian Kamm
a88ac00115 SyncEngine: Better reporting when ignoring hardlinks. #2217
Also touch csync to actually let us know it's ignoring the file
due to it having hard links.
2014-09-18 11:32:29 +02:00
Christian Kamm
30683b38a8 Updater: Add "didn't check for updates" message. #2175
Don't show "Checking server..." when we are not.

(cherry picked from commit ece11dc3d8)
2014-09-18 09:43:13 +02:00
Christian Kamm
45aefeb146 SelectiveSyncDialog: Change 'partial' behavior.
The real bug in #2219 actually was that the gui allowed users to
choose to not sync the root folder. That's not supported and no
longer possible in the UI.

Instead you may now sync a folder's files without syncing its sub-
folders.
2014-09-18 09:42:50 +02:00
Jenkins for ownCloud
580ecbff0c [tx-robot] updated from transifex 2014-09-18 01:25:28 -04:00
Daniel Molkentin
db3318886e Merge pull request #2214 from owncloud/2211
Implement (most of) #2211
2014-09-18 00:09:26 +02:00
Daniel Molkentin
54eb837950 Remove unused confdir option 2014-09-18 00:07:33 +02:00
Christian Kamm
0bd73788f4 Doc: Update csync test script README. 2014-09-17 16:18:55 +02:00
Christian Kamm
e395282e0e SelectiveSyncDialog: Fix sync-nothing case. #2219 2014-09-17 16:13:47 +02:00
Christian Kamm
1f129d0bcb Propagator: Don't upload files that were changed recently.
Instead skip them and try another sync later.

See #2167, #2169, #2210.
2014-09-17 15:30:18 +02:00
Christian Kamm
c2ae5e5fd1 FolderMan: Ensure a 1s delay between sync request and start.
That way the propagator can detect files that are still being
changed right now and skip them.
2014-09-17 15:30:18 +02:00
Olivier Goffart
292a7357bd t1.cfg.in: saner placeholder executable name
Now it is owncloudcmd and not csync
2014-09-17 14:39:34 +02:00
Christian Kamm
99aa2cdf2a Log: Print client version on sync start. #2178 2014-09-17 09:39:04 +02:00
Christian Kamm
0eb9401c62 File change detection: Also look at file sizes.
See #2167 and #2169.

* csync_detect_update: Reupload a file if the sizes differ, similar
  to how we reupload if the mtimes differ.
* PropagateUploadFileQNAM::slotPutFinished(): Abort an upload if the
  size changed, similar to how we abort an upload if the mtimes changed.
2014-09-17 09:05:13 +02:00
Jenkins for ownCloud
ab14a589c8 [tx-robot] updated from transifex 2014-09-17 01:25:27 -04:00
Daniel Molkentin
122fa596b3 Remove stray file that was not meant to be committed 2014-09-17 00:55:55 +02:00
Daniel Molkentin
5406407ed6 Implement --non-interactive as per Juergens' request 2014-09-17 00:12:16 +02:00
Daniel Molkentin
b72cee2783 Fix passing URLs not ending in /remote.php/webdav 2014-09-16 23:53:01 +02:00
Daniel Molkentin
fe023e2229 Allow passing user/pass explicitly or via netrc
#2211
2014-09-16 23:52:28 +02:00
Jenkins for ownCloud
1dae928a7c [tx-robot] updated from transifex 2014-09-16 01:25:22 -04:00
Olivier Goffart
9b1779bb06 Fix compilation
qFatal does not work with <<
2014-09-15 18:03:44 +02:00
Olivier Goffart
97cc05eeea journaldb: Assert in case of SQL error
relates issue #2106
2014-09-15 14:27:39 +02:00
Christian Kamm
20dd3b0a69 FolderMan: Fix startFromScratch logic. #1989
(cherry picked from commit 4566ca3127)
2014-09-15 13:53:38 +02:00
Christian Kamm
f348eabf19 Account: Fix cert save/restore from settings. #2160
(cherry picked from commit cc1121ef00)
2014-09-15 13:53:38 +02:00
Olivier Goffart
5870a57002 wizard: fix start a clean sync
The problem was that the backup function failed as we tried to
move  /home/xxx/ownCloud/  to /home/xxx/ownCloud/.oC_bak
The intention was to move it to /home/xxx/ownCloud.oC_bak

Issue #1989
2014-09-15 13:49:13 +02:00
Olivier Goffart
278bc5a8cd owncloudcmd: ask for the login and password and put it in the url (if it's not there already)
Because we cannot rely on HTTPCredentials to open windows in a command line tool

Fixes #1860
2014-09-15 13:24:31 +02:00
Jenkins for ownCloud
3c89415df1 [tx-robot] updated from transifex 2014-09-14 01:25:21 -04:00
Jenkins for ownCloud
5981f700f5 [tx-robot] updated from transifex 2014-09-13 05:16:21 -04:00
Olivier Goffart
af5e8ee18c AbstractNetworkJob
Abort the transfer in case of timeout.

This avoid that a connection that never replies blocks mirall

Issue #2148
2014-09-12 18:06:29 +02:00
Olivier Goffart
52e8343f76 ConnecitonValidator: Handle the timeout
otherwise the account may be stuck in a disconnect case if there is a timeout

Issue #2148
2014-09-12 18:06:17 +02:00
Olivier Goffart
a4dbf5942c owncloudcmd: restart the sync if required
Fixes #2038
2014-09-12 17:23:01 +02:00
Daniel Molkentin
ada1d42ebf Sparkle requirement bumped to 1.8 2014-09-12 16:08:52 +02:00
Daniel Molkentin
f27182ae05 fFx Utility::freeDiskSpace for win32 2014-09-12 16:08:52 +02:00
Markus Goetz
2fddf05515 OS X: Overlay Icons: Load from bundle-specific path
The client (in this case mirall) tells the Finder plugin where to get the icons.
This enables installation in different locations and in branded clients.
2014-09-12 15:09:47 +02:00
Markus Goetz
91d1864840 OS X: Overlay Icons: Less verbose debug output 2014-09-12 15:09:46 +02:00
Olivier Goffart
79052ba7c6 Blacklist: ignore problems that don't have HTTP error code and are possibly problem on the local file system
Issue #1985
2014-09-12 14:13:04 +02:00
Markus Goetz
0edd4d3c02 OS X: Overlay icons: Don't show if folder is not marked as being an oC folder 2014-09-12 11:46:53 +02:00
Jenkins for ownCloud
71516c480d [tx-robot] updated from transifex 2014-09-12 03:28:04 -04:00
Jenkins for ownCloud
1304c2c4ab [tx-robot] updated from transifex 2014-09-11 01:25:22 -04:00
Olivier Goffart
a84b7dc27e Restart the sync when we detect we need to redo a sync
Fixes #1968
Relates #2038
2014-09-10 17:27:33 +02:00
Daniel Molkentin
927af0adec Fix build on win32: add missing export 2014-09-10 16:31:47 +02:00
Daniel Molkentin
2dfbc2058f Win32: ignore files ending in '.' or at least one space
Fixes #416
Fixes #2176
2014-09-10 15:21:19 +02:00
Olivier Goffart
79ee6c2f3b csync_vio_local on windows: fix overflow when computing the size of file > 4GiB
MAXDWORD is 0xFFFFFFFF, so if we add one, it overflows and is 0.
We need to cast it to 64 bits before
2014-09-10 13:21:31 +02:00
Daniel Molkentin
f59a6862ca raiseDialog: Actually send the XEvent
Amendment to 25c274a0bd

Conflicts:
	src/mirall/owncloudgui.cpp
2014-09-10 13:21:27 +02:00
Olivier Goffart
fa962b7f53 csync_update: fix compilation warning 2014-09-10 11:08:00 +02:00
Olivier Goffart
71408bab60 I forgot to rename one of the while list to the blacklist 2014-09-10 11:01:38 +02:00
Jenkins for ownCloud
9e015eb654 [tx-robot] updated from transifex 2014-09-09 01:25:24 -04:00
Markus Goetz
4ce03e8b61 OS X: Fix Overlay icon retrieval
Re-retrieve all icons for a path in case we receive UPDATE_VIEW.
(But in contrast to previous code, don't delete the icons which then
would have caused screen flickering)
2014-09-07 11:38:23 +02:00
Jenkins for ownCloud
68b7f412b6 [tx-robot] updated from transifex 2014-09-07 01:25:23 -04:00
Jenkins for ownCloud
20011f3a84 [tx-robot] updated from transifex 2014-09-06 01:25:23 -04:00
Daniel Molkentin
2d020b5989 Merge pull request #2138 from owncloud/cleanup_shell_integration_nautilus
Cleanup and make python3 compatible shell integration nautilus
2014-09-05 15:48:16 +02:00
Markus Goetz
1909b465dc CSync: Show file size and inode during update traversal
With the previous code, we saw those values only when the file/dir was also in the local DB
2014-09-05 15:23:33 +02:00
Christian Kamm
88b7f2e0ee SyncJournal: Don't use C++11 features. 2014-09-05 12:48:45 +02:00
Jenkins for ownCloud
531d586460 [tx-robot] updated from transifex 2014-09-05 01:25:28 -04:00
Christian Kamm
2630a73a1c Propagator: Use csync to get the modification time.
See owncloud/core#9781
2014-09-04 14:16:23 +02:00
ckamm
4decd15ca9 Merge pull request #2161 from ckamm/stale-downloadinfo
Clean up stale journal entries and temporaries. #2057
2014-09-04 14:14:39 +02:00
ckamm
3a59dd24f3 Merge pull request #2162 from ckamm/error-missing-exclude
Don't do a broken sync when the system exclude file is missing
2014-09-04 14:14:07 +02:00
Christian Kamm
1cf1f6edcb Fix style issues. 2014-09-04 13:27:11 +02:00
Christian Kamm
5d36a27893 Clean up stale journal entries and temporaries. #2057
* Downloadinfo entries for files that no longer need to be downloaded
  are useless and can be removed. In particular, the temporary files
  holding partially retrieved files are now deleted when no longer
  necessary.
* The same is true for blacklist entries for paths that are no longer
  being discovered.
* Same for uploadinfos for files that no longer need to be uploaded.
2014-09-04 13:14:15 +02:00
Christian Kamm
da94533647 Folders: Signout should not switch folders to paused state. #2112
On signout, syncs that are running in folders are aborted. That used to
also switch the state of these folders to 'paused'. To fix that, aborts
that are caused by user actions no longer change the folder paused
state.

Aborts due to errors should still pause folders! Otherwise we'd try
resyncing them even though there was an error.
2014-09-04 11:21:28 +02:00
Jenkins for ownCloud
db08d5021e [tx-robot] updated from transifex 2014-09-04 01:25:25 -04:00
Markus Goetz
69066013c1 ownCloudTheme: Fix casing in appName()
Without this fix, the section in the config file uses the wrong name,
leading to re-configuration of the client needed.
2014-09-03 17:30:34 +02:00
Christian Kamm
aef569ee9d SyncEngine: Use exclude file fallback next to binary on linux.
This is mainly useful for developers where the system-wide exclude file
may not exist.
2014-09-03 14:53:01 +02:00
Christian Kamm
cf881aa6dc SyncEngine: Fix invalid slot name in sync error condition. 2014-09-03 14:52:55 +02:00
Christian Kamm
a48bf3142c SyncEngine: Abort sync with error if system exclude file is missing.
Syncing without the system exclude file would cause lots of trouble.
For instance we would try uploading the temporary files we store
partially completed downloads in.
2014-09-03 14:52:46 +02:00
Jenkins for ownCloud
33d9f4b882 [tx-robot] updated from transifex 2014-09-03 01:25:21 -04:00
Markus Goetz
49c40a4b11 OS X: Have the PKG installer also be signed 2014-09-02 17:57:22 +02:00
Markus Goetz
d1eff0ae24 OS X: Add sign_app.sh 2014-09-02 16:14:00 +02:00
Daniel Molkentin
c0131695c5 Return from Folder::slotPollTimerTimeout() if the account object is 0
Right now, we crash instead. This can happen if a folder is created
when an account object is not (anymore/yet) created.

Fixes #2142
2014-09-02 14:51:33 +02:00
Daniel Molkentin
fcbadda40f Make Settings Window close on Ctrl+W
Fixes #2141

(cherry picked from commit 2ab19b23d7)
2014-09-02 14:03:20 +02:00
Daniel Molkentin
2455faa6fe Account Migrator: Switch to string comparison for URLs.
QUrl does not normalize trailing slashes, so there is no benefit
of using QUrl here.

(cherry picked from commit d770f9cc1a)
2014-09-02 14:03:07 +02:00
Markus Goetz
7da8a5e374 OS X: Create tbz in create_mac_pkg.sh
Sparkle needs this
2014-09-02 12:15:11 +02:00
Jenkins for ownCloud
b3950165c4 [tx-robot] updated from transifex 2014-09-01 15:47:58 -04:00
Jenkins for ownCloud
b8ab859c59 [tx-robot] updated from transifex 2014-09-01 01:25:19 -04:00
Jenkins for ownCloud
99a3cb0eab [tx-robot] updated from transifex 2014-08-31 13:00:41 -04:00
Markus Goetz
0be4b59cff Sparkle: Keep permissions from bundle 2014-08-31 18:57:39 +02:00
hefee
ddfc7c75df Fix minor Python styling issues
* Do not use sapces inside parenthesis
* make indend PEP8
* empty lines should not contain whitespaces
2014-08-31 00:35:56 +02:00
David Prévot
7618f29657 Fix minor Python syntax errors
The installation fails because of these:

	TabError: inconsistent use of tabs and spaces in indentation
	SyntaxError: Missing parentheses in call to 'print'
2014-08-31 00:28:25 +02:00
Olivier Goffart
291231c561 Merge missing commits from 1.6.2-themefix into 1.7
Conflicts:
	VERSION.cmake
2014-08-30 17:57:58 +02:00
hefee
68792ee9db Fixing spellingerror
GNU Public License -> GNU General Public License
2014-08-30 02:18:55 +02:00
Klaas Freitag
7ce2a93c63 Merge remote-tracking branch 'origin/reuse_oc_config' into 1.7
Conflicts:
	src/CMakeLists.txt
	src/mirall/folderman.cpp
	src/mirall/folderman.h
	src/mirall/owncloudtheme.h
2014-08-29 20:23:07 +02:00
Klaas Freitag
4d33773cef Nautilus Overlays: Rename icons according to branding.
Added a script that renames the icons and patches the python file for
nautilus.
2014-08-29 20:02:52 +02:00
Olivier Goffart
5d19426930 Propagator: When the server don't support ranges, reset the counter so the progress is not messed up
Issue #2081
2014-08-29 19:33:20 +02:00
Olivier Goffart
1b51a10b19 Socket API: be consistant in the VERSION command and add the VERSION at the beginning 2014-08-29 17:28:36 +02:00
Olivier Goffart
aab870af32 desktop file: add a Comment
Fixes #2130
2014-08-29 17:14:40 +02:00
Markus Goetz
7c70ada423 Exclude List: Gnucash temp files
Fixes #2045
2014-08-29 16:45:08 +02:00
Markus Goetz
12e2bac16b Propagator: Also parse OC-ETag header
Client side part of https://github.com/owncloud/core/issues/9005
2014-08-29 16:30:58 +02:00
Olivier Goffart
34a27c748a Progress: in case of resuming chunks, advance directly at startup by the amount of chunk already done
Fixes #2103
2014-08-29 16:06:56 +02:00
Olivier Goffart
a73fbccf8c t4.pl: add a test to test that ignored file are not deleted 2014-08-28 19:33:52 +02:00
Klaas Freitag
7f1d707d23 ownCloud Theme: Do not have the oCSetupTop custom media, see #1445 2014-08-28 18:10:53 +02:00
Klaas Freitag
f1fb36bcb8 Tests: Get rid of the Carp package that ogoffart does not have.
Recommendation: Use a decent distribution! But anyway....
2014-08-28 18:10:53 +02:00
Daniel Molkentin
25c274a0bd X11: Bring Settings window to front when launched 2014-08-28 17:25:00 +02:00
Olivier Goffart
d4bbd28757 csync: remove ignored_cleanup: it's not used anymore 2014-08-28 17:16:51 +02:00
Olivier Goffart
98b7248df0 reconcile/update: don't remove directory that contains ignored files 2014-08-28 17:16:17 +02:00
Olivier Goffart
0fb0f2c204 Selective sync: start a sync when the selective sync settings changes 2014-08-28 16:27:46 +02:00
Olivier Goffart
79d13d9242 Selective sync: deselecting a folder removes it from the local file system 2014-08-28 15:53:49 +02:00
Markus Goetz
b6f42a91f4 OS X: Fix Finder bundle NVTY->OWNC 2014-08-28 15:45:07 +02:00
Daniel Molkentin
cc5f5cf3a6 Set the minimum supported OS X version to 10.7
We dropped 10.6 support quite a while ago.
This should avoid bug reports from 10.6 users.

Fixes #2122
2014-08-28 14:50:00 +02:00
Olivier Goffart
79f00c2a2a Wizard: adjust alignements 2014-08-28 13:32:14 +02:00
Olivier Goffart
e5068e7543 Selective sync: if one click twice on the button in the wizard, it should keep the blacklist 2014-08-28 12:25:44 +02:00
Olivier Goffart
858218ac34 Wizard: new layout 2014-08-28 12:18:19 +02:00
Markus Goetz
d69049ce10 OS X: Fix Finder plugin 2014-08-28 10:21:56 +02:00
Daniel Molkentin
59a9cc7c12 OS X build: use correct macro for version number 2014-08-28 00:08:24 +02:00
Markus Goetz
2f34b046d0 Overlay Icons: Improve OS X version, improve general feedback
Now the update phase of the syncing algorithm pushes stuff the notification socket too.
2014-08-27 19:15:43 +02:00
Olivier Goffart
a73316306d Selective sync: new design in the wizard 2014-08-27 19:03:11 +02:00
Olivier Goffart
928652e4cf Selective sync: rename the button 'choose what to sync' 2014-08-27 17:31:57 +02:00
Olivier Goffart
7950b49cb1 Selective sync dialog: fix fetching sub directory when the folder is not the root folder 2014-08-27 17:19:36 +02:00
Markus Goetz
f8b1b243c1 OS X: Fix installer target name if we have a build number 2014-08-27 14:44:21 +02:00
Klaas Freitag
cc6aa66ab0 JournalDB: Do prepare the queries even if the db update failed.
Also, add more logging in case SQL errors happen while db structure
update.
2014-08-27 14:01:33 +02:00
Olivier Goffart
ea381392a7 SocketAPI: fix the BROADCAST message 2014-08-27 13:55:06 +02:00
Olivier Goffart
bb7f63dcfd AccountSettings: be less verbose in the status string 2014-08-27 13:51:14 +02:00
Olivier Goffart
253d65727b Socket api: Add a VERSION command 2014-08-27 13:51:14 +02:00
Markus Goetz
61138b58bf OS X: Quote the installer filename
Viel hilft viel
2014-08-27 12:49:22 +02:00
Markus Goetz
5490063b7e OS X: Fix installer creation
The script should know independently of the machine
2014-08-27 12:02:57 +02:00
Klaas Freitag
d2e1489fe7 Propagator: Set the chunk size to 20MB as requested by Matt. 2014-08-27 10:35:58 +02:00
Klaas Freitag
eb898646bc Create Mac Pack: Copy the creator script to the build directory. 2014-08-26 18:13:43 +02:00
Markus Goetz
79b547b83b Icon Overlay OS X: Complain if icon couldnt be loaded 2014-08-26 17:21:15 +02:00
Olivier Goffart
2356601bb3 folder: Make sure not to pol the server if the account is disconnected
Fixes #2108
2014-08-26 16:23:19 +02:00
Olivier Goffart
9b88c7d3c1 SSLButton: fix memleak 2014-08-26 15:59:19 +02:00
Olivier Goffart
302499b483 uploading: make sure to cast to uint64 to avoid integer overflow 2014-08-26 15:58:55 +02:00
Jenkins for ownCloud
03dc27a327 [tx-robot] updated from transifex 2014-08-26 01:25:22 -04:00
Jenkins for ownCloud
9291ace558 [tx-robot] updated from transifex 2014-08-25 01:25:17 -04:00
Jenkins for ownCloud
15c11ea172 [tx-robot] updated from transifex 2014-08-24 02:06:11 -04:00
Jenkins for ownCloud
cd6950d984 [tx-robot] updated from transifex 2014-08-24 01:25:18 -04:00
Jenkins for ownCloud
de96350bee [tx-robot] updated from transifex 2014-08-23 01:25:22 -04:00
Klaas Freitag
753aa9132e Merge pull request #2013 from owncloud/fix-man-dir-16
Fix issue#2004 -- mandir must be man1, not man
2014-07-30 17:38:25 +02:00
Olivier Goffart
cfdfd6a860 wizard: don't call initializePage
It is called automatically by QWizard and do not need to be called explicitly

But setVisibla(false) don't really have an effect there since show() is going
to be called on the page
2014-07-30 12:36:30 +02:00
Jürgen Weigert
0c9d57228d Fix issue#2004 -- mandir must be man1, not man 2014-07-29 18:29:55 +02:00
Olivier Goffart
5254c9785c shibboleth: Fix connection when the URL do not have a path
When the url do not have a path (for example: "http://example.com" as
opposed to "http://example.com/"),  its path is not a prefix of the
root path of the cookie (usually '/')

By adding the dav path, we make sure the URL has a path.

This made a bug when the owncloud url was just a domain name and did not
have a path
2014-07-28 13:50:24 +02:00
Klaas Freitag
0f37484b8a Bumped the release number to 1.6.2, Changelog additions. 2014-07-28 11:44:10 +02:00
Klaas Freitag
e17243bc1f AccountMigrator: Read path from QDir::fromNativeSeperators(), add debug. 2014-06-25 11:38:08 +02:00
Klaas Freitag
0e45dd7a3d AccountMigrator: Do not inherit from QObject as it is not needed yet.
As requested by Danimos review.
2014-06-25 11:38:08 +02:00
Klaas Freitag
65f313f1b4 Account: Added missing include statement. 2014-06-25 11:38:08 +02:00
Klaas Freitag
da4958c716 Account: Read settings from ownCloud config if no branded exists.
If there is not yet a config for a branded client, but one for the
"normal" client targetting the same URL, it will be migrated.
2014-06-25 11:38:08 +02:00
Klaas Freitag
653b8494f5 FolderMan: Migrate folderlist if no folder definitions can be found
and the account indicates that it was migrated. In that case,
read the folder definitions from the ownCloud config directory.
2014-06-25 11:38:08 +02:00
Klaas Freitag
6ed6f84f6e Account: Add a wasMigrated flag.
If an account in a branded client was migrated from a former ownCloud
configuration, the method wasMigrated() will return true.
2014-06-25 11:38:08 +02:00
Klaas Freitag
ff0ba56bc3 ownCloud Theme: Implement appName() and appNameGUI(). 2014-06-25 11:38:08 +02:00
Klaas Freitag
e795d04f30 cfg migration: Add a account migrator class. 2014-06-25 11:38:08 +02:00
Klaas Freitag
8d3806b080 folderman: make escapeAlias public as its now used in accountmigrator. 2014-06-25 11:38:08 +02:00
Klaas Freitag
5597ebe455 Account: Add a scoped pointer to the ownCloud theme. 2014-06-25 11:38:07 +02:00
172 changed files with 13848 additions and 9411 deletions

2
.gitattributes vendored
View File

@@ -2,4 +2,4 @@
.gitignore export-ignore
.gitattributes export-ignore
.commit-template export-ignore
/binary export-ignore
binary/ export-ignore

View File

@@ -128,6 +128,11 @@ configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
# Copy that logo, the installer uses it later
if(BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES resources/owncloud_logo_blue.png DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
endif()
include(OwnCloudCPack.cmake)
add_definitions(-DUNICODE)
@@ -144,6 +149,7 @@ add_subdirectory(csync)
add_subdirectory(src)
add_subdirectory(shell_integration)
add_subdirectory(doc)
add_subdirectory(admin)
if(UNIT_TESTING)
include(CTest)
@@ -155,4 +161,5 @@ if(BUILD_OWNCLOUD_OSX_BUNDLE)
configure_file(sync-exclude.lst ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
else()
install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
configure_file(sync-exclude.lst bin/sync-exclude.lst COPYONLY)
endif()

View File

@@ -1,6 +1,7 @@
ChangeLog
=========
version 1.6.2 (release 2014-07-x )
version 1.6.2 (release 2014-07-28 )
* Limit the HTTP buffer size when downloading to limit memory consumption.
* Another small mem leak fixed in HTTP Credentials.
* Fix local file name clash detection for MacOSX.
* Limit maximum wait time to ten seconds in network limiting.

View File

@@ -4,7 +4,7 @@ set( MIRALL_VERSION_PATCH 0 )
set( MIRALL_SOVERSION 0 )
if ( NOT DEFINED MIRALL_VERSION_SUFFIX )
set( MIRALL_VERSION_SUFFIX "beta1") #e.g. beta1, beta2, rc1
set( MIRALL_VERSION_SUFFIX "beta2") #e.g. beta1, beta2, rc1
endif( NOT DEFINED MIRALL_VERSION_SUFFIX )
if( NOT DEFINED MIRALL_VERSION_BUILD )

2
admin/CMakeLists.txt Normal file
View File

@@ -0,0 +1,2 @@
# traverse into osx subdirectory to install and patch the create-pack script
add_subdirectory(osx)

3
admin/osx/CMakeLists.txt Normal file
View File

@@ -0,0 +1,3 @@
configure_file(create_mac_pkg.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/create_mac.sh)
configure_file(macosx.pkgproj ${CMAKE_CURRENT_BINARY_DIR}/macosx.pkgproj)

View File

@@ -1,45 +0,0 @@
#!/bin/bash
# Script to create the Mac installer using the packages tool from
# http://s.sudre.free.fr/Software/Packages/about.html
#
# the path of installation must be given as parameter
if [ -z "$1" ]; then
echo "ERROR: Provide the CMAKE_INSTALL_DIR to this script."
exit 1
fi
prjfile="admin/osx/macosx.pkgproj"
if [ ! -f $prjfile ]; then
echo "ERROR: macosx.pkgproj not in admin dir, start from CMAKE_SOURCE_DIR!"
exit 2
fi
pack="admin/ownCloud Installer.pkg"
rm -f $pack
install_path=$1
# The name of the installer package
installer=ownCloud\ Installer.pkg
# The command line tool of the "Packages" tool, see link above.
pkgbuild=/usr/local/bin/packagesbuild
$pkgbuild -F $install_path $prjfile
rc=$?
if [ $rc == 0 ]; then
echo "Successfully created $pack"
else
echo "Failed to create $pack"
exit 3
fi
# FIXME: Sign the finished package.
# See http://s.sudre.free.fr/Software/documentation/Packages/en/Project_Configuration.html#5
# certname=gdbsign
# productsign --cert $certname admin/$installer ./$installer

View File

@@ -0,0 +1,74 @@
#!/bin/bash
# Script to create the Mac installer using the packages tool from
# http://s.sudre.free.fr/Software/Packages/about.html
#
[ "$#" -lt 2 ] && echo "Usage: create_mac_pkg.sh <CMAKE_INSTALL_DIR> <build dir> <installer sign identity>" && exit
# the path of installation must be given as parameter
if [ -z "$1" ]; then
echo "ERROR: Provide the path to CMAKE_INSTALL_DIR to this script as first parameter."
exit 1
fi
if [ -z "$2" ]; then
echo "ERROR: Provide the path to build directory as second parameter."
exit 1
fi
install_path="$1"
build_path="$2"
identity="$3"
prjfile=$build_path/admin/osx/macosx.pkgproj
# The name of the installer package
installer="@APPLICATION_NAME@-@MIRALL_VERSION_FULL@@MIRALL_VERSION_SUFFIX@"
installer_file="$installer.pkg"
installer_file_tar="$installer.pkg.tar"
installer_file_tar_bz2="$installer.pkg.tar.bz2"
installer_file_tbz="$installer.pkg.tbz"
# set the installer name to the copied prj config file
/usr/local/bin/packagesutil --file $prjfile set project name "$installer"
# The command line tool of the "Packages" tool, see link above.
pkgbuild=/usr/local/bin/packagesbuild
$pkgbuild -F $install_path $prjfile
rc=$?
if [ $rc == 0 ]; then
echo "Successfully created $installer_file"
else
echo "Failed to create $installer_file"
exit 3
fi
# Sign the finished package if desired.
if [ ! -z "$identity" ]; then
echo "Will try to sign the installer"
pushd $install_path
productsign --sign "$identity" "$installer_file" "$installer_file.new"
mv "$installer_file".new $installer_file
popd
else
echo "No certificate given, will not sign the pkg"
fi
# FIXME: OEMs?
# they will need to do their own signing..
# Sparkle wants a tbz, it cannot install raw pkg
cd $install_path
tar cf "$installer_file_tar" "$installer_file"
bzip2 -9 "$installer_file_tar"
mv "$installer_file_tar_bz2" "$installer_file_tbz"
rc=$?
if [ $rc == 0 ]; then
echo "Successfully created $installer_file"
else
echo "Failed to create $installer_file"
exit 3
fi

330
admin/osx/macdeployqt.py Executable file
View File

@@ -0,0 +1,330 @@
#!/usr/bin/python
# This file is part of ownCloud.
# It was inspired in large part by the macdeploy script in Clementine
# and Tomahawk
#
# ownCloud 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.
#
# ownCLoud 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.
#
# You should have received a copy of the GNU General Public License
# along with ownCloud. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import subprocess
import commands
import sys
from glob import glob
def QueryQMake(attrib):
return subprocess.check_output(['qmake', '-query', attrib]).rstrip('\n')
FRAMEWORK_SEARCH_PATH=[
'/Library/Frameworks',
os.path.join(os.environ['HOME'], 'Library/Frameworks')
]
LIBRARY_SEARCH_PATH=['/usr/local/lib', '.']
QT_PLUGINS = [
'accessible/libqtaccessiblewidgets.dylib',
'sqldrivers/libqsqlite.dylib',
'platforms/libqcocoa.dylib',
'imageformats/libqgif.dylib',
'imageformats/libqico.dylib',
'imageformats/libqjpeg.dylib',
'imageformats/libqsvg.dylib',
'imageformats/libqmng.dylib',
]
QT_PLUGINS_SEARCH_PATH=[
# os.path.join(os.environ['QTDIR'], 'plugins'),
'/usr/local/Cellar/qt/5.2.1/plugins',
]
class Error(Exception):
pass
class CouldNotFindQtPluginErrorFindFrameworkError(Error):
pass
class InstallNameToolError(Error):
pass
class CouldNotFindQtPluginError(Error):
pass
class CouldNotFindScriptPluginError(Error):
pass
if len(sys.argv) < 2:
print 'Usage: %s <bundle.app>' % sys.argv[0]
exit()
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
bundle_dir = sys.argv[1]
bundle_name = os.path.basename(bundle_dir).split('.')[0]
commands = []
binary_dir = os.path.join(bundle_dir, 'Contents', 'MacOS')
frameworks_dir = os.path.join(bundle_dir, 'Contents', 'Frameworks')
commands.append(['mkdir', '-p', frameworks_dir])
resources_dir = os.path.join(bundle_dir, 'Contents', 'Resources')
commands.append(['mkdir', '-p', resources_dir])
plugins_dir = os.path.join(bundle_dir, 'Contents', 'PlugIns')
binaries = [i for i in glob(os.path.join(bundle_dir, 'Contents', 'MacOS', "*")) if is_exe(i)];
fixed_libraries = []
fixed_frameworks = []
def WriteQtConf():
print "Writing qt.conf..."
with open(os.path.join(resources_dir, 'qt.conf'), 'w') as f:
f.write("[Paths]\nPlugins = PlugIns\n");
f.close()
def GetBrokenLibraries(binary):
#print "Checking libs for binary: %s" % binary
output = subprocess.Popen(['otool', '-L', binary], stdout=subprocess.PIPE).communicate()[0]
broken_libs = {
'frameworks': [],
'libs': []}
for line in [x.split(' ')[0].lstrip() for x in output.split('\n')[1:]]:
#print "Checking line: %s" % line
if not line: # skip empty lines
continue
if os.path.basename(binary) == os.path.basename(line):
#print "mnope %s-%s" % (os.path.basename(binary), os.path.basename(line))
continue
if re.match(r'^\s*/System/', line):
continue # System framework
elif re.match(r'^\s*/usr/lib/', line):
#print "unix style system lib"
continue # unix style system library
elif re.match(r'Breakpad', line):
continue # Manually added by cmake.
elif re.match(r'^\s*@executable_path', line) or re.match(r'^\s*@loader_path', line):
# Potentially already fixed library
if '.framework' in line:
relative_path = os.path.join(*line.split('/')[3:])
if not os.path.exists(os.path.join(frameworks_dir, relative_path)):
broken_libs['frameworks'].append(relative_path)
else:
relative_path = os.path.join(*line.split('/')[1:])
#print "RELPATH %s %s" % (relative_path, os.path.join(binary_dir, relative_path))
if not os.path.exists(os.path.join(binary_dir, relative_path)):
broken_libs['libs'].append(relative_path)
elif re.search(r'\w+\.framework', line):
broken_libs['frameworks'].append(line)
else:
broken_libs['libs'].append(line)
return broken_libs
def FindFramework(path):
search_pathes = FRAMEWORK_SEARCH_PATH
search_pathes.insert(0, QueryQMake('QT_INSTALL_LIBS'))
for search_path in search_pathes:
abs_path = os.path.join(search_path, path)
if os.path.exists(abs_path):
return abs_path
raise CouldNotFindFrameworkError(path)
def FindLibrary(path):
if os.path.exists(path):
return path
search_pathes = LIBRARY_SEARCH_PATH
search_pathes.insert(0, QueryQMake('QT_INSTALL_LIBS'))
for search_path in search_pathes:
abs_path = os.path.join(search_path, path)
if os.path.exists(abs_path):
return abs_path
else: # try harder---look for lib name in library folders
newpath = os.path.join(search_path,os.path.basename(path))
if os.path.exists(newpath):
return newpath
return ""
#raise CouldNotFindFrameworkError(path)
def FixAllLibraries(broken_libs):
for framework in broken_libs['frameworks']:
FixFramework(framework)
for lib in broken_libs['libs']:
FixLibrary(lib)
def FixFramework(path):
if path in fixed_libraries:
return
else:
fixed_libraries.append(path)
abs_path = FindFramework(path)
broken_libs = GetBrokenLibraries(abs_path)
FixAllLibraries(broken_libs)
new_path = CopyFramework(abs_path)
id = os.sep.join(new_path.split(os.sep)[3:])
FixFrameworkId(new_path, id)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, new_path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, new_path)
def FixLibrary(path):
if path in fixed_libraries or FindSystemLibrary(os.path.basename(path)) is not None:
return
else:
fixed_libraries.append(path)
abs_path = FindLibrary(path)
if abs_path == "":
print "Could not resolve %s, not fixing!" % path
return
broken_libs = GetBrokenLibraries(abs_path)
FixAllLibraries(broken_libs)
new_path = CopyLibrary(abs_path)
FixLibraryId(new_path)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, new_path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, new_path)
def FixPlugin(abs_path, subdir):
broken_libs = GetBrokenLibraries(abs_path)
FixAllLibraries(broken_libs)
new_path = CopyPlugin(abs_path, subdir)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, new_path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, new_path)
def FixBinary(path):
broken_libs = GetBrokenLibraries(path)
FixAllLibraries(broken_libs)
for framework in broken_libs['frameworks']:
FixFrameworkInstallPath(framework, path)
for library in broken_libs['libs']:
FixLibraryInstallPath(library, path)
def CopyLibrary(path):
new_path = os.path.join(binary_dir, os.path.basename(path))
args = ['ditto', '--arch=x86_64', path, new_path]
commands.append(args)
args = ['chmod', 'u+w', new_path]
commands.append(args)
return new_path
def CopyPlugin(path, subdir):
new_path = os.path.join(plugins_dir, subdir, os.path.basename(path))
args = ['mkdir', '-p', os.path.dirname(new_path)]
commands.append(args)
args = ['ditto', '--arch=x86_64', path, new_path]
commands.append(args)
args = ['chmod', 'u+w', new_path]
commands.append(args)
return new_path
def CopyFramework(path):
parts = path.split(os.sep)
print "CopyFramework:", path
for i, part in enumerate(parts):
if re.match(r'\w+\.framework', part):
full_path = os.path.join(frameworks_dir, *parts[i:-1])
break
args = ['mkdir', '-p', full_path]
commands.append(args)
args = ['ditto', '--arch=x86_64', path, full_path]
commands.append(args)
args = ['chmod', 'u+w', os.path.join(full_path, parts[-1])]
commands.append(args)
info_plist = os.path.join(os.path.split(path)[0], '..', '..', 'Contents', 'Info.plist')
if os.path.exists(info_plist):
args = ['cp', '-r', info_plist, resources_dir]
commands.append(args)
return os.path.join(full_path, parts[-1])
def FixId(path, library_name):
id = '@executable_path/../Frameworks/%s' % library_name
args = ['install_name_tool', '-id', id, path]
commands.append(args)
def FixLibraryId(path):
library_name = os.path.basename(path)
FixId(path, library_name)
def FixFrameworkId(path, id):
FixId(path, id)
def FixInstallPath(library_path, library, new_path):
args = ['install_name_tool', '-change', library_path, new_path, library]
commands.append(args)
def FindSystemLibrary(library_name):
for path in ['/lib', '/usr/lib']:
full_path = os.path.join(path, library_name)
if os.path.exists(full_path):
return full_path
return None
def FixLibraryInstallPath(library_path, library):
system_library = FindSystemLibrary(os.path.basename(library_path))
if system_library is None:
new_path = '@executable_path/../MacOS/%s' % os.path.basename(library_path)
FixInstallPath(library_path, library, new_path)
else:
FixInstallPath(library_path, library, system_library)
def FixFrameworkInstallPath(library_path, library):
parts = library_path.split(os.sep)
for i, part in enumerate(parts):
if re.match(r'\w+\.framework', part):
full_path = os.path.join(*parts[i:])
break
new_path = '@executable_path/../Frameworks/%s' % full_path
FixInstallPath(library_path, library, new_path)
def FindQtPlugin(name):
search_path = QT_PLUGINS_SEARCH_PATH
search_path.insert(0, QueryQMake('QT_INSTALL_PLUGINS'))
for path in search_path:
if os.path.exists(path):
if os.path.exists(os.path.join(path, name)):
return os.path.join(path, name)
raise CouldNotFindQtPluginError(name)
for binary in binaries:
FixBinary(binary)
for plugin in QT_PLUGINS:
FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin))
if len(sys.argv) <= 2:
print 'Will run %d commands:' % len(commands)
for command in commands:
print ' '.join(command)
for command in commands:
p = subprocess.Popen(command)
os.waitpid(p.pid, 0)
WriteQtConf()

View File

@@ -22,7 +22,7 @@
<key>GID</key>
<integer>80</integer>
<key>PATH</key>
<string>owncloud.app</string>
<string>@APPLICATION_EXECUTABLE@.app</string>
<key>PATH_TYPE</key>
<integer>3</integer>
<key>PERMISSIONS</key>
@@ -1054,10 +1054,10 @@
<integer>6</integer>
<key>BACKGROUND_PATH</key>
<dict>
<key>PATH</key>
<string>/Users/mackie/owncloud.com/mirall/resources/owncloud_logo_blue.png</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<key>PATH</key>
<string>./@APPLICATION_EXECUTABLE@.app/Contents/Resources/owncloud_logo_blue.png</string>
<key>PATH_TYPE</key>
<integer>3</integer>
</dict>
<key>CUSTOM</key>
<integer>1</integer>
@@ -1240,9 +1240,9 @@
<key>BUILD_PATH</key>
<dict>
<key>PATH</key>
<string>/Users/mackie/owncloud.com/mirall/admin</string>
<string>../install/.</string>
<key>PATH_TYPE</key>
<integer>0</integer>
<integer>3</integer>
</dict>
<key>EXCLUDED_FILES</key>
<array>

32
admin/osx/sign_app.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh -x
[ "$#" -lt 2 ] && echo "Usage: sign_app.sh <app> <identity>" && exit
src_app="$1"
identity="$2"
QT_FMWK_VERSION="5"
fix_frameworks() {
TMP_APP=$1
QT_FMWK_PATH=$2
QT_FMWKS=$3/Qt*.framework
echo "Patching Qt frameworks..."
for FMWK in $QT_FMWKS; do
FMWK_NAME=`basename -s .framework $FMWK`
FMWK=`basename $FMWK`
FMWK_PATH="${TMP_APP}/Contents/Frameworks/${FMWK}"
mkdir -p "${FMWK_PATH}/Versions/${QT_FMWK_VERSION}/Resources/"
cp -avf "${QT_FMWK_PATH}/${FMWK}/Contents/Info.plist" "${FMWK_PATH}/Versions/${QT_FMWK_VERSION}/Resources"
(cd "${FMWK_PATH}" && ln -sf "Versions/${QT_FMWK_VERSION}/Resources" "Resources")
perl -pi -e "s/${FMWK_NAME}_debug/${FMWK_NAME}/" "${FMWK_PATH}/Resources/Info.plist"
done
}
fix_frameworks "$src_app" `qmake -query QT_INSTALL_LIBS` "$src_app"/Contents/Frameworks
codesign -s "$identity" --force --verbose=4 --deep "$src_app"
# Just for our debug purposes:
spctl -a -t exec -vv $src_app
codesign -dv $src_app

View File

@@ -15,6 +15,8 @@ StrCpy $PageReinstall_SAME_Field_3 "Avinstallera ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "Avinstallera ${APPLICATION_NAME}"
StrCpy $PageReinstall_SAME_MUI_HEADER_TEXT_SUBTITLE "Välj underhålls alternativ att utföra."
StrCpy $SEC_APPLICATION_DETAILS "Installerar ${APPLICATION_NAME} väsentligheter."
StrCpy $OPTION_SECTION_SC_SHELL_EXT_SECTION "Statusikoner för Windows Explorer"
StrCpy $OPTION_SECTION_SC_SHELL_EXT_DetailPrint "Installerar statusikoner för Windows Explorer"
StrCpy $OPTION_SECTION_SC_START_MENU_SECTION "Start-meny program genväg"
StrCpy $OPTION_SECTION_SC_START_MENU_DetailPrint "Lägger till genväg för ${APPLICATION_NAME} till Start-menyn."
StrCpy $OPTION_SECTION_SC_DESKTOP_SECTION "Skrivbordsgenväg"
@@ -42,5 +44,3 @@ StrCpy $INIT_INSTALLER_RUNNING "Installationsprogrammet körs redan."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Detta avinstallationsprogram kräver administratörs rättigheter, försök igen"
StrCpy $INIT_UNINSTALLER_RUNNING "Avinstallationsprogrammet körs redan."
StrCpy $SectionGroup_Shortcuts "Genvägar"
StrCpy $OPTION_SECTION_SC_SHELL_EXT_SECTION "Status icons for Windows Explorer"
StrCpy $OPTION_SECTION_SC_SHELL_EXT_DetailPrint "Installing status icons for Windows Explorer"

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# Always include srcdir and builddir in include path
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in
# about every subdir

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# define system dependent compiler flags
include(CheckCCompilerFlag)

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
if (UNIX)
# Suffix for Linux
SET(LIB_SUFFIX

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# Set system vars
if (CMAKE_SYSTEM_NAME MATCHES "Linux")

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# This module defines
# INOTIFY_INCLUDE_DIR, where to find inotify.h, etc.
# INOTIFY_FOUND, If false, do not try to use inotify.

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# FIND_PACKAGE_VERSION_CHECK(NAME (DEFAULT_MSG|"Custom failure message"))
# This function is intended to be used in FindXXX.cmake modules files.
# It handles NAME_FIND_VERSION and NAME_VERSION variables in a Module.

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
find_program(PDFLATEX_EXECUTABLE NAMES pdflatex
HINTS
$ENV{PDFLATEX_DIR}

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# - Try to find QtKeychain
# Once done this will define
# QTKEYCHAIN_FOUND - System has QtKeychain

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# - Try to find QtKeychain
# Once done this will define
# QTKEYCHAIN_FOUND - System has QtKeychain

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
find_program(SPHINX_EXECUTABLE NAMES sphinx-build
HINTS
$ENV{SPHINX_DIR}

View File

@@ -30,6 +30,8 @@
<string>(C) 2014 @APPLICATION_VENDOR@</string>
<key>SUShowReleaseNotes</key>
<false/>
<key>LSMinimumBundleVersion</key>
<string>10.7.0</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
</dict>

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# - macro_copy_file(_src _dst)
# Copies a file to ${_dst} only if ${_src} is different (newer) than ${_dst}
#

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
include (MacroOptionalFindPackage)
include (MacroLogFeature)

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# -helper macro to add a "doc" target with CMake build system.
# and configure doxy.config.in to doxy.config
#

View File

@@ -1,3 +1,7 @@
# (c) 2014 Copyright ownCloud, Inc.
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
if(CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)

View File

@@ -522,8 +522,6 @@ static void _tree_destructor(void *data) {
* used by csync_commit and csync_destroy */
static void _csync_clean_ctx(CSYNC *ctx)
{
c_list_t * walk;
/* destroy the rbtrees */
if (c_rbtree_size(ctx->local.tree) > 0) {
c_rbtree_destroy(ctx->local.tree, _tree_destructor);
@@ -535,25 +533,14 @@ static void _csync_clean_ctx(CSYNC *ctx)
csync_rename_destroy(ctx);
for (walk = c_list_last(ctx->local.ignored_cleanup); walk != NULL; walk = c_list_prev(walk)) {
SAFE_FREE(walk->data);
}
for (walk = c_list_last(ctx->remote.ignored_cleanup); walk != NULL; walk = c_list_prev(walk)) {
SAFE_FREE(walk->data);
}
/* free memory */
c_rbtree_free(ctx->local.tree);
c_list_free(ctx->local.list);
c_list_free(ctx->local.ignored_cleanup);
c_rbtree_free(ctx->remote.tree);
c_list_free(ctx->remote.list);
c_list_free(ctx->remote.ignored_cleanup);
ctx->remote.list = 0;
ctx->local.list = 0;
ctx->remote.ignored_cleanup = 0;
ctx->local.ignored_cleanup = 0;
SAFE_FREE(ctx->statedb.file);
}

View File

@@ -94,6 +94,7 @@ enum csync_status_codes_e {
CSYNC_STATUS_ABORTED,
/* Codes for file individual status: */
CSYNC_STATUS_INDIVIDUAL_IS_SYMLINK,
CSYNC_STATUS_INDIVIDUAL_IS_HARDLINK,
CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST,
CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS,
CYSNC_STATUS_FILE_LOCKED_OR_OPEN

View File

@@ -40,7 +40,10 @@
#define CSYNC_LOG_CATEGORY_NAME "csync.exclude"
#include "csync_log.h"
static int _csync_exclude_add(c_strlist_t **inList, const char *string) {
#ifndef NDEBUG
static
#endif
int _csync_exclude_add(c_strlist_t **inList, const char *string) {
c_strlist_t *list;
if (*inList == NULL) {
@@ -150,12 +153,6 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype) {
match = csync_excluded_no_ctx( ctx->excludes, path, filetype );
if (match == CSYNC_NOT_EXCLUDED && ctx->checkBlackListHook) {
if (ctx->checkBlackListHook(ctx->checkBlackListData, path)) {
match = CSYNC_FILE_EXCLUDE_LIST;
}
}
return match;
}
@@ -205,6 +202,20 @@ CSYNC_EXCLUDE_TYPE csync_excluded_no_ctx(c_strlist_t *excludes, const char *path
goto out;
}
#ifdef _WIN32
// Windows cannot sync files ending in spaces (#2176). It also cannot
// distinguish files ending in '.' from files without an ending,
// as '.' is a separator that is not stored internally, so let's
// not allow to sync those to avoid file loss/ambiguities (#416)
size_t blen = strlen(bname);
if (blen > 1 && (bname[blen-1]== ' ' || bname[blen-1]== '.' )) {
match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
SAFE_FREE(bname);
SAFE_FREE(dname);
goto out;
}
#endif
rc = csync_fnmatch(".owncloudsync.log*", bname, 0);
if (rc == 0) {
match = CSYNC_FILE_SILENTLY_EXCLUDED;

View File

@@ -29,6 +29,11 @@ enum csync_exclude_type_e {
CSYNC_FILE_EXCLUDE_INVALID_CHAR
};
typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
#ifdef NDEBUG
int _csync_exclude_add(c_strlist_t **inList, const char *string);
#endif
/**
* @brief Load exclude list
*

View File

@@ -339,6 +339,8 @@ void fill_webdav_properties_into_resource(struct resource* newres, const ne_prop
file_id = ne_propset_value( set, &ls_props[4] );
directDownloadUrl = ne_propset_value( set, &ls_props[5] );
directDownloadCookies = ne_propset_value( set, &ls_props[6] );
// permission flags: Defined in https://github.com/owncloud/core/issues/8322
perm = ne_propset_value( set, &ls_props[7] );
if( resourcetype && strncmp( resourcetype, "<DAV:collection>", 16 ) == 0) {

View File

@@ -107,7 +107,6 @@ struct csync_s {
c_rbtree_t *tree;
c_list_t *list;
enum csync_replica_e type;
c_list_t *ignored_cleanup;
} local;
struct {
@@ -116,7 +115,6 @@ struct csync_s {
c_list_t *list;
enum csync_replica_e type;
int read_from_db;
c_list_t *ignored_cleanup;
} remote;
#if defined(HAVE_ICONV) && defined(WITH_ICONV)
@@ -167,6 +165,7 @@ struct csync_file_stat_s {
int type; /* u32 */
int child_modified;/*bool*/
int should_update_etag; /*bool */
int has_ignored_files; /*bool: specify that a directory, or child directory contains ignored files */
char *destpath; /* for renames */
const char *etag;

View File

@@ -134,6 +134,10 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
break;
/* file has been removed on the opposite replica */
case CSYNC_INSTRUCTION_NONE:
if (cur->has_ignored_files) {
/* Do not remove a directory that has ignored files */
break;
}
cur->instruction = CSYNC_INSTRUCTION_REMOVE;
break;
case CSYNC_INSTRUCTION_EVAL_RENAME:

View File

@@ -146,21 +146,21 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
if (excluded != CSYNC_NOT_EXCLUDED) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "%s excluded (%d)", path, excluded);
if (excluded == CSYNC_FILE_EXCLUDE_AND_REMOVE) {
switch (ctx->current) {
case LOCAL_REPLICA:
ctx->local.ignored_cleanup = c_list_append(ctx->local.ignored_cleanup, c_strdup(path));
break;
case REMOTE_REPLICA:
ctx->remote.ignored_cleanup = c_list_append(ctx->remote.ignored_cleanup, c_strdup(path));
break;
default:
break;
}
return 0;
return 1;
}
if (excluded == CSYNC_FILE_SILENTLY_EXCLUDED) {
return 0;
return 1;
}
if (ctx->current_fs) {
ctx->current_fs->has_ignored_files = true;
}
}
if (ctx->current == REMOTE_REPLICA && ctx->checkBlackListHook) {
if (ctx->checkBlackListHook(ctx->checkBlackListData, path)) {
return 1;
}
}
h = _hash_of_file(ctx, file );
@@ -179,11 +179,13 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
st->instruction = CSYNC_INSTRUCTION_NONE;
st->etag = NULL;
st->child_modified = 0;
st->has_ignored_files = 0;
/* check hardlink count */
if (type == CSYNC_FTW_TYPE_FILE ) {
if( fs->nlink > 1) {
st->instruction = CSYNC_INSTRUCTION_IGNORE;
st->error_status = CSYNC_STATUS_INDIVIDUAL_IS_HARDLINK;
goto out;
}
@@ -228,14 +230,16 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
if(tmp && tmp->phash == h ) { /* there is an entry in the database */
/* we have an update! */
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Database entry found, compare: %" PRId64 " <-> %" PRId64 ", etag: %s <-> %s, inode: %" PRId64 " <-> %" PRId64,
((int64_t) fs->mtime), ((int64_t) tmp->modtime), fs->etag, tmp->etag, (uint64_t) fs->inode, (uint64_t) tmp->inode);
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Database entry found, compare: %" PRId64 " <-> %" PRId64 ", etag: %s <-> %s, inode: %" PRId64 " <-> %" PRId64 ", size: %" PRId64 " <-> %" PRId64,
((int64_t) fs->mtime), ((int64_t) tmp->modtime), fs->etag, tmp->etag, (uint64_t) fs->inode, (uint64_t) tmp->inode, (uint64_t) fs->size, (uint64_t) tmp->size);
if( !fs->etag) {
st->instruction = CSYNC_INSTRUCTION_EVAL;
goto out;
}
if((ctx->current == REMOTE_REPLICA && !c_streq(fs->etag, tmp->etag ))
|| (ctx->current == LOCAL_REPLICA && (fs->mtime != tmp->modtime
// zero size in statedb can happen during migration
|| (tmp->size != 0 && fs->size != tmp->size)
#if 0
|| fs->inode != tmp->inode
#endif
@@ -431,11 +435,19 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
switch (flag) {
case CSYNC_FTW_FLAG_FILE:
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s]", file, fs->file_id);
if (ctx->current == REMOTE_REPLICA) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size);
} else {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [inode=%" PRIu64 " size=%" PRIu64 "]", file, fs->inode, fs->size);
}
type = CSYNC_FTW_TYPE_FILE;
break;
case CSYNC_FTW_FLAG_DIR: /* enter directory */
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "directory: %s [file_id=%s]", file, fs->file_id);
if (ctx->current == REMOTE_REPLICA) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "directory: %s [file_id=%s]", file, fs->file_id);
} else {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "directory: %s [inode=%" PRIu64 "]", file, fs->inode);
}
type = CSYNC_FTW_TYPE_DIR;
break;
case CSYNC_FTW_FLAG_NSTAT: /* not statable file */
@@ -660,6 +672,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
/* this function may update ctx->current and ctx->read_from_db */
if (ctx->current_fs && previous_fs && ctx->current_fs->child_modified) {
/* If a directory has modified files, put the flag on the parent directory as well */
previous_fs->child_modified = ctx->current_fs->child_modified;
}
@@ -677,7 +690,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
goto error;
}
if (flag == CSYNC_FTW_FLAG_DIR && depth
if (flag == CSYNC_FTW_FLAG_DIR && depth && rc == 0
&& (!ctx->current_fs || ctx->current_fs->instruction != CSYNC_INSTRUCTION_IGNORE)) {
rc = csync_ftw(ctx, filename, fn, depth - 1);
if (rc < 0) {
@@ -690,6 +703,11 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
ctx->current_fs->instruction = CSYNC_INSTRUCTION_NONE;
ctx->current_fs->should_update_etag = true;
}
if (ctx->current_fs && previous_fs && ctx->current_fs->has_ignored_files) {
/* If a directory has ignored files, put the flag on the parent directory as well */
previous_fs->has_ignored_files = ctx->current_fs->has_ignored_files;
}
}
if (flag == CSYNC_FTW_FLAG_DIR && ctx->current_fs

View File

@@ -237,7 +237,7 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) {
/* printf("Index: %I64i\n", FileIndex.QuadPart); */
buf->inode = FileIndex.QuadPart;
buf->size = (fileInfo.nFileSizeHigh * (int64_t)(MAXDWORD+1)) + fileInfo.nFileSizeLow;
buf->size = (fileInfo.nFileSizeHigh * ((int64_t)(MAXDWORD)+1)) + fileInfo.nFileSizeLow;
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
/* Get the file time with a win32 call rather than through stat. See

View File

@@ -141,6 +141,38 @@ static void check_csync_excluded(void **state)
}
static void check_csync_pathes(void **state)
{
CSYNC *csync = *state;
int rc;
_csync_exclude_add( &(csync->excludes), "/exclude" );
/* Check toplevel dir, the pattern only works for toplevel dir. */
rc = csync_excluded(csync, "/exclude", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded(csync, "/foo/exclude", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
/* check for a file called exclude. Must still work */
rc = csync_excluded(csync, "/exclude", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded(csync, "/foo/exclude", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
/* Add an exclude for directories only: excl/ */
_csync_exclude_add( &(csync->excludes), "excl/" );
rc = csync_excluded(csync, "/excl", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded(csync, "meep/excl", CSYNC_FTW_TYPE_DIR);
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
rc = csync_excluded(csync, "/excl", CSYNC_FTW_TYPE_FILE);
assert_int_equal(rc, CSYNC_NOT_EXCLUDED);
}
int torture_run_tests(void)
{
@@ -148,6 +180,7 @@ int torture_run_tests(void)
unit_test_setup_teardown(check_csync_exclude_add, setup, teardown),
unit_test_setup_teardown(check_csync_exclude_load, setup, teardown),
unit_test_setup_teardown(check_csync_excluded, setup_init, teardown),
unit_test_setup_teardown(check_csync_pathes, setup_init, teardown),
};
return run_tests(tests);

1
csync/tests/ownCloud/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
t1.cfg

View File

@@ -1,12 +1,7 @@
t1 - an integration test script for csync syncing to ownCloud.
Note: This test script uses perl HTTP::DAV. This package needs to
be in version 0.46 at least. Many distros deliver older versions.
A working version is part of the github checkout.
Note: This test script uses perl HTTP::DAV. This package needs to
be in version 0.46 at least. Many distros deliver older versions.
Update than.
be in version 0.47 at least. Many distros deliver older versions.
t1 uses a perl WebDAV client lib to sync to an existing instance of
ownCloud. For that, various files are copied around, synced and the
@@ -20,10 +15,6 @@ First, configure the script. For that, create a file t1.cfg. There
is t1.cfg.in as an example. Yeah, this test script is not secure,
make sure to run it with a weak account and in a save environment.
Second, unpack the test file collection with
tar xf testfiles.tar.xz
in the directory where the tarball can be found.
To start the script, call ./t1.pl on the commandline. A lot of
output is generated. If the script does not fail, everything works.

View File

@@ -1 +1,3 @@
*_conflict-*
*.part
]*.directory

View File

@@ -27,7 +27,6 @@ use Exporter;
use HTTP::DAV 0.47;
use Data::Dumper;
use File::Glob ':glob';
use Carp::Assert;
use Digest::MD5;
use Unicode::Normalize;
use LWP::UserAgent;
@@ -36,6 +35,7 @@ use HTTP::Request::Common qw( POST GET DELETE );
use File::Basename;
use IO::Handle;
use POSIX qw/strftime/;
use Carp;
use Encode qw(from_to);
use utf8;
@@ -66,7 +66,7 @@ our %config;
assertLocalDirs assertLocalAndRemoteDir glob_put put_to_dir
putToDirLWP localDir remoteDir localCleanup createLocalFile md5OfFile
remoteCleanup server initLocalDir initRemoteDir moveRemoteFile
printInfo remoteFileId createShare removeShare
printInfo remoteFileId createShare removeShare assert
configValue testDirUrl getToFileLWP getToFileCurl);
sub server
@@ -305,7 +305,7 @@ sub csync( ;$ )
print "CSync URL: $url\n";
my $args = "--trust"; # Trust crappy SSL certificates
my $args = "--trust --exclude exclude.cfg"; # Trust crappy SSL certificates
my $cmd = "LD_LIBRARY_PATH=$ld_libpath $csync $args $localDir $url";
print "Starting: $cmd\n";
@@ -783,4 +783,12 @@ sub removeShare($$)
my $response = $ua->request($req);
}
sub assert($;$)
{
unless( $_[0] ) {
print Carp::confess(@_);
exit(1);
}
}
#

View File

@@ -1,8 +1,8 @@
user => "joe",
passwd => "secret",
url => "http://localhost/ocm/remote.php/webdav/",
ld_libpath => "/home/joe/owncloud/csync/csync-build/modules",
csync => "/home/joe/owncloud/csync/csync-build/client/csync",
ld_libpath => "/home/joe/owncloud/mirall-install/lib",
csync => "/home/joe/owncloud/mirall-install/bin/owncloudcmd",
ocs_url => "http://localhost/owncloud/ocs/v1.php/",
share_user => "jenny",
share_passwd => "also_secret"

View File

@@ -23,7 +23,6 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;

View File

@@ -23,7 +23,7 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;

View File

@@ -23,7 +23,7 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;

View File

@@ -23,7 +23,7 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;
@@ -38,6 +38,10 @@ printInfo( "Copy some files to the remote location" );
mkdir( localDir() . 'test_stat' );
system( "echo foobar > " . localDir() . 'test_stat/file.txt' );
mkdir( localDir() . 'test_ignored' );
mkdir( localDir() . 'test_ignored/sub' );
system( "echo foobarfoo > " . localDir() . 'test_ignored/sub/file.txt' );
# call csync, sync local t1 to remote t1
csync();
@@ -91,15 +95,25 @@ my $realMD5 = md5OfFile( '/tmp/kernelcrash.txt' );
print "MD5 compare $localMD5 <-> $realMD5\n";
assert( $localMD5 eq $realMD5 );
printInfo("Added a file that is on the ignore list");
# (*.directory is in the ignored list that needs cleanup)
# (it is names with _conflict) because i want the conflicft detection of assertLocalAndRemoteDir to work
system( "echo dir >> " . localDir() . 'test_stat/file_conflict.directory' );
# this one should retain the directory
system( "echo foobarfoo > " . localDir() . 'test_ignored/sub/ignored_conflict.part' );
csync();
# The file_conflict.directory is seen as a conflict
assertLocalAndRemoteDir( '', 1 );
# TODO: check that the file_conflict.directory is indeed NOT on the server
# TODO: check that test_ignored/sub/ignored_conflict.part is NOT on the server
assert(-e localDir() . 'test_ignored/sub/ignored_conflict.part');
printInfo("Remove a directory containing an ignored file that should not be removed\n");
remoteCleanup('test_ignored');
csync();
assert(-e localDir() . 'test_ignored/sub/ignored_conflict.part');
#remove the file so next sync allow the directory to be removed
system( "rm " . localDir() . 'test_ignored/sub/ignored_conflict.part' );
printInfo("Remove a directory containing a local file\n");
remoteCleanup('test_stat');
@@ -150,6 +164,8 @@ printInfo("Now remove the symlink\n");
system( "rm -f " . localDir() . 'anotherdir' );
csync();
assertLocalAndRemoteDir( '', 0 );
assert(! -e localDir(). 'anotherdir' );
cleanup();

View File

@@ -23,7 +23,7 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;

View File

@@ -23,7 +23,7 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;

View File

@@ -23,7 +23,7 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;
@@ -176,8 +176,6 @@ system("sqlite3 " . localDir().'.csync_journal.db .dump');
#new directory should be uploaded
system("mv " . localDir().'readonlyDirectory_PERM_M_/subdir_PERM_CK_ ' . localDir().'normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_' );
# two syncs may be necessary for now: https://github.com/owncloud/mirall/issues/2038
csync();
csync();
system("sqlite3 " . localDir().'.csync_journal.db .dump');
assertCsyncJournalOk(localDir());
@@ -209,8 +207,6 @@ system("mv " . localDir().'readonlyDirectory_PERM_M_/subdir_PERM_CK_ ' . localDi
#2. move a directory from read to read only (move the directory from previous step)
system("mv " . localDir().'normalDirectory_PERM_CKDNV_/subdir_PERM_CKDNV_ ' . localDir().'readonlyDirectory_PERM_M_/moved_PERM_CK_' );
# two syncs may be necessary for now: https://github.com/owncloud/mirall/issues/2038
csync();
csync();
assertCsyncJournalOk(localDir());

View File

@@ -23,7 +23,7 @@
use lib ".";
use Carp::Assert;
use File::Copy;
use ownCloud::Test;

View File

@@ -1,12 +1,12 @@
The ownCloud Client reads a configuration file. You can locate this configuration files as follows:
- On Linux distributions:
On Linux distributions:
``$HOME/.local/share/data/ownCloud/owncloud.cfg``
- In Microsoft Windows systems:
On Microsoft Windows systems:
``%LOCALAPPDATA%\ownCloud\owncloud.cfg``
- In MAC OS X systems:
On MAC OS X systems:
``$HOME/Library/Application Support/ownCloud``

View File

@@ -29,12 +29,24 @@ the server URL.
OPTIONS
=======
``--confdir`` `PATH`
Specifies the configuration directory where `csync.conf` is located.
``--user``, ``-u`` ``[user]``
Use ``user`` as the login name.
``--silent``
``--password``, ``-p`` ``[password]``
Use ``password`` as the password.
``-n``
Use ``netrc (5)`` for login.
``--non-interactive``
Do not prompt for questions.
``--silent``, ``--s``
Inhibits verbose log output.
``--trust``
Trust any SSL certificate, including invalid ones.
``--httpproxy http://[user@pass:]<server>:<port>``
Uses ``server`` as HTTP proxy.
@@ -48,6 +60,8 @@ the command line would be::
$HOME/media/music \
https://server/owncloud/remote.php/webdav/Music
``owncloudcmd`` will enquire user name and password, unless they have
been specified on the command line or ``-n`` (see `netrc(5)`) has been passed.
Using the legacy scheme, it would be::

View File

@@ -22,13 +22,25 @@ the server URL.
Other comand line switches supported by owncloudcmd include the following:
- ``--silent``
Supresses verbose log output.
``--user``, ``-u`` ``[user]``
Use ``user`` as the login name.
- ``--confdir`` `PATH`
Fetches or stores configuration in the specified configuration directory.
``--password``, ``-p`` ``[password]``
Use ``password`` as the password.
- ``--httpproxy http://[user@pass:]<server>:<port>``
``-n``
Use ``netrc (5)`` for login.
``--non-interactive``
Do not prompt for questions.
``--silent``, ``-s``
Inhibits verbose log output.
``--trust``
Trust any SSL certificate, including invalid ones.
``--httpproxy http://[user@pass:]<server>:<port>``
Uses the specified ``server`` as the HTTP proxy.
Credential Handling
@@ -41,18 +53,19 @@ setting with the usual URL pattern. For example::
https://user:secret@192.168.178.2/remote.php/webdav
Example
~~~~~~~
To synchronize the ownCloud directory ``Music`` to the local directory
``media/music`, through a proxy listening on port ``8080``, and on a gateway
``media/music``, through a proxy listening on port ``8080``, and on a gateway
machine using IP address ``192.168.178.1``, the command line would be::
$ owncloudcmd --httpproxy http://192.168.178.1:8080 \
$HOME/media/music \
https://server/owncloud/remote.php/webdav/Music
``owncloudcmd`` will enquire user name and password, unless they have
been specified on the command line or ``-n`` has been passed.
Using the legacy scheme, the command line would be::

View File

@@ -3,6 +3,7 @@ Categories=Utility;X-SuSE-SyncUtility;
Type=Application
Exec=@APPLICATION_EXECUTABLE@
Name=@APPLICATION_NAME@ desktop sync client
Comment=@APPLICATION_NAME@ desktop synchronization client
GenericName=Folder Sync
Icon=@APPLICATION_EXECUTABLE@
Keywords=@APPLICATION_NAME@;syncing;file;sharing;

View File

@@ -3,7 +3,7 @@ if(APPLE)
add_custom_target( mac_overlayplugin ALL
xcodebuild -workspace ${CMAKE_SOURCE_DIR}/shell_integration/MacOSX/OwnCloud.xcworkspace
-scheme OwnCloudFinder.osax SYMROOT=${CMAKE_CURRENT_BINARY_DIR} archive
COMMENT building Mac Overlay iccons)
COMMENT building Mac Overlay icons)
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Release/OwnCloudFinder.osax/Contents
DESTINATION ${CMAKE_INSTALL_PREFIX}/Library/ScriptingAdditions/OwnCloudFinder.osax/ )

View File

@@ -18,6 +18,7 @@
{
NSMutableDictionary* _fileNamesCache;
BOOL _fileIconsEnabled;
BOOL _hasChangedContent;
NSNumber *_icnOk;
NSNumber *_icnSync;
@@ -38,6 +39,9 @@
- (void)setIcons:(NSDictionary*)iconDictionary filterByFolder:(NSString*)filterFolder;
- (void)setResultForPath:(NSString*)path result:(NSString*)result;
- (void)clearFileNameCacheForPath:(NSString*)path;
- (void)reFetchFileNameCacheForPath:(NSString*)path;
- (void)repaintAllWindows;
- (void)loadIconResourcePath:(NSString*)path;
@end

View File

@@ -31,19 +31,7 @@ static ContentManager* sharedInstance = nil;
{
_fileNamesCache = [[NSMutableDictionary alloc] init];
_fileIconsEnabled = TRUE;
NSString *base = @"/Applications/owncloud.app/Contents/Resources/icons/";
_icnOk = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok.icns"]];
_icnSync = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync.icns"]];
_icnWarn = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning.icns"]];
_icnErr = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error.icns"]];
_icnOkSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok_swm.icns"]];
_icnSyncSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync_swm.icns"]];
_icnWarnSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning_swm.icns"]];
_icnErrSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error_swm.icns"]];
NSLog(@"Icon ok identifier: %d", [_icnOk intValue]);
_hasChangedContent = TRUE;
}
return self;
@@ -71,6 +59,22 @@ static ContentManager* sharedInstance = nil;
return sharedInstance;
}
- (void)loadIconResourcePath:(NSString*)path
{
NSString *base = path;
_icnOk = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok.icns"]];
_icnSync = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync.icns"]];
_icnWarn = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning.icns"]];
_icnErr = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error.icns"]];
_icnOkSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"ok_swm.icns"]];
_icnSyncSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"sync_swm.icns"]];
_icnWarnSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"warning_swm.icns"]];
_icnErrSwm = [[IconCache sharedInstance] registerIcon:[base stringByAppendingString:@"error_swm.icns"]];
NSLog(@"Icon ok identifier: %d from %@", [_icnOk intValue], [base stringByAppendingString:@"ok.icns"]);
}
- (void)enableFileIcons:(BOOL)enable
{
_fileIconsEnabled = enable;
@@ -80,6 +84,10 @@ static ContentManager* sharedInstance = nil;
- (void)setResultForPath:(NSString*)path result:(NSString*)result
{
if (_icnOk == nil) {
// no icon resource path registered yet
return;
}
NSNumber *res;
res = [NSNumber numberWithInt:0];
@@ -107,14 +115,18 @@ static ContentManager* sharedInstance = nil;
}
NSString* normalizedPath = [path decomposedStringWithCanonicalMapping];
[_fileNamesCache setObject:res forKey:normalizedPath];
// NSLog(@"SET value %d", [res intValue]);
[self repaintAllWindows];
if (![_fileNamesCache objectForKey:normalizedPath] || ![[_fileNamesCache objectForKey:normalizedPath] isEqualTo:res]) {
[_fileNamesCache setObject:res forKey:normalizedPath];
//NSLog(@"SET value %d %@", [res intValue], normalizedPath);
_hasChangedContent = YES;
[self performSelector:@selector(repaintAllWindowsIfNeeded) withObject:0 afterDelay:1.0]; // 1 sec
}
}
- (NSNumber*)iconByPath:(NSString*)path isDirectory:(BOOL)isDir
{
//NSLog(@"%@ %@", NSStringFromSelector(_cmd), path);
if (!_fileIconsEnabled)
{
NSLog(@"Icons are NOT ENABLED!");
@@ -126,9 +138,13 @@ static ContentManager* sharedInstance = nil;
return res;
}
NSString* normalizedPath = [path decomposedStringWithCanonicalMapping];
if (![[RequestManager sharedInstance] isRegisteredPath:normalizedPath isDirectory:isDir]) {
return [NSNumber numberWithInt:0];
}
NSNumber* result = [_fileNamesCache objectForKey:normalizedPath];
// NSLog(@"XXXXXXX Asking for icon for path %@ = %d",path, [result intValue]);
// NSLog(@"XXXXXXX Asking for icon for path %@ = %d",normalizedPath, [result intValue]);
if( result == nil ) {
// start the async call
@@ -151,6 +167,7 @@ static ContentManager* sharedInstance = nil;
// it clears the entries from the hash to make it call again home to mirall.
- (void)clearFileNameCacheForPath:(NSString*)path
{
NSLog(@"%@", NSStringFromSelector(_cmd));
NSMutableArray *keysToDelete = [NSMutableArray array];
if( path != nil ) {
@@ -170,12 +187,30 @@ static ContentManager* sharedInstance = nil;
if( [keysToDelete count] > 0 ) {
NSLog( @"Entries to delete: %d", [keysToDelete count]);
[_fileNamesCache removeObjectsForKeys:keysToDelete];
[self repaintAllWindows];
}
}
- (void)reFetchFileNameCacheForPath:(NSString*)path
{
NSLog(@"%@", NSStringFromSelector(_cmd));
for (id p in [_fileNamesCache keyEnumerator]) {
if ( path && [p hasPrefix:path] ) {
[[RequestManager sharedInstance] askForIcon:p isDirectory:false]; // FIXME isDirectory parameter
//[_fileNamesCache setObject:askState forKey:p]; We don't do this since we want to keep the old icon meanwhile
//NSLog(@"%@ %@", NSStringFromSelector(_cmd), p);
}
}
// Ask for directory itself
if ([path hasSuffix:@"/"]) {
path = [path substringToIndex:path.length - 1];
}
[[RequestManager sharedInstance] askForIcon:path isDirectory:true];
//NSLog(@"%@ %@", NSStringFromSelector(_cmd), path);
}
- (void)removeAllIcons
{
[_fileNamesCache removeAllObjects];
@@ -195,8 +230,20 @@ static ContentManager* sharedInstance = nil;
[self repaintAllWindows];
}
- (void)repaintAllWindowsIfNeeded
{
if (!_hasChangedContent) {
NSLog(@"%@ Repaint scheduled but not needed", NSStringFromSelector(_cmd));
return;
}
_hasChangedContent = NO;
[self repaintAllWindows];
}
- (void)repaintAllWindows
{
NSLog(@"%@", NSStringFromSelector(_cmd));
NSArray* windows = [[NSApplication sharedApplication] windows];
for (int i = 0; i < [windows count]; i++)
@@ -286,7 +333,7 @@ static ContentManager* sharedInstance = nil;
}
else
{
NSLog(@"LiferayNativityFinder: refreshing icon badges failed");
NSLog(@"OwnCloudFinder: refreshing icon badges failed");
return;
}
@@ -297,6 +344,7 @@ static ContentManager* sharedInstance = nil;
- (void)setIcons:(NSDictionary*)iconDictionary filterByFolder:(NSString*)filterFolder
{
NSLog(@"%@", NSStringFromSelector(_cmd));
for (NSString* path in iconDictionary)
{
if (filterFolder && ![path hasPrefix:filterFolder])

View File

@@ -3,25 +3,77 @@
//
// This class is in the public domain.
// Originally created by Robbie Hanson in Q3 2010.
// Updated and maintained by Deusty LLC and the Mac development community.
// Updated and maintained by Deusty LLC and the Apple development community.
//
// http://code.google.com/p/cocoaasyncsocket/
// https://github.com/robbiehanson/CocoaAsyncSocket
//
#import <Foundation/Foundation.h>
#import <Security/Security.h>
#import <Security/SecureTransport.h>
#import <dispatch/dispatch.h>
@class GCDAsyncReadPacket;
@class GCDAsyncWritePacket;
@class GCDAsyncSocketPreBuffer;
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 50000 // iOS 5.0 supported
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000 // iOS 5.0 supported and required
#define IS_SECURE_TRANSPORT_AVAILABLE YES
#define SECURE_TRANSPORT_MAYBE_AVAILABLE 1
#define SECURE_TRANSPORT_MAYBE_UNAVAILABLE 0
#else // iOS 5.0 supported but not required
#ifndef NSFoundationVersionNumber_iPhoneOS_5_0
#define NSFoundationVersionNumber_iPhoneOS_5_0 881.00
#endif
#define IS_SECURE_TRANSPORT_AVAILABLE (NSFoundationVersionNumber >= NSFoundationVersionNumber_iPhoneOS_5_0)
#define SECURE_TRANSPORT_MAYBE_AVAILABLE 1
#define SECURE_TRANSPORT_MAYBE_UNAVAILABLE 1
#endif
#else // iOS 5.0 not supported
#define IS_SECURE_TRANSPORT_AVAILABLE NO
#define SECURE_TRANSPORT_MAYBE_AVAILABLE 0
#define SECURE_TRANSPORT_MAYBE_UNAVAILABLE 1
#endif
#else
// Compiling for Mac OS X
#define IS_SECURE_TRANSPORT_AVAILABLE YES
#define SECURE_TRANSPORT_MAYBE_AVAILABLE 1
#define SECURE_TRANSPORT_MAYBE_UNAVAILABLE 0
#endif
extern NSString *const GCDAsyncSocketException;
extern NSString *const GCDAsyncSocketErrorDomain;
#if !TARGET_OS_IPHONE
extern NSString *const GCDAsyncSocketQueueName;
extern NSString *const GCDAsyncSocketThreadName;
#if SECURE_TRANSPORT_MAYBE_AVAILABLE
extern NSString *const GCDAsyncSocketSSLCipherSuites;
#if TARGET_OS_IPHONE
extern NSString *const GCDAsyncSocketSSLProtocolVersionMin;
extern NSString *const GCDAsyncSocketSSLProtocolVersionMax;
#else
extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters;
#endif
#endif
enum GCDAsyncSocketError
{
@@ -42,51 +94,6 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@interface GCDAsyncSocket : NSObject
{
uint32_t flags;
uint16_t config;
id delegate;
dispatch_queue_t delegateQueue;
int socket4FD;
int socket6FD;
int connectIndex;
NSData * connectInterface4;
NSData * connectInterface6;
dispatch_queue_t socketQueue;
dispatch_source_t accept4Source;
dispatch_source_t accept6Source;
dispatch_source_t connectTimer;
dispatch_source_t readSource;
dispatch_source_t writeSource;
dispatch_source_t readTimer;
dispatch_source_t writeTimer;
NSMutableArray *readQueue;
NSMutableArray *writeQueue;
GCDAsyncReadPacket *currentRead;
GCDAsyncWritePacket *currentWrite;
unsigned long socketFDBytesAvailable;
NSMutableData *partialReadBuffer;
#if TARGET_OS_IPHONE
CFStreamClientContext streamContext;
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
#else
SSLContextRef sslContext;
NSMutableData *sslReadBuffer;
size_t sslWriteCachedLength;
#endif
id userData;
}
/**
* GCDAsyncSocket uses the standard delegate paradigm,
@@ -99,6 +106,8 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* The socket queue is optional.
* If you pass NULL, GCDAsyncSocket will automatically create it's own socket queue.
* If you choose to provide a socket queue, the socket queue must not be a concurrent queue.
* If you choose to provide a socket queue, and the socket queue has a configured target queue,
* then please see the discussion for the method markSocketQueueTargetQueue.
*
* The delegate queue and socket queue can optionally be the same.
**/
@@ -121,39 +130,6 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
- (void)setDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
- (void)synchronouslySetDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
/**
* Traditionally sockets are not closed until the conversation is over.
* However, it is technically possible for the remote enpoint to close its write stream.
* Our socket would then be notified that there is no more data to be read,
* but our socket would still be writeable and the remote endpoint could continue to receive our data.
*
* The argument for this confusing functionality stems from the idea that a client could shut down its
* write stream after sending a request to the server, thus notifying the server there are to be no further requests.
* In practice, however, this technique did little to help server developers.
*
* To make matters worse, from a TCP perspective there is no way to tell the difference from a read stream close
* and a full socket close. They both result in the TCP stack receiving a FIN packet. The only way to tell
* is by continuing to write to the socket. If it was only a read stream close, then writes will continue to work.
* Otherwise an error will be occur shortly (when the remote end sends us a RST packet).
*
* In addition to the technical challenges and confusion, many high level socket/stream API's provide
* no support for dealing with the problem. If the read stream is closed, the API immediately declares the
* socket to be closed, and shuts down the write stream as well. In fact, this is what Apple's CFStream API does.
* It might sound like poor design at first, but in fact it simplifies development.
*
* The vast majority of the time if the read stream is closed it's because the remote endpoint closed its socket.
* Thus it actually makes sense to close the socket at this point.
* And in fact this is what most networking developers want and expect to happen.
* However, if you are writing a server that interacts with a plethora of clients,
* you might encounter a client that uses the discouraged technique of shutting down its write stream.
* If this is the case, you can set this property to NO,
* and make use of the socketDidCloseReadStream delegate method.
*
* The default value is YES.
**/
- (BOOL)autoDisconnectOnClosedReadStream;
- (void)setAutoDisconnectOnClosedReadStream:(BOOL)flag;
/**
* By default, both IPv4 and IPv6 are enabled.
*
@@ -211,6 +187,15 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
**/
- (BOOL)acceptOnInterface:(NSString *)interface port:(uint16_t)port error:(NSError **)errPtr;
/**
* Tells the socket to begin listening and accepting connections on the unix domain at the given url.
* When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it,
* and the socket:didAcceptNewSocket: delegate method will be invoked.
*
* The socket will listen on all available interfaces (e.g. wifi, ethernet, etc)
**/
- (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr;
#pragma mark Connecting
/**
@@ -326,6 +311,10 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
viaInterface:(NSString *)interface
withTimeout:(NSTimeInterval)timeout
error:(NSError **)errPtr;
/**
* Connects to the unix domain socket at the given url, using the specified timeout.
*/
- (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr;
#pragma mark Disconnecting
@@ -389,6 +378,7 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
**/
- (NSString *)connectedHost;
- (uint16_t)connectedPort;
- (NSURL *)connectedUrl;
- (NSString *)localHost;
- (uint16_t)localPort;
@@ -646,6 +636,12 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
maxLength:(NSUInteger)length
tag:(long)tag;
/**
* Returns progress of the current read, from 0.0 to 1.0, or NaN if no current read (use isnan() to check).
* The parameters "tag", "done" and "total" will be filled in if they aren't NULL.
**/
- (float)progressOfReadReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr;
#pragma mark Writing
/**
@@ -667,6 +663,12 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
**/
- (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag;
/**
* Returns progress of the current write, from 0.0 to 1.0, or NaN if no current write (use isnan() to check).
* The parameters "tag", "done" and "total" will be filled in if they aren't NULL.
**/
- (float)progressOfWriteReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr;
#pragma mark Security
/**
@@ -678,7 +680,8 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* Any reads or writes scheduled after this method is called will occur over the secured connection.
*
* The possible keys and values for the TLS settings are well documented.
* Some possible keys are:
* Standard keys are:
*
* - kCFStreamSSLLevel
* - kCFStreamSSLAllowsExpiredCertificates
* - kCFStreamSSLAllowsExpiredRoots
@@ -688,6 +691,18 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
* - kCFStreamSSLCertificates
* - kCFStreamSSLIsServer
*
* If SecureTransport is available on iOS:
*
* - GCDAsyncSocketSSLCipherSuites
* - GCDAsyncSocketSSLProtocolVersionMin
* - GCDAsyncSocketSSLProtocolVersionMax
*
* If SecureTransport is available on Mac OS X:
*
* - GCDAsyncSocketSSLCipherSuites
* - GCDAsyncSocketSSLDiffieHellmanParameters;
*
*
* Please refer to Apple's documentation for associated values, as well as other possible keys.
*
* If you pass in nil or an empty dictionary, the default settings will be used.
@@ -712,6 +727,114 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
#pragma mark Advanced
/**
* Traditionally sockets are not closed until the conversation is over.
* However, it is technically possible for the remote enpoint to close its write stream.
* Our socket would then be notified that there is no more data to be read,
* but our socket would still be writeable and the remote endpoint could continue to receive our data.
*
* The argument for this confusing functionality stems from the idea that a client could shut down its
* write stream after sending a request to the server, thus notifying the server there are to be no further requests.
* In practice, however, this technique did little to help server developers.
*
* To make matters worse, from a TCP perspective there is no way to tell the difference from a read stream close
* and a full socket close. They both result in the TCP stack receiving a FIN packet. The only way to tell
* is by continuing to write to the socket. If it was only a read stream close, then writes will continue to work.
* Otherwise an error will be occur shortly (when the remote end sends us a RST packet).
*
* In addition to the technical challenges and confusion, many high level socket/stream API's provide
* no support for dealing with the problem. If the read stream is closed, the API immediately declares the
* socket to be closed, and shuts down the write stream as well. In fact, this is what Apple's CFStream API does.
* It might sound like poor design at first, but in fact it simplifies development.
*
* The vast majority of the time if the read stream is closed it's because the remote endpoint closed its socket.
* Thus it actually makes sense to close the socket at this point.
* And in fact this is what most networking developers want and expect to happen.
* However, if you are writing a server that interacts with a plethora of clients,
* you might encounter a client that uses the discouraged technique of shutting down its write stream.
* If this is the case, you can set this property to NO,
* and make use of the socketDidCloseReadStream delegate method.
*
* The default value is YES.
**/
- (BOOL)autoDisconnectOnClosedReadStream;
- (void)setAutoDisconnectOnClosedReadStream:(BOOL)flag;
/**
* GCDAsyncSocket maintains thread safety by using an internal serial dispatch_queue.
* In most cases, the instance creates this queue itself.
* However, to allow for maximum flexibility, the internal queue may be passed in the init method.
* This allows for some advanced options such as controlling socket priority via target queues.
* However, when one begins to use target queues like this, they open the door to some specific deadlock issues.
*
* For example, imagine there are 2 queues:
* dispatch_queue_t socketQueue;
* dispatch_queue_t socketTargetQueue;
*
* If you do this (pseudo-code):
* socketQueue.targetQueue = socketTargetQueue;
*
* Then all socketQueue operations will actually get run on the given socketTargetQueue.
* This is fine and works great in most situations.
* But if you run code directly from within the socketTargetQueue that accesses the socket,
* you could potentially get deadlock. Imagine the following code:
*
* - (BOOL)socketHasSomething
* {
* __block BOOL result = NO;
* dispatch_block_t block = ^{
* result = [self someInternalMethodToBeRunOnlyOnSocketQueue];
* }
* if (is_executing_on_queue(socketQueue))
* block();
* else
* dispatch_sync(socketQueue, block);
*
* return result;
* }
*
* What happens if you call this method from the socketTargetQueue? The result is deadlock.
* This is because the GCD API offers no mechanism to discover a queue's targetQueue.
* Thus we have no idea if our socketQueue is configured with a targetQueue.
* If we had this information, we could easily avoid deadlock.
* But, since these API's are missing or unfeasible, you'll have to explicitly set it.
*
* IF you pass a socketQueue via the init method,
* AND you've configured the passed socketQueue with a targetQueue,
* THEN you should pass the end queue in the target hierarchy.
*
* For example, consider the following queue hierarchy:
* socketQueue -> ipQueue -> moduleQueue
*
* This example demonstrates priority shaping within some server.
* All incoming client connections from the same IP address are executed on the same target queue.
* And all connections for a particular module are executed on the same target queue.
* Thus, the priority of all networking for the entire module can be changed on the fly.
* Additionally, networking traffic from a single IP cannot monopolize the module.
*
* Here's how you would accomplish something like that:
* - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock
* {
* dispatch_queue_t socketQueue = dispatch_queue_create("", NULL);
* dispatch_queue_t ipQueue = [self ipQueueForAddress:address];
*
* dispatch_set_target_queue(socketQueue, ipQueue);
* dispatch_set_target_queue(iqQueue, moduleQueue);
*
* return socketQueue;
* }
* - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket
* {
* [clientConnections addObject:newSocket];
* [newSocket markSocketQueueTargetQueue:moduleQueue];
* }
*
* Note: This workaround is ONLY needed if you intend to execute code directly on the ipQueue or moduleQueue.
* This is often NOT the case, as such queues are used solely for execution shaping.
**/
- (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreConfiguredTargetQueue;
- (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreviouslyConfiguredTargetQueue;
/**
* It's not thread-safe to access certain variables from outside the socket's internal queue.
*
@@ -805,7 +928,9 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
**/
- (BOOL)enableBackgroundingOnSocket;
#else
#endif
#if SECURE_TRANSPORT_MAYBE_AVAILABLE
/**
* This method is only available from within the context of a performBlock: invocation.
@@ -881,6 +1006,12 @@ typedef enum GCDAsyncSocketError GCDAsyncSocketError;
**/
- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port;
/**
* Called when a socket connects and is ready for reading and writing.
* The host parameter will be an IP address, not a DNS name.
**/
- (void)socket:(GCDAsyncSocket *)sock didConnectToUrl:(NSURL *)url;
/**
* Called when a socket has completed reading the requested data into memory.
* Not called if there is an error.

File diff suppressed because it is too large Load Diff

View File

@@ -71,6 +71,7 @@ static IconCache* sharedInstance = nil;
if (image == nil)
{
NSLog(@"%@ Could not load %@", NSStringFromSelector(_cmd), path);
return [NSNumber numberWithInt:-1];
}

View File

@@ -34,7 +34,7 @@
NSNumber* imageIndex = [[ContentManager sharedInstance] iconByPath:[url path] isDirectory:isDir];
NSLog(@"1 The icon index is %d", [imageIndex intValue]);
//NSLog(@"1 The icon index is %d", [imageIndex intValue]);
if ([imageIndex intValue] > 0)
{
NSImage* image = [[IconCache sharedInstance] getIcon:imageIndex];
@@ -77,7 +77,7 @@
}
NSNumber* imageIndex = [[ContentManager sharedInstance] iconByPath:[url path] isDirectory:isDir];
// NSLog(@"2 The icon index is %d", [imageIndex intValue]);
//NSLog(@"2 The icon index is %d %@ %@", [imageIndex intValue], [url path], isDir ? @"isDir" : @"");
if ([imageIndex intValue] > 0)
{
@@ -145,7 +145,7 @@
}
NSNumber* imageIndex = [[ContentManager sharedInstance] iconByPath:[url path] isDirectory:isDir];
NSLog(@"3 The icon index is %d", [imageIndex intValue]);
//NSLog(@"3 The icon index is %d", [imageIndex intValue]);
if ([imageIndex intValue] > 0)
{

View File

@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>NVTY</string>
<string>OWNC</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFPlugInDynamicRegisterFunction</key>

View File

@@ -31,7 +31,7 @@
+ (RequestManager*)sharedInstance;
- (BOOL)isRegisteredPath:(NSString*)path;
- (BOOL)isRegisteredPath:(NSString*)path isDirectory:(BOOL)isDir;
- (void)askOnSocket:(NSString*)path query:(NSString*)verb;
- (NSNumber*)askForIcon:(NSString*)path isDirectory:(BOOL)isDir;
- (void)menuItemClicked:(NSDictionary*)actionDictionary;

View File

@@ -77,14 +77,20 @@ static RequestManager* sharedInstance = nil;
}
- (BOOL)isRegisteredPath:(NSString*)path
- (BOOL)isRegisteredPath:(NSString*)path isDirectory:(BOOL)isDir
{
// check if the file in question is underneath a registered directory
NSArray *regPathes = [_registeredPathes allKeys];
BOOL registered = NO;
NSString* checkPath = [[NSString alloc] initWithString:path];
if (isDir) {
// append a slash
checkPath = [path stringByAppendingString:@"/"];
}
for( NSString *regPath in regPathes ) {
if( [path hasPrefix:regPath]) {
if( [checkPath hasPrefix:regPath]) {
// the path was registered
registered = YES;
break;
@@ -99,7 +105,7 @@ static RequestManager* sharedInstance = nil;
NSString *verb = @"RETRIEVE_FILE_STATUS";
NSNumber *res = [NSNumber numberWithInt:0];
if( [self isRegisteredPath:path] ) {
if( [self isRegisteredPath:path isDirectory:isDir] ) {
if( _isConnected ) {
if(isDir) {
verb = @"RETRIEVE_FOLDER_STATUS";
@@ -133,24 +139,32 @@ static RequestManager* sharedInstance = nil;
if( [chunks count] > 0 && tag == READ_TAG ) {
if( [[chunks objectAtIndex:0] isEqualToString:@"STATUS"] ) {
[contentman setResultForPath:[chunks objectAtIndex:2] result:[chunks objectAtIndex:1]];
NSString *path = [chunks objectAtIndex:2];
if( [chunks count] > 3 ) {
for( int i = 2; i < [chunks count]-1; i++ ) {
path = [NSString stringWithFormat:@"%@:%@",
path, [chunks objectAtIndex:i+1] ];
}
}
[contentman setResultForPath:path result:[chunks objectAtIndex:1]];
} else if( [[chunks objectAtIndex:0] isEqualToString:@"UPDATE_VIEW"] ) {
NSString *path = [chunks objectAtIndex:1];
[contentman clearFileNameCacheForPath:path];
[contentman repaintAllWindows];
[contentman reFetchFileNameCacheForPath:path];
} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"REGISTER_PATH"] ) {
NSNumber *one = [NSNumber numberWithInt:1];
NSString *path = [chunks objectAtIndex:1];
NSLog(@"Registering path: %@", path);
[_registeredPathes setObject:one forKey:path];
[contentman repaintAllWindows];
} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"UNREGISTER_PATH"] ) {
NSNumber *one = [NSNumber numberWithInt:1];
NSString *path = [chunks objectAtIndex:1];
[_registeredPathes removeObjectForKey:path];
[contentman repaintAllWindows];
} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"ICON_PATH"] ) {
NSString *path = [chunks objectAtIndex:1];
[[ContentManager sharedInstance] loadIconResourcePath:path];
} else {
NSLog(@"Unknown command %@", [chunks objectAtIndex:0]);
}
@@ -169,9 +183,19 @@ static RequestManager* sharedInstance = nil;
return 0.0;
}
-(void)socket:(GCDAsyncSocket*)socket didConnectToUrl:(NSURL *)url {
NSLog(@"didConnectToUrl %@", url);
[self socketDidConnect:socket];
}
- (void)socket:(GCDAsyncSocket*)socket didConnectToHost:(NSString*)host port:(UInt16)port
{
NSLog( @"Connected to host successfully!");
[self socketDidConnect:socket];
}
// Our impl
- (void)socketDidConnect:(GCDAsyncSocket*)socket {
NSLog( @"Connected to sync client successfully!");
_isConnected = YES;
_isRunning = NO;
@@ -181,6 +205,10 @@ static RequestManager* sharedInstance = nil;
[self askOnSocket:path];
}
}
ContentManager *contentman = [ContentManager sharedInstance];
[contentman clearFileNameCacheForPath:nil];
[contentman repaintAllWindows];
// Read for the UPDATE_VIEW requests
NSData* stop = [@"\n" dataUsingEncoding:NSUTF8StringEncoding];
@@ -205,6 +233,7 @@ static RequestManager* sharedInstance = nil;
// clear the caches in conent manager
ContentManager *contentman = [ContentManager sharedInstance];
[contentman clearFileNameCacheForPath:nil];
[contentman repaintAllWindows];
[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(start) userInfo:nil repeats:NO];
@@ -215,12 +244,27 @@ static RequestManager* sharedInstance = nil;
{
if (!_isRunning)
{
NSLog(@"Connect Socket!");
NSError *err = nil;
if (![_socket connectToHost:@"localhost" onPort:34001 withTimeout:5 error:&err]) // Asynchronous!
{
// If there was an error, it's likely something like "already connected" or "no delegate set"
NSLog(@"I goofed: %@", err);
BOOL useTcp = NO;
if (useTcp) {
NSLog(@"Connect Socket");
if (![_socket connectToHost:@"localhost" onPort:34001 withTimeout:5 error:&err]) {
// If there was an error, it's likely something like "already connected" or "no delegate set"
NSLog(@"I goofed: %@", err);
}
} else if (!useTcp) {
NSURL *url;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
if ([paths count])
{
// file:///Users/guruz/Library/Caches/SyncStateHelper/ownCloud.socket
// FIXME Generify this and support all sockets there since multiple sync clients might be running
url =[NSURL fileURLWithPath:[[[paths objectAtIndex:0] stringByAppendingPathComponent:@"SyncStateHelper"] stringByAppendingPathComponent:@"ownCloud.socket"]];
}
if (url) {
NSLog(@"Connect Socket to %@", url);
[_socket connectToUrl:url withTimeout:5 error:&err];
}
}
_isRunning = YES;

View File

@@ -26,7 +26,7 @@
<dict>
<key>Events</key>
<dict>
<key>NVTYlded</key>
<key>OWNClded</key>
<dict>
<key>Context</key>
<string>Process</string>
@@ -35,7 +35,7 @@
<key>ThreadSafe</key>
<false/>
</dict>
<key>NVTYload</key>
<key>OWNCload</key>
<dict>
<key>Context</key>
<string>Process</string>
@@ -44,7 +44,7 @@
<key>ThreadSafe</key>
<false/>
</dict>
<key>NVTYunld</key>
<key>OWNCunld</key>
<dict>
<key>Context</key>
<string>Process</string>

View File

@@ -1,6 +1,6 @@
tell application "Finder"
try
«event NVTYlded»
«event OWNClded»
set the result to 0
on error msg number code
set the result to code

View File

@@ -1,6 +1,6 @@
tell application "Finder"
try
«event NVTYload»
«event OWNCload»
end try
end tell

View File

@@ -2,7 +2,7 @@
osascript -e 'tell application "Finder" \
try \
«event NVTYload» \
«event OWNCload» \
end try \
end tell'

View File

@@ -1,6 +1,6 @@
tell application "Finder"
try
«event NVTYunld»
«event OWNCunld»
end try
end tell

View File

@@ -13,7 +13,12 @@ if( UNIX AND NOT APPLE )
FOREACH(size 128x128 16x16 256x256 32x32 48x48 64x64 72x72)
file(GLOB files "${size}/*.png")
install(FILES ${files} DESTINATION ${ICON_DIR}/${size}/apps)
FOREACH( file ${files} )
# the GLOB returns a absolute path. Make it relative by replacing the current src dir by nothing
STRING(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/${size}/" "" shortFile ${file})
STRING(REPLACE "oC" ${APPLICATION_NAME} brandedName ${shortFile})
install(FILES ${file} DESTINATION ${ICON_DIR}/${size}/apps RENAME ${brandedName})
ENDFOREACH(file)
ENDFOREACH(size)
endif()

View File

@@ -1 +1,2 @@
install(FILES ownCloud.py DESTINATION ${DATADIR}/nautilus-python/extensions)
install(FILES syncstate.py DESTINATION ${DATADIR}/nautilus-python/extensions)

View File

@@ -1,168 +0,0 @@
#!/usr/bin/python3
import os
import urllib
import socket
from gi.repository import GObject, Nautilus
class ownCloudExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoProvider):
nautilusVFSFile_table = {}
registered_paths = {}
remainder = ''
connected = False
watch_id = 0
def __init__(self):
self.connectToOwnCloud
if not self.connected:
# try again in 5 seconds - attention, logic inverted!
GObject.timeout_add(5000, self.connectToOwnCloud)
def port(self):
return 34001 # Fixme, read from config file.
def connectToOwnCloud(self):
try:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.connect(("localhost", self.port()))
self.sock.settimeout(5)
self.connected = True
self.watch_id = GObject.io_add_watch(self.sock, GObject.IO_IN, self.handle_notify)
except:
print "Connect could not be established, try again later!"
self.sock.close()
return not self.connected
def sendCommand(self, cmd):
if self.connected:
try:
self.sock.send(cmd)
except:
print "Sending failed."
GObject.source_remove( self.watch_id )
self.connected = False
GObject.timeout_add(5000, self.connectToOwnCloud)
def find_item_for_file( self, path ):
if path in self.nautilusVFSFile_table:
return self.nautilusVFSFile_table[path]
else:
return None
def askForOverlay(self, file):
if os.path.isdir(file):
folderStatus = self.sendCommand("RETRIEVE_FOLDER_STATUS:"+file+"\n");
if os.path.isfile(file):
fileStatus = self.sendCommand("RETRIEVE_FILE_STATUS:"+file+"\n");
def invalidate_items_underneath( self, path ):
update_items = []
for p in self.nautilusVFSFile_table:
if p == path or p.startswith( path ):
item = self.nautilusVFSFile_table[p]
update_items.append(item)
for item in update_items:
item.invalidate_extension_info()
# self.update_file_info(item)
# Handles a single line of server respoonse and sets the emblem
def handle_server_response(self, l):
Emblems = { 'OK' : 'oC_ok',
'SYNC' : 'oC_sync',
'NEW' : 'oC_sync',
'IGNORE' : 'oC_warn',
'ERROR' : 'oC_error',
'OK+SWM' : 'oC_ok_shared',
'SYNC+SWM' : 'oC_sync_shared',
'NEW+SWM' : 'oC_sync_shared',
'IGNORE+SWM': 'oC_warn_shared',
'ERROR+SWM' : 'oC_error_shared',
'NOP' : 'oC_error'
}
print "Server response: "+l
parts = l.split(':')
if len(parts) > 0:
action = parts[0]
# file = parts[1]
# print "Action for " + file + ": "+parts[0]
if action == 'STATUS':
emblem = Emblems[parts[1]]
if emblem:
item = self.find_item_for_file(parts[2])
if item:
item.add_emblem(emblem)
elif action == 'UPDATE_VIEW':
# Search all items underneath this path and invalidate them
if parts[1] in self.registered_paths:
self.invalidate_items_underneath( parts[1] )
elif action == 'REGISTER_PATH':
self.registered_paths[parts[1]] = 1
self.invalidate_items_underneath( parts[1] )
elif action == 'UNREGISTER_PATH':
del self.registered_paths[parts[1]]
self.invalidate_items_underneath( parts[1] )
# check if there are non pathes any more, if so, its usual
# that mirall went away. Try reconnect.
if not self.registered_paths:
self.sock.close()
self.connected = False
GObject.source_remove( self.watch_id )
GObject.timeout_add(5000, self.connectToOwnCloud)
else:
# print "We got unknown action " + action
1
# notify is the raw answer from the socket
def handle_notify(self, source, condition):
data = source.recv(1024)
# prepend the remaining data from last call
if len(self.remainder) > 0:
data = self.remainder+data
self.remainder = ''
if len(data) > 0:
# remember the remainder for next round
lastNL = data.rfind('\n');
if lastNL > -1 and lastNL < len(data):
self.remainder = data[lastNL+1:]
data = data[:lastNL]
for l in data.split('\n'):
self.handle_server_response( l )
else:
return False
return True # run again
def get_local_path(self, path):
return path.replace("file://", "")
def update_file_info(self, item):
if item.get_uri_scheme() != 'file':
return
filename = urllib.unquote(item.get_uri()[7:])
if item.is_directory():
filename += '/'
for reg_path in self.registered_paths:
if filename.startswith(reg_path):
self.nautilusVFSFile_table[filename] = item
# item.add_string_attribute('share_state', "share state")
self.askForOverlay(filename)
break
else:
print "Not in scope:"+filename

View File

@@ -0,0 +1,194 @@
#!/usr/bin/python3
#
# 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.
import os
import urllib
import socket
from gi.repository import GObject, Nautilus
class syncStateExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoProvider):
nautilusVFSFile_table = {}
registered_paths = {}
remainder = ''
connected = False
watch_id = 0
appname = 'ownCloud'
def __init__(self):
self.connectToSocketServer
if not self.connected:
# try again in 5 seconds - attention, logic inverted!
GObject.timeout_add(5000, self.connectToSocketServer)
def connectToSocketServer(self):
try:
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
postfix = "/"+self.appname+"/socket"
sock_file = os.environ["XDG_RUNTIME_DIR"]+postfix
print ("XXXX " + sock_file + " <=> " + postfix)
if sock_file != postfix:
try:
print("Socket File: "+sock_file)
self.sock.connect(sock_file)
self.connected = True
self.watch_id = GObject.io_add_watch(self.sock, GObject.IO_IN, self.handle_notify)
except:
print("Could not connect to unix socket.")
else:
print("Sock-File not valid: "+sock_file)
except:
print("Connect could not be established, try again later!")
self.sock.close()
return not self.connected
def sendCommand(self, cmd):
if self.connected:
try:
self.sock.send(cmd)
except:
print("Sending failed.")
GObject.source_remove(self.watch_id)
self.connected = False
GObject.timeout_add(5000, self.connectToSocketServer)
def find_item_for_file(self, path):
if path in self.nautilusVFSFile_table:
return self.nautilusVFSFile_table[path]
else:
return None
def askForOverlay(self, file):
# print("Asking for overlay for "+file)
if os.path.isdir(file):
folderStatus = self.sendCommand("RETRIEVE_FOLDER_STATUS:"+file+"\n");
if os.path.isfile(file):
fileStatus = self.sendCommand("RETRIEVE_FILE_STATUS:"+file+"\n");
def invalidate_items_underneath(self, path):
update_items = []
if not self.nautilusVFSFile_table:
self.askForOverlay(path)
else:
for p in self.nautilusVFSFile_table:
if p == path or p.startswith(path):
item = self.nautilusVFSFile_table[p]['item']
update_items.append(item)
for item in update_items:
item.invalidate_extension_info()
# Handles a single line of server respoonse and sets the emblem
def handle_server_response(self, l):
Emblems = { 'OK' : self.appname +'_ok',
'SYNC' : self.appname +'_sync',
'NEW' : self.appname +'_sync',
'IGNORE' : self.appname +'_warn',
'ERROR' : self.appname +'_error',
'OK+SWM' : self.appname +'_ok_shared',
'SYNC+SWM' : self.appname +'_sync_shared',
'NEW+SWM' : self.appname +'_sync_shared',
'IGNORE+SWM': self.appname +'_warn_shared',
'ERROR+SWM' : self.appname +'_error_shared',
'NOP' : self.appname +'_error'
}
print("Server response: "+l)
parts = l.split(':')
if len(parts) > 0:
action = parts[0]
# file = parts[1]
# print "Action for " + file + ": "+parts[0]
if action == 'STATUS':
newState = parts[1]
emblem = Emblems[newState]
if emblem:
itemStore = self.find_item_for_file(parts[2])
if itemStore:
if( not itemStore['state'] or newState != itemStore['state'] ):
item = itemStore['item']
item.add_emblem(emblem)
# print "Setting emblem on " + parts[2]
self.nautilusVFSFile_table[parts[2]] = {'item': item, 'state':newState}
elif action == 'UPDATE_VIEW':
# Search all items underneath this path and invalidate them
if parts[1] in self.registered_paths:
self.invalidate_items_underneath(parts[1])
elif action == 'REGISTER_PATH':
self.registered_paths[parts[1]] = 1
self.invalidate_items_underneath(parts[1])
elif action == 'UNREGISTER_PATH':
del self.registered_paths[parts[1]]
self.invalidate_items_underneath(parts[1])
# check if there are non pathes any more, if so, its usual
# that mirall went away. Try reconnect.
if not self.registered_paths:
self.sock.close()
self.connected = False
GObject.source_remove(self.watch_id)
GObject.timeout_add(5000, self.connectToSocketServer)
else:
# print "We got unknown action " + action
1
# notify is the raw answer from the socket
def handle_notify(self, source, condition):
data = source.recv(1024)
# prepend the remaining data from last call
if len(self.remainder) > 0:
data = self.remainder+data
self.remainder = ''
if len(data) > 0:
# remember the remainder for next round
lastNL = data.rfind('\n');
if lastNL > -1 and lastNL < len(data):
self.remainder = data[lastNL+1:]
data = data[:lastNL]
for l in data.split('\n'):
self.handle_server_response(l)
else:
return False
return True # run again
def get_local_path(self, path):
return path.replace("file://", "")
def update_file_info(self, item):
if item.get_uri_scheme() != 'file':
return
filename = urllib.unquote(item.get_uri()[7:])
if item.is_directory():
filename += '/'
for reg_path in self.registered_paths:
if filename.startswith(reg_path):
self.nautilusVFSFile_table[filename] = {'item': item, 'state':''}
# item.add_string_attribute('share_state', "share state")
self.askForOverlay(filename)
break
else:
print("Not in scope:"+filename)

View File

@@ -216,7 +216,7 @@ else()
install(TARGETS ${synclib_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
if (SPARKLE_FOUND)
install(DIRECTORY "${SPARKLE_LIBRARY}"
DESTINATION "${OWNCLOUD_OSX_BUNDLE}/Contents/Frameworks")
DESTINATION "${OWNCLOUD_OSX_BUNDLE}/Contents/Frameworks" USE_SOURCE_PERMISSIONS)
endif (SPARKLE_FOUND)
endif()
@@ -270,6 +270,7 @@ set(mirall_SRCS
mirall/sslbutton.cpp
mirall/syncrunfilelog.cpp
mirall/selectivesyncdialog.cpp
mirall/accountmigrator.cpp
)
@@ -358,13 +359,7 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml WebKitWidgets Sql ${ADDITIONAL_APP_MODULES})
elseif(NOT BUILD_LIBRARIES_ONLY)
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
if (Qt5Core_FOUND)
include(DeployQt5)
else(Qt5Core_FOUND)
include(DeployQt4)
endif(Qt5Core_FOUND)
set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf.
# set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf.
set(MACOSX_BUNDLE_ICON_FILE "ownCloud.icns")
# we must add MACOSX_BUNDLE only if building a bundle
@@ -403,18 +398,6 @@ if(NOT BUILD_LIBRARIES_ONLY)
)
endif()
#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 AND NOT BUILD_LIBRARIES_ONLY)
if(Qt5Core_FOUND)
install_qt5_executable(${OWNCLOUD_OSX_BUNDLE} "qtaccessiblewidgets;qsqlite;qcocoa")
else(Qt5Core_FOUND)
install_qt4_executable(${OWNCLOUD_OSX_BUNDLE} "qtaccessiblewidgets;qsqlite")
endif(Qt5Core_FOUND)
endif()
find_program(KRAZY2_EXECUTABLE krazy2)
if(KRAZY2_EXECUTABLE)
# s/y k/y ALL k/ for building this target always
@@ -426,7 +409,7 @@ if(KRAZY2_EXECUTABLE)
endif()
set(owncloudcmd_NAME ${APPLICATION_EXECUTABLE}cmd)
set(OWNCLOUDCMD_SRC owncloudcmd/simplesslerrorhandler.cpp owncloudcmd/owncloudcmd.cpp)
set(OWNCLOUDCMD_SRC owncloudcmd/simplesslerrorhandler.cpp owncloudcmd/owncloudcmd.cpp owncloudcmd/netrcparser.cpp)
if(NOT BUILD_LIBRARIES_ONLY)
add_executable(${owncloudcmd_NAME} ${OWNCLOUDCMD_SRC})
@@ -454,3 +437,13 @@ elseif(NOT BUILD_LIBRARIES_ONLY)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
#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 AND NOT BUILD_LIBRARIES_ONLY)
install(CODE "
message(STATUS \"Deploying (Qt) dependencies and fixing library pathes...\")
execute_process(COMMAND \"${CMAKE_SOURCE_DIR}/admin/osx/macdeployqt.py\" ${CMAKE_INSTALL_PREFIX}/${OWNCLOUD_OSX_BUNDLE})
" COMPONENT RUNTIME)
endif()

View File

@@ -36,7 +36,7 @@ AbstractCredentials* create(const QString& type)
// empty string might happen for old version of configuration
if (type == "http" || type == "") {
return new HttpCredentials;
return new HttpCredentialsGui;
} else if (type == "dummy") {
return new DummyCredentials;
} else if (type == "shibboleth") {

View File

@@ -37,9 +37,6 @@ using namespace QKeychain;
namespace Mirall
{
namespace
{
int getauth(const char *prompt,
char *buf,
size_t len,
@@ -74,10 +71,10 @@ int getauth(const char *prompt,
return re;
}
namespace
{
const char userC[] = "user";
const char authenticationFailedC[] = "owncloud-authentication-failed";
} // ns
class HttpCredentialsAccessManager : public MirallAccessManager {
@@ -299,19 +296,6 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
}
}
QString HttpCredentials::queryPassword(bool *ok)
{
if (ok) {
QString str = QInputDialog::getText(0, tr("Enter Password"),
tr("Please enter %1 password for user '%2':")
.arg(Theme::instance()->appNameGUI(), _user),
QLineEdit::Password, QString(), ok);
return str;
} else {
return QString();
}
}
void HttpCredentials::invalidateToken(Account *account)
{
_password = QString();
@@ -380,4 +364,17 @@ void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* a
reply->close();
}
QString HttpCredentialsGui::queryPassword(bool *ok)
{
if (ok) {
QString str = QInputDialog::getText(0, tr("Enter Password"),
tr("Please enter %1 password for user '%2':")
.arg(Theme::instance()->appNameGUI(), _user),
QLineEdit::Password, QString(), ok);
return str;
} else {
return QString();
}
}
} // ns Mirall

View File

@@ -49,7 +49,7 @@ public:
void persist(Account *account) Q_DECL_OVERRIDE;
QString user() const Q_DECL_OVERRIDE;
QString password() const;
QString queryPassword(bool *ok);
virtual QString queryPassword(bool *ok) = 0;
void invalidateToken(Account *account) Q_DECL_OVERRIDE;
QString fetchUser(Account *account);
@@ -58,14 +58,23 @@ private Q_SLOTS:
void slotReadJobDone(QKeychain::Job*);
void slotWriteJobDone(QKeychain::Job*);
private:
protected:
QString _user;
QString _password;
private:
bool _ready;
bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible
bool _readPwdFromDeprecatedPlace;
};
class OWNCLOUDSYNC_EXPORT HttpCredentialsGui : public HttpCredentials {
public:
HttpCredentialsGui() : HttpCredentials() {}
HttpCredentialsGui(const QString& user, const QString& password) : HttpCredentials(user, password) {}
QString queryPassword(bool *ok) Q_DECL_OVERRIDE;
};
} // ns Mirall
#endif

View File

@@ -385,7 +385,7 @@ void ShibbolethCredentials::showLoginWindow(Account* account)
QList<QNetworkCookie> ShibbolethCredentials::accountCookies(Account *account)
{
return account->networkAccessManager()->cookieJar()->cookiesForUrl(account->url());
return account->networkAccessManager()->cookieJar()->cookiesForUrl(account->davUrl());
}
QNetworkCookie ShibbolethCredentials::findShibCookie(Account *account, QList<QNetworkCookie> cookies)

View File

@@ -18,6 +18,7 @@
#include "mirall/mirallconfigfile.h"
#include "mirall/mirallaccessmanager.h"
#include "mirall/quotainfo.h"
#include "mirall/owncloudtheme.h"
#include "creds/abstractcredentials.h"
#include "creds/credentialsfactory.h"
@@ -27,6 +28,8 @@
#include <QNetworkAccessManager>
#include <QSslSocket>
#include <QNetworkCookieJar>
#include <QFileInfo>
#include <QDir>
#include <QDebug>
@@ -36,6 +39,7 @@ static const char urlC[] = "url";
static const char authTypeC[] = "authType";
static const char userC[] = "user";
static const char httpUserC[] = "http_user";
static const char caCertsKeyC[] = "CaCertificates";
AccountManager *AccountManager::_instance = 0;
@@ -71,6 +75,7 @@ Account::Account(AbstractSslErrorHandler *sslErrorHandler, QObject *parent)
, _treatSslErrorsAsFailure(false)
, _state(Account::Disconnected)
, _davPath("remote.php/webdav/")
, _wasMigrated(false)
{
qRegisterMetaType<Account*>("Account*");
}
@@ -98,25 +103,66 @@ void Account::save()
}
settings->sync();
// ### TODO port away from MirallConfigFile
MirallConfigFile cfg;
// Save accepted certificates.
settings->beginGroup(QLatin1String("General"));
qDebug() << "Saving " << approvedCerts().count() << " unknown certs.";
QByteArray certs;
Q_FOREACH( const QSslCertificate& cert, approvedCerts() ) {
certs += cert.toPem() + '\n';
}
if (!certs.isEmpty()) {
cfg.setCaCerts( certs );
settings->setValue( QLatin1String(caCertsKeyC), certs );
}
}
Account* Account::restore()
{
// try to open the correctly themed settings
QScopedPointer<QSettings> settings(settingsWithGroup(Theme::instance()->appName()));
Account *acc = 0;
bool migratedCreds = false;
// if the settings file could not be opened, the childKeys list is empty
if( settings->childKeys().isEmpty() ) {
// Now try to open the original ownCloud settings to see if they exist.
QString oCCfgFile = QDir::fromNativeSeparators( settings->fileName() );
// replace the last two segments with ownCloud/owncloud.cfg
oCCfgFile = oCCfgFile.left( oCCfgFile.lastIndexOf('/'));
oCCfgFile = oCCfgFile.left( oCCfgFile.lastIndexOf('/'));
oCCfgFile += QLatin1String("/ownCloud/owncloud.cfg");
qDebug() << "Migrate: checking old config " << oCCfgFile;
QFileInfo fi( oCCfgFile );
if( fi.isReadable() ) {
QSettings *oCSettings = new QSettings(oCCfgFile, QSettings::IniFormat);
oCSettings->beginGroup(QLatin1String("ownCloud"));
// Check the theme url to see if it is the same url that the oC config was for
QString overrideUrl = Theme::instance()->overrideServerUrl();
if( !overrideUrl.isEmpty() ) {
if (overrideUrl.endsWith('/')) { overrideUrl.chop(1); }
QString oCUrl = oCSettings->value(QLatin1String(urlC)).toString();
if (oCUrl.endsWith('/')) { oCUrl.chop(1); }
// in case the urls are equal reset the settings object to read from
// the ownCloud settings object
qDebug() << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":"
<< (oCUrl == overrideUrl ? "Yes" : "No");
if( oCUrl == overrideUrl ) {
migratedCreds = true;
settings.reset( oCSettings );
} else {
delete oCSettings;
}
}
}
}
if (!settings->childKeys().isEmpty()) {
Account *acc = new Account;
MirallConfigFile cfg;
acc->setApprovedCerts(QSslCertificate::fromData(cfg.caCerts()));
acc = new Account;
acc->setUrl(settings->value(QLatin1String(urlC)).toUrl());
acc->setCredentials(CredentialsFactory::create(settings->value(QLatin1String(authTypeC)).toString()));
@@ -128,6 +174,11 @@ Account* Account::restore()
continue;
acc->_settingsMap.insert(key, settings->value(key));
}
// now the cert, it is in the general group
settings->beginGroup(QLatin1String("General"));
acc->setApprovedCerts(QSslCertificate::fromData(settings->value(caCertsKeyC).toByteArray()));
acc->setMigrated(migratedCreds);
return acc;
}
return 0;
@@ -364,4 +415,14 @@ void Account::slotHandleErrors(QNetworkReply *reply , QList<QSslError> errors)
}
}
bool Account::wasMigrated()
{
return _wasMigrated;
}
void Account::setMigrated(bool mig)
{
_wasMigrated = mig;
}
} // namespace Mirall

View File

@@ -108,6 +108,13 @@ public:
/** Returns webdav entry URL, based on url() */
QUrl davUrl() const;
/** set and retrieve the migration flag: if an account of a branded
* client was migrated from a former ownCloud Account, this is true
*/
void setMigrated(bool mig);
bool wasMigrated();
QList<QNetworkCookie> lastAuthCookies() const;
QNetworkReply* headRequest(const QString &relPath);
@@ -147,8 +154,10 @@ public:
QNetworkAccessManager* networkAccessManager();
QuotaInfo *quotaInfo();
signals:
void stateChanged(int state);
void propagatorNetworkActivity();
protected Q_SLOTS:
void slotHandleErrors(QNetworkReply*,QList<QSslError>);
@@ -166,6 +175,7 @@ private:
int _state;
static QString _configFileName;
QString _davPath; // default "remote.php/webdav/";
bool _wasMigrated;
};
}

View File

@@ -0,0 +1,89 @@
/*
* 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 "mirall/accountmigrator.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/folderman.h"
#include "mirall/theme.h"
#include <QSettings>
#include <QStringList>
#include <QDir>
#include <QFileInfo>
#include <QDebug>
namespace Mirall {
// The purpose of this class is to migrate an existing account that
// was set up with an unbranded client to an branded one.
// The usecase is: Usually people try first with the community client,
// later they maybe switch to a branded client. When they install the
// branded client first, it should automatically pick the information
// from the already configured account.
AccountMigrator::AccountMigrator()
{
}
// the list of folder definitions which are files in the directory "folders"
// underneath the ownCloud configPath (with ownCloud as a last segment)
// need to be copied to the themed path and adjusted.
QStringList AccountMigrator::migrateFolderDefinitons()
{
MirallConfigFile cfg;
QStringList re;
QString themePath = cfg.configPath();
// create the original ownCloud config path out of the theme path
// by removing the theme folder and append ownCloud.
QString oCPath = themePath;
if( oCPath.endsWith(QLatin1Char('/')) ) {
oCPath.truncate( oCPath.length()-1 );
}
oCPath = oCPath.left( oCPath.lastIndexOf('/'));
themePath += QLatin1String( "folders");
oCPath += QLatin1String( "/ownCloud/folders" );
qDebug() << "Migrator: theme-path: " << themePath;
qDebug() << "Migrator: ownCloud path: " << oCPath;
// get a dir listing of the ownCloud folder definitions and copy
// them over to the theme dir
QDir oCDir(oCPath);
oCDir.setFilter( QDir::Files );
QStringList files = oCDir.entryList();
foreach( const QString& file, files ) {
QString escapedAlias = FolderMan::instance()->escapeAlias(file);
QString themeFile = themePath + QDir::separator() + file;
QString oCFile = oCPath+QDir::separator()+file;
if( QFile::copy( oCFile, themeFile ) ) {
re.append(file);
qDebug() << "Migrator: Folder definition migrated: " << file;
// fix the connection entry of the folder definition
QSettings settings(themeFile, QSettings::IniFormat);
settings.beginGroup( escapedAlias );
settings.setValue(QLatin1String("connection"), Theme::instance()->appName());
settings.sync();
}
}
return re;
}
}

View File

@@ -0,0 +1,38 @@
/*
* 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 ACCOUNTMIGRATOR_H
#define ACCOUNTMIGRATOR_H
#include <QStringList>
namespace Mirall {
class AccountMigrator {
public:
explicit AccountMigrator();
/**
* @brief migrateFolderDefinitons - migrate the folder definition files
* @return the list of migrated folder definitions
*/
QStringList migrateFolderDefinitons();
signals:
public slots:
};
}
#endif // ACCOUNTMIGRATOR_H

View File

@@ -398,10 +398,9 @@ void AccountSettings::slotSelectiveSync()
FolderMan *folderMan = FolderMan::instance();
Folder *f = folderMan->folder(alias);
if (f) {
(new SelectiveSyncDialog(f, this))->open();
(new SelectiveSyncDialog(AccountManager::instance()->account(), f, this))->open();
}
}
}
void AccountSettings::slotDoubleClicked( const QModelIndex& indx )
@@ -643,12 +642,18 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
if (Progress::isSizeDependent(curItem._instruction)) {
QString s1 = Utility::octetsToString( curItemProgress );
QString s2 = Utility::octetsToString( curItem._size );
//: Example text: "uploading foobar.png (1MB of 2MB) time left 2 minutes at a rate of 24Kb/s"
fileProgressString = tr("%1 %2 (%3 of %4) %5 left at a rate of %6/s")
.arg(kindString, itemFileName, s1, s2,
Utility::timeToDescriptiveString(progress.getFileEstimate(curItem).getEtaEstimate(), 3, " ", true),
Utility::octetsToString(progress.getFileEstimate(curItem).getEstimatedBandwidth()) );
} else {
quint64 estimatedBw = progress.getFileEstimate(curItem).getEstimatedBandwidth();
if (estimatedBw) {
//: Example text: "uploading foobar.png (1MB of 2MB) time left 2 minutes at a rate of 24Kb/s"
fileProgressString = tr("%1 %2 (%3 of %4) %5 left at a rate of %6/s")
.arg(kindString, itemFileName, s1, s2,
Utility::timeToDescriptiveString(progress.getFileEstimate(curItem).getEtaEstimate(), 3, " ", true),
Utility::octetsToString(estimatedBw) );
} else {
//: Example text: "uploading foobar.png (2MB of 2MB)"
fileProgressString = tr("%1 %2 (%3 of %4)") .arg(kindString, itemFileName, s1, s2);
}
} else if (!kindString.isEmpty()) {
//: Example text: "uploading foobar.png"
fileProgressString = tr("%1 %2").arg(kindString, itemFileName);
}
@@ -657,12 +662,18 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
// overall progress
quint64 completedSize = progress.completedSize();
quint64 currentFile = progress._completedFileCount + progress._currentItems.count();
QString s1 = Utility::octetsToString( completedSize );
QString s2 = Utility::octetsToString( progress._totalSize );
QString overallSyncString = tr("%1 of %2, file %3 of %4\nTotal time left %5")
.arg(s1, s2)
.arg(currentFile).arg(progress._totalFileCount)
.arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate(), 3, " ", true) );
QString overallSyncString;
if (progress._totalSize > 0) {
QString s1 = Utility::octetsToString( completedSize );
QString s2 = Utility::octetsToString( progress._totalSize );
overallSyncString = tr("%1 of %2, file %3 of %4\nTotal time left %5")
.arg(s1, s2)
.arg(currentFile).arg(progress._totalFileCount)
.arg( Utility::timeToDescriptiveString(progress.totalEstimate().getEtaEstimate(), 3, " ", true) );
} else if (progress._totalFileCount > 0) {
// Don't attemt to estimate the time left if there is no kb to transfer.
overallSyncString = tr("file %1 of %2") .arg(currentFile).arg(progress._totalFileCount);
}
item->setData( overallSyncString, FolderStatusDelegate::SyncProgressOverallString );

View File

@@ -73,7 +73,7 @@
<item>
<widget class="QPushButton" name="_buttonSelectiveSync">
<property name="text">
<string>Selective Sync...</string>
<string>Choose What to Sync</string>
</property>
</widget>
</item>

View File

@@ -85,6 +85,7 @@ void ConnectionValidator::checkConnection()
checkJob->setIgnoreCredentialFailure(true);
connect(checkJob, SIGNAL(instanceFound(QUrl,QVariantMap)), SLOT(slotStatusFound(QUrl,QVariantMap)));
connect(checkJob, SIGNAL(networkError(QNetworkReply*)), SLOT(slotNoStatusFound(QNetworkReply*)));
connect(checkJob, SIGNAL(timeout(QUrl)), SLOT(slotStatusTimeout(QUrl)));
checkJob->start();
} else {
_errors << tr("No ownCloud account configured");
@@ -127,9 +128,19 @@ void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
_errors.append( reply->errorString() );
_networkError = (reply->error() != QNetworkReply::NoError);
emit connectionResult( StatusNotFound );
}
void ConnectionValidator::slotStatusTimeout(const QUrl &url)
{
_account->setState(Account::Disconnected);
_errors.append(tr("Unable to connect to %1").arg(url.toString()));
_errors.append(tr("timeout"));
_networkError = true;
emit connectionResult( StatusNotFound );
}
void ConnectionValidator::slotCheckAuthentication()
{
AbstractCredentials *creds = _account->credentials();

View File

@@ -60,6 +60,7 @@ public slots:
protected slots:
void slotStatusFound(const QUrl&url, const QVariantMap &info);
void slotNoStatusFound(QNetworkReply *reply);
void slotStatusTimeout(const QUrl& url);
void slotCheckAuthentication();
void slotAuthFailed(QNetworkReply *reply);

View File

@@ -45,7 +45,7 @@ bool DiscoveryJob::isInBlackList(const QString& path) const
return false;
}
int DiscoveryJob::isInWhiteListCallBack(void *data, const char *path)
int DiscoveryJob::isInBlackListCallBack(void *data, const char *path)
{
return static_cast<DiscoveryJob*>(data)->isInBlackList(QString::fromUtf8(path));
}
@@ -72,7 +72,7 @@ void DiscoveryJob::update_job_update_callback (bool local,
void DiscoveryJob::start() {
_selectiveSyncBlackList.sort();
_csync_ctx->checkBlackListHook = isInWhiteListCallBack;
_csync_ctx->checkBlackListHook = isInBlackListCallBack;
_csync_ctx->checkBlackListData = this;
_csync_ctx->callbacks.update_callback = update_job_update_callback;

View File

@@ -41,7 +41,7 @@ class DiscoveryJob : public QObject {
* false if the path should be ignored
*/
bool isInBlackList(const QString &path) const;
static int isInWhiteListCallBack(void *, const char *);
static int isInBlackListCallBack(void *, const char *);
static void update_job_update_callback (bool local,
const char *dirname,

View File

@@ -12,7 +12,10 @@
*/
#include "filesystem.h"
#include "utility.h"
#include <QFile>
#include <QFileInfo>
#include <QDebug>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
@@ -24,11 +27,16 @@
#include <winbase.h>
#endif
// We use some internals of csync:
extern "C" int c_utimes(const char *, const struct timeval *);
extern "C" void csync_win32_set_file_hidden( const char *file, bool h );
extern "C" {
#include "vio/csync_vio_handle.h"
#include "vio/csync_vio_file_stat.h"
#include "vio/csync_vio_local.h"
}
namespace Mirall {
bool FileSystem::fileEquals(const QString& fn1, const QString& fn2)
@@ -69,6 +77,25 @@ void FileSystem::setFileHidden(const QString& filename, bool hidden)
return csync_win32_set_file_hidden(filename.toUtf8().constData(), hidden);
}
time_t FileSystem::getModTime(const QString &filename)
{
csync_vio_file_stat_t* stat = csync_vio_file_stat_new();
qint64 result = -1;
if (csync_vio_local_stat(filename.toUtf8().data(), stat) != -1
&& (stat->fields & CSYNC_VIO_FILE_STAT_FIELDS_MTIME))
{
result = stat->mtime;
}
else
{
qDebug() << "Could not get modification time for" << filename
<< "with csync, using QFileInfo";
result = Utility::qDateTimeToTime_t(QFileInfo(filename).lastModified());
}
csync_vio_file_stat_destroy(stat);
return result;
}
void FileSystem::setModTime(const QString& filename, time_t modTime)
{
struct timeval times[2];

View File

@@ -32,6 +32,14 @@ bool fileEquals(const QString &fn1, const QString &fn2);
/** Mark the file as hidden (only has effects on windows) */
void OWNCLOUDSYNC_EXPORT setFileHidden(const QString& filename, bool hidden);
/** Get the mtime for a filepath.
*
* Use this over QFileInfo::lastModified() to avoid timezone related bugs. See
* owncloud/core#9781 for details.
*/
time_t OWNCLOUDSYNC_EXPORT getModTime(const QString &filename);
void setModTime(const QString &filename, time_t modTime);
/**

View File

@@ -27,6 +27,7 @@
#include "mirall/clientproxy.h"
#include "mirall/syncengine.h"
#include "mirall/syncrunfilelog.h"
#include "mirall/theme.h"
#include "creds/abstractcredentials.h"
@@ -220,11 +221,11 @@ bool Folder::syncPaused() const
return _paused;
}
void Folder::setSyncPaused( bool doit )
void Folder::setSyncPaused( bool paused )
{
_paused = doit;
_paused = paused;
if( doit ) {
if( !paused ) {
// qDebug() << "Syncing enabled on folder " << name();
} else {
// do not stop or start the watcher here, that is done internally by
@@ -255,13 +256,27 @@ void Folder::slotPollTimerTimeout()
{
qDebug() << "* Polling" << alias() << "for changes. (time since last sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";
Account *account = AccountManager::instance()->account();
if (!account) {
qDebug() << Q_FUNC_INFO << "No valid account object";
return;
}
if (_paused || account->state() != Account::Connected) {
qDebug() << "Not syncing. :" << _paused << account->state();
return;
}
if (quint64(_timeSinceLastSync.elapsed()) > MirallConfigFile().forceSyncInterval() ||
_lastEtag.isNull() ||
!(_syncResult.status() == SyncResult::Success ||_syncResult.status() == SyncResult::Problem)) {
qDebug() << "** Force Sync now, state is " << _syncResult.statusString();
emit scheduleToSync(alias());
} else {
// do the ordinary etag chech for the root folder.
RequestEtagJob* job = new RequestEtagJob(AccountManager::instance()->account(), remotePath(), this);
// do the ordinary etag check for the root folder.
RequestEtagJob* job = new RequestEtagJob(account, remotePath(), this);
// check if the etag is different
QObject::connect(job, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
QObject::connect(job, SIGNAL(networkError(QNetworkReply*)), this, SLOT(slotNetworkUnavailable()));
@@ -299,12 +314,13 @@ void Folder::bubbleUpSyncResult()
int updatedItems = 0;
int ignoredItems = 0;
int renamedItems = 0;
int errorItems = 0;
SyncFileItem firstItemNew;
SyncFileItem firstItemDeleted;
SyncFileItem firstItemUpdated;
SyncFileItem firstItemRenamed;
Logger *logger = Logger::instance();
SyncFileItem firstItemError;
SyncRunFileLog syncFileLog;
@@ -320,7 +336,10 @@ void Folder::bubbleUpSyncResult()
// and process the item to the gui
if( item._status == SyncFileItem::FatalError || item._status == SyncFileItem::NormalError ) {
slotSyncError( tr("%1: %2").arg(item._file, item._errorString) );
logger->postOptionalGuiLog(item._file, item._errorString);
errorItems++;
if (firstItemError.isEmpty()) {
firstItemError = item;
}
} else {
// add new directories or remove gone away dirs to the watcher
if (item._isDirectory && item._instruction == CSYNC_INSTRUCTION_NEW ) {
@@ -373,9 +392,9 @@ void Folder::bubbleUpSyncResult()
qDebug() << "Processing result list and logging took " << timer.elapsed() << " Milliseconds.";
_syncResult.setWarnCount(ignoredItems);
createGuiLog( firstItemNew._file, SyncFileStatus(SyncFileStatus::STATUS_NEW), newItems );
createGuiLog( firstItemDeleted._file, SyncFileStatus(SyncFileStatus::STATUS_REMOVE), removedItems );
createGuiLog( firstItemUpdated._file, SyncFileStatus(SyncFileStatus::STATUS_UPDATED), updatedItems );
createGuiLog( firstItemNew._file, SyncFileStatus::STATUS_NEW, newItems );
createGuiLog( firstItemDeleted._file, SyncFileStatus::STATUS_REMOVE, removedItems );
createGuiLog( firstItemUpdated._file, SyncFileStatus::STATUS_UPDATED, updatedItems );
if( !firstItemRenamed.isEmpty() ) {
SyncFileStatus status(SyncFileStatus::STATUS_RENAME);
@@ -388,6 +407,8 @@ void Folder::bubbleUpSyncResult()
createGuiLog( firstItemRenamed._file, status, renamedItems, firstItemRenamed._renameTarget );
}
createGuiLog( firstItemError._file, SyncFileStatus::STATUS_ERROR, errorItems );
qDebug() << "OO folder slotSyncFinished: result: " << int(_syncResult.status());
}
@@ -438,6 +459,13 @@ void Folder::createGuiLog( const QString& filename, SyncFileStatus status, int c
text = tr("%1 has been moved to %2.").arg(file).arg(renameTarget);
}
break;
case SyncFileStatus::STATUS_ERROR:
if( count > 1 ) {
text = tr("%1 and %2 other files could not be synced due to errors. See the log for details.", "%1 names a file.").arg(file).arg(count-1);
} else {
text = tr("%1 could not be synced due to an error. See the log for details.").arg(file);
}
break;
default:
break;
}
@@ -483,9 +511,7 @@ void Folder::slotTerminateSync()
// Do not display an error message, user knows his own actions.
// _errors.append( tr("The CSync thread terminated.") );
// _csyncError = true;
FolderMan::instance()->slotSetFolderPaused(alias(), true);
setSyncState(SyncResult::SyncAbortRequested);
return;
}
}
@@ -516,20 +542,27 @@ void Folder::wipe()
}
}
void Folder::setIgnoredFiles()
bool Folder::setIgnoredFiles()
{
bool ok = false;
MirallConfigFile cfgFile;
csync_clear_exclude_list( _csync_ctx );
QString excludeList = cfgFile.excludeFile( MirallConfigFile::SystemScope );
if( !excludeList.isEmpty() ) {
qDebug() << "==== added system ignore list to csync:" << excludeList.toUtf8();
csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() );
if (csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() ) == 0) {
ok = true;
}
}
excludeList = cfgFile.excludeFile( MirallConfigFile::UserScope );
if( !excludeList.isEmpty() ) {
qDebug() << "==== added user defined ignore list to csync:" << excludeList.toUtf8();
csync_add_exclude_list( _csync_ctx, excludeList.toUtf8() );
// reading the user exclude file is optional
}
return ok;
}
void Folder::setProxyDirty(bool value)
@@ -552,7 +585,7 @@ void Folder::startSync(const QStringList &pathList)
if (!_csync_ctx) {
qDebug() << Q_FUNC_INFO << "init failed.";
// the error should already be set
QMetaObject::invokeMethod(this, "slotCSyncFinished", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "slotSyncFinished", Qt::QueuedConnection);
return;
}
_clientProxy.setCSyncProxy(AccountManager::instance()->account()->url(), _csync_ctx);
@@ -573,9 +606,16 @@ void Folder::startSync(const QStringList &pathList)
_syncResult.setStatus( SyncResult::SyncPrepare );
emit syncStateChange();
qDebug() << "*** Start syncing - client version"
<< qPrintable(Theme::instance()->version());
if (! setIgnoredFiles())
{
slotSyncError(tr("Could not read system exclude file"));
QMetaObject::invokeMethod(this, "slotSyncFinished", Qt::QueuedConnection);
return;
}
qDebug() << "*** Start syncing";
setIgnoredFiles();
_engine.reset(new SyncEngine( _csync_ctx, path(), remoteUrl().path(), _remotePath, &_journal));
qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector");
@@ -595,6 +635,7 @@ void Folder::startSync(const QStringList &pathList)
connect(_engine.data(), SIGNAL(folderDiscovered(bool,QString)), this, SLOT(slotFolderDiscovered(bool,QString)));
connect(_engine.data(), SIGNAL(transmissionProgress(Progress::Info)), this, SLOT(slotTransmissionProgress(Progress::Info)));
connect(_engine.data(), SIGNAL(jobCompleted(SyncFileItem)), this, SLOT(slotJobCompleted(SyncFileItem)));
connect(_engine.data(), SIGNAL(syncItemDiscovered(SyncFileItem)), this, SLOT(slotSyncItemDiscovered(SyncFileItem)));
setDirtyNetworkLimits();
_engine->setSelectiveSyncBlackList(selectiveSyncBlackList());
@@ -652,10 +693,13 @@ void Folder::slotSyncFinished()
bubbleUpSyncResult();
_engine.reset(0);
bool anotherSyncNeeded = false;
if (_engine) {
anotherSyncNeeded = _engine->isAnotherSyncNeeded();
_engine.reset(0);
}
// _watcher->setEventsEnabledDelayed(2000);
_pollTimer.start();
_timeSinceLastSync.restart();
if (_csyncError) {
@@ -683,6 +727,16 @@ void Folder::slotSyncFinished()
// all come in.
QTimer::singleShot(200, this, SLOT(slotEmitFinishedDelayed() ));
if (!anotherSyncNeeded) {
_pollTimer.start();
_timeSinceLastSync.restart();
} else {
// Another sync is required. We will make sure that the poll timer occurs soon enough
// and we clear the etag to force a sync
_lastEtag.clear();
QTimer::singleShot(1000, this, SLOT(slotPollTimerTimeout() ));
}
}
void Folder::slotEmitFinishedDelayed()
@@ -720,6 +774,11 @@ void Folder::slotJobCompleted(const SyncFileItem &item)
emit ProgressDispatcher::instance()->jobCompleted(alias(), item);
}
void Folder::slotSyncItemDiscovered(const SyncFileItem & item)
{
emit ProgressDispatcher::instance()->syncItemDiscovered(alias(), item);
}
void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
{

View File

@@ -164,6 +164,7 @@ private slots:
void slotFolderDiscovered(bool local, QString folderName);
void slotTransmissionProgress(const Progress::Info& pi);
void slotJobCompleted(const SyncFileItem&);
void slotSyncItemDiscovered(const SyncFileItem & item);
void slotPollTimerTimeout();
void etagRetreived(const QString &);
@@ -176,7 +177,7 @@ private slots:
private:
bool init();
void setIgnoredFiles();
bool setIgnoredFiles();
void bubbleUpSyncResult();

View File

@@ -13,11 +13,14 @@
*/
#include "mirall/folderman.h"
#include "mirall/account.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/folder.h"
#include "mirall/syncresult.h"
#include "mirall/theme.h"
#include "mirall/socketapi.h"
#include "mirall/accountmigrator.h"
#include <neon/ne_socket.h>
@@ -36,6 +39,15 @@ namespace Mirall {
FolderMan* FolderMan::_instance = 0;
/**
* The minimum time between a sync being requested and it
* being executed in milliseconds.
*
* This delay must be larger than the minFileAgeForUpload in
* the propagator.
*/
static int msBetweenRequestAndSync = 2000;
FolderMan::FolderMan(QObject *parent) :
QObject(parent),
_syncEnabled( true )
@@ -181,6 +193,15 @@ int FolderMan::setupFolders()
dir.setFilter(QDir::Files | QDir::Hidden);
QStringList list = dir.entryList();
if( list.count() == 0 ) {
// maybe the account was just migrated.
Account *acc = AccountManager::instance()->account();
if ( acc && acc->wasMigrated() ) {
AccountMigrator accMig;
list = accMig.migrateFolderDefinitons();
}
}
foreach ( const QString& alias, list ) {
Folder *f = setupFolderFromConfigFile( alias );
if( f ) {
@@ -214,14 +235,6 @@ bool FolderMan::ensureJournalGone(const QString &localPath)
return true;
}
void FolderMan::terminateCurrentSync()
{
if( !_currentSyncFolder.isEmpty() ) {
qDebug() << "Terminating syncing on folder " << _currentSyncFolder;
terminateSyncProcess( _currentSyncFolder );
}
}
#define SLASH_TAG QLatin1String("__SLASH__")
#define BSLASH_TAG QLatin1String("__BSLASH__")
#define QMARK_TAG QLatin1String("__QMARK__")
@@ -424,31 +437,35 @@ void FolderMan::slotScheduleAllFolders()
*/
void FolderMan::slotScheduleSync( const QString& alias )
{
if( alias.isEmpty() ) return;
if( _currentSyncFolder == alias ) {
qDebug() << "folder " << alias << " is currently syncing. NOT scheduling.";
if( alias.isEmpty() || ! _folderMap.contains(alias) ) {
qDebug() << "Not scheduling sync for empty or unknown folder" << alias;
return;
}
qDebug() << "Schedule folder " << alias << " to sync!";
if( ! _scheduleQueue.contains(alias ) && _folderMap.contains(alias) ) {
if( ! _scheduleQueue.contains(alias) ) {
Folder *f = _folderMap[alias];
if( f ) {
if( !f->syncPaused() ) {
f->prepareToSync();
} else {
qDebug() << "Folder is not enabled, not scheduled!";
if ( !f )
return;
if( !f->syncPaused() ) {
f->prepareToSync();
} else {
qDebug() << "Folder is not enabled, not scheduled!";
if( _socketApi ) {
_socketApi->slotUpdateFolderView(f->alias());
return;
}
return;
}
_scheduleQueue.enqueue(alias);
} else {
qDebug() << " II> Sync for folder " << alias << " already scheduled, do not enqueue!";
}
// wait a moment until the syncing starts
QTimer::singleShot(500, this, SLOT(slotScheduleFolderSync()));
// Look at the scheduleQueue in a bit to see if the sync is ready to start.
// The delay here is essential as the sync will not upload files that were
// changed too recently.
QTimer::singleShot(msBetweenRequestAndSync, this, SLOT(slotStartScheduledFolderSync()));
}
// only enable or disable foldermans will to schedule and do syncs.
@@ -457,7 +474,7 @@ void FolderMan::setSyncEnabled( bool enabled )
{
if (!_syncEnabled && enabled && !_scheduleQueue.isEmpty()) {
// We have things in our queue that were waiting the the connection to go back on.
QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync()));
QTimer::singleShot(200, this, SLOT(slotStartScheduledFolderSync()));
}
_syncEnabled = enabled;
// force a redraw in case the network connect status changed
@@ -469,7 +486,7 @@ void FolderMan::setSyncEnabled( bool enabled )
* It is either called from the slot where folders enqueue themselves for
* syncing or after a folder sync was finished.
*/
void FolderMan::slotScheduleFolderSync()
void FolderMan::slotStartScheduledFolderSync()
{
if( !_currentSyncFolder.isEmpty() ) {
qDebug() << "Currently folder " << _currentSyncFolder << " is running, wait for finish!";
@@ -481,18 +498,25 @@ void FolderMan::slotScheduleFolderSync()
return;
}
// Try to start the top scheduled sync.
qDebug() << "XX slotScheduleFolderSync: folderQueue size: " << _scheduleQueue.count();
if( ! _scheduleQueue.isEmpty() ) {
if( !_scheduleQueue.isEmpty() ) {
const QString alias = _scheduleQueue.dequeue();
if( _folderMap.contains( alias ) ) {
Folder *f = _folderMap[alias];
if( f && !f->syncPaused() ) {
_currentSyncFolder = alias;
if( !_folderMap.contains( alias ) ) {
qDebug() << "FolderMan: Not syncing queued folder" << alias << ": not in folder map anymore";
return;
}
f->startSync( QStringList() );
// Start syncing this folder!
Folder *f = _folderMap[alias];
if( f && !f->syncPaused() ) {
_currentSyncFolder = alias;
// reread the excludes of the socket api
// FIXME: the excludes need rework.
f->startSync( QStringList() );
// reread the excludes of the socket api
// FIXME: the excludes need rework.
if( _socketApi ) {
_socketApi->slotClearExcludesList();
_socketApi->slotReadExcludes();
}
@@ -515,7 +539,7 @@ void FolderMan::slotFolderSyncFinished( const SyncResult& )
_currentSyncFolder.clear();
QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync()));
QTimer::singleShot(200, this, SLOT(slotStartScheduledFolderSync()));
}
void FolderMan::addFolderDefinition(const QString& alias, const QString& sourceFolder,
@@ -609,8 +633,11 @@ void FolderMan::removeFolder( const QString& alias )
}
}
QString FolderMan::getBackupName( const QString& fullPathName ) const
QString FolderMan::getBackupName( QString fullPathName ) const
{
if (fullPathName.endsWith("/"))
fullPathName.chop(1);
if( fullPathName.isEmpty() ) return QString::null;
QString newName = fullPathName + QLatin1String(".oC_bak");
@@ -628,27 +655,41 @@ QString FolderMan::getBackupName( const QString& fullPathName ) const
bool FolderMan::startFromScratch( const QString& localFolder )
{
if( localFolder.isEmpty() ) return false;
if( localFolder.isEmpty() ) {
return false;
}
QFileInfo fi( localFolder );
if( fi.exists() && fi.isDir() ) {
QDir file = fi.dir();
QDir parentDir( fi.dir() );
QString folderName = fi.fileName();
// check if there are files in the directory.
if( file.count() == 0 ) {
// directory is existing, but its empty. Use it.
// Adjust for case where localFolder ends with a /
if ( fi.isDir() ) {
folderName = parentDir.dirName();
parentDir.cdUp();
}
if( fi.exists() ) {
// It exists, but is empty -> just reuse it.
if( fi.isDir() && fi.dir().count() == 0 ) {
qDebug() << "startFromScratch: Directory is empty!";
return true;
}
QString newName = getBackupName( fi.absoluteFilePath() );
if( file.rename( fi.absoluteFilePath(), newName )) {
if( file.mkdir( fi.absoluteFilePath() ) ) {
return true;
}
// Make a backup of the folder/file.
QString newName = getBackupName( parentDir.absoluteFilePath( folderName ) );
if( !parentDir.rename( fi.absoluteFilePath(), newName ) ) {
qDebug() << "startFromScratch: Could not rename" << fi.absoluteFilePath()
<< "to" << newName;
return false;
}
}
return false;
if( !parentDir.mkdir( fi.absoluteFilePath() ) ) {
qDebug() << "startFromScratch: Could not mkdir" << fi.absoluteFilePath();
return false;
}
return true;
}
void FolderMan::setDirtyProxy(bool value)

View File

@@ -107,6 +107,11 @@ public slots:
void slotFolderSyncStarted();
void slotFolderSyncFinished( const SyncResult& );
/**
* Terminates the specified folder sync (or the current one).
*
* It does not switch the folder to paused state.
*/
void terminateSyncProcess( const QString& alias = QString::null );
/* unload and delete on folder object */
@@ -129,13 +134,12 @@ public slots:
private slots:
// slot to take the next folder from queue and start syncing.
void slotScheduleFolderSync();
void slotStartScheduledFolderSync();
private:
// finds all folder configuration files
// and create the folders
void terminateCurrentSync();
QString getBackupName( const QString& ) const;
QString getBackupName( QString fullPathName ) const;
void registerFolderMonitor( Folder *folder );
QString unescapeAlias( const QString& ) const;
@@ -149,10 +153,12 @@ private:
QSignalMapper *_folderWatcherSignalMapper;
QString _currentSyncFolder;
bool _syncEnabled;
QQueue<QString> _scheduleQueue;
QMap<QString, FolderWatcher*> _folderWatchers;
QPointer<SocketApi> _socketApi;
/** The aliases of folders that shall be synced. */
QQueue<QString> _scheduleQueue;
static FolderMan *_instance;
explicit FolderMan(QObject *parent = 0);
~FolderMan();

View File

@@ -429,8 +429,8 @@ void FolderWizardRemotePath::showWarn( const QString& msg ) const
FolderWizardSelectiveSync::FolderWizardSelectiveSync()
{
QVBoxLayout *layout = new QVBoxLayout(this);
_treeView = new SelectiveSyncTreeView(this);
layout->addWidget(new QLabel(tr("Selective Sync: You can optionally deselect subfolders you do not wish to synchronize.")));
_treeView = new SelectiveSyncTreeView(AccountManager::instance()->account(), this);
layout->addWidget(new QLabel(tr("Choose What to Sync: You can optionally deselect subfolders you do not wish to synchronize.")));
layout->addWidget(_treeView);
}

View File

@@ -233,6 +233,14 @@ QString MirallConfigFile::excludeFile(Scope scope) const
#endif
#ifdef Q_OS_UNIX
fi.setFile( QString( SYSCONFDIR "/%1").arg(Theme::instance()->appName()), exclFile );
if ( ! fi.exists() ) {
// Prefer to return the preferred path! Only use the fallback location
// if the other path does not exist and the fallback is valid.
QFileInfo nextToBinary( QCoreApplication::applicationDirPath(), exclFile );
if (nextToBinary.exists()) {
fi = nextToBinary;
}
}
#endif
#ifdef Q_OS_MAC
// exec path is inside the bundle

View File

@@ -50,6 +50,15 @@ AbstractNetworkJob::AbstractNetworkJob(Account *account, const QString &path, QO
_timer.setSingleShot(true);
_timer.setInterval(10*1000); // default to 10 seconds.
connect(&_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
connect(this, SIGNAL(networkActivity()), SLOT(resetTimeout()));
// Network activity on the propagator jobs (GET/PUT) keeps all requests alive.
// This is a workaround for OC instances which only support one
// parallel up and download
if (_account) {
connect(_account, SIGNAL(propagatorNetworkActivity()), SLOT(resetTimeout()));
}
}
void AbstractNetworkJob::setReply(QNetworkReply *reply)
@@ -80,11 +89,6 @@ void AbstractNetworkJob::setIgnoreCredentialFailure(bool ignore)
_ignoreCredentialFailure = ignore;
}
void AbstractNetworkJob::setAccount(Account *account)
{
_account = account;
}
void AbstractNetworkJob::setPath(const QString &path)
{
_path = path;
@@ -93,6 +97,8 @@ void AbstractNetworkJob::setPath(const QString &path)
void AbstractNetworkJob::setupConnections(QNetworkReply *reply)
{
connect(reply, SIGNAL(finished()), SLOT(slotFinished()));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), SIGNAL(networkActivity()));
connect(reply, SIGNAL(uploadProgress(qint64,qint64)), SIGNAL(networkActivity()));
}
QNetworkReply* AbstractNetworkJob::addTimer(QNetworkReply *reply)
@@ -179,9 +185,11 @@ QString AbstractNetworkJob::responseTimestamp()
return _responseTimestamp;
}
AbstractNetworkJob::~AbstractNetworkJob() {
if (_reply)
AbstractNetworkJob::~AbstractNetworkJob()
{
if (_reply) {
_reply->deleteLater();
}
}
void AbstractNetworkJob::start()
@@ -193,6 +201,16 @@ void AbstractNetworkJob::start()
qDebug() << "!!!" << metaObject()->className() << "created for" << account()->url() << "querying" << path();
}
void AbstractNetworkJob::slotTimeout()
{
qDebug() << this << "Timeout";
if (reply()) {
reply()->abort();
} else {
qDebug() << "reply was NULL";
}
}
/*********************************************************************************************/
RequestEtagJob::RequestEtagJob(Account *account, const QString &path, QObject *parent)
@@ -359,6 +377,7 @@ void CheckServerJob::slotTimeout()
qDebug() << "TIMEOUT" << Q_FUNC_INFO;
if (reply()->isRunning())
emit timeout(reply()->url());
deleteLater();
}
QString CheckServerJob::version(const QVariantMap &info)

View File

@@ -55,15 +55,14 @@ public:
virtual void start();
void setAccount(Account *account);
Account* account() const { return _account; }
void setPath(const QString &path);
QString path() const { return _path; }
void setReply(QNetworkReply *reply);
QNetworkReply* reply() const { return _reply; }
void setIgnoreCredentialFailure(bool ignore);
bool ignoreCredentialFailure() const { return _ignoreCredentialFailure; }
@@ -75,6 +74,7 @@ public slots:
void resetTimeout();
signals:
void networkError(QNetworkReply *reply);
void networkActivity();
protected:
void setupConnections(QNetworkReply *reply);
QNetworkReply* davRequest(const QByteArray& verb, const QString &relPath,
@@ -96,7 +96,7 @@ protected:
private slots:
void slotFinished();
virtual void slotTimeout() {}
virtual void slotTimeout();
private:
QNetworkReply* addTimer(QNetworkReply *reply);

View File

@@ -35,6 +35,10 @@
#include <QMessageBox>
#include <QSignalMapper>
#if defined(Q_OS_X11)
#include <QX11Info>
#endif
namespace Mirall {
ownCloudGui::ownCloudGui(Application *parent) :
@@ -102,7 +106,7 @@ void ownCloudGui::setupOverlayIcons()
if( Utility::isMac() && QFile::exists("/Library/ScriptingAdditions/OwnCloudFinder.osax") ) {
QString aScript = QString::fromUtf8("tell application \"Finder\"\n"
" try\n"
" «event NVTYload»\n"
" «event OWNCload»\n"
" end try\n"
"end tell\n");
@@ -599,6 +603,28 @@ void ownCloudGui::raiseDialog( QWidget *raiseWidget )
#if defined(Q_OS_MAC)
// viel hilft viel ;-)
MacWindow::bringToFront(raiseWidget);
#endif
#if defined(Q_OS_X11)
WId wid = widget->winId();
NETWM::init();
XEvent e;
e.xclient.type = ClientMessage;
e.xclient.message_type = NETWM::NET_ACTIVE_WINDOW;
e.xclient.display = QX11Info::display();
e.xclient.window = wid;
e.xclient.format = 32;
e.xclient.data.l[0] = 2;
e.xclient.data.l[1] = QX11Info::appTime();
e.xclient.data.l[2] = 0;
e.xclient.data.l[3] = 0l;
e.xclient.data.l[4] = 0l;
Display *display = QX11Info::display();
XSendEvent(display,
RootWindow(display, DefaultScreen(display)),
False, // propagate
SubstructureRedirectMask|SubstructureNotifyMask,
&e);
#endif
}
}

View File

@@ -51,7 +51,9 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
_item._errorString += tr("; Restoration Failed: ") + errorString;
}
} else {
_item._errorString = errorString;
if( _item._errorString.isEmpty() ) {
_item._errorString = errorString;
}
}
if( _propagator->_abortRequested.fetchAndAddRelaxed(0) ) {
@@ -84,13 +86,14 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
// do not blacklist in case of soft error or fatal error.
break;
case SyncFileItem::NormalError:
if (_item._httpErrorCode == 0 // Do not blacklist local errors. (#1985)
#ifdef OWNCLOUD_5XX_NO_BLACKLIST
if (_item._httpErrorCode / 100 == 5) {
// In this configuration, never blacklist error 5xx
qDebug() << "Do not blacklist error " << _item._httpErrorCode;
|| _item._httpErrorCode / 100 == 5 // In this configuration, never blacklist error 5xx
#endif
) {
qDebug() << "This error is not blacklisted " << _item._httpErrorCode;
break;
}
#endif
_propagator->_journal->updateBlacklistEntry( record );
break;
case SyncFileItem::Success:
@@ -150,6 +153,7 @@ bool PropagateItemJob::checkForProblemsWithShared(int httpStatusCode, const QStr
// Also remove the inodes and fileid from the db so no further renames are tried for
// this item.
_propagator->_journal->avoidRenamesOnNextSync(_item._file);
_propagator->_anotherSyncNeeded = true;
}
if( newJob ) {
newJob->setRestoreJobMsg(msg);
@@ -399,6 +403,11 @@ bool OwncloudPropagator::localFileNameClash( const QString& relFile )
return re;
}
QString OwncloudPropagator::getFilePath(const QString& tmp_file_name) const
{
return _localDir + tmp_file_name;
}
// ================================================================================
void PropagateDirectory::start()

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