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

Compare commits

...

201 Commits

Author SHA1 Message Date
Nextcloud bot
6b174d6182 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-02-06 03:52:32 +00:00
Nextcloud bot
bfed1f952c [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-02-05 03:52:49 +00:00
allexzander
e5cae81f25 Merge pull request #4186 from nextcloud/feature/improve-activity-buttons
Feature/improve activity buttons
2022-02-04 19:11:59 +02:00
alex-z
ae44dd5978 Adjust icons for activity entries in main dialog. Refactor the dialog by splitting it to separate components.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-02-04 17:52:37 +02:00
Nextcloud bot
5ce8c9bf50 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-02-04 03:54:01 +00:00
Nextcloud bot
0df0d47c5e [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-02-03 03:53:38 +00:00
allexzander
c21f02bead Merge pull request #4217 from nextcloud/feature/always-build-with-updater
Always build with updater. Use 'beta/stable' channel selector in 'General Settins' dialog with default 'stable'.
2022-02-02 13:39:15 +02:00
alex-z
0776df65c3 Always build with updater. Use 'beta/stable' channel seletor in 'General Settins' dialog with default 'stable'.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-02-02 10:46:11 +00:00
Matthieu Gallien
375c7b585c Merge pull request #4218 from nextcloud/feature/cmake-option-to-disable-proxy
Cmake option to disable proxy
2022-02-02 11:45:02 +01:00
alex-z
0ea7e8d3a6 Cmake option to disable proxy
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-02-02 10:02:34 +00:00
Nextcloud bot
ceb13aa53c [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-02-02 03:54:14 +00:00
Claudio Cambra
bb8ca05162 Merge pull request #4216 from nextcloud/bugfix/account-menu-scroll
Allow account menu to scroll when content height is larger than menu height
2022-02-01 17:41:23 +01:00
Claudio Cambra
a2524763c8 Merge branch 'master' into bugfix/account-menu-scroll 2022-02-01 17:01:51 +01:00
Claudio Cambra
fddd9dd884 Merge pull request #4135 from nextcloud/feature/testactivitylistmodel
Add testing for ActivityListModel
2022-02-01 16:51:34 +01:00
Claudio Cambra
ce5494b4ec Add testing for ActivityListModel
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-02-01 13:57:08 +00:00
István Váradi
a66bed5d0f Merge pull request #4212 from ivaradi/hirsute_jammy
Remove Hirsute, add Jammy
2022-02-01 14:35:52 +01:00
István Váradi
566a5e5465 Remove Hirsute, add Jammy
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2022-02-01 12:26:00 +00:00
Nextcloud bot
c78855b4c2 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-02-01 03:54:14 +00:00
Claudio Cambra
7a1eae45d3 Account menu can now scroll
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-31 15:06:55 +00:00
Nextcloud bot
e94802a338 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-31 03:54:11 +00:00
Nextcloud bot
c69cecceda [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-30 03:52:35 +00:00
Nextcloud bot
7e43f29cd1 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-29 03:54:57 +00:00
Nextcloud bot
368d226357 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-28 03:53:29 +00:00
Nextcloud bot
9c98846c23 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-27 03:54:17 +00:00
Nextcloud bot
fe799e983b [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-26 03:54:14 +00:00
Nextcloud bot
004e5e58a3 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-25 03:54:37 +00:00
Matthieu Gallien
29d823571c Merge pull request #4154 from nextch/bug/4153-cloudproviders-dbus-build
Check for dbus-1 when building with cloudproviders
2022-01-24 18:44:41 +01:00
nextch
308dd8e790 Merge branch 'master' into bug/4153-cloudproviders-dbus-build 2022-01-24 18:58:12 +02:00
allexzander
fbc89a3149 Merge pull request #4191 from nextcloud/bugfix/cfapiDehydrateProperly
use proper API to dehydrate a placeholder file
2022-01-24 16:50:57 +02:00
Matthieu Gallien
20a4ed6e7e use proper API to dehydrate a placeholder file
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2022-01-24 14:16:40 +00:00
nextch
b4d6c90c62 Merge branch 'master' into bug/4153-cloudproviders-dbus-build 2022-01-24 15:21:39 +02:00
Matthieu Gallien
41a194952e Merge pull request #4162 from nextcloud/feature/internallink
Add ability to copy internal link from share dialog
2022-01-24 11:39:50 +01:00
Claudio Cambra
624213956e Add ability to copy internal link from share dialog
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-24 09:40:28 +00:00
Nextcloud bot
d0364e697a [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-24 03:51:33 +00:00
Nextcloud bot
1a3e42451c [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-23 03:51:38 +00:00
Nextcloud bot
40021e6943 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-21 03:50:49 +00:00
Nextcloud bot
580148335f [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-20 03:53:08 +00:00
Nextcloud bot
4e8a5d7aee [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-19 03:51:48 +00:00
Nextcloud bot
45b2647cc9 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-18 04:10:30 +00:00
allexzander
aad028097b Merge pull request #3907 from nextcloud/bugfix/main-dialog-use-system-font-size
Main dialog use system font size
2022-01-17 15:31:47 +02:00
Felix Weilbach
12610baeba Replace Text with Label
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2022-01-17 11:11:57 +00:00
Felix Weilbach
f4bf4da44d Remove commented out code
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2022-01-17 11:11:57 +00:00
Felix Weilbach
99457e8c38 Use the font size that Qt suggest
Fixes: https://github.com/nextcloud/desktop/issues/3797

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
2022-01-17 11:11:57 +00:00
Nextcloud bot
f21d064b4f [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-17 03:48:38 +00:00
Nextcloud bot
94ec5396da [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-16 03:52:20 +00:00
Nextcloud bot
610c2f9084 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-15 03:50:57 +00:00
Matthieu Gallien
075f33a272 Merge pull request #4102 from nextcloud/feature/file-names-in-activity
Show only filenames in tray activity items, with full path in tooltip
2022-01-14 11:02:07 +01:00
Claudio Cambra
2a27882307 Show only filenames in tray activity items, with full path in tooltip
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-14 08:02:08 +00:00
Nextcloud bot
8b26251199 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-14 03:53:45 +00:00
Matthieu Gallien
1e6d3d2c6b Merge pull request #4038 from nextcloud/bugfix/share-dialog-scroll
Add scroll area for share links.
2022-01-13 15:25:38 +01:00
Camila
fd8186ff0e ShareDialog: group links and users in one scrollbar.
- Remove the scrollbar used only for user shares
- Resize share dialog when removing share links
- Fix widget margins and max height of the share dialog
- slotAdjustScrollWidgetSize => adjustScrollWidgetSize

Signed-off-by: Camila <hello@camila.codes>
2022-01-13 10:39:11 +00:00
Camila
82aed71d09 Just trying to make the sahre dialog look nicer.
Signed-off-by: Camila <hello@camila.codes>
2022-01-13 10:39:11 +00:00
Camila
c08a291742 Remove unused slots.
Signed-off-by: Camila <hello@camila.codes>
2022-01-13 10:39:11 +00:00
Camila
a10f84b5c1 Add scroll area for share links.
Signed-off-by: Camila <hello@camila.codes>
2022-01-13 10:39:11 +00:00
Matthieu Gallien
40d8434c8e Merge pull request #4087 from nextcloud/rakekniven-patch-2
l10n: Fixed grammar
2022-01-13 11:37:58 +01:00
rakekniven
5cec3c3ca1 l10n: Fixed grammar
Reported at Transifex.

Signed-off-by: rakekniven <2069590+rakekniven@users.noreply.github.com>
2022-01-13 09:39:13 +00:00
allexzander
907282cf89 Merge pull request #4171 from nextcloud/bugfix/link-share-ui-not-visible
Bugfix. Re-init sharing manager to enable link sharing UI when receivng sharing permissions.
2022-01-13 11:37:12 +02:00
alex-z
3aaaaaf2d0 Bugfix. Re-init sharing manager to enable link sharing UI when receiving sharing permissions.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-13 10:42:48 +02:00
Nextcloud bot
5ea53cdf80 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-13 03:52:08 +00:00
Matthieu Gallien
5e651878ff Merge pull request #4067 from nextcloud/rakekniven-patch-1
l10n: Change "modified time" to "modification time"
2022-01-12 18:47:24 +01:00
rakekniven
961cea92ca l10n: Fixed grammar
Reported at Transifex.

Signed-off-by: rakekniven <2069590+rakekniven@users.noreply.github.com>
2022-01-12 15:55:56 +01:00
Matthieu Gallien
040e740375 Merge pull request #4168 from nextcloud/bugfix/doNotUseQuickCompilerByDefault
do not activate quick compiler by default
2022-01-12 15:52:13 +01:00
Matthieu Gallien
18be0e88dc do not activate quick compiler by default
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2022-01-12 11:37:13 +00:00
Matthieu Gallien
c2af167933 Merge pull request #4137 from nextcloud/feature/link-share-compromised-password-display-error
Display error message when creating a link share with compromised password.
2022-01-12 12:35:55 +01:00
alex-z
39d1ca3a3c Fix review comments.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-12 10:36:25 +00:00
alex-z
39e2292acd Fix review comments.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-12 10:36:25 +00:00
alex-z
3d7fc166b4 Fix review comments.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-12 10:36:25 +00:00
alex-z
4a8433d297 Display error message when creating a link share with compromised password.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-12 10:36:25 +00:00
Matthieu Gallien
f2d075f3ca Merge pull request #4099 from Dimon4eg/write_logs_to_Output_window_of_Visual_Studio
write logs to Output window of Visual Studio
2022-01-12 11:35:22 +01:00
Dmytro Korchynskyi
c872514571 write logs to Output window of Visual Studio
Signed-off-by: Dmytro Korchynskyi <kdl.dima@gmail.com>
2022-01-12 11:59:34 +02:00
Matthieu Gallien
66ba89a37d Merge branch 'rakekniven-patch-2' 2022-01-12 10:57:35 +01:00
rakekniven
dbe8dc303f Removed server versions as they are mostly outdated.
Addionally added link to server wiki page.

Signed-off-by: rakekniven <2069590+rakekniven@users.noreply.github.com>
2022-01-12 10:56:29 +01:00
Nextcloud bot
2967b3acca [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-12 03:51:38 +00:00
Claudio Cambra
1d8478bc06 Merge pull request #4167 from nextcloud/bugfix/textClipping
Add macOS *.textClipping files to ignore list
2022-01-11 23:22:41 +01:00
Claudio Cambra
27cf2592de Add macOS *.textClipping files to ignore list
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-11 15:50:47 +00:00
allexzander
2e0ba8208b Merge pull request #4100 from nextcloud/feature/ask-server-to-recalc-checksum
Ask server to recalculate checksum(hash)
2022-01-11 15:40:19 +02:00
alex-z
225753a8c0 Refactor DeleteJob and DeleteApiJob to use SimpleFileJob.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
alex-z
190d278fd4 Checksum validation PropagateDownload unit tests.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
alex-z
5b0e2d8ed0 Checksum validator unit tests.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
alex-z
6f5f3e769f Fix typo in usernamePrefillServerVersionMinSupportedMajor.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
alex-z
b7be10f712 Ask server to recalculate checksum on validatin failure.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-11 13:37:09 +00:00
Matthieu Gallien
fbe35538b6 Merge pull request #4015 from nextcloud/update-docs-with-new-features
Add screenshots of the latest features.
2022-01-11 14:24:09 +01:00
Camila
39faeffe09 Add screenshots of the latest features.
- Add a few sentences about the new features
- Reorder the menu to make more sense with the new content.
- Move 'User status' from Architecture to 'Visual Tour'.

Signed-off-by: Camila <hello@camila.codes>
2022-01-11 11:40:15 +00:00
Matthieu Gallien
e89dfe493e Merge pull request #4061 from nextcloud/bugfix/testModTime
check modified time sent by upload jobs in automated tests
2022-01-11 12:39:07 +01:00
Matthieu Gallien
c88f57b42d check modified time sent by upload jobs in automated tests
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2022-01-11 08:46:11 +00:00
Nextcloud bot
9d7568aa4a [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-11 03:52:21 +00:00
Nextcloud bot
ab66711513 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-10 03:54:40 +00:00
nextch
e48879555b Check for dbus-1 when building with cloudproviders
Resolves: 4153
Signed-off-by: nextch <97217716+nextch@users.noreply.github.com>
2022-01-08 16:56:40 +02:00
Nextcloud bot
05f4a331bf [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-08 03:49:26 +00:00
Matthieu Gallien
a7c1f58f99 Merge pull request #4120 from nextcloud/feature/qtquick-compile
Add option of enabling QtQuick compiler
2022-01-07 23:32:46 +01:00
Claudio Cambra
f23c7007a5 Fix space
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-07 17:48:31 +00:00
Claudio Cambra
044cf7ee13 Add QUICK_COMPILER option to drone builds, set quick compiler on by default
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-07 17:48:31 +00:00
Claudio Cambra
a1d42b4177 Make compiler required when option is on, removed unused def
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-07 17:48:31 +00:00
Claudio Cambra
8ad04f5a5e Remove AUTORCC
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-07 17:48:31 +00:00
Claudio Cambra
e25140d72e Add option of enabling QtQuick compiler
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2022-01-07 17:48:31 +00:00
Matthieu Gallien
9688ba24ca Merge pull request #4115 from nextcloud/bugfix/vbs-unregister-vfs
Windows. MSI. Unregister Nextcloud folders in SyncRootManager on uninstall.
2022-01-07 18:45:59 +01:00
alex-z
237e5a942f Windows. MSI. Unregister Nextcloud folders in SyncRootManager on uninstall.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-07 17:02:32 +00:00
Matthieu Gallien
888cd27540 Merge pull request #4111 from nextcloud/bugfix/do-not-display-gui-error-on-vfs-folder-conflict
Do not display 'Conflict when uploading some files to a folder
2022-01-07 18:01:26 +01:00
alex-z
77d7a0b7ed Do not display 'Conflict when uploading some files to a folder
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-07 08:46:22 +00:00
Nextcloud bot
263a10cb3a [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-07 03:52:19 +00:00
Nextcloud bot
3cf67bb60e [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-06 03:52:33 +00:00
allexzander
ef938a5d54 Merge pull request #4116 from nextcloud/bugfix/test-ssl-errors-relogin
Bugfix/force re-login on SSL Handshake error
2022-01-05 12:14:55 +02:00
alex-z
62b0a9b9f1 Try to sign-in after being signed-out due to SslHandshakeFailedError
Signed-off-by: alex-z <blackslayer4@gmail.com>
2022-01-05 10:01:13 +02:00
Nextcloud bot
d790bafcad [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-04 03:51:31 +00:00
Nextcloud bot
85020c1c95 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-03 03:51:22 +00:00
Nextcloud bot
5c7cce6dfe [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2022-01-02 03:51:13 +00:00
Nextcloud bot
72f32fc4f4 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-31 03:52:13 +00:00
Nextcloud bot
a8f8b6d36c [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-30 03:52:09 +00:00
allexzander
fdba105a0d Merge pull request #4022 from antonio-rojas/patch-1
Unbreak loading translations
2021-12-28 11:34:04 +02:00
Antonio Rojas
9d4d11df61 Unbreak loading translations
Commit 18ddb9df4a changed SHAREDIR to point to CMAKE_INSTALL_DATADIR, which is a relative path by default. This prevents the C++ code from finding the translations at runtime.

Signed-off-by: Antonio Rojas <arojas@archlinux.org>
2021-12-28 08:07:04 +00:00
Nextcloud bot
493da5f964 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-28 03:52:02 +00:00
Nextcloud bot
9b5a16e57e [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-27 03:50:47 +00:00
Nextcloud bot
f1e17c6672 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-25 03:51:24 +00:00
Nextcloud bot
3909f62fa9 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-24 03:54:07 +00:00
Nextcloud bot
df40bee75e [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-23 03:52:20 +00:00
Nextcloud bot
55e6301fa6 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-22 03:54:00 +00:00
Nextcloud bot
d549a16ee8 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-21 03:52:58 +00:00
Claudio Cambra
2ba0df3d3c Merge pull request #4090 from nextcloud/feature/hide-share-for-deleted
Hide share button for deleted files and ignored files in tray activity
2021-12-20 17:39:16 +01:00
Claudio Cambra
8c091a2daa Hide share button for deleted and ignored files in tray activity
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
2021-12-20 16:07:11 +00:00
Nextcloud bot
fc366933e4 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-20 03:55:12 +00:00
Nextcloud bot
e62ce9e6e3 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-19 03:58:02 +00:00
Nextcloud bot
728f5fe2cd [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-18 03:52:32 +00:00
Matthieu Gallien
49a81a7a2c Merge pull request #4096 from nextcloud/Valdnet-patch-2
l10n: Remove parenthesis
2021-12-17 09:44:44 +01:00
Valdnet
cedf079762 Remove parenthesis
Signed-off-by: Valdnet <47037905+Valdnet@users.noreply.github.com>
2021-12-17 08:53:35 +01:00
Nextcloud bot
d61983643a [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-17 03:56:40 +00:00
Matthieu Gallien
a5275e37d1 Merge pull request #4092 from nextcloud/bugfix/protectLastGetModTimeCalls
ensure any errors after calling FileSystem::getModTime are handled
2021-12-16 16:00:29 +01:00
Matthieu Gallien
3e82466d5e ensure any errors after calling FileSystem::getModTime are handled
be sure that even in release mode no errors when calling getModTime
could be ignored

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-16 15:28:46 +01:00
Nextcloud bot
384c4bb3f8 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-16 03:52:20 +00:00
allexzander
4c447b06a2 Merge pull request #4058 from nextcloud/bugfix/do-not-crash-on-cancele-delete-jobs
Do not crash on findAndCancelDeletedJob
2021-12-15 16:33:46 +02:00
alex-z
b66ba8ba0a Added sync stop when failed to cancel delete jobs.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-12-15 13:41:30 +00:00
alex-z
6381acf85b Do not crash on findAndCancelDeletedJob.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-12-15 13:41:29 +00:00
Nextcloud bot
3758cdf818 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-15 03:51:41 +00:00
allexzander
3b4b2c7a50 Merge pull request #4079 from nextcloud/bugfix/ecm-add-app-icon-fix-mac
Fix CMake error in ECMAddAppIcon for mac
2021-12-14 20:16:48 +02:00
alex-z
2482ca7ea7 Fix CMake error in ECMAddAppIcon for mac.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-12-14 17:31:21 +00:00
Matthieu Gallien
e092909b81 Merge pull request #4076 from nextcloud/bugfix/avoidSyncGettingStuck
Bugfix/avoid sync getting stuck
2021-12-14 17:24:54 +01:00
Matthieu Gallien
24f1d2ce89 fix review comment
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-14 15:28:42 +00:00
Matthieu Gallien
f581f71058 ensure bulk upload jobs finished after an error
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-14 15:28:42 +00:00
allexzander
958a9a3aed Merge pull request #4073 from nextcloud/feature/force-vfs
Enforce VFS. Disable 'Make always available locally'.
2021-12-14 17:18:42 +02:00
alex-z
3f3b752e44 Save folder settings to config when force-switching VFS.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-12-14 16:33:35 +02:00
alex-z
1244e96681 Enforce VFS. Disable 'Make always available locally'.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-12-14 15:03:57 +02:00
Matthieu Gallien
b021460290 Merge pull request #4074 from nextcloud/bugfix/forceDownloadLocalInvalidFiles
Bugfix/force download local invalid files
2021-12-14 11:15:10 +01:00
Matthieu Gallien
9a201a8963 force download from server for local files that have invalid dates
will trigger if local state is incoherent
like the file itself haveing 0 or negative modtime and the database not

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-14 10:00:59 +01:00
Nextcloud bot
5b696e5cf3 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-14 03:51:16 +00:00
Nextcloud bot
3c62c9ddb8 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-13 03:51:32 +00:00
Nextcloud bot
284a5eff89 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-12 03:53:39 +00:00
Nextcloud bot
a0b7ba6d9b [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-11 03:52:23 +00:00
Matthieu Gallien
e1d5a2a4c1 Merge pull request #4064 from nextcloud/bugfix/syncStuckOnError
Bugfix/sync stuck on error
2021-12-10 13:37:20 +01:00
Matthieu Gallien
8ead035016 do not get stuck forever in sync in case of errors
when a local file has invalid date and we try to upload it, properly
handle the error such that we are not stuck forever in sync state

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-10 11:28:35 +01:00
Nextcloud bot
7e19462312 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-10 03:55:50 +00:00
Matthieu Gallien
881697d3d7 Merge pull request #4055 from nextcloud/bugfix/3.4.1RC1
Bugfix/3.4.1 rc1
2021-12-09 10:08:26 +01:00
Matthieu Gallien
66d981aa64 remove files which gets downloaded with an invalid modified time
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-09 10:00:36 +01:00
Nextcloud bot
f2219ee717 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-09 03:55:42 +00:00
Matthieu Gallien
833e3bbcf6 Merge pull request #4045 from nextcloud/bugfix/assertInvalidModtime
Bugfix/assert invalid modtime
2021-12-08 09:00:25 +01:00
Matthieu Gallien
8696670909 add log statements for each new assert about invalid modified time
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Matthieu Gallien
791073bd28 recover from local invalid modifie time: force download from server
force file download if local modified time is invalid and server has
valid modified time

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Matthieu Gallien
41c86d6459 prevent cases where desktop client would store invalid modified time
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Matthieu Gallien
b1977dfb18 prevent injecting invalid modified time through CfApi calls
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Matthieu Gallien
76c8d7287e do not consider that a file has changed if its mtime is invalid
a mtime should never be 0 or negative

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Matthieu Gallien
389424c54b avoid downloading a file from server when modified time is invalid
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Matthieu Gallien
c9f63b5744 prevent invalid modified time from being propagated
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Matthieu Gallien
9523c036d6 assert on invalid modtime
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-08 07:22:24 +00:00
Nextcloud bot
2223c6e498 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-08 04:04:09 +00:00
allexzander
6b5a4bbb13 Merge pull request #4014 from nextcloud/feature/folder-logo-variations
Feature/folder logo variations
2021-12-07 19:19:50 +02:00
alex-z
77bf892809 Use different icon for a sync folder on Windows depending on zoom level.
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-12-07 15:48:16 +00:00
Matthieu Gallien
7e41cf07d4 Merge pull request #4033 from nextcloud/bugfix/renameBadFileNames
do not forget the path when renaming files with invalid names
2021-12-07 13:41:39 +01:00
Matthieu Gallien
b053cf9e2a do not forget the path when renaming files with invalid names
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-07 11:35:38 +01:00
Matthieu Gallien
6ceb45bac4 test files that should be renamed in sub-directory
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-12-07 11:35:38 +01:00
Nextcloud bot
450af67698 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-07 05:08:46 +00:00
Nextcloud bot
312f5960df [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-06 04:00:07 +00:00
Nextcloud bot
064f137f26 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-05 04:07:16 +00:00
Nextcloud bot
ec431ffd95 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-04 04:02:11 +00:00
allexzander
ec28618413 Merge pull request #4031 from nextcloud/feature/always-prefill-username-for-server24-and-up
Always prefill username from Windows login name based on server version
2021-12-03 12:32:30 +02:00
alex-z
25785841a3 Always prefill username from Windows login name based on server version
Signed-off-by: alex-z <blackslayer4@gmail.com>
2021-12-03 11:08:35 +02:00
Nextcloud bot
14374bc1be [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-03 03:57:51 +00:00
Nextcloud bot
aa9c4eec8a [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-02 03:57:44 +00:00
Nextcloud bot
f1a7de70e2 [tx-robot] updated from transifex 2021-12-01 18:47:06 +00:00
Nextcloud bot
25f868971b [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-12-01 04:00:08 +00:00
Matthieu Gallien
17a5cf572d Merge pull request #4009 from nextcloud/rakekniven-patch-1
l10n: Changed case of word
2021-11-30 14:38:17 +01:00
rakekniven
7dfd8181fa l10n: Changed case of word
Reported at Transifex.

Signed-off-by: rakekniven <2069590+rakekniven@users.noreply.github.com>
2021-11-30 11:52:46 +00:00
Nextcloud bot
da56bb8d9f [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-11-30 03:57:45 +00:00
Camila
7ef4deb76c Merge pull request #4012 from nextcloud/bugfix/fixCfApiUpdateMetadata
fix random error when updating CfApi metadata
2021-11-29 18:22:21 +01:00
Matthieu Gallien
c53159cb0c fix random error when updating CfApi metadata
initialiazing all fields in a structure is required to not have random
behavior

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-29 18:04:00 +01:00
Camila
c12704d726 Merge pull request #4011 from nextcloud/bump-version
Bump version to 3.4.50.
2021-11-29 15:10:47 +01:00
Camila
cbed4786be Bump version to 3.4.50.
Signed-off-by: Camila <hello@camila.codes>
2021-11-29 14:57:18 +01:00
Camila
fd60e60541 Merge pull request #4010 from nextcloud/bump-version
Bump VERSION.cmake to 3.4.0.
2021-11-29 14:46:29 +01:00
Camila
fb833ed311 Bump VERSION.cmake to 3.4.0.
Signed-off-by: Camila <hello@camila.codes>
2021-11-29 14:33:29 +01:00
Nextcloud bot
1440c53ed6 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-11-29 03:52:09 +00:00
Nextcloud bot
bd42c35e80 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-11-28 03:50:40 +00:00
Nextcloud bot
a5c82670c9 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-11-27 03:53:51 +00:00
Matthieu Gallien
3c966a77df Merge pull request #4006 from nextcloud/bugfix/speedUpBulkUpload
Bugfix/speed up bulk upload
2021-11-26 17:50:01 +01:00
Matthieu Gallien
1a9aade28e use the error message sent by the server for bulk upload
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 16:32:08 +01:00
Matthieu Gallien
34c4c28879 allow sending parallel batch of files: curretly disabled
can allow to send a new batch before the reply to a previous one is
received

due to concerns with the reliability on the server side this is disabled

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 16:32:08 +01:00
Matthieu Gallien
a272b34809 really check that this is a valid answer when receiving batch upload
we could somehow miss that the reply is missing proper fields

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 15:49:25 +01:00
Matthieu Gallien
05b8d1e40d batch upload: only handle file that are in the reply
do not handle all files sent but only received ones

should allow to submit more than one request in parallel

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 15:49:25 +01:00
Matthieu Gallien
18ef471332 let auto tests of batch upload return proper file paths
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 15:49:25 +01:00
Matthieu Gallien
e14502606c make sure we do not start a new batch when the previous one is not sent
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 15:49:25 +01:00
Matthieu Gallien
59953d857b use a proper constant for the size of batch
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 15:49:25 +01:00
Matthieu Gallien
436eced9fb Merge pull request #4003 from nextcloud/bugfix/errorBulkUpload
if BulkPropagatorJob abort after an error emit finished signal
2021-11-26 15:31:15 +01:00
Matthieu Gallien
f56985938d if BulkPropagatorJob abort after an error emit finished signal
prevent sync engine being stuck because of an error when preparing bulk
upload

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
2021-11-26 12:48:38 +01:00
Nextcloud bot
56f4198b28 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-11-26 04:14:39 +00:00
Nextcloud bot
6b22081f61 [tx-robot] updated from transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2021-11-25 03:52:56 +00:00
181 changed files with 44017 additions and 29165 deletions

View File

@@ -9,7 +9,7 @@ steps:
path: /drone/build
commands:
- cd /drone/build
- cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
- cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
- name: compile
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
volumes:
@@ -53,7 +53,7 @@ steps:
path: /drone/build
commands:
- cd /drone/build
- cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
- cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
- name: compile
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
volumes:

1
.gitignore vendored
View File

@@ -184,6 +184,7 @@ compile_commands.json
convert.exe
.dir-locals.el
*-icon.png
*-icon-win-folder.png
*-sidebar.png
*-w10startmenu.png
theme.qrc

View File

@@ -21,7 +21,7 @@ Icon=@APPLICATION_EXECUTABLE@
# Translations
Icon[de_DE]=@APPLICATION_ICON_NAME@
Name[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
Comment[de_DE]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
GenericName[de_DE]=Ordnersynchronisierung
Icon[de]=@APPLICATION_ICON_NAME@
Name[de]=@APPLICATION_NAME@ Desktop
Comment[de]=@APPLICATION_NAME@ Client zur Desktop-Synchronisierung
GenericName[de]=Ordner-Synchronisation

View File

@@ -0,0 +1,24 @@
[Desktop Entry]
Categories=Utility;X-SuSE-SyncUtility;
Type=Application
Exec=@APPLICATION_EXECUTABLE@
Name=@APPLICATION_NAME@ Desktop
Comment=@APPLICATION_NAME@ desktop synchronization client
GenericName=Folder Sync
Icon=@APPLICATION_ICON_NAME@
Keywords=@APPLICATION_NAME@;syncing;file;sharing;
X-GNOME-Autostart-Delay=3
MimeType=application/vnd.@APPLICATION_EXECUTABLE@;
Actions=Quit;
# Translations
[Desktop Action Quit]
Exec=@APPLICATION_EXECUTABLE@ --quit
Name=Quit @APPLICATION_NAME@
Icon=@APPLICATION_EXECUTABLE@
# Translations
GenericName[id]=Sinkronisasi Folder

View File

@@ -22,5 +22,6 @@ Icon=@APPLICATION_EXECUTABLE@
# Translations
Icon[nb_NO]=@APPLICATION_ICON_NAME@
Name[nb_NO]=@APPLICATION_NAME@ skrivebord
Comment[nb_NO]=@APPLICATION_NAME@ klient for synkroinisering
GenericName[nb_NO]=Mappe synkroinisering

View File

@@ -22,5 +22,6 @@ Icon=@APPLICATION_EXECUTABLE@
# Translations
Icon[oc]=@APPLICATION_ICON_NAME@
Name[oc]=@APPLICATION_NAME@ Burèu
Comment[oc]=@APPLICATION_NAME@ client de sincronizacion
GenericName[oc]=Sincro. dossièr

View File

@@ -22,5 +22,6 @@ Icon=@APPLICATION_EXECUTABLE@
# Translations
Icon[sv]=@APPLICATION_ICON_NAME@
Name[sv]=@APPLICATION_NAME@ Skrivbord
Comment[sv]=@APPLICATION_NAME@ desktopssynkroniseringsklient
GenericName[sv]=Mappsynkronisering

View File

@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.6)
set(CMAKE_CXX_STANDARD 14)
cmake_policy(SET CMP0071 NEW) # Enable use of QtQuick compiler/generated code
project(client)
@@ -96,7 +97,7 @@ endif()
message(STATUS "GIT_SHA1 ${GIT_SHA1}")
set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
set(SHAREDIR ${CMAKE_INSTALL_DATADIR})
set(SHAREDIR ${CMAKE_INSTALL_FULL_DATADIR})
# Build MacOS app bundle if wished
if(APPLE AND BUILD_OWNCLOUD_OSX_BUNDLE)
@@ -106,6 +107,9 @@ if(APPLE AND BUILD_OWNCLOUD_OSX_BUNDLE)
set(BIN_INSTALL_DIR "${APPLICATION_NAME}.app/Contents/MacOS")
endif()
option(QUICK_COMPILER "Use QtQuick compiler to improve performance" OFF)
# this option removes Http authentication, keychain, shibboleth etc and is intended for
# external authentication mechanisms
option(TOKEN_AUTH_ONLY "TOKEN_AUTH_ONLY" OFF)
@@ -119,11 +123,8 @@ if(NO_MSG_HANDLER)
add_definitions(-DNO_MSG_HANDLER=1)
endif()
# this option builds the updater
option(BUILD_UPDATER "BUILD_UPDATER" OFF)
if(BUILD_UPDATER)
message("Compiling with updater")
add_definitions(-DBUILD_UPDATER=1)
else()
message("Compiling without updater")
endif()
@@ -182,6 +183,7 @@ if(BUILD_CLIENT)
pkg_check_modules(CLOUDPROVIDERS cloudproviders IMPORTED_TARGET)
if(CLOUDPROVIDERS_FOUND)
pkg_check_modules(DBUS-1 REQUIRED dbus-1 IMPORTED_TARGET)
pkg_check_modules(GIO REQUIRED gio-2.0 IMPORTED_TARGET)
pkg_check_modules(GLIB2 REQUIRED glib-2.0 IMPORTED_TARGET)
endif()

View File

@@ -13,7 +13,6 @@ set( APPLICATION_REV_DOMAIN "com.nextcloud.desktopclient" )
set( APPLICATION_VIRTUALFILE_SUFFIX "nextcloud" CACHE STRING "Virtual file suffix (not including the .)")
set( APPLICATION_OCSP_STAPLING_ENABLED OFF )
set( APPLICATION_FORBID_BAD_SSL OFF )
set( APPLICATION_LOGIN_WITH_SYSTEM_USERNAME OFF )
set( LINUX_PACKAGE_SHORTNAME "nextcloud" )
set( LINUX_APPLICATION_ID "${APPLICATION_REV_DOMAIN}.${LINUX_PACKAGE_SHORTNAME}")
@@ -31,12 +30,14 @@ option( WITH_CRASHREPORTER "Build crashreporter" OFF )
#set( CRASHREPORTER_ICON ":/owncloud-icon.png" )
## Updater options
option( BUILD_UPDATER "Build updater" OFF )
option( BUILD_UPDATER "Build updater" ON )
option( WITH_PROVIDERS "Build with providers list" ON )
option( ENFORCE_VIRTUAL_FILES_SYNC_FOLDER "Enforce use of virtual files sync folder when available" OFF )
option( DO_NOT_USE_PROXY "Do not use system wide proxy, instead always do a direct connection to server" OFF )
## Theming options
set(NEXTCLOUD_BACKGROUND_COLOR "#0082c9" CACHE STRING "Default Nextcloud background color")
set( APPLICATION_WIZARD_HEADER_BACKGROUND_COLOR ${NEXTCLOUD_BACKGROUND_COLOR} CACHE STRING "Hex color of the wizard header background")

View File

@@ -1,6 +1,6 @@
set( MIRALL_VERSION_MAJOR 3 )
set( MIRALL_VERSION_MINOR 3 )
set( MIRALL_VERSION_PATCH 82 )
set( MIRALL_VERSION_MINOR 4 )
set( MIRALL_VERSION_PATCH 50 )
set( MIRALL_VERSION_YEAR 2021 )
set( MIRALL_SOVERSION 0 )

View File

@@ -15,10 +15,10 @@ OBS_PROJECT_BETA=home:ivaradi:beta
OBS_PACKAGE=nextcloud-desktop
if test "${DRONE_TARGET_BRANCH}" = "stable-2.6"; then
UBUNTU_DISTRIBUTIONS="bionic focal hirsute impish"
UBUNTU_DISTRIBUTIONS="bionic focal impish jammy"
DEBIAN_DISTRIBUTIONS="buster stretch testing"
else
UBUNTU_DISTRIBUTIONS="focal hirsute impish"
UBUNTU_DISTRIBUTIONS="focal impish jammy"
DEBIAN_DISTRIBUTIONS="testing"
fi

View File

@@ -26,6 +26,8 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/make-msi.bat
Platform.wxi
Nextcloud.wxs
RegistryCleanup.vbs
RegistryCleanupCustomAction.wxs
gui/banner.bmp
gui/dialog.bmp
DESTINATION msi/)

View File

@@ -76,12 +76,16 @@
<!-- Uninstall: Remove sync folders from Explorer's Navigation Pane, only effective for the current user (home users) -->
<Custom Action="RemoveNavigationPaneEntries" After="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
<!-- Uninstall: Cleanup the Registry -->
<Custom Action="RegistryCleanupCustomAction" After="RemoveFiles">(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>
<!-- Schedule Reboot for the Shell Extensions (in silent installation mode only, or if SCHEDULE_REBOOT argument is set-->
<ScheduleReboot After="InstallFinalize">(SCHEDULE_REBOOT=1) OR NOT (UILevel=2)</ScheduleReboot>
</InstallExecuteSequence>
<!-- "Add or Remove" Programs Entries -->
<Property Id="APPNAME">$(var.AppName)</Property>
<Property Id="ARPPRODUCTICON">$(var.AppIcon)</Property>
<Property Id="ARPHELPLINK">$(var.AppHelpLink)</Property>
<Property Id="ARPURLINFOABOUT">$(var.AppInfoLink)</Property>

View File

@@ -0,0 +1,54 @@
On Error goto 0
Const HKEY_LOCAL_MACHINE = &H80000002
Const strObjRegistry = "winmgmts:\\.\root\default:StdRegProv"
Function RegistryDeleteKeyRecursive(regRoot, strKeyPath)
Set objRegistry = GetObject(strObjRegistry)
objRegistry.EnumKey regRoot, strKeyPath, arrSubkeys
If IsArray(arrSubkeys) Then
For Each strSubkey In arrSubkeys
RegistryDeleteKeyRecursive regRoot, strKeyPath & "\" & strSubkey
Next
End If
objRegistry.DeleteKey regRoot, strKeyPath
End Function
Function RegistryListSubkeys(regRoot, strKeyPath)
Set objRegistry = GetObject(strObjRegistry)
objRegistry.EnumKey regRoot, strKeyPath, arrSubkeys
RegistryListSubkeys = arrSubkeys
End Function
Function GetUserSID()
Dim objWshNetwork, objUserAccount
Set objWshNetwork = CreateObject("WScript.Network")
Set objUserAccount = GetObject("winmgmts://" & objWshNetwork.UserDomain & "/root/cimv2").Get("Win32_UserAccount.Domain='" & objWshNetwork.ComputerName & "',Name='" & objWshNetwork.UserName & "'")
GetUserSID = objUserAccount.SID
End Function
Function RegistryCleanupSyncRootManager()
strSyncRootManagerKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager"
arrSubKeys = RegistryListSubkeys(HKEY_LOCAL_MACHINE, strSyncRootManagerKeyPath)
If IsArray(arrSubkeys) Then
arrSubkeys=Filter(arrSubkeys, Session.Property("APPNAME"))
End If
If IsArray(arrSubkeys) Then
arrSubkeys=Filter(arrSubkeys, GetUserSID())
End If
If IsArray(arrSubkeys) Then
For Each strSubkey In arrSubkeys
RegistryDeleteKeyRecursive HKEY_LOCAL_MACHINE, strSyncRootManagerKeyPath & "\" & strSubkey
Next
End If
End Function
Function RegistryCleanup()
RegistryCleanupSyncRootManager()
End Function

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Binary Id="RegistryCleanup" SourceFile="RegistryCleanup.vbs"/>
<CustomAction Id='RegistryCleanupCustomAction' BinaryKey="RegistryCleanup" VBScriptCall="RegistryCleanup" Return="ignore" Execute="immediate"/>
</Fragment>
</Wix>

View File

@@ -17,10 +17,10 @@ Rem Generate collect.wxs
if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%
Rem Compile en-US (https://www.firegiant.com/wix/tutorial/transforms/morphing-installers/)
"%WIX%\bin\candle.exe" -dcodepage=1252 -dPlatform=%BuildArch% -arch %BuildArch% -dHarvestAppDir="%HarvestAppDir%" -ext WixUtilExtension NCMsiHelper.wxs WinShellExt.wxs collect.wxs Nextcloud.wxs
"%WIX%\bin\candle.exe" -dcodepage=1252 -dPlatform=%BuildArch% -arch %BuildArch% -dHarvestAppDir="%HarvestAppDir%" -ext WixUtilExtension NCMsiHelper.wxs WinShellExt.wxs collect.wxs Nextcloud.wxs RegistryCleanupCustomAction.wxs
if %ERRORLEVEL% neq 0 exit %ERRORLEVEL%
Rem Link MSI package
"%WIX%\bin\light.exe" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us NCMsiHelper.wixobj WinShellExt.wixobj collect.wixobj Nextcloud.wixobj -out "@MSI_INSTALLER_FILENAME@"
"%WIX%\bin\light.exe" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us NCMsiHelper.wixobj WinShellExt.wixobj collect.wixobj Nextcloud.wixobj RegistryCleanupCustomAction.wixobj -out "@MSI_INSTALLER_FILENAME@"
exit %ERRORLEVEL%

View File

@@ -41,7 +41,7 @@
# target does not have the ``WIN32_EXECUTABLE`` property set.
# * One of the tools png2ico (See :find-module:`FindPng2Ico`) or
# icotool (see :find-module:`FindIcoTool`) is required.
# * Supported sizes: 16, 24, 32, 48, 64, 128, 256, 512 and 1024.
# * Supported sizes: 16, 20, 24, 32, 40, 48, 64, 128, 256, 512 and 1024.
#
# Mac OS X notes
# * The executable target must have the ``MACOSX_BUNDLE`` property set.
@@ -102,9 +102,12 @@ include(CMakeParseArguments)
function(ecm_add_app_icon appsources)
set(options)
set(oneValueArgs OUTFILE_BASENAME)
set(multiValueArgs ICONS SIDEBAR_ICONS)
set(oneValueArgs OUTFILE_BASENAME ICON_INDEX)
set(multiValueArgs ICONS SIDEBAR_ICONS RC_DEPENDENCIES)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT ARG_ICON_INDEX)
set(ARG_ICON_INDEX 1)
endif()
if(NOT ARG_ICONS)
message(FATAL_ERROR "No ICONS argument given to ecm_add_app_icon")
@@ -138,8 +141,11 @@ function(ecm_add_app_icon appsources)
endforeach()
endif()
_ecm_add_app_icon_categorize_icons("${ARG_ICONS}" "icons" "16;24;32;48;64;128;256;512;1024")
if (WIN32)
_ecm_add_app_icon_categorize_icons("${ARG_ICONS}" "icons" "16;20;24;32;40;48;64;128;256;512;1024")
else()
_ecm_add_app_icon_categorize_icons("${ARG_ICONS}" "icons" "16;24;32;48;64;128;256;512;1024")
endif()
if(ARG_SIDEBAR_ICONS)
_ecm_add_app_icon_categorize_icons("${ARG_SIDEBAR_ICONS}" "sidebar_icons" "16;32;64;128;256")
endif()
@@ -168,8 +174,10 @@ function(ecm_add_app_icon appsources)
set(windows_icons ${icons_at_16px}
${icons_at_20px}
${icons_at_24px}
${icons_at_32px}
${icons_at_40px}
${icons_at_48px}
${icons_at_64px}
${icons_at_128px}
@@ -204,12 +212,12 @@ function(ecm_add_app_icon appsources)
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
# this bit's a little hacky to make the dependency stuff work
file(WRITE "${_outfilename}.rc.in" "IDI_ICON1 ICON DISCARDABLE \"${_outfilename}.ico\"\n")
file(WRITE "${_outfilename}.rc.in" "IDI_ICON${ARG_ICON_INDEX} ICON DISCARDABLE \"${_outfilename}.ico\"\n")
add_custom_command(
OUTPUT "${_outfilename}.rc"
COMMAND ${CMAKE_COMMAND}
ARGS -E copy "${_outfilename}.rc.in" "${_outfilename}.rc"
DEPENDS "${_outfilename}.ico"
DEPENDS ${ARG_RC_DEPENDENCIES} "${_outfilename}.ico"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
endfunction()
@@ -226,7 +234,7 @@ function(ecm_add_app_icon appsources)
endif()
endforeach()
foreach(size 16 24 32 48 64 128 ${maxSize})
foreach(size 16 20 24 32 40 48 64 128 ${maxSize})
if(NOT icons_at_${size}px)
continue()
endif()

View File

@@ -31,9 +31,9 @@
#cmakedefine APPLICATION_VIRTUALFILE_SUFFIX "@APPLICATION_VIRTUALFILE_SUFFIX@"
#cmakedefine APPLICATION_OCSP_STAPLING_ENABLED "@APPLICATION_OCSP_STAPLING_ENABLED@"
#cmakedefine APPLICATION_FORBID_BAD_SSL "@APPLICATION_FORBID_BAD_SSL@"
#cmakedefine APPLICATION_LOGIN_WITH_SYSTEM_USERNAME "@APPLICATION_LOGIN_WITH_SYSTEM_USERNAME@"
#define APPLICATION_DOTVIRTUALFILE_SUFFIX "." APPLICATION_VIRTUALFILE_SUFFIX
#cmakedefine01 ENFORCE_VIRTUAL_FILES_SYNC_FOLDER
#cmakedefine DO_NOT_USE_PROXY "@DO_NOT_USE_PROXY@"
#cmakedefine ZLIB_FOUND @ZLIB_FOUND@
@@ -42,4 +42,6 @@
#cmakedefine01 GUI_TESTING
#cmakedefine BUILD_UPDATER "@BUILD_UPDATER@"
#endif

View File

@@ -21,7 +21,7 @@ result, the Nextcloud Client runs on Linux, Windows, and MacOS.
The Synchronization Process
---------------------------
The process of synchronization keeps files in two separate repositories the
The process of synchronization keeps files in two separate repositories the
same. When synchronized:
- If a file is added to one repository it is copied to the other synchronized repository.
@@ -93,7 +93,7 @@ traverses the file tree and compares the modification time of each file with an
expected value stored in its database. If the value is not the same, the client
determines that the file has been modified in the local repository.
.. note:: On the local side, the modification time is a good attribute to use for
.. note:: On the local side, the modification time is a good attribute to use for
detecting changes, because
the value does not depend on time shifts and such.
@@ -122,7 +122,7 @@ Conflict files are always created on the client and never on the server.
In ownCloud 10.0 we implemented a checksum feature which checks the file integrity on upload and download by computing a checksum after the file transfer finishes.
The client queries the server capabilities after login to decide which checksum algorithm to use.
Currently, SHA1 is hard-coded in the official server release and can't be changed by the end-user.
Currently, SHA1 is hard-coded in the official server release and can't be changed by the end-user.
Note that the server additionally also supports MD5 and Adler-32, but the desktop client will always use the checksum algorithm announced in the capabilities:
::
@@ -202,14 +202,14 @@ Conflict files are always created on the client and never on the server.
Upload
~~~~~~
A checksum is calculated with the previously negotiated algorithm by the client and sent along with the file in an HTTP Header.
A checksum is calculated with the previously negotiated algorithm by the client and sent along with the file in an HTTP Header.
```OC-Checksum: [algorithm]:[checksum]```
.. image:: ./images/checksums/client-activity.png
During file upload, the server computes SHA1, MD5, and Adler-32 checksums and compares one of them to the checksum supplied by the client.
During file upload, the server computes SHA1, MD5, and Adler-32 checksums and compares one of them to the checksum supplied by the client.
On mismatch, the server returns HTTP Status code 400 (Bad Request) thus signaling the client that the upload failed.
On mismatch, the server returns HTTP Status code 400 (Bad Request) thus signaling the client that the upload failed.
The server then discards the upload, and the client blacklists the file:
.. image:: ./images/checksums/testing-checksums.png
@@ -223,29 +223,29 @@ Conflict files are always created on the client and never on the server.
client.</s:message>
</d:error>
The client retries the upload using exponential back-off.
The client retries the upload using exponential back-off.
On success (matching checksum) the computed checksums are stored by the server in ``oc_filecache`` alongside the file.
Chunked Upload
~~~~~~~~~~~~~~
Mostly same as above.
The checksum of the full file is sent with every chunk of the file.
Mostly same as above.
The checksum of the full file is sent with every chunk of the file.
But the server only compares the checksum after receiving the checksum sent with the last chunk.
Download
~~~~~~~~
The server sends the checksum in an HTTP header with the file. (same format as above).
If no checksum is found in ``oc_filecache`` (freshly mounted external storage) it is computed and stored in ``oc_filecache`` on the first download.
The checksum is then provided on all subsequent downloads but not on the first.
If no checksum is found in ``oc_filecache`` (freshly mounted external storage) it is computed and stored in ``oc_filecache`` on the first download.
The checksum is then provided on all subsequent downloads but not on the first.
.. _ignored-files-label:
Ignored Files
-------------
The Nextcloud Client supports the ability to exclude or ignore certain files from the synchronization process.
The Nextcloud Client supports the ability to exclude or ignore certain files from the synchronization process.
Some system wide file patterns that are used to exclude or ignore files are included with the client by default and the Nextcloud Client provides the ability to add custom patterns.
By default, the Nextcloud Client ignores the following files:
@@ -262,18 +262,18 @@ By default, the Nextcloud Client ignores the following files:
If a pattern selected using a checkbox in the `ignoredFilesEditor-label` (or if
a line in the exclude file starts with the character ``]`` directly followed by
the file pattern), files matching the pattern are considered *fleeting meta
data*.
data*.
These files are ignored and *removed* by the client if found in the
synchronized folder.
synchronized folder.
This is suitable for meta files created by some applications that have no sustainable meaning.
If a pattern ends with the forward slash (``/``) character, only directories are matched.
If a pattern ends with the forward slash (``/``) character, only directories are matched.
The pattern is only applied for directory components of filenames selected using the checkbox.
To match filenames against the exclude patterns, the UNIX standard C library
function ``fnmatch`` is used.
This process checks the filename against the specified pattern using standard shell wildcard pattern matching.
function ``fnmatch`` is used.
This process checks the filename against the specified pattern using standard shell wildcard pattern matching.
For more information, please refer to `The opengroup website
<http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_13_01>`_.
@@ -369,7 +369,7 @@ is renamed or moved.
Example:
<oc:id>00000020oc5cfy6qqizm</oc:id>
End-to-end Encryption
---------------------
@@ -440,13 +440,3 @@ Files that must be removed from the local storage only, need to be dehydrated vi
.. note::
* End-to-end Encryption works with Virtual Files (VFS) but only on a per-folder level. Folders with E2EE can be made available offline in their entirety, but the individual files in them can not be retrieved on demand. This is mainly due to two technical reasons. First, the Windows VFS API is not designed for handling encrypted files. Second, while the VFS is designed to deal mostly with large files, E2EE is mostly recommended for use with small files as encrypting and decrypting large files puts large demands on the computer infrastructure.
User Status
-----------
Starting from 3.2.0, user status is displayed in the Nextcloud desktop client's tray window. The icon and a text message are displayed as long as those are set in the user's account menu in the Web UI (server's website). At the moment, setting the status from the desktop client is not available.
The status is updated almost immediately after it is set in the Web UI. Default user status is always "Online" if no other status is available from the server-side.
.. image:: images/status_feature_example.png
:alt: User Status feature in the tray window

View File

@@ -48,9 +48,9 @@ copyright = u'2013-2021, The Nextcloud developers'
# built documents.
#
# The short X.Y version.
version = '3.3'
version = '3.4'
# The full version, including alpha/beta/rc tags.
release = '3.3.82'
release = '3.4.50'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -8,7 +8,9 @@ There are clients for Linux, macOs, and Microsoft Windows.
The currently supported server releases are the latest three stable versions
at time of publication. It means that the |version| release series is supporting
server major version 20, 21 and 22.
stable server major versions.
See https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule for
supported major versions.
Installation on Mac OS X and Windows is the same as for any software
application: download the program and then double-click it to launch the

View File

@@ -1,3 +1,4 @@
===========
Visual Tour
===========
@@ -11,23 +12,7 @@ as an icon in the system tray (Windows, KDE), status bar
(macOS), or notification area (Ubuntu).
.. image:: images/icon.png
Main dialog
~~~~~~~~~~~
.. index:: activity, recent changes, sync activity, main dialog, adding account, account, add account, remove account
The main dialog, which can be invoked from the tray icon in the
taskbar, will show files information about the activities of the sync
client and Nextcloud. If there are any synchronization issues, they
will show up here. The dialog also gives information about other
activities or notifications like Talk mentions or file changes. It
does also show the status of the user.
.. image:: images/main_dialog.png
When clicking on the avatar a menu opens where it is possible to add a
new account or removing an existing account.
:alt: desktop client icon
Menu
----
@@ -45,8 +30,9 @@ A right click on the icon provides the following menu:
.. NOTE::
This menu is not available on macOS.
Settings
--------
~~~~~~~~
Account Settings
~~~~~~~~~~~~~~~~
@@ -218,3 +204,98 @@ while syncing for a three times. These are listed in the activity view.
There also is a button to retry the sync for another three times.
For more detailed information see :ref:`ignored-files-label`.
Main dialog
-----------
.. index:: activity, recent changes, sync activity, main dialog, adding account, account, add account, remove account, sync state, user status, unified search, share dialog
Sync State
~~~~~~~~~~
The main dialog, which can be invoked from the tray icon in the
taskbar, will show files information about the activities of the sync
client and Nextcloud.
.. image:: images/sync-state-paused.png
:alt: sync state paused
.. image:: images/sync-state-syncing.png
:alt: sync state syncing
.. image:: images/sync-state-synced.png
:alt: sync state synced
If there are any synchronization issues, they will show up here:
.. image:: images/sync-state-warnings.png
:alt: sync state warnings
For more information on how to solve these issues see :doc:`troubleshooting`.
When clicking on the avatar a menu opens where it is
possible to add a new account or removing an existing account.
.. image:: images/user-account-options.png
:alt: user account options
User Status
~~~~~~~~~~~
User status is displayed in the Nextcloud desktop client's tray window.
Default user status is always "Online" if no other status is available from the server-side.
.. image:: images/status_feature_example.png
:alt: User Status feature in the tray window
When clicking on ``Set status`` you can edit the emoji, message and the timer to clear your user status:
.. image:: images/set-user-status.png
:alt: set user status menu option
|
.. image:: images/set-user-status-menu.png
:alt: changing the user status
Activities list
~~~~~~~~~~~~~~~
The dialog also gives information about other activities or
notifications like Talk mentions or file changes.
It does also show the status of the user.
.. image:: images/main_dialog.png
:alt: main dialog activities list
Unified search
~~~~~~~~~~~~~~
With the unified search you can find everything you have in your server - files,
Talk messages, calendar appointments:
.. image:: images/unified-search-files.png
:alt: unified search files search result
.. image:: images/unified-search-talk.png
:alt: unified search Talk conversations search result
.. image:: images/unified-search-events.png
:alt: unified search calendar appointments search result
Share dialog: Talk options and View Profile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can now share a file directly in a conversation in Talk and view the sharee user profile:
.. image:: images/open-share-dialog.png
:alt: open share dialog option
|
.. image:: images/share-dialog-view-profile.png
:alt: shared dialog sharing options

View File

@@ -23,5 +23,10 @@
<file>src/gui/tray/UnifiedSearchResultListItem.qml</file>
<file>src/gui/tray/UnifiedSearchResultNothingFound.qml</file>
<file>src/gui/tray/UnifiedSearchResultSectionItem.qml</file>
<file>src/gui/tray/CustomButton.qml</file>
<file>src/gui/tray/CustomTextButton.qml</file>
<file>src/gui/tray/ActivityItemContextMenu.qml</file>
<file>src/gui/tray/ActivityItemActions.qml</file>
<file>src/gui/tray/ActivityItemContent.qml</file>
</qresource>
</RCC>

View File

@@ -337,7 +337,7 @@ ComputeChecksum *ValidateChecksumHeader::prepareStart(const QByteArray &checksum
if (!parseChecksumHeader(checksumHeader, &_expectedChecksumType, &_expectedChecksum)) {
qCWarning(lcChecksums) << "Checksum header malformed:" << checksumHeader;
emit validationFailed(tr("The checksum header is malformed."));
emit validationFailed(tr("The checksum header is malformed."), _calculatedChecksumType, _calculatedChecksum, ChecksumHeaderMalformed);
return nullptr;
}
@@ -360,15 +360,30 @@ void ValidateChecksumHeader::start(std::unique_ptr<QIODevice> device, const QByt
calculator->start(std::move(device));
}
QByteArray ValidateChecksumHeader::calculatedChecksumType() const
{
return _calculatedChecksumType;
}
QByteArray ValidateChecksumHeader::calculatedChecksum() const
{
return _calculatedChecksum;
}
void ValidateChecksumHeader::slotChecksumCalculated(const QByteArray &checksumType,
const QByteArray &checksum)
{
_calculatedChecksumType = checksumType;
_calculatedChecksum = checksum;
if (checksumType != _expectedChecksumType) {
emit validationFailed(tr("The checksum header contained an unknown checksum type \"%1\"").arg(QString::fromLatin1(_expectedChecksumType)));
emit validationFailed(tr("The checksum header contained an unknown checksum type \"%1\"").arg(QString::fromLatin1(_expectedChecksumType)),
_calculatedChecksumType, _calculatedChecksum, ChecksumTypeUnknown);
return;
}
if (checksum != _expectedChecksum) {
emit validationFailed(tr(R"(The downloaded file does not match the checksum, it will be resumed. "%1" != "%2")").arg(QString::fromUtf8(_expectedChecksum), QString::fromUtf8(checksum)));
emit validationFailed(tr(R"(The downloaded file does not match the checksum, it will be resumed. "%1" != "%2")").arg(QString::fromUtf8(_expectedChecksum), QString::fromUtf8(checksum)),
_calculatedChecksumType, _calculatedChecksum, ChecksumMismatch);
return;
}
emit validated(checksumType, checksum);

View File

@@ -140,6 +140,14 @@ class OCSYNC_EXPORT ValidateChecksumHeader : public QObject
{
Q_OBJECT
public:
enum FailureReason {
Success,
ChecksumHeaderMalformed,
ChecksumTypeUnknown,
ChecksumMismatch,
};
Q_ENUM(FailureReason)
explicit ValidateChecksumHeader(QObject *parent = nullptr);
/**
@@ -161,9 +169,13 @@ public:
*/
void start(std::unique_ptr<QIODevice> device, const QByteArray &checksumHeader);
QByteArray calculatedChecksumType() const;
QByteArray calculatedChecksum() const;
signals:
void validated(const QByteArray &checksumType, const QByteArray &checksum);
void validationFailed(const QString &errMsg);
void validationFailed(const QString &errMsg, const QByteArray &calculatedChecksumType,
const QByteArray &calculatedChecksum, const ValidateChecksumHeader::FailureReason reason);
private slots:
void slotChecksumCalculated(const QByteArray &checksumType, const QByteArray &checksum);
@@ -173,6 +185,9 @@ private:
QByteArray _expectedChecksumType;
QByteArray _expectedChecksum;
QByteArray _calculatedChecksumType;
QByteArray _calculatedChecksum;
};
/**

View File

@@ -18,6 +18,7 @@
#include "asserts.h"
#include "utility.h"
#include "gui/configgui.h"
#include <comdef.h>
#include <Lmcons.h>
@@ -48,7 +49,14 @@ static void setupFavLink_private(const QString &folder)
desktopIni.open(QFile::WriteOnly);
desktopIni.write("[.ShellClassInfo]\r\nIconResource=");
desktopIni.write(QDir::toNativeSeparators(qApp->applicationFilePath()).toUtf8());
desktopIni.write(",0\r\n");
#ifdef APPLICATION_FOLDER_ICON_INDEX
const auto iconIndex = APPLICATION_FOLDER_ICON_INDEX;
#else
const auto iconIndex = "0";
#endif
desktopIni.write(",");
desktopIni.write(iconIndex);
desktopIni.write("\r\n");
desktopIni.close();
// Set the folder as system and Desktop.ini as hidden+system for explorer to pick it.

View File

@@ -1,5 +1,14 @@
project(gui)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg Qml Quick QuickControls2 Xml Network)
if(QUICK_COMPILER)
find_package(Qt5QuickCompiler)
set_package_properties(Qt5QuickCompiler PROPERTIES
DESCRIPTION "Compile QML at build time"
TYPE REQUIRED
)
endif()
if (NOT TARGET Qt5::GuiPrivate)
message(FATAL_ERROR "Could not find GuiPrivate component of Qt5. It might be shipped as a separate package, please check that.")
endif()
@@ -13,14 +22,12 @@ IF(BUILD_UPDATER)
endif()
configure_file(${CMAKE_SOURCE_DIR}/theme.qrc.in ${CMAKE_SOURCE_DIR}/theme.qrc)
set(MIRALL_RC_SRC ../../resources.qrc)
list(APPEND MIRALL_RC_SRC ${CMAKE_SOURCE_DIR}/theme.qrc)
set(theme_dir ${CMAKE_SOURCE_DIR}/theme)
set(client_UI_SRCS
accountsettings.ui
conflictdialog.ui
internallinkwidget.ui
invalidfilenamedialog.ui
foldercreationdialog.ui
folderwizardsourcepage.ui
@@ -37,23 +44,9 @@ set(client_UI_SRCS
shareuserline.ui
sslerrordialog.ui
addcertificatedialog.ui
passwordinputdialog.ui
proxyauthdialog.ui
mnemonicdialog.ui
UserStatusSelector.qml
UserStatusSelectorDialog.qml
tray/ActivityActionButton.qml
tray/ActivityItem.qml
tray/ActivityList.qml
tray/Window.qml
tray/UserLine.qml
tray/UnifiedSearchInputContainer.qml
tray/UnifiedSearchResultFetchMoreTrigger.qml
tray/UnifiedSearchResultItem.qml
tray/UnifiedSearchResultItemSkeleton.qml
tray/UnifiedSearchResultItemSkeletonContainer.qml
tray/UnifiedSearchResultListItem.qml
tray/UnifiedSearchResultNothingFound.qml
tray/UnifiedSearchResultSectionItem.qml
wizard/flow2authwidget.ui
wizard/owncloudadvancedsetuppage.ui
wizard/owncloudconnectionmethoddialog.ui
@@ -64,6 +57,12 @@ set(client_UI_SRCS
wizard/welcomepage.ui
)
if(QUICK_COMPILER)
qtquick_compiler_add_resources(client_UI_SRCS ../../resources.qrc ${CMAKE_SOURCE_DIR}/theme.qrc)
else()
qt_add_resources(client_UI_SRCS ../../resources.qrc ${CMAKE_SOURCE_DIR}/theme.qrc)
endif()
set(client_SRCS
accountmanager.cpp
accountsettings.cpp
@@ -82,6 +81,7 @@ set(client_SRCS
folderwizard.cpp
generalsettings.cpp
legalnotice.cpp
internallinkwidget.cpp
ignorelisteditor.cpp
ignorelisttablewidget.cpp
lockwatcher.cpp
@@ -95,6 +95,7 @@ set(client_SRCS
openfilemanager.cpp
owncloudgui.cpp
owncloudsetupwizard.cpp
passwordinputdialog.cpp
selectivesyncdialog.cpp
settingsdialog.cpp
sharedialog.cpp
@@ -232,7 +233,6 @@ IF( WIN32 )
ENDIF()
set( final_src
${MIRALL_RC_SRC}
${client_SRCS}
${client_UI_SRCS}
${guiMoc}
@@ -258,6 +258,10 @@ if (NOT DEFINED APPLICATION_ICON_NAME)
set(APPLICATION_ICON_NAME ${APPLICATION_SHORTNAME})
endif()
if(NOT DEFINED APPLICATION_FOLDER_ICON_INDEX)
set(APPLICATION_FOLDER_ICON_INDEX 0)
endif()
# Generate png icons from svg
find_program(SVG_CONVERTER
NAMES inkscape inkscape.exe rsvg-convert
@@ -269,9 +273,24 @@ if (NOT SVG_CONVERTER)
endif()
function(generate_sized_png_from_svg icon_path size)
set(options)
set(oneValueArgs OUTPUT_ICON_NAME OUTPUT_ICON_PATH)
set(multiValueArgs)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
get_filename_component(icon_name_dir ${icon_path} DIRECTORY)
get_filename_component(icon_name_wle ${icon_path} NAME_WLE)
if (ARG_OUTPUT_ICON_NAME)
set(icon_name_wle ${ARG_OUTPUT_ICON_NAME})
endif ()
if (ARG_OUTPUT_ICON_PATH)
set(icon_name_dir ${ARG_OUTPUT_ICON_PATH})
endif ()
if (EXISTS "${icon_name_dir}/${size}-${icon_name_wle}.png")
return()
endif()
@@ -317,22 +336,86 @@ if(WIN32)
endif()
set(APP_ICON_SVG "${theme_dir}/colored/${APPLICATION_ICON_NAME}-icon.svg")
generate_sized_png_from_svg(${APP_ICON_SVG} 16)
generate_sized_png_from_svg(${APP_ICON_SVG} 24)
generate_sized_png_from_svg(${APP_ICON_SVG} 32)
generate_sized_png_from_svg(${APP_ICON_SVG} 48)
generate_sized_png_from_svg(${APP_ICON_SVG} 64)
generate_sized_png_from_svg(${APP_ICON_SVG} 128)
generate_sized_png_from_svg(${APP_ICON_SVG} 256)
generate_sized_png_from_svg(${APP_ICON_SVG} 512)
generate_sized_png_from_svg(${APP_ICON_SVG} 1024)
# generate secondary icon if available (currently for Windows only)--------------------------------------
set(APP_SECONDARY_ICONS "${theme_dir}/colored/icons")
set(APP_ICON_WIN_FOLDER_SVG "${APP_SECONDARY_ICONS}/${APPLICATION_ICON_NAME}-icon-win-folder.svg")
set(RC_DEPENDENCIES "")
if(WIN32)
if (EXISTS ${APP_ICON_WIN_FOLDER_SVG})
get_filename_component(output_icon_name_win ${APP_ICON_WIN_FOLDER_SVG} NAME_WLE)
# Product icon (for smallest size)
foreach(size IN ITEMS 16;20)
generate_sized_png_from_svg(${APP_ICON_SVG} ${size} OUTPUT_ICON_NAME ${output_icon_name_win} OUTPUT_ICON_PATH "${APP_SECONDARY_ICONS}/")
endforeach()
# Product icon with Windows folder (for sizes larger than 20)
foreach(size IN ITEMS 24;32;40;48;64;128;256;512;1024)
generate_sized_png_from_svg(${APP_ICON_WIN_FOLDER_SVG} ${size} OUTPUT_ICON_NAME ${output_icon_name_win} OUTPUT_ICON_PATH "${APP_SECONDARY_ICONS}/")
endforeach()
file(GLOB_RECURSE OWNCLOUD_ICONS_WIN_FOLDER "${APP_SECONDARY_ICONS}/*-${APPLICATION_ICON_NAME}-icon*")
set(APP_ICON_WIN_FOLDER_ICO_NAME "${APPLICATION_ICON_NAME}-win-folder")
set(RC_DEPENDENCIES "${RC_DEPENDENCIES} ${APP_ICON_WIN_FOLDER_ICO_NAME}.ico")
ecm_add_app_icon(APP_ICON_WIN_FOLDER ICONS "${OWNCLOUD_ICONS_WIN_FOLDER}" SIDEBAR_ICONS "${OWNCLOUD_SIDEBAR_ICONS}" OUTFILE_BASENAME "${APP_ICON_WIN_FOLDER_ICO_NAME}" ICON_INDEX 2)
endif()
endif()
# --------------------------------------
if (NOT ${RC_DEPENDENCIES} STREQUAL "")
string(STRIP ${RC_DEPENDENCIES} RC_DEPENDENCIES)
endif()
# generate primary icon from SVG (due to Win .ico vs .rc dependency issues, primary icon must always be generated last)--------------------------------------
if(WIN32)
foreach(size IN ITEMS 16;20;24;32;40;48;64;128;256;512;1024)
generate_sized_png_from_svg(${APP_ICON_SVG} ${size})
endforeach()
else()
foreach(size IN ITEMS 16;24;32;48;64;128;256;512;1024)
generate_sized_png_from_svg(${APP_ICON_SVG} ${size})
endforeach()
endif()
file(GLOB_RECURSE OWNCLOUD_ICONS "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-icon*")
if(APPLE)
file(GLOB_RECURSE OWNCLOUD_SIDEBAR_ICONS "${theme_dir}/colored/*-${APPLICATION_ICON_NAME}-sidebar*")
MESSAGE(STATUS "OWNCLOUD_SIDEBAR_ICONS: ${APPLICATION_ICON_NAME}: ${OWNCLOUD_SIDEBAR_ICONS}")
endif()
ecm_add_app_icon(APP_ICON ICONS "${OWNCLOUD_ICONS}" SIDEBAR_ICONS "${OWNCLOUD_SIDEBAR_ICONS}" OUTFILE_BASENAME "${APPLICATION_ICON_NAME}")
ecm_add_app_icon(APP_ICON RC_DEPENDENCIES ${RC_DEPENDENCIES} ICONS "${OWNCLOUD_ICONS}" SIDEBAR_ICONS "${OWNCLOUD_SIDEBAR_ICONS}" OUTFILE_BASENAME "${APPLICATION_ICON_NAME}" ICON_INDEX 1)
# --------------------------------------
if(WIN32)
# merge *.rc.in files for Windows (multiple ICON resources must be placed in a single file, otherwise, this won't work de to a bug in Windows compiler https://developercommunity.visualstudio.com/t/visual-studio-2017-prof-1557-cvt1100-duplicate-res/363156)
function(merge_files IN_FILE OUT_FILE)
file(READ ${IN_FILE} CONTENTS)
message("Merging ${IN_FILE} into ${OUT_FILE}")
file(APPEND ${OUT_FILE} "${CONTENTS}")
endfunction()
message("APP_ICON is: ${APP_ICON}")
if(APP_ICON)
get_filename_component(RC_IN_FOLDER ${APP_ICON}} DIRECTORY)
file(GLOB_RECURSE RC_IN_FILES "${RC_IN_FOLDER}/*rc.in")
foreach(rc_in_file IN ITEMS ${RC_IN_FILES})
get_filename_component(rc_in_file_name ${rc_in_file} NAME)
get_filename_component(app_icon_name "${APP_ICON}.in" NAME)
if(NOT "${rc_in_file_name}" STREQUAL "${app_icon_name}")
merge_files(${rc_in_file} "${APP_ICON}.in")
if (DEFINED APPLICATION_FOLDER_ICON_INDEX)
MATH(EXPR APPLICATION_FOLDER_ICON_INDEX "${APPLICATION_FOLDER_ICON_INDEX}+1")
message("APPLICATION_FOLDER_ICON_INDEX is now set to: ${APPLICATION_FOLDER_ICON_INDEX}")
endif()
endif()
endforeach()
endif()
endif()
# --------------------------------------
if(UNIX AND NOT APPLE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
@@ -368,7 +451,6 @@ endif()
set_target_properties(nextcloudCore
PROPERTIES
AUTOUIC ON
AUTORCC ON
AUTOMOC ON
)
@@ -545,3 +627,5 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE AND NOT WIN32)
update_xdg_mimetypes( ${CMAKE_INSTALL_DATADIR}/mime/packages )
endif(SharedMimeInfo_FOUND)
endif()
configure_file(configgui.h.in ${CMAKE_CURRENT_BINARY_DIR}/configgui.h)

View File

@@ -24,11 +24,7 @@ ColumnLayout {
spacing: 0
property NC.UserStatusSelectorModel userStatusSelectorModel
FontMetrics {
id: metrics
}
Text {
Label {
Layout.topMargin: 16
Layout.leftMargin: 8
Layout.rightMargin: 8
@@ -89,7 +85,7 @@ ColumnLayout {
}
}
Text {
Label {
Layout.topMargin: 16
Layout.leftMargin: 8
Layout.rightMargin: 8
@@ -108,8 +104,8 @@ ColumnLayout {
Layout.fillWidth: true
Button {
Layout.preferredWidth: userStatusMessageTextField.height // metrics.height * 2
Layout.preferredHeight: userStatusMessageTextField.height // metrics.height * 2
Layout.preferredWidth: userStatusMessageTextField.height
Layout.preferredHeight: userStatusMessageTextField.height
text: userStatusSelectorModel.userStatusEmoji
onClicked: emojiDialog.open()
}
@@ -161,7 +157,7 @@ ColumnLayout {
Layout.bottomMargin: 8
Layout.alignment: Qt.AlignTop
Text {
Label {
text: qsTr("Clear status message after")
}

View File

@@ -587,6 +587,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
ac = availabilityMenu->addAction(Utility::vfsPinActionText());
connect(ac, &QAction::triggered, this, [this]() { slotSetCurrentFolderAvailability(PinState::AlwaysLocal); });
ac->setDisabled(Theme::instance()->enforceVirtualFilesSyncFolder());
ac = availabilityMenu->addAction(Utility::vfsFreeSpaceActionText());
connect(ac, &QAction::triggered, this, [this]() { slotSetCurrentFolderAvailability(PinState::OnlineOnly); });

View File

@@ -221,6 +221,19 @@ void AccountState::setDesktopNotificationsAllowed(bool isAllowed)
emit desktopNotificationsAllowedChanged();
}
AccountState::ConnectionStatus AccountState::lastConnectionStatus() const
{
return _lastConnectionValidatorStatus;
}
void AccountState::trySignIn()
{
if (isSignedOut() && account()) {
account()->resetRejectedCertificates();
signIn();
}
}
void AccountState::checkConnectivity()
{
if (isSignedOut() || _waitingForNewCredentials) {
@@ -285,6 +298,8 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta
return;
}
_lastConnectionValidatorStatus = status;
// Come online gradually from 503 or maintenance mode
if (status == ConnectionValidator::Connected
&& (_connectionStatus == ConnectionValidator::ServiceUnavailable

View File

@@ -171,6 +171,10 @@ public:
*/
void setDesktopNotificationsAllowed(bool isAllowed);
ConnectionStatus lastConnectionStatus() const;
void trySignIn();
public slots:
/// Triggers a ping to the server to update state and
/// connection status and errors.
@@ -205,6 +209,7 @@ private:
AccountPtr _account;
State _state;
ConnectionStatus _connectionStatus;
ConnectionStatus _lastConnectionValidatorStatus = ConnectionStatus::Undefined;
QStringList _connectionErrors;
bool _waitingForNewCredentials;
QDateTime _timeOfLastETagCheck;

View File

@@ -250,6 +250,10 @@ Application::Application(int &argc, char **argv)
}
}
if (_theme->doNotUseProxy()) {
ConfigFile().setProxyType(QNetworkProxy::NoProxy);
}
parseOptions(arguments());
//no need to waste time;
if (_helpOnly || _versionOnly)
@@ -465,6 +469,9 @@ void Application::slotCheckConnection()
if (state != AccountState::SignedOut && state != AccountState::ConfigurationError
&& state != AccountState::AskingCredentials && !pushNotificationsAvailable) {
accountState->checkConnectivity();
} else if (state == AccountState::SignedOut && accountState->lastConnectionStatus() == AccountState::ConnectionStatus::SslError) {
qCWarning(lcApplication) << "Account is signed out due to SSL Handshake error. Going to perform a sign-in attempt...";
accountState->trySignIn();
}
}

4
src/gui/configgui.h.in Normal file
View File

@@ -0,0 +1,4 @@
#ifndef CONFIG_GUI_H
#define CONFIG_GUI_H
#cmakedefine APPLICATION_FOLDER_ICON_INDEX "@APPLICATION_FOLDER_ICON_INDEX@"
#endif

View File

@@ -136,7 +136,7 @@ void ConnectionValidator::slotStatusFound(const QUrl &url, const QJsonObject &in
void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
{
auto job = qobject_cast<CheckServerJob *>(sender());
qCWarning(lcConnectionValidator) << reply->error() << job->errorString() << reply->peek(1024);
qCWarning(lcConnectionValidator) << reply->error() << reply->errorString() << job->errorString() << reply->peek(1024);
if (reply->error() == QNetworkReply::SslHandshakeFailedError) {
reportResult(SslError);
return;

View File

@@ -133,7 +133,7 @@ void Flow2Auth::fetchNewToken(const TokenAction action)
_loginUrl = loginUrl;
if (Theme::instance()->loginWithSystemUserName()) {
if (_account->isUsernamePrefillSupported()) {
const auto userName = Utility::getCurrentUserName();
if (!userName.isEmpty()) {
auto query = QUrlQuery(_loginUrl);

View File

@@ -691,6 +691,15 @@ void Folder::setRootPinState(PinState state)
void Folder::switchToVirtualFiles()
{
SyncEngine::switchToVirtualFiles(path(), _journal, *_vfs);
_hasSwitchedToVfs = true;
}
void Folder::processSwitchedToVirtualFiles()
{
if (_hasSwitchedToVfs) {
_hasSwitchedToVfs = false;
saveToSettings();
}
}
bool Folder::supportsSelectiveSync() const

View File

@@ -289,6 +289,8 @@ public:
void switchToVirtualFiles();
void processSwitchedToVirtualFiles();
/** Whether this folder should show selective sync ui */
bool supportsSelectiveSync() const;
@@ -500,6 +502,10 @@ private:
*/
bool _vfsOnOffPending = false;
/** Whether this folder has just switched to VFS or not
*/
bool _hasSwitchedToVfs = false;
/**
* Watches this folder's local directory for changes.
*

View File

@@ -211,6 +211,10 @@ int FolderMan::setupFolders()
emit folderListChanged(_folderMap);
for (const auto folder : _folderMap) {
folder->processSwitchedToVirtualFiles();
}
return _folderMap.size();
}

View File

@@ -36,8 +36,6 @@
#include "common/utility.h"
#include "logger.h"
#include "config.h"
#include "legalnotice.h"
#include <QFileDialog>

View File

@@ -15,6 +15,8 @@
#ifndef MIRALL_GENERALSETTINGS_H
#define MIRALL_GENERALSETTINGS_H
#include "config.h"
#include <QWidget>
#include <QPointer>

View File

@@ -0,0 +1,86 @@
/*
* Copyright (C) 2022 by Claudio Cambra <claudio.cambra@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 "internallinkwidget.h"
#include "accountstate.h"
#include "folderman.h"
#include "theme.h"
#include "QProgressIndicator.h"
#include <QClipboard>
namespace OCC {
Q_LOGGING_CATEGORY(lcInternalLink, "nextcloud.gui.internallink", QtInfoMsg)
InternalLinkWidget::InternalLinkWidget(const QString &localPath,
QWidget *parent)
: QWidget(parent)
, _localPath(localPath)
{
_ui->setupUi(this);
const auto folder = FolderMan::instance()->folderForPath(_localPath);
const auto folderRelativePath = _localPath.mid(folder->cleanPath().length() + 1);
const auto serverRelativePath = QDir(folder->remotePath()).filePath(folderRelativePath);
const auto bindLinkSlot = [this](QString link) { slotLinkFetched(link); };
fetchPrivateLinkUrl(
folder->accountState()->account(),
serverRelativePath,
{},
this,
bindLinkSlot
);
_ui->copyInternalLinkButton->setEnabled(false);
_ui->internalLinkProgressIndicator->setVisible(true);
_ui->internalLinkProgressIndicator->startAnimation();
connect(_ui->copyInternalLinkButton, &QPushButton::clicked, this, &InternalLinkWidget::slotCopyInternalLink);
}
void InternalLinkWidget::slotLinkFetched(const QString &url)
{
_internalUrl = url;
_ui->copyInternalLinkButton->setEnabled(true);
_ui->internalLinkProgressIndicator->setVisible(false);
_ui->internalLinkProgressIndicator->stopAnimation();
_ui->horizontalSpacer->changeSize(0, 0);
_ui->horizontalSpacer_2->changeSize(0, 0);
}
void InternalLinkWidget::slotCopyInternalLink() const
{
QApplication::clipboard()->setText(_internalUrl);
}
void InternalLinkWidget::setupUiOptions()
{
customizeStyle();
}
void InternalLinkWidget::slotStyleChanged()
{
customizeStyle();
}
void InternalLinkWidget::customizeStyle()
{
_ui->copyInternalLinkButton->setIcon(Theme::createColorAwareIcon(":/client/theme/copy.svg"));
_ui->internalLinkIconLabel->setPixmap(Theme::createColorAwarePixmap(":/client/theme/external.svg"));
}
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) 2022 by Claudio Cambra <claudio.cambra@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 INTERNALLINKWIDGET_H
#define INTERNALLINKWIDGET_H
#include "QProgressIndicator.h"
#include <QList>
#include <QPushButton>
#include "ui_internallinkwidget.h"
namespace OCC {
/**
* @brief The ShareDialog class
* @ingroup gui
*/
class InternalLinkWidget : public QWidget
{
Q_OBJECT
public:
explicit InternalLinkWidget(const QString &localPath,
QWidget *parent = nullptr);
~InternalLinkWidget() override = default;
void setupUiOptions();
public slots:
void slotStyleChanged();
private slots:
void slotLinkFetched(const QString &url);
void slotCopyInternalLink() const;
private:
void customizeStyle();
std::unique_ptr<Ui::InternalLinkWidget> _ui = std::make_unique<Ui::InternalLinkWidget>();
QString _localPath;
QString _internalUrl;
QPushButton *_copyInternalLinkButton{};
};
}
#endif // INTERNALLINKWIDGET_H

View File

@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OCC::InternalLinkWidget</class>
<widget class="QWidget" name="OCC::InternalLinkWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>238</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>20</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="internalLinkIconLabel">
<property name="text">
<string notr="true"/>
</property>
<property name="pixmap">
<pixmap resource="../../theme.qrc">:/client/theme/external.svg</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalTextLayout">
<item>
<widget class="QLabel" name="internalLinkLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Internal link</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="infoMessage">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(118, 118, 118)</string>
</property>
<property name="text">
<string>Only works for users with access to this folder</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</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>25</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QProgressIndicator" name="internalLinkProgressIndicator" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>28</width>
<height>27</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="copyInternalLinkButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../theme.qrc">
<normaloff>:/client/theme/copy.svg</normaloff>:/client/theme/copy.svg</iconset>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QProgressIndicator</class>
<extends>QWidget</extends>
<header>QProgressIndicator.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../theme.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -34,42 +34,51 @@ NetworkSettings::NetworkSettings(QWidget *parent)
{
_ui->setupUi(this);
_ui->hostLineEdit->setPlaceholderText(tr("Hostname of proxy server"));
_ui->userLineEdit->setPlaceholderText(tr("Username for proxy server"));
_ui->passwordLineEdit->setPlaceholderText(tr("Password for proxy server"));
_ui->proxyGroupBox->setVisible(!Theme::instance()->doNotUseProxy());
_ui->typeComboBox->addItem(tr("HTTP(S) proxy"), QNetworkProxy::HttpProxy);
_ui->typeComboBox->addItem(tr("SOCKS5 proxy"), QNetworkProxy::Socks5Proxy);
if (!Theme::instance()->doNotUseProxy()) {
_ui->hostLineEdit->setPlaceholderText(tr("Hostname of proxy server"));
_ui->userLineEdit->setPlaceholderText(tr("Username for proxy server"));
_ui->passwordLineEdit->setPlaceholderText(tr("Password for proxy server"));
_ui->authRequiredcheckBox->setEnabled(true);
_ui->typeComboBox->addItem(tr("HTTP(S) proxy"), QNetworkProxy::HttpProxy);
_ui->typeComboBox->addItem(tr("SOCKS5 proxy"), QNetworkProxy::Socks5Proxy);
// Explicitly set up the enabled status of the proxy auth widgets to ensure
// toggling the parent enables/disables the children
_ui->userLineEdit->setEnabled(true);
_ui->passwordLineEdit->setEnabled(true);
_ui->authWidgets->setEnabled(_ui->authRequiredcheckBox->isChecked());
connect(_ui->authRequiredcheckBox, &QAbstractButton::toggled,
_ui->authWidgets, &QWidget::setEnabled);
_ui->authRequiredcheckBox->setEnabled(true);
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
_ui->manualSettings, &QWidget::setEnabled);
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
_ui->typeComboBox, &QWidget::setEnabled);
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
this, &NetworkSettings::checkAccountLocalhost);
// Explicitly set up the enabled status of the proxy auth widgets to ensure
// toggling the parent enables/disables the children
_ui->userLineEdit->setEnabled(true);
_ui->passwordLineEdit->setEnabled(true);
_ui->authWidgets->setEnabled(_ui->authRequiredcheckBox->isChecked());
connect(_ui->authRequiredcheckBox, &QAbstractButton::toggled, _ui->authWidgets, &QWidget::setEnabled);
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, _ui->manualSettings, &QWidget::setEnabled);
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, _ui->typeComboBox, &QWidget::setEnabled);
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, this, &NetworkSettings::checkAccountLocalhost);
loadProxySettings();
connect(_ui->typeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&NetworkSettings::saveProxySettings);
connect(_ui->proxyButtonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this,
&NetworkSettings::saveProxySettings);
connect(_ui->hostLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->userLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->passwordLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->portSpinBox, &QAbstractSpinBox::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->authRequiredcheckBox, &QAbstractButton::toggled, this, &NetworkSettings::saveProxySettings);
// Warn about empty proxy host
connect(_ui->hostLineEdit, &QLineEdit::textChanged, this, &NetworkSettings::checkEmptyProxyHost);
checkEmptyProxyHost();
checkAccountLocalhost();
} else {
_ui->noProxyRadioButton->setChecked(false);
}
loadProxySettings();
loadBWLimitSettings();
// proxy
connect(_ui->typeComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &NetworkSettings::saveProxySettings);
connect(_ui->proxyButtonGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &NetworkSettings::saveProxySettings);
connect(_ui->hostLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->userLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->passwordLineEdit, &QLineEdit::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->portSpinBox, &QAbstractSpinBox::editingFinished, this, &NetworkSettings::saveProxySettings);
connect(_ui->authRequiredcheckBox, &QAbstractButton::toggled, this, &NetworkSettings::saveProxySettings);
connect(_ui->uploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings);
connect(_ui->noUploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings);
connect(_ui->autoUploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings);
@@ -78,11 +87,6 @@ NetworkSettings::NetworkSettings(QWidget *parent)
connect(_ui->autoDownloadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings);
connect(_ui->downloadSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NetworkSettings::saveBWLimitSettings);
connect(_ui->uploadSpinBox, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NetworkSettings::saveBWLimitSettings);
// Warn about empty proxy host
connect(_ui->hostLineEdit, &QLineEdit::textChanged, this, &NetworkSettings::checkEmptyProxyHost);
checkEmptyProxyHost();
checkAccountLocalhost();
}
NetworkSettings::~NetworkSettings()

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) by Oleksandr Zolotov <alex@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 "passwordinputdialog.h"
#include "ui_passwordinputdialog.h"
namespace OCC {
PasswordInputDialog::PasswordInputDialog(const QString &description, const QString &error, QWidget *parent)
: QDialog(parent)
, _ui(new Ui::PasswordInputDialog)
{
_ui->setupUi(this);
_ui->passwordLineEditLabel->setText(description);
_ui->passwordLineEditLabel->setVisible(!description.isEmpty());
_ui->labelErrorMessage->setText(error);
_ui->labelErrorMessage->setVisible(!error.isEmpty());
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
PasswordInputDialog::~PasswordInputDialog() = default;
QString PasswordInputDialog::password() const
{
return _ui->passwordLineEdit->text();
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) by Oleksandr Zolotov <alex@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.
*/
#pragma once
#include <QDialog>
namespace OCC {
namespace Ui {
class PasswordInputDialog;
}
class PasswordInputDialog : public QDialog
{
Q_OBJECT
public:
explicit PasswordInputDialog(const QString &description, const QString &error, QWidget *parent = nullptr);
~PasswordInputDialog() override;
QString password() const;
private:
std::unique_ptr<Ui::PasswordInputDialog> _ui;
};
}

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OCC::PasswordInputDialog</class>
<widget class="QDialog" name="OCC::PasswordInputDialog">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>276</width>
<height>125</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Password for share required</string>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="passwordLineEditLabel">
<property name="text">
<string>Please enter a password for your share:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="passwordLineEdit">
<property name="inputMask">
<string notr="true"/>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelErrorMessage">
<property name="enabled">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(118, 118, 118)</string>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>OCC::PasswordInputDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>OCC::PasswordInputDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
*
* This program is free software; you can redistribute it and/or modify
@@ -16,7 +16,9 @@
#include "sharedialog.h"
#include "sharee.h"
#include "sharelinkwidget.h"
#include "internallinkwidget.h"
#include "shareusergroupwidget.h"
#include "passwordinputdialog.h"
#include "sharemanager.h"
@@ -135,28 +137,24 @@ ShareDialog::ShareDialog(QPointer<AccountState> accountState,
connect(job, &PropfindJob::finishedWithError, this, &ShareDialog::slotPropfindError);
job->start();
bool sharingPossible = true;
if (!accountState->account()->capabilities().sharePublicLink()) {
qCWarning(lcSharing) << "Link shares have been disabled";
sharingPossible = false;
} else if (!(maxSharingPermissions & SharePermissionShare)) {
qCWarning(lcSharing) << "The file cannot be shared because it does not have sharing permission.";
sharingPossible = false;
}
initShareManager();
_scrollAreaViewPort = new QWidget(_ui->scrollArea);
_scrollAreaLayout = new QVBoxLayout(_scrollAreaViewPort);
_scrollAreaLayout->setContentsMargins(0, 0, 0, 0);
_ui->scrollArea->setWidget(_scrollAreaViewPort);
if (sharingPossible) {
_manager = new ShareManager(accountState->account(), this);
connect(_manager, &ShareManager::sharesFetched, this, &ShareDialog::slotSharesFetched);
connect(_manager, &ShareManager::linkShareCreated, this, &ShareDialog::slotAddLinkShareWidget);
connect(_manager, &ShareManager::linkShareRequiresPassword, this, &ShareDialog::slotLinkShareRequiresPassword);
}
_internalLinkWidget = new InternalLinkWidget(localPath, this);
_ui->verticalLayout->addWidget(_internalLinkWidget);
_internalLinkWidget->setupUiOptions();
connect(this, &ShareDialog::styleChanged, _internalLinkWidget, &InternalLinkWidget::slotStyleChanged);
}
ShareLinkWidget *ShareDialog::addLinkShareWidget(const QSharedPointer<LinkShare> &linkShare)
{
_linkWidgetList.append(new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, this));
const auto linkShareWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _ui->scrollArea);
_linkWidgetList.append(linkShareWidget);
const auto linkShareWidget = _linkWidgetList.at(_linkWidgetList.size() - 1);
linkShareWidget->setLinkShare(linkShare);
connect(linkShare.data(), &Share::serverError, linkShareWidget, &ShareLinkWidget::slotServerError);
@@ -171,13 +169,13 @@ ShareLinkWidget *ShareDialog::addLinkShareWidget(const QSharedPointer<LinkShare>
connect(linkShareWidget, &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
connect(linkShareWidget, &ShareLinkWidget::deleteLinkShare, this, &ShareDialog::slotDeleteShare);
connect(linkShareWidget, &ShareLinkWidget::createPassword, this, &ShareDialog::slotCreatePasswordForLinkShare);
//connect(_linkWidgetList.at(index), &ShareLinkWidget::resizeRequested, this, &ShareDialog::slotAdjustScrollWidgetSize);
// Connect styleChanged events to our widget, so it can adapt (Dark-/Light-Mode switching)
connect(this, &ShareDialog::styleChanged, linkShareWidget, &ShareLinkWidget::slotStyleChanged);
_ui->verticalLayout->insertWidget(_linkWidgetList.size() + 1, linkShareWidget);
_scrollAreaLayout->addWidget(linkShareWidget);
linkShareWidget->setupUiOptions();
return linkShareWidget;
@@ -186,18 +184,17 @@ ShareLinkWidget *ShareDialog::addLinkShareWidget(const QSharedPointer<LinkShare>
void ShareDialog::initLinkShareWidget()
{
if(_linkWidgetList.size() == 0) {
_emptyShareLinkWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, this);
_emptyShareLinkWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _ui->scrollArea);
_linkWidgetList.append(_emptyShareLinkWidget);
connect(_emptyShareLinkWidget, &ShareLinkWidget::resizeRequested, this, &ShareDialog::slotAdjustScrollWidgetSize);
connect(this, &ShareDialog::toggleShareLinkAnimation, _emptyShareLinkWidget, &ShareLinkWidget::slotToggleShareLinkAnimation);
connect(_emptyShareLinkWidget, &ShareLinkWidget::createLinkShare, this, &ShareDialog::slotCreateLinkShare);
connect(_emptyShareLinkWidget, &ShareLinkWidget::createPassword, this, &ShareDialog::slotCreatePasswordForLinkShare);
_ui->verticalLayout->insertWidget(_linkWidgetList.size()+1, _emptyShareLinkWidget);
_scrollAreaLayout->addWidget(_emptyShareLinkWidget);
_emptyShareLinkWidget->show();
} else if(_emptyShareLinkWidget) {
} else if (_emptyShareLinkWidget) {
_emptyShareLinkWidget->hide();
_ui->verticalLayout->removeWidget(_emptyShareLinkWidget);
_linkWidgetList.removeAll(_emptyShareLinkWidget);
@@ -210,6 +207,7 @@ void ShareDialog::slotAddLinkShareWidget(const QSharedPointer<LinkShare> &linkSh
emit toggleShareLinkAnimation(true);
const auto addedLinkShareWidget = addLinkShareWidget(linkShare);
initLinkShareWidget();
adjustScrollWidgetSize();
if (linkShare->isPasswordSet()) {
addedLinkShareWidget->focusPasswordLineEdit();
}
@@ -222,6 +220,7 @@ void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
const QString versionString = _accountState->account()->serverVersion();
qCInfo(lcSharing) << versionString << "Fetched" << shares.count() << "shares";
foreach (auto share, shares) {
if (share->getShareType() != Share::TypeLink || share->getUidOwner() != share->account()->davUser()) {
continue;
@@ -232,17 +231,20 @@ void ShareDialog::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
}
initLinkShareWidget();
adjustScrollWidgetSize();
emit toggleShareLinkAnimation(false);
}
void ShareDialog::slotAdjustScrollWidgetSize()
void ShareDialog::adjustScrollWidgetSize()
{
int count = this->findChildren<ShareLinkWidget *>().count();
_ui->scrollArea->setVisible(count > 0);
if (count > 0 && count <= 3) {
_ui->scrollArea->setFixedHeight(_ui->scrollArea->widget()->sizeHint().height());
}
_ui->scrollArea->setFrameShape(count > 3 ? QFrame::StyledPanel : QFrame::NoFrame);
const auto count = _scrollAreaLayout->count();
const auto margin = 10;
const auto height = _linkWidgetList.empty() ? 0 : _linkWidgetList.last()->sizeHint().height() + margin;
const auto totalHeight = height * count;
_ui->scrollArea->setFixedWidth(_ui->verticalLayout->sizeHint().width());
_ui->scrollArea->setFixedHeight(totalHeight > 400 ? 400 : totalHeight);
_ui->scrollArea->setVisible(height > 0);
_ui->scrollArea->setFrameShape(count > 6 ? QFrame::StyledPanel : QFrame::NoFrame);
}
ShareDialog::~ShareDialog()
@@ -303,21 +305,19 @@ void ShareDialog::showSharingUi()
return;
}
// We only do user/group sharing from 8.2.0
bool userGroupSharing =
theme->userGroupSharing()
&& _accountState->account()->serverVersionInt() >= Account::makeServerVersion(8, 2, 0);
if (userGroupSharing) {
_userGroupWidget = new ShareUserGroupWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _privateLinkUrl, this);
if (theme->userGroupSharing()) {
_userGroupWidget = new ShareUserGroupWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _privateLinkUrl, _ui->scrollArea);
_userGroupWidget->getShares();
// Connect styleChanged events to our widget, so it can adapt (Dark-/Light-Mode switching)
connect(this, &ShareDialog::styleChanged, _userGroupWidget, &ShareUserGroupWidget::slotStyleChanged);
_ui->verticalLayout->insertWidget(1, _userGroupWidget);
_userGroupWidget->getShares();
_scrollAreaLayout->addLayout(_userGroupWidget->shareUserGroupLayout());
}
initShareManager();
if (theme->linkSharing()) {
if(_manager) {
_manager->fetchShares(_sharePath);
@@ -325,6 +325,25 @@ void ShareDialog::showSharingUi()
}
}
void ShareDialog::initShareManager()
{
bool sharingPossible = true;
if (!_accountState->account()->capabilities().sharePublicLink()) {
qCWarning(lcSharing) << "Link shares have been disabled";
sharingPossible = false;
} else if (!(_maxSharingPermissions & SharePermissionShare)) {
qCWarning(lcSharing) << "The file cannot be shared because it does not have sharing permission.";
sharingPossible = false;
}
if (!_manager && sharingPossible) {
_manager = new ShareManager(_accountState->account(), this);
connect(_manager, &ShareManager::sharesFetched, this, &ShareDialog::slotSharesFetched);
connect(_manager, &ShareManager::linkShareCreated, this, &ShareDialog::slotAddLinkShareWidget);
connect(_manager, &ShareManager::linkShareRequiresPassword, this, &ShareDialog::slotLinkShareRequiresPassword);
}
}
void ShareDialog::slotCreateLinkShare()
{
if(_manager) {
@@ -359,26 +378,21 @@ void ShareDialog::slotCreatePasswordForLinkShareProcessed()
}
}
void ShareDialog::slotLinkShareRequiresPassword()
void ShareDialog::slotLinkShareRequiresPassword(const QString &message)
{
bool ok = false;
QString password = QInputDialog::getText(this,
tr("Password for share required"),
tr("Please enter a password for your link share:"),
QLineEdit::Password,
QString(),
&ok);
const auto passwordInputDialog = new PasswordInputDialog(tr("Please enter a password for your link share:"), message, this);
passwordInputDialog->setWindowTitle(tr("Password for share required"));
passwordInputDialog->setAttribute(Qt::WA_DeleteOnClose);
passwordInputDialog->open();
if (!ok) {
// The dialog was canceled so no need to do anything
connect(passwordInputDialog, &QDialog::finished, this, [this, passwordInputDialog](const int result) {
if (result == QDialog::Accepted && _manager) {
// Try to create the link share again with the newly entered password
_manager->createLinkShare(_sharePath, QString(), passwordInputDialog->password());
return;
}
emit toggleShareLinkAnimation(false);
return;
}
if(_manager) {
// Try to create the link share again with the newly entered password
_manager->createLinkShare(_sharePath, QString(), password);
}
});
}
void ShareDialog::slotDeleteShare()
@@ -386,8 +400,10 @@ void ShareDialog::slotDeleteShare()
auto sharelinkWidget = dynamic_cast<ShareLinkWidget*>(sender());
sharelinkWidget->hide();
_ui->verticalLayout->removeWidget(sharelinkWidget);
_scrollAreaLayout->removeWidget(sharelinkWidget);
_linkWidgetList.removeAll(sharelinkWidget);
initLinkShareWidget();
adjustScrollWidgetSize();
}
void ShareDialog::slotThumbnailFetched(const int &statusCode, const QByteArray &reply)

View File

@@ -26,6 +26,7 @@
#include <QWidget>
class QProgressIndicator;
class QVBoxLayout;
namespace OCC {
@@ -34,6 +35,7 @@ namespace Ui {
}
class ShareLinkWidget;
class InternalLinkWidget;
class ShareUserGroupWidget;
class ShareManager;
class LinkShare;
@@ -66,8 +68,7 @@ private slots:
void slotCreateLinkShare();
void slotCreatePasswordForLinkShare(const QString &password);
void slotCreatePasswordForLinkShareProcessed();
void slotLinkShareRequiresPassword();
void slotAdjustScrollWidgetSize();
void slotLinkShareRequiresPassword(const QString &message);
signals:
void toggleShareLinkAnimation(bool start);
@@ -78,8 +79,10 @@ protected:
private:
void showSharingUi();
void initShareManager();
ShareLinkWidget *addLinkShareWidget(const QSharedPointer<LinkShare> &linkShare);
void initLinkShareWidget();
void adjustScrollWidgetSize();
Ui::ShareDialog *_ui;
@@ -94,8 +97,12 @@ private:
QList<ShareLinkWidget*> _linkWidgetList;
ShareLinkWidget* _emptyShareLinkWidget = nullptr;
InternalLinkWidget* _internalLinkWidget = nullptr;
ShareUserGroupWidget *_userGroupWidget = nullptr;
QProgressIndicator *_progressIndicator = nullptr;
QWidget *_scrollAreaViewPort = nullptr;
QVBoxLayout *_scrollAreaLayout = nullptr;
};
} // namespace OCC

View File

@@ -6,18 +6,36 @@
<rect>
<x>0</x>
<y>0</y>
<width>385</width>
<height>150</height>
<width>480</width>
<height>280</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>480</width>
<height>250</height>
</size>
</property>
<layout class="QVBoxLayout" name="shareDialogVerticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0" columnstretch="0,0">
@@ -33,6 +51,31 @@
<property name="spacing">
<number>10</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Icon</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_name">
<property name="sizePolicy">
@@ -89,49 +132,36 @@
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_icon">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Icon</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
@@ -141,11 +171,10 @@
<rect>
<x>0</x>
<y>0</y>
<width>69</width>
<height>69</height>
<width>460</width>
<height>200</height>
</rect>
</property>
<layout class="QVBoxLayout" name="scrollAreaVerticalLayout"/>
</widget>
</widget>
</item>

View File

@@ -411,22 +411,6 @@ void ShareLinkWidget::slotPasswordSetError(const int code, const QString &messag
emit createPasswordProcessed();
}
void ShareLinkWidget::startAnimation(const int start, const int end)
{
auto *animation = new QPropertyAnimation(this, "maximumHeight", this);
animation->setDuration(500);
animation->setStartValue(start);
animation->setEndValue(end);
connect(animation, &QAbstractAnimation::finished, this, &ShareLinkWidget::slotAnimationFinished);
if (end < start) // that is to remove the widget, not to show it
connect(animation, &QAbstractAnimation::finished, this, &ShareLinkWidget::slotDeleteAnimationFinished);
connect(animation, &QVariantAnimation::valueChanged, this, &ShareLinkWidget::resizeRequested);
animation->start();
}
void ShareLinkWidget::slotDeleteShareFetched()
{
slotToggleShareLinkAnimation(false);
@@ -450,12 +434,6 @@ void ShareLinkWidget::toggleNoteOptions(const bool enable)
}
}
void ShareLinkWidget::slotAnimationFinished()
{
emit resizeRequested();
deleteLater();
}
void ShareLinkWidget::slotCreateLabel()
{
const auto labelText = _shareLinkEdit->text();
@@ -474,14 +452,6 @@ void ShareLinkWidget::slotLabelSet()
displayShareLinkLabel();
}
void ShareLinkWidget::slotDeleteAnimationFinished()
{
// There is a painting bug where a small line of this widget isn't
// properly cleared. This explicit repaint() call makes sure any trace of
// the share widget is removed once it's destroyed. #4189
connect(this, SIGNAL(destroyed(QObject *)), parentWidget(), SLOT(repaint()));
}
void ShareLinkWidget::slotCreateShareRequiresPassword(const QString &message)
{
slotToggleShareLinkAnimation(message.isEmpty());

View File

@@ -90,9 +90,6 @@ private slots:
void slotContextMenuButtonClicked();
void slotLinkContextMenuActionTriggered(QAction *action);
void slotDeleteAnimationFinished();
void slotAnimationFinished();
void slotCreateLabel();
void slotLabelSet();
@@ -100,7 +97,6 @@ private slots:
signals:
void createLinkShare();
void deleteLinkShare();
void resizeRequested();
void visualDeletionDone();
void createPassword(const QString &password);
void createPasswordProcessed();
@@ -119,8 +115,6 @@ private:
/** Retrieve a share's name, accounting for _namesSupported */
QString shareName() const;
void startAnimation(const int start, const int end);
void customizeStyle();
void displayShareLinkLabel();

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>365</width>
<width>400</width>
<height>238</height>
</rect>
</property>
@@ -17,8 +17,29 @@
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>20</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="shareLinkIconLabel">
<property name="text">

View File

@@ -154,16 +154,18 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account,
_completionTimer.setInterval(600);
_ui->errorLabel->hide();
// TODO Progress Indicator where should it go?
// Setup the sharee search progress indicator
//_ui->shareeHorizontalLayout->addWidget(&_pi_sharee);
_parentScrollArea = parentWidget()->findChild<QScrollArea*>("scrollArea");
_shareUserGroup = new QVBoxLayout(_parentScrollArea);
_shareUserGroup->setContentsMargins(0, 0, 0, 0);
customizeStyle();
}
QVBoxLayout *ShareUserGroupWidget::shareUserGroupLayout()
{
return _shareUserGroup;
}
ShareUserGroupWidget::~ShareUserGroupWidget()
{
delete _ui;
@@ -247,17 +249,16 @@ void ShareUserGroupWidget::slotShareCreated(const QSharedPointer<Share> &share)
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
QScrollArea *scrollArea = _parentScrollArea;
auto newViewPort = new QWidget(scrollArea);
auto layout = new QVBoxLayout(newViewPort);
layout->setContentsMargins(0, 0, 0, 0);
int x = 0;
int height = 0;
QList<QString> linkOwners({});
ShareUserLine *justCreatedShareThatNeedsPassword = nullptr;
while (QLayoutItem *shareUserLine = _shareUserGroup->takeAt(0)) {
delete shareUserLine->widget();
delete shareUserLine;
}
foreach (const auto &share, shares) {
// We don't handle link shares, only TypeUser or TypeGroup
if (share->getShareType() == Share::TypeLink) {
@@ -278,14 +279,12 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
Q_ASSERT(Share::isShareTypeUserGroupEmailRoomOrRemote(share->getShareType()));
auto userGroupShare = qSharedPointerDynamicCast<UserGroupShare>(share);
auto *s = new ShareUserLine(_account, userGroupShare, _maxSharingPermissions, _isFile, _parentScrollArea);
connect(s, &ShareUserLine::resizeRequested, this, &ShareUserGroupWidget::slotAdjustScrollWidgetSize);
connect(s, &ShareUserLine::visualDeletionDone, this, &ShareUserGroupWidget::getShares);
s->setBackgroundRole(layout->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase);
s->setBackgroundRole(_shareUserGroup->count() % 2 == 0 ? QPalette::Base : QPalette::AlternateBase);
// Connect styleChanged events to our widget, so it can adapt (Dark-/Light-Mode switching)
connect(this, &ShareUserGroupWidget::styleChanged, s, &ShareUserLine::slotStyleChanged);
layout->addWidget(s);
_shareUserGroup->addWidget(s);
if (!_lastCreatedShareId.isEmpty() && share->getId() == _lastCreatedShareId) {
_lastCreatedShareId = QString();
@@ -295,27 +294,14 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
}
x++;
if (x <= 3) {
height = newViewPort->sizeHint().height();
}
}
foreach (const QString &owner, linkOwners) {
auto ownerLabel = new QLabel(QString(owner + " shared via link"));
layout->addWidget(ownerLabel);
_shareUserGroup->addWidget(ownerLabel);
ownerLabel->setVisible(true);
x++;
if (x <= 6) {
height = newViewPort->sizeHint().height();
}
}
scrollArea->setFrameShape(x > 6 ? QFrame::StyledPanel : QFrame::NoFrame);
scrollArea->setVisible(!shares.isEmpty());
scrollArea->setFixedHeight(height);
scrollArea->setWidget(newViewPort);
_disableCompleterActivated = false;
activateShareeLineEdit();
@@ -325,24 +311,6 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
}
}
void ShareUserGroupWidget::slotAdjustScrollWidgetSize()
{
QScrollArea *scrollArea = _parentScrollArea;
const auto shareUserLineChilds = scrollArea->findChildren<ShareUserLine *>();
// Ask the child widgets to calculate their size
for (const auto shareUserLineChild : shareUserLineChilds) {
shareUserLineChild->adjustSize();
}
const auto shareUserLineChildsCount = shareUserLineChilds.count();
scrollArea->setVisible(shareUserLineChildsCount > 0);
if (shareUserLineChildsCount > 0 && shareUserLineChildsCount <= 3) {
scrollArea->setFixedHeight(scrollArea->widget()->sizeHint().height());
}
scrollArea->setFrameShape(shareUserLineChildsCount > 3 ? QFrame::StyledPanel : QFrame::NoFrame);
}
void ShareUserGroupWidget::slotPrivateLinkShare()
{
auto menu = new QMenu(this);
@@ -380,22 +348,11 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
return;
}
// TODO Progress Indicator where should it go?
// auto indicator = new QProgressIndicator(viewPort);
// indicator->startAnimation();
// if (layout->count() == 1) {
// // No shares yet! Remove the label, add some stretch.
// delete layout->itemAt(0)->widget();
// layout->addStretch(1);
// }
// layout->insertWidget(layout->count() - 1, indicator);
/*
* Don't send the reshare permissions for federated shares for servers <9.1
* https://github.com/owncloud/core/issues/22122#issuecomment-185637344
* https://github.com/owncloud/client/issues/4996
*/
_lastCreatedShareId = QString();
QString password;

View File

@@ -77,6 +77,8 @@ public:
const QString &privateLinkUrl,
QWidget *parent = nullptr);
~ShareUserGroupWidget() override;
QVBoxLayout *shareUserGroupLayout();
signals:
void togglePublicLinkShare(bool);
@@ -98,7 +100,6 @@ private slots:
void slotCompleterActivated(const QModelIndex &index);
void slotCompleterHighlighted(const QModelIndex &index);
void slotShareesReady();
void slotAdjustScrollWidgetSize();
void slotPrivateLinkShare();
void displayError(int code, const QString &message);
@@ -113,6 +114,7 @@ private:
Ui::ShareUserGroupWidget *_ui;
QScrollArea *_parentScrollArea;
QVBoxLayout *_shareUserGroup;
AccountPtr _account;
QString _sharePath;
QString _localPath;

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>350</width>
<height>70</height>
<height>106</height>
</rect>
</property>
<property name="sizePolicy">
@@ -17,6 +17,21 @@
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="mainOwnerLabel">
<property name="sizePolicy">

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>899</width>
<width>400</width>
<height>310</height>
</rect>
</property>
@@ -26,8 +26,26 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>20</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
@@ -75,11 +93,11 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>20</width>
<height>20</height>
</size>
</property>

View File

@@ -1225,9 +1225,11 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListe
auto makePinContextMenu = [&](bool makeAvailableLocally, bool freeSpace) {
listener->sendMessage(QLatin1String("MENU_ITEM:CURRENT_PIN:d:")
+ Utility::vfsCurrentAvailabilityText(*combined));
listener->sendMessage(QLatin1String("MENU_ITEM:MAKE_AVAILABLE_LOCALLY:")
+ (makeAvailableLocally ? QLatin1String(":") : QLatin1String("d:"))
+ Utility::vfsPinActionText());
if (!Theme::instance()->enforceVirtualFilesSyncFolder()) {
listener->sendMessage(QLatin1String("MENU_ITEM:MAKE_AVAILABLE_LOCALLY:")
+ (makeAvailableLocally ? QLatin1String(":") : QLatin1String("d:")) + Utility::vfsPinActionText());
}
listener->sendMessage(QLatin1String("MENU_ITEM:MAKE_ONLINE_ONLY:")
+ (freeSpace ? QLatin1String(":") : QLatin1String("d:"))
+ Utility::vfsFreeSpaceActionText());

View File

@@ -1,109 +1,65 @@
import QtQuick 2.5
import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.15
import Style 1.0
Item {
id: root
readonly property bool labelVisible: label.visible
readonly property bool iconVisible: icon.visible
// label value
property string text: ""
// font value
property var font: label.font
property string toolTipText: ""
property bool bold: false
// icon value
property string imageSource: ""
property string imageSourceHover: ""
// Tooltip value
property string tooltipText: text
// text color
property color textColor: Style.ncTextColor
property color textColorHovered: Style.lightHover
// text background color
property color textBgColor: "transparent"
property color textBgColorHovered: Style.lightHover
// icon background color
property color iconBgColor: "transparent"
property color iconBgColorHovered: Style.lightHover
// text border color
property color textBorderColor: "transparent"
property alias hovered: mouseArea.containsMouse
property color textColor: Style.unifiedSearchResulTitleColor
property color textColorHovered: Style.unifiedSearchResulSublineColor
signal clicked()
Accessible.role: Accessible.Button
Accessible.name: text !== "" ? text : (tooltipText !== "" ? tooltipText : qsTr("Activity action button"))
Accessible.onPressAction: clicked()
// background with border around the Text
Rectangle {
visible: parent.labelVisible
Loader {
active: root.imageSource === ""
anchors.fill: parent
// padding
anchors.topMargin: 10
anchors.bottomMargin: 10
sourceComponent: CustomTextButton {
anchors.fill: parent
text: root.text
toolTipText: root.toolTipText
border.color: parent.textBorderColor
border.width: 1
textColor: root.textColor
textColorHovered: root.textColorHovered
color: parent.hovered ? parent.textBgColorHovered : parent.textBgColor
radius: 25
onClicked: root.clicked()
}
}
// background with border around the Image
Rectangle {
visible: parent.iconVisible
Loader {
active: root.imageSource !== ""
anchors.fill: parent
color: parent.hovered ? parent.iconBgColorHovered : parent.iconBgColor
}
sourceComponent: CustomButton {
anchors.fill: parent
anchors.topMargin: Style.roundedButtonBackgroundVerticalMargins
anchors.bottomMargin: Style.roundedButtonBackgroundVerticalMargins
// label
Text {
id: label
visible: parent.text !== ""
text: parent.text
font: parent.font
color: parent.hovered ? parent.textColorHovered : parent.textColor
anchors.fill: parent
anchors.leftMargin: 10
anchors.rightMargin: 10
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
text: root.text
toolTipText: root.toolTipText
// icon
Image {
id: icon
visible: parent.imageSource !== ""
anchors.centerIn: parent
source: parent.imageSource
sourceSize.width: visible ? 32 : 0
sourceSize.height: visible ? 32 : 0
}
textColor: root.textColor
textColorHovered: root.textColorHovered
MouseArea {
id: mouseArea
anchors.fill: parent
onClicked: parent.clicked()
hoverEnabled: true
}
bold: root.bold
ToolTip {
text: parent.tooltipText
delay: 1000
visible: text != "" && parent.hovered
imageSource: root.imageSource
imageSourceHover: root.imageSourceHover
bgColor: Style.ncBlue
onClicked: root.clicked()
}
}
}

View File

@@ -1,260 +1,84 @@
import QtQml 2.12
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
import QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Style 1.0
import com.nextcloud.desktopclient 1.0
MouseArea {
id: activityMouseArea
id: root
readonly property int maxActionButtons: 2
property Flickable flickable
property bool isFileActivityList: false
property bool isChatActivity: model.objectType === "chat" || model.objectType === "room"
signal fileActivityButtonClicked(string absolutePath)
enabled: (path !== "" || link !== "")
enabled: (model.path !== "" || model.link !== "" || model.isCurrentUserFileActivity === true)
hoverEnabled: true
height: childrenRect.height
ToolTip.visible: containsMouse && !activityContent.childHovered && model.displayLocation !== ""
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: qsTr("In %1").arg(model.displayLocation)
Accessible.role: Accessible.ListItem
Accessible.name: (model.path !== "" && model.displayPath !== "") ? qsTr("Open %1 locally").arg(model.displayPath) : model.message
Accessible.onPressAction: root.clicked()
Rectangle {
id: activityHover
anchors.fill: parent
color: (parent.containsMouse ? Style.lightHover : "transparent")
}
RowLayout {
id: activityItem
readonly property variant links: model.links
readonly property int itemIndex: model.index
width: activityMouseArea.width
height: Style.trayWindowHeaderHeight
ColumnLayout {
anchors.left: root.left
anchors.right: root.right
anchors.leftMargin: 15
anchors.rightMargin: 10
spacing: 0
Accessible.role: Accessible.ListItem
Accessible.name: path !== "" ? qsTr("Open %1 locally").arg(displayPath)
: message
Accessible.onPressAction: activityMouseArea.clicked()
Image {
id: activityIcon
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.leftMargin: 20
Layout.preferredWidth: shareButton.icon.width
Layout.preferredHeight: shareButton.icon.height
verticalAlignment: Qt.AlignCenter
cache: true
source: icon
sourceSize.height: 64
sourceSize.width: 64
}
Column {
id: activityTextColumn
Layout.leftMargin: 14
Layout.topMargin: 4
Layout.bottomMargin: 4
Layout.fillWidth: true
spacing: 4
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Text {
id: activityTextTitle
text: (type === "Activity" || type === "Notification") ? subject : message
width: parent.width
elide: Text.ElideRight
font.pixelSize: Style.topLinePixelSize
color: activityTextTitleColor
}
Text {
id: activityTextInfo
text: (type === "Sync") ? displayPath
: (type === "File") ? subject
: (type === "Notification") ? message
: ""
height: (text === "") ? 0 : activityTextTitle.height
width: parent.width
elide: Text.ElideRight
font.pixelSize: Style.subLinePixelSize
}
Text {
id: activityTextDateTime
text: dateTime
height: (text === "") ? 0 : activityTextTitle.height
width: parent.width
elide: Text.ElideRight
font.pixelSize: Style.subLinePixelSize
color: "#808080"
}
}
RowLayout {
id: activityActionsLayout
spacing: 0
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.minimumWidth: 28
Layout.fillWidth: true
function actionButtonIcon(actionIndex) {
const verb = String(model.links[actionIndex].verb);
if (verb === "WEB" && (model.objectType === "chat" || model.objectType === "call")) {
return "qrc:///client/theme/reply.svg";
} else if (verb === "DELETE") {
return "qrc:///client/theme/close.svg";
}
return "qrc:///client/theme/confirm.svg";
}
Repeater {
model: activityItem.links.length > maxActionButtons ? 1 : activityItem.links.length
ActivityActionButton {
id: activityActionButton
readonly property int actionIndex: model.index
readonly property bool primary: model.index === 0 && String(activityItem.links[actionIndex].verb) !== "DELETE"
Layout.fillHeight: true
text: !primary ? "" : activityItem.links[actionIndex].label
imageSource: !primary ? activityActionsLayout.actionButtonIcon(actionIndex) : ""
textColor: primary ? Style.ncBlue : "black"
textColorHovered: Style.lightHover
textBorderColor: Style.ncBlue
textBgColor: "transparent"
textBgColorHovered: Style.ncBlue
tooltipText: activityItem.links[actionIndex].label
Layout.minimumWidth: primary ? 80 : -1
Layout.minimumHeight: parent.height
Layout.preferredWidth: primary ? -1 : parent.height
onClicked: activityModel.triggerAction(activityItem.itemIndex, actionIndex)
}
}
Button {
id: shareButton
Layout.preferredWidth: parent.height
Layout.fillHeight: true
Layout.alignment: Qt.AlignRight
flat: true
hoverEnabled: true
visible: displayActions && (path !== "")
display: AbstractButton.IconOnly
icon.source: "qrc:///client/theme/share.svg"
icon.color: "transparent"
background: Rectangle {
color: parent.hovered ? Style.lightHover : "transparent"
}
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: qsTr("Open share dialog")
onClicked: Systray.openShareDialog(displayPath, absolutePath)
Accessible.role: Accessible.Button
Accessible.name: qsTr("Share %1").arg(displayPath)
Accessible.onPressAction: shareButton.clicked()
}
Button {
id: moreActionsButton
Layout.preferredWidth: parent.height
Layout.preferredHeight: parent.height
Layout.alignment: Qt.AlignRight
flat: true
hoverEnabled: true
visible: displayActions && ((path !== "") || (activityItem.links.length > maxActionButtons))
display: AbstractButton.IconOnly
icon.source: "qrc:///client/theme/more.svg"
icon.color: "transparent"
background: Rectangle {
color: parent.hovered ? Style.lightHover : "transparent"
}
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: qsTr("Show more actions")
Accessible.role: Accessible.Button
Accessible.name: qsTr("Show more actions")
Accessible.onPressAction: moreActionsButton.clicked()
onClicked: moreActionsButtonContextMenu.popup();
Connections {
target: flickable
function onMovementStarted() {
moreActionsButtonContextMenu.close();
}
}
Container {
id: moreActionsButtonContextMenuContainer
visible: moreActionsButtonContextMenu.opened
width: moreActionsButtonContextMenu.width
height: moreActionsButtonContextMenu.height
anchors.right: moreActionsButton.right
anchors.top: moreActionsButton.top
Menu {
id: moreActionsButtonContextMenu
anchors.centerIn: parent
// transform model to contain indexed actions with primary action filtered out
function actionListToContextMenuList(actionList) {
// early out with non-altered data
if (activityItem.links.length <= maxActionButtons) {
return actionList;
}
// add index to every action and filter 'primary' action out
var reducedActionList = actionList.reduce(function(reduced, action, index) {
if (!action.primary) {
var actionWithIndex = { actionIndex: index, label: action.label };
reduced.push(actionWithIndex);
}
return reduced;
}, []);
return reducedActionList;
}
ActivityItemContent {
id: activityContent
MenuItem {
text: qsTr("View activity")
onClicked: fileActivityButtonClicked(absolutePath)
}
Repeater {
id: moreActionsButtonContextMenuRepeater
model: moreActionsButtonContextMenu.actionListToContextMenuList(activityItem.links)
delegate: MenuItem {
id: moreActionsButtonContextMenuEntry
text: model.modelData.label
onTriggered: activityModel.triggerAction(activityItem.itemIndex, model.modelData.actionIndex)
}
}
}
}
}
Layout.fillWidth: true
showDismissButton: model.links.length > 0 && model.linksForActionButtons.length === 0
activityData: model
Layout.preferredHeight: Style.trayWindowHeaderHeight
onShareButtonClicked: Systray.openShareDialog(model.displayPath, model.absolutePath)
onDismissButtonClicked: activityModel.slotTriggerDismiss(model.index)
}
ActivityItemActions {
id: activityActions
visible: !root.isFileActivityList && model.linksForActionButtons.length > 0
Layout.preferredHeight: Style.trayWindowHeaderHeight * 0.85
Layout.fillWidth: true
Layout.leftMargin: 40
Layout.bottomMargin: model.links.length > 1 ? 5 : 0
displayActions: model.displayActions
objectType: model.objectType
linksForActionButtons: model.linksForActionButtons
linksContextMenu: model.linksContextMenu
moreActionsButtonColor: activityHover.color
maxActionButtons: activityModel.maxActionButtons
flickable: root.flickable
onTriggerAction: activityModel.slotTriggerAction(model.index, actionIndex)
}
}
}

View File

@@ -0,0 +1,103 @@
import QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import Style 1.0
RowLayout {
id: root
spacing: 20
property string objectType: ""
property variant linksForActionButtons: []
property variant linksContextMenu: []
property bool displayActions: false
property color moreActionsButtonColor: "transparent"
property int maxActionButtons: 0
property Flickable flickable
signal triggerAction(int actionIndex)
Repeater {
id: actionsRepeater
// a max of maxActionButtons will get dispayed as separate buttons
model: root.linksForActionButtons
ActivityActionButton {
id: activityActionButton
readonly property bool primary: model.index === 0 && model.modelData.verb !== "DELETE"
Layout.minimumWidth: primary ? Style.activityItemActionPrimaryButtonMinWidth : Style.activityItemActionSecondaryButtonMinWidth
Layout.preferredHeight: primary ? parent.height : parent.height * 0.3
Layout.preferredWidth: primary ? -1 : parent.height
text: model.modelData.label
toolTipText: model.modelData.label
imageSource: model.modelData.imageSource
imageSourceHover: model.modelData.imageSourceHovered
textColor: imageSource !== "" ? Style.ncBlue : Style.unifiedSearchResulSublineColor
textColorHovered: imageSource !== "" ? Style.lightHover : Style.unifiedSearchResulTitleColor
bold: primary
onClicked: root.triggerAction(model.index)
}
}
Loader {
// actions that do not fit maxActionButtons limit, must be put into a context menu
id: moreActionsButtonContainer
Layout.preferredWidth: parent.height
Layout.topMargin: Style.roundedButtonBackgroundVerticalMargins
Layout.bottomMargin: Style.roundedButtonBackgroundVerticalMargins
Layout.fillHeight: true
active: root.displayActions && (root.linksContextMenu.length > 0)
sourceComponent: Button {
id: moreActionsButton
icon.source: "qrc:///client/theme/more.svg"
background: Rectangle {
color: parent.hovered ? "white" : root.moreActionsButtonColor
radius: width / 2
}
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: qsTr("Show more actions")
Accessible.name: qsTr("Show more actions")
onClicked: moreActionsButtonContextMenu.popup(moreActionsButton.x, moreActionsButton.y);
Connections {
target: root.flickable
function onMovementStarted() {
moreActionsButtonContextMenu.close();
}
}
ActivityItemContextMenu {
id: moreActionsButtonContextMenu
maxActionButtons: root.maxActionButtons
linksContextMenu: root.linksContextMenu
onMenuEntryTriggered: function(entryIndex) {
root.triggerAction(entryIndex)
}
}
}
}
}

View File

@@ -0,0 +1,127 @@
import QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import Style 1.0
import com.nextcloud.desktopclient 1.0
RowLayout {
id: root
property variant activityData: {{}}
property color activityTextTitleColor: Style.ncTextColor
property bool showDismissButton: false
property bool childHovered: shareButton.hovered || dismissActionButton.hovered
signal dismissButtonClicked()
signal shareButtonClicked()
spacing: 10
Image {
id: activityIcon
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Layout.preferredWidth: 32
Layout.preferredHeight: 32
verticalAlignment: Qt.AlignCenter
source: icon
sourceSize.height: 64
sourceSize.width: 64
}
Column {
id: activityTextColumn
Layout.topMargin: 4
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
spacing: 4
Label {
id: activityTextTitle
text: (root.activityData.type === "Activity" || root.activityData.type === "Notification") ? root.activityData.subject : root.activityData.message
width: parent.width
elide: Text.ElideRight
font.pixelSize: Style.topLinePixelSize
color: root.activityData.activityTextTitleColor
}
Label {
id: activityTextInfo
text: (root.activityData.type === "Sync") ? root.activityData.displayPath
: (root.activityData.type === "File") ? root.activityData.subject
: (root.activityData.type === "Notification") ? root.activityData.message
: ""
height: (text === "") ? 0 : activityTextTitle.height
width: parent.width
elide: Text.ElideRight
font.pixelSize: Style.subLinePixelSize
}
Label {
id: activityTextDateTime
text: root.activityData.dateTime
height: (text === "") ? 0 : activityTextTitle.height
width: parent.width
elide: Text.ElideRight
font.pixelSize: Style.subLinePixelSize
color: "#808080"
}
}
Button {
id: dismissActionButton
Layout.preferredWidth: parent.height * 0.40
Layout.preferredHeight: parent.height * 0.40
Layout.alignment: Qt.AlignCenter
Layout.margins: Style.roundButtonBackgroundVerticalMargins
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: qsTr("Dismiss")
Accessible.name: qsTr("Dismiss")
visible: root.showDismissButton && !shareButton.visible
background: Rectangle {
color: "transparent"
}
contentItem: Image {
anchors.fill: parent
source: parent.hovered ? "image://svgimage-custom-color/clear.svg/black" : "image://svgimage-custom-color/clear.svg/grey"
sourceSize.width: 24
sourceSize.height: 24
}
onClicked: root.dismissButtonClicked()
}
CustomButton {
id: shareButton
Layout.preferredWidth: parent.height * 0.70
Layout.preferredHeight: parent.height * 0.70
visible: root.activityData.isShareable
imageSource: "image://svgimage-custom-color/share.svg" + "/" + Style.ncBlue
imageSourceHover: "image://svgimage-custom-color/share.svg" + "/" + Style.ncTextColor
toolTipText: qsTr("Open share dialog")
bgColor: Style.ncBlue
onClicked: root.shareButtonClicked()
}
}

View File

@@ -0,0 +1,25 @@
import QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.3
AutoSizingMenu {
id: moreActionsButtonContextMenu
property int maxActionButtons: 0
property var linksContextMenu: []
signal menuEntryTriggered(int index)
Repeater {
id: moreActionsButtonContextMenuRepeater
model: moreActionsButtonContextMenu.linksContextMenu
delegate: MenuItem {
id: moreActionsButtonContextMenuEntry
text: model.modelData.label
onTriggered: menuEntryTriggered(model.modelData.actionIndex)
}
}
}

View File

@@ -1,14 +1,14 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import Style 1.0
import com.nextcloud.desktopclient 1.0 as NC
ScrollView {
id: controlRoot
property alias model: activityList.model
property bool isFileActivityList: false
signal showFileActivity(string displayPath, string absolutePath)
signal activityItemClicked(int index)
@@ -31,12 +31,19 @@ ScrollView {
clip: true
spacing: 10
delegate: ActivityItem {
isFileActivityList: controlRoot.isFileActivityList
width: activityList.contentWidth
height: Style.trayWindowHeaderHeight
flickable: activityList
onClicked: activityItemClicked(model.index)
onFileActivityButtonClicked: showFileActivity(displayPath, absolutePath)
onClicked: {
if (model.isCurrentUserFileActivity) {
showFileActivity(model.displayPath, model.absolutePath)
} else {
activityItemClicked(model.index)
}
}
}
}
}

View File

@@ -0,0 +1,61 @@
import QtQuick 2.15
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
Button {
id: root
property string imageSource: ""
property string imageSourceHover: ""
property string toolTipText: ""
property color textColor
property color textColorHovered
property color bgColor: "transparent"
property bool bold: false
background: Rectangle {
color: root.bgColor
opacity: parent.hovered ? 1.0 : 0.3
radius: width / 2
}
leftPadding: root.text === "" ? 5 : 10
rightPadding: root.text === "" ? 5 : 10
contentItem: RowLayout {
Image {
id: icon
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
source: root.hovered ? root.imageSourceHover : root.imageSource
}
Label {
Layout.maximumWidth: icon.width > 0 ? parent.width - icon.width - parent.spacing : parent.width
Layout.fillWidth: icon.status !== Image.Ready
text: root.text
font.bold: root.bold
visible: root.text !== ""
color: root.hovered ? root.textColorHovered : root.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}
ToolTip {
text: root.toolTipText
delay: Qt.styleHints.mousePressAndHoldInterval
visible: root.toolTipText !== "" && root.hovered
}
}

View File

@@ -0,0 +1,49 @@
import QtQuick 2.15
import QtQuick.Controls 2.3
import Style 1.0
Label {
id: root
property string toolTipText: ""
property Action action: null
property alias acceptedButtons: mouseArea.acceptedButtons
property bool hovered: mouseArea.containsMouse
height: implicitHeight
property color textColor: Style.unifiedSearchResulTitleColor
property color textColorHovered: Style.unifiedSearchResulSublineColor
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.onPressAction: root.clicked(null)
text: action ? action.text : ""
enabled: !action || action.enabled
onClicked: if (action) action.trigger()
font.underline: true
color: root.hovered ? root.textColorHovered : root.textColor
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
signal pressed(QtObject mouse)
signal clicked(QtObject mouse)
ToolTip {
text: root.toolTipText
delay: Qt.styleHints.mousePressAndHoldInterval
visible: root.toolTipText !== "" && root.hovered
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: root.clicked(mouse)
onPressed: root.pressed(mouse)
}
}

View File

@@ -15,6 +15,7 @@ Window {
height: 500
ActivityList {
isFileActivityList: true
anchors.fill: parent
model: dialog.model
}

View File

@@ -111,14 +111,12 @@ MenuItem {
width: parent.width
Label {
id: emoji
height: Style.topLinePixelSize
visible: model.statusEmoji !== ""
text: statusEmoji
topPadding: -Style.accountLabelsSpacing
}
Label {
id: message
height: Style.topLinePixelSize
width: parent.width - parent.spacing - emoji.width
visible: model.statusMessage !== ""
text: statusMessage
@@ -169,9 +167,8 @@ MenuItem {
y: userMoreButton.y + 1
}
Menu {
AutoSizingMenu {
id: userMoreButtonMenu
width: 120
closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape
background: Rectangle {

View File

@@ -174,6 +174,22 @@ Window {
radius: Style.currentAccountButtonRadius
}
contentItem: ScrollView {
id: accMenuScrollView
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
data: WheelHandler {
target: accMenuScrollView.contentItem
}
ListView {
implicitHeight: contentHeight
model: accountMenu.contentModel
interactive: true
clip: true
currentIndex: accountMenu.currentIndex
}
}
onClosed: {
// HACK: reload account Instantiator immediately by restting it - could be done better I guess
// see also onVisibleChanged above
@@ -732,7 +748,7 @@ Window {
openFileActivityDialog(displayPath, absolutePath)
}
onActivityItemClicked: {
model.triggerDefaultAction(index)
model.slotTriggerDefaultAction(index)
}
}

View File

@@ -33,4 +33,15 @@ Activity::Identifier Activity::ident() const
{
return Identifier(_id, _accName);
}
ActivityLink ActivityLink::createFomJsonObject(const QJsonObject &obj)
{
ActivityLink activityLink;
activityLink._label = QUrl::fromPercentEncoding(obj.value(QStringLiteral("label")).toString().toUtf8());
activityLink._link = obj.value(QStringLiteral("link")).toString();
activityLink._verb = obj.value(QStringLiteral("type")).toString().toUtf8();
activityLink._primary = obj.value(QStringLiteral("primary")).toBool();
return activityLink;
}
}

View File

@@ -17,6 +17,7 @@
#include <QtCore>
#include <QIcon>
#include <QJsonObject>
namespace OCC {
/**
@@ -28,13 +29,20 @@ namespace OCC {
class ActivityLink
{
Q_GADGET
Q_PROPERTY(QString imageSource MEMBER _imageSource)
Q_PROPERTY(QString imageSourceHovered MEMBER _imageSourceHovered)
Q_PROPERTY(QString label MEMBER _label)
Q_PROPERTY(QString link MEMBER _link)
Q_PROPERTY(QByteArray verb MEMBER _verb)
Q_PROPERTY(bool primary MEMBER _primary)
public:
static ActivityLink createFomJsonObject(const QJsonObject &obj);
public:
QString _imageSource;
QString _imageSourceHovered;
QString _label;
QString _link;
QByteArray _verb;
@@ -61,19 +69,32 @@ public:
SyncFileItemType
};
struct RichSubjectParameter {
QString type; // Required
QString id; // Required
QString name; // Required
QString path; // Required (for files only)
QUrl link; // Optional (files only)
};
Type _type;
qlonglong _id;
QString _fileAction;
QString _objectType;
QString _subject;
QString _subjectRich;
QHash<QString, RichSubjectParameter> _subjectRichParameters;
QString _subjectDisplay;
QString _message;
QString _folder;
QString _file;
QString _renamedFile;
QUrl _link;
QDateTime _dateTime;
qint64 _expireAtMsecs = -1;
QString _accName;
QString _icon;
bool _isCurrentUserFileActivity = false;
// Stores information about the error
int _status;

View File

@@ -54,20 +54,25 @@ ActivityListModel::ActivityListModel(AccountState *accountState,
QHash<int, QByteArray> ActivityListModel::roleNames() const
{
QHash<int, QByteArray> roles;
auto roles = QAbstractListModel::roleNames();
roles[DisplayPathRole] = "displayPath";
roles[PathRole] = "path";
roles[AbsolutePathRole] = "absolutePath";
roles[DisplayLocationRole] = "displayLocation";
roles[LinkRole] = "link";
roles[MessageRole] = "message";
roles[ActionRole] = "type";
roles[ActionIconRole] = "icon";
roles[ActionTextRole] = "subject";
roles[ActionsLinksRole] = "links";
roles[ActionsLinksContextMenuRole] = "linksContextMenu";
roles[ActionsLinksForActionButtonsRole] = "linksForActionButtons";
roles[ActionTextColorRole] = "activityTextTitleColor";
roles[ObjectTypeRole] = "objectType";
roles[PointInTimeRole] = "dateTime";
roles[DisplayActions] = "displayActions";
roles[ShareableRole] = "isShareable";
roles[IsCurrentUserFileActivityRole] = "isCurrentUserFileActivity";
return roles;
}
@@ -76,6 +81,11 @@ void ActivityListModel::setAccountState(AccountState *state)
_accountState = state;
}
void ActivityListModel::setCurrentItem(const int currentItem)
{
_currentItem = currentItem;
}
void ActivityListModel::setCurrentlyFetching(bool value)
{
_currentlyFetching = value;
@@ -113,15 +123,41 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
if (!ast && _accountState != ast.data())
return QVariant();
switch (role) {
case DisplayPathRole:
if (!a._file.isEmpty()) {
auto folder = FolderMan::instance()->folder(a._folder);
QString relPath(a._file);
if (folder) {
relPath.prepend(folder->remotePath());
}
const auto getFilePath = [&]() {
const auto fileName = a._fileAction == QStringLiteral("file_renamed") ? a._renamedFile : a._file;
if (!fileName.isEmpty()) {
const auto folder = FolderMan::instance()->folder(a._folder);
const QString relPath = folder ? folder->remotePath() + fileName : fileName;
const auto localFiles = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
if (localFiles.isEmpty()) {
return QString();
}
// If this is an E2EE file or folder, pretend we got no path, hiding the share button which is what we want
if (folder) {
SyncJournalFileRecord rec;
folder->journalDb()->getFileRecord(fileName.mid(1), &rec);
if (rec.isValid() && (rec._isE2eEncrypted || !rec._e2eMangledName.isEmpty())) {
return QString();
}
}
return localFiles.constFirst();
}
return QString();
};
const auto getDisplayPath = [&a, &ast]() {
if (!a._file.isEmpty()) {
const auto folder = FolderMan::instance()->folder(a._folder);
QString relPath = folder ? folder->remotePath() + a._file : a._file;
const auto localFiles = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
if (localFiles.count() > 0) {
if (relPath.startsWith('/') || relPath.startsWith('\\')) {
return relPath.remove(0, 1);
@@ -131,54 +167,22 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
}
}
return QString();
};
const auto displayLocation = [&]() {
const auto displayPath = QFileInfo(getDisplayPath()).path();
return displayPath == "." || displayPath == "/" ? QString() : displayPath;
};
switch (role) {
case DisplayPathRole:
return getDisplayPath();
case PathRole:
if (!a._file.isEmpty()) {
const auto folder = FolderMan::instance()->folder(a._folder);
QString relPath(a._file);
if (folder) {
relPath.prepend(folder->remotePath());
}
// get relative path to the file so we can open it in the file manager
const auto localFiles = FolderMan::instance()->findFileInLocalFolders(QFileInfo(relPath).path(), ast->account());
if (localFiles.isEmpty()) {
return QString();
}
// If this is an E2EE file or folder, pretend we got no path, this leads to
// hiding the share button which is what we want
if (folder) {
SyncJournalFileRecord rec;
folder->journalDb()->getFileRecord(a._file.mid(1), &rec);
if (rec.isValid() && (rec._isE2eEncrypted || !rec._e2eMangledName.isEmpty())) {
return QString();
}
}
return QUrl::fromLocalFile(localFiles.constFirst());
}
return QString();
case AbsolutePathRole: {
const auto folder = FolderMan::instance()->folder(a._folder);
QString relPath(a._file);
if (!a._file.isEmpty()) {
if (folder) {
relPath.prepend(folder->remotePath());
}
const auto localFiles = FolderMan::instance()->findFileInLocalFolders(relPath, ast->account());
if (!localFiles.empty()) {
return localFiles.constFirst();
} else {
qWarning("File not local folders while processing absolute path request.");
return QString();
}
} else {
qWarning("Received an absolute path request for an activity without a file path.");
return QString();
}
}
return QFileInfo(getFilePath()).path();
case AbsolutePathRole:
return getFilePath();
case DisplayLocationRole:
return displayLocation();
case ActionsLinksRole: {
QList<QVariant> customList;
foreach (ActivityLink activityLink, a._links) {
@@ -186,6 +190,15 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
}
return customList;
}
case ActionsLinksContextMenuRole: {
return ActivityListModel::convertLinksToMenuEntries(a);
}
case ActionsLinksForActionButtonsRole: {
return ActivityListModel::convertLinksToActionButtons(a);
}
case ActionIconRole: {
if (a._type == Activity::NotificationType) {
return "qrc:///client/theme/black/bell.svg";
@@ -241,7 +254,11 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
}
}
case ActionTextRole:
return a._subject;
if(a._subjectDisplay.isEmpty()) {
return a._subject;
}
return a._subjectDisplay;
case ActionTextColorRole:
return a._id == -1 ? QLatin1String("#808080") : QLatin1String("#222"); // FIXME: This is a temporary workaround for _showMoreActivitiesAvailableEntry
case MessageRole:
@@ -250,7 +267,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
if (a._link.isEmpty()) {
return "";
} else {
return a._link;
return a._link.toString();
}
}
case AccountRole:
@@ -262,14 +279,22 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
return (ast && ast->isConnected());
case DisplayActions:
return _displayActions;
case ShareableRole:
return !data(index, PathRole).toString().isEmpty() && a._objectType == QStringLiteral("files") && _displayActions && a._fileAction != "file_deleted" && a._status != SyncFileItem::FileIgnored;
case IsCurrentUserFileActivityRole:
return a._isCurrentUserFileActivity;
default:
return QVariant();
}
return QVariant();
}
int ActivityListModel::rowCount(const QModelIndex &) const
int ActivityListModel::rowCount(const QModelIndex &parent) const
{
if(parent.isValid()) {
return 0;
}
return _finalList.count();
}
@@ -305,6 +330,21 @@ void ActivityListModel::startFetchJob()
job->start();
}
void ActivityListModel::setFinalList(const ActivityList &finalList)
{
_finalList = finalList;
}
const ActivityList &ActivityListModel::finalList() const
{
return _finalList;
}
int ActivityListModel::currentItem() const
{
return _currentItem;
}
void ActivityListModel::activitiesReceived(const QJsonDocument &json, int statusCode)
{
auto activities = json.object().value("ocs").toObject().value("data").toArray();
@@ -328,17 +368,55 @@ void ActivityListModel::activitiesReceived(const QJsonDocument &json, int status
auto json = activ.toObject();
Activity a;
const auto activityUser = json.value(QStringLiteral("user")).toString();
a._type = Activity::ActivityType;
a._objectType = json.value("object_type").toString();
a._objectType = json.value(QStringLiteral("object_type")).toString();
a._accName = ast->account()->displayName();
a._id = json.value("activity_id").toInt();
a._fileAction = json.value("type").toString();
a._subject = json.value("subject").toString();
a._message = json.value("message").toString();
a._file = json.value("object_name").toString();
a._link = QUrl(json.value("link").toString());
a._dateTime = QDateTime::fromString(json.value("datetime").toString(), Qt::ISODate);
a._icon = json.value("icon").toString();
a._id = json.value(QStringLiteral("activity_id")).toInt();
a._fileAction = json.value(QStringLiteral("type")).toString();
a._subject = json.value(QStringLiteral("subject")).toString();
a._message = json.value(QStringLiteral("message")).toString();
a._file = json.value(QStringLiteral("object_name")).toString();
a._link = QUrl(json.value(QStringLiteral("link")).toString());
a._dateTime = QDateTime::fromString(json.value(QStringLiteral("datetime")).toString(), Qt::ISODate);
a._icon = json.value(QStringLiteral("icon")).toString();
a._isCurrentUserFileActivity = a._objectType == QStringLiteral("files") && activityUser == ast->account()->davUser();
auto richSubjectData = json.value(QStringLiteral("subject_rich")).toArray();
if(richSubjectData.size() > 1) {
a._subjectRich = richSubjectData[0].toString();
auto parameters = richSubjectData[1].toObject();
const QRegularExpression subjectRichParameterRe(QStringLiteral("({[a-zA-Z0-9]*})"));
const QRegularExpression subjectRichParameterBracesRe(QStringLiteral("[{}]"));
for (auto i = parameters.begin(); i != parameters.end(); ++i) {
const auto parameterJsonObject = i.value().toObject();
const Activity::RichSubjectParameter parameter = {
parameterJsonObject.value(QStringLiteral("type")).toString(),
parameterJsonObject.value(QStringLiteral("id")).toString(),
parameterJsonObject.value(QStringLiteral("name")).toString(),
parameterJsonObject.contains(QStringLiteral("path")) ? parameterJsonObject.value(QStringLiteral("path")).toString() : QString(),
parameterJsonObject.contains(QStringLiteral("link")) ? QUrl(parameterJsonObject.value(QStringLiteral("link")).toString()) : QUrl(),
};
a._subjectRichParameters[i.key()] = parameter;
}
auto displayString = a._subjectRich;
auto i = subjectRichParameterRe.globalMatch(displayString);
while (i.hasNext()) {
const auto match = i.next();
auto word = match.captured(1);
word.remove(subjectRichParameterBracesRe);
Q_ASSERT(a._subjectRichParameters.contains(word));
displayString = displayString.replace(match.captured(1), a._subjectRichParameters[word].name);
}
a._subjectDisplay = displayString;
}
list.append(a);
_currentItem = list.last()._id;
@@ -354,9 +432,9 @@ void ActivityListModel::activitiesReceived(const QJsonDocument &json, int status
_activityLists.append(list);
emit activityJobStatusCode(statusCode);
combineActivityLists();
emit activityJobStatusCode(statusCode);
}
void ActivityListModel::addErrorToActivityList(Activity activity)
@@ -445,7 +523,7 @@ void ActivityListModel::removeActivityFromActivityList(Activity activity)
}
}
void ActivityListModel::triggerDefaultAction(int activityIndex)
void ActivityListModel::slotTriggerDefaultAction(const int activityIndex)
{
if (activityIndex < 0 || activityIndex >= _finalList.size()) {
qCWarning(lcActivity) << "Couldn't trigger default action at index" << activityIndex << "/ final list size:" << _finalList.size();
@@ -453,7 +531,7 @@ void ActivityListModel::triggerDefaultAction(int activityIndex)
}
const auto modelIndex = index(activityIndex);
const auto path = data(modelIndex, PathRole).toUrl();
const auto path = data(modelIndex, PathRole).toString();
const auto activity = _finalList.at(activityIndex);
if (activity._status == SyncFileItem::Conflict) {
@@ -503,15 +581,15 @@ void ActivityListModel::triggerDefaultAction(int activityIndex)
return;
}
if (path.isValid()) {
QDesktopServices::openUrl(path);
if (!path.isEmpty()) {
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
} else {
const auto link = data(modelIndex, LinkRole).toUrl();
Utility::openBrowser(link);
}
}
void ActivityListModel::triggerAction(int activityIndex, int actionIndex)
void ActivityListModel::slotTriggerAction(const int activityIndex, const int actionIndex)
{
if (activityIndex < 0 || activityIndex >= _finalList.size()) {
qCWarning(lcActivity) << "Couldn't trigger action on activity at index" << activityIndex << "/ final list size:" << _finalList.size();
@@ -535,11 +613,112 @@ void ActivityListModel::triggerAction(int activityIndex, int actionIndex)
emit sendNotificationRequest(activity._accName, action._link, action._verb, activityIndex);
}
void ActivityListModel::slotTriggerDismiss(const int activityIndex)
{
if (activityIndex < 0 || activityIndex >= _finalList.size()) {
qCWarning(lcActivity) << "Couldn't trigger action on activity at index" << activityIndex << "/ final list size:" << _finalList.size();
return;
}
const auto activityLinks = _finalList[activityIndex]._links;
const auto foundActivityLinkIt = std::find_if(std::cbegin(activityLinks), std::cend(activityLinks), [](const ActivityLink &link) {
return link._verb == QStringLiteral("DELETE");
});
if (foundActivityLinkIt == std::cend(activityLinks)) {
qCWarning(lcActivity) << "Couldn't find dismiss action in activity at index" << activityIndex
<< " links.size() " << activityLinks.size();
return;
}
const auto actionIndex = static_cast<int>(std::distance(activityLinks.begin(), foundActivityLinkIt));
if (actionIndex < 0 || actionIndex > activityLinks.size()) {
qCWarning(lcActivity) << "Couldn't find dismiss action in activity at index" << activityIndex
<< " actionIndex found " << actionIndex;
return;
}
slotTriggerAction(activityIndex, actionIndex);
}
AccountState *ActivityListModel::accountState() const
{
return _accountState;
}
QVariantList ActivityListModel::convertLinksToActionButtons(const Activity &activity)
{
QVariantList customList;
if (activity._links.size() == 1) {
return customList;
}
if (static_cast<quint32>(activity._links.size()) > maxActionButtons()) {
customList << ActivityListModel::convertLinkToActionButton(activity, activity._links.first());
return customList;
}
for (const auto &activityLink : activity._links) {
if (activityLink._verb == QStringLiteral("DELETE")
|| (activity._objectType == QStringLiteral("chat") || activity._objectType == QStringLiteral("call")
|| activity._objectType == QStringLiteral("room"))) {
customList << ActivityListModel::convertLinkToActionButton(activity, activityLink);
}
}
return customList;
}
QVariant ActivityListModel::convertLinkToActionButton(const OCC::Activity &activity, const OCC::ActivityLink &activityLink)
{
auto activityLinkCopy = activityLink;
const auto isReplyIconApplicable = activityLink._verb == QStringLiteral("WEB")
&& (activity._objectType == QStringLiteral("chat") || activity._objectType == QStringLiteral("call")
|| activity._objectType == QStringLiteral("room"));
const QString replyButtonPath = QStringLiteral("image://svgimage-custom-color/reply.svg");
if (isReplyIconApplicable) {
activityLinkCopy._imageSource =
QString(replyButtonPath + "/" + OCC::Theme::instance()->wizardHeaderBackgroundColor().name());
activityLinkCopy._imageSourceHovered =
QString(replyButtonPath + "/" + OCC::Theme::instance()->wizardHeaderTitleColor().name());
}
const auto isReplyLabelApplicable = activityLink._verb == QStringLiteral("WEB")
&& (activity._objectType == QStringLiteral("chat")
|| (activity._objectType != QStringLiteral("room") && activity._objectType != QStringLiteral("call")));
if (activityLink._verb == QStringLiteral("DELETE")) {
activityLinkCopy._label = QObject::tr("Mark as read");
} else if (isReplyLabelApplicable) {
activityLinkCopy._label = QObject::tr("Reply");
}
return QVariant::fromValue(activityLinkCopy);
}
QVariantList ActivityListModel::convertLinksToMenuEntries(const Activity &activity)
{
QVariantList customList;
if (static_cast<quint32>(activity._links.size()) > maxActionButtons()) {
for (int i = 0; i < activity._links.size(); ++i) {
const auto &activityLink = activity._links[i];
if (!activityLink._primary) {
customList << QVariantMap{
{QStringLiteral("actionIndex"), i}, {QStringLiteral("label"), activityLink._label}};
}
}
}
return customList;
}
void ActivityListModel::combineActivityLists()
{
ActivityList resultList;
@@ -583,14 +762,8 @@ void ActivityListModel::combineActivityLists()
}
beginResetModel();
_finalList.clear();
_finalList = resultList;
endResetModel();
if (resultList.count() > 0) {
beginInsertRows(QModelIndex(), 0, resultList.count() - 1);
_finalList = resultList;
endInsertRows();
}
}
bool ActivityListModel::canFetchActivities() const
@@ -600,11 +773,8 @@ bool ActivityListModel::canFetchActivities() const
void ActivityListModel::fetchMore(const QModelIndex &)
{
if (canFetchActivities()) {
if (canFetchActivities() && !_currentlyFetching) {
startFetchJob();
} else {
_doneFetching = true;
combineActivityLists();
}
}
@@ -634,4 +804,6 @@ void ActivityListModel::slotRemoveAccount()
_totalActivitiesFetched = 0;
_showMoreActivitiesAvailableEntry = false;
}
}

View File

@@ -40,14 +40,17 @@ class ActivityListModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(quint32 maxActionButtons READ maxActionButtons CONSTANT)
Q_PROPERTY(AccountState *accountState READ accountState CONSTANT)
public:
enum DataRole {
ActionIconRole = Qt::UserRole + 1,
UserIconRole,
AccountRole,
ObjectTypeRole,
ActionsLinksRole,
ActionsLinksContextMenuRole,
ActionsLinksForActionButtonsRole,
ActionTextRole,
ActionTextColorRole,
ActionRole,
@@ -55,11 +58,13 @@ public:
DisplayPathRole,
PathRole,
AbsolutePathRole,
DisplayLocationRole, // Provides the display path to a file's parent folder, relative to Nextcloud root
LinkRole,
PointInTimeRole,
AccountConnectedRole,
SyncFileStatusRole,
DisplayActions,
ShareableRole,
IsCurrentUserFileActivityRole,
};
Q_ENUM(DataRole)
@@ -84,14 +89,22 @@ public:
void removeActivityFromActivityList(int row);
void removeActivityFromActivityList(Activity activity);
Q_INVOKABLE void triggerDefaultAction(int activityIndex);
Q_INVOKABLE void triggerAction(int activityIndex, int actionIndex);
AccountState *accountState() const;
void setAccountState(AccountState *state);
static constexpr quint32 maxActionButtons()
{
return MaxActionButtons;
}
void setCurrentItem(const int currentItem);
public slots:
void slotRefreshActivity();
void slotRemoveAccount();
void slotTriggerDefaultAction(const int activityIndex);
void slotTriggerAction(const int activityIndex, const int actionIndex);
void slotTriggerDismiss(const int activityIndex);
signals:
void activityJobStatusCode(int statusCode);
@@ -101,7 +114,6 @@ protected:
void activitiesReceived(const QJsonDocument &json, int statusCode);
QHash<int, QByteArray> roleNames() const override;
void setAccountState(AccountState *state);
void setCurrentlyFetching(bool value);
bool currentlyFetching() const;
void setDoneFetching(bool value);
@@ -110,7 +122,16 @@ protected:
virtual void startFetchJob();
// added these for unit tests
void setFinalList(const ActivityList &finalList);
const ActivityList &finalList() const;
int currentItem() const;
//
private:
static QVariantList convertLinksToMenuEntries(const Activity &activity);
static QVariantList convertLinksToActionButtons(const Activity &activity);
static QVariant convertLinkToActionButton(const Activity &activity, const ActivityLink &activityLink);
void combineActivityLists();
bool canFetchActivities() const;
@@ -137,6 +158,8 @@ private:
bool _currentlyFetching = false;
bool _doneFetching = false;
bool _hideOldActivities = true;
static constexpr quint32 MaxActionButtons = 2;
};
}

View File

@@ -121,14 +121,7 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
auto actions = json.value("actions").toArray();
foreach (auto action, actions) {
auto actionJson = action.toObject();
ActivityLink al;
al._label = QUrl::fromPercentEncoding(actionJson.value("label").toString().toUtf8());
al._link = actionJson.value("link").toString();
al._verb = actionJson.value("type").toString().toUtf8();
al._primary = actionJson.value("primary").toBool();
a._links.append(al);
a._links.append(ActivityLink::createFomJsonObject(action.toObject()));
}
// Add another action to dismiss notification on server

View File

@@ -506,12 +506,15 @@ void User::processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr
activity._folder = folder->alias();
activity._fileAction = "";
const auto fileName = QFileInfo(item->_originalFile).fileName();
if (item->_instruction == CSYNC_INSTRUCTION_REMOVE) {
activity._fileAction = "file_deleted";
} else if (item->_instruction == CSYNC_INSTRUCTION_NEW) {
activity._fileAction = "file_created";
} else if (item->_instruction == CSYNC_INSTRUCTION_RENAME) {
activity._fileAction = "file_renamed";
activity._renamedFile = item->_renameTarget;
} else {
activity._fileAction = "file_changed";
}
@@ -520,15 +523,15 @@ void User::processCompletedSyncItem(const Folder *folder, const SyncFileItemPtr
qCWarning(lcActivity) << "Item " << item->_file << " retrieved successfully.";
if (item->_direction != SyncFileItem::Up) {
activity._message = tr("Synced %1").arg(item->_originalFile);
activity._message = tr("Synced %1").arg(fileName);
} else if (activity._fileAction == "file_renamed") {
activity._message = tr("You renamed %1").arg(item->_originalFile);
activity._message = tr("You renamed %1").arg(fileName);
} else if (activity._fileAction == "file_deleted") {
activity._message = tr("You deleted %1").arg(item->_originalFile);
activity._message = tr("You deleted %1").arg(fileName);
} else if (activity._fileAction == "file_created") {
activity._message = tr("You created %1").arg(item->_originalFile);
activity._message = tr("You created %1").arg(fileName);
} else {
activity._message = tr("You changed %1").arg(item->_originalFile);
activity._message = tr("You changed %1").arg(fileName);
}
_activityModel->addSyncFileItemToActivityList(activity);

View File

@@ -57,6 +57,8 @@ using namespace QKeychain;
namespace {
constexpr int pushNotificationsReconnectInterval = 1000 * 60 * 2;
constexpr int usernamePrefillServerVersionMinSupportedMajor = 24;
constexpr int checksumRecalculateRequestServerVersionMinSupportedMajor = 24;
}
namespace OCC {
@@ -629,6 +631,21 @@ bool Account::serverVersionUnsupported() const
NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR, NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_PATCH);
}
bool Account::isUsernamePrefillSupported() const
{
return serverVersionInt() >= makeServerVersion(usernamePrefillServerVersionMinSupportedMajor, 0, 0);
}
bool Account::isChecksumRecalculateRequestSupported() const
{
return serverVersionInt() >= makeServerVersion(checksumRecalculateRequestServerVersionMinSupportedMajor, 0, 0);
}
int Account::checksumRecalculateServerVersionMinSupportedMajor() const
{
return checksumRecalculateRequestServerVersionMinSupportedMajor;
}
void Account::setServerVersion(const QString &version)
{
if (version == _serverVersion) {

View File

@@ -230,6 +230,12 @@ public:
*/
bool serverVersionUnsupported() const;
bool isUsernamePrefillSupported() const;
bool isChecksumRecalculateRequestSupported() const;
int checksumRecalculateServerVersionMinSupportedMajor() const;
/** True when the server connection is using HTTP2 */
bool isHttp2Supported() { return _http2Supported; }
void setHttp2Supported(bool value) { _http2Supported = value; }

View File

@@ -64,6 +64,9 @@ QByteArray getHeaderFromJsonReply(const QJsonObject &reply, const QByteArray &he
return reply.value(headerName).toString().toLatin1();
}
constexpr auto batchSize = 100;
constexpr auto parallelJobsMaximumCount = 1;
}
namespace OCC {
@@ -73,7 +76,8 @@ BulkPropagatorJob::BulkPropagatorJob(OwncloudPropagator *propagator,
: PropagatorJob(propagator)
, _items(items)
{
_filesToUpload.reserve(100);
_filesToUpload.reserve(batchSize);
_pendingChecksumFiles.reserve(batchSize);
}
bool BulkPropagatorJob::scheduleSelfOrChild()
@@ -81,9 +85,12 @@ bool BulkPropagatorJob::scheduleSelfOrChild()
if (_items.empty()) {
return false;
}
if (!_pendingChecksumFiles.empty()) {
return false;
}
_state = Running;
for(int i = 0; i < 100 && !_items.empty(); ++i) {
for(int i = 0; i < batchSize && !_items.empty(); ++i) {
auto currentItem = _items.front();
_items.pop_front();
_pendingChecksumFiles.insert(currentItem->_file);
@@ -101,7 +108,7 @@ bool BulkPropagatorJob::scheduleSelfOrChild()
PropagatorJob::JobParallelism BulkPropagatorJob::parallelism()
{
return PropagatorJob::JobParallelism::WaitForFinished;
return PropagatorJob::JobParallelism::FullParallelism;
}
void BulkPropagatorJob::startUploadFile(SyncFileItemPtr item, UploadFileInfo fileToUpload)
@@ -157,6 +164,12 @@ void BulkPropagatorJob::doStartUpload(SyncFileItemPtr item,
fileToUpload._file = item->_file = item->_renameTarget;
fileToUpload._path = propagator()->fullLocalPath(fileToUpload._file);
item->_modtime = FileSystem::getModTime(newFilePathAbsolute);
if (item->_modtime <= 0) {
_pendingChecksumFiles.remove(item->_file);
slotOnErrorStartFolderUnlock(item, SyncFileItem::NormalError, tr("File %1 has invalid modified time. Do not upload to the server.").arg(QDir::toNativeSeparators(item->_file)));
checkPropagationIsDone();
return;
}
}
const auto remotePath = propagator()->fullRemotePath(fileToUpload._file);
@@ -194,8 +207,10 @@ void BulkPropagatorJob::triggerUpload()
if (FileSystem::isFileLocked(singleFile._localPath)) {
emit propagator()->seenLockedFile(singleFile._localPath);
}
// Soft error because this is likely caused by the user modifying his files while syncing
abortWithError(singleFile._item, SyncFileItem::SoftError, device->errorString());
abortWithError(singleFile._item, SyncFileItem::NormalError, device->errorString());
emit finished(SyncFileItem::NormalError);
return;
}
singleFile._headers["X-File-Path"] = singleFile._remotePath.toUtf8();
@@ -217,6 +232,25 @@ void BulkPropagatorJob::triggerUpload()
adjustLastJobTimeout(job.get(), timeout);
_jobs.append(job.get());
job.release()->start();
if (parallelism() == PropagatorJob::JobParallelism::FullParallelism && _jobs.size() < parallelJobsMaximumCount) {
scheduleSelfOrChild();
}
}
void BulkPropagatorJob::checkPropagationIsDone()
{
if (_items.empty()) {
if (!_jobs.empty() || !_pendingChecksumFiles.empty()) {
// just wait for the other job to finish.
return;
}
qCInfo(lcBulkPropagatorJob) << "final status" << _finalStatus;
emit finished(_finalStatus);
propagator()->scheduleNextJob();
} else {
scheduleSelfOrChild();
}
}
void BulkPropagatorJob::slotComputeTransmissionChecksum(SyncFileItemPtr item,
@@ -256,17 +290,29 @@ void BulkPropagatorJob::slotStartUpload(SyncFileItemPtr item,
const QString originalFilePath = propagator()->fullLocalPath(item->_file);
if (!FileSystem::fileExists(fullFilePath)) {
return slotOnErrorStartFolderUnlock(item, SyncFileItem::SoftError, tr("File Removed (start upload) %1").arg(fullFilePath));
_pendingChecksumFiles.remove(item->_file);
slotOnErrorStartFolderUnlock(item, SyncFileItem::SoftError, tr("File Removed (start upload) %1").arg(fullFilePath));
checkPropagationIsDone();
return;
}
const time_t prevModtime = item->_modtime; // the _item value was set in PropagateUploadFile::start()
// but a potential checksum calculation could have taken some time during which the file could
// have been changed again, so better check again here.
item->_modtime = FileSystem::getModTime(originalFilePath);
if (item->_modtime <= 0) {
_pendingChecksumFiles.remove(item->_file);
slotOnErrorStartFolderUnlock(item, SyncFileItem::NormalError, tr("File %1 has invalid modification time. Do not upload to the server.").arg(QDir::toNativeSeparators(item->_file)));
checkPropagationIsDone();
return;
}
if (prevModtime != item->_modtime) {
propagator()->_anotherSyncNeeded = true;
_pendingChecksumFiles.remove(item->_file);
qDebug() << "trigger another sync after checking modified time of item" << item->_file << "prevModtime" << prevModtime << "Curr" << item->_modtime;
return slotOnErrorStartFolderUnlock(item, SyncFileItem::SoftError, tr("Local file changed during syncing. It will be resumed."));
slotOnErrorStartFolderUnlock(item, SyncFileItem::SoftError, tr("Local file changed during syncing. It will be resumed."));
checkPropagationIsDone();
return;
}
fileToUpload._size = FileSystem::getSize(fullFilePath);
@@ -277,7 +323,10 @@ void BulkPropagatorJob::slotStartUpload(SyncFileItemPtr item,
// or not yet fully copied to the destination.
if (fileIsStillChanging(*item)) {
propagator()->_anotherSyncNeeded = true;
return slotOnErrorStartFolderUnlock(item, SyncFileItem::SoftError, tr("Local file changed during sync."));
_pendingChecksumFiles.remove(item->_file);
slotOnErrorStartFolderUnlock(item, SyncFileItem::SoftError, tr("Local file changed during sync."));
checkPropagationIsDone();
return;
}
doStartUpload(item, fileToUpload, transmissionChecksum);
@@ -293,14 +342,13 @@ void BulkPropagatorJob::slotOnErrorStartFolderUnlock(SyncFileItemPtr item,
void BulkPropagatorJob::slotPutFinishedOneFile(const BulkUploadItem &singleFile,
PutMultiFileJob *job,
const QJsonObject &fullReplyObject)
const QJsonObject &fileReply)
{
bool finished = false;
const auto fileReply = fullReplyObject.value(QChar('/') + singleFile._item->_file).toObject();
qCInfo(lcBulkPropagatorJob()) << singleFile._item->_file << "file headers" << fileReply;
if (!fileReply[QStringLiteral("error")].toBool()) {
if (fileReply.contains("error") && !fileReply[QStringLiteral("error")].toBool()) {
singleFile._item->_httpErrorCode = static_cast<quint16>(200);
} else {
singleFile._item->_httpErrorCode = static_cast<quint16>(412);
@@ -309,7 +357,7 @@ void BulkPropagatorJob::slotPutFinishedOneFile(const BulkUploadItem &singleFile,
singleFile._item->_responseTimeStamp = job->responseTimestamp();
singleFile._item->_requestId = job->requestId();
if (singleFile._item->_httpErrorCode != 200) {
commonErrorHandling(singleFile._item);
commonErrorHandling(singleFile._item, fileReply[QStringLiteral("message")].toString());
return;
}
@@ -363,11 +411,15 @@ void BulkPropagatorJob::slotPutFinished()
const auto replyJson = QJsonDocument::fromJson(replyData);
const auto fullReplyObject = replyJson.object();
for (const auto &oneFile : _filesToUpload) {
slotPutFinishedOneFile(oneFile, job, fullReplyObject);
for (const auto &singleFile : _filesToUpload) {
if (!fullReplyObject.contains(singleFile._remotePath)) {
continue;
}
const auto singleReplyObject = fullReplyObject[singleFile._remotePath].toObject();
slotPutFinishedOneFile(singleFile, job, singleReplyObject);
}
finalize();
finalize(fullReplyObject);
}
void BulkPropagatorJob::slotUploadProgress(SyncFileItemPtr item, qint64 sent, qint64 total)
@@ -427,35 +479,25 @@ void BulkPropagatorJob::finalizeOneFile(const BulkUploadItem &oneFile)
propagator()->_journal->commit("upload file start");
}
void BulkPropagatorJob::finalize()
void BulkPropagatorJob::finalize(const QJsonObject &fullReply)
{
for(const auto &oneFile : _filesToUpload) {
if (!oneFile._item->hasErrorStatus()) {
finalizeOneFile(oneFile);
for(auto singleFileIt = std::begin(_filesToUpload); singleFileIt != std::end(_filesToUpload); ) {
const auto &singleFile = *singleFileIt;
if (!fullReply.contains(singleFile._remotePath)) {
++singleFileIt;
continue;
}
if (!singleFile._item->hasErrorStatus()) {
finalizeOneFile(singleFile);
}
done(oneFile._item, oneFile._item->_status, {});
done(singleFile._item, singleFile._item->_status, {});
singleFileIt = _filesToUpload.erase(singleFileIt);
}
Q_ASSERT(!_filesToUpload.empty());
_filesToUpload.clear();
if (_items.empty()) {
if (!_jobs.empty()) {
// just wait for the other job to finish.
return;
}
if (!_pendingChecksumFiles.empty()) {
// just wait for the other job to finish.
return;
}
qCInfo(lcBulkPropagatorJob) << "final status" << _finalStatus;
emit finished(_finalStatus);
propagator()->scheduleNextJob();
} else {
scheduleSelfOrChild();
}
checkPropagationIsDone();
}
void BulkPropagatorJob::done(SyncFileItemPtr item,
@@ -563,12 +605,13 @@ void BulkPropagatorJob::checkResettingErrors(SyncFileItemPtr item) const
}
}
void BulkPropagatorJob::commonErrorHandling(SyncFileItemPtr item)
void BulkPropagatorJob::commonErrorHandling(SyncFileItemPtr item,
const QString &errorMessage)
{
// Ensure errors that should eventually reset the chunked upload are tracked.
checkResettingErrors(item);
abortWithError(item, SyncFileItem::NormalError, tr("Error"));
abortWithError(item, SyncFileItem::NormalError, errorMessage);
}
bool BulkPropagatorJob::checkFileStillExists(SyncFileItemPtr item,

View File

@@ -98,7 +98,7 @@ private:
void adjustLastJobTimeout(AbstractNetworkJob *job,
qint64 fileSize) const;
void finalize();
void finalize(const QJsonObject &fullReply);
void finalizeOneFile(const BulkUploadItem &oneFile);
@@ -127,7 +127,8 @@ private:
/**
* Error handling functionality that is shared between jobs.
*/
void commonErrorHandling(SyncFileItemPtr item);
void commonErrorHandling(SyncFileItemPtr item,
const QString &errorMessage);
bool checkFileStillExists(SyncFileItemPtr item,
const bool finished,
@@ -150,6 +151,8 @@ private:
void triggerUpload();
void checkPropagationIsDone();
std::deque<SyncFileItemPtr> _items;
QVector<AbstractNetworkJob *> _jobs; /// network jobs that are currently in transit

View File

@@ -21,12 +21,12 @@ namespace OCC {
Q_LOGGING_CATEGORY(lcDeleteJob, "nextcloud.sync.networkjob.delete", QtInfoMsg)
DeleteJob::DeleteJob(AccountPtr account, const QString &path, QObject *parent)
: AbstractNetworkJob(account, path, parent)
: SimpleFileJob(account, path, parent)
{
}
DeleteJob::DeleteJob(AccountPtr account, const QUrl &url, QObject *parent)
: AbstractNetworkJob(account, QString(), parent)
: SimpleFileJob(account, QString(), parent)
, _url(url)
{
}
@@ -39,24 +39,10 @@ void DeleteJob::start()
}
if (_url.isValid()) {
sendRequest("DELETE", _url, req);
startRequest("DELETE", _url, req);
} else {
sendRequest("DELETE", makeDavUrl(path()), req);
startRequest("DELETE", req);
}
if (reply()->error() != QNetworkReply::NoError) {
qCWarning(lcDeleteJob) << " Network error: " << reply()->errorString();
}
AbstractNetworkJob::start();
}
bool DeleteJob::finished()
{
qCInfo(lcDeleteJob) << "DELETE of" << reply()->request().url() << "FINISHED WITH STATUS"
<< replyStatusString();
emit finishedSignal();
return true;
}
QByteArray DeleteJob::folderToken() const

View File

@@ -23,7 +23,7 @@ namespace OCC {
* @brief The DeleteJob class
* @ingroup libsync
*/
class DeleteJob : public AbstractNetworkJob
class DeleteJob : public SimpleFileJob
{
Q_OBJECT
public:
@@ -31,14 +31,10 @@ public:
explicit DeleteJob(AccountPtr account, const QUrl &url, QObject *parent = nullptr);
void start() override;
bool finished() override;
QByteArray folderToken() const;
void setFolderToken(const QByteArray &folderToken);
signals:
void finishedSignal();
private:
QUrl _url; // Only used if the constructor taking a url is taken.
QByteArray _folderToken;

View File

@@ -389,7 +389,13 @@ void ProcessDirectoryJob::processFile(PathTuple path,
item->_originalFile = path._original;
item->_previousSize = dbEntry._fileSize;
item->_previousModtime = dbEntry._modtime;
item->_renameTarget = localEntry.renameName;
if (!localEntry.renameName.isEmpty()) {
if (_dirItem) {
item->_renameTarget = _dirItem->_file + "/" + localEntry.renameName;
} else {
item->_renameTarget = localEntry.renameName;
}
}
if (dbEntry._modtime == localEntry.modtime && dbEntry._type == ItemTypeVirtualFile && localEntry.type == ItemTypeFile) {
item->_type = ItemTypeFile;
@@ -536,6 +542,19 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(
} else {
item->_instruction = CSYNC_INSTRUCTION_SYNC;
}
} else if (dbEntry._modtime <= 0 && serverEntry.modtime > 0) {
item->_direction = SyncFileItem::Down;
item->_modtime = serverEntry.modtime;
item->_size = sizeOnServer;
if (serverEntry.isDirectory) {
ENFORCE(dbEntry.isDirectory());
item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
} else if (!localEntry.isValid() && _queryLocal != ParentNotChanged) {
// Deleted locally, changed on server
item->_instruction = CSYNC_INSTRUCTION_NEW;
} else {
item->_instruction = CSYNC_INSTRUCTION_SYNC;
}
} else if (dbEntry._remotePerm != serverEntry.remotePerm || dbEntry._fileId != serverEntry.fileId || metaDataSizeNeedsUpdateForE2EeFilePlaceholder) {
if (metaDataSizeNeedsUpdateForE2EeFilePlaceholder) {
// we are updating placeholder sizes after migrating from older versions with VFS + E2EE implicit hydration not supported
@@ -934,6 +953,14 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
item->_modtime = localEntry.modtime;
item->_type = localEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile;
_childModified = true;
} else if (dbEntry._modtime > 0 && localEntry.modtime <= 0) {
item->_instruction = CSYNC_INSTRUCTION_SYNC;
item->_direction = SyncFileItem::Down;
item->_size = localEntry.size > 0 ? localEntry.size : dbEntry._fileSize;
item->_modtime = dbEntry._modtime;
item->_previousModtime = dbEntry._modtime;
item->_type = localEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile;
_childModified = true;
} else {
// Local file was changed
item->_instruction = CSYNC_INSTRUCTION_SYNC;
@@ -1033,9 +1060,8 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
if (!isFilePlaceHolder && !isOnlineOnlyFolder) {
if (localEntry.isDirectory && folderPlaceHolderAvailability.isValid() && !isOnlineOnlyFolder) {
// a VFS folder but is not online0only (has some files hydrated)
// a VFS folder but is not online-only (has some files hydrated)
qCInfo(lcDisco) << "Virtual directory without db entry for" << path._local << "but it contains hydrated file(s), so let's keep it and reupload.";
emit _discoveryData->addErrorToGui(SyncFileItem::SoftError, tr("Conflict when uploading some files to a folder. Those, conflicted, are going to get cleared!"), path._local);
return;
}
qCWarning(lcDisco) << "Virtual file without db entry for" << path._local

View File

@@ -185,7 +185,9 @@ QPair<bool, QByteArray> DiscoveryPhase::findAndCancelDeletedJob(const QString &o
qCWarning(lcDiscovery) << "instruction" << instruction;
qCWarning(lcDiscovery) << "(*it)->_type" << (*it)->_type;
qCWarning(lcDiscovery) << "(*it)->_isRestoration " << (*it)->_isRestoration;
ENFORCE(false);
Q_ASSERT(false);
addErrorToGui(SyncFileItem::Status::FatalError, tr("Error while canceling deletion of a file"), originalPath);
emit fatalError(tr("Error while canceling deletion of %1").arg(originalPath));
}
(*it)->_instruction = CSYNC_INSTRUCTION_NONE;
result = true;

View File

@@ -98,7 +98,7 @@ bool FileSystem::verifyFileUnchanged(const QString &fileName,
{
const qint64 actualSize = getSize(fileName);
const time_t actualMtime = getModTime(fileName);
if (actualSize != previousSize || actualMtime != previousMtime) {
if ((actualSize != previousSize && actualMtime > 0) || (actualMtime != previousMtime && previousMtime > 0 && actualMtime > 0)) {
qCInfo(lcFileSystem) << "File" << fileName << "has changed:"
<< "size: " << previousSize << "<->" << actualSize
<< ", mtime: " << previousMtime << "<->" << actualMtime;

View File

@@ -89,6 +89,30 @@ bool Logger::isLoggingToFile() const
void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString &message)
{
const QString msg = qFormatLogMessage(type, ctx, message);
#if defined(Q_OS_WIN) && defined(QT_DEBUG)
// write logs to Output window of Visual Studio
{
QString prefix;
switch (type) {
case QtDebugMsg:
break;
case QtInfoMsg:
break;
case QtWarningMsg:
prefix = QStringLiteral("[WARNING] ");
break;
case QtCriticalMsg:
prefix = QStringLiteral("[CRITICAL ERROR] ");
break;
case QtFatalMsg:
prefix = QStringLiteral("[FATAL ERROR] ");
break;
}
auto msgW = QString(prefix + message).toStdWString();
msgW.append(L"\n");
OutputDebugString(msgW.c_str());
}
#endif
{
QMutexLocker lock(&_mutex);
_crashLogIndex = (_crashLogIndex + 1) % CrashLogSize;

View File

@@ -55,6 +55,7 @@ Q_LOGGING_CATEGORY(lcMkColJob, "nextcloud.sync.networkjob.mkcol", QtInfoMsg)
Q_LOGGING_CATEGORY(lcProppatchJob, "nextcloud.sync.networkjob.proppatch", QtInfoMsg)
Q_LOGGING_CATEGORY(lcJsonApiJob, "nextcloud.sync.networkjob.jsonapi", QtInfoMsg)
Q_LOGGING_CATEGORY(lcDetermineAuthTypeJob, "nextcloud.sync.networkjob.determineauthtype", QtInfoMsg)
Q_LOGGING_CATEGORY(lcSimpleFileJob, "nextcloud.sync.networkjob.simplefilejob", QtInfoMsg)
const int notModifiedStatusCode = 304;
QByteArray parseEtag(const char *header)
@@ -1084,9 +1085,39 @@ bool SimpleNetworkJob::finished()
return true;
}
SimpleFileJob::SimpleFileJob(AccountPtr account, const QString &filePath, QObject *parent)
: AbstractNetworkJob(account, filePath, parent)
{
}
QNetworkReply *SimpleFileJob::startRequest(
const QByteArray &verb, const QNetworkRequest req, QIODevice *requestBody)
{
return startRequest(verb, makeDavUrl(path()), req, requestBody);
}
QNetworkReply *SimpleFileJob::startRequest(
const QByteArray &verb, const QUrl &url, const QNetworkRequest req, QIODevice *requestBody)
{
_verb = verb;
const auto reply = sendRequest(verb, url, req, requestBody);
if (reply->error() != QNetworkReply::NoError) {
qCWarning(lcSimpleFileJob) << verb << " Network error: " << reply->errorString();
}
AbstractNetworkJob::start();
return reply;
}
bool SimpleFileJob::finished()
{
qCInfo(lcSimpleFileJob) << _verb << "for" << reply()->request().url() << "FINISHED WITH STATUS" << replyStatusString();
emit finishedSignal(reply());
return true;
}
DeleteApiJob::DeleteApiJob(AccountPtr account, const QString &path, QObject *parent)
: AbstractNetworkJob(account, path, parent)
: SimpleFileJob(account, path, parent)
{
}
@@ -1095,14 +1126,13 @@ void DeleteApiJob::start()
{
QNetworkRequest req;
req.setRawHeader("OCS-APIREQUEST", "true");
QUrl url = Utility::concatUrlPath(account()->url(), path());
sendRequest("DELETE", url, req);
AbstractNetworkJob::start();
startRequest("DELETE", req);
}
bool DeleteApiJob::finished()
{
qCInfo(lcJsonApiJob) << "JsonApiJob of" << reply()->request().url() << "FINISHED WITH STATUS"
qCInfo(lcJsonApiJob) << "DeleteApiJob of" << reply()->request().url() << "FINISHED WITH STATUS"
<< reply()->error()
<< (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString());
@@ -1118,7 +1148,7 @@ bool DeleteApiJob::finished()
const auto replyData = QString::fromUtf8(reply()->readAll());
qCInfo(lcJsonApiJob()) << "TMX Delete Job" << replyData;
emit result(httpStatus);
return true;
return SimpleFileJob::finished();
}
void fetchPrivateLinkUrl(AccountPtr account, const QString &remotePath,

View File

@@ -60,6 +60,31 @@ private slots:
bool finished() override;
};
/**
* @brief A basic file manipulation job
* @ingroup libsync
*/
class OWNCLOUDSYNC_EXPORT SimpleFileJob : public AbstractNetworkJob
{
Q_OBJECT
public:
explicit SimpleFileJob(AccountPtr account, const QString &filePath, QObject *parent = nullptr);
QNetworkReply *startRequest(
const QByteArray &verb, const QNetworkRequest req = QNetworkRequest(), QIODevice *requestBody = nullptr);
QNetworkReply *startRequest(const QByteArray &verb, const QUrl &url, const QNetworkRequest req = QNetworkRequest(),
QIODevice *requestBody = nullptr);
signals:
void finishedSignal(QNetworkReply *reply);
protected slots:
bool finished() override;
private:
QByteArray _verb;
};
/**
* @brief sends a DELETE http request to a url.
*
@@ -67,7 +92,7 @@ private slots:
*
* This does *not* delete files, it does a http request.
*/
class OWNCLOUDSYNC_EXPORT DeleteApiJob : public AbstractNetworkJob
class OWNCLOUDSYNC_EXPORT DeleteApiJob : public SimpleFileJob
{
Q_OBJECT
public:

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