fix(filemanager): restore icons, path bar clicks and rubber band selection

main
reionwong 4 weeks ago
parent adeeb512f8
commit 14732a0853

@ -20,6 +20,7 @@
#include "desktopview.h"
#include "dockdbusinterface.h"
#include "thumbnailer/thumbnailprovider.h"
#include "desktopiconprovider.h"
#include <QQmlEngine>
#include <QQmlContext>
@ -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);

@ -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"));

@ -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
}
}

@ -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
}
}

@ -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,

@ -18,6 +18,7 @@
*/
#include "window.h"
#include "desktopiconprovider.h"
#include <QEvent>
#include <QDebug>
#include <QQuickWindow>
@ -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)

Loading…
Cancel
Save