This improve considerably the keyboard navigation in the SystemTray.
But this is still not as good as the golden standard that is recommended
by this article: https://www.sarasoueidan.com/blog/focus-indicators/
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
ensure the label width is not higher than the parent to ensure log
string get elided as expected
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
- This information is retrieved from the notifications endpoint.
- Add icons for the different pre defined status.
- Make functions available to QML to decide which status icon to display.
- Display the user status icon on the avatar and
move the online/offline connection status to the folder icon.
Signed-off-by: Camila <hello@camila.codes>
Refactoring of User::isValueableactivity() because of changes
introduced with merge commit f17c52d.
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
When the client runs and a conflict gets detected, the sync engine runs
two times.
On the first run, the sync engine detects the conflict, marks the
file as a conflict and propagates that to the GUI. This leads to an
error notification with the original filename in the main dialog.
The sync engine runs then a second time. On this second run, the file
that originally caused the conflict is not anymore a conflict
file. Instead, the sync engine detects the conflicted copy and
propagates that file as a conflict to the GUI.
When opening the conflict dialog with the original file name (not the
conflicted copy) a crash happens. Usually, the two sync runs are really
fast, so the user does not notice the first notification. However, a
problem can occur if a conflict gets created while the client is not
running. Since then, the client does not do two sync runs. It does only
run once.
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
You'd expect that after a conflict resolution the file watcher would
pick up the change and trigger a sync. For some reason it doesn't seem
to happen on at least some Ubuntu systems. In such cases the user would
then still have a stale conflict entry in the activity list and wouldn't
be able to do anything with it.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
The model was just checking for the user list being empty or not which
is overly optimistic. Indeed there might be cases where the id is
actually outside the boundaries so properly check for this.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This is quick enough that no flickering should appear in practice.
We end up doing this because for some reason on Windows (I dug up deep
into the Windows QPA without nailing it down) not showing that systray
window at least once prevents the app object to return from exec() when
the session ends.
It's as if that window would be in some limbo state (neither opened nor
closed) which would prevent quitting. Clearly what we're doing here is a
workaround...
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
No need to go to the file manager first to then have the user go through
the context menu, just popup the dialog directly.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
We better do this before this business logic grows in the QML side and
gets out of control. We'll need finer grained information due to the
conflict handling anyway.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Use a similar trick of a semi-transparent rectangle on top when the
mouse area is hovered. This way it will always work whatever is the
background color.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
Combining translated strings like this makes them hard to translate since the order of words is different between languages.
Use proper placeholder strings instead.
Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
By using properties and property bindings the QML code gets more declarative rather than imperative, which is considered better.
This patch:
- Introduces a currentUserId property in UserModel that replaces the equivalent Q_INVOKABLE call
- Introduces an avatar property in User that contains the avatar's image provider url without any fallback
- Introduces new image provider urls for fallback images
- Moves the fallback image selection to QML since we want different fallbacks according to where it is used
- Wires up the necessary signals to propagate a changing avatar
Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
Otherwise we get lots of "No description available" lines in the
activity list which is basically noise. Also trains the user to ignore
the secondary line.
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
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>
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>
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>
- 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 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>
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>
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>
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>
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>
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 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>
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 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>
- Modify Window.qml and Systray to show the App menu upon clicking the App button
on the top-right. Fall back to opening the general URL in case no apps are found.
- Introduce a new UserAppsModel in UserModel.cpp to access the fetched server Apps
from AccountState (propagated down from the User class).
Signed-off-by: Michael Schuster <michael@schuster.ms>