1
0
Fork 0
Commit Graph

7122 Commits

Author SHA1 Message Date
Kevin Ottens 73c3aa7898 Extract the svg renderer from the loop
No need to recreate it each time for nothing.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 16a37c6aa0 Branded clients have more size variety for their icons
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 983c02b6db Switch to for range loop
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Kevin Ottens 14ecf535f9 Let Theme tell us if we're branded or not
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-28 09:20:34 +00:00
Camila e89177b25b Add OpacityMask to fix mouse hover on round corner.
- Fix for #2173.
- Removed the workaround for the left round corner which was also
fixed with the OpacityMask.

Signed-off-by: Camila <hello@camila.codes>
2020-07-28 11:19:22 +02:00
Stephan Beyer cd008ffe59 Let context menu open wizard if there are no accounts
The context menu offers to open the main dialog and the settings
even if no accounts are configured.  In this case, the main dialog
is useless and the settings are probably confusing.  Hence, this
commit replaces these actions in the context menu by an action
to open the wizard (which also opens on left click, so this is
the most natural thing to do).

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-23 21:08:53 +02:00
Dominique Fuchs a07db657d5 sigh, too
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 12:44:45 +02:00
Dominique Fuchs cd3a72822e Get a const auto for the FolderMap to iterate over
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Dominique Fuchs dbdf40ea45 Replaced Qt foreach by C++11 ranged for loop
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Dominique Fuchs 82c70f0c95 Properly set syncPause state on Systray creation when account init is done
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Dominique Fuchs 5ac3099b37 Fixed copy/paste bug, resulting in a wrong signal ::pauseSync used instead of ::resumeSync
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-21 10:10:07 +00:00
Dominique Fuchs 6ab55eddae Add -no-strip cmd line arg to macdeployqt if when building with Debug profile
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-20 15:04:33 +02:00
Kevin Ottens f46276d70d Update our E2E API requirement
Now that we adjusted our protocol to follow the slightly updated server
API, let's make sure we don't try to talk to a server with an older API.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 18:39:29 +02:00
Kevin Ottens c369d33015
Disable parallelism if we think the parent is e2e
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:05:54 +02:00
Kevin Ottens cfd3771818
Allow to override the parallelism
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:05:11 +02:00
Kevin Ottens 5cfbf34501
Move PropagateRemoteMkdir ctor to the cpp file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 13:03:55 +02:00
Kevin Ottens 6b8d2270c6 Make sure the tray icon point is in screen coordinates
Previously we were using QCursor::pos() in the Linux case, which is a
fair heuristic except it will always be relative to the primary screen
and not the current screen. This explains why we had to adjust with the
virtual geometry.

In the Windows and Mac case we got the position out of QSystemTrayIcon
and that one was already relative to the current screen.

So now we use QCursor::pos(currentScreen()) which ensures we give the
coordinates relatively to the current screen also in the Linux case.

Since all platforms are now having that point in the same coordinate
system we don't need to mess around with the virtual geometry to
compensate.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-15 12:22:54 +02:00
Dominique Fuchs 6bc70ddd5b
Fix typo, use compound assignment op
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-13 17:47:19 +02:00
Dominique Fuchs bc20edc582
Only attempt to move if file exist
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-13 17:47:18 +02:00
Dominique Fuchs 4656748130
Move existing syncjournal db files from client ver <2.7
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-13 17:47:11 +02:00
Dominique Fuchs 19d46f0541 Merge branch 'fix-delete-base-folders-instr' of https://github.com/Nextcloud/desktop into fix-delete-base-folders-instr 2020-07-09 21:47:34 +02:00
Dominique Fuchs f8920f969f Remove debug variable
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-09 21:47:19 +02:00
Dominique Fuchs 8deb38ac24
Merge branch 'master' into fix-delete-base-folders-instr 2020-07-09 21:38:11 +02:00
Dominique Fuchs d47e570ff3 Prevent empty FileMap in local csync to be processed if folder not empty
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-09 21:23:24 +02:00
Kevin Ottens 3ccac1b1be Properly register folder as encrypted during sync
Turns out that when we added a new e2e folder during sync, we were
passing the wrong path to the e2e object. We have several path
convention in the sync code, just happened to be the wrong one.

I still long for the day when we'll use the type system to deal with
paths. All those strings are error-prone.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 17:16:21 +02:00
Kevin Ottens 26686ecd45 Recover from missing metadata on uploads
Other clients seem to allow creating empty encrypted folders with no
metadata associated to them, so let's get ready to handle it. In case of
a 404 to get the metadata, we create an empty metadata payload and pass
it further down.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 4ef42e53d3 Change the separator in the private key
It used to be a base64 encoded '|', now it is still a '|' but not
encoded, let's adjust accordingly.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 3c20b2414e Prevent parallelism when deleting encrypted files
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 1be869fdc7 Unlock the folder only after we actually deleted the file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 8e0ab5ce47 Allow to specify the e2e-token on DeleteJob
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 0575d0e793 Stop unlocking from within PropagateRemoteDeleteEncrypted
We need to finish deleting the file before we can actually unlock. Also
the token will be necessary for the delete to succeed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 7e251edd6e Compare the unencrypted filename with the originalName
Otherwise obviously we'd never find the files in the metadata.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 2831b22be4 Use the encrypted path for collection listing
If we use the local path we'll get a 404.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 511a6e66dc Pass e2e-token to PropagateUpload subjobs
The headers() method is used to pass extra headers to the PUT jobs for
instance, definitely needed for uploads now.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 9a4c63404d Pass the e2e-token for encrypted MKCOL
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens 01f5501ad8 Allow to pass extraHeaders to a path based MkColJob
We could specify the extra headers with a URL but not a simple path.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Kevin Ottens e14ae806b6 E2EE RFC has been updated to use e2e-token instead of token
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-09 16:22:54 +02:00
Camila f018f7df3b Fix text in the permissions menu for share link.
Changed word capitalization and replace && for andi to match the server.

Signed-off-by: Camila <hello@camila.codes>
2020-07-09 03:21:04 +00:00
Camila 30a533d49c Share link display the correct permissions for files and folders.
- Fix #2175:
	- Shows the correct default permissions
	- Shows the permissions the user set

