Indee the MenuItem might not be linked to its Menu at creation time
which will make the binding fail and give a warning. Delay for the menu
availability.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Now that we depend on Qt 5.12 anyway, the count property is available
just fine on the Menu item.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Under Wayland QCursor::pos() is unlikely to give us anything meaningful,
so fallback to the primary screen information.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Users get rightfully confused with the "You changed ..." messages in the
activity list for syncs. Indeed, some of those changes might be coming
from the server in which case we don't really know who did the change.
So now we use the old "Synced ..." messages for changes pulled from the
server and we have a more precise "You changed ..." (renamed, deleted,
created) when the changes were initiated locally (since there we know
the user reading the message did it).
Also changed how the messages are constructed so that they can be
properly translated.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
I wrongly (and stupidly) assumed the int in QBitArray was treated as a
hash as well but it is an index so it must be positive. Also to make
things even worse I misread on which expression clang-tidy was
complaining regarding the implementation specific narrowing
conversion... This is happening after the modulo operator and not
before. We're in a safe range of values at that point, so it's fine to
let the narrowing happen.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This flagged mostly unused parameters. Didn't enable the
misc-non-private-member-variables-in-classes check as we got a lot of
those. Hopefully we'll get to fix them at some point but that feels too
early and too much work for now.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
The visibility of the share button for the activity list is tied to the
path role in the ActivityListModel, so make sure we don't return a path
for E2EE files and folders.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Those files and folders are not shareable and the "Edit" or "Open in
browser" actions will lead to showing an error in the web GUI. No need
to lead users there so just disable them.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Turns out that showing the button straight from the page ctor is a bit
too early. At that point the account might not be connected yet and thus
we wouldn't have proper information. Currently we were displaying that
button all the time, now we wait for the account to be connected to
decide to show it or not.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
We lost the ability to display the E2EE mnemonic during the GUI
redesign and the info message wasn't displayed again on restart. So now
we display it every time, it still can be dismissed and the button text
is different in such a case to make the intent clearer.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
We update properly the CLSID of folders to integrate them with the
Explorer pane when they are added or removed from the GUI. That said,
there might be cases of users adding folders to sync straight from the
GUI. In such a case the CLSID might be missing on config load so now we
assign one on the fly when that happens.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
The context menu should allow access to the Settings even when no accounts are configured.
Users may specify proxy / startup / update and other settings at any time.
This slipped through in #2164.
Signed-off-by: Michael Schuster <michael@schuster.ms>
- 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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
_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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
The PropfindJob quota includes the size of shares and thus leads to confusion
in regard of the real space available, as shown in the UI.
This commit aims to streamline the behaviour with the Android and iOS apps,
which also utilize the API.
Details:
- Refactor the QuotaInfo class into UserInfo
- Use JsonApiJob (ocs/v1.php/cloud/user) instead of PropfindJob
- Let ConnectionValidator use the new UserInfo class to fetch
the user and the avatar image (to avoid code duplication)
- Allow updating the avatar image upon AccountSettings visibility,
using UserInfo's quota fetching
Signed-off-by: Michael Schuster <michael@schuster.ms>