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

Compare commits

..

486 Commits

Author SHA1 Message Date
Kevin Ottens
7f4ffd0f72 Merge pull request #2696 from nextcloud/v.3.1.0
Bump master version to 3.1.0
2020-12-10 12:16:47 +01:00
allexzander
e6b06d0a6b Bump master version to 3.1.0
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-12-10 12:47:51 +02:00
Nextcloud bot
e160788204 [tx-robot] updated from transifex 2020-12-10 03:53:56 +00:00
Nextcloud bot
f5d4ac518f [tx-robot] updated from transifex 2020-12-09 03:44:40 +00:00
allexzander
31d3ce7663 Merge pull request #2685 from nextcloud/fix-slow-sharee-search-in-dialog
Fixed slow sharee search in the share dialog
2020-12-08 15:56:29 +02:00
allexzander
9266ecc2e8 Fixed slow sharee search in the share dialog
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-12-08 13:48:43 +00:00
allexzander
14105d4ec6 Merge pull request #2686 from nextcloud/add-email-sharing
Added sharing via email.
2020-12-08 15:24:08 +02:00
allexzander
6e8658dc2c Added sharing via email.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-12-08 11:08:45 +02:00
Nextcloud bot
1d7b7c26d3 [tx-robot] updated from transifex 2020-12-08 03:48:38 +00:00
Kevin Ottens
b2dfa29325 Merge pull request #2690 from nextcloud/update-documentation
Update documentation on how to generate debug logs.
2020-12-07 16:22:37 +01:00
Camila
09c2279bb5 Update documentation on how to generate debug logs.
Minor change: bypasses => bypass.

Signed-off-by: Camila <hello@camila.codes>
2020-12-07 14:52:51 +01:00
Nextcloud bot
4886525e08 [tx-robot] updated from transifex 2020-12-07 03:48:13 +00:00
Nextcloud bot
f2fd083898 [tx-robot] updated from transifex 2020-12-06 03:43:57 +00:00
Nextcloud bot
8a2eb71c4f [tx-robot] updated from transifex 2020-12-04 03:45:51 +00:00
Kevin Ottens
8e29935195 Merge pull request #2682 from nextcloud/debug-skip
Add debug log to check which folders are being skipped during syncing.
2020-12-03 12:37:38 +01:00
Camila
5517ff2c02 Add debug log to check which folders are being skipped during syncing.
Signed-off-by: Camila <hello@camila.codes>
2020-12-03 12:24:25 +01:00
Nextcloud bot
bd959018a1 [tx-robot] updated from transifex 2020-12-03 03:45:56 +00:00
Camila
a527e85fe6 Merge pull request #2666 from nextcloud/notification_actions_bring_back_from_version_2
Notification action buttons and context menu
2020-12-02 15:42:32 +01:00
allexzander
f04281cb69 Implemented notification action buttons and context menu for confirm/dismiss and other actions.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-12-02 08:08:37 +00:00
Kevin Ottens
7721832ee0 Merge pull request #2677 from briankendall/fix-tray-window-spaces-bug
Fix macOS bug where tray window causes spaces to switch
2020-12-02 08:23:19 +01:00
Brian Kendall
f9991e180c Fix macOS bug where tray window causes spaces to switch
Signed-off-by: Brian Kendall <brian@briankendall.net>
2020-12-02 06:54:16 +00:00
Nextcloud bot
bc38c0ba3f [tx-robot] updated from transifex 2020-12-02 03:46:16 +00:00
Nextcloud bot
9ff8d97647 [tx-robot] updated from transifex 2020-12-01 03:45:58 +00:00
István Váradi
62bf777cda Merge pull request #2652 from ivaradi/debian-version-discrepancy
Handle the case when the release version differs from that in VERSION.cmake
2020-11-30 16:46:20 +01:00
István Váradi
3d9d5f2fe7 Handle the case when the release version differs from that in VERSION.cmake
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-11-30 15:33:34 +01:00
allexzander
57e1f2ac07 Merge pull request #2675 from nextcloud/fix-appimage-build
fix AppImage build
2020-11-30 14:20:30 +02:00
allexzander
0fdb423fe0 fix AppImage build by using v0.10.0 for qtkeychain
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-11-30 13:41:12 +02:00
Nextcloud bot
7bfd8ea23c [tx-robot] updated from transifex 2020-11-30 03:43:17 +00:00
Nextcloud bot
57a4cd926d [tx-robot] updated from transifex 2020-11-29 03:42:10 +00:00
Nextcloud bot
de4edb6099 [tx-robot] updated from transifex 2020-11-28 03:39:34 +00:00
Nextcloud bot
70dbbbeaa4 [tx-robot] updated from transifex 2020-11-27 03:40:43 +00:00
Camila
9614d051a5 Merge pull request #2667 from nextcloud/version-bump
Master is now 3.0.82.
2020-11-26 13:08:20 +01:00
Camila
8d1fe8ed3c Master is now 3.0.82.
Signed-off-by: Camila <hello@camila.codes>
2020-11-26 12:52:55 +01:00
Camila
4d133ba9a5 Merge pull request #2540 from nextcloud/fix-issue-1458
Add last / to exclude list file path.
2020-11-26 12:51:53 +01:00
Camila
bdd3465e7b Check if there are patterns associated with a sync exclude file.
The previous check didn't take into the account that .sync-exclude.lst
might be empty which would crash at Q_ASSERT(_allExcludes.contains(basePath))
in the prepare function. It also takes into account that
_allExcludes[basePath] was creating new items in the list.

Signed-off-by: Camila <hello@camila.codes>
2020-11-26 12:12:04 +01:00
Camila
998e93ac13 Add last / to exclude list file path.
This Q_ASSERT(this->endsWith('/')) in BasePathByteArray was the reason
for bug report #1458.

Signed-off-by: Camila <hello@camila.codes>
2020-11-26 12:11:57 +01:00
Nextcloud bot
820ab12561 [tx-robot] updated from transifex 2020-11-26 03:45:21 +00:00
Kevin Ottens
c38189e981 Merge pull request #2665 from nextcloud/sparkle_build_fixes
Sparkle build fixes
2020-11-25 18:00:34 +01:00
Dominik Schmidt
a50c665051 Simplify Sparkle handling in CMake 2020-11-25 09:43:59 +01:00
Chih-Hsuan Yen
6962cbf582 Fix build without Sparkle.framework
(PR #6567)
2020-11-25 09:40:20 +01:00
Christian Kamm
60d3696ccd Settings: Add warning when switching update channel 2020-11-25 09:39:16 +01:00
Nextcloud bot
c4987aa641 [tx-robot] updated from transifex 2020-11-25 03:42:43 +00:00
Camila
104d3c0661 Merge pull request #2647 from nextcloud/cherry_pick_updater_fixes_and_improvements
Cherry pick updater fixes and improvements
2020-11-24 20:58:26 +01:00
Kevin Ottens
4906353f2e Please the clang-tidy overlord
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-24 18:22:33 +00:00
Hannah von Reth
038644f378 Don't scare users with critical parser log messages 2020-11-24 18:22:33 +00:00
Hannah von Reth
d30cd0f0fd Include architecture in updater query
Fixes: #8074
2020-11-24 18:22:33 +00:00
Hannah von Reth
c76095859a Cleanup stirngs 2020-11-24 18:22:33 +00:00
Olivier Goffart
a7f010c370 Updater: Fix crash when there is an XML error
The problem was accessing the lines with an off by one error, while printing
the log.

Other problem included the fact that QDebug added spaces, quotes, and other
things which made the error lot look right in the console.

Issue #7545
2020-11-24 18:22:33 +00:00
Olivier Goffart
1bf895cadc Updater: Fix Version numer not shown in the user visible string
There was one argument too many in the string.
Bug was introduced in commit 21ac396b

Issue: #7288
2020-11-24 18:22:33 +00:00
Christian Kamm
c58f00abc7 Updater: Improved logging output #7388 2020-11-24 18:22:33 +00:00
Hannah von Reth
1df3f5b6df NSISUpdater: Improve logging for version comparison 2020-11-24 18:22:33 +00:00
Hannah von Reth
1aca005267 Updater: Log parsing issues in autoupdatLog parsing issues in autoupdatee 2020-11-24 18:22:33 +00:00
Markus Goetz
9a375211d7 Autoupdater: Log the URL #3475 2020-11-24 18:22:33 +00:00
Christian Kamm
d2991210c5 Updater: Preserve target version string
For #7217
2020-11-24 18:22:33 +00:00
Christian Kamm
aa7409f401 Updater: Make "Update manually" not also "skip this version"
See #7217
2020-11-24 18:22:33 +00:00
Christian Kamm
0b3512f49c WinUpdater: More useful options on update failure #7217
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-24 18:22:33 +00:00
Olivier Goffart
9596eb7f20 Updater: show the human readable version in the settings
The xml looks like this:

   <version>2.5.0.328</version>
   <versionstring>ownCloud Client 2.5.0 alpha1 (build 238)</versionstring>

And we should show the version string

Issue #6602
2020-11-24 18:22:33 +00:00
Olivier Goffart
f2c3ef741b Updater: remove unused function 2020-11-24 18:22:33 +00:00
Dominik Schmidt
ae38b88d1c Remove unused installers before copying new ones into the appdata dir 2020-11-24 18:22:33 +00:00
Olivier Goffart
e93972824d MSI: Fix crash in the auto updater
'auto' here is a QStringBuilder referencing a temporary

Ammend commit 150d4f5935
(MSI: Always with logfile #6609)

Found in the crash reporter:
https://sentry.io/owncloud/desktop-win-and-mac/issues/623245771/
2020-11-24 18:22:33 +00:00
Markus Goetz
5e518419de MSI: Always with logfile #6609 2020-11-24 18:22:33 +00:00
Dominik Schmidt
d069fda9ab Extract filename of updateFile without leading slash 2020-11-24 18:22:33 +00:00
Dominik Schmidt
dfac8c0e59 Escape msi and owncloud.exe path (who knows...) 2020-11-24 18:22:33 +00:00
Dominik Schmidt
ed0dc68db2 Run msi properly and restart client after update 2020-11-24 18:22:33 +00:00
Dominik Schmidt
08b5981fb6 Implement basic .msi support in updater 2020-11-24 18:22:33 +00:00
Markus Goetz
412e43b696 Updater: Comments 2020-11-24 18:22:33 +00:00
Christian Kamm
4b39731c27 Updater: Make sparkle updater respect release channel 2020-11-24 18:22:33 +00:00
Markus Goetz
311e3a3bd8 Auto Updater: Show UI element also on macOS
(cherry picked from commit dfdc2e1e87f99d387a042f4983c999fbb7fcf3d9)
2020-11-24 18:22:33 +00:00
Christian Kamm
a8ad946758 Settings: Add update channel combobox #6259 2020-11-24 18:22:33 +00:00
Markus Goetz
65035d1990 Sparkle: Delegate calls work now with 1.18.1 (maybe even before)
We can extend on this to give UI feedback.
2020-11-24 18:22:33 +00:00
Camila
c24b81c081 Merge pull request #2660 from nextcloud/folder-watcher
FolderWatcher: fixes and improvements
2020-11-24 19:19:08 +01:00
Christian Kamm
08014b6dc3 FolderWatcher: Disable test on OSX #7305 2020-11-24 16:56:49 +00:00
Olivier Goffart
5a432a193f FolderWatcher: Usage of QTime for elapsed time is deprecated 2020-11-24 16:56:49 +00:00
Christian Kamm
28e4fc54a1 FolderWatcher: Wait for ready before testing #7305 2020-11-24 16:56:49 +00:00
Christian Kamm
e97fc430bf FolderWatcher: Become unreliable if test notification fails #7241
Necessary for some filesystems on windows that don't have full file
watching capabilities.
2020-11-24 16:56:49 +00:00
Christian Kamm
74382ddcc0 FolderWatcher linux: Make automatically recursive #7068
Previously it depended on addFolder() / removeFolder() calls to adjust
watchers when new folders were added or removed. There also needed to be
complex move handling.

Now, any folder creation/move-in notifications automatically trigger
watcher additions and folder deletion/move-out triggers removal.
2020-11-24 16:56:49 +00:00
Christian Kamm
21b931dc6b FolderWatcher: Always notify about conflict files #7073
This makes sure that the conflict list can be updated if a user resolves
a conflict by deleting the local conflict file. Previously one had to
wait for the next sync run.
2020-11-24 16:56:49 +00:00
Christian Kamm
351bada552 Folderwatcher: On linux, fix paths after dir renames #6808
If a folder was renamed A -> B, the folder watcher for the inode
would be unaware and still report changes for A/foo. Now directory
renames in the watched folders are tracked and paths are updated
accordingly.
2020-11-24 16:56:49 +00:00
allexzander
fe29290564 Merge pull request #2663 from nextcloud/fix-windows-compilation
Fix Windows compilation broken after QML debugging fix.
2020-11-24 18:34:04 +02:00
allexzander
29ca1404cc Fix Windows compilation broken after QML debugging fix.
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-11-24 16:50:16 +02:00
allexzander
d4c14f8f4f Merge pull request #2662 from nextcloud/fix-qml-debugging
Fix QML debugging by removing incorrect dependency
2020-11-24 16:24:17 +02:00
allexzander
92733e9069 Fix QML debugging by removing incorrect dependency
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-11-24 15:19:17 +02:00
Nextcloud bot
2aa3d17e5c [tx-robot] updated from transifex 2020-11-24 03:41:57 +00:00
Kevin Ottens
7cf3f14f78 Merge pull request #2658 from nextcloud/enable_qml_debugger_on_debug_builds
Enable the QML debugger on debug builds
2020-11-23 18:59:52 +01:00
Kevin Ottens
922b322337 Enable the QML debugger on debug builds
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-23 17:39:50 +00:00
allexzander
f530758f78 Merge pull request #2655 from nextcloud/use-dinamyc-path-for-account-state-icons
Use dynamic path for account online/offline state icon. Refresh GUI on connection state change.
2020-11-23 18:01:13 +02:00
allexzander
665a8c4217 Use dynamic path for account online/offline state icon. Refresh GUI on connection state change.
Signed-off-by: Alex Zolotov <alex.zolotov.nextcloud.com>
Signed-off-by: allexzander <blackslayer4@gmail.com>
2020-11-23 17:49:25 +02:00
Nextcloud bot
10cb0a71eb [tx-robot] updated from transifex 2020-11-23 03:38:35 +00:00
Nextcloud bot
e6ea3878a9 [tx-robot] updated from transifex 2020-11-21 03:44:21 +00:00
Nextcloud bot
8faa103ebf [tx-robot] updated from transifex 2020-11-20 03:43:18 +00:00
Nextcloud bot
d0004230b9 [tx-robot] updated from transifex 2020-11-19 03:43:51 +00:00
Kevin Ottens
44f2bc24ff Merge pull request #2648 from nextcloud/debian_packages_should_not_block_ci
Issue a warning for Debian pipeline failures but don't fail the CI
2020-11-18 16:32:29 +01:00
Kevin Ottens
6f25840ec9 Issue a warning for Debian pipeline failures but don't fail the CI
Since this fails every time we bump the version number and takes time to
catch up while failing every following PRs, let's prevent this pipeline
from failing the CI.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-18 16:05:19 +01:00
Nextcloud bot
1950efcfff [tx-robot] updated from transifex 2020-11-18 03:41:49 +00:00
Nextcloud bot
d026aa9301 [tx-robot] updated from transifex 2020-11-16 03:43:48 +00:00
Nextcloud bot
0d7865e6f8 [tx-robot] updated from transifex 2020-11-15 03:41:36 +00:00
Nextcloud bot
fa1f20ca8e [tx-robot] updated from transifex 2020-11-14 03:44:00 +00:00
Nextcloud bot
771bac2279 [tx-robot] updated from transifex 2020-11-13 03:43:12 +00:00
Kevin Ottens
ebcdb41fb9 Merge pull request #2630 from nextcloud/bump_to_version_3.0.81
Master is now 3.0.81
2020-11-12 16:31:01 +01:00
Kevin Ottens
d2e0959b47 Master is now 3.0.81
This feels a bit like moving back in that case, but that's due to the
change of convention in the release process. We used to bump early but
now we're moving to a point when we bump at the last minute.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-12 15:53:16 +01:00
Nextcloud bot
2316cb6ce4 [tx-robot] updated from transifex 2020-11-12 03:44:40 +00:00
Nextcloud bot
f66b091e12 [tx-robot] updated from transifex 2020-11-11 03:47:29 +00:00
Camila
00a47fefaf Merge pull request #2616 from nextcloud/move_journaldb_files_back_to_sync_folders
Move journaldb files back to sync folders
2020-11-10 19:19:14 +01:00
Kevin Ottens
4f7876f520 Migrate journal dbs files back to the sync folder
In case of past collisions during the 3.0 times... well one will resync
from scratch unfortunately. But if that happened there are likely other
problems which occurred.

Also this might fix some of the bugs with people loosing settings from
the database. Indeed the -wal and -shm concatenations were wrong. Using
append was in fact changing the folderDefinition member which (I guess)
would potentially lead to funny ".db-wal-shm-wal-shm" names.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 17:46:43 +00:00
Kevin Ottens
0b731eb516 Revert "moved default db sync file to Qt standard path AppDataLocation"
This reverts commit fc6b895f52.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 17:46:43 +00:00
Kevin Ottens
1b553b93b9 Partial Revert "Adapted for cmd version and added migration step for config file"
This partially reverts commit 67ed54671b.

The migration code was left untouched.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 17:46:43 +00:00
Kevin Ottens
cebd39aa85 Revert "Adjust to makeDbName returning an absolute path"
This reverts commit 2492e241ac.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 17:46:43 +00:00
Camila
2e97a7fb74 Merge pull request #2531 from nextcloud/bring_back_systray_menu_pause_sync_action
Bring back the "Pause sync" action in the systray context menu
2020-11-10 18:43:52 +01:00
Kevin Ottens
6c463442ef Bring back the pause/resume action in the systray menu
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 17:29:51 +00:00
Kevin Ottens
1288ee0437 Move pause/unpause helpers to Systray
We had signals just to call those backs in ownCloudGui, they were
otherwise unused. So let's move them inside of Systray since it's
specific to it anyway.

Also fix the dangerous call to sender(). We can call this function
without going through a signal/slot connection and also it's never
connected to an AccountState.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 17:29:51 +00:00
Camila
3ffc699058 Merge pull request #2620 from nextcloud/fix_crash_when_displaying_share_dialog
Make sure the settings dialog exist before hiding it
2020-11-10 18:09:54 +01:00
Kevin Ottens
95487d8bfc Make sure the settings dialog exist before hiding it
Because of PR #2580 the settings dialog doesn't always exist. We need to
check for it first before placing calls to it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-10 16:57:56 +00:00
Camila
863db075eb Merge pull request #2621 from nextcloud/wiswedel/documentation/chunkedUpload
[documentation] upload chunks config
2020-11-10 17:56:28 +01:00
Sascha Wiswedel
e69b26e363 [documentation] upload chunks config
documenting e86499d990
2020-11-10 14:56:32 +01:00
Nextcloud bot
4382193519 [tx-robot] updated from transifex 2020-11-10 03:45:50 +00:00
Nextcloud bot
7a093592a0 [tx-robot] updated from transifex 2020-11-09 03:42:28 +00:00
Nextcloud bot
942d8ba86a [tx-robot] updated from transifex 2020-11-08 03:42:17 +00:00
Nextcloud bot
9f9bcecd31 [tx-robot] updated from transifex 2020-11-07 03:42:02 +00:00
Kevin Ottens
46aba0832d Merge pull request #2615 from nextcloud/fetch_apps_on_connectivity_changes_only
Fetch apps when we get connected only
2020-11-05 13:55:36 +01:00
Kevin Ottens
86d240f7b4 Fetch apps when we get connected only
This was right now on the check connectivity beat which is too much when
you got many users. Be more conservative there and only update the list
of apps when the account gets connected.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-05 13:37:25 +01:00
Nextcloud bot
6445a61d80 [tx-robot] updated from transifex 2020-11-05 03:40:34 +00:00
Nextcloud bot
3749fe15b6 [tx-robot] updated from transifex 2020-11-04 03:41:27 +00:00
Nextcloud bot
50e038cfaa [tx-robot] updated from transifex 2020-11-03 03:41:44 +00:00
Camila
44a55674ac Merge pull request #2603 from nextcloud/remove_findqt5keychain_cmake_module
Get rid of FindQt5Keychain.cmake
2020-11-02 14:36:46 +01:00
Kevin Ottens
0e617d020f Adjust AppImage build of QtKeychain to be found by cmake
Now that things are done in a more standard way, let's adjust the
AppImage build so that QtKeychain is picked up properly now that our
FindQt5Keychain.cmake file is gone.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-02 13:28:02 +01:00
Kevin Ottens
3427dadaeb Get rid of FindQt5Keychain.cmake
QtKeychain provides Qt5KeychainConfig.cmake and friends nowadays, so no
need to have a less reliable and outdated find module on our end.

Also this shows that we were including keychain.h in the wrong way and
were not using the link target, so both got fixed as well.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-11-02 13:19:48 +01:00
Nextcloud bot
dfd6cce978 [tx-robot] updated from transifex 2020-11-02 03:41:37 +00:00
Nextcloud bot
5a8c2bab89 [tx-robot] updated from transifex 2020-11-01 03:40:38 +00:00
Nextcloud bot
a14930c293 [tx-robot] updated from transifex 2020-10-31 03:41:57 +00:00
Nextcloud bot
a3914482d7 [tx-robot] updated from transifex 2020-10-30 03:42:51 +00:00
Kevin Ottens
56d067d7a9 Merge pull request #2589 from sryze/windows7-fixes
Misc fixes for Windows 7
2020-10-28 07:39:14 +01:00
Sergey Zolotarev
18c1bc0bd6 Misc fixes for Windows 7
Signed-off-by: Sergey Zolotarev <sryze@protonmail.com>
2020-10-28 06:24:53 +00:00
Nextcloud bot
ef86d4b738 [tx-robot] updated from transifex 2020-10-28 03:42:53 +00:00
Nextcloud bot
a74861dbb5 [tx-robot] updated from transifex 2020-10-27 03:42:33 +00:00
Kevin Ottens
9593cea18c Merge pull request #2591 from nextcloud/fix_conflict_dialog_wording
Remove last left over of the "remote" wording
2020-10-26 16:09:49 +01:00
Kevin Ottens
3e6b257ccd Remove last left over of the "remote" wording
I switched from "remote" to "server" but apparently left one behind by
mistake...

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-26 14:45:46 +00:00
Valdnet
d17c9af044 Merge pull request #2586 from nextcloud/Valdnet-patch-2
l10n: Change the triple dot to ellipsis
2020-10-26 15:09:15 +01:00
Valdnet
204cced445 l10n: Change the ellipsis 2020-10-26 13:22:55 +00:00
Valdnet
f116c39b0a l10n: Add a space in generalsettings.ui 2020-10-26 13:22:55 +00:00
Kevin Ottens
6b794ddd5a Merge pull request #2582 from nextcloud/macos_add_more_information_on_skipped_file_watcher_event
Also output the event flags in the debug logs
2020-10-26 14:15:15 +01:00
Kevin Ottens
8fad88055e Also output the event flags in the debug logs
When we skip a watcher event on mac, we log the file path but not the
event flags which came with it. Let's add it, it should help figure out
what's going on with #2578.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-26 12:37:00 +00:00
Valdnet
1627522695 Merge pull request #2587 from nextcloud/rakekniven-patch-1
Triple dot to ellipsis
2020-10-26 13:32:42 +01:00
rakekniven
62fa8028a6 Triple dot to ellipsis
Reported at Transifex.

Signed-off-by: rakekniven <mark.ziegler@rakekniven.de>
2020-10-26 12:22:23 +00:00
Nextcloud bot
92801816e0 [tx-robot] updated from transifex 2020-10-26 03:37:49 +00:00
Nextcloud bot
599cf0143f [tx-robot] updated from transifex 2020-10-25 03:39:15 +00:00
Nextcloud bot
38205cab68 [tx-robot] updated from transifex 2020-10-24 03:39:31 +00:00
Nextcloud bot
fa8f37e987 [tx-robot] updated from transifex 2020-10-23 03:38:53 +00:00
Camila
2bcc99792d Merge pull request #2581 from nextcloud/ensure_systray_window_doesnt_prevent_windows_session_close
Ensure we quickly show/hide the systray window on startup
2020-10-22 19:48:43 +02:00
Kevin Ottens
24964e2b9b Ensure we quickly show/hide the systray window on startup
This is quick enough that no flickering should appear in practice.

We end up doing this because for some reason on Windows (I dug up deep
into the Windows QPA without nailing it down) not showing that systray
window at least once prevents the app object to return from exec() when
the session ends.

It's as if that window would be in some limbo state (neither opened nor
closed) which would prevent quitting. Clearly what we're doing here is a
workaround...

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 17:31:05 +00:00
Kevin Ottens
802d27ed0f Merge pull request #2527 from nextcloud/improve_conflict_handling_gui
Improve conflict handling gui
2020-10-22 18:27:45 +02:00
Kevin Ottens
b835092ae9 Use the ConflictDialog directly from the activity list
No need to go to the file manager first to then have the user go through
the context menu, just popup the dialog directly.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:47 +02:00
Kevin Ottens
4116c90c9c Move the activity action behavior on the C++ side
We better do this before this business logic grows in the QML side and
gets out of control. We'll need finer grained information due to the
conflict handling anyway.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:46 +02:00
Kevin Ottens
910f0c9339 Repair SettingsDialog::showIssuesList
This was completely disabled code and the connect was gone... So let's
introduce the connect back and have it trigger the main window while
selecting the right user. This way the new activity list is displayed
and since the conflicts are shown at the top this is hopefully obvious
again.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:46 +02:00
Kevin Ottens
c42f4abd25 Add a function to know the user id matching a given account
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:46 +02:00
Kevin Ottens
e3b97b0a04 In the case of conflicts, have the socket api propose the config dialog
This should be safe in the case of conflicts in folders on which the
user can write. For other cases we still use the older actions.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:46 +02:00
Kevin Ottens
49c478cd2a Add a conflict dialog to help the user solve them
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:46 +02:00
Kevin Ottens
67e81fcd0f Add KeepBothVersions as a possible solution to ConflictSolver
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:46 +02:00
Kevin Ottens
4fdb203cdb Move some of the SocketApi conflict handling in a ConflictSolver class
The socket api move and delete commands are not strictly about conflicts
since they also deal with files which couldn't be uploaded for some
other reason. Still the new ConflictSolver could be used in those cases.

This opens the door at reusing that logic in other places.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:46 +02:00
Kevin Ottens
26d62a9712 Repair the canAddToDir logic
This could only work at the root of the sync folder where the record for
the parent folder would be invalid. Otherwise the negation would be
wrong... assuming you can add a file only if the permission is not
there.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:44 +02:00
Christian Kamm
00e901f5a7 SocketAPI: Introduce conflict resolution actions #6252
For conflicts generally as well as new files in read-only directories
the context menu will now present delete and move options.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-22 16:40:10 +02:00
Christian Kamm
f62be57ef2 FileSystem: make removeRecursively() reusable
We want to use it for deleting directory conflicts.
2020-10-22 16:39:17 +02:00
Christian Kamm
e70371f408 FileSystem: Fix bad indentation 2020-10-22 16:39:17 +02:00
Kevin Ottens
b982a17998 Merge pull request #2580 from nextcloud/delay-settingsdialog-init
Delay initialization of SettingsDialog
2020-10-22 15:08:01 +02:00
Michael Schuster
7699004a11 Fix crash in SettingsDialog with delayed initialization
setWindowFlags triggered changeEvent, thus causing a crash in customizeStyle.

This fix should be kept even if we decide against delayed init in the future.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-22 11:29:38 +00:00
Michael Schuster
0fb10163a3 Delay initialization of SettingsDialog
ownCloudGui::slotShowSettings already got what it takes to create it only when we try to show it for the first time.

This however has some implications:

Pros:
- Only created when needed, while testing saved ca. 20 MB of RAM and got freed again after closing the dialog.
- Since we defaulted to the new Tray UI from 3.0, this is an added bonus for users don't opening the settings.

Cons:
- Resources like the avatar image have to be refetched everytime the dialog is recreated.
  This may be desired as well, because it ensures displaying no outdated info (e.g. on connection issues).

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-22 11:29:38 +00:00
Nextcloud bot
40aa53bf76 [tx-robot] updated from transifex 2020-10-22 03:39:17 +00:00
Kevin Ottens
bb43127633 Merge pull request #2575 from nextcloud/expose_branding_values_to_qtquick
Expose branding values to qtquick
2020-10-21 14:13:40 +02:00
Kevin Ottens
c6c2d4cf4c Use the Theme colors for the header part of the window
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 13:46:51 +02:00
Kevin Ottens
a2e3f9d63a Expose Theme on the QML side
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 13:46:38 +02:00
Kevin Ottens
7536e4c00b Expose the branding related members of Theme as properties
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 13:46:04 +02:00
Kevin Ottens
de63e5e221 Don't hardcode the color of text in the header
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 13:40:42 +02:00
Kevin Ottens
0e9efe728a Get rid of ncBlueHover
Use a similar trick of a semi-transparent rectangle on top when the
mouse area is hovered. This way it will always work whatever is the
background color.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 11:24:06 +02:00
Kevin Ottens
60da0cee25 Merge pull request #2572 from nextcloud/avoid_depth_infinity_propfind_for_e2ee
Avoid depth infinity propfind for e2ee
2020-10-21 10:16:14 +02:00
Kevin Ottens
10cb4170c7 Don't use depth infinity anymore to get the folders e2ee status
This way we avoid the expensive SQL query on the server at the price of
more round-trips since we're doing the recursive traversal by hand now.

Also it turns out this depth was used for all the other propfind calls
during sync when we want fresher information regarding a folder. This
was very inefficient in all cases and won't happen anymore.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:59 +02:00
Kevin Ottens
b5fdbefb0e Make sure jobs don't outlive ClientSideEncryption
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens
399b97442e Factor out the logic to start a new e2ee status job
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens
cbc40b5a15 Mention the folder we listed in the debug logs
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens
8e3ca71763 Change the way we store the job result
If there's more than one job we need to unite the maps not simply overwrite
them.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens
9aeb7046d2 Start managing a list of GetFolderEncryptStatusJob
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Kevin Ottens
cfb66ddadd Add a way to know which folder was listed for encrypted status
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-21 10:00:58 +02:00
Nextcloud bot
65b90f4bb1 [tx-robot] updated from transifex 2020-10-21 03:39:44 +00:00
Kevin Ottens
534f0567bf Merge pull request #2568 from nextcloud/fix-macos-crash-403-folder-view
Fix crash when clicking on folder with status 403 in the main dialog.
2020-10-20 16:38:13 +02:00
Camila San
03b1c0b84a Fix crash when clicking on folder with status 403 in the main dialog.
LsColJob was still being used after delete was called.

Signed-off-by: Camila San <hello@camila.codes>
2020-10-20 16:19:27 +02:00
Nextcloud bot
671ca522ea [tx-robot] updated from transifex 2020-10-20 03:38:46 +00:00
Kevin Ottens
0927b9bc90 Merge pull request #2551 from nextcloud/fix_share_dialog_animation_for_enforced_password_policy
Fix share dialog animation for enforced password policy
2020-10-19 17:09:55 +02:00
Kevin Ottens
b7ea6530c5 Stop the animation if we got an error message
Otherwise it would spin forever while we know we're not doing any work
anymore since we got a message from the server.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-19 14:33:19 +00:00
Kevin Ottens
ecc170decc Inform _emptyShareLinkWidget of linkShareRequiresPassword signals
All the other ShareLinkWidgets process that signal (which allows to
display error messages for instance) but not that one for some reason.
That being said it might need to deal with an enforced password
situation.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-19 14:33:19 +00:00
Kevin Ottens
e502e71926 Emit last to avoid use after delete crash
It turns out the shareDeleted() signal is connected to a function
cleaning up the ShareLinkWidget holding the last shared pointer to the
Share object. Since we use member variables for calling updateFolder()
this would lead to using deleted objects.

Just swap the call and the signal to have everything back in order.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-19 14:33:19 +00:00
Nextcloud bot
3329df4caf [tx-robot] updated from transifex 2020-10-17 03:38:33 +00:00
Nextcloud bot
801c77401c [tx-robot] updated from transifex 2020-10-16 03:39:07 +00:00
Nextcloud bot
f6824de126 [tx-robot] updated from transifex 2020-10-15 03:37:51 +00:00
Michael Schuster
61dc4b9137 Update comments
Everyone uses their private mail, so ensure people can get in touch.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-15 02:18:52 +02:00
Nextcloud bot
e656d67f39 [tx-robot] updated from transifex 2020-10-14 03:41:57 +00:00
Kevin Ottens
38f4843582 Merge pull request #2534 from nextcloud/connection_wizard_improvements
Connection wizard improvements
2020-10-13 15:23:56 +02:00
Kevin Ottens
ca57221b74 Ensure we use the app name in the GUI
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-13 07:28:43 +02:00
Kevin Ottens
7efaa2ed68 Fix the secure lock label aspect
Make sure we got a fixed size for that label. Also ensure that the
pixmap we display there is properly scaled to fit while maintaining the
aspect ratio.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-13 07:28:32 +02:00
Kevin Ottens
ec945b8ac7 Hide the slideshow when going to the login page
This is indeed very distracting otherwise.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-13 07:28:32 +02:00
Kevin Ottens
9ec4b5ef8e Add a label explaining the server address field
This is as discussed in #1160

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-13 07:28:31 +02:00
Kevin Ottens
5e472e629f Improve wording on the wizard buttons
This is as discussed on #1158

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-13 07:28:31 +02:00
Nextcloud bot
d0a9d21de8 [tx-robot] updated from transifex 2020-10-13 03:40:16 +00:00
Kevin Ottens
e980682b4d Merge pull request #2543 from renyhp/patch-2
Update bookmarks location
2020-10-12 17:31:11 +02:00
renyhp
e5b307c81f Update bookmarks location
Signed-off-by: renyhp <renyhp@disroot.org>
2020-10-12 15:02:00 +00:00
Kevin Ottens
3c986ead91 Merge pull request #2542 from nicolasfella/puzzel
Avoid string translation puzzle
2020-10-12 17:00:49 +02:00
Nicolas Fella
206c98688e Avoid string translation puzzle
Combining translated strings like this makes them hard to translate since the order of words is different between languages.
Use proper placeholder strings instead.

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-10-12 13:34:50 +00:00
Kevin Ottens
e787054d1c Merge pull request #2541 from nicolasfella/work/nullptrflags
Don't use nullptr for QFlags
2020-10-12 15:33:38 +02:00
Nicolas Fella
6f17bbe6d5 Don't use nullptr for QFlags
This fixes some deprecation warnings

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-10-12 11:52:53 +00:00
Kevin Ottens
142894b2f7 Merge pull request #2221 from nicolasfella/declarative
Make QML code more declarative by using properties
2020-10-12 13:51:47 +02:00
Nicolas Fella
f5860928d9 Make QML code more declarative by using properties
By using properties and property bindings the QML code gets more declarative rather than imperative, which is considered better.

This patch:
- Introduces a currentUserId property in UserModel that replaces the equivalent Q_INVOKABLE call
- Introduces an avatar property in User that contains the avatar's image provider url without any fallback
- Introduces new image provider urls for fallback images
- Moves the fallback image selection to QML since we want different fallbacks according to where it is used
- Wires up the necessary signals to propagate a changing avatar

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-10-12 11:00:20 +00:00
Nextcloud bot
1d939121fc [tx-robot] updated from transifex 2020-10-12 03:37:35 +00:00
Nextcloud bot
bfe9b0ba91 [tx-robot] updated from transifex 2020-10-10 03:42:03 +00:00
Nextcloud bot
3148705df6 [tx-robot] updated from transifex 2020-10-09 03:37:01 +00:00
Camila
643e43dcfb Merge pull request #2530 from nextcloud/repair_windows_build
Repair the Windows build
2020-10-08 17:21:04 +02:00
Kevin Ottens
a53a87a3eb Export the WordList functions
Now that they are used from gui/ they need to be properly exported so
that linking doesn't fail when visibility is activated (only on our
Windows build it seems).

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 15:58:29 +02:00
Kevin Ottens
fc9ceb5af9 Merge pull request #2521 from nextcloud/use_friendly_user_agent_during_authentication
Use friendly user agent during authentication
2020-10-08 12:42:17 +02:00
Kevin Ottens
ab67741d87 Use setHeader instead of setRawHeader for the user agent
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 05:55:47 +00:00
Kevin Ottens
3d8af05037 Use friendly user agent during webflow2 auth
This way the server displays a less scary string while granting access
from the browser. Also this same string will be used in the "Devices and
sessions" section of the server settings.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 05:55:47 +00:00
Kevin Ottens
836de0358d Add a function for a more friendly user agent string
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 05:55:47 +00:00
Kevin Ottens
50dd715f4d Don't force user agent if one is already set on the request
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-08 05:55:47 +00:00
Nextcloud bot
d0ce8bc1ae [tx-robot] updated from transifex 2020-10-08 03:37:16 +00:00
Michael Schuster
211dbadd1a Merge pull request #2514 from nextcloud/make_it_easier_for_user_to_provide_debug_information
Make it easier for user to provide debug information
2020-10-07 17:12:02 +02:00
Kevin Ottens
3fca307fbb Also add build infos in the archive
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens
8ce137cc53 Also add the command line arguments in the archive
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens
8fb673457b Add a button to create a debug archive
This will harvest everything we might need for debugging purposes:
 * config file
 * sync journal dbs
 * log files

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens
15d294e7fb Add dependency on QtGuiPrivate
I'm not a huge fan of using private APIs but QZip is really the API with
the least hassles for our debug archive need. No external dependency and
we know it is generally available and stable despite the lack of
stability promise.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens
607347289e Expose more of the logger state
It is better to rely on the Logger state to know exactly where we're
logging. Indeed due to the the various ways to impact its state the
config alone might not now where we're logging.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens
167800320f Make sure --logfile has precedence on config
Since we changed the default in the config file and since log dir had
precedence on log file, the --logfile command line option wasn't doing
anything anymore.