Signed-off-by: Camila <hello@camila.codes>
2020-07-09 03:21:04 +00:00
Camila d7a1367292
Display the correct default permissions when creating a share.
- The default displayed was not in sync with the server because
the client was setting permissions when creating a share while it
should get the default permissions from the server to display it to the
user first.

Signed-off-by: Camila <hello@camila.codes>
2020-07-08 18:15:36 +02:00
Stephan Beyer 308bed0da7 Use braced initializer list for returns in Systray::taskbarGeometry()
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer a87b6157ee Make csync_file_stat_s::isE2eEncrypted a bitfield
This is in line with other bools of that struct and gets rid
of clang-tidy's modernize-use-default-member-init warning.
(The trivial alternative to get rid of that warning would be
to use default member init for that bool variable, but I think
it is better to have it as a bitfield.)

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer 1e6747cd1d Remove redundant initialization of ElidedLabel::_elideMode
The value gets already initialized by default member initialization,
so there is no need to set it again in the constructor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer 293be2c2e6 Remove redundant initialization of HttpCredentials::_keychainMigration
The value gets already initialized by default member initialization,
so there is no need to set it again.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer a9de465927 Remove redundant initialization of SyncFileStatus::_shared attribute
The value gets already initialized by default member initialization,
so there is no need to set it again in the copy constructor.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer ed570d6274 Use default member init for PKeyCtx::_ctx and PKey::_pkey
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Stephan Beyer 00f93fdb77 Use more auto in folderstatusdelegate.cpp
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-08 14:08:41 +02:00
Kevin Ottens 2492e241ac Adjust to makeDbName returning an absolute path
PR #1451 changed the behavior of makeDbName which now returns an
absolute path. This obviously then failed in nextcloudcmd which
prepended to it the path to the local folder to sync. We just stop doing
this to have the journal db end up at the right place in that case as
well.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-08 13:09:13 +02:00
Kevin Ottens c2632eb604 Handle properly null avatar
If we try to produce the avatar before we managed to connect we'd end up
trying to paint in a null image. Just return early, which will allow the
caller to do something else instead.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 18:07:33 +02:00
Kevin Ottens 217869e95c Decode the href from the XML payload
The XML we get as reply has href entities properly percent encoded.
Since we didn't go through QUrl next we didn't get a properly decoded
version. Make sure we decode it before storage.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 15:51:24 +00:00
Kevin Ottens f90d6951c2 No need to compute base at each loop run
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-07 15:51:24 +00:00
Stephan Beyer e32bd75519 Set maximum height of account and app menu
The menus may become too large if they have too many items
(the account menu has this in case of many accounts, the apps
menu in case of many apps).  This commit limits the maximum
height such that the menus do not hide the header.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-07-07 17:35:09 +02:00
Kevin Ottens b98cf0a029 Reach out to the contentItem inside of the ListView to find the width
Turns out that the ListView embedded in the Menu (reachable via
contentItem) would create a binding loop if we're using its
childrenRect. But really we're interested in the total width for the
instantiated delegate *inside* the ListView. That's why we go one level
deeper and get the childrenRect of the inner contentItem instead.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 20:39:42 +00:00
Michael Schuster f4d83d02f6
Cleanup auto pointers and qobject casts, refactor KeychainChunk
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:40 +02:00
Michael Schuster ff631e919f
ProxyAuthHandler: Add template member function execAwait to avoid code duplication
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:40 +02:00
Michael Schuster 8503226c44
Keychain: Use auto deletion in WebFlowCredentials and ConfigFile
- Also make use of the new KeychainChunk::DeleteJob

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:40 +02:00
Michael Schuster 42eb3388f8
Refactor KeychainChunk to use QEventLoop and add DeleteJob class
- Use QEventLoop for synchronous exec()
- Rename startAwait() to exec()
- Add code for auto deletion
- Add new DeleteJob class
- Cleanup, tweaks

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:40 +02:00
Michael Schuster ea95c4bf49
Refactor ProxyAuthHandler to use QEventLoop
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:39 +02:00
Michael Schuster 81c644e702
ConfigFile security: Migrate Proxy password to keychain
When specified in the config file, the Proxy password will be migrated
to the keychain, for backward compatibility and to allow admins to
overwrite an existing password by rolling out updated config files.

Once migrated to the keychain, the password will be removed from the
config file.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:39 +02:00
Michael Schuster 18cbbc5052
KeychainChunk: Add synchronous method startAwait()
Awaits completion with no need to connect some slot to the finished() signal first,
inspired by the ProxyAuthHandler class.

