Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Cambra <claudio.cambra@gmail.com>2022-07-26 20:21:17 +0300
committerClaudio Cambra <claudio.cambra@gmail.com>2022-08-26 21:22:41 +0300
commit6c52480a60c87b63f6ee107fe310957ee0e03123 (patch)
tree88c1564b71a73f4e1be5071f9c545622f0179b98
parent2e2ed97c70f28ec92a368cd5c144585339ac096d (diff)
Improve activity list highlighting/keyboard item selectionbugfix/keyboard-activity-list-selection
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
-rw-r--r--src/gui/tray/ActivityItem.qml6
-rw-r--r--src/gui/tray/ActivityList.qml38
2 files changed, 35 insertions, 9 deletions
diff --git a/src/gui/tray/ActivityItem.qml b/src/gui/tray/ActivityItem.qml
index b0ead37ed..5f417e291 100644
--- a/src/gui/tray/ActivityItem.qml
+++ b/src/gui/tray/ActivityItem.qml
@@ -34,12 +34,6 @@ MouseArea {
isTalkReplyOptionVisible = !isTalkReplyOptionVisible
}
- Rectangle {
- id: activityHover
- anchors.fill: parent
- color: (parent.containsMouse ? Style.lightHover : "transparent")
- }
-
ToolTip {
id: activityMouseAreaTooltip
visible: containsMouse && !activityContent.childHovered && model.displayLocation !== ""
diff --git a/src/gui/tray/ActivityList.qml b/src/gui/tray/ActivityList.qml
index f3a6416c2..8106c939f 100644
--- a/src/gui/tray/ActivityList.qml
+++ b/src/gui/tray/ActivityList.qml
@@ -2,6 +2,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15
import com.nextcloud.desktopclient 1.0 as NC
+import Style 1.0
ScrollView {
id: controlRoot
@@ -14,6 +15,7 @@ ScrollView {
contentWidth: availableWidth
padding: 1
+ focus: false
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
@@ -24,19 +26,49 @@ ScrollView {
ListView {
id: activityList
- keyNavigationEnabled: true
-
Accessible.role: Accessible.List
Accessible.name: qsTr("Activity list")
clip: true
-
spacing: 0
+ currentIndex: -1
+ interactive: true
+
+ highlight: Rectangle {
+ id: activityHover
+ width: activityList.currentItem.width
+ height: activityList.currentItem.height
+ color: Style.lightHover
+ visible: activityList.activeFocus
+ }
+ highlightFollowsCurrentItem: true
+ highlightMoveDuration: 0
+ highlightResizeDuration: 0
+ highlightRangeMode: ListView.ApplyRange
+ preferredHighlightBegin: 0
+ preferredHighlightEnd: controlRoot.height
delegate: ActivityItem {
isFileActivityList: controlRoot.isFileActivityList
width: activityList.contentWidth
flickable: activityList
+ onEntered: {
+ // When we set the currentIndex the list view will scroll...
+ // unless we tamper with the preferred highlight points to stop this.
+ const savedPreferredHighlightBegin = activityList.preferredHighlightBegin;
+ const savedPreferredHighlightEnd = activityList.preferredHighlightEnd;
+ // Set overkill values to make sure no scroll happens when we hover with mouse
+ activityList.preferredHighlightBegin = -controlRoot.height;
+ activityList.preferredHighlightEnd = controlRoot.height * 2;
+
+ activityList.currentIndex = index
+
+ // Reset original values so keyboard navigation makes list view scroll
+ activityList.preferredHighlightBegin = savedPreferredHighlightBegin;
+ activityList.preferredHighlightEnd = savedPreferredHighlightEnd;
+
+ forceActiveFocus();
+ }
onClicked: {
if (model.isCurrentUserFileActivity && model.openablePath) {
openFile("file://" + model.openablePath);