We make sure it has an effect again overriding --logdir or the logDir
config entry.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Kevin Ottens
b0a38816fc Change the defaults for logging
Turn on the logging by default for everyone. Let's use a log dir within
the config directory of the application and have debug logs expiring
after a day.

This obviously means we'll generate quite some logs but with the
automated compression it shouldn't be too horrible. Obviously that
scales with the amount of files and syncs occurring. In our tests with a
large setup we're around 100 MB for a day worth of logs, this shouldn't
be too much of an issue on today's average desktop/laptop.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 13:33:20 +00:00
Michael Schuster
f90ae66d94 Merge pull request #2520 from nextcloud/handle_askForOptionalPassword_capability
Handle ask for optional password capability
2020-10-07 15:30:17 +02:00
Kevin Ottens
e78312f094 If askForOptionalPassword is enabled preset a random password
This is the same approach used on the server side. Turns out I quite
like it, this avoids popping up a dialog to the user and since she won't
know the password she'll have to set a new one anyway or disable it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 09:43:47 +00:00
Kevin Ottens
099d25a56c Since we must ask for a password this can't be a default public link
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 09:43:47 +00:00
Kevin Ottens
e356acbcee Add sharePublicLinkAskOptionalPassword to Capabilities
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-07 09:43:47 +00:00
Nextcloud bot
d6f53d66f4 [tx-robot] updated from transifex 2020-10-07 03:36:23 +00:00
Nextcloud bot
a2a58eefde [tx-robot] updated from transifex 2020-10-06 03:36:51 +00:00
Michael Schuster
36002701ed Merge pull request #2512 from nextcloud/fix_updater_with_github_downloads
Handle redirects when downloading updates
2020-10-05 16:56:23 +02:00
Kevin Ottens
f39542688a Handle redirects when downloading updates
This is necessary for downloads coming from Github for instance. They
are systematically redirected and we'd just fail the download.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-10-05 15:48:39 +02:00
Kevin Ottens
01152d3f37 Merge pull request #2500 from nextcloud/docs-msi
Windows MSI: Update Docs & add SKIPAUTOUPDATE property
2020-10-05 09:43:00 +02:00
Michael Schuster
b552c77128 Docs: Be slightly more modern and use 64-bit examples
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-05 07:18:35 +00:00
Michael Schuster
ce279d0bbd Windows MSI: Add SKIPAUTOUPDATE property for the skipUpdateCheck setting
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-05 07:18:35 +00:00
Michael Schuster
c5ff288b37 Docs: Use our app name in the MSI docs
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-05 07:18:35 +00:00
Michael Schuster
2476dcb425 Windows MSI: Stay compatible with the upstream "StartMenuShortcuts" feature
Even though we only create a program shortcut in the Start Menu, try to make administrators lives easier by not diverging feature and option naming.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-05 07:18:35 +00:00
Michael Schuster
bf6980d31a Docs: Adopt latest MSI doc enhancements from upstream master
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-05 07:18:35 +00:00
Dominik Schmidt
8e48d53b04 Docs: Adopt upstream commit fe04300 for MSI installation
See: fe043006c8

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-05 07:18:35 +00:00
Michael Schuster
0e5d9a5a6b Docs: Update macOS version info
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-05 07:18:35 +00:00
Nextcloud bot
d1c0481338 [tx-robot] updated from transifex 2020-10-05 03:38:36 +00:00
Nextcloud bot
06177b1a7c [tx-robot] updated from transifex 2020-10-04 03:38:54 +00:00
Nextcloud bot
ebe7cbf0ed [tx-robot] updated from transifex 2020-10-03 03:40:51 +00:00
Michael Schuster
a0b351b145 Merge pull request #2497 from nextcloud/fix/mac-folderwatcher-memory-leak
macOS: Fix memory leak in FolderWatcherPrivate::startWatching
2020-10-02 19:30:26 +02:00
Michael Schuster
bb30633d31 Fix source file access modes
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-02 16:56:29 +00:00
Michael Schuster
5979ae30e1 macOS: Fix memory leak in FolderWatcherPrivate::startWatching
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-10-02 16:56:29 +00:00
Nextcloud bot
4b985ab3b3 [tx-robot] updated from transifex 2020-10-02 03:32:41 +00:00
Michael Schuster
5467909389 Merge pull request #2478 from Aldaris1985/patch-1
Update propagateupload.cpp
2020-10-02 00:07:45 +02:00
Aldaris1985
ef6773bd60 Update propagateupload.cpp
Typo corrected.
2020-10-01 21:26:17 +00:00
Kevin Ottens
c1feecc727 Merge pull request #2493 from nextcloud/kesselb-patch-1
Delete FUNDING.yml
2020-10-01 13:03:09 +02:00
kesselb
fbeba931d2 Delete FUNDING.yml 2020-10-01 11:21:12 +02:00
Nextcloud bot
ce2dec0194 [tx-robot] updated from transifex 2020-10-01 03:40:09 +00:00
Kevin Ottens
48524fc1f4 Merge pull request #2487 from nextcloud/add-talk-icon
Add a clickable icon for Talk notifications.
2020-09-30 14:02:27 +02:00
Camila
954544830d Add a clickable icon for Talk notifications.
Signed-off-by: Camila <hello@camila.codes>
2020-09-30 08:46:01 +00:00
Nextcloud bot
2cb919a684 [tx-robot] updated from transifex 2020-09-30 03:39:38 +00:00
Kevin Ottens
6569ecbd27 Merge pull request #2272 from snake66/issues/2219/deprecate-foreach
Issues/2219/deprecate foreach
2020-09-29 19:58:52 +02:00
Harald Eilertsen
7721da25e5 Replace find_if with none_of where appropriate.
We're not interested in any found element in these cases, just to check
that none of the elements matches.

Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:32:39 +02:00
Harald Eilertsen
061ef027ff Don't hold ref to value returned from function.
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:32:24 +02:00
Harald Eilertsen
074a94ceb9 gui/accountmanager: Make isAccountIdAvailable a bit clearer.
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:24 +02:00
Harald Eilertsen
62bf4c5fda gui/folderman: Replace foreach (#2219)
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:24 +02:00
Harald Eilertsen
677997b2b3 gui/folder: Replace foreach (#2219)
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:23 +02:00
Harald Eilertsen
5bd2529ca6 gui/application: replace foreach (#2219)
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:23 +02:00
Harald Eilertsen
e343b4b947 gui/accountstate: Replace foreach (#2219)
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:23 +02:00
Harald Eilertsen
225fdabf6a gui/accountstate: Replace foreach (#2219)
Most instances have been converted to range based for, but std::find_if
has been used where it made sense.

Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:23 +02:00
Harald Eilertsen
1898782781 gui/accountmanager: Replace foreach/Q_FOREACH (#2219)
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:23 +02:00
Harald Eilertsen
5f4cec870b cmd: Replace foreach with range base for (#2219)
Signed-off-by: Harald Eilertsen <haraldei@anduin.net>
2020-09-29 19:31:23 +02:00
Camila
1b1975e01d Merge pull request #2486 from nextcloud/fix-notification
Connect signal guiLog to slot to display systray message.
2020-09-29 19:26:06 +02:00
Camila
dc12cdf196 Correct the object name returned by the api.
The id was always 0 so no new systray messages were displayed.

Signed-off-by: Camila <hello@camila.codes>
2020-09-29 18:53:28 +02:00
Camila
d2eb24a9a8 Connect signal guiLog to slot to display systray message.
Signed-off-by: Camila <hello@camila.codes>
2020-09-29 18:53:28 +02:00
Kevin Ottens
b9873cac63 Merge pull request #2485 from nextcloud/Valdnet-patch-1
l10n: Remove space from string text
2020-09-29 14:43:39 +02:00
Valdnet
d50ad548d2 l10n: Remove space from string text 2020-09-29 14:39:34 +02:00
Nextcloud bot
68ba07a45a [tx-robot] updated from transifex 2020-09-29 03:41:15 +00:00
Kevin Ottens
10b23200ab Merge pull request #2317 from nextcloud/tray-accessibility
Tray accessibility
2020-09-28 16:48:26 +02:00
Dominique Fuchs
b96b7e20c7 emitting signals from Qts Accessibility interaction invocations instead of duplicating actions
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Dominique Fuchs
1053c58b0f KISS. Removed description for now, instead clarified some Accessible.name
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Dominique Fuchs
8abe4219a5 Added missing qsTr() calls - again
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Dominique Fuchs
a69898371f Added missing qsTr() calls
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Dominique Fuchs
a4151d71bc Fix typo
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Dominique Fuchs
3287ec2387 Typo fixes, minor additions
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Dominique Fuchs
c6047e4d63 Re-add wrongly delete action
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Dominique Fuchs
43bf703806 Initial accessibility declarations for tray window qml src
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-28 12:38:21 +00:00
Camila
a7a079a335 Merge pull request #2477 from nextcloud/free_icon_job
Free IconJob after use
2020-09-28 13:02:41 +02:00
Dan Griffin
5763e1e9d8 Free IconJob after use
Signed-off-by: Dan Griffin <github.mk@xiragon.com>
2020-09-28 12:30:53 +02:00
Nextcloud bot
836638815f [tx-robot] updated from transifex 2020-09-28 03:37:52 +00:00
Nextcloud bot
eefa46a8e7 [tx-robot] updated from transifex 2020-09-27 03:37:06 +00:00
Nextcloud bot
d58af951f3 [tx-robot] updated from transifex 2020-09-26 03:38:03 +00:00
Nextcloud bot
78a3e45456 [tx-robot] updated from transifex 2020-09-25 03:41:46 +00:00
Kevin Ottens
7b1ba31c13 Merge pull request #2470 from nextcloud/fix_qt_5_12_tooltip_wrap
Force tooltip wrap mode because it's not enabled in Qt 5.12...
2020-09-24 14:49:44 +02:00
Kevin Ottens
78b03739a7 Force tooltip wrap mode because it's not enabled in Qt 5.12...
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-24 14:47:56 +02:00
Nextcloud bot
16b709edbc [tx-robot] updated from transifex 2020-09-24 03:38:39 +00:00
Kevin Ottens
a2899eba74 Merge pull request #2409 from jplsek/native-text-render
Use native text rendering for qml windows
2020-09-23 13:15:00 +02:00
Jeremy Plsek
5fa2a13f8d Use native text rendering for qml windows
Signed-off-by: Jeremy Plsek <jeremyplsek@gmail.com>
2020-09-23 08:00:46 +00:00
Kevin Ottens
dde4dd78fb Merge pull request #2441 from nextcloud/enh/server-url
Allow server URL to be pre-defined without enforcing it
2020-09-23 09:59:31 +02:00
Michael Schuster
ce71ffe9f9 Allow server URL to be pre-defined without enforcing it to be used unmodified
APPLICATION_SERVER_URL can be either empty or be specified. This commit adds the new CMake option APPLICATION_SERVER_URL_ENFORCE to decide whether to enforce the
URL's unmodified use (like before, default: ON) or to allow modification by the user (new).

By default APPLICATION_SERVER_URL_ENFORCE is set to ON, to no break with the previous implementation's expectations.

If APPLICATION_SERVER_URL is empty, APPLICATION_SERVER_URL_ENFORCE will be ignored by the Account Wizard.

The previous behaviour confused me a bit with branded builds. When the URL was (usually) specified but not forced, it was simply discarded, forcing the user to
manually supply it.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-23 07:21:35 +00:00
Nextcloud bot
122493eeeb [tx-robot] updated from transifex 2020-09-23 03:37:35 +00:00
Nextcloud bot
3ca6f4b0f2 [tx-robot] updated from transifex 2020-09-22 03:37:33 +00:00
Michael Schuster
b72bfb5c65 Merge pull request #2369 from nextcloud/enh/windows-msi
Windows: MSI support & Win32 migration tools
2020-09-21 17:35:37 +02:00
Michael Schuster
e024aa3f16 Windows: Win32 migration tools code review
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-21 16:40:19 +02:00
Michael Schuster
a9014f9852 Windows MSI: Add MSI scripts and UI resources
Uses CMake to generate and install all required files in the "msi/" directory.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-21 16:40:19 +02:00
Michael Schuster
f321cd8ae6 Windows: Add Win32 stand-alone migration tool NCNavRemove
Removes all Explorer Navigation Pane entries for a given ApplicationName, specified in NavRemove.ini in the working directory.

Also compiles a DLL with the same behaviour that exports:
- RemoveNavigationPaneEntries

Both tool variants are Mutex-protected.

Statically linked, optimized for binary size, no Qt dependencies.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-21 16:40:19 +02:00
Michael Schuster
68776fe319 Windows MSI: Add helper DLL and shared migration tools code
The helper DLL will be utilized by Windows Installer with Custom Actions defined in the NCMsiHelper.wxs WiX fragment.

Exports:
- ExecNsisUninstaller
- RemoveNavigationPaneEntries

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-21 16:40:19 +02:00
Michael Schuster
fc365df5de Windows MSI: Let CMake install Shell Extensions WiX fragment to "msi/"
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-21 16:40:19 +02:00
Michael Schuster
fad9b2c969 Windows MSI: Add Upgrade Code and migration tool build options to NEXTCLOUD.cmake
The Upgrade Code is a GUID (specified without brackets) for the MSI package to allow Windows Installer identify existing installations.

New build options (default: OFF):
- BUILD_WIN_MSI: Build all MSI scripts and a required helper DLL (to uninstall NSIS legacy installations and remove Explorer Navigation Pane entries)
- BUILD_WIN_TOOLS: Build additional migration tools (currently NCNavRemove, a stand-alone tool for Explorer entries removal)

The helper DLL and migration tools are set to be statically linked and optimized for binary size.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-21 16:40:19 +02:00
Kevin Ottens
58b88de936 Merge pull request #2431 from jplsek/remove-this-includes
Remove "This includes" due to tooltip order
2020-09-21 15:40:37 +02:00
Jeremy Plsek
3a53afd704 Remove "This includes" due to tooltip order
Signed-off-by: Jeremy Plsek <jeremyplsek@gmail.com>
2020-09-21 09:46:25 +00:00
Nextcloud bot
c127052f2d [tx-robot] updated from transifex 2020-09-21 03:32:07 +00:00
Nextcloud bot
ed972a0e3f [tx-robot] updated from transifex 2020-09-20 03:31:45 +00:00
Nextcloud bot
5d7e1b6a69 [tx-robot] updated from transifex 2020-09-19 03:34:11 +00:00
Michael Schuster
0f2784107c Merge pull request #2437 from nextcloud/remove_no_description_available_messages_in_activity_list
If there's no description just say nothing
2020-09-18 20:41:34 +02:00
Kevin Ottens
3171cb2720 If there's no description just say nothing
Otherwise we get lots of "No description available" lines in the
activity list which is basically noise. Also trains the user to ignore
the secondary line.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-18 17:46:38 +00:00
Michael Schuster
f451e1d2d5 Merge pull request #2445 from nextcloud/fix-mac-catalina-login
Entitlement to sign the QtWebEngineProcess with an exception.
2020-09-18 06:44:11 +02:00
Camila San
9c5a51bb07 Entitlement to sign the QtWebEngineProcess with an exception.
Fix for #1793: The problem seems to be related enabling hardened runtime.
This exception allows the webview to load.

Signed-off-by: Camila San <hello@camila.codes>
2020-09-18 04:35:06 +00:00
Nextcloud bot
091c805f9e [tx-robot] updated from transifex 2020-09-18 03:30:59 +00:00
Dominique Fuchs
54364e7374 Merge pull request #2439 from nextcloud/fix-subfolder-missing-contentsync
Fix missing subdirectory discovery on move operations in macOS
2020-09-17 16:04:12 +02:00
Dominique Fuchs
f8f3190cb4 Fix missing subdirectory discovery on move operations in macOS.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>

Add qAsConst to avoid detaching

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>

Changed callchain to find and return possibly coalesced paths

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>

Removed another qAsConst remnant, more func const-correctness.

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-17 15:44:32 +02:00
Nextcloud bot
ed3eb1ac9c [tx-robot] updated from transifex 2020-09-17 04:13:19 +00:00
Kevin Ottens
61a74e67c9 Merge pull request #2435 from nextcloud/fix-journal-upgrade-multiple-syncconnections
Fix incomplete journal upgrade from 2.x to 3.x
2020-09-16 13:21:42 +02:00
Dominique Fuchs
d09b0284dd Do not break out of outer loop when upgrading folders, continue instead
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>

Remove awkward debug line a.k.a. whoops

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-09-16 10:57:43 +02:00
Kevin Ottens
5eba2e9163 Merge pull request #2432 from nextcloud/fix/nsis-language-encoding
Windows: Fix NSIS language encoding (use UTF-8)
2020-09-16 09:13:26 +02:00
Michael Schuster
0e1e3a29ce Windows: Remove unused and outdated NSIS Transifex settings
The last translation update from Transifex was done in 2017, so the scripts and settings were never used for Nextcloud.

This commit removes the unused scripts and "Auto-generated" comments in the translation files.

Some files have been modified over time either way and MSI will replace NSIS soon.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-16 05:41:27 +00:00
Michael Schuster
7f5b7f637c Windows: Fix NSIS language encoding (use UTF-8 instead of Win code pages)
The old conversion to specific code pages caused display errors (see issue #2393 for Russian).

Based on bin/l10n.sh, the files in this commit were converted to UTF-8 using iconv with the following parameters:

  iconv -f CP1252 -t UTF-8 -o German.nsh German.nsh
  iconv -f CP1252 -t UTF-8 -o Galician.nsh Galician.nsh
  iconv -f CP1253 -t UTF-8 -o Greek.nsh Greek.nsh
  iconv -f CP1250 -t UTF-8 -o Slovenian.nsh Slovenian.nsh
  iconv -f CP1257 -t UTF-8 -o Estonian.nsh Estonian.nsh
  iconv -f CP1252 -t UTF-8 -o Italian.nsh Italian.nsh
  iconv -f CP1252 -t UTF-8 -o PortugueseBR.nsh PortugueseBR.nsh
  iconv -f CP1252 -t UTF-8 -o Spanish.nsh Spanish.nsh
  iconv -f CP1252 -t UTF-8 -o Dutch.nsh Dutch.nsh
  iconv -f CP1252 -t UTF-8 -o Finnish.nsh Finnish.nsh
  iconv -f CP932 -t UTF-8 -o Japanese.nsh Japanese.nsh
  iconv -f CP1250 -t UTF-8 -o Slovak.nsh Slovak.nsh
  iconv -f CP1254 -t UTF-8 -o Turkish.nsh Turkish.nsh
  iconv -f CP1252 -t UTF-8 -o Norwegian.nsh Norwegian.nsh
  iconv -f CP852  -t UTF-8 -o Czech.nsh Czech.nsh

The installer script nextcloud.nsi in the client-building repo needs the following line (to be added on top):
  Unicode true

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-09-16 05:41:27 +00:00
Nextcloud bot
dbe8422c5d [tx-robot] updated from transifex 2020-09-16 03:27:56 +00:00
Kevin Ottens
9d05bc0a8b Merge pull request #2424 from nextcloud/enable_ci_for_stable_branches
Try to enable the CI on stable branches as well
2020-09-15 15:24:58 +02:00
Kevin Ottens
f3c2632f8c Try to enable the CI on stable branches as well
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-15 12:46:36 +00:00
Kevin Ottens
16dda17334 Merge pull request #2423 from nextcloud/disable_bugprone_forward_declaration_namespace_clang_tidy_check
Disable bugprone-forward-declaration-namespace check
2020-09-15 14:45:29 +02:00
Kevin Ottens
63c3580755 Disable bugprone-forward-declaration-namespace check
Turns out this clang-tidy check can give false positives coming from
headers outside the project while it shouldn't.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-15 12:04:32 +00:00
Kevin Ottens
8aaa533a3e Merge pull request #2412 from jplsek/tooltip-update
Include list info in tooltip
2020-09-15 13:50:39 +02:00
Jeremy Plsek
797df2b5d5 Include list info in tooltip
Also extend the tooltip timeout

Signed-off-by: Jeremy Plsek <jeremyplsek@gmail.com>
2020-09-15 10:04:06 +00:00
Kevin Ottens
14993d4de6 Merge pull request #2417 from nextcloud/fix_menu_popup_in_main_dialog
Fix menu popup in main dialog
2020-09-15 11:03:07 +02:00
Kevin Ottens
6ee37b5975 Make sure menu are closed when button is clicked again
This way we also made sure all the Menu are currently on the same close
policy.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-15 08:46:10 +00:00
Kevin Ottens
f7efe6a902 Delay binding on the menu width
Indee the MenuItem might not be linked to its Menu at creation time
which will make the binding fail and give a warning. Delay for the menu
availability.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-15 08:46:10 +00:00
Kevin Ottens
eb0cedebfa Remove pre-QQC2.3 workaround
Now that we depend on Qt 5.12 anyway, the count property is available
just fine on the Menu item.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-15 08:46:09 +00:00
Kevin Ottens
4f5d707e44 Merge pull request #2418 from nextcloud/use_primary_screen_as_fallback_when_qcursor_pos_search_failed
Use QGuiApplication::primaryScreen() as fallback for Systray::currentScreen()
2020-09-15 10:44:54 +02:00
Kevin Ottens
7ccb016397 Use QGuiApplication::primaryScreen() as fallback for Systray::currentScreen()
Under Wayland QCursor::pos() is unlikely to give us anything meaningful,
so fallback to the primary screen information.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-15 07:17:03 +00:00
Nextcloud bot
54b09a1fbb [tx-robot] updated from transifex 2020-09-15 03:22:14 +00:00
Nextcloud bot
9d3a905cc5 [tx-robot] updated from transifex 2020-09-12 03:19:44 +00:00
Nextcloud bot
88a573a643 [tx-robot] updated from transifex 2020-09-11 03:20:37 +00:00
Kevin Ottens
01986df8ca Don't use a confusing "royal you" in the sync messages
Users get rightfully confused with the "You changed ..." messages in the
activity list for syncs. Indeed, some of those changes might be coming
from the server in which case we don't really know who did the change.

So now we use the old "Synced ..." messages for changes pulled from the
server and we have a more precise "You changed ..." (renamed, deleted,
created) when the changes were initiated locally (since there we know
the user reading the message did it).

Also changed how the messages are constructed so that they can be
properly translated.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-10 15:40:05 +02:00
Nextcloud bot
9ab256b4b4 [tx-robot] updated from transifex 2020-09-10 03:25:52 +00:00
Camila
95f634ce28 Click on activity list in systray open file in the file manager.
Clean up code, add more const and auto.

Signed-off-by: Camila <hello@camila.codes>
2020-09-09 20:06:46 +02:00
Camila
c1086c9886 Fix tooltip for activity info.
Also improves readability of the items in the list.

Signed-off-by: Camila <hello@camila.codes>
2020-09-09 20:06:46 +02:00
Valdnet
a432501d80 l10n: Add a period 2020-09-09 10:07:10 +02:00
Nextcloud bot
301a926f4d [tx-robot] updated from transifex 2020-09-09 03:19:56 +00:00
Valdnet
9822079cae l10n: Extract the button name 2020-09-08 16:44:51 +02:00
Valdnet
528fa92e86 l10n: Delete unnecessary sentence 2020-09-08 16:44:51 +02:00
Valdnet
1444500f77 l10n: A few more fixes 2020-09-08 16:44:51 +02:00
Valdnet
e2737b5067 l10n: Word correction 2020-09-08 16:44:51 +02:00
Valdnet
f931bc832c l10n: Corrected translation 2020-09-08 16:44:51 +02:00
Kevin Ottens
fdb35e5f9f Leave the implicit uint to int cast
I wrongly (and stupidly) assumed the int in QBitArray was treated as a
hash as well but it is an index so it must be positive. Also to make
things even worse I misread on which expression clang-tidy was
complaining regarding the implementation specific narrowing
conversion... This is happening after the modulo operator and not
before. We're in a safe range of values at that point, so it's fine to
let the narrowing happen.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-08 16:44:31 +02:00
Kevin Ottens
de3ba2721b Merge pull request #2387 from nextcloud/update-troubleshooting
Update troubleshooting
2020-09-08 15:46:55 +02:00
Camila
0f03e3091d Add README with instructions on how to build the documentation.
Signed-off-by: Camila <hello@camila.codes>
2020-09-08 13:44:26 +00:00
Camila
fecc62b7e1 Update troubleshooting instructions with the newly added config file options.
Signed-off-by: Camila <hello@camila.codes>
2020-09-08 13:44:26 +00:00
Nextcloud bot
5adb720630 [tx-robot] updated from transifex 2020-09-08 03:19:49 +00:00
Nextcloud bot
a61dd7cf46 [tx-robot] updated from transifex 2020-09-06 03:28:59 +00:00
Nextcloud bot
2db125dca0 [tx-robot] updated from transifex 2020-09-05 03:29:13 +00:00
Nextcloud bot
6c69ac6602 [tx-robot] updated from transifex 2020-09-04 03:29:47 +00:00
Kevin Ottens
a4cb7e3040 Merge pull request #2357 from thaytan/metadata-index-e2eMangledName
syncjournaldb: index e2eMangledName column in metadata
2020-09-03 16:20:48 +02:00
Jan Schmidt
3077a1378b syncjournaldb: index e2eMangledName column in metadata
Add an index on the e2eMangledName column in the metadata table
to speed up file sync by orders of magnitude on directories with
a large number of files.

Signed-off-by: Jan Schmidt <jan@centricular.com>
2020-09-03 22:56:14 +10:00
Nextcloud bot
fd29a0ae57 [tx-robot] updated from transifex 2020-09-03 03:29:13 +00:00
Kevin Ottens
18b16a3ede Merge pull request #2351 from nextcloud/fix_clang_tidy_errors_in_csync_tests
Fix clang tidy errors in csync tests
2020-09-02 08:25:24 +02:00
Kevin Ottens
ee92e5af9a Switch to newer CI image to build csync tests
This new image brings the cmocka dependency and thus will make the CI
build the csync tests which depend on it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-02 06:12:46 +00:00
Kevin Ottens
2916144fe3 Fix bugprone-narrowing-conversion errors in csync tests
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-02 06:12:46 +00:00
Kevin Ottens
c7c37f9bef Fix modernize-use-nullptr errors in csync tests
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-02 06:12:46 +00:00
Kevin Ottens
9a0713fab7 Fix modernize-use-auto errors in csync tests
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-02 06:12:46 +00:00
Kevin Ottens
f323f8b4bc Fix modernize-deprecated-headers errors in csync tests
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-02 06:12:45 +00:00
Nextcloud bot
9ec4e772eb [tx-robot] updated from transifex 2020-09-02 03:31:47 +00:00
Kevin Ottens
b6591be973 Merge pull request #2283 from nextcloud/enable_bugprone_clang_tidy_checks
Enable bugprone clang tidy checks
2020-09-01 08:47:41 +02:00
Kevin Ottens
310693be2c Enable all the other bugprone clang-tidy checks
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens
aa63889e5b Enable bugprone-terminating-continue clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens
0909f00a8b Enable bugprone-too-small-loop-variable clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens
80cc196f6f Enable bugprone-narrowing-conversions clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens
5cec1373ad Enable bugprone-macro-parentheses clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens
608bf025e6 Enable bugprone-forward-declaration-namespace clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens
c8ea848596 Enable the bugprone-branch-clone clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Kevin Ottens
4cb9bec23a Enable the bugprone-argument-comment clang-tidy check
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-09-01 06:37:03 +00:00
Nextcloud bot
4e61181b45 [tx-robot] updated from transifex 2020-09-01 03:26:29 +00:00
Kevin Ottens
4ee80bfe2e Merge pull request #2345 from nextcloud/use_httpd_unix-directory_mimetype_for_e2ee_folders
Use httpd/unix-directory mimetype for E2EE folders
2020-08-31 13:11:51 +02:00
Kevin Ottens
eb76682b1e Use httpd/unix-directory mimetype for E2EE folders
We don't do much with that mimetype on our end, but other clients
somehow don't expect inode/directory to let's lie. ;-)

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-31 10:08:48 +00:00
Kevin Ottens
1a0945a973 Enable all the misc clang-tidy check except one
This flagged mostly unused parameters. Didn't enable the
misc-non-private-member-variables-in-classes check as we got a lot of
those. Hopefully we'll get to fix them at some point but that feels too
early and too much work for now.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-31 09:14:09 +02:00
Nextcloud bot
7236af78af [tx-robot] updated from transifex 2020-08-31 03:25:49 +00:00
Nextcloud bot
b01299349b [tx-robot] updated from transifex 2020-08-30 03:24:23 +00:00
Nextcloud bot
78fa448c7e [tx-robot] updated from transifex 2020-08-29 03:26:40 +00:00
Michael Schuster
75aa94be79 Merge pull request #2336 from nextcloud/jospoortvliet-patch-1
Some changes to the template...
2020-08-29 00:14:16 +02:00
Jos Poortvliet
01a722821a Some changes to the template... 2020-08-28 21:54:10 +02:00
Nextcloud bot
e45be65996 [tx-robot] updated from transifex 2020-08-28 03:26:44 +00:00
Nextcloud bot
1f536a7e1b [tx-robot] updated from transifex 2020-08-27 03:29:43 +00:00
Michael Schuster
5945f18d5a Remove remaining QLinkedList includes in addition to #2300
Now the only remaining reference is in:

src/3rdparty/libcrashreporter-qt/3rdparty/drkonqi-parser/backtraceparser.cpp:269:        || line.functionName().startsWith(QLatin1String("QLinkedList")

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 03:12:09 +02:00
Michael Schuster
bd519ffe7a Adapt code style in addition to #2300
- Use "!empty()" instead of "size() > 0" in std::list
- Add comments for namespace brackets

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-27 01:31:06 +02:00
Michael Schuster
e973c43a7a Merge pull request #2300 from chenecharry/master
Support client builds on VS2019 (QLinkedList is deprecated)
2020-08-27 01:27:09 +02:00
Michael Schuster
24a2b21c2c Merge branch 'master' into master 2020-08-27 01:12:30 +02:00
Nextcloud bot
07bde18c3a [tx-robot] updated from transifex 2020-08-26 03:29:53 +00:00
V.C
b20ea25201 Code review changes implemented
Code review changes implemented for bandwidthmanager.cpp
1. Use auto instead of size_t
2. Check for empty instead of size comparisions

Signed-off-by: V.C <c******@rediffmail.com>
2020-08-26 02:45:20 +00:00
V.C
af1bb7e98c Support client builds on VS2019
Scenario: Build fails on Qt 5.15.0 + VS2019 16.7.2
Root cause: QLinkedList seems to be depreciated. Advise to use std::list instead.
Fix: Used std::list insead of QLinkedList.

Signed-off-by: V.C <c******@rediffmail.com>
2020-08-26 02:45:20 +00:00
Michael Schuster
c1cb3e6c49 Merge pull request #2309 from nextcloud/update-docs-page-title
Update copyright date and version displayed in the page title.
2020-08-25 21:07:18 +02:00
Camila
cbea02390e Update copyright date and version displayed in the page title.
- This is the title displayed at https://docs.nextcloud.com/desktop/x.y

Signed-off-by: Camila <hello@camila.codes>
2020-08-25 18:50:14 +00:00
Michael Schuster
c4b87cd465 Merge pull request #2313 from nextcloud/update-issue-template
Add --logdebug parameter to instructions in issue_template for Github.
2020-08-25 20:48:59 +02:00
Camila
c746e65a8e Update issue_template with information about logs, e2ee versions and code of conduct.
Signed-off-by: Camila <hello@camila.codes>
2020-08-25 15:11:34 +00:00
Camila
6c36041829 Add --logdebug parameter to instructions in issue_template for Github.
Signed-off-by: Camila <hello@camila.codes>
2020-08-25 15:11:34 +00:00
Nextcloud bot
c687fb0291 [tx-robot] updated from transifex 2020-08-25 03:32:20 +00:00
Nextcloud bot
d4183aebb3 [tx-robot] updated from transifex 2020-08-24 03:31:03 +00:00
Nextcloud bot
7af6e18491 [tx-robot] updated from transifex 2020-08-22 03:28:48 +00:00
Michael Schuster
5b8ec5cede Merge pull request #2302 from ivaradi/no-eoan
Do not build for Eoan
2020-08-22 00:55:31 +02:00
István Váradi
cd303e313d Do not build for Eoan
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-08-21 18:54:56 +02:00
Nextcloud bot
32880507b2 [tx-robot] updated from transifex 2020-08-21 03:30:20 +00:00
Michael Schuster
b60239c29e Merge pull request #2288 from nextcloud/enh/windows-shellext
Windows shell extensions: Use custom GUIDs and prepare for MSI
2020-08-20 21:11:34 +02:00
Michael Schuster
4df8db4ff6 Fix spacing
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Michael Schuster
db05f65e0d Windows shell extensions: Add WiX (MSI) fragment
Use CMake to generate a WXI fragment to handle the DLL registration and file deployment for the shellext components.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Michael Schuster
11632da7ea Windows shell extensions: Change NCUtil Pipe name from ownCloud to APPLICATION_EXECUTABLE
Avoid interference with foreign pipes as this is always a bad idea ;p

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Michael Schuster
0ba5df597f Windows shell extensions: Rename all files and classes from OC* to NC*, update version info
This also ensures a clear separation in the system registry.

SelfReg is not recommended by Microsoft and will be handled by the MSI package to allow proper Repair and Uninstall.
However, we keep it for backward compatibility with the NSIS installer.

For details see:
https://stackoverflow.com/questions/364187/how-do-you-register-a-win32-com-dll-file-in-wix-3#364210
https://docs.microsoft.com/en-us/windows/win32/msi/selfreg-table#remarks

Another fix by this commit:
The "Version" registry value in the NCOverlays self reg should be a key and not a value.

Details: https://wixtoolset.org/documentation/manual/v3/xsd/wix/class.html

Example:

  [HKCR\CLSID\{01234567-89AB-CDEF-0123-456789ABCDEF}\Version]
  @="1.0.0.0"

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Michael Schuster
8ce13b7bdb Windows shell extensions: Use custom GUIDs via CMake and prepare MSI reg
Previously side by side installation with ownCloud or other NC custom builds would break the shell integration because the same GUIDs and registry keys were used.

Now we specify our custom GUIDs in NEXTCLOUD.cmake and use CMake to generate a header file and WiX (MSI) include file with these constants.

Note: Using generators like "guidgen" or "uuidgen" ensures that GUIDs are unique, as manual changes are not guaranteed to be.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Hannah von Reth
4675869fb3 Remove dead code
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Hannah von Reth
bfd7707ff4 2.7 has less automatic includes on Windows
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Hannah von Reth
34e9e2f288 Cleanup Windows shell extensions
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Hannah von Reth
6c9a31f6ee Remove outdated visual studio projects, we now use cmake
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Dominik Schmidt
13d4b91935 Avoid warning because /MT overrides /MD flag
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Dominik Schmidt
e4b53b12e1 Make OCUtil helper lib static and link it statically against crt
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Olivier Goffart
906556640d Windows Shell Integration: Don't limit the size of the buffer
Otherwise we can't have operation that has many many filename

As reported in #6780

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Christian Kamm
77cc262337 Windows shellext: Update copyrights and company name
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Olivier Goffart
6274462036 windows shell extension: add OCUtil/resource.h
It's a copy from OCContextMenu/resources.h

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Christian Kamm
c6fc46aa09 Windows shellext: Add rc for OCUtil #6554
To set the dll's metadata.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-08-20 18:50:05 +02:00
Kevin Ottens
d446431804 Merge pull request #2292 from nextcloud/prevent_sharing_for_e2ee_folders
Disable context menu actions for E2EE files and folders
2020-08-20 18:36:37 +02:00
Kevin Ottens
ed5e9de9f6 Present sharing of E2EE files from the main dialog too
The visibility of the share button for the activity list is tied to the
path role in the ActivityListModel, so make sure we don't return a path
for E2EE files and folders.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-20 14:53:14 +02:00
Kevin Ottens
07388e0f22 Disable context menu actions for E2EE files and folders
Those files and folders are not shareable and the "Edit" or "Open in
browser" actions will lead to showing an error in the web GUI. No need
to lead users there so just disable them.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-20 14:13:56 +02:00
Nextcloud bot
b67c61bf4a [tx-robot] updated from transifex 2020-08-20 03:32:34 +00:00
Nextcloud bot
d6cc9fe829 [tx-robot] updated from transifex 2020-08-19 03:32:55 +00:00
Kevin Ottens
3540f1e460 Show the "Display mnemonic" button only when we know e2e is supported
Turns out that showing the button straight from the page ctor is a bit
too early. At that point the account might not be connected yet and thus
we wouldn't have proper information. Currently we were displaying that
button all the time, now we wait for the account to be connected to
decide to show it or not.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-18 17:41:38 +02:00
Camila
71fbc65eb0 Minor fix in text of warning and debug message.
Signed-off-by: Camila <hello@camila.codes>
2020-08-18 14:00:21 +02:00
Kevin Ottens
f6e36523d2 Make sure we don't assert when calling fileStatus
It happens that sometimes we leak a directory path ending with a slash,
but that violates fileStatus' precondition so let's catch it early and
skip such path.

Of course the right fix would be a larger swipe in the sync engine and
around it to not use naked strings anymore but rely on the typesystem.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-18 13:52:28 +02:00
Nextcloud bot
2456f943af [tx-robot] updated from transifex 2020-08-18 03:34:45 +00:00
Nextcloud bot
c8b6bc6029 [tx-robot] updated from transifex 2020-08-17 03:28:12 +00:00
Nextcloud bot
60ce985828 [tx-robot] updated from transifex 2020-08-16 03:28:22 +00:00
István Váradi
770e3e7b85 Merge pull request #2271 from ivaradi/cstdint-fix
Include cstdint only when compiling C++ code
2020-08-15 14:35:01 +02:00
István Váradi
387df7ae71 Merge branch 'master' into cstdint-fix 2020-08-15 12:56:13 +02:00
Nextcloud bot
2e69680812 [tx-robot] updated from transifex 2020-08-15 03:29:02 +00:00
István Váradi
89d4b6e12a Include cstdint only when compiling C++ code
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-08-14 06:15:42 +02:00
Nextcloud bot
74c1710ed4 [tx-robot] updated from transifex 2020-08-14 03:44:39 +00:00
Kevin Ottens
4117ac2913 Merge pull request #2268 from nextcloud/cherry_pick_testchunkingng_related_improvements
Cherry pick TestChunkingNG related improvements
2020-08-13 17:26:33 +02:00
Kevin Ottens
ef6d2600ca Size cleanups in TestChunkingNG
Some of the comments didn't match the size or were missing. This also
means reducing one of the 150 MB payloads left behind reducing the
execution time by a few more seconds. This is now around 30s execution
time which is more acceptable.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 16:46:14 +02:00
Olivier Goffart
a7847a4e82 Upload: Store the size in the UploadInfo, and compare it when resolving potential conflict
This is about the conflicts that happens when the file has been uploaded
correctly to the server, but the etag was not recieved because the connection
was closed before we got the reply.

We used to compare only the mtime when comparing the uploaded file and the
existing file.  However, to be perfectly correct, we also should check the
size.

This was found because TestChunkingNG::connectionDroppedBeforeEtagRecieved is
flaky. Example of faillure found in https://drone.owncloud.com/owncloud/client/481/5
while testing PR #6626

(very trimmed log:)

06-29 07:58:02:015 [ info sync.csync.csync ]:	## Starting local discovery ##
06-29 07:58:02:016 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag:  <-> 1644a8c8750, inode: 1935629 <-> 1935629, size: 301 <-> 300, perms: 0 <-> ff, type: 0 <-> 0, checksum:  <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:016 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:972 [ warning sync.networkjob ]:	QNetworkReply::NetworkError(OperationCanceledError) "Connection timed out" QVariant(Invalid)
.. next sync...
06-29 07:58:02:980 [ info sync.engine ]:	#### Discovery start ####################################################
06-29 07:58:02:981 [ info sync.csync.csync ]:	## Starting local discovery ##
06-29 07:58:02:983 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag:  <-> 1644a8c8750, inode: 1935629 <-> 1935629, size: 302 <-> 300, perms: 0 <-> ff, type: 0 <-> 0, checksum:  <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:983 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:985 [ info sync.csync.csync ]:	## Starting remote discovery ##
06-29 07:58:02:985 [ info sync.networkjob ]:	OCC::LsColJob created for "http://localhost/owncloud" + "" "OCC::DiscoverySingleDirectoryJob"
06-29 07:58:02:987 [ info sync.csync.updater ]:	Database entry found, compare: 1530259082 <-> 1530259051, etag: 1644a8c8b26 <-> 1644a8c8750, inode: 0 <-> 1935629, size: 301 <-> 300, perms: ff <-> ff, type: 0 <-> 0, checksum: SHA1:5adcdac9608ae0811247f07f4cf1ab0a2ef99154 <-> SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1, ignore: 0
06-29 07:58:02:987 [ info sync.csync.updater ]:	file: A/a0, instruction: INSTRUCTION_EVAL <<=
06-29 07:58:02:989 [ info sync.csync.csync ]:	Update detection for remote replica took 0.004 seconds walking 13 files
06-29 07:58:02:990 [ info sync.engine ]:	#### Discovery end ####################################################  9 ms
06-29 07:58:02:990 [ info sync.database ]:	Updating file record for path: "A/a0" inode: 1935629 modtime: 1530259082 type: 0 etag: "1644a8c8b26" fileId: "16383ea4" remotePerm: "WDNVCKR" fileSize: 301 checksum: "SHA1:cc9adedebe27a6259efb8d6ed09f4f2eff559ad1"
06-29 07:58:02:990 [ info sync.csync.reconciler ]:	INSTRUCTION_UPDATE_METADATA    client file: A/a0
06-29 07:58:02:990 [ info sync.csync.csync ]:	Reconciliation for local replica took  0 seconds visiting  13  files.
06-29 07:58:02:990 [ info sync.csync.reconciler ]:	INSTRUCTION_UPDATE_METADATA    server dir:  A
06-29 07:58:02:990 [ info sync.csync.csync ]:	Reconciliation for remote replica took  0 seconds visiting  13  files.
06-29 07:58:02:990 [ info sync.engine ]:	#### Reconcile end ####################################################  9 ms
06-29 07:58:02:990 [ info sync.database ]:	Updating local metadata for: "A/a0" 1530259082 302 1935629
FAIL!  : TestChunkingNG::connectionDroppedBeforeEtagRecieved(small file) '!fakeFolder.syncOnce()' returned FALSE. ()
2020-08-13 16:46:08 +02:00
Olivier Goffart
c2324327ef TestChunkingNG: Make it faster
Use smaller files so the test run faster.
Particulary usefull for TestChunkingNG::connectionDroppedBeforeEtagRecieved
Which had become so much slower after 2638332dc6
increased the timeout for bigger files
2020-08-13 16:46:03 +02:00
Christian Kamm
c74c0d8e6e Upload: Add more chunk resuming unit tests #6405 2020-08-13 16:45:55 +02:00
Kevin Ottens
2684ba149e Merge pull request #2269 from nextcloud/enable_modernize_loop_convert
Enable the modernize-loop-convert check on clang-tidy
2020-08-13 16:37:41 +02:00
Kevin Ottens
866ffc2a6b Enable the modernize-loop-convert check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 12:55:14 +00:00
Kevin Ottens
a5b4922a0e Remove unused method
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 12:55:14 +00:00
Kevin Ottens
0e2af4b502 Enable the modernize-deprecated-headers check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 14:53:52 +02:00
Kevin Ottens
2f8c29082a Enable the modernize-use-equals-default check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-13 14:19:42 +02:00
Nextcloud bot
2d4d66b998 [tx-robot] updated from transifex 2020-08-13 03:30:50 +00:00
Kevin Ottens
cdf6e7d72b Enable the modernize-user-nullptr check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 19:45:25 +02:00
Kevin Ottens
3ff899cff9 Merge pull request #2264 from nextcloud/enable_modernize_use_using
Enable the modernize-use-using check on clang-tidy
2020-08-12 19:29:17 +02:00
Kevin Ottens
6ae1d0ddf6 Get rid of useless using constructs
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 18:18:57 +02:00
Kevin Ottens
97af14a4f0 Make QTokenizer use simpler by having optional second parameter
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 18:18:57 +02:00
Kevin Ottens
d58ec4bf70 Enable the modernize-use-using check on clang-tidy
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 18:18:57 +02:00
Kevin Ottens
7bb54e34d7 Merge pull request #2262 from nextcloud/enable_trivial_clang_tidy_modernize_checks
Enable "trivial" modernize clang-tidy checks
2020-08-12 17:16:38 +02:00
Kevin Ottens
07b7753216 Enable "trivial" modernize clang-tidy checks
This is a bunch of modernize checks which we don't hit at all. This is
an easy win and also make sure those old constructs won't creep up
behind our back.

Note that some of them won't trigger until we bump our C++ baseline
standard to C++17. But I'd say that's OK, that'll force our hand to do
those C++17 related cleanups when the time comes.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 13:13:08 +00:00
Kevin Ottens
1767c0295f Merge pull request #2037 from nextcloud/enable_modernize_raw_string_literal
Enable modernize raw string literal
2020-08-12 15:02:55 +02:00
Kevin Ottens
3e79e1861b We don't really need two \ here
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 09:48:33 +02:00
Kevin Ottens
c50a968a1e Add more raw string literals missed previously
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 09:48:29 +02:00
Kevin Ottens
ed1c2eaab4 Merge pull request #2247 from nextcloud/improve_drone_config
Improve drone config
2020-08-12 09:45:26 +02:00
Kevin Ottens
14bfa5025f Make sure wget looks for the certificates at the right place
Might happen because we got too many copies of OpenSSL around

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:13 +00:00
Kevin Ottens
571e15c6eb Switch to Ninja for the clang build
Clang is generally slower to compile than GCC so use a faster Make for
that build variant. This also allows us to verify our CMake files don't
do anything Make specific.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:13 +00:00
Kevin Ottens
5116f4d255 Parallelize the clang-tidy runs
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:13 +00:00
Kevin Ottens
db5c186202 Split cmake and compile into separate pipeline steps
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:13 +00:00
Kevin Ottens
725f1e742d Switch to actual commands inside of the steps
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:12 +00:00
Kevin Ottens
6da67ef653 Split the CI pipelines into proper steps
Will make it easier to navigate the logs

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:12 +00:00
Kevin Ottens
65407483e5 Now make sure we're not picking up generated headers
This could happen (and started to happen more with clang-tidy 10) that
clang-tidy picked up errors in headers from the build directory. Now
that we moved the build directory out of source, we can simply filter
headers based on the pwd.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:12 +00:00
Kevin Ottens
1e8340cd48 Move the build in a volume to be reused between steps
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:12 +00:00
Kevin Ottens
9016ffe4b7 Remove unneeded environment variables
Those are set by the base CI image anyway, no need to do the work again.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:12 +00:00
Kevin Ottens
be6a9dab01 Switch to the newer base CI image
We can now spare building QtKeychain over and over shortening a bit the
build. We also update to latest gcc and clang.

Note that I didn't switch the AppImage pipeline to the newer image to
keep the binary compatibility promise required by linuxdeployqt.
Probably would make sense to do a specific image for AppImage with some
other of the cleanups I did there (in particular to avoid building
qtkeychain every time).

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:12 +00:00
Kevin Ottens
d264f7078b Parallelize the CI build
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-12 06:45:12 +00:00
Nextcloud bot
c3cd06ddad [tx-robot] updated from transifex 2020-08-12 03:30:27 +00:00
Kevin Ottens
c5343e10f5 Merge pull request #2258 from nextcloud/have_a_way_to_display_e2ee_mnemonic
Keep the E2EE info message around to allow displaying mnemonic
2020-08-11 15:11:40 +02:00
Kevin Ottens
37e20698ca Keep the E2EE info message around to allow displaying mnemonic
We lost the ability to display the E2EE mnemonic during the GUI
redesign and the info message wasn't displayed again on restart. So now
we display it every time, it still can be dismissed and the button text
is different in such a case to make the intent clearer.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-11 14:55:51 +02:00
Nextcloud bot
a1dbfd71cb [tx-robot] updated from transifex 2020-08-11 03:30:03 +00:00
Kevin Ottens
d08c160b69 Merge pull request #2255 from nextcloud/restore_e2ee_old_key_storage_format_compatibility
Restore E2EE old key storage format compatibility
2020-08-10 16:07:06 +02:00
Kevin Ottens
ef3c516598 Add support for BASE64 encoded '|' when decrypting
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens
595eb78c8a Move the private key salt handling in its own function
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens
d5339265fb Ignore the salt part of the key during decryption
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens
54a19945fd Restore the symmetry between *StringSymmetric functions
If we receive data without base64 encoding for encryption, it makes
sense to get it without base64 encoding out of decryption.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Kevin Ottens
26b88131cc Add unit tests for the encryption helpers
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-10 13:13:19 +02:00
Nextcloud bot
aac1f2ae56 [tx-robot] updated from transifex 2020-08-09 03:29:44 +00:00
Nextcloud bot
7e2c3b2516 [tx-robot] updated from transifex 2020-08-08 03:31:51 +00:00
Kevin Ottens
a813602124 Master is now what will become 3.1
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-08-07 14:36:44 +02:00
Nextcloud bot
53f346fa9b [tx-robot] updated from transifex 2020-08-07 03:32:17 +00:00
255 changed files with 12816 additions and 4223 deletions

View File

@@ -1,22 +1,45 @@
Checks: '-*,
bugprone-*,
-bugprone-forward-declaration-namespace,
cppcoreguidelines-init-variables,
misc-*,
-misc-non-private-member-variables-in-classes,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-*,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-*,
modernize-return-braced-init-list,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-equals-delete,
modernize-use-nodiscard,
modernize-use-equals-default,
modernize-use-noexcept,
modernize-user-override,
modernize-use-nullptr,
modernize-use-transparent-functors,
modernize-use-uncaught-exceptions,
modernize-use-using,
'
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- key: bugprone-assert-side-effect.AssertMacros
value: 'assert;Q_ASSERT'
- key: bugprone-dangling-handle.HandleClasses
value: 'std::basic_string_view;std::experimental::basic_string_view;QStringView'
- key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression
value: 1
- key: modernize-use-default-member-init.UseAssignment
value: 1

View File

@@ -122,7 +122,7 @@ steps:
- name: build
image: nextcloudci/client-debian-ci:client-debian-ci-2
commands:
- /bin/bash -c "./admin/linux/debian/drone-build.sh"
- /bin/bash -c "./admin/linux/debian/drone-build.sh" || echo "[WARNING] Debian build failed but this is a non-blocking CI event"
environment:
DEBIAN_SECRET_KEY:
from_secret: DEBIAN_SECRET_KEY

3
.github/FUNDING.yml vendored
View File

@@ -1,3 +0,0 @@
# You can add one username per supported platform and one custom link
custom: https://www.bountysource.com/teams/nextcloud/issues?tracker_ids=74294474

View File

@@ -1,20 +1,41 @@
<!--
Dear user,
Please understand that at the moment, we are very busy with customer issues
and some high priority development work. A lot of issues are getting reported.
Right now we can't keep up and timely respond to all of them.
We're sorry for that and are expanding our team, if you're looking for a C++
job or know somebody who is, please point them to https://nextcloud.com/jobs
Don't forget that Github is not a support system or a place to ask for
features but only a place to report verified bugs - see nextcloud.com/support
for support options!
Thanks for reporting issues back to Nextcloud!
Note: This is the **issue tracker of Nextcloud**, please do NOT use this to get answers to your questions or get help for fixing your installation. This is a place to report bugs to developers, after your server has been debugged. You can find help debugging your system on our home user forums: https://help.nextcloud.com or, if you use Nextcloud in a large organization, ask our engineers on https://portal.nextcloud.com. See also https://nextcloud.com/support for support options.
Nextcloud is an open source project backed by Nextcloud GmbH. Most of our volunteers are home users and thus primarily care about issues that affect home users. Our paid engineers prioritize issues of our customers. If you are neither a home user nor a customer, consider paying somebody to fix your issue, do it yourself or become a customer.
Please understand that at the moment, we are very busy with customer issues and some high priority development work. A lot of issues are getting reported. We can't always keep up and timely respond to all of them, but we try!
Guidelines for submitting issues:
* Please search the existing issues first, it's likely that your issue was already reported or even fixed.
- Go to https://github.com/nextcloud and type any word in the top search/command bar. You probably see something like "We couldnt find any repositories matching ..." then click "Issues" in the left navigation.
- You can also filter by appending e. g. "state:open" to the search string.
- More info on search syntax within github: https://help.github.com/articles/searching-issues
* Please fill in as much of the template below as possible. We know it is a pain sometimes, but especially without logs there is often not much we can do: really, if we would have seen the issue you encoutered before, we would already have fixed it. So we did NOT see it, and we will need YOUR help to find out what is wrong and fix it. The logs are absoutely crucial for that. Expect us to quickly close issues without logs or other information we need. If you don't have time to gather the required information, we don't either.
Please also note that we have a https://nextcloud.com/contribute/code-of-conduct/ that applies on Github. To summarize it: please, be kind. We try our best to be nice, too. If you can't be bothered to be polite, please just don't bother to report issues as we won't feel motivated to help you. Remember, we don't get paid to help you!
-->
<!--- Please keep the note below for others who read your bug report -->
### How to use GitHub
* Please use the 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are affected by the same issue.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.
### Expected behaviour
Tell us what should happen
### Actual behaviour
Tell us what happens instead
<!--
Did you try end-to-end encryption before version 3.0? Following the instructions from this post might solve your problem since you might need to clean up the keys as that can break the functioning of >3.0 if you had a malformed key: https://help.nextcloud.com/t/help-test-the-latest-version-of-e2ee/87590
-->
### Steps to reproduce
1.
@@ -25,8 +46,8 @@ Tell us what happens instead
Client version:
<!---
Please try to only report a bug if it happens with the latest version
The latest version can be seen by checking https://download.nextcloud.com/desktop/
For support try our forums: https://help.nextcloud.com
The latest version can be seen by checking https://nextcloud.com/install/#install-clients
In the case of end-to-end encryption bug reports the client must be at least 3.0 and the server at least 19 with the end to end encryption app version at least 1.5.2.
--->
Operating system:
@@ -53,7 +74,9 @@ Storage backend (external storage):
Please use Gist (https://gist.github.com/) or a similar code paster for longer
logs.
1. Client logfile: Output of `nextcloud --logwindow` or `nextcloud --logfile log.txt`
1. Client logfile:
<!-- desktop client logs are a hard requirement for bug reports because we don't know how to do magic here :) -->
Output of `nextcloud --logdebug --logwindow` or `nextcloud --logdebug --logfile log.txt`
(On Windows using `cmd.exe`, you might need to first `cd` into the Nextcloud directory)
(See also https://docs.nextcloud.com/desktop/2.3/troubleshooting.html#log-files)

View File

@@ -199,5 +199,6 @@ X-GNOME-Autostart-Delay=3
# Translations
Icon[ko]=@APPLICATION_ICON_NAME@
Name[ko]=@APPLICATION_NAME@ 데스크톱 동기화 클라이언트
Comment[ko]=@APPLICATION_NAME@ 데스크톱 동기화 클라이언트
GenericName[ko]=폴더 동기화

View File

@@ -1,6 +1,6 @@
set( MIRALL_VERSION_MAJOR 3 )
set( MIRALL_VERSION_MINOR 0 )
set( MIRALL_VERSION_PATCH 3 )
set( MIRALL_VERSION_MINOR 1 )
set( MIRALL_VERSION_PATCH 0 )
set( MIRALL_VERSION_YEAR 2020 )
set( MIRALL_SOVERSION 0 )

View File

@@ -21,16 +21,16 @@ if [ $SUFFIX != "master" ]; then
SUFFIX="PR-$SUFFIX"
fi
#QtKeyChain master
#QtKeyChain v0.10.0
cd /build
git clone https://github.com/frankosterfeld/qtkeychain.git
cd qtkeychain
git checkout master
git checkout v0.10.0
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=/usr ../
make -j4
make DESTDIR=/app install
make install
#Build client
cd /build
@@ -39,8 +39,6 @@ cd build-client
cmake -D CMAKE_INSTALL_PREFIX=/usr \
-D NO_SHIBBOLETH=1 \
-D BUILD_UPDATER=ON \
-D QTKEYCHAIN_LIBRARY=/app/usr/lib/x86_64-linux-gnu/libqt5keychain.so \
-D QTKEYCHAIN_INCLUDE_DIR=/app/usr/include/qt5keychain/ \
-DMIRALL_VERSION_SUFFIX=PR-$DRONE_PULL_REQUEST \
-DMIRALL_VERSION_BUILD=$DRONE_BUILD_NUMBER \
$DRONE_WORKSPACE

View File

@@ -76,7 +76,7 @@ for distribution in ${UBUNTU_DISTRIBUTIONS} ${DEBIAN_DISTRIBUTIONS}; do
git merge ${DRONE_COMMIT}
admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} ${revdate}
admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} ${revdate} ${basever}
cat /tmp/tmpchangelog debian/changelog > debian/changelog.new
mv debian/changelog.new debian/changelog

View File

@@ -31,7 +31,7 @@ def getCommitVersion(commit):
try:
for line in subprocess.check_output(["git", "show",
commit + ":VERSION.cmake"]).splitlines():
m = re.match("set\( MIRALL_VERSION_([A-Z]+) +([0-9])+ *\)", line)
m = re.match("set\( MIRALL_VERSION_([A-Z]+) +([0-9]+) *\)", line)
if m is not None:
kind=m.group(1)
version=m.group(2)
@@ -48,7 +48,7 @@ def getCommitVersion(commit):
except:
return None
def collectEntries(baseCommit, baseVersion, kind, finalRevDate, config):
def collectEntries(baseCommit, baseVersion, kind, finalBaseVersion, finalRevDate, config):
newVersionCommit = None
newVersionTag = None
@@ -89,7 +89,6 @@ def collectEntries(baseCommit, baseVersion, kind, finalRevDate, config):
newVersionOrigTag = lastVersionTag
(baseVersion, _kind) = result
version=getCommitVersion(commit)
if version and version!=lastCMAKEVersion:
tag = "v" + version
@@ -119,6 +118,8 @@ def collectEntries(baseCommit, baseVersion, kind, finalRevDate, config):
revdate = datetime.datetime.now().strftime("%Y%m%d.%H%M%S")+ "." + commit
else:
revdate = finalRevDate
if finalBaseVersion is not None:
baseVersion = finalBaseVersion
entries[-1] = (commit, name, email, date, revdate, subject, baseVersion, kind)
entries.reverse()
@@ -167,8 +168,10 @@ if __name__ == "__main__":
distribution = sys.argv[2]
finalRevDate = sys.argv[3] if len(sys.argv)>3 else None
finalBaseVersion = sys.argv[4] if len(sys.argv)>4 else None
entries = collectEntries(baseCommit, baseVersion, "alpha", finalRevDate, config)
entries = collectEntries(baseCommit, baseVersion, "alpha",
finalBaseVersion, finalRevDate, config)
with open(sys.argv[1], "wt") as f:
(baseVersion, revdate, kind) = genChangeLogEntries(f, entries, distribution)

View File

@@ -34,9 +34,9 @@ StrCpy $UNINSTALL_ABORT "Uninstall aborted by user"
StrCpy $INIT_NO_QUICK_LAUNCH "Quick Launch Shortcut (N/A)"
StrCpy $INIT_NO_DESKTOP "Desktop Shortcut (overwrites existing)"
StrCpy $UAC_ERROR_ELEVATE "Unable to elevate, error:"
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "This installer requires admin access, try again"
StrCpy $UAC_INSTALLER_REQUIRE_ADMIN "This installer requires admin access, try again."
StrCpy $INIT_INSTALLER_RUNNING "The installer is already running."
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "This uninstaller requires admin access, try again"
StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "This uninstaller requires admin access, try again."
StrCpy $UAC_ERROR_LOGON_SERVICE "Logon service is not running, aborting!"
StrCpy $INIT_UNINSTALLER_RUNNING "The uninstaller is already running."
StrCpy $SectionGroup_Shortcuts "Shortcuts"

View File

@@ -1,50 +0,0 @@
# (c) 2014 Copyright ownCloud GmbH
# 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
# QTKEYCHAIN_INCLUDE_DIRS - The QtKeychain include directories
# QTKEYCHAIN_LIBRARIES - The libraries needed to use QtKeychain
# QTKEYCHAIN_DEFINITIONS - Compiler switches required for using LibXml2
# When we build our own Qt we also need to build QtKeychain with it
# so that it doesn't pull a different Qt version. For that reason
# first look in the Qt lib directory for QtKeychain.
get_target_property(_QTCORE_LIB_PATH Qt5::Core IMPORTED_LOCATION_RELEASE)
# Use PATH here because Debian 7.0 has CMake 2.8.9 and DIRECTORY is only available from 2.8.12+
get_filename_component(QT_LIB_DIR "${_QTCORE_LIB_PATH}" PATH)
find_path(QTKEYCHAIN_INCLUDE_DIR
NAMES
keychain.h
HINTS
${QT_LIB_DIR}/../include
PATH_SUFFIXES
qt5keychain
)
find_library(QTKEYCHAIN_LIBRARY
NAMES
qt5keychain
lib5qtkeychain
HINTS
${QT_LIB_DIR}
PATHS
/usr/lib
/usr/lib/${CMAKE_ARCH_TRIPLET}
/usr/local/lib
/opt/local/lib
${CMAKE_LIBRARY_PATH}
${CMAKE_INSTALL_PREFIX}/lib
)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set QTKEYCHAIN_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Qt5Keychain DEFAULT_MSG
QTKEYCHAIN_LIBRARY QTKEYCHAIN_INCLUDE_DIR)
mark_as_advanced(QTKEYCHAIN_INCLUDE_DIR QTKEYCHAIN_LIBRARY)

View File

@@ -2,8 +2,7 @@
#
# Once done this will define
# SPARKLE_FOUND - system has Sparkle
# SPARKLE_INCLUDE_DIR - the Sparkle include directory
# SPARKLE_LIBRARY - The library needed to use Sparkle
# SPARKLE_LIBRARY - The framework needed to use Sparkle
# Copyright (c) 2009, Vittorio Giovara <vittorio.giovara@gmail.com>
#
# Distributed under the OSI-approved BSD License (the "License");
@@ -15,9 +14,8 @@
include(FindPackageHandleStandardArgs)
find_path(SPARKLE_INCLUDE_DIR Sparkle.h)
find_library(SPARKLE_LIBRARY NAMES Sparkle)
find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY)
mark_as_advanced(SPARKLE_INCLUDE_DIR SPARKLE_LIBRARY)
find_package_handle_standard_args(Sparkle DEFAULT_MSG SPARKLE_LIBRARY)
mark_as_advanced(SPARKLE_LIBRARY)

View File

@@ -33,22 +33,31 @@ Some interesting values that can be set on the configuration file are:
+---------------------------------+---------------+--------------------------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``[General]`` section |
+=================================+===============+========================================================================================================+
| Variable | Default | Meaning |
+---------------------------------+---------------+--------------------------------------------------------------------------------------------------------+
| ``chunkSize`` | ``5242880`` | Specifies the chunk size of uploaded files in bytes. |
+---------------------------------+---------------+--------------------------------------------------------------------------------------------------------+
| ``promptDeleteAllFiles`` | ``true`` | If a UI prompt should ask for confirmation if it was detected that all files and folders were deleted. |
+---------------------------------+---------------+--------------------------------------------------------------------------------------------------------+
| ``maxLogLines`` | ``20000`` | Specifies the maximum number of log lines displayed in the log window. |
+---------------------------------+---------------+--------------------------------------------------------------------------------------------------------+
| ``timeout`` | ``300`` | The timeout for network connections in seconds. |
+---------------------------------+---------------+--------------------------------------------------------------------------------------------------------+
| ``moveToTrash`` | ``false`` | If non-locally deleted files should be moved to trash instead of deleting them completely. |
| | | This option only works on linux |
+---------------------------------+---------------+--------------------------------------------------------------------------------------------------------+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``[General]`` section |
+=================================+===============+=================================================================================================================+
| Variable | Default | Meaning |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``chunkSize`` | ``10000000`` (10 MB) | Specifies the chunk size of uploaded files in bytes. |
| | | The client will dynamically adjust this size within the maximum and minimum bounds (see below). |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``maxChunkSize`` | ``100000000`` (100 MB) | Specifies the maximum chunk size of uploaded files in bytes. |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``minChunkSize`` | ``1000000`` (1 MB) | Specifies the minimum chunk size of uploaded files in bytes. |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``targetChunkUploadDuration`` | ``6000`` (1 minute) | Target duration in milliseconds for chunk uploads. |
| | | The client adjusts the chunk size until each chunk upload takes approximately this long. |
| | | Set to 0 to disable dynamic chunk sizing. |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``promptDeleteAllFiles`` | ``true`` | If a UI prompt should ask for confirmation if it was detected that all files and folders were deleted. |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``maxLogLines`` | ``20000`` | Specifies the maximum number of log lines displayed in the log window. |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``timeout`` | ``300`` | The timeout for network connections in seconds. |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
| ``moveToTrash`` | ``false`` | If non-locally deleted files should be moved to trash instead of deleting them completely. |
| | | This option only works on linux |
+---------------------------------+------------------------+--------------------------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------------------------------------------------------------------------+

View File

@@ -153,10 +153,42 @@ Saving Files Directly
The Nextcloud client enables you to save log files directly to a predefined file
or directory. This is a useful option for troubleshooting sporadic issues as
it enables you to log large amounts of data and bypasses the limited buffer
it enables you to log large amounts of data and bypass the limited buffer
settings associated with the log window.
To save log files to a file or a directory:
To enable logging to a directory, stop the client and add the following to the General section in the configuration file:
```
[General]
logDebug=true
logExpire=<hours>
logDir=<dir>
```
.. note:: Independent of platform you must use slash (/) as a path reparator:
* Correct: C:/Temp
* Not correct: C:\Temp
As an example, to keep log data for two days in a directory called temp:
```
[General]
logDebug=true
logExpire=48
logDir=C:/Temp
```
Once you restart the client, you will find the log file in the ``<dir>`` defined in ``logDir``.
.. note:: You will find the configuration file in the following locations:
* Microsoft Windows systems: ``%APPDATA%\Nextcloud\nextcloud.cfg``
* macOS systems: ``$HOME/Library/Preferences/Nextcloud/nextcloud.cfg``
* Linux distributions: ``$HOME/.config/Nextcloud/nextcloud.cfg``
Alternatively, you can start the client in the command line with parameters:
1. To save to a file, start the client using the ``--logfile <file>`` command,
where ``<file>`` is the filename to which you want to save the file.
@@ -177,21 +209,6 @@ issue the following command:
nextcloud --logdir /tmp/nextcloud_logs --logexpire 48
```
Alternatively, you can add the following to the configuration file:
```
logDebug=true
logExpire=<hours>
logDir=<dir>
```
Once you restart the client, you will find the log file in the ``<dir>`` defined in ``logDir``.
.. note:: You will find the configuration file in the following locations:
* Microsoft Windows systems: ``%APPDATA%\Nextcloud\nextcloud.cfg``
* macOS systems: ``$HOME/Library/Preferences/Nextcloud/nextcloud.cfg``
* Linux distributions: ``$HOME/.config/Nextcloud/nextcloud.cfg``
Nextcloud server Log File
~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -5,5 +5,6 @@
<file>src/gui/tray/HeaderButton.qml</file>
<file>theme/Style/Style.qml</file>
<file>theme/Style/qmldir</file>
<file>src/gui/tray/ActivityActionButton.qml</file>
</qresource>
</RCC>

View File

@@ -30,7 +30,7 @@ class OwncloudDolphinPlugin : public KOverlayIconPlugin
Q_PLUGIN_METADATA(IID "com.owncloud.ovarlayiconplugin" FILE "ownclouddolphinoverlayplugin.json")
Q_OBJECT
typedef QHash<QByteArray, QByteArray> StatusMap;
using StatusMap = QHash<QByteArray, QByteArray>;
StatusMap m_status;
public:

View File

@@ -83,7 +83,7 @@ HRESULT NCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
wchar_t szSubkey[MAX_PATH];
// Create the HKCR\CLSID\{<CLSID>} key.
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), L"CLSID\\%s", szCLSID);
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), LR"(CLSID\%s)", szCLSID);
if (SUCCEEDED(hr))
{
hr = SetHKCRRegistryKeyAndValue(szSubkey, nullptr, pszFriendlyName);
@@ -92,7 +92,7 @@ HRESULT NCContextMenuRegHandler::RegisterInprocServer(PCWSTR pszModule, const CL
if (SUCCEEDED(hr))
{
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
L"CLSID\\%s\\InprocServer32", szCLSID);
LR"(CLSID\%s\InprocServer32)", szCLSID);
if (SUCCEEDED(hr))
{
// Set the default value of the InprocServer32 key to the
@@ -121,7 +121,7 @@ HRESULT NCContextMenuRegHandler::UnregisterInprocServer(const CLSID& clsid)
wchar_t szSubkey[MAX_PATH];
// Delete the HKCR\CLSID\{<CLSID>} key.
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), L"CLSID\\%s", szCLSID);
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey), LR"(CLSID\%s)", szCLSID);
if (SUCCEEDED(hr))
{
hr = HRESULT_FROM_WIN32(RegDelnode(HKEY_CLASSES_ROOT, szSubkey));
@@ -165,7 +165,7 @@ HRESULT NCContextMenuRegHandler::RegisterShellExtContextMenuHandler(
// Create the key HKCR\<File Type>\shellex\ContextMenuHandlers\{friendlyName>}
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
L"%s\\shellex\\ContextMenuHandlers\\%s", pszFileType, pszFriendlyName);
LR"(%s\shellex\ContextMenuHandlers\%s)", pszFileType, pszFriendlyName);
if (SUCCEEDED(hr))
{
// Set the default value of the key.
@@ -206,7 +206,7 @@ HRESULT NCContextMenuRegHandler::UnregisterShellExtContextMenuHandler(
// Remove the HKCR\<File Type>\shellex\ContextMenuHandlers\{friendlyName} key.
hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
L"%s\\shellex\\ContextMenuHandlers\\%s", pszFileType, pszFriendlyName);
LR"(%s\shellex\ContextMenuHandlers\%s)", pszFileType, pszFriendlyName);
if (SUCCEEDED(hr))
{
hr = HRESULT_FROM_WIN32(RegDelnode(HKEY_CLASSES_ROOT, szSubkey));

View File

@@ -113,23 +113,23 @@ void QProgressIndicator::paintEvent(QPaintEvent * /*event*/)
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
int outerRadius = (width-1)*0.5;
int innerRadius = (width-1)*0.5*0.38;
int outerRadius = qRound((width - 1) * 0.5);
int innerRadius = qRound((width - 1) * 0.5 * 0.38);
int capsuleHeight = outerRadius - innerRadius;
int capsuleWidth = (width > 32 ) ? capsuleHeight *.23 : capsuleHeight *.35;
int capsuleWidth = qRound((width > 32 ) ? capsuleHeight * 0.23 : capsuleHeight * 0.35);
int capsuleRadius = capsuleWidth/2;
for (int i=0; i<12; i++)
{
QColor color = m_color;
color.setAlphaF(1.0f - (i/12.0f));
color.setAlphaF(1.0f - (static_cast<float>(i) / 12.0f));
p.setPen(Qt::NoPen);
p.setBrush(color);
p.save();
p.translate(rect().center());
p.rotate(m_angle - i*30.0f);
p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
p.rotate(m_angle - i * 30);
p.drawRoundedRect(qRound(-capsuleWidth * 0.5), -(innerRadius + capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
p.restore();
}
}

View File

@@ -42,7 +42,7 @@ class QProgressIndicator : public QWidget
Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
QProgressIndicator(QWidget* parent = 0);
QProgressIndicator(QWidget* parent = nullptr);
/*! Returns the delay between animation steps.
\return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.

View File

@@ -197,9 +197,9 @@ void KMessageWidgetPrivate::applyStyleSheet()
const QColor border = bgBaseColor;
// Generate a final background color from overlaying bgBaseColor over windowColor
const int newRed = (bgBaseColor.red() * bgBaseColorAlpha) + (windowColor.red() * (1 - bgBaseColorAlpha));
const int newGreen = (bgBaseColor.green() * bgBaseColorAlpha) + (windowColor.green() * (1 - bgBaseColorAlpha));
const int newBlue = (bgBaseColor.blue() * bgBaseColorAlpha) + (windowColor.blue() * (1 - bgBaseColorAlpha));
const int newRed = qRound(bgBaseColor.red() * bgBaseColorAlpha) + qRound(windowColor.red() * (1 - bgBaseColorAlpha));
const int newGreen = qRound(bgBaseColor.green() * bgBaseColorAlpha) + qRound(windowColor.green() * (1 - bgBaseColorAlpha));
const int newBlue = qRound(bgBaseColor.blue() * bgBaseColorAlpha) + qRound(windowColor.blue() * (1 - bgBaseColorAlpha));
const QColor bgFinalColor = QColor(newRed, newGreen, newBlue);
@@ -241,7 +241,7 @@ void KMessageWidgetPrivate::updateSnapShot()
void KMessageWidgetPrivate::slotTimeLineChanged(qreal value)
{
q->setFixedHeight(qMin(value * 2, qreal(1.0)) * content->height());
q->setFixedHeight(qMin(qRound(value * 2.0), 1) * content->height());
q->update();
}

View File

@@ -29,8 +29,8 @@
#include "qtlockedfile.h"
#include <string.h>
#include <errno.h>
#include <cstring>
#include <cerrno>
#include <unistd.h>
#include <fcntl.h>

View File

@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
template <class T, class const_iterator>
struct QTokenizerPrivate {
typedef typename T::value_type char_type;
using char_type = typename T::value_type;
struct State {
bool inQuote = false;
@@ -110,10 +110,10 @@ struct QTokenizerPrivate {
bool returnQuotes;
};
template <class T, class const_iterator>
template <class T, class const_iterator = typename T::const_iterator>
class QTokenizer {
public:
typedef typename T::value_type char_type;
using char_type = typename T::value_type;
/*!
\class QTokenizer
@@ -220,7 +220,7 @@ public:
Use \c hasNext() to fetch the next token.
*/
T next() const {
int len = d->tokenEnd-d->tokenBegin;
int len = std::distance(d->tokenBegin, d->tokenEnd);
const_iterator tmpStart = d->tokenBegin;
if (!d->returnQuotes && len > 1 && d->isQuote(*d->tokenBegin)) {
tmpStart++;
@@ -234,7 +234,7 @@ private:
QSharedPointer<QTokenizerPrivate<T, const_iterator> > d;
};
class QStringTokenizer : public QTokenizer<QString, QString::const_iterator> {
class QStringTokenizer : public QTokenizer<QString> {
public:
QStringTokenizer(const QString &string, const QString &delim) :
QTokenizer<QString, QString::const_iterator>(string, delim) {}
@@ -243,8 +243,9 @@ public:
* @return A reference to the token within the string
*/
QStringRef stringRef() {
int begin = d->tokenBegin-d->begin;
int end = d->tokenEnd-d->tokenBegin;
// If those differences overflow an int we'd have a veeeeeery long string in memory
int begin = std::distance(d->begin, d->tokenBegin);
int end = std::distance(d->tokenBegin, d->tokenEnd);
if (!d->returnQuotes && d->isQuote(*d->tokenBegin)) {
begin++;
end -= 2;
@@ -253,9 +254,9 @@ public:
}
};
typedef QTokenizer<QByteArray, QByteArray::const_iterator> QByteArrayTokenizer;
typedef QTokenizer<std::string, std::string::const_iterator> StringTokenizer;
typedef QTokenizer<std::wstring, std::wstring::const_iterator> WStringTokenizer;
using QByteArrayTokenizer = QTokenizer<QByteArray>;
using StringTokenizer = QTokenizer<std::string>;
using WStringTokenizer = QTokenizer<std::wstring>;
QT_END_NAMESPACE

View File

@@ -36,12 +36,12 @@
#if defined(Q_OS_WIN)
#include <QLibrary>
#include <qt_windows.h>
typedef BOOL(WINAPI*PProcessIdToSessionId)(DWORD,DWORD*);
using PProcessIdToSessionId = BOOL (WINAPI*)(DWORD, DWORD*);
static PProcessIdToSessionId pProcessIdToSessionId = 0;
#endif
#if defined(Q_OS_UNIX)
#include <time.h>
#include <ctime>
#include <unistd.h>
#endif

View File

@@ -40,7 +40,7 @@ class QtLocalPeer : public QObject
Q_OBJECT
public:
explicit QtLocalPeer(QObject *parent = 0, const QString &appId = QString());
explicit QtLocalPeer(QObject *parent = nullptr, const QString &appId = QString());
bool isClient();
bool sendMessage(const QString &message, int timeout, bool block);
QString applicationId() const

View File

@@ -293,8 +293,8 @@ void selectiveSyncFixup(OCC::SyncJournalDb *journal, const QStringList &newList)
auto oldBlackListSet = journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok).toSet();
if (ok) {
auto blackListSet = newList.toSet();
auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
foreach (const auto &it, changes) {
const auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
for (const auto &it : changes) {
journal->avoidReadFromDbOnNextSync(it);
}
@@ -499,7 +499,7 @@ restart_sync:
}
Cmd cmd;
QString dbPath = SyncJournalDb::makeDbName(credentialFreeUrl, folder, user);
QString dbPath = options.source_dir + SyncJournalDb::makeDbName(options.source_dir, credentialFreeUrl, folder, user);
SyncJournalDb db(dbPath);
if (!selectiveSyncList.empty()) {

View File

@@ -27,7 +27,7 @@ namespace OCC {
class NetrcParser
{
public:
typedef QPair<QString, QString> LoginPair;
using LoginPair = QPair<QString, QString>;
NetrcParser(const QString &file = QString());
bool parse();

View File

@@ -27,7 +27,7 @@ bool SimpleSslErrorHandler::handleErrors(QList<QSslError> errors, const QSslConf
return false;
}
foreach (QSslError error, errors) {
for (const auto &error : qAsConst(errors)) {
certs->append(error.certificate());
}
return true;

View File

@@ -24,7 +24,7 @@
#ifndef _C_JHASH_H
#define _C_JHASH_H
#include <stdint.h>
#include <stdint.h> // NOLINT
#define c_hashsize(n) ((uint8_t) 1 << (n))
#define c_hashmask(n) (xhashsize(n) - 1)
@@ -57,15 +57,15 @@
*/
#define _c_mix(a,b,c) \
{ \
a -= b; a -= c; a ^= (c>>13); \
b -= c; b -= a; b ^= (a<<8); \
c -= a; c -= b; c ^= (b>>13); \
a -= b; a -= c; a ^= (c>>12); \
b -= c; b -= a; b ^= (a<<16); \
c -= a; c -= b; c ^= (b>>5); \
a -= b; a -= c; a ^= (c>>3); \
b -= c; b -= a; b ^= (a<<10); \
c -= a; c -= b; c ^= (b>>15); \
(a) -= (b); (a) -= (c); (a) ^= ((c)>>13); \
(b) -= (c); (b) -= (a); (b) ^= ((a)<<8); \
(c) -= (a); (c) -= (b); (c) ^= ((b)>>13); \
(a) -= (b); (a) -= (c); (a) ^= ((c)>>12); \
(b) -= (c); (b) -= (a); (b) ^= ((a)<<16); \
(c) -= (a); (c) -= (b); (c) ^= ((b)>>5); \
(a) -= (b); (a) -= (c); (a) ^= ((c)>>3); \
(b) -= (c); (b) -= (a); (b) ^= ((a)<<10); \
(c) -= (a); (c) -= (b); (c) ^= ((b)>>15); \
}
/**
@@ -88,18 +88,18 @@
*/
#define _c_mix64(a,b,c) \
{ \
a -= b; a -= c; a ^= (c>>43); \
b -= c; b -= a; b ^= (a<<9); \
c -= a; c -= b; c ^= (b>>8); \
a -= b; a -= c; a ^= (c>>38); \
b -= c; b -= a; b ^= (a<<23); \
c -= a; c -= b; c ^= (b>>5); \
a -= b; a -= c; a ^= (c>>35); \
b -= c; b -= a; b ^= (a<<49); \
c -= a; c -= b; c ^= (b>>11); \
a -= b; a -= c; a ^= (c>>12); \
b -= c; b -= a; b ^= (a<<18); \
c -= a; c -= b; c ^= (b>>22); \
(a) -= (b); (a) -= (c); (a) ^= ((c)>>43); \
(b) -= (c); (b) -= (a); (b) ^= ((a)<<9); \
(c) -= (a); (c) -= (b); (c) ^= ((b)>>8); \
(a) -= (b); (a) -= (c); (a) ^= ((c)>>38); \
(b) -= (c); (b) -= (a); (b) ^= ((a)<<23); \
(c) -= (a); (c) -= (b); (c) ^= ((b)>>5); \
(a) -= (b); (a) -= (c); (a) ^= ((c)>>35); \
(b) -= (c); (b) -= (a); (b) ^= ((a)<<49); \
(c) -= (a); (c) -= (b); (c) ^= ((b)>>11); \
(a) -= (b); (a) -= (c); (a) ^= ((c)>>12); \
(b) -= (c); (b) -= (a); (b) ^= ((a)<<18); \
(c) -= (a); (c) -= (b); (c) ^= ((b)>>22); \
}
/**

View File

@@ -70,7 +70,7 @@ class OCSYNC_EXPORT ComputeChecksum : public QObject
{
Q_OBJECT
public:
explicit ComputeChecksum(QObject *parent = 0);
explicit ComputeChecksum(QObject *parent = nullptr);
/**
* Sets the checksum type to be used. The default is empty.
@@ -112,7 +112,7 @@ class OCSYNC_EXPORT ValidateChecksumHeader : public QObject
{
Q_OBJECT
public:
explicit ValidateChecksumHeader(QObject *parent = 0);
explicit ValidateChecksumHeader(QObject *parent = nullptr);
/**
* Check a file's actual checksum against the provided checksumHeader

View File

@@ -107,7 +107,7 @@ namespace FileSystem {
* Equivalent to QFile::remove(), except on Windows, where it will also
* successfully remove read-only files.
*/
bool OCSYNC_EXPORT remove(const QString &fileName, QString *errorString = 0);
bool OCSYNC_EXPORT remove(const QString &fileName, QString *errorString = nullptr);
/**
* Move the specified file or folder to the trash. (Only implemented on linux)
@@ -175,10 +175,10 @@ namespace FileSystem {
if( str[0] == '/' || str[0] == '\\' ) {
// Don't prepend if already UNC
if( !(len > 1 && (str[1] == '/' || str[1] == '\\')) ) {
longStr.append("\\\\?");
longStr.append(R"(\\?)");
}
} else {
longStr.append("\\\\?\\"); // prepend string by this four magic chars.
longStr.append(R"(\\?\)"); // prepend string by this four magic chars.
}
longStr += str;

View File

@@ -43,9 +43,7 @@ namespace OCC {
Q_LOGGING_CATEGORY(lcSql, "nextcloud.sync.database.sql", QtInfoMsg)
SqlDatabase::SqlDatabase()
{
}
SqlDatabase::SqlDatabase() = default;
SqlDatabase::~SqlDatabase()
{
@@ -369,14 +367,14 @@ void SqlQuery::bindValue(int pos, const QVariant &value)
const QDateTime dateTime = value.toDateTime();
const QString str = dateTime.toString(QLatin1String("yyyy-MM-ddThh:mm:ss.zzz"));
res = sqlite3_bind_text16(_stmt, pos, str.utf16(),
str.size() * sizeof(ushort), SQLITE_TRANSIENT);
str.size() * static_cast<int>(sizeof(ushort)), SQLITE_TRANSIENT);
break;
}
case QVariant::Time: {
const QTime time = value.toTime();
const QString str = time.toString(QLatin1String("hh:mm:ss.zzz"));
res = sqlite3_bind_text16(_stmt, pos, str.utf16(),
str.size() * sizeof(ushort), SQLITE_TRANSIENT);
str.size() * static_cast<int>(sizeof(ushort)), SQLITE_TRANSIENT);
break;
}
case QVariant::String: {
@@ -384,7 +382,7 @@ void SqlQuery::bindValue(int pos, const QVariant &value)
// lifetime of string == lifetime of its qvariant
const auto *str = static_cast<const QString *>(value.constData());
res = sqlite3_bind_text16(_stmt, pos, str->utf16(),
(str->size()) * sizeof(QChar), SQLITE_TRANSIENT);
(str->size()) * static_cast<int>(sizeof(QChar)), SQLITE_TRANSIENT);
} else {
res = sqlite3_bind_null(_stmt, pos);
}
@@ -399,7 +397,7 @@ void SqlQuery::bindValue(int pos, const QVariant &value)
QString str = value.toString();
// SQLITE_TRANSIENT makes sure that sqlite buffers the data
res = sqlite3_bind_text16(_stmt, pos, str.utf16(),
(str.size()) * sizeof(QChar), SQLITE_TRANSIENT);
(str.size()) * static_cast<int>(sizeof(QChar)), SQLITE_TRANSIENT);
break;
}
}

View File

@@ -23,7 +23,6 @@
#include <QElapsedTimer>
#include <QUrl>
#include <QDir>
#include <QStandardPaths>
#include <sqlite3.h>
#include "common/syncjournaldb.h"
@@ -104,15 +103,11 @@ SyncJournalDb::SyncJournalDb(const QString &dbFilePath, QObject *parent)
}
}
QString SyncJournalDb::makeDbName(const QUrl &remoteUrl,
QString SyncJournalDb::makeDbName(const QString &localPath,
const QUrl &remoteUrl,
const QString &remotePath,
const QString &user)
{
const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if (!QDir(dbPath).exists()) {
QDir().mkdir(dbPath);
}
QString journalPath = QLatin1String("._sync_");
QString key = QString::fromUtf8("%1@%2:%3").arg(user, remoteUrl.toString(), remotePath);
@@ -121,16 +116,17 @@ QString SyncJournalDb::makeDbName(const QUrl &remoteUrl,
journalPath.append(ba.left(6).toHex());
journalPath.append(".db");
journalPath = dbPath + QLatin1Char('/') + journalPath;
// If the journal doesn't exist and we can't create a file
// at that location, try again with a journal name that doesn't
// have the ._ prefix.
//
// The disadvantage of that filename is that it will only be ignored
// by client versions >2.3.2.
//
// See #5633: "._*" is often forbidden on samba shared folders.
// If it exists already, the path is clearly usable
QFile file(QDir(dbPath).filePath(journalPath));
QFile file(QDir(localPath).filePath(journalPath));
if (file.exists()) {
return journalPath;
}
@@ -145,7 +141,7 @@ QString SyncJournalDb::makeDbName(const QUrl &remoteUrl,
// Can we create it if we drop the underscore?
QString alternateJournalPath = journalPath.mid(2).prepend(".");
QFile file2(QDir(dbPath).filePath(alternateJournalPath));
QFile file2(QDir(localPath).filePath(alternateJournalPath));
if (file2.open(QIODevice::ReadWrite)) {
// The alternative worked, use it
qCInfo(lcDb) << "Using alternate database path" << alternateJournalPath;
@@ -729,10 +725,10 @@ bool SyncJournalDb::updateMetadataTableStructure()
SqlQuery query(_db);
query.prepare("ALTER TABLE metadata ADD COLUMN isE2eEncrypted INTEGER;");
if (!query.exec()) {
sqlFail("updateMetadataTableStructure: add e2eMangledName column", query);
sqlFail("updateMetadataTableStructure: add isE2eEncrypted column", query);
re = false;
}
commitInternal("update database structure: add e2eMangledName col");
commitInternal("update database structure: add isE2eEncrypted col");
}
if (!tableColumns("uploadinfo").contains("contentChecksum")) {
@@ -1456,7 +1452,7 @@ SyncJournalDb::UploadInfo SyncJournalDb::getUploadInfo(const QString &file)
if (_getUploadInfoQuery.next()) {
bool ok = true;
res._chunk = _getUploadInfoQuery.intValue(0);
res._transferid = _getUploadInfoQuery.intValue(1);
res._transferid = _getUploadInfoQuery.int64Value(1);
res._errorCount = _getUploadInfoQuery.intValue(2);
res._size = _getUploadInfoQuery.int64Value(3);
res._modtime = _getUploadInfoQuery.int64Value(4);
@@ -2031,6 +2027,23 @@ QByteArrayList SyncJournalDb::conflictRecordPaths()
return paths;
}
QByteArray SyncJournalDb::conflictFileBaseName(const QByteArray &conflictName)
{
auto conflict = conflictRecord(conflictName);
QByteArray result;
if (conflict.isValid()) {
getFileRecordsByFileId(conflict.baseFileId, [&result](const SyncJournalFileRecord &record) {
if (!record._path.isEmpty())
result = record._path;
});
}
if (result.isEmpty()) {
result = Utility::conflictFileBaseNameFromPattern(conflictName);
}
return result;
}
void SyncJournalDb::clearFileTable()
{
QMutexLocker lock(&_mutex);

View File

@@ -42,11 +42,12 @@ class OCSYNC_EXPORT SyncJournalDb : public QObject
{
Q_OBJECT
public:
explicit SyncJournalDb(const QString &dbFilePath, QObject *parent = 0);
explicit SyncJournalDb(const QString &dbFilePath, QObject *parent = nullptr);
virtual ~SyncJournalDb();
/// Create a journal path for a specific configuration
static QString makeDbName(const QUrl &remoteUrl,
static QString makeDbName(const QString &localPath,
const QUrl &remoteUrl,
const QString &remotePath,
const QString &user);
@@ -94,7 +95,7 @@ public:
struct UploadInfo
{
int _chunk = 0;
int _transferid = 0;
quint64 _transferid = 0;
quint64 _size = 0; //currently unused
qint64 _modtime = 0;
int _errorCount = 0;
@@ -225,6 +226,13 @@ public:
/// Return all paths of files with a conflict tag in the name and records in the db
QByteArrayList conflictRecordPaths();
/** Find the base name for a conflict file name, using journal or name pattern
*
* The path must be sync-folder relative.
*
* Will return an empty string if it's not even a conflict file by pattern.
*/
QByteArray conflictFileBaseName(const QByteArray &conflictName);
/**
* Delete any file entry. This will force the next sync to re-sync everything as if it was new,

View File

@@ -21,9 +21,7 @@
namespace OCC {
SyncJournalFileRecord::SyncJournalFileRecord()
{
}
SyncJournalFileRecord::SyncJournalFileRecord() = default;
QByteArray SyncJournalFileRecord::numericFileId() const
{

View File

@@ -44,8 +44,8 @@
#include <unistd.h>
#endif
#include <math.h>
#include <stdarg.h>
#include <cmath>
#include <cstdarg>
#include <cstring>
#if defined(Q_OS_WIN)
@@ -190,6 +190,13 @@ QByteArray Utility::userAgentString()
return re.toLatin1();
}
QByteArray Utility::friendlyUserAgentString()
{
const auto pattern = QStringLiteral("%1 (Desktop Client - %2)");
const auto userAgent = pattern.arg(QSysInfo::machineHostName(), platform());
return userAgent.toUtf8();
}
bool Utility::hasLaunchOnStartup(const QString &appName)
{
return hasLaunchOnStartup_private(appName);
@@ -407,7 +414,7 @@ uint Utility::convertSizeToUint(size_t &convertVar)
return static_cast<uint>(convertVar);
}
uint Utility::convertSizeToInt(size_t &convertVar)
int Utility::convertSizeToInt(size_t &convertVar)
{
if (convertVar > INT_MAX) {
//throw std::bad_cast();
@@ -634,7 +641,7 @@ bool Utility::isConflictFile(const QString &name)
return false;
}
QByteArray Utility::conflictFileBaseName(const QByteArray &conflictName)
QByteArray Utility::conflictFileBaseNameFromPattern(const QByteArray &conflictName)
{
// This function must be able to deal with conflict files for conflict files.
// To do this, we scan backwards, for the outermost conflict marker and
@@ -666,7 +673,7 @@ QByteArray Utility::conflictFileBaseName(const QByteArray &conflictName)
QString Utility::sanitizeForFileName(const QString &name)
{
const auto invalid = QStringLiteral("/?<>\\:*|\"");
const auto invalid = QStringLiteral(R"(/?<>\:*|")");
QString result;
result.reserve(name.size());
for (const auto c : name) {

View File

@@ -30,11 +30,11 @@
#include <QMap>
#include <QUrl>
#include <QUrlQuery>
#include <QtQuick/QQuickImageProvider>
#include <functional>
#include <memory>
#ifdef Q_OS_WIN
#include <QRect>
#include <windows.h>
#endif
@@ -42,6 +42,8 @@ class QSettings;
namespace OCC {
class SyncJournal;
Q_DECLARE_LOGGING_CATEGORY(lcUtility)
/** \addtogroup libsync
@@ -55,10 +57,11 @@ namespace Utility {
OCSYNC_EXPORT bool writeRandomFile(const QString &fname, int size = -1);
OCSYNC_EXPORT QString octetsToString(qint64 octets);
OCSYNC_EXPORT QByteArray userAgentString();
OCSYNC_EXPORT QByteArray friendlyUserAgentString();
OCSYNC_EXPORT bool hasLaunchOnStartup(const QString &appName);
OCSYNC_EXPORT void setLaunchOnStartup(const QString &appName, const QString &guiName, bool launch);
OCSYNC_EXPORT uint convertSizeToUint(size_t &convertVar);
OCSYNC_EXPORT uint convertSizeToInt(size_t &convertVar);
OCSYNC_EXPORT int convertSizeToInt(size_t &convertVar);
#ifdef Q_OS_WIN
OCSYNC_EXPORT DWORD convertSizeToDWORD(size_t &convertVar);
@@ -188,7 +191,7 @@ namespace Utility {
/** Returns a new settings pre-set in a specific group. The Settings will be created
with the given parent. If no parent is specified, the caller must destroy the settings */
OCSYNC_EXPORT std::unique_ptr<QSettings> settingsWithGroup(const QString &group, QObject *parent = 0);
OCSYNC_EXPORT std::unique_ptr<QSettings> settingsWithGroup(const QString &group, QObject *parent = nullptr);
/** Sanitizes a string that shall become part of a filename.
*
@@ -214,16 +217,17 @@ namespace Utility {
OCSYNC_EXPORT bool isConflictFile(const char *name);
OCSYNC_EXPORT bool isConflictFile(const QString &name);
/** Find the base name for a conflict file name
/** Find the base name for a conflict file name, using name pattern only
*
* Will return an empty string if it's not a conflict file.
*
* Prefer to use the data from the conflicts table in the journal to determine
* a conflict's base file.
* a conflict's base file, see SyncJournal::conflictFileBaseName()
*/
OCSYNC_EXPORT QByteArray conflictFileBaseName(const QByteArray &conflictName);
OCSYNC_EXPORT QByteArray conflictFileBaseNameFromPattern(const QByteArray &conflictName);
#ifdef Q_OS_WIN
OCSYNC_EXPORT bool registryKeyExists(HKEY hRootKey, const QString &subKey);
OCSYNC_EXPORT QVariant registryGetKeyValue(HKEY hRootKey, const QString &subKey, const QString &valueName);
OCSYNC_EXPORT bool registrySetKeyValue(HKEY hRootKey, const QString &subKey, const QString &valueName, DWORD type, const QVariant &value);
OCSYNC_EXPORT bool registryDeleteKeyTree(HKEY hRootKey, const QString &subKey);

View File

@@ -24,7 +24,7 @@ namespace OCC {
static void setupFavLink_private(const QString &folder)
{
// Nautilus: add to ~/.gtk-bookmarks
QFile gtkBookmarks(QDir::homePath() + QLatin1String("/.gtk-bookmarks"));
QFile gtkBookmarks(QDir::homePath() + QLatin1String("/.config/gtk-3.0/bookmarks"));
QByteArray folderUrl = "file://" + folder.toUtf8();
if (gtkBookmarks.open(QFile::ReadWrite)) {
QByteArray places = gtkBookmarks.readAll();
@@ -47,6 +47,7 @@ QString getUserAutostartDir_private()
bool hasLaunchOnStartup_private(const QString &appName)
{
Q_UNUSED(appName)
QString desktopFileLocation = getUserAutostartDir_private()
+ QLatin1String(LINUX_APPLICATION_ID)
+ QLatin1String(".desktop");
@@ -55,6 +56,7 @@ bool hasLaunchOnStartup_private(const QString &appName)
void setLaunchOnStartup_private(const QString &appName, const QString &guiName, bool enable)
{
Q_UNUSED(appName)
QString userAutoStartPath = getUserAutostartDir_private();
QString desktopFileLocation = userAutoStartPath
+ QLatin1String(LINUX_APPLICATION_ID)

View File

@@ -25,7 +25,7 @@
#include <string>
#include <QLibrary>
static const char runPathC[] = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
static const char runPathC[] = R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)";
namespace OCC {
@@ -91,7 +91,7 @@ void setLaunchOnStartup_private(const QString &appName, const QString &guiName,
static inline bool hasDarkSystray_private()
{
if(Utility::registryGetKeyValue( HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
R"(Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)",
"SystemUsesLightTheme" ) == 1) {
return false;
}
@@ -114,6 +114,17 @@ QRect Utility::getTaskbarDimensions()
return QRect(barRect.left, barRect.top, (barRect.right - barRect.left), (barRect.bottom - barRect.top));
}
bool Utility::registryKeyExists(HKEY hRootKey, const QString &subKey)
{
HKEY hKey;
REGSAM sam = KEY_READ | KEY_WOW64_64KEY;
LONG result = RegOpenKeyEx(hRootKey, reinterpret_cast<LPCWSTR>(subKey.utf16()), 0, sam, &hKey);
RegCloseKey(hKey);
return result != ERROR_FILE_NOT_FOUND;
}
QVariant Utility::registryGetKeyValue(HKEY hRootKey, const QString &subKey, const QString &valueName)
{
QVariant value;

View File

@@ -25,13 +25,13 @@
#define _GNU_SOURCE
#endif
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <sys/types.h>
#include <stdbool.h>
#include "c_lib.h"
#include "csync_private.h"
@@ -326,7 +326,7 @@ int csync_abort_requested(CSYNC *ctx)
}
}
std::unique_ptr<csync_file_stat_t> csync_file_stat_s::fromSyncJournalFileRecord(const OCC::SyncJournalFileRecord &rec)
std::unique_ptr<csync_file_stat_t> csync_file_stat_t::fromSyncJournalFileRecord(const OCC::SyncJournalFileRecord &rec)
{
std::unique_ptr<csync_file_stat_t> st(new csync_file_stat_t);
st->path = rec._path;

View File

@@ -36,8 +36,8 @@
#include "ocsynclib.h"
#include <sys/stat.h>
#include <stdbool.h>
#include <stdint.h>
#include <cstdint>
#include <sys/types.h>
#include <config_csync.h>
#include <functional>
@@ -59,7 +59,7 @@ class SyncJournalFileRecord;
#define BITFIELD(size) :size
#endif
enum csync_status_codes_e {
enum CSYNC_STATUS {
CSYNC_STATUS_OK = 0,
CSYNC_STATUS_ERROR = 1024, /* don't use this code,
@@ -95,8 +95,6 @@ enum csync_status_codes_e {
CSYNC_STATUS_INDIVIDUAL_CANNOT_ENCODE
};
typedef enum csync_status_codes_e CSYNC_STATUS;
#ifndef likely
# define likely(x) (x)
#endif
@@ -146,9 +144,7 @@ enum ItemType {
// currently specified at https://github.com/owncloud/core/issues/8322 are 9 to 10
#define REMOTE_PERM_BUF_SIZE 15
typedef struct csync_file_stat_s csync_file_stat_t;
struct OCSYNC_EXPORT csync_file_stat_s {
struct OCSYNC_EXPORT csync_file_stat_t {
time_t modtime = 0;
int64_t size = 0;
uint64_t inode = 0;
@@ -179,7 +175,7 @@ struct OCSYNC_EXPORT csync_file_stat_s {
enum csync_instructions_e instruction = CSYNC_INSTRUCTION_NONE; /* u32 */
csync_file_stat_s()
csync_file_stat_t()
: type(ItemTypeSkip)
, child_modified(false)
, has_ignored_files(false)
@@ -193,26 +189,19 @@ struct OCSYNC_EXPORT csync_file_stat_s {
/**
* csync handle
*/
typedef struct csync_s CSYNC;
using CSYNC = struct csync_s;
typedef int (*csync_auth_callback) (const char *prompt, char *buf, size_t len,
int echo, int verify, void *userdata);
using csync_auth_callback = int (*)(const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata);
typedef void (*csync_update_callback) (bool local,
const char *dirUrl,
void *userdata);
using csync_update_callback = void (*)(bool local, const char *dirUrl, void *userdata);
typedef void csync_vio_handle_t;
typedef csync_vio_handle_t* (*csync_vio_opendir_hook) (const char *url,
void *userdata);
typedef std::unique_ptr<csync_file_stat_t> (*csync_vio_readdir_hook) (csync_vio_handle_t *dhhandle,
void *userdata);
typedef void (*csync_vio_closedir_hook) (csync_vio_handle_t *dhhandle,
void *userdata);
using csync_vio_handle_t = void;
using csync_vio_opendir_hook = csync_vio_handle_t *(*)(const char *url, void *userdata);
using csync_vio_readdir_hook = std::unique_ptr<csync_file_stat_t> (*)(csync_vio_handle_t *dhandle, void *userdata);
using csync_vio_closedir_hook = void (*)(csync_vio_handle_t *dhandle, void *userdata);
/* Compute the checksum of the given \a checksumTypeId for \a path. */
typedef QByteArray (*csync_checksum_hook)(
const QByteArray &path, const QByteArray &otherChecksumHeader, void *userdata);
using csync_checksum_hook = QByteArray (*)(const QByteArray &path, const QByteArray &otherChecksumHeader, void *userdata);
/**
* @brief Update detection

View File

@@ -317,17 +317,20 @@ bool ExcludedFiles::loadExcludeFile(const QByteArray & basePath, const QString &
if (!f.open(QIODevice::ReadOnly))
return false;
QList<QByteArray> patterns;
while (!f.atEnd()) {
QByteArray line = f.readLine().trimmed();
if (line.isEmpty() || line.startsWith('#'))
continue;
csync_exclude_expand_escapes(line);
_allExcludes[basePath].append(line);
patterns.append(line);
}
_allExcludes.insert(basePath, patterns);
// nothing to prepare if the user decided to not exclude anything
if(_allExcludes.size())
if (!_allExcludes.value(basePath).isEmpty()){
prepare(basePath);
}
return true;
}
@@ -411,10 +414,12 @@ CSYNC_EXCLUDE_TYPE ExcludedFiles::traversalPatternMatch(const char *path, ItemTy
// Directories are guaranteed to be visited before their files
if (filetype == ItemTypeDirectory) {
QFileInfo fi = QFileInfo(_localPath + path + "/.sync-exclude.lst");
const auto basePath = QString(_localPath + path + QLatin1Char('/')).toUtf8();
const auto fi = QFileInfo(basePath + QStringLiteral(".sync-exclude.lst"));
if (fi.isReadable()) {
addInTreeExcludeFilePath(fi.absoluteFilePath());
loadExcludeFile(fi.absolutePath().toUtf8(), fi.absoluteFilePath());
loadExcludeFile(basePath, fi.absoluteFilePath());
}
}

View File

@@ -32,7 +32,7 @@
#include <functional>
enum csync_exclude_type_e {
enum CSYNC_EXCLUDE_TYPE {
CSYNC_NOT_EXCLUDED = 0,
CSYNC_FILE_SILENTLY_EXCLUDED,
CSYNC_FILE_EXCLUDE_AND_REMOVE,
@@ -45,7 +45,6 @@ enum csync_exclude_type_e {
CSYNC_FILE_EXCLUDE_CONFLICT,
CSYNC_FILE_EXCLUDE_CANNOT_ENCODE
};
typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
class ExcludedFilesTest;

View File

@@ -22,20 +22,20 @@
#ifndef _CSYNC_MACROS_H
#define _CSYNC_MACROS_H
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
/* How many elements there are in a static array */
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
/* Some special custom errno values to report bugs properly. The BASE value
* should always be larger than the highest system errno. */
#define CSYNC_CUSTOM_ERRNO_BASE 10000
#define ERRNO_WRONG_CONTENT CSYNC_CUSTOM_ERRNO_BASE+11
#define ERRNO_SERVICE_UNAVAILABLE CSYNC_CUSTOM_ERRNO_BASE+14
#define ERRNO_STORAGE_UNAVAILABLE CSYNC_CUSTOM_ERRNO_BASE+17
#define ERRNO_FORBIDDEN CSYNC_CUSTOM_ERRNO_BASE+18
#define ERRNO_WRONG_CONTENT (CSYNC_CUSTOM_ERRNO_BASE+11)
#define ERRNO_SERVICE_UNAVAILABLE (CSYNC_CUSTOM_ERRNO_BASE+14)
#define ERRNO_STORAGE_UNAVAILABLE (CSYNC_CUSTOM_ERRNO_BASE+17)
#define ERRNO_FORBIDDEN (CSYNC_CUSTOM_ERRNO_BASE+18)
#endif /* _CSYNC_MACROS_H */
/* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */

View File

@@ -25,12 +25,12 @@
#define _GNU_SOURCE
#endif
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <sys/types.h>
#include <errno.h>
#include <cerrno>
#if _WIN32
# ifndef _WIN32_IE

View File

@@ -34,8 +34,8 @@
#include <unordered_map>
#include <QHash>
#include <stdint.h>
#include <stdbool.h>
#include <cstdint>
#include <map>
#include <set>
#include <functional>
@@ -189,7 +189,7 @@ struct OCSYNC_EXPORT csync_s {
csync_file_stat_t *current_fs = nullptr;
/* csync error code */
enum csync_status_codes_e status_code = CSYNC_STATUS_OK;
enum CSYNC_STATUS status_code = CSYNC_STATUS_OK;
char *error_string = nullptr;

View File

@@ -20,7 +20,7 @@
#include "config_csync.h"
#include <assert.h>
#include <cassert>
#include "csync_private.h"
#include "csync_reconcile.h"
#include "csync_util.h"
@@ -34,7 +34,7 @@ Q_LOGGING_CATEGORY(lcReconcile, "nextcloud.sync.csync.reconciler", QtInfoMsg)
// Needed for PRIu64 on MinGW in C++ mode.
#define __STDC_FORMAT_MACROS
#include "inttypes.h"
#include <cinttypes>
/* Check if a file is ignored because one parent is ignored.
* return the node of the ignored directoy if it's the case, or \c nullptr if it is not ignored */
@@ -188,11 +188,12 @@ static void _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx)
}();
auto curParent = our_tree->findFile(curParentPath);
if(!other) {
// Stick with the NEW
return;
} else if (!other->e2eMangledName.isEmpty() || (curParent && curParent->isE2eEncrypted)) {
// Stick with the NEW as well, we want to always issue delete + upload in such cases
if (!other
|| !other->e2eMangledName.isEmpty()
|| (curParent && curParent->isE2eEncrypted)) {
// Stick with the NEW since there's no "other" file
// or if there's an "other" file it involves E2EE and
// we want to always issue delete + upload in such cases
return;
} else if (other->instruction == CSYNC_INSTRUCTION_RENAME) {
// Some other EVAL_RENAME already claimed other.
@@ -343,7 +344,9 @@ static void _csync_merge_algorithm_visitor(csync_file_stat_t *cur, CSYNC * ctx)
auto remoteNode = ctx->current == REMOTE_REPLICA ? cur : other;
auto localNode = ctx->current == REMOTE_REPLICA ? other : cur;
remoteNode->instruction = CSYNC_INSTRUCTION_NONE;
localNode->instruction = up._modtime == localNode->modtime ? CSYNC_INSTRUCTION_UPDATE_METADATA : CSYNC_INSTRUCTION_SYNC;
localNode->instruction = up._modtime == localNode->modtime && up._size == localNode->size ?
CSYNC_INSTRUCTION_UPDATE_METADATA : CSYNC_INSTRUCTION_SYNC;
// Update the etag and other server metadata in the journal already
// (We can't use a typical CSYNC_INSTRUCTION_UPDATE_METADATA because
// we must not store the size/modtime from the file system)

View File

@@ -25,11 +25,11 @@
#define _GNU_SOURCE
#endif
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <cerrno>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <cmath>
#include "c_lib.h"
@@ -50,7 +50,7 @@
// Needed for PRIu64 on MinGW in C++ mode.
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <cinttypes>
Q_LOGGING_CATEGORY(lcUpdate, "nextcloud.sync.csync.updater", QtInfoMsg)

View File

@@ -37,7 +37,7 @@
* @{
*/
typedef int (*csync_walker_fn) (CSYNC *ctx, std::unique_ptr<csync_file_stat_t> fs);
using csync_walker_fn = int (*)(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> fs);
/**
* @brief The walker function to use in the file tree walker.

View File

@@ -25,10 +25,10 @@
#define _GNU_SOURCE
#endif
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <time.h>
#include <cerrno>
#include <climits>
#include <cstdio>
#include <ctime>
#include "common/c_jhash.h"
#include "csync_util.h"
@@ -37,10 +37,10 @@
Q_LOGGING_CATEGORY(lcCSyncUtils, "nextcloud.sync.csync.utils", QtInfoMsg)
typedef struct {
struct _instr_code_struct {
const char *instr_str;
enum csync_instructions_e instr_code;
} _instr_code_struct;
};
static const _instr_code_struct _instr[] =
{

View File

@@ -22,7 +22,7 @@
#ifndef _CSYNC_UTIL_H
#define _CSYNC_UTIL_H
#include <stdint.h>
#include <cstdint>
#include "csync_private.h"

View File

@@ -38,7 +38,7 @@
extern "C" {
#endif
#include <stdlib.h>
#include <stdlib.h> // NOLINT this is sometimes compiled in C mode
#include "c_macro.h"

View File

@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>
#include <string.h>
#include <stdlib.h> // NOLINT this is sometimes compiled in C mode
#include <string.h> // NOLINT this is sometimes compiled in C mode
#include "c_macro.h"
#include "c_alloc.h"

View File

@@ -31,8 +31,8 @@
#ifndef _C_MACRO_H
#define _C_MACRO_H
#include <stdint.h>
#include <string.h>
#include <stdint.h> // NOLINT this is sometimes compiled in C mode
#include <string.h> // NOLINT this is sometimes compiled in C mode
#define INT_TO_POINTER(i) (void *) i
#define POINTER_TO_INT(p) *((int *) (p))
@@ -44,7 +44,7 @@
#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
/** Free memory and zero the pointer */
#define SAFE_FREE(x) do { if ((x) != NULL) {free((void*)x); x=NULL;} } while(0)
#define SAFE_FREE(x) do { if ((x) != NULL) {free((void*)(x)); (x)=NULL;} } while(0)
/** Get the smaller value */
#define MIN(a,b) ((a) < (b) ? (a) : (b))
@@ -53,7 +53,7 @@
#define MAX(a,b) ((a) < (b) ? (b) : (a))
/** Get the size of an array */
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
/**
* This is a hack to fix warnings. The idea is to use this everywhere that we

View File

@@ -39,7 +39,7 @@
#include <unistd.h>
#endif
#include <errno.h>
#include <errno.h> // NOLINT this is sometimes compiled in C mode
#ifdef __MINGW32__
#define EDQUOT 0
@@ -80,10 +80,10 @@
#ifdef _WIN32
typedef struct stat64 csync_stat_t;
typedef struct stat64 csync_stat_t; // NOLINT this is sometimes compiled in C mode
#define _FILE_OFFSET_BITS 64
#else
typedef struct stat csync_stat_t;
typedef struct stat csync_stat_t; // NOLINT this is sometimes compiled in C mode
#endif
#ifndef O_NOATIME
@@ -112,7 +112,7 @@ typedef struct stat csync_stat_t;
#endif
#if defined _WIN32 && defined _UNICODE
typedef wchar_t mbchar_t;
typedef wchar_t mbchar_t; // NOLINT this is sometimes compiled in C mode
#define _topen _wopen
#define _tdirent _wdirent
#define _topendir _wopendir
@@ -133,7 +133,7 @@ typedef wchar_t mbchar_t;
#define _tchdir _wchdir
#define _tgetcwd _wgetcwd
#else
typedef char mbchar_t;
typedef char mbchar_t; // NOLINT this is sometimes compiled in C mode
#define _tdirent dirent
#define _topen open
#define _topendir opendir

View File

@@ -39,7 +39,7 @@ extern "C" {
#include "c_private.h"
#include "c_macro.h"
#include <stdlib.h>
#include <stdlib.h> // NOLINT this is sometimes compiled in C mode
/**
* @brief Compare to strings case insensitively.

View File

@@ -22,8 +22,8 @@
#define _GNU_SOURCE
#endif
#include <errno.h>
#include <stdio.h>
#include <cerrno>
#include <cstdio>
#include "common/asserts.h"
#include "csync_private.h"

View File

@@ -28,9 +28,9 @@
#include "csync.h"
#include "csync_private.h"
typedef struct fhandle_s {
struct fhandle_t {
int fd;
} fhandle_t;
};
csync_vio_handle_t *csync_vio_opendir(CSYNC *ctx, const char *name);
int csync_vio_closedir(CSYNC *ctx, csync_vio_handle_t *dhandle);

View File

@@ -19,12 +19,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <cerrno>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <stdio.h>
#include <cstdio>
#include <memory>
@@ -43,10 +43,10 @@ Q_LOGGING_CATEGORY(lcCSyncVIOLocal, "nextcloud.sync.csync.vio_local", QtInfoMsg)
* directory functions
*/
typedef struct dhandle_s {
struct dhandle_t {
DIR *dh;
char *path;
} dhandle_t;
};
static int _csync_vio_local_stat_mb(const mbchar_t *wuri, csync_file_stat_t *buf);

View File

@@ -43,12 +43,12 @@ Q_LOGGING_CATEGORY(lcCSyncVIOLocal, "nextcloud.sync.csync.vio_local", QtInfoMsg)
* directory functions
*/
typedef struct dhandle_s {
struct dhandle_t {
WIN32_FIND_DATA ffd;
HANDLE hFind;
int firstFind;
mbchar_t *path; // Always ends with '\'
} dhandle_t;
};
static int _csync_vio_local_stat_mb(const mbchar_t *uri, csync_file_stat_t *buf);

View File

@@ -4,6 +4,10 @@ set(CMAKE_AUTOMOC TRUE)
set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTORCC TRUE)
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DQT_QML_DEBUG)
endif()
IF(BUILD_UPDATER)
add_subdirectory(updater)
endif()
@@ -21,6 +25,7 @@ endif()
set(client_UI_SRCS
accountsettings.ui
conflictdialog.ui
folderwizardsourcepage.ui
folderwizardtargetpage.ui
generalsettings.ui
@@ -38,6 +43,7 @@ set(client_UI_SRCS
addcertificatedialog.ui
proxyauthdialog.ui
mnemonicdialog.ui
tray/ActivityActionButton.qml
tray/Window.qml
tray/UserLine.qml
wizard/flow2authwidget.ui
@@ -54,6 +60,8 @@ set(client_SRCS
accountmanager.cpp
accountsettings.cpp
application.cpp
conflictdialog.cpp
conflictsolver.cpp
connectionvalidator.cpp
folder.cpp
folderman.cpp
@@ -154,9 +162,16 @@ IF( APPLE )
list(APPEND client_SRCS systray.mm)
if(SPARKLE_FOUND AND BUILD_UPDATER)
# Define this, we need to check in updater.cpp
add_definitions( -DHAVE_SPARKLE )
list(APPEND updater_SRCS updater/sparkleupdater_mac.mm)
# Define this, we need to check in updater.cpp
add_definitions(-DHAVE_SPARKLE)
list(APPEND updater_SRCS updater/sparkleupdater_mac.mm updater/sparkleupdater.h)
list(APPEND updater_DEPS ${SPARKLE_LIBRARY})
# Sparkle.framework is installed from here because macdeployqt's CopyFramework breaks on this bundle
# as its logic is tightly tailored around Qt5 frameworks
install(DIRECTORY "${SPARKLE_LIBRARY}"
DESTINATION "${OWNCLOUD_OSX_BUNDLE}/Contents/Frameworks" USE_SOURCE_PERMISSIONS)
endif()
ENDIF()
@@ -224,9 +239,8 @@ set( final_src
${3rdparty_MOC}
)
if(QTKEYCHAIN_FOUND OR QT5KEYCHAIN_FOUND)
list(APPEND libsync_LINK_TARGETS ${QTKEYCHAIN_LIBRARY})
include_directories(${QTKEYCHAIN_INCLUDE_DIR})
if(Qt5Keychain_FOUND)
list(APPEND libsync_LINK_TARGETS qt5keychain)
endif()
# add executable icon on windows and osx
@@ -303,7 +317,7 @@ endif()
IF(BUILD_UPDATER)
add_library(updater STATIC ${updater_SRCS})
target_link_libraries(updater ${synclib_NAME} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml)
target_link_libraries(updater ${synclib_NAME} ${updater_DEPS} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml)
target_include_directories(updater PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
endif()
@@ -314,7 +328,7 @@ set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/${APPLICATION_EXECUTABLE};${CMAKE_INSTALL_RPATH}" )
target_link_libraries( ${APPLICATION_EXECUTABLE} Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Xml Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::WebEngineWidgets)
target_link_libraries( ${APPLICATION_EXECUTABLE} Qt5::Widgets Qt5::GuiPrivate Qt5::Svg Qt5::Network Qt5::Xml Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::WebEngineWidgets)
target_link_libraries( ${APPLICATION_EXECUTABLE} ${synclib_NAME} )
IF(BUILD_UPDATER)
target_link_libraries( ${APPLICATION_EXECUTABLE} updater )

View File

@@ -65,7 +65,7 @@ bool AccountManager::restore()
return true;
}
foreach (const auto &accountId, settings->childGroups()) {
for (const auto &accountId : settings->childGroups()) {
settings->beginGroup(accountId);
if (auto acc = loadAccountHelper(*settings)) {
acc->_id = accountId;
@@ -140,7 +140,7 @@ void AccountManager::save(bool saveCredentials)
{
auto settings = ConfigFile::settingsWithGroup(QLatin1String(accountsC));
settings->setValue(QLatin1String(versionC), 2);
foreach (const auto &acc, _accounts) {
for (const auto &acc : qAsConst(_accounts)) {
settings->beginGroup(acc->account()->id());
saveAccountHelper(acc->account().data(), *settings, saveCredentials);
acc->writeToSettings(*settings);
@@ -187,7 +187,7 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
// re-persisting them)
acc->_credentials->persist();
}
Q_FOREACH (QString key, acc->_settingsMap.keys()) {
for (const auto &key : acc->_settingsMap.keys()) {
settings.setValue(key, acc->_settingsMap.value(key));
}
settings.setValue(QLatin1String(authTypeC), acc->_credentials->authType());
@@ -201,7 +201,7 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
settings.beginGroup(QLatin1String("General"));
qCInfo(lcAccountManager) << "Saving " << acc->approvedCerts().count() << " unknown certs.";
QByteArray certs;
Q_FOREACH (const QSslCertificate &cert, acc->approvedCerts()) {
for (const auto &cert : acc->approvedCerts()) {
certs += cert.toPem() + '\n';
}
if (!certs.isEmpty()) {
@@ -258,7 +258,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
authType = "webflow";
settings.setValue(QLatin1String(authTypeC), authType);
foreach(QString key, settings.childKeys()) {
for (const QString &key : settings.childKeys()) {
if (!key.startsWith("http_"))
continue;
auto newkey = QString::fromLatin1("webflow_").append(key.mid(5));
@@ -274,7 +274,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
// We want to only restore settings for that auth type and the user value
acc->_settingsMap.insert(QLatin1String(userC), settings.value(userC));
QString authTypePrefix = authType + "_";
Q_FOREACH (QString key, settings.childKeys()) {
for (const auto &key : settings.childKeys()) {
if (!key.startsWith(authTypePrefix))
continue;
acc->_settingsMap.insert(key, settings.value(key));
@@ -292,12 +292,10 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
AccountStatePtr AccountManager::account(const QString &name)
{
foreach (const auto &acc, _accounts) {
if (acc->account()->displayName() == name) {
return acc;
}
}
return AccountStatePtr();
const auto it = std::find_if(_accounts.cbegin(), _accounts.cend(), [name](const auto &acc) {
return acc->account()->displayName() == name;
});
return it != _accounts.cend() ? *it : AccountStatePtr();
}
AccountState *AccountManager::addAccount(const AccountPtr &newAccount)
@@ -364,9 +362,9 @@ void AccountManager::displayMnemonic(const QString& mnemonic)
void AccountManager::shutdown()
{
auto accountsCopy = _accounts;
const auto accountsCopy = _accounts;
_accounts.clear();
foreach (const auto &acc, accountsCopy) {
for (const auto &acc : accountsCopy) {
emit accountRemoved(acc.data());
emit removeAccountFolders(acc.data());
}
@@ -374,12 +372,9 @@ void AccountManager::shutdown()
bool AccountManager::isAccountIdAvailable(const QString &id) const
{
foreach (const auto &acc, _accounts) {
if (acc->account()->id() == id) {
return false;
}
}
return true;
return std::none_of(_accounts.cbegin(), _accounts.cend(), [id](const auto &acc) {
return acc->account()->id() == id;
});
}
QString AccountManager::generateFreeAccountId() const

View File

@@ -28,7 +28,7 @@ class AccountManager : public QObject
Q_OBJECT
public:
static AccountManager *instance();
~AccountManager() {}
~AccountManager() = default;
/**
* Saves the accounts to a given settings file
@@ -89,7 +89,7 @@ private:
// Adds an account to the tracked list, emitting accountAdded()
void addAccountState(AccountState *accountState);
AccountManager() {}
AccountManager() = default;
QList<AccountStatePtr> _accounts;
public slots:

View File

@@ -37,7 +37,7 @@
#include "syncresult.h"
#include "ignorelisttablewidget.h"
#include <math.h>
#include <cmath>
#include <QDesktopServices>
#include <QDialogButtonBox>
@@ -761,8 +761,8 @@ void AccountSettings::slotAccountStateChanged()
AccountPtr account = _accountState->account();
QUrl safeUrl(account->url());
safeUrl.setPassword(QString()); // Remove the password from the URL to avoid showing it in the UI
FolderMan *folderMan = FolderMan::instance();
foreach (Folder *folder, folderMan->map().values()) {
const auto folders = FolderMan::instance()->map().values();
for (Folder *folder : folders) {
_model->slotUpdateFolderState(folder);
}
@@ -894,15 +894,16 @@ void AccountSettings::refreshSelectiveSyncStatus()
QString msg;
int cnt = 0;
foreach (Folder *folder, FolderMan::instance()->map().values()) {
const auto folders = FolderMan::instance()->map().values();
for (Folder *folder : folders) {
if (folder->accountState() != _accountState) {
continue;
}
bool ok = false;
auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok);
const auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok);
QString p;
foreach (const auto &it, undecidedList) {
for (const auto &it : undecidedList) {
// FIXME: add the folder alias in a hoover hint.
// folder->alias() + QLatin1String("/")
if (cnt++) {

View File

@@ -54,6 +54,13 @@ AccountState::AccountState(AccountPtr account)
connect(account.data(), &Account::credentialsAsked,
this, &AccountState::slotCredentialsAsked);
_timeSinceLastETagCheck.invalidate();
connect(this, &AccountState::isConnectedChanged, [=]{
// Get the Apps available on the server if we're now connected.
if (isConnected()) {
fetchNavigationApps();
}
});
}
AccountState::~AccountState() = default;
@@ -236,9 +243,6 @@ void AccountState::checkConnectivity()
// Use a small authed propfind as a minimal ping when we're
// already connected.
conValidator->checkAuthentication();
// Get the Apps available on the server.
fetchNavigationApps();
} else {
// Check the server and then the auth.
@@ -441,10 +445,10 @@ void AccountState::slotNavigationAppsFetched(const QJsonDocument &reply, int sta
if(!reply.isEmpty()){
auto element = reply.object().value("ocs").toObject().value("data");
auto navLinks = element.toArray();
const auto navLinks = element.toArray();
if(navLinks.size() > 0){
foreach (const QJsonValue &value, navLinks) {
for (const QJsonValue &value : navLinks) {
auto navLink = value.toObject();
auto *app = new AccountApp(navLink.value("name").toString(), QUrl(navLink.value("href").toString()),
@@ -468,9 +472,12 @@ AccountAppList AccountState::appList() const
AccountApp* AccountState::findApp(const QString &appId) const
{
if(!appId.isEmpty()) {
foreach(AccountApp *app, appList()) {
if(app->id() == appId)
return app;
const auto apps = appList();
const auto it = std::find_if(apps.cbegin(), apps.cend(), [appId](const auto &app) {
return app->id() == appId;
});
if (it != apps.cend()) {
return *it;
}
}

View File

@@ -32,8 +32,8 @@ class Account;
class AccountApp;
class RemoteWipe;
typedef QExplicitlySharedDataPointer<AccountState> AccountStatePtr;
typedef QList<AccountApp*> AccountAppList;
using AccountStatePtr = QExplicitlySharedDataPointer<AccountState>;
using AccountAppList = QList<AccountApp *>;
/**
* @brief Extra info about an ownCloud server account.
@@ -75,7 +75,7 @@ public:
};
/// The actual current connectivity status.
typedef ConnectionValidator::Status ConnectionStatus;
using ConnectionStatus = ConnectionValidator::Status;
/// Use the account as parent
explicit AccountState(AccountPtr account);
@@ -229,7 +229,7 @@ class AccountApp : public QObject
public:
AccountApp(const QString &name, const QUrl &url,
const QString &id, const QUrl &iconUrl,
QObject* parent = 0);
QObject* parent = nullptr);
QString name() const;
QUrl url() const;

View File

@@ -241,7 +241,7 @@ Application::Application(int &argc, char **argv)
this, &Application::slotAccountStateAdded);
connect(AccountManager::instance(), &AccountManager::accountRemoved,
this, &Application::slotAccountStateRemoved);
foreach (auto ai, AccountManager::instance()->accounts()) {
for (const auto &ai : AccountManager::instance()->accounts()) {
slotAccountStateAdded(ai.data());
}
@@ -349,8 +349,8 @@ void Application::slotSystemOnlineConfigurationChanged(QNetworkConfiguration cnf
void Application::slotCheckConnection()
{
auto list = AccountManager::instance()->accounts();
foreach (const auto &accountState, list) {
const auto list = AccountManager::instance()->accounts();
for (const auto &accountState : list) {
AccountState::State state = accountState->state();
// Don't check if we're manually signed out or
@@ -408,7 +408,9 @@ void Application::setupLogging()
// might be called from second instance
auto logger = Logger::instance();
logger->setLogFile(_logFile);
logger->setLogDir(!_logDir.isEmpty() ? _logDir : ConfigFile().logDir());
if (_logFile.isEmpty()) {
logger->setLogDir(_logDir.isEmpty() ? ConfigFile().logDir() : _logDir);
}
logger->setLogExpire(_logExpire > 0 ? _logExpire : ConfigFile().logExpire());
logger->setLogFlush(_logFlush || ConfigFile().logFlush());
logger->setLogDebug(_logDebug || ConfigFile().logDebug());
@@ -612,7 +614,7 @@ void Application::setupTranslations()
auto *qtTranslator = new QTranslator(this);
auto *qtkeychainTranslator = new QTranslator(this);
foreach (QString lang, uiLanguages) {
for (QString lang : qAsConst(uiLanguages)) {
lang.replace(QLatin1Char('-'), QLatin1Char('_')); // work around QTBUG-25973
lang = substLang(lang);
const QString trPath = applicationTrPath();

View File

@@ -20,17 +20,17 @@
/* Forward declaration required since gio header files interfere with QObject headers */
struct _CloudProvidersProviderExporter;
typedef _CloudProvidersProviderExporter CloudProvidersProviderExporter;
using CloudProvidersProviderExporter = _CloudProvidersProviderExporter;
struct _CloudProvidersAccountExporter;
typedef _CloudProvidersAccountExporter CloudProvidersAccountExporter;
using CloudProvidersAccountExporter = _CloudProvidersAccountExporter;
struct _GMenuModel;
typedef _GMenuModel GMenuModel;
using GMenuModel = _GMenuModel;
struct _GMenu;
typedef _GMenu GMenu;
using GMenu = _GMenu;
struct _GActionGroup;
typedef _GActionGroup GActionGroup;
typedef char gchar;
typedef void* gpointer;
using GActionGroup = _GActionGroup;
using gchar = char;
using gpointer = void*;
using namespace OCC;

181
src/gui/conflictdialog.cpp Normal file
View File

@@ -0,0 +1,181 @@
/*
* Copyright (C) by Kevin Ottens <kevin.ottens@nextcloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "conflictdialog.h"
#include "ui_conflictdialog.h"
#include "conflictsolver.h"
#include <QDateTime>
#include <QDebug>
#include <QDesktopServices>
#include <QFileInfo>
#include <QMimeDatabase>
#include <QPushButton>
#include <QUrl>
namespace {
void forceHeaderFont(QWidget *widget)
{
auto font = widget->font();
font.setPointSizeF(font.pointSizeF() * 1.5);
widget->setFont(font);
}
void setBoldFont(QWidget *widget, bool bold)
{
auto font = widget->font();
font.setBold(bold);
widget->setFont(font);
}
}
namespace OCC {
ConflictDialog::ConflictDialog(QWidget *parent)
: QDialog(parent)
, _ui(new Ui::ConflictDialog)
, _solver(new ConflictSolver(this))
{
_ui->setupUi(this);
forceHeaderFont(_ui->conflictMessage);
_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Keep selected version"));
connect(_ui->localVersionRadio, &QCheckBox::toggled, this, &ConflictDialog::updateButtonStates);
connect(_ui->localVersionButton, &QToolButton::clicked, this, [=] {
QDesktopServices::openUrl(QUrl::fromLocalFile(_solver->localVersionFilename()));
});
connect(_ui->remoteVersionRadio, &QCheckBox::toggled, this, &ConflictDialog::updateButtonStates);
connect(_ui->remoteVersionButton, &QToolButton::clicked, this, [=] {
QDesktopServices::openUrl(QUrl::fromLocalFile(_solver->remoteVersionFilename()));
});
connect(_solver, &ConflictSolver::localVersionFilenameChanged, this, &ConflictDialog::updateWidgets);
connect(_solver, &ConflictSolver::remoteVersionFilenameChanged, this, &ConflictDialog::updateWidgets);
}
QString ConflictDialog::baseFilename() const
{
return _baseFilename;
}
ConflictDialog::~ConflictDialog() = default;
QString ConflictDialog::localVersionFilename() const
{
return _solver->localVersionFilename();
}
QString ConflictDialog::remoteVersionFilename() const
{
return _solver->remoteVersionFilename();
}
void ConflictDialog::setBaseFilename(const QString &baseFilename)
{
if (_baseFilename == baseFilename) {
return;
}
_baseFilename = baseFilename;
_ui->conflictMessage->setText(tr("Conflicting versions of %1.").arg(_baseFilename));
}
void ConflictDialog::setLocalVersionFilename(const QString &localVersionFilename)
{
_solver->setLocalVersionFilename(localVersionFilename);
}
void ConflictDialog::setRemoteVersionFilename(const QString &remoteVersionFilename)
{
_solver->setRemoteVersionFilename(remoteVersionFilename);
}
void ConflictDialog::accept()
{
const auto isLocalPicked = _ui->localVersionRadio->isChecked();
const auto isRemotePicked = _ui->remoteVersionRadio->isChecked();
Q_ASSERT(isLocalPicked || isRemotePicked);
if (!isLocalPicked && !isRemotePicked) {
return;
}
const auto solution = isLocalPicked && isRemotePicked ? ConflictSolver::KeepBothVersions
: isLocalPicked ? ConflictSolver::KeepLocalVersion
: ConflictSolver::KeepRemoteVersion;
if (_solver->exec(solution)) {
QDialog::accept();
}
}
void ConflictDialog::updateWidgets()
{
QMimeDatabase mimeDb;
const auto updateGroup = [this, &mimeDb](const QString &filename, QLabel *linkLabel, const QString &linkText, QLabel *mtimeLabel, QLabel *sizeLabel, QToolButton *button) {
const auto fileUrl = QUrl::fromLocalFile(filename).toString();
linkLabel->setText(QStringLiteral("<a href='%1'>%2</a>").arg(fileUrl).arg(linkText));
const auto info = QFileInfo(filename);
mtimeLabel->setText(info.lastModified().toString());
sizeLabel->setText(locale().formattedDataSize(info.size()));
const auto mime = mimeDb.mimeTypeForFile(filename);
if (QIcon::hasThemeIcon(mime.iconName())) {
button->setIcon(QIcon::fromTheme(mime.iconName()));
} else {
button->setIcon(QIcon(":/qt-project.org/styles/commonstyle/images/file-128.png"));
}
};
const auto localVersion = _solver->localVersionFilename();
updateGroup(localVersion,
_ui->localVersionLink,
tr("Open local version"),
_ui->localVersionMtime,
_ui->localVersionSize,
_ui->localVersionButton);
const auto remoteVersion = _solver->remoteVersionFilename();
updateGroup(remoteVersion,
_ui->remoteVersionLink,
tr("Open server version"),
_ui->remoteVersionMtime,
_ui->remoteVersionSize,
_ui->remoteVersionButton);
const auto localMtime = QFileInfo(localVersion).lastModified();
const auto remoteMtime = QFileInfo(remoteVersion).lastModified();
setBoldFont(_ui->localVersionMtime, localMtime > remoteMtime);
setBoldFont(_ui->remoteVersionMtime, remoteMtime > localMtime);
}
void ConflictDialog::updateButtonStates()
{
const auto isLocalPicked = _ui->localVersionRadio->isChecked();
const auto isRemotePicked = _ui->remoteVersionRadio->isChecked();
_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isLocalPicked || isRemotePicked);
const auto text = isLocalPicked && isRemotePicked ? tr("Keep both versions")
: isLocalPicked ? tr("Keep local version")
: isRemotePicked ? tr("Keep server version")
: tr("Keep selected version");
_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(text);
}
} // namespace OCC

57
src/gui/conflictdialog.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) by Kevin Ottens <kevin.ottens@nextcloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef CONFLICTDIALOG_H
#define CONFLICTDIALOG_H
#include <QDialog>
namespace OCC {
class ConflictSolver;
namespace Ui {
class ConflictDialog;
}
class ConflictDialog : public QDialog
{
Q_OBJECT
public:
explicit ConflictDialog(QWidget *parent = nullptr);
~ConflictDialog() override;
QString baseFilename() const;
QString localVersionFilename() const;
QString remoteVersionFilename() const;
public slots:
void setBaseFilename(const QString &baseFilename);
void setLocalVersionFilename(const QString &localVersionFilename);
void setRemoteVersionFilename(const QString &remoteVersionFilename);
void accept() override;
private:
void updateWidgets();
void updateButtonStates();
QString _baseFilename;
QScopedPointer<Ui::ConflictDialog> _ui;
ConflictSolver *_solver;
};
} // namespace OCC
#endif // CONFLICTDIALOG_H

305
src/gui/conflictdialog.ui Normal file
View File

@@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OCC::ConflictDialog</class>
<widget class="QDialog" name="OCC::ConflictDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>504</width>
<height>407</height>
</rect>
</property>
<property name="windowTitle">
<string>Sync Conflict</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="conflictMessage">
<property name="text">
<string>Conflicting versions of %1.</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="spacing">
<number>16</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Which version of the file do you want to keep?&lt;br/&gt;If you select both versions, the local file will have a number added to its name.</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>16</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="localVersionRadio">
<property name="text">
<string>Local version</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QToolButton" name="localVersionButton">
<property name="toolTip">
<string>Click to open the file</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0,1">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="localVersionMtime">
<property name="text">
<string>today</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="localVersionSize">
<property name="text">
<string>0 byte</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="localVersionLink">
<property name="text">
<string>&lt;a href=&quot;%1&quot;&gt;Open local version&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="remoteVersionRadio">
<property name="text">
<string>Server version</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QToolButton" name="remoteVersionButton">
<property name="toolTip">
<string>Click to open the file</string>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,1">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="remoteVersionMtime">
<property name="text">
<string>today</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="remoteVersionSize">
<property name="text">
<string>0 byte</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="remoteVersionLink">
<property name="text">
<string>&lt;a href=&quot;%1&quot;&gt;Open server version&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>OCC::ConflictDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>123</x>
<y>218</y>
</hint>
<hint type="destinationlabel">
<x>148</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>OCC::ConflictDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>181</x>
<y>215</y>
</hint>
<hint type="destinationlabel">
<x>240</x>
<y>254</y>
</hint>
</hints>
</connection>
</connections>
</ui>

164
src/gui/conflictsolver.cpp Normal file
View File

@@ -0,0 +1,164 @@
/*
* Copyright (C) by Kevin Ottens <kevin.ottens@nextcloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "conflictsolver.h"
#include <QFileDialog>
#include <QMessageBox>
#include "common/utility.h"
#include "filesystem.h"
namespace OCC {
Q_LOGGING_CATEGORY(lcConflict, "nextcloud.gui.conflictsolver", QtInfoMsg)
ConflictSolver::ConflictSolver(QWidget *parent)
: QObject(parent)
, _parentWidget(parent)
{
}
QString ConflictSolver::localVersionFilename() const
{
return _localVersionFilename;
}
QString ConflictSolver::remoteVersionFilename() const
{
return _remoteVersionFilename;
}
bool ConflictSolver::exec(ConflictSolver::Solution solution)
{
switch (solution) {
case KeepLocalVersion:
return overwriteRemoteVersion();
case KeepRemoteVersion:
return deleteLocalVersion();
case KeepBothVersions:
return renameLocalVersion();
}
Q_UNREACHABLE();
return false;
}
void ConflictSolver::setLocalVersionFilename(const QString &localVersionFilename)
{
if (_localVersionFilename == localVersionFilename) {
return;
}
_localVersionFilename = localVersionFilename;
emit localVersionFilenameChanged();
}
void ConflictSolver::setRemoteVersionFilename(const QString &remoteVersionFilename)
{
if (_remoteVersionFilename == remoteVersionFilename) {
return;
}
_remoteVersionFilename = remoteVersionFilename;
emit remoteVersionFilenameChanged();
}
bool ConflictSolver::deleteLocalVersion()
{
if (_localVersionFilename.isEmpty()) {
return false;
}
QFileInfo info(_localVersionFilename);
if (!info.exists()) {
return false;
}
const auto message = info.isDir() ? tr("Do you want to delete the directory <i>%1</i> and all its contents permanently?").arg(info.dir().dirName())
: tr("Do you want to delete the file <i>%1</i> permanently?").arg(info.fileName());
const auto result = QMessageBox::question(_parentWidget, tr("Confirm deletion"), message, QMessageBox::Yes, QMessageBox::No);
if (result != QMessageBox::Yes)
return false;
if (info.isDir()) {
return FileSystem::removeRecursively(_localVersionFilename);
} else {
return QFile(_localVersionFilename).remove();
}
}
bool ConflictSolver::renameLocalVersion()
{
if (_localVersionFilename.isEmpty()) {
return false;
}
QFileInfo info(_localVersionFilename);
if (!info.exists()) {
return false;
}
const auto renamePattern = [=] {
auto result = QString::fromUtf8(OCC::Utility::conflictFileBaseNameFromPattern(_localVersionFilename.toUtf8()));
const auto dotIndex = result.lastIndexOf('.');
return QString(result.left(dotIndex) + "_%1" + result.mid(dotIndex));
}();
const auto targetFilename = [=] {
uint i = 1;
auto result = renamePattern.arg(i);
while (QFileInfo::exists(result)) {
Q_ASSERT(i > 0);
i++;
result = renamePattern.arg(i);
}
return result;
}();
QString error;
if (FileSystem::uncheckedRenameReplace(_localVersionFilename, targetFilename, &error)) {
return true;
} else {
qCWarning(lcConflict) << "Rename error:" << error;
QMessageBox::warning(_parentWidget, tr("Error"), tr("Moving file failed:\n\n%1").arg(error));
return false;
}
}
bool ConflictSolver::overwriteRemoteVersion()
{
if (_localVersionFilename.isEmpty()) {
return false;
}
if (_remoteVersionFilename.isEmpty()) {
return false;
}
QFileInfo info(_localVersionFilename);
if (!info.exists()) {
return false;
}
QString error;
if (FileSystem::uncheckedRenameReplace(_localVersionFilename, _remoteVersionFilename, &error)) {
return true;
} else {
qCWarning(lcConflict) << "Rename error:" << error;
QMessageBox::warning(_parentWidget, tr("Error"), tr("Moving file failed:\n\n%1").arg(error));
return false;
}
}
} // namespace OCC

63
src/gui/conflictsolver.h Normal file
View File

@@ -0,0 +1,63 @@
/*
* Copyright (C) by Kevin Ottens <kevin.ottens@nextcloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef CONFLICTSOLVER_H
#define CONFLICTSOLVER_H
#include <QObject>
class QWidget;
namespace OCC {
class ConflictSolver : public QObject
{
Q_OBJECT
Q_PROPERTY(QString localVersionFilename READ localVersionFilename WRITE setLocalVersionFilename NOTIFY localVersionFilenameChanged)
Q_PROPERTY(QString remoteVersionFilename READ remoteVersionFilename WRITE setRemoteVersionFilename NOTIFY remoteVersionFilenameChanged)
public:
enum Solution {
KeepLocalVersion,
KeepRemoteVersion,
KeepBothVersions
};
explicit ConflictSolver(QWidget *parent = nullptr);
QString localVersionFilename() const;
QString remoteVersionFilename() const;
bool exec(Solution solution);
public slots:
void setLocalVersionFilename(const QString &localVersionFilename);
void setRemoteVersionFilename(const QString &remoteVersionFilename);
signals:
void localVersionFilenameChanged();
void remoteVersionFilenameChanged();
private:
bool deleteLocalVersion();
bool renameLocalVersion();
bool overwriteRemoteVersion();
QWidget *_parentWidget;
QString _localVersionFilename;
QString _remoteVersionFilename;
};
} // namespace OCC
#endif // CONFLICTSOLVER_H

View File

@@ -82,6 +82,7 @@ void Flow2Auth::fetchNewToken(const TokenAction action)
// add 'Content-Length: 0' header (see https://github.com/nextcloud/desktop/issues/1473)
QNetworkRequest req;
req.setHeader(QNetworkRequest::ContentLengthHeader, "0");
req.setHeader(QNetworkRequest::UserAgentHeader, Utility::friendlyUserAgentString());
auto job = _account->sendRequest("POST", url, req);
job->setTimeout(qMin(30 * 1000ll, job->timeoutMsec()));

View File

@@ -77,8 +77,8 @@ private:
QString _pollToken;
QString _pollEndpoint;
QTimer _pollTimer;
int _secondsLeft;
int _secondsInterval;
qint64 _secondsLeft;
qint64 _secondsInterval;
bool _isBusy;
bool _hasToken;
};

View File

@@ -33,7 +33,7 @@
#include "owncloudgui.h"
#include "syncengine.h"
#include <keychain.h>
#include <qt5keychain/keychain.h>
using namespace QKeychain;

View File

@@ -85,10 +85,7 @@ static void addSettingsToJob(Account *account, QKeychain::Job *job)
}
#endif
WebFlowCredentials::WebFlowCredentials()
{
}
WebFlowCredentials::WebFlowCredentials() = default;
WebFlowCredentials::WebFlowCredentials(const QString &user, const QString &password, const QSslCertificate &certificate, const QSslKey &key, const QList<QSslCertificate> &caCertificates)
: _user(user)
@@ -252,6 +249,7 @@ void WebFlowCredentials::persist() {
void WebFlowCredentials::slotWriteClientCertPEMJobDone(KeychainChunk::WriteJob *writeJob)
{
Q_UNUSED(writeJob)
// write ssl key if there is one
if (!_clientSslKey.isNull()) {
auto job = new KeychainChunk::WriteJob(_account,
@@ -298,6 +296,7 @@ void WebFlowCredentials::writeSingleClientCaCertPEM()
void WebFlowCredentials::slotWriteClientKeyPEMJobDone(KeychainChunk::WriteJob *writeJob)
{
Q_UNUSED(writeJob)
_clientSslCaCertificatesWriteQueue.clear();
// write ca certs if there are any

View File

@@ -159,6 +159,7 @@ void WebFlowCredentialsDialog::slotShowSettingsDialog()
void WebFlowCredentialsDialog::slotFlow2AuthResult(Flow2Auth::Result r, const QString &errorString, const QString &user, const QString &appPassword)
{
Q_UNUSED(errorString)
if(r == Flow2Auth::LoggedIn) {
emit urlCatched(user, appPassword, QString());
} else {

View File

@@ -441,7 +441,7 @@ int Folder::slotDiscardDownloadProgress()
QSet<QString> keep_nothing;
const QVector<SyncJournalDb::DownloadInfo> deleted_infos =
_journal.getAndDeleteStaleDownloadInfos(keep_nothing);
foreach (const SyncJournalDb::DownloadInfo &deleted_info, deleted_infos) {
for (const auto &deleted_info : deleted_infos) {
const QString tmppath = folderpath.filePath(deleted_info._tmpfile);
qCInfo(lcFolder) << "Deleting temporary file: " << tmppath;
FileSystem::remove(tmppath);
@@ -528,13 +528,10 @@ void Folder::saveToSettings() const
// This ensures that older clients will not read a configuration
// where two folders for different accounts point at the same
// local folders.
bool oneAccountOnly = true;
foreach (Folder *other, FolderMan::instance()->map()) {
if (other != this && other->cleanPath() == this->cleanPath()) {
oneAccountOnly = false;
break;
}
}
const auto folderMap = FolderMan::instance()->map();
const auto oneAccountOnly = std::none_of(folderMap.cbegin(), folderMap.cend(), [this](const auto *other) {
return other != this && other->cleanPath() == this->cleanPath();
});
bool compatible = _saveBackwardsCompatible || oneAccountOnly;
@@ -901,43 +898,6 @@ void Folder::slotItemCompleted(const SyncFileItemPtr &item)
return;
}
// add new directories or remove gone away dirs to the watcher
if (_folderWatcher && item->isDirectory()) {
switch (item->_instruction) {
case CSYNC_INSTRUCTION_NEW:
_folderWatcher->addPath(path() + item->_file);
break;
case CSYNC_INSTRUCTION_REMOVE:
_folderWatcher->removePath(path() + item->_file);
break;
case CSYNC_INSTRUCTION_RENAME:
_folderWatcher->removePath(path() + item->_file);
_folderWatcher->addPath(path() + item->destination());
break;
default:
break;
}
}
// Success and failure of sync items adjust what the next sync is
// supposed to do.
//
// For successes, we want to wipe the file from the list to ensure we don't
// rediscover it even if this overall sync fails.
//
// For failures, we want to add the file to the list so the next sync
// will be able to retry it.
if (item->_status == SyncFileItem::Success
|| item->_status == SyncFileItem::FileIgnored
|| item->_status == SyncFileItem::Restoration
|| item->_status == SyncFileItem::Conflict) {
if (_previousLocalDiscoveryPaths.erase(item->_file.toUtf8()))
qCDebug(lcFolder) << "local discovery: wiped" << item->_file;
} else {
_localDiscoveryPaths.insert(item->_file.toUtf8());
qCDebug(lcFolder) << "local discovery: inserted" << item->_file << "due to sync failure";
}
_syncResult.processCompletedItem(item);
_fileLog->logItem(*item);
@@ -1080,6 +1040,7 @@ void Folder::registerFolderWatcher()
connect(_folderWatcher.data(), &FolderWatcher::becameUnreliable,
this, &Folder::slotWatcherUnreliable);
_folderWatcher->init(path());
_folderWatcher->startNotificatonTest(path() + QLatin1String(".owncloudsync.log"));
}
void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction dir, bool *cancel)
@@ -1207,7 +1168,7 @@ QString FolderDefinition::absoluteJournalPath() const
QString FolderDefinition::defaultJournalPath(AccountPtr account)
{
return SyncJournalDb::makeDbName(account->url(), targetPath, account->credentials()->user());
return SyncJournalDb::makeDbName(localPath, account->url(), targetPath, account->credentials()->user());
}
} // namespace OCC

View File

@@ -51,7 +51,7 @@ public:
QString alias;
/// path on local machine
QString localPath;
/// path to the journal, usually in QStandardPaths::AppDataLocation
/// path to the journal, usually relative to localPath
QString journalPath;
/// path on remote
QString targetPath;
@@ -95,8 +95,8 @@ public:
~Folder();
typedef QMap<QString, Folder *> Map;
typedef QMapIterator<QString, Folder *> MapIterator;
using Map = QMap<QString, Folder *>;
using MapIterator = QMapIterator<QString, Folder *>;
/**
* The account the folder is configured on.

View File

@@ -171,7 +171,7 @@ int FolderMan::setupFolders()
qCInfo(lcFolderMan) << "Setup folders from settings file";
foreach (const auto &account, AccountManager::instance()->accounts()) {
for (const auto &account : AccountManager::instance()->accounts()) {
const auto id = account->account()->id();
if (!accountsWithSettings.contains(id)) {
continue;
@@ -197,7 +197,7 @@ int FolderMan::setupFolders()
void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account, bool backwardsCompatible)
{
foreach (const auto &folderAlias, settings.childGroups()) {
for (const auto &folderAlias : settings.childGroups()) {
FolderDefinition folderDefinition;
if (FolderDefinition::load(settings, folderAlias, &folderDefinition)) {
auto defaultJournalPath = folderDefinition.defaultJournalPath(account->account());
@@ -207,11 +207,11 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
folderDefinition.journalPath = defaultJournalPath;
}
// Migration #2: journalPath now in DataAppDir, not root of local tree (cross-platform persistent user roaming files)
if (folderDefinition.journalPath.at(0) == QChar('.')) {
QFile oldJournal(folderDefinition.localPath + "/" + folderDefinition.journalPath);
QFile oldJournalShm(folderDefinition.localPath + "/" + folderDefinition.journalPath.append("-shm"));
QFile oldJournalWal(folderDefinition.localPath + "/" + folderDefinition.journalPath.append("-wal"));
// Migration #2: journalPath might be absolute (in DataAppDir most likely) move it back to the root of local tree
if (folderDefinition.journalPath.at(0) != QChar('.')) {
QFile oldJournal(folderDefinition.journalPath);
QFile oldJournalShm(folderDefinition.journalPath + QStringLiteral("-shm"));
QFile oldJournalWal(folderDefinition.journalPath + QStringLiteral("-wal"));
folderDefinition.journalPath = defaultJournalPath;
@@ -221,17 +221,17 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
auto journalFileMoveSuccess = true;
// Due to db logic can't be sure which of these file exist.
if (oldJournal.exists()) {
journalFileMoveSuccess &= oldJournal.rename(folderDefinition.journalPath);
journalFileMoveSuccess &= oldJournal.rename(folderDefinition.localPath + "/" + folderDefinition.journalPath);
}
if (oldJournalShm.exists()) {
journalFileMoveSuccess &= oldJournalShm.rename(folderDefinition.journalPath.append("-shm"));
journalFileMoveSuccess &= oldJournalShm.rename(folderDefinition.localPath + "/" + folderDefinition.journalPath + QStringLiteral("-shm"));
}
if (oldJournalWal.exists()) {
journalFileMoveSuccess &= oldJournalWal.rename(folderDefinition.journalPath.append("-wal"));
journalFileMoveSuccess &= oldJournalWal.rename(folderDefinition.localPath + "/" + folderDefinition.journalPath + QStringLiteral("-wal"));
}
if (!journalFileMoveSuccess) {
qCWarning(lcFolderMan) << "Wasn't able to move pre-2.7 syncjournal database files to new location. One-time loss off sync settings possible.";
qCWarning(lcFolderMan) << "Wasn't able to move 3.0 syncjournal database files to new location. One-time loss off sync settings possible.";
} else {
qCInfo(lcFolderMan) << "Successfully migrated syncjournal database.";
}
@@ -280,11 +280,11 @@ int FolderMan::setupFoldersMigration()
QDir dir(_folderConfigPath);
//We need to include hidden files just in case the alias starts with '.'
dir.setFilter(QDir::Files | QDir::Hidden);
QStringList list = dir.entryList();
const auto list = dir.entryList();
// Normally there should be only one account when migrating.
AccountState *accountState = AccountManager::instance()->accounts().value(0).data();
foreach (const QString &alias, list) {
for (const auto &alias : list) {
Folder *f = setupFolderFromOldConfigFile(alias, accountState);
if (f) {
scheduleFolder(f);
@@ -508,7 +508,7 @@ Folder *FolderMan::folder(const QString &alias)
void FolderMan::scheduleAllFolders()
{
foreach (Folder *f, _folderMap.values()) {
for (Folder *f : _folderMap.values()) {
if (f && f->canSync()) {
scheduleFolder(f);
}
@@ -595,7 +595,7 @@ void FolderMan::slotRunOneEtagJob()
{
if (_currentEtagJob.isNull()) {
Folder *folder = nullptr;
foreach (Folder *f, _folderMap) {
for (Folder *f : qAsConst(_folderMap)) {
if (f->etagJob()) {
// Caveat: always grabs the first folder with a job, but we think this is Ok for now and avoids us having a seperate queue.
_currentEtagJob = f->etagJob();
@@ -628,7 +628,7 @@ void FolderMan::slotAccountStateChanged()
if (accountState->isConnected()) {
qCInfo(lcFolderMan) << "Account" << accountName << "connected, scheduling its folders";
foreach (Folder *f, _folderMap.values()) {
for (Folder *f : _folderMap.values()) {
if (f
&& f->canSync()
&& f->accountState() == accountState) {
@@ -758,7 +758,7 @@ void FolderMan::slotEtagPollTimerTimeout()
ConfigFile cfg;
auto polltime = cfg.remotePollInterval();
foreach (Folder *f, _folderMap) {
for (Folder *f : qAsConst(_folderMap)) {
if (!f) {
continue;
}
@@ -793,7 +793,7 @@ void FolderMan::slotRemoveFoldersForAccount(AccountState *accountState)
}
}
foreach (const auto &f, foldersToRemove) {
for (const auto &f : qAsConst(foldersToRemove)) {
removeFolder(f);
}
emit folderListChanged(_folderMap);
@@ -813,7 +813,7 @@ void FolderMan::slotServerVersionChanged(Account *account)
qCWarning(lcFolderMan) << "The server version is unsupported:" << account->serverVersion()
<< "pausing all folders on the account";
foreach (auto &f, _folderMap) {
for (auto &f : qAsConst(_folderMap)) {
if (f->accountState()->account().data() == account) {
f->setSyncPaused(true);
}
@@ -830,7 +830,7 @@ void FolderMan::slotWatchedFileUnlocked(const QString &path)
void FolderMan::slotScheduleFolderByTime()
{
foreach (auto &f, _folderMap) {
for (const auto &f : qAsConst(_folderMap)) {
// Never schedule if syncing is disabled or when we're currently
// querying the server for etags
if (!f->canSync() || f->etagJob()) {
@@ -913,13 +913,11 @@ Folder *FolderMan::addFolder(AccountState *accountState, const FolderDefinition
// Migration: The first account that's configured for a local folder shall
// be saved in a backwards-compatible way.
bool oneAccountOnly = true;
foreach (Folder *other, FolderMan::instance()->map()) {
if (other != folder && other->cleanPath() == folder->cleanPath()) {
oneAccountOnly = false;
break;
}
}
const auto folderList = FolderMan::instance()->map();
const auto oneAccountOnly = std::none_of(folderList.cbegin(), folderList.cend(), [this, folder](const auto *other) {
return other != folder && other->cleanPath() == folder->cleanPath();
});
folder->setSaveBackwardsCompatible(oneAccountOnly);
if (folder) {
@@ -976,22 +974,20 @@ Folder *FolderMan::folderForPath(const QString &path)
{
QString absolutePath = QDir::cleanPath(path) + QLatin1Char('/');
foreach (Folder *folder, this->map().values()) {
const auto folders = this->map().values();
const auto it = std::find_if(folders.cbegin(), folders.cend(), [absolutePath](const auto *folder) {
const QString folderPath = folder->cleanPath() + QLatin1Char('/');
return absolutePath.startsWith(folderPath, (Utility::isWindows() || Utility::isMac()) ? Qt::CaseInsensitive : Qt::CaseSensitive);
});
if (absolutePath.startsWith(folderPath, (Utility::isWindows() || Utility::isMac()) ? Qt::CaseInsensitive : Qt::CaseSensitive)) {
return folder;
}
}
return nullptr;
return it != folders.cend() ? *it : nullptr;
}
QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const AccountPtr acc)
{
QStringList re;
foreach (Folder *folder, this->map().values()) {
for (Folder *folder : this->map().values()) {
if (acc && folder->accountState()->account() != acc) {
continue;
}
@@ -1134,7 +1130,7 @@ void FolderMan::slotWipeFolderForAccount(AccountState *accountState)
}
bool success = false;
foreach (const auto &f, foldersToRemove) {
for (const auto &f : qAsConst(foldersToRemove)) {
if (!f) {
qCCritical(lcFolderMan) << "Can not remove null folder";
return;
@@ -1190,7 +1186,7 @@ void FolderMan::slotWipeFolderForAccount(AccountState *accountState)
void FolderMan::setDirtyProxy()
{
foreach (Folder *f, _folderMap.values()) {
for (const Folder *f : _folderMap.values()) {
if (f) {
if (f->accountState() && f->accountState()->account()
&& f->accountState()->account()->networkAccessManager()) {
@@ -1204,7 +1200,7 @@ void FolderMan::setDirtyProxy()
void FolderMan::setDirtyNetworkLimits()
{
foreach (Folder *f, _folderMap.values()) {
for (Folder *f : _folderMap.values()) {
// set only in busy folders. Otherwise they read the config anyway.
if (f && f->isBusy()) {
f->setDirtyNetworkLimits();
@@ -1255,7 +1251,7 @@ void FolderMan::trayOverallStatus(const QList<Folder *> &folders,
int runSeen = 0;
int various = 0;
foreach (Folder *folder, folders) {
for (const Folder *folder : qAsConst(folders)) {
SyncResult folderResult = folder->syncResult();
if (folder->syncPaused()) {
abortOrPausedSeen++;
@@ -1478,7 +1474,7 @@ void FolderMan::setIgnoreHiddenFiles(bool ignore)
{
// Note that the setting will revert to 'true' if all folders
// are deleted...
foreach (Folder *folder, _folderMap) {
for (Folder *folder : qAsConst(_folderMap)) {
folder->setIgnoreHiddenFiles(ignore);
folder->saveToSettings();
}

View File

@@ -102,7 +102,7 @@ void FolderStatusModel::setAccountState(const AccountState *accountState)
Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const
{
if (!_accountState) {
return nullptr;
return {};
}
switch (classify(index)) {
case AddButton: {
@@ -120,7 +120,7 @@ Qt::ItemFlags FolderStatusModel::flags(const QModelIndex &index) const
case SubFolder:
return Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
}
return nullptr;
return {};
}
QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
@@ -250,9 +250,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
if (f->syncPaused()) {
return theme->folderDisabledIcon();
} else {
if (status == SyncResult::SyncPrepare) {
return theme->syncStateIcon(SyncResult::SyncRunning);
} else if (status == SyncResult::Undefined) {
if (status == SyncResult::SyncPrepare || status == SyncResult::Undefined) {
return theme->syncStateIcon(SyncResult::SyncRunning);
} else {
// The "Problem" *result* just means some files weren't
@@ -409,24 +407,6 @@ FolderStatusModel::SubFolderInfo *FolderStatusModel::infoForIndex(const QModelIn
}
}
/* Recursivelly traverse the file info looking for the id */
FolderStatusModel::SubFolderInfo *FolderStatusModel::infoForFileId(const QByteArray& fileId, SubFolderInfo* info) const
{
const QVector<SubFolderInfo>& infoVec = info ? info->_subs : _folders;
for(int i = 0, end = infoVec.size(); i < end; i++) {
auto *info = const_cast<SubFolderInfo *>(&infoVec[i]);
if (info->_fileId == fileId) {
return info;
} else if (info->_subs.size()) {
if (auto *subInfo = infoForFileId(fileId, info)) {
return subInfo;
}
}
}
return nullptr;
}
QModelIndex FolderStatusModel::indexForPath(Folder *f, const QString &path) const
{
if (!f) {
@@ -748,8 +728,8 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
endInsertRows();
}
for (auto it = undecidedIndexes.begin(); it != undecidedIndexes.end(); ++it) {
suggestExpand(index(*it, 0, idx));
for (int undecidedIndex : qAsConst(undecidedIndexes)) {
suggestExpand(index(undecidedIndex, 0, idx));
}
/* We need lambda function for the following code.
@@ -1090,7 +1070,7 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
auto &pi = _folders[folderIndex]._progress;
SyncResult::Status state = f->syncResult().status();
if (!f->canSync()) {
if (!f->canSync() || state == SyncResult::Problem || state == SyncResult::Success || state == SyncResult::Error) {
// Reset progress info.
pi = SubFolderInfo::Progress();
} else if (state == SyncResult::NotYetStarted) {
@@ -1111,11 +1091,6 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
} else if (state == SyncResult::SyncPrepare) {
pi = SubFolderInfo::Progress();
pi._overallSyncString = tr("Preparing to sync …");
} else if (state == SyncResult::Problem || state == SyncResult::Success) {
// Reset the progress info after a sync.
pi = SubFolderInfo::Progress();
} else if (state == SyncResult::Error) {
pi = SubFolderInfo::Progress();
}
// update the icon etc. now

View File

@@ -105,7 +105,6 @@ public:
FetchLabel };
ItemType classify(const QModelIndex &index) const;
SubFolderInfo *infoForIndex(const QModelIndex &index) const;
SubFolderInfo *infoForFileId(const QByteArray &fileId, SubFolderInfo *info = nullptr) const;
// If the selective sync check boxes were changed
bool isDirty() { return _dirty; }

View File

@@ -15,7 +15,7 @@
// event masks
#include "folderwatcher.h"
#include <stdint.h>
#include <cstdint>
#include <QFileInfo>
#include <QFlags>
@@ -33,6 +33,7 @@
#endif
#include "folder.h"
#include "filesystem.h"
namespace OCC {
@@ -60,7 +61,7 @@ bool FolderWatcher::pathIsIgnored(const QString &path)
return false;
#ifndef OWNCLOUD_TEST
if (_folder->isFileExcludedAbsolute(path)) {
if (_folder->isFileExcludedAbsolute(path) && !Utility::isConflictFile(path)) {
qCDebug(lcFolderWatcher) << "* Ignoring file" << path;
return true;
}
@@ -86,6 +87,57 @@ void FolderWatcher::appendSubPaths(QDir dir, QStringList& subPaths) {
}
}
void FolderWatcher::startNotificatonTest(const QString &path)
{
#ifdef Q_OS_MAC
// Testing the folder watcher on OSX is harder because the watcher
// automatically discards changes that were performed by our process.
// It would still be useful to test but the OSX implementation
// is deferred until later.
return;
#endif
Q_ASSERT(_testNotificationPath.isEmpty());
_testNotificationPath = path;
// Don't do the local file modification immediately:
// wait for FolderWatchPrivate::_ready
startNotificationTestWhenReady();
}
void FolderWatcher::startNotificationTestWhenReady()
{
if (!_d->_ready) {
QTimer::singleShot(1000, this, &FolderWatcher::startNotificationTestWhenReady);
return;
}
auto path = _testNotificationPath;
if (QFile::exists(path)) {
auto mtime = FileSystem::getModTime(path);
FileSystem::setModTime(path, mtime + 1);
} else {
QFile f(path);
f.open(QIODevice::WriteOnly | QIODevice::Append);
}
QTimer::singleShot(5000, this, [this]() {
if (!_testNotificationPath.isEmpty())
emit becameUnreliable(tr("The watcher did not receive a test notification."));
_testNotificationPath.clear();
});
}
int FolderWatcher::testLinuxWatchCount() const
{
#ifdef Q_OS_LINUX
return _d->testWatchCount();
#else
return -1;
#endif
}
void FolderWatcher::changeDetected(const QString &path)
{
QFileInfo fileInfo(path);
@@ -118,6 +170,10 @@ void FolderWatcher::changeDetected(const QStringList &paths)
// ------- handle ignores:
for (int i = 0; i < paths.size(); ++i) {
QString path = paths[i];
if (!_testNotificationPath.isEmpty()
&& Utility::fileNamesEqual(path, _testNotificationPath)) {
_testNotificationPath.clear();
}
if (pathIsIgnored(path)) {
continue;
}
@@ -134,15 +190,4 @@ void FolderWatcher::changeDetected(const QStringList &paths)
}
}
void FolderWatcher::addPath(const QString &path)
{
_d->addPath(path);
}
void FolderWatcher::removePath(const QString &path)
{
_d->removePath(path);
}
} // namespace OCC

View File

@@ -22,7 +22,7 @@
#include <QObject>
#include <QString>
#include <QStringList>
#include <QTime>
#include <QElapsedTimer>
#include <QHash>
#include <QScopedPointer>
#include <QSet>
@@ -44,11 +44,6 @@ class Folder;
* for changes in the local file system. Changes are signalled
* through the pathChanged() signal.
*
* Note that if new folders are created, this folderwatcher class
* does not automatically add them to the list of monitored
* dirs. That is the responsibility of the user of this class to
* call addPath() with the new dir.
*
* @ingroup gui
*/
@@ -65,14 +60,6 @@ public:
*/
void init(const QString &root);
/**
* Not all backends are recursive by default.
* Those need to be notified when a directory is added or removed while the watcher is disabled.
* This is a no-op for backends that are recursive
*/
void addPath(const QString &);
void removePath(const QString &);
/* Check if the path is ignored. */
bool pathIsIgnored(const QString &path);
@@ -85,6 +72,17 @@ public:
*/
bool isReliable() const;
/**
* Triggers a change in the path and verifies a notification arrives.
*
* If no notification is seen, the folderwatcher marks itself as unreliable.
* The path must be ignored by the watcher.
*/
void startNotificatonTest(const QString &path);
/// For testing linux behavior only
int testLinuxWatchCount() const;
signals:
/** Emitted when one of the watched directories or one
* of the contained files is changed. */
@@ -111,18 +109,24 @@ protected slots:
void changeDetected(const QString &path);
void changeDetected(const QStringList &paths);
private slots:
void startNotificationTestWhenReady();
protected:
QHash<QString, int> _pendingPathes;
private:
QScopedPointer<FolderWatcherPrivate> _d;
QTime _timer;
QElapsedTimer _timer;
QSet<QString> _lastPaths;
Folder *_folder;
bool _isReliable = true;
void appendSubPaths(QDir dir, QStringList& subPaths);
/** Path of the expected test notification */
QString _testNotificationPath;
friend class FolderWatcherPrivate;
};
}

View File

@@ -71,34 +71,37 @@ bool FolderWatcherPrivate::findFoldersBelow(const QDir &dir, QStringList &fullLi
void FolderWatcherPrivate::inotifyRegisterPath(const QString &path)
{
if (!path.isEmpty()) {
int wd = inotify_add_watch(_fd, path.toUtf8().constData(),
IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVE | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | IN_ONLYDIR);
if (wd > -1) {
_watches.insert(wd, path);
} else {
// If we're running out of memory or inotify watches, become
// unreliable.
if (_parent->_isReliable && (errno == ENOMEM || errno == ENOSPC)) {
_parent->_isReliable = false;
emit _parent->becameUnreliable(
tr("This problem usually happens when the inotify watches are exhausted. "
"Check the FAQ for details."));
}
if (path.isEmpty())
return;
int wd = inotify_add_watch(_fd, path.toUtf8().constData(),
IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVE | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | IN_ONLYDIR);
if (wd > -1) {
_watchToPath.insert(wd, path);
_pathToWatch.insert(path, wd);
} else {
// If we're running out of memory or inotify watches, become
// unreliable.
if (_parent->_isReliable && (errno == ENOMEM || errno == ENOSPC)) {
_parent->_isReliable = false;
emit _parent->becameUnreliable(
tr("This problem usually happens when the inotify watches are exhausted. "
"Check the FAQ for details."));
}
}
}
void FolderWatcherPrivate::slotAddFolderRecursive(const QString &path)
{
if (_pathToWatch.contains(path))
return;
int subdirs = 0;
qCDebug(lcFolderWatcher) << "(+) Watcher:" << path;
QDir inPath(path);
inotifyRegisterPath(inPath.absolutePath());
const QStringList watchedFolders = _watches.values();
QStringList allSubfolders;
if (!findFoldersBelow(QDir(path), allSubfolders)) {
qCWarning(lcFolderWatcher) << "Could not traverse all sub folders";
@@ -107,7 +110,7 @@ void FolderWatcherPrivate::slotAddFolderRecursive(const QString &path)
while (subfoldersIt.hasNext()) {
QString subfolder = subfoldersIt.next();
QDir folder(subfolder);
if (folder.exists() && !watchedFolders.contains(folder.absolutePath())) {
if (folder.exists() && !_pathToWatch.contains(folder.absolutePath())) {
subdirs++;
if (_parent->pathIsIgnored(subfolder)) {
qCDebug(lcFolderWatcher) << "* Not adding" << folder.path();
@@ -128,81 +131,89 @@ void FolderWatcherPrivate::slotReceivedNotification(int fd)
{
int len = 0;
struct inotify_event *event = nullptr;
int i = 0;
size_t i = 0;
int error = 0;
QVarLengthArray<char, 2048> buffer(2048);
do {
len = read(fd, buffer.data(), buffer.size());
error = errno;
/**
* From inotify documentation:
*
* The behavior when the buffer given to read(2) is too
* small to return information about the next event
* depends on the kernel version: in kernels before 2.6.21,
* read(2) returns 0; since kernel 2.6.21, read(2) fails with
* the error EINVAL.
*/
while (len < 0 && error == EINVAL) {
// double the buffer size
buffer.resize(buffer.size() * 2);
/* and try again ... */
len = read(fd, buffer.data(), buffer.size());
error = errno;
/**
* From inotify documentation:
*
* The behavior when the buffer given to read(2) is too
* small to return information about the next event
* depends on the kernel version: in kernels before 2.6.21,
* read(2) returns 0; since kernel 2.6.21, read(2) fails with
* the error EINVAL.
*/
if (len < 0 && error == EINVAL) {
// double the buffer size
buffer.resize(buffer.size() * 2);
/* and try again ... */
continue;
}
} while (false);
}
// reset counter
i = 0;
// while there are enough events in the buffer
while (i + sizeof(struct inotify_event) < static_cast<unsigned int>(len)) {
// iterate events in buffer
unsigned int ulen = len;
for (i = 0; i + sizeof(inotify_event) < ulen; i += sizeof(inotify_event) + (event ? event->len : 0)) {
// cast an inotify_event
event = (struct inotify_event *)&buffer[i];
if (!event) {
qCDebug(lcFolderWatcher) << "NULL event";
i += sizeof(struct inotify_event);
continue;
}
// Fire event for the path that was changed.
if (event->len > 0 && event->wd > -1) {
QByteArray fileName(event->name);
if (fileName.startsWith("._sync_")
|| fileName.startsWith(".csync_journal.db")
|| fileName.startsWith(".owncloudsync.log")
|| fileName.startsWith(".sync_")) {
} else {
const QString p = _watches[event->wd] + '/' + fileName;
_parent->changeDetected(p);
}
if (event->len == 0 || event->wd <= -1)
continue;
QByteArray fileName(event->name);
// Filter out journal changes - redundant with filtering in
// FolderWatcher::pathIsIgnored.
if (fileName.startsWith("._sync_")
|| fileName.startsWith(".csync_journal.db")
|| fileName.startsWith(".sync_")) {
continue;
}
const QString p = _watchToPath[event->wd] + '/' + fileName;
_parent->changeDetected(p);
// increment counter
i += sizeof(struct inotify_event) + event->len;
if ((event->mask & (IN_MOVED_TO | IN_CREATE))
&& QFileInfo(p).isDir()
&& !_parent->pathIsIgnored(p)) {
slotAddFolderRecursive(p);
}
if (event->mask & (IN_MOVED_FROM | IN_DELETE)) {
removeFoldersBelow(p);
}
}
}
void FolderWatcherPrivate::addPath(const QString &path)
void FolderWatcherPrivate::removeFoldersBelow(const QString &path)
{
slotAddFolderRecursive(path);
}
auto it = _pathToWatch.find(path);
if (it == _pathToWatch.end())
return;
void FolderWatcherPrivate::removePath(const QString &path)
{
int wid = -1;
// Remove the inotify watch.
QHash<int, QString>::const_iterator i = _watches.constBegin();
QString pathSlash = path + '/';
while (i != _watches.constEnd()) {
if (i.value() == path) {
wid = i.key();
// Remove the entry and all subentries
while (it != _pathToWatch.end()) {
auto itPath = it.key();
if (!itPath.startsWith(path))
break;
if (itPath != path && !itPath.startsWith(pathSlash)) {
// order is 'foo', 'foo bar', 'foo/bar'
++it;
continue;
}
++i;
}
if (wid > -1) {
auto wid = it.value();
inotify_rm_watch(_fd, wid);
_watches.remove(wid);
_watchToPath.remove(wid);
it = _pathToWatch.erase(it);
qCDebug(lcFolderWatcher) << "Removed watch for" << itPath;
}
}

View File

@@ -23,6 +23,8 @@
#include "folderwatcher.h"
class QTimer;
namespace OCC {
/**
@@ -33,12 +35,14 @@ class FolderWatcherPrivate : public QObject
{
Q_OBJECT
public:
FolderWatcherPrivate() {}
FolderWatcherPrivate() = default;
FolderWatcherPrivate(FolderWatcher *p, const QString &path);
~FolderWatcherPrivate();
void addPath(const QString &path);
void removePath(const QString &);
int testWatchCount() const { return _pathToWatch.size(); }
/// On linux the watcher is ready when the ctor finished.
bool _ready = true;
protected slots:
void slotReceivedNotification(int fd);
@@ -47,12 +51,14 @@ protected slots:
protected:
bool findFoldersBelow(const QDir &dir, QStringList &fullList);
void inotifyRegisterPath(const QString &path);
void removeFoldersBelow(const QString &path);
private:
FolderWatcher *_parent;
QString _folder;
QHash<int, QString> _watches;
QHash<int, QString> _watchToPath;
QMap<QString, int> _pathToWatch;
QScopedPointer<QSocketNotifier> _socket;
int _fd;
};

View File

@@ -33,13 +33,13 @@ public:
FolderWatcherPrivate(FolderWatcher *p, const QString &path);
~FolderWatcherPrivate();
void addPath(const QString &) {}
void removePath(const QString &) {}
void startWatching();
QStringList addCoalescedPaths(const QStringList &) const;
void doNotifyParent(const QStringList &);
/// On OSX the watcher is ready when the ctor finished.
bool _ready = true;
private:
FolderWatcher *_parent;

View File

@@ -84,6 +84,8 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize,
break;
}
emit ready();
HANDLE handles[] = { _resultEvent, _stopEvent };
DWORD result = WaitForMultipleObjects(
2, handles,
@@ -139,6 +141,8 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize,
if (!skip) {
emit changed(longfile);
} else {
qCDebug(lcFolderWatcher) << "Skipping syncing of" << longfile;
}
if (curEntry->NextEntryOffset == 0) {
@@ -204,6 +208,8 @@ FolderWatcherPrivate::FolderWatcherPrivate(FolderWatcher *p, const QString &path
_parent, SLOT(changeDetected(const QString &)));
connect(_thread, SIGNAL(lostChanges()),
_parent, SIGNAL(lostChanges()));
connect(_thread, &WatcherThread::ready,
this, [this]() { _ready = 1; });
_thread->start();
}

View File

@@ -54,6 +54,7 @@ protected:
signals:
void changed(const QString &path);
void lostChanges();
void ready();
private:
QString _path;
@@ -74,8 +75,8 @@ public:
FolderWatcherPrivate(FolderWatcher *p, const QString &path);
~FolderWatcherPrivate();
void addPath(const QString &) {}
void removePath(const QString &) {}
/// Set to non-zero once the WatcherThread is capturing events.
QAtomicInt _ready;
private:
FolderWatcher *_parent;

View File

@@ -37,7 +37,7 @@
#include <QVBoxLayout>
#include <QEvent>
#include <stdlib.h>
#include <cstdlib>
namespace OCC {

View File

@@ -26,18 +26,28 @@
#if defined(BUILD_UPDATER)
#include "updater/updater.h"
#include "updater/ocupdater.h"
#ifdef Q_OS_MAC
// FIXME We should unify those, but Sparkle does everything behind the scene transparently
#include "updater/sparkleupdater.h"
#endif
#endif
#include "ignorelisteditor.h"
#include "common/utility.h"
#include "logger.h"
#include "config.h"
#include "legalnotice.h"
#include <QFileDialog>
#include <QMessageBox>
#include <QNetworkProxy>
#include <QDir>
#include <QScopedValueRollback>
#include <QMessageBox>
#include <private/qzipwriter_p.h>
#define QTLEGACY (QT_VERSION < QT_VERSION_CHECK(5,9,0))
@@ -45,6 +55,87 @@
#include <QOperatingSystemVersion>
#endif
namespace {
struct ZipEntry {
QString localFilename;
QString zipFilename;
};
ZipEntry fileInfoToZipEntry(const QFileInfo &info)
{
return {
info.absoluteFilePath(),
info.fileName()
};
}
ZipEntry fileInfoToLogZipEntry(const QFileInfo &info)
{
auto entry = fileInfoToZipEntry(info);
entry.zipFilename.prepend(QStringLiteral("logs/"));
return entry;
}
ZipEntry syncFolderToZipEntry(OCC::Folder *f)
{
const auto journalPath = f->journalDb()->databaseFilePath();
const auto journalInfo = QFileInfo(journalPath);
return fileInfoToZipEntry(journalInfo);
}
QVector<ZipEntry> createFileList()
{
auto list = QVector<ZipEntry>();
OCC::ConfigFile cfg;
list.append(fileInfoToZipEntry(QFileInfo(cfg.configFile())));
const auto logger = OCC::Logger::instance();
if (!logger->logDir().isEmpty()) {
list.append({QString(), QStringLiteral("logs")});
QDir dir(logger->logDir());
const auto infoList = dir.entryInfoList(QDir::Files);
std::transform(std::cbegin(infoList), std::cend(infoList),
std::back_inserter(list),
fileInfoToLogZipEntry);
} else if (!logger->logFile().isEmpty()) {
list.append(fileInfoToZipEntry(QFileInfo(logger->logFile())));
}
const auto folders = OCC::FolderMan::instance()->map().values();
std::transform(std::cbegin(folders), std::cend(folders),
std::back_inserter(list),
syncFolderToZipEntry);
return list;
}
void createDebugArchive(const QString &filename)
{
const auto entries = createFileList();
QZipWriter zip(filename);
for (const auto &entry : entries) {
if (entry.localFilename.isEmpty()) {
zip.addDirectory(entry.zipFilename);
} else {
QFile file(entry.localFilename);
if (!file.open(QFile::ReadOnly)) {
continue;
}
zip.addFile(entry.zipFilename, &file);
}
}
zip.addFile("__nextcloud_client_parameters.txt", QCoreApplication::arguments().join(' ').toUtf8());
const auto buildInfo = QString(OCC::Theme::instance()->about() + "\n\n" + OCC::Theme::instance()->aboutDetails());
zip.addFile("__nextcloud_client_buildinfo.txt", buildInfo.toUtf8());
}
}
namespace OCC {
GeneralSettings::GeneralSettings(QWidget *parent)
@@ -122,6 +213,7 @@ GeneralSettings::GeneralSettings(QWidget *parent)
_ui->monoIconsCheckBox->setVisible(Theme::instance()->monoIconsAvailable());
connect(_ui->ignoredFilesButton, &QAbstractButton::clicked, this, &GeneralSettings::slotIgnoreFilesEditor);
connect(_ui->debugArchiveButton, &QAbstractButton::clicked, this, &GeneralSettings::slotCreateDebugArchive);
// accountAdded means the wizard was finished and the wizard might change some options.
connect(AccountManager::instance(), &AccountManager::accountAdded, this, &GeneralSettings::loadMiscSettings);
@@ -161,34 +253,88 @@ void GeneralSettings::loadMiscSettings()
#if defined(BUILD_UPDATER)
void GeneralSettings::slotUpdateInfo()
{
// Note: the sparkle-updater is not an OCUpdater
auto *updater = qobject_cast<OCUpdater *>(Updater::instance());
if (ConfigFile().skipUpdateCheck()) {
updater = nullptr; // don't show update info if updates are disabled
if (ConfigFile().skipUpdateCheck() || !Updater::instance()) {
// updater disabled on compile
_ui->updatesGroupBox->setVisible(false);
return;
}
if (updater) {
connect(updater, &OCUpdater::downloadStateChanged, this, &GeneralSettings::slotUpdateInfo, Qt::UniqueConnection);
connect(_ui->restartButton, &QAbstractButton::clicked, updater, &OCUpdater::slotStartInstaller, Qt::UniqueConnection);
// Note: the sparkle-updater is not an OCUpdater
auto *ocupdater = qobject_cast<OCUpdater *>(Updater::instance());
if (ocupdater) {
connect(ocupdater, &OCUpdater::downloadStateChanged, this, &GeneralSettings::slotUpdateInfo, Qt::UniqueConnection);
connect(_ui->restartButton, &QAbstractButton::clicked, ocupdater, &OCUpdater::slotStartInstaller, Qt::UniqueConnection);
connect(_ui->restartButton, &QAbstractButton::clicked, qApp, &QApplication::quit, Qt::UniqueConnection);
connect(_ui->updateButton, &QAbstractButton::clicked, this, &GeneralSettings::slotUpdateCheckNow, Qt::UniqueConnection);
connect(_ui->autoCheckForUpdatesCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleAutoUpdateCheck);
QString status = updater->statusString();
QString status = ocupdater->statusString();
Theme::replaceLinkColorStringBackgroundAware(status);
_ui->updateStateLabel->setText(status);
_ui->restartButton->setVisible(updater->downloadState() == OCUpdater::DownloadComplete);
_ui->restartButton->setVisible(ocupdater->downloadState() == OCUpdater::DownloadComplete);
_ui->updateButton->setEnabled(updater->downloadState() != OCUpdater::CheckingServer &&
updater->downloadState() != OCUpdater::Downloading &&
updater->downloadState() != OCUpdater::DownloadComplete);
_ui->updateButton->setEnabled(ocupdater->downloadState() != OCUpdater::CheckingServer &&
ocupdater->downloadState() != OCUpdater::Downloading &&
ocupdater->downloadState() != OCUpdater::DownloadComplete);
_ui->autoCheckForUpdatesCheckBox->setChecked(ConfigFile().autoUpdateCheck());
} else {
// can't have those infos from sparkle currently
_ui->updatesGroupBox->setVisible(false);
}
#if defined(Q_OS_MAC) && defined(HAVE_SPARKLE)
else if (auto sparkleUpdater = qobject_cast<SparkleUpdater *>(Updater::instance())) {
_ui->updateStateLabel->setText(sparkleUpdater->statusString());
_ui->restartButton->setVisible(false);
}
#endif
// Channel selection
_ui->updateChannel->setCurrentIndex(ConfigFile().updateChannel() == "beta" ? 1 : 0);
connect(_ui->updateChannel, &QComboBox::currentTextChanged,
this, &GeneralSettings::slotUpdateChannelChanged, Qt::UniqueConnection);
}
void GeneralSettings::slotUpdateChannelChanged(const QString &channel)
{
if (channel == ConfigFile().updateChannel())
return;
auto msgBox = new QMessageBox(
QMessageBox::Warning,
tr("Change update channel?"),
tr("The update channel determines which client updates will be offered "
"for installation. The \"stable\" channel contains only upgrades that "
"are considered reliable, while the versions in the \"beta\" channel "
"may contain newer features and bugfixes, but have not yet been tested "
"thoroughly."
"\n\n"
"Note that this selects only what pool upgrades are taken from, and that "
"there are no downgrades: So going back from the beta channel to "
"the stable channel usually cannot be done immediately and means waiting "
"for a stable version that is newer than the currently installed beta "
"version."),
QMessageBox::NoButton,
this);
msgBox->addButton(tr("Change update channel"), QMessageBox::AcceptRole);
msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
connect(msgBox, &QMessageBox::finished, msgBox, [this, channel, msgBox](int result) {
msgBox->deleteLater();
if (result == QMessageBox::AcceptRole) {
ConfigFile().setUpdateChannel(channel);
if (auto updater = qobject_cast<OCUpdater *>(Updater::instance())) {
updater->setUpdateUrl(Updater::updateUrl());
updater->checkForUpdate();
}
#if defined(Q_OS_MAC) && defined(HAVE_SPARKLE)
else if (auto updater = qobject_cast<SparkleUpdater *>(Updater::instance())) {
updater->setUpdateUrl(Updater::updateUrl());
updater->checkForUpdate();
}
#endif
} else {
_ui->updateChannel->setCurrentText(ConfigFile().updateChannel());
}
});
msgBox->open();
}
void GeneralSettings::slotUpdateCheckNow()
@@ -260,6 +406,17 @@ void GeneralSettings::slotIgnoreFilesEditor()
}
}
void GeneralSettings::slotCreateDebugArchive()
{
const auto filename = QFileDialog::getSaveFileName(this, tr("Create Debug Archive"), QString(), tr("Zip Archives") + " (*.zip)");
if (filename.isEmpty()) {
return;
}
createDebugArchive(filename);
QMessageBox::information(this, tr("Debug Archive Created"), tr("Debug archive is created at %1").arg(filename));
}
void GeneralSettings::slotShowLegalNotice()
{
auto notice = new LegalNotice();

View File

@@ -48,10 +48,12 @@ private slots:
void slotToggleOptionalServerNotifications(bool);
void slotShowInExplorerNavigationPane(bool);
void slotIgnoreFilesEditor();
void slotCreateDebugArchive();
void loadMiscSettings();
void slotShowLegalNotice();
#if defined(BUILD_UPDATER)
void slotUpdateInfo();
void slotUpdateChannelChanged(const QString &channel);
void slotUpdateCheckNow();
void slotToggleAutoUpdateCheck();
#endif

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>516</width>
<height>523</height>
<width>553</width>
<height>558</height>
</rect>
</property>
<property name="windowTitle">
@@ -124,26 +124,46 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="updateChannelLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&amp;Channel</string>
</property>
<property name="buddy">
<cstring>updateChannel</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="updateChannel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>stable</string>
</property>
</item>
<item>
<property name="text">
<string>beta</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="updateStateLabel">
<property name="text">
@@ -170,22 +190,6 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@@ -219,6 +223,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="debugArchiveButton">
<property name="text">
<string>Create Debug Archive …</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">

View File

@@ -73,7 +73,7 @@ class HeaderBanner : public QWidget
{
Q_OBJECT
public:
HeaderBanner(QWidget *parent = 0);
HeaderBanner(QWidget *parent = nullptr);
void setup(const QString &title, const QPixmap &logo, const QPixmap &banner,
const Qt::TextFormat titleFormat, const QString &styleSheet);

View File

@@ -14,7 +14,7 @@
#include "logbrowser.h"
#include "stdio.h"
#include <cstdio>
#include <iostream>
#include <QDialogButtonBox>

View File

@@ -15,7 +15,7 @@
#include <QtGlobal>
#include <cmath>
#include <signal.h>
#include <csignal>
#ifdef Q_OS_UNIX
#include <sys/time.h>

View File

@@ -66,17 +66,18 @@ void NavigationPaneHelper::updateCloudStorageRegistry()
// that matches ours when we saved.
QVector<QUuid> entriesToRemove;
#ifdef Q_OS_WIN
Utility::registryWalkSubKeys(
HKEY_CURRENT_USER,
QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Desktop\\NameSpace"),
[&entriesToRemove](HKEY key, const QString &subKey) {
QVariant appName = Utility::registryGetKeyValue(key, subKey, QStringLiteral("ApplicationName"));
if (appName.toString() == QLatin1String(APPLICATION_NAME)) {
QUuid clsid{ subKey };
Q_ASSERT(!clsid.isNull());
entriesToRemove.append(clsid);
}
});
QString nameSpaceKey = QStringLiteral(R"(Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace)");
if (Utility::registryKeyExists(HKEY_CURRENT_USER, nameSpaceKey)) {
Utility::registryWalkSubKeys(HKEY_CURRENT_USER, nameSpaceKey,
[&entriesToRemove](HKEY key, const QString &subKey) {
QVariant appName = Utility::registryGetKeyValue(key, subKey, QStringLiteral("ApplicationName"));
if (appName.toString() == QLatin1String(APPLICATION_NAME)) {
QUuid clsid{ subKey };
Q_ASSERT(!clsid.isNull());
entriesToRemove.append(clsid);
}
});
}
#endif
// Only save folder entries if the option is enabled.
@@ -138,7 +139,7 @@ void NavigationPaneHelper::updateCloudStorageRegistry()
// Step 11: Register your extension in the namespace root
Utility::registrySetKeyValue(HKEY_CURRENT_USER, namespacePath, QString(), REG_SZ, title);
// Step 12: Hide your extension from the Desktop
Utility::registrySetKeyValue(HKEY_CURRENT_USER, QStringLiteral("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\HideDesktopIcons\\NewStartPanel"), clsidStr, REG_DWORD, 0x1);
Utility::registrySetKeyValue(HKEY_CURRENT_USER, QStringLiteral(R"(Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel)"), clsidStr, REG_DWORD, 0x1);
// For us, to later be able to iterate and find our own namespace entries and associated CLSID.
// Use the macro instead of the theme to make sure it matches with the uninstaller.

View File

@@ -28,7 +28,8 @@ OcsShareeJob::OcsShareeJob(AccountPtr account)
void OcsShareeJob::getSharees(const QString &search,
const QString &itemType,
int page,
int perPage)
int perPage,
bool lookup)
{
setVerb("GET");
@@ -36,6 +37,7 @@ void OcsShareeJob::getSharees(const QString &search,
addParam(QString::fromLatin1("itemType"), itemType);
addParam(QString::fromLatin1("page"), QString::number(page));
addParam(QString::fromLatin1("perPage"), QString::number(perPage));
addParam(QString::fromLatin1("lookup"), QVariant(lookup).toString());
start();
}

View File

@@ -38,7 +38,7 @@ public:
*
* @param path Path to request shares for (default all shares)
*/
void getSharees(const QString &search, const QString &itemType, int page = 1, int perPage = 50);
void getSharees(const QString &search, const QString &itemType, int page = 1, int perPage = 50, bool lookup = false);
signals:
/**
* Result of the OCS request

View File

@@ -144,6 +144,7 @@ void OcsShareJob::createShare(const QString &path,
const QString &shareWith,
const Share::Permissions permissions)
{
Q_UNUSED(permissions)
setVerb("POST");
addParam(QString::fromLatin1("path"), path);

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