Also add:
- Job dtor to safely erase passwords
- textData() method
- New ctor overloads to work with arbitrary keys (without Account ptrs)

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:39 +02:00
Michael Schuster 2a3ef044be
Move KeychainChunk class from gui to libsync
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:39 +02:00
Michael Schuster 203a2ce003
Move QKeychain::NoBackendAvailable error handling to KeychainChunk class
Originally this was in the WebFlowCredentials class. Since we've abstracted everything
from there already, let's also move this in case some other code may use
KeychainChunk::ReadJob prior to WebFlowCredentials.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-07-06 21:51:36 +02:00
Kevin Ottens d3d713ff9c Fix the hover for the other menu items
Ultimately we would avoid the code duplication by creating our own
proper QQC2 style instead of directly tuning everything. That's a battle
for another time (more elements would need to be adjusted for that, I
don't want to dilute this branch too much).

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 20:14:57 +02:00
Dominique Fuchs 180f191014 Fix hover cutoff in apps menu
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-07-06 20:14:57 +02:00
asemmar 628a426d22 forgot some indent
Signed-off-by: asemmar <anis.semmar@itron.com>
2020-07-06 09:46:14 +02:00
asemmar d5587e386c fixed bad spelling of word 'retreive' except in sqlite dependancy
Signed-off-by: asemmar <anis.semmar@itron.com>
2020-07-06 09:46:14 +02:00
Kevin Ottens d217fc272e Make sure moves involving e2e are delete + upload
If the file has a mangled name or will end up in a parent directory
known to be encrypted, we stick to the CSYNC_INTRUCTION_NEW instead of
going for CSYNC_INSTRUCTION_RENAME. This way we'll have a delete and an
upload instead of a move command.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 0b1cf69134 Update the metadata table with encryption info before discovery
When the ClientSideEncryption object is fed, also serialize the
encryption info of the folders inside the metadata table.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 7bb48a76c4 Add isE2eEncrypted column in the metadata table
This will allow to exploit the information of a directory being
encrypted or not during the discovery phase.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 287a130044 Also deliver the encrypted status via the ClientEncryption signal
This will turn useful for other consumers of that data. The alternative
would be to expose a method breaking all form of encapsulation.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens 3520360159 Move the e2e information fetch even earlier
We used to do it when the propagation starts, let's do it even before
the discovery starts. This way we'll have a chance to exploit the
information during the discovery phase.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Kevin Ottens f98c7990ba Split the discovery phase out of startSync()
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-06 05:27:14 +00:00
Camila bd9aae8ca2 Don't display quota information when the user has no quota.
- The code handling the api response was not up to date with the latest
api changes.
- Unlimited quota display: use qint64 to avoid data loss
- Change total with quota: total holds the quota total and not the storage total.

Signed-off-by: Camila <hello@camila.codes>
2020-07-02 20:06:12 +02:00
Camila fdc160460b Fix #2085 new tray menu.
Update systray behavior and context menu:
- left click brings up the new QtQuick based dialogs on all latforms
- right click brings up the new QtQuick based dialog on Mac OS only
- right click brings up a context menu on all other platforms than Mac OS
- "Quit Nextcloud" => "Exit Nextcloud"
- Add "Open main dialog" option.

Signed-off-by: Camila <hello@camila.codes>
2020-07-02 19:21:10 +02:00
Kevin Ottens 5a07a36d06 Avoid job parallelism when uploading to an encrypted folder
With the current design of the file upload this necessarily pushed to a
lock starvation on the folder. Indeed you could end up with N jobs
asking for the lock at the same time. So just avoid parallelizing for
now even though it will be slow.

We could try to optimize but that'd require some serious changes to the
sync logic on the jobs... let's stabilize first and optimize later.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 17:11:57 +00:00
Kevin Ottens 27b982ceaf Override parallelism() for uploads
This way we'll be able to control parallelism for upload jobs.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 17:11:57 +00:00
Kevin Ottens 5e20e2b46f Move PropagateUpload ctor impl to the cpp file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 17:11:57 +00:00
Kevin Ottens 542d303313 Reduce interaction with e2ee folders when in the wizard
During the wizard we currently don't have much information about the
encrypted folders. In particular we can only display their mangled names
which is far from ideal for the user to make an informed choice.

That's why in the wizard we now forbid creation of subfolders in e2ee
folders and we also don't display subfolders of e2ee folders.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens cb9ba9702b Properly display encryption status for non root folder connection
Since the e2e oracle works only in term of absolute remote paths and
that our model x._path was relative, we need to properly convert.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens d2e8cd4469 Deal properly with encrypted item updates accross connections
In such cases we get a download for which _file is already the demangled
name and _encryptedFileName has the mangled information. This is
different to what we encountered so far where initially _file was
mangled and _encryptedFileName was empty. Let's deal with that case
properly.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 9a2d04720a Also use mangled paths when looking for entries below a path
Otherwise on second sync we wouldn't find anything under a mangled path
and just end up thinking said files were removed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 0f21b625ab Also check on mangled names when cleaning up the journal
Otherwise, after a first sync all the mangled entries would be removed
from the journal. On second sync it would be fine because we'd then have
seen the unmangled names because of the local files. Unfortunately
that'd mean reuploading them for nothing or trying to mkdir again on the
server for nothing... with a chance of using differently mangled names
(although I didn't spot it, I can't exclude it never happened).

This also led to weirdly getting stuck during sync when there was more
than one sync point.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 3204c15911 Better separate between absolute and relative paths on uploads
Yes... I still wish this would be all driven by the type system, would be
much less error-prone.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 8d5c79c219 Better separate between absolute and relative paths on downloads
I wish this would be all driven by the type system instead of
error-prone string concatenation everywhere. That will be for a (much)
later refactoring hopefully.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens 8a181adb3a Always use an absolute remote path for GetFolderEncryptStatusJob
It turns out this job expected an absolute remote path even in the case
of a subfolder sync point.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:58:29 +00:00
Kevin Ottens fdceb1f2d2 Allow to control logFlush from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:10:56 +02:00
Kevin Ottens f557dd7792 Allow to control logDir from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:10:53 +02:00
Kevin Ottens be2d9d4838 Allow to control logExpire from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 16:10:50 +02:00
Kevin Ottens 808fb17809 Allow to control log debug from the config file
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:56:23 +02:00
Kevin Ottens 7996eaae82 Have a filter rule capturing all of nextcloud debug
This was half broken before that commit and the previous one since some
of the categories would not be captured.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:39:52 +02:00
Kevin Ottens 53c31f5fed Make sure all our logging categories start with nextcloud.
Otherwise it was a bit confusing and annoying for filter rules:
e.g. "nextcloud.sync.*" vs "sync.*".

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:39:52 +02:00
Kevin Ottens 90f757b96b Repair the log message pattern
At last it will become useful again...

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:39:52 +02:00
Hannah von Reth 5a05c2d6cd [Logger] Ensure log file is flushed before crash 2020-07-01 15:13:20 +02:00
Hannah von Reth cd96b4a265 [Logger] Ensure errors are also printed to an attached console 2020-07-01 15:13:20 +02:00
Olivier Goffart 44fc881ced Logger: Remove the thread pointer from the log.
We don't do discovery in a thread or use many threads anymore so this is
just noise.

Also use of QString::sprintf is deprecated, and C cast.
2020-07-01 15:13:20 +02:00
Hannah von Reth 669e42edd1 [Logger] Correctly handle message priority
This fixes the flodded sys log.

Fixes: #7453
2020-07-01 15:13:20 +02:00
Hannah von Reth a57bf0c899 Print critical and fatal messages to stderr
That way we might get a reason why the client crashes (dev setup)
2020-07-01 15:13:20 +02:00
Christian Kamm 039d885b76 LogDir: Compress last logfile on restart
For #7353
2020-07-01 15:13:20 +02:00
Kevin Ottens 09c9a1c5bc Properly guard io.h since it is Windows only
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-07-01 15:13:20 +02:00
Dominik Schmidt b171bd991d Make -logfile - work on Windows 2020-07-01 14:54:52 +02:00
Dominik Schmidt fd493a0598 Make qFatal() trigger the crash reporter on Windows 2020-07-01 14:54:32 +02:00
Valdnet 01e6f73da5 Change the space character to a dot
Change the space character to a dot in the text string
2020-07-01 14:11:14 +02:00
Valdnet d526f9e073 Delete a space character
Delete a space character before the line breaks
2020-07-01 14:10:49 +02:00
Kevin Ottens d7a9a4cd09 Fix parenting issues of PropagateUploadEncrypted
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 3182c613ac Take care of mangled paths on download as well
This means adjusting PropagateDownloadEncrypted so that it knows where
the file will end (otherwise it would create temporary files in non
existant paths for instance).
In turn we have to adjust PropagateDownloadFile accordingly so that it
resolves the local folder the file will end up in.
And last we adjust PropagateLocalMkdir to resolve paths as well and
demangle as needed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 6dc12166ad Update the item even if we don't call decryptFile()
This way it makes it usable in a directory context.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 2abc3ce2f5 Stop leaking PropagateDownloadEncrypted objects
We give them a parent to make sure they will be destroyed when the jobs
which created them are destroyed themselves.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 01d44dd3a1 Display folder names demangled in the settings
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 710c470c13 Assume that folder paths can be mangled
PropagateUploadEncrypted made the assumption of the folder names never
being mangled. This is not true since the previous commits so make sure
we properly deal with that using the journal db.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 3e13919c35 Use QHash instead of QMap
This is not only a question of performances in our case (complexity
being better on look ups). It also provides a few more services.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 3db267a03b Ensure GetFolderEncryptStatusJob gets all the folders
We ensure the PROPFIND Depth is infinity by explicitly specifying the
header (turns out our implementation just doesn't assume infinity
otherwise). This way we have a clear picture about *all* the folders of
the user, otherwise ClientSideEncryption couldn't be a trustable oracle
on the encryption state for any folder not on the root and all the
encryption code assumes it has a full picture of encryption.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens f93fdafa80 Finally encrypt subdirectories during sync
We catch when a directory is inside a known encrypted folder and in such
a case we now do the following:
 1) we encrypt the folder meta data (its name) properly and create it
    under that mangled name on the server side
 2) we mark the new folder itself as encrypted

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 319e441653 Make PropagateUploadEncrypted reusable in a directory context
It was assuming we'd encrypt only files but directory names also need to
be encrypted. We just skip the writing to temp file part in that case.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens fc9a8c4496 Mark user strings for translation
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 74978a23fb Move the encrypt folder logic in a reusable job class
This way this whole logic isn't stuck into the settings dialog anymore.
Also cleaned up the unused "decrypt folder" logic.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens b3fb730d5a Use the propagator to trigger the e2e info fetch
This is a much better place than the GUI, this way we ensure the
propagator is always operating of up to date information. Previously if
the propagator kicked in without user interaction from startup (not
showing the settings dialog) it would have no E2E information available
whatsoever... unsurprisingly it would thus take wrong information at
every turn.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 5f611d6e39 Get ClientSideEncryption to notify when folder info fetch is done
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 76fbbfefa5 Fix typo
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 5afcf71e68 Fix typo
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 839c056b8d Don't show the encrypt action in subfolders of encrypted folders
Since we want to move to a place where the encryption of subfolders is
always enforced it makes no sense to leave it in control of the user.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 3bbc54ee6c Fix typo
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Kevin Ottens 03ecaab259 Capture the pointer to info by value
Using a reference capture is a disaster waiting to happen here, if for
some reason we'd move from exec() to popup() for the menu below we'd be
getting garbage in the lambda call.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-30 11:29:08 +02:00
Stephan Beyer 20b58219e4 Hide Systray's auxiliary positioning methods from public and Qml
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-26 12:03:26 +00:00
Stephan Beyer 080505ef46 Simplify tray window positioning
The Qml position setting code is moved to C++, which allowed to get rid
of the currentScreenIndex() method (which seemed to be just a detour to
pass the screen from C++ to Qml).

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-26 12:03:26 +00:00
Michael Schuster d71249bb6e Fix crash in UserModel::currentUser() and add more sanity checks
Commit 07bede8 (PR #1892) introduced a new helper method currentUser()
that didn't check for _users.count() thus causing to throw an
"index out of range" exception when no accounts are configured.

This commit uses the opportunity to add more sanity checks to UserModel.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-25 20:52:30 +02:00
Stephan Beyer f90e0e519f Make Systray's _trayEngine a QPointer
This is just safer.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-24 17:25:20 +02:00
Stephan Beyer 08cb289b8c Fix SEGV (by circular ownership) at exit
Commit a12205f322 (PR #1891) introduced
a circular ownership: qmlRegisterSingletonType<Systray>(...) makes the
QQmlEngine own the resulting singleton Systray instance, however, the
QQmlEngine _trayEngine itself is owned by the Systray instance. This
circular ownership results in a crash when the destructor of Systray
calls the destructor of _trayEngine which attempts to call the destructor
of Systray.

This commit solves this problem by making ownCloudGui, which is the
parent of Systray, the parent of the _trayEngine.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-24 13:50:17 +02:00
Stephan Beyer 6adb798728 Let Systray constructor call its base class constructor
Although I see no behavioral difference, this is probably
a good idea.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-24 13:42:26 +02:00
Michael Schuster 902963fa10 Fix issue #2108: Default system proxy not working with Account Wizard
Discovered on Windows in conjunction with PAC scripts:
- Already configured accounts worked
- Fresh client account setup did not work

Reason:
- Proxy was reset over and over again in Account::setCredentials

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-22 11:59:13 +02:00
Stephan Beyer 3f4ed0883a Make sure the menu separator uses Style.menuBorder color
In case the default color value will ever change, this
commit makes sure that the colors of the menu border and
the menu separator coincide.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-22 06:54:57 +00:00
Michael Schuster 92c8d6836b
Fix libsync exports for proxy changes in #1886
Build failed on Windows, missing libsync export for printQNetworkProxy after
moving ClientProxy class from gui to libsync.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-18 21:05:11 +02:00
Michael Schuster 0253e98041
Improve proxy logging: Log type string instead of abstract ID
The format in the client log was: 3://host:port
Now it is shown like:             HttpProxy://host:port

The old ID display was confusing and misleading users (and people debugging it ;p)

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-18 20:13:57 +02:00
Roeland Jago Douma 50dcab5f88
Move the proxyfiles to libsync where they make more sense
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-18 18:38:06 +02:00
Kevin Ottens 2ce1669ceb Bring forward the main systray dialog on second execution
Previously we were showing up the settings dialog but it doesn't quite
make sense anymore now that we got two dialogs.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-17 16:01:49 +00:00
Kevin Ottens a6873f556b Also show the window on right click
Note this won't work on all platforms. KDE Plasma and GNOME Shell (with
systray extension) assume that right click is necessarily for a context
menu exposed via D-Bus, there's not nice way to make the right click
popup the main dialog on those platforms.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-17 16:01:49 +00:00
Kevin Ottens 73a689bc39 Don't call method on potentially null object
We were calling accountState() on a "folder" member which could be
nullptr. In fact this would happen any time one right click on a file
outside of a sync dir under Windows, this thus led to a crash.

Since the capabilities variable was unused anyway, we just removed it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-16 19:15:53 +02:00
Kevin Ottens 4f7a6cfb1d Make activity items with a link clickable
We then get more items clickable, in particular the bottom one proposing
to open the activity application. Now we can click it and it opens the
activity application straight away.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-16 18:52:20 +02:00
Kevin Ottens f147e5a66f Don't use a bright blue color for menus
As advised, use a light gray instead, this electric blue was a bit too
much.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-16 18:52:20 +02:00
Kevin Ottens bc863584db Don't duplicate file name in the info line
For the "Activity" type activities, displayPath contains the file name
which is also in the subject. This was redundant, so now we don't
display an info line at all for that type of activities.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-16 18:52:20 +02:00
Kevin Ottens f8e2e3403a Close all menus on window show
We previously missed the app menu which wasn't closed.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-16 18:52:20 +02:00
Nicolas Fella 07bede8a56 Use properties to get user details
Convert imperative QML code to declarative code using property bindings

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-06-16 15:01:37 +02:00
Nicolas Fella a12205f322 Port from context properties to singletons
Context properties are deprecated and will be removed in Qt 6.
QML singletons are the better option here, especially given that
UserModel and UserAppsModel already are singletons.

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-06-16 14:34:59 +02:00
Nicolas Fella be2e5266aa Create HeaderButton QML component
Deduplicate the Button code by moving it into a separate file.

Also use the same background code for the apps button since as far as I can tell it didn't behave any different

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-06-15 20:52:41 +02:00
Kevin Ottens d3d99b2d9d Add some debug output for the window placement
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Michael Schuster 44a9200c5d Fix crash caused by setting Tray window screen pointer on the QML side
Seems like Qt sometimes doesn't like the QML window's screen property to be set
to a C++ (QVariant) pointer value, so we use the index: Qt.application.screens[]

See Qt docs: https://doc.qt.io/qt-5/qml-qtquick-window-window.html#screen-prop

This fix returns the matching window's index from the QGuiApplication::screens()
list to the QML side, instead of the window pointer.

Steps to reproduce the crash with the previous code:
- Open the Tray menu and close it a few times,
  or scroll randomly up and down in its activity list.

Tested with Qt 5.12.5

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-15 12:32:25 +00:00
Michael Schuster 5055f526c2 Remove Submodule qtmacgoodies again
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-15 12:32:25 +00:00
Kevin Ottens f15a9cfc82 Try make taskbar position heuristic more readable
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Kevin Ottens 5848a1575b Make the reference point independent of the window
This leads to simplifying the computation code quite a bit as well.
Indeed we're separating concern between what is window size dependent or
not and that shows.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Kevin Ottens 40824dc427 Get rid of screenIndex
This was leading to the same logic being duplicated several times. It's
fine to return the QScreen* on the QML side directly but wrapped into a
QVariant.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Kevin Ottens 6c6dfb15a7 Move all the position computation on the C++ side
The API is just more convenient there, the rect and point types on the
QML side are just pale shadow of their C++ counterparts.

Also improved a bit the constness of the Systray class.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Kevin Ottens 83b36b4ab0 Rename tbOrientation into taskbarOrientation
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Kevin Ottens aa90237e94 Introduce a screenRect as coordinate space
The top left corner of that screenRect is (0,0) or based on
(virtualX,virtualY) depending on the platform. This leads to easier
reduction in code duplication.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Kevin Ottens 65e8f33ccf Use TaskBarPosition enum on the QML side
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-15 12:32:25 +00:00
Dominique Fuchs a6f918f3c2 More simplifications, also transfer of more tray positioning logic to C++ backend.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-06-15 12:32:25 +00:00
Dominique Fuchs f44df7f61a Major multi monitor improvements and rewrite of tray window positioning
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-06-15 12:32:25 +00:00
Michael Schuster 456c1eadbe
Simplify nullptr comparisons where appropriate
Make the codebase consistent, we already have a lot of implicit pointer comparisons.

Exception: Stay explicit on return's, example:
  return _db != nullptr;

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-11 00:27:30 +02:00
Rick van der Zwet 24177ec7e4 Change default autostart to hide gui
Signed-off-by: Rick van der Zwet <info@rickvanderzwet.nl>
2020-06-09 18:34:30 +02:00
Stephan Beyer 0f620acc1f Replace prefixing of paths with file:// by QUrl::fromLocalFile()
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-09 16:45:46 +02:00
Stephan Beyer 749070a29c Hide openLocalFolderButton if no local folder is configured
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-09 16:45:46 +02:00
Stephan Beyer 131c1f1bac Fix crash on opening unconfigured local folder
When you try to open the local sync folder (by clicking on the
folder symbol) for an account that has no folder configured,
the client crashes.

This commit changes User::openLocalFolder() to do nothing in
case no local folder is configured.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-09 16:45:38 +02:00
Stephan Beyer 2946c335ba Change width of app menu
The app menu had a width based on the header button size which was
way too narrow to display its content.

This commit changes the width based on the contents (menu items) of
the menu, however, limiting the maximum width to half the window width.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-09 14:53:51 +02:00
Stephan Beyer ea16804751 Replace NULL by nullptr in all C++ files
We keep NULL in the pure C files in src/csync/std and test/csync.

We also replace Doxygen documentation referring to "NULL" to
"\c nullptr" (formatted as code).

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-06-08 20:07:50 +02:00
Nicolas Fella bce93b052b Use APPLICATION_ICON_NAME for autostart icon
Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-06-08 20:06:00 +02:00
Roeland Jago Douma fba69de096 Don't show a message box if the entered url returned an error
BEtter to now just display clickable links etc.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-06-08 19:40:16 +02:00
Michael Schuster e6389959ce macOS: Build nextcloudcmd after gui and run macdeployqt with the -executable option
- src/CMakeLists.txt: Switch build order to build cmd before gui
- src/gui/CMakeLists.txt: Use the -executable option for a combined run of macdeployqt

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-07 14:39:42 +02:00
Dominique Fuchs a45c2e04e5 Copy nextcloudcmd post-build instead of macdeployqt when building macOS bundle
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-06-07 14:39:42 +02:00
Michael Schuster acb56be528 macOS: Use macdeployqt instead of the old admin/osx/macdeployqt.py
In order to build the new 2.7 releases (new QML dependencies) without manually
modifying the old Python script each time, rely on Qt's standard tool instead.

This should streamline the build systems for upcoming dependency changes.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-07 14:39:42 +02:00
Michael Schuster 221e5c5fc4
Improve command line version info and help display to streamline gui and cmd
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-07 14:20:33 +02:00
Michael Schuster 0fe7a65738
Fix Qt 5.15.0 build error (missing include)
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-06-07 02:43:45 +02:00
Kevin Ottens 0503be65ae Cleanup the missing braced init list returns
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-03 16:14:18 +02:00
Kevin Ottens e3e262e42e Use default member init when applicable
This also fixes a couple of warnings at places (out of order init for
instance) and a potential bug in the webflow credentials / qtkeychain
integration.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-03 16:10:39 +02:00
Kevin Ottens 965909f7fa Add missing auto opportunities
Somehow forgot to run it on the updater code

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-03 16:02:43 +02:00
Camila San 3bae570f29 Do not declare local variables without an initial value.
Signed-off-by: Camila San <hello@camila.codes>
2020-06-03 07:50:40 +00:00
Kevin Ottens 02a28325a8 Show broken encryption icon only in non-empty folders
This should address Tobias' concerns regarding the icon being
misleading. Now we basically do the following inside an encrypted folder
parent:
 * encrypted folders get the encrypted icon;
 * non-encrypted empty folders get the regular folder icon;
 * non-encrypted non-empty folders get the broken encryption icon.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-06-02 15:50:18 +00:00
Ivan Čukić c800d9149e Show a broken lock icon for unencrypted subdirectory
The E2E application allows creating unencrypted subdirectories
in an encrypted parent. This is a big privacy problem.

This patch shows a red broken lock icon for these subdirectories
in the NC client UI.

Signed-off-by: Ivan Čukić <ivan.cukic@kde.org>
2020-06-02 15:50:18 +00:00
Ivan Čukić 4fb370275d Introduced RAII classes for other OpenSSL resources 2020-06-02 14:09:06 +00:00
Ivan Čukić c31b1a750d Fixing memory leaks in the encryption module
Due to usage of early-returns, combined with malloc/free,
several buffers that get allocated are leaked when an error
occurs.

Several functions had potential leaks:

 - `encryptStringSymmetric` leaked `ctext`
 - `EncryptionHelper::fileDecryption` leaked `out`
 - `EncryptionHelper::fileEncryption` leaked `out`

Most of the functions had leaks of the cypher context.

This patch uses `QByteArray` as the handler for the dynamically
allocated buffers for openssl to operate on. This also removes
the need for conversions from malloc'd buffers to `QByteArray`
variables previously present in the code.

It also introduces a `CypherCtx` thin wrapper class to provide
a leak-free handling of `EVP_CIPHER_CTX`.
2020-06-02 14:09:06 +00:00
Michael Schuster 6ec69a700d
ShareDialog: Pointer cosmetics
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-05-29 20:57:52 +02:00
Michael Schuster ae0ea12501
Merge branch 'master' into traywindow-listview-actions 2020-05-29 19:08:21 +02:00
Michael Schuster ba4d109315
ShareDialog: Add further checks for the _manager member ptr
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-05-29 18:29:47 +02:00
Michael Schuster efdef8535f
ShareDialog: Fix crash, properly init member pointers
_manager ptr only got initialized in the constructor when sharingPossible was set to true

Changes:
- Move member ptr inits from constructor to the header file's class definition
- Init _manager: set to nullptr too
- Add check for _manager to avoid crash in showSharingUi()

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-05-29 18:12:36 +02:00
Kevin Ottens 08cc4e1967 Remove the last redundant void arg I left behind
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-28 18:57:20 +02:00
Kevin Ottens 6e62c8b430 Use the return braced init list pattern
This way we avoid repeating the return type while it is already known.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-27 14:36:07 +02:00
Michael Schuster ccc409dbd0
Merge pull request #2024 from nextcloud/use_raw_string_literals
Use raw string literals when appropriate
2020-05-27 05:54:54 +02:00
Michael Schuster 044a4bf6b5
Merge pull request #2021 from nextcloud/use_default_for_trivial_ctor_and_dtor
Use = default for trivial ctors and dtors
2020-05-27 05:17:24 +02:00
Michael Schuster b2b0e8f4e4
Merge pull request #2020 from nextcloud/use_make_unique
Use make_unique when appropriate
2020-05-27 05:10:41 +02:00
Michael Schuster 4b2684cf4a
Merge pull request #2019 from nextcloud/remove_redundant_void_argument
Remove redundant void argument list
2020-05-27 05:07:52 +02:00
Kevin Ottens f5350db078 Use raw string literals when appropriate
This is especially nice for Windows paths.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-26 20:13:51 +02:00
Kevin Ottens a73a1f3927 Use = default for trivial ctors and dtors
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 21:33:24 +02:00
Kevin Ottens 9e20a0fecf Use make_unique when appropriate
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 21:08:43 +02:00
Kevin Ottens 65e6c445e5 Remove redundant void argument list
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 20:32:55 +02:00
Kevin Ottens 86b1821251 Remove redundant initializer
This is the same value than the initializer value in the header, no need
to repeat it.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 20:12:09 +02:00
Kevin Ottens b579b49a5c Get rid of redundant parentheses
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-25 20:03:01 +02:00
Stephan Beyer 375fcb8e14 Replace "https://..." hint by "https://host:port"
The new hint is a little more verbose and provides more information
than the old one.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-23 18:32:18 +02:00
Stephan Beyer f46ce2ce98 Show URL placeholder hint in wizard
In owncloudsetupnocredspage.ui, the URL input field leUrl has a
placeholder text saying "https://..." which is a very useful hint
for the user.  However, in the OwncloudSetupPage constructor, the
placeholer text is overwritten by the return string of the theme's
wizardUrlHint() method.  The NextcloudTheme class does not override
this virtual method, so an empty string is used.

To make available the "https://..." hint, it is moved from the
UI file to NextcloudTheme::wizardUrlHint().  Note that, if a
theme is used which does not allow a custom server URL, the
placeholder text is now empty.  This makes sense because the
input field is disabled in that case.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-23 18:32:15 +02:00
Stephan Beyer deff3230f5 Change vertical size policy of URL input field in wizard
The input field for the nextcloud server URL is vertically too
big (because of the icon next to it in the same horizontal layout).
This commit solves this issue by changing its vertical size policy
from Ignored to Fixed.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-23 18:32:10 +02:00
Kevin Ottens 89316ced9e
Merge pull request #1987 from sbeyer/fix-leaks
Fix a few leaks
2020-05-21 17:12:04 +02:00
Stephan Beyer faeb233a74 Use default member initializers in OCC::FolderStatusModel sub-structs
This allows to remove their explicit default constructor definitions.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:45:13 +02:00
Stephan Beyer 04a24c14a8 Use default member initializers in OCC::SyncJournalErrorBlacklistRecord
This allows to remove its explicit default constructor definition.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:41:33 +02:00
Stephan Beyer 3015ea5715 Use default member initializers in OCC::SyncJournalDb sub-structs
This allows to remove their explicit default constructor definitions.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:32:16 +02:00
Stephan Beyer 8bc1525df5 Fix leak in Systray
The member _trayEngine, allocated in the constructor, was leaking.

This commit sets the Systray instance as the Qt object tree parent of
the _trayEngine to fix the leak.

While at it, a few unused header includes have been removed.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:22:15 +02:00
Stephan Beyer eaf4aa0e5b Fix leak in CloudProviderManager
The member _map, allocated in the constructor, was leaking.

The ad-hoc way to fix the leak would have been to add a destructor
that deletes _map.  However, there is no good reason why _map has
to be a pointer to a QMap (instead of a QMap).
Hence this commit changes the type of the _map member from a QMap
pointer to a QMap.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:22:15 +02:00
Stephan Beyer 71a474129b Fix leak in CloudProviderWrapper
The member _recentlyChanged, allocated in the constructor, was leaking.

The ad-hoc way to fix the leak would have been to add a destructor
that deletes _recentlyChanged.  However, there is no good reason why
_recentlyChanged has to be a pointer to a QList (instead of a QList).
Hence this commit changes the type of the _recentlyChanged member
from a QList pointer to a QList.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 01:22:15 +02:00
Stephan Beyer 15bdfa9fbf Use default member initializers in OCC::FolderDefinition
Using default member initializers (available since C++11) in
OCC::FolderDefinition allows to remove its explicit default
constructor, which is favorable.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 00:56:26 +02:00
Stephan Beyer ff192e48d0 Remove unused member in OCC::FolderDefinition
OCC::FolderDefinition has a member called isClientSideEncrypted
that was introduced by commit 9318c487b9 but has not been used
in any way since.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
2020-05-21 00:56:06 +02:00
Kevin Ottens 5543e4d834 Don't use int literals for bools
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 13:52:58 +02:00
Dominique Fuchs e9a82dff77 Merge remote-tracking branch 'origin/master' into traywindow-listview-actions
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-05-20 10:48:46 +02:00
Michael Schuster 7804b8e006
Fix spacing
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-05-20 03:57:33 +02:00
Kevin Ottens 712869db9a Use auto to avoiding repeating type names
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 03:54:41 +02:00
Michael Schuster 7fd431b50f
Use the default parameter: QUrl::path(QUrl::PrettyDecoded = 0x000000)
Change it to path() to be consistent with the other usages in the project :)

