From 14732a0853492a608334ebfdab876fbce1a7d79f Mon Sep 17 00:00:00 2001 From: reionwong Date: Sat, 29 Aug 2026 23:28:21 -0400 Subject: [PATCH] fix(filemanager): restore icons, path bar clicks and rubber band selection --- desktop/desktopview.cpp | 2 ++ dialogs/filepropertiesdialog.cpp | 2 +- qml/FolderGridView.qml | 11 +++-------- qml/FolderListView.qml | 7 +++---- qml/PathBar.qml | 16 +++++++++------- window.cpp | 5 +++++ 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/desktop/desktopview.cpp b/desktop/desktopview.cpp index eb7bb24..49cf914 100644 --- a/desktop/desktopview.cpp +++ b/desktop/desktopview.cpp @@ -20,6 +20,7 @@ #include "desktopview.h" #include "dockdbusinterface.h" #include "thumbnailer/thumbnailprovider.h" +#include "desktopiconprovider.h" #include #include @@ -44,6 +45,7 @@ DesktopView::DesktopView(QScreen *screen, QQuickView *parent) engine()->rootContext()->setContextProperty("Dock", DockDBusInterface::self()); QWindow::fromWinId(winId())->setOpacity(0.99); engine()->addImageProvider("thumbnailer", new ThumbnailProvider()); + engine()->addImageProvider("icontheme", new DesktopIconProvider()); setTitle(tr("Desktop")); setScreen(m_screen); diff --git a/dialogs/filepropertiesdialog.cpp b/dialogs/filepropertiesdialog.cpp index 309cf1b..7b4e304 100644 --- a/dialogs/filepropertiesdialog.cpp +++ b/dialogs/filepropertiesdialog.cpp @@ -188,7 +188,7 @@ bool FilePropertiesDialog::event(QEvent *e) void FilePropertiesDialog::init() { engine()->rootContext()->setContextProperty("main", this); - // engine()->addImageProvider(QStringLiteral("icontheme"), new DesktopIconProvider()); + engine()->addImageProvider(QStringLiteral("icontheme"), new DesktopIconProvider()); setFlag(Qt::Dialog); setTitle(tr("Properties")); diff --git a/qml/FolderGridView.qml b/qml/FolderGridView.qml index 15a55ab..622863a 100644 --- a/qml/FolderGridView.qml +++ b/qml/FolderGridView.qml @@ -273,10 +273,9 @@ GridView { } clip: true - // The desktop uses a GridView for layout, but dragging its surface must - // select icons instead of flicking the desktop like a touch interface. - // WheelHandler remains responsible for wheel and touchpad scrolling. - interactive: !isDesktopView + // Dragging the view must rubber band select, not flick the content around + // like a touch interface. WheelHandler and the scroll bar do the scrolling. + interactive: false currentIndex: -1 ScrollBar.vertical: ScrollBar { } @@ -465,7 +464,6 @@ GridView { dirModel.pinSelection() control.rubberBand = rubberBandObject.createObject(control.contentItem, {x: cPress.x, y: cPress.y}) - control.interactive = false } } } @@ -524,7 +522,6 @@ GridView { control.rubberBand.close() control.rubberBand = null - control.interactive = !control.isDesktopView control.cachedRectangleSelection = null dirModel.unpinSelection() } @@ -663,14 +660,12 @@ GridView { targetItem.labelArea.visible = false _editor.select(0, dirModel.fileExtensionBoundary(targetItem.index)) visible = true - control.interactive = false } else { x = 0 y = 0 width = 0 height = 0 visible = false - control.interactive = !control.isDesktopView } } diff --git a/qml/FolderListView.qml b/qml/FolderListView.qml index a2c5b2a..25a6882 100644 --- a/qml/FolderListView.qml +++ b/qml/FolderListView.qml @@ -59,6 +59,9 @@ ListView { ScrollBar.vertical: ScrollBar { } boundsBehavior: Flickable.StopAtBounds + // Dragging the view must rubber band select, not flick the content around + // like a touch interface. WheelHandler and the scroll bar do the scrolling. + interactive: false FishUI.WheelHandler { target: control @@ -367,7 +370,6 @@ ListView { dirModel.pinSelection() control.rubberBand = rubberBandObject.createObject(control.contentItem, {x: cPress.x, y: cPress.y}) - control.interactive = false } } } @@ -403,7 +405,6 @@ ListView { control.rubberBand.close() control.rubberBand = null - control.interactive = true control.cachedRectangleSelection = null dirModel.unpinSelection() } @@ -471,12 +472,10 @@ ListView { targetItem.labelArea2.visible = false _editor.select(0, dirModel.fileExtensionBoundary(targetItem.index)) visible = true - control.interactive = false } else { x: 0 y: 0 visible = false - control.interactive = true } } diff --git a/qml/PathBar.qml b/qml/PathBar.qml index 78f370f..24ef2dd 100644 --- a/qml/PathBar.qml +++ b/qml/PathBar.qml @@ -40,9 +40,18 @@ Item { z: -1 } + // Clicking anywhere that is not a breadcrumb opens the path editor. The + // view above is not interactive, so its empty area lets the press through. + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onClicked: openEditor() + } + ListView { id: _pathView anchors.fill: parent + interactive: false anchors.topMargin: 2 anchors.bottomMargin: 2 model: _pathBarModel @@ -59,13 +68,6 @@ Item { _pathView.positionViewAtEnd() } - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton - onClicked: openEditor() - z: -1 - } - highlight: Rectangle { radius: FishUI.Theme.smallRadius color: Qt.rgba(FishUI.Theme.highlightColor.r, diff --git a/window.cpp b/window.cpp index 2d8f6ea..1297503 100644 --- a/window.cpp +++ b/window.cpp @@ -18,6 +18,7 @@ */ #include "window.h" +#include "desktopiconprovider.h" #include #include #include @@ -26,6 +27,10 @@ Window::Window(QObject *parent) : QQmlApplicationEngine(parent) { + // Qt6 only calls QQmlExtensionPlugin::initializeEngine() for the first engine + // that imports a module, so FishUI's "icontheme" provider is missing in every + // engine created afterwards. Register our own copy for each window. + addImageProvider("icontheme", new DesktopIconProvider()); } void Window::load(const QUrl &url)