See: https://doc.qt.io/qt-5/qurl.html#path

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-05-20 02:30:45 +02:00
Kevin Ottens dea6ebaa35 Use nullptr when appropriate
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-20 02:21:26 +02:00
Michael Schuster 0c040c9686
Merge pull request #1986 from nextcloud/properly_handle_denormalized_href_path
Properly handle denormalized href
2020-05-20 01:31:34 +02:00
Dominique Fuchs 9bfcdbae3a More code cleanupand style-preference adjustments.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-05-20 00:09:41 +02:00
Dominique Fuchs aa13aa533a Removed publiclink param and corresponding if branch.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-05-19 23:29:59 +02:00
Dominique Fuchs fa9dddf567 Code cleanup and this-> removals.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-05-19 23:25:21 +02:00
Kevin Ottens 4d1ff01654 Properly handle denormalized href
In case of denormalized paths in the dav href (presence of . or .. in
the path) simple string startsWith comparison wasn't enough to know if
said href ended up in the right namespace. That's why we're now using
QUrl (pretending local file since we don't have a full URL in the href)
to normalize the path before comparison.

This could happen with broken proxies for instance where we would
wrongly validate the dav information resulting in potentially surprising
syncing and name collisions.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-18 19:33:34 +02:00
Kevin Ottens 3867e73fd5 Stop supporting Qt older than 5.12
This both removes older Qt from the CI and also adjust all the
find_package calls in CMakeLists.txt

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-14 21:15:45 +02:00
Kevin Ottens 9000a880cb Don't silently kill debug messages
The message handler globally installed by the logger silently drop
messages if the logger is not logging. On top of it, it doesn't log
debug messages by default.

Anything not logged is currently silently discarded. This can come as a
surprise to a developer trying to contribute for the first time and
adding some debug message for some reason.

We're thus trying to strike a middle ground which is that debug messages
get a regular output if the logger isn't interested in them.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-12 17:33:13 +02:00
Kevin Ottens 3b6ab2fa5a Indicate this is a dialog and not a regular window
This is necessary with some window managers which would otherwise
consider they can reposition and resize the tray window as they wish
(yes, even though the user can't do it directly).

This is for instance the case if you use the tiling mode scripts of
KWin. It automatically ignores dialogs but might force windows to be
fullscreen (which would badly break the layout in our case).

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-07 09:39:08 +02:00
Kevin Ottens de7021e85e Force the default QQC2 style
This works around a bug in KDE's qqc2-desktop-style which breaks buttons
with icons not based on a name. By forcing a style name the KDE Plasma
platformtheme plugin won't try to force qqc2-desktops-style anymore.

Can be removed once the bug in qqc2-desktop-style is gone.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
2020-05-07 02:07:02 +02:00
Sandro Knauß 6cdae6c19e Fix typos.
Debian has a list of known typos in their checking tools.

Signed-off-by: Sandro Knauß <hefee@debian.org>
2020-05-04 18:11:36 +00:00
Dominique Fuchs 671961e641 Added share icon from nc server repo, changed corresp. btn icon
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-04-27 08:06:58 +02:00
Dominique Fuchs 1c21bfdd7c
Merge pull request #1922 from taaem/fix-recent-files
Fix cloudprovider crashing - don't clear the _recentMenu pointer
2020-04-25 13:37:29 +02:00
Dominique Fuchs ddee26084d
Merge pull request #1937 from ivaradi/xenial-compat
Qt 5.5 compatibility #ifdef
2020-04-25 12:23:25 +02:00
Dominique Fuchs 6df75328fd
Merge pull request #1893 from nicolasfella/override
override specifier missing
2020-04-25 12:18:56 +02:00
Dominique Fuchs 210253ce35
Merge pull request #1889 from nicolasfella/applicationengine
Use QQmlApplicationEngine instead of QQmlEngine
2020-04-25 12:15:33 +02:00
Dominique Fuchs 4bd5e9d79b Implemented share functionality in tray window and changed actions / button logic.
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
2020-04-25 10:17:53 +02:00
István Váradi 3d44a71755 Qt 5.5 compatibility #ifdef
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
2020-04-23 20:22:30 +02:00
Michael Schuster 6e220b10e4
Merge pull request #1883 from nicolasfella/contexticon
[dolphin] Add icon to context menu
2020-04-16 02:52:34 +02:00
Michael Schuster 45342d7952
Merge pull request #1882 from nicolasfella/detach
Fix container detaching
2020-04-15 21:28:51 +02:00
Michael Schuster d0b698ed37
Merge pull request #1881 from nicolasfella/envempty
Use qEnvironmentVariableIsEmpty
2020-04-15 17:52:09 +02:00
Michael Schuster ef42635c23
Merge pull request #1880 from nicolasfella/timeout
Remove timeout parameter from showMessage
2020-04-15 17:28:02 +02:00
Nicolas Fella 29fa924853 Use LINUX_APPLICATION_ID
Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-04-14 21:38:33 +02:00
Tim Klocke 18615d0297 CloudProviders: Don't clear the _recentMenu pointer
The _recentMenu pointer ref should not be freed, when building the
menu.
This fixes #1920 and #1818
2020-04-10 23:08:07 +02:00
Nicolas Fella b4d1a63c14 Use override
Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-22 21:58:15 +01:00
Nicolas Fella d54add6233 Use QQmlApplicationEngine
This simplifies the code a bit.

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-22 16:14:56 +01:00
Nicolas Fella e1f4d17446 [dolphin] Add icon to context menu
Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-21 02:04:42 +01:00
Nicolas Fella 1afda2b875 Fix container detaching
Found by clazy

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-21 01:24:37 +01:00
Nicolas Fella c1189421c0 Use qEnvironmentVariableIsEmpty
clazy suggests that it is more efficient since it doesn't allocate.

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-21 01:06:15 +01:00
Nicolas Fella b84a1eeb8d Remove timeout parameter from showMessage
It it never set by calling code so the default value of 10000 is used. It is only used in the call to QSystemTrayIcon, which uses 10000 as default value too.

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-21 00:40:40 +01:00
Nicolas Fella 2f54e911b7 Add desktop-entry hint to notifications
This allows the notification server to map a notification to the program's desktop file, which allows the server to do extra things. For example KDE Plasma adds the Nextcloud icon to the notification and allows to configure notifications from Nextcloud.

This is a standard hint from https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html#hints

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
2020-03-21 00:25:33 +01:00
Michael Schuster 102369bfbe
WebView: Add missing Q_OBJECT macros
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-11 01:18:11 +01:00
Michael Schuster 78776f81e4
Merge pull request #1847 from nextcloud/enh/updater
Updater: Enhance UI, make build optional
2020-03-10 15:53:47 +01:00
Michael Schuster e833e86da6 Updater: Add CMake option BUILD_UPDATER to make the updater optional
- Default: BUILD_UPDATER = NO

  To ease builds for distro packages and contributors (regardless of the specified update URL)

- Enable updater build for Drone CI and AppImage builds

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-09 02:34:55 +01:00
Michael Schuster c812d896aa Fix OCUpdater: Also change status on network error or invalid XML
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-09 02:34:55 +01:00
Michael Schuster c043a4e55c Updater UI: Implement auto-update option and update button
- Add checkbox and button to UI
- Add new parameter autoUpdateCheck to ConfigFile

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-09 02:34:55 +01:00
Michael Schuster 555b41f300
Fix Legal notice dialog: Correct title and header font
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-09 00:41:59 +01:00
Michael Schuster d8c407ac97
Settings dialog: Move detailed version info from About section to Legal notice dialog
- Enlarge dialog widget to show full content
- Implement Dark-/Light-Mode switching (hyperlinks)

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-07 06:45:41 +01:00
Michael Schuster 2adde0fcca
Settings dialog About section: Show minimal version info
- Application name, version number, OS

  Example: Nextcloud Desktop Client
           Version 2.6.4 (macOS)

- Keep previous version info in new method Theme::aboutDetails()

Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-07 06:38:09 +01:00
Michael Schuster a471868d88
Version parameter: Show Qt platform plugin, OS and CPU arch
Signed-off-by: Michael Schuster <michael@schuster.ms>
2020-03-07 06:31:14 +01:00