From 4d81aabd1ee78c2fca61452ef3a866cfad0c88a5 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Tue, 9 Aug 2022 16:02:55 +0200 Subject: Fix item highlighting through DBus Before this commit, even items that are distant children of currently open views were considered selectable. This lead to the bug that items meant to be highlighted through DBus would not be highlighted if any ancestor of the item was open in any view. This was fixed by only considering items in view if they can be seen by scrolling. Main difficulty here was to make this also work for the details view mode which allows expanding. To implement this cleanly, some refactoring seemed necessary because the logic to determine if an item is already in view was previously intertwined with the logic to identify already open directories. This commit also contains the following refactorings aiming to make the code more readable: - A magic value (-1) is replaced using std::optional. - A boolean trap is removed. - A QPair is replaced by a struct with named variables. - More and improved documentation --- src/global.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/global.cpp') diff --git a/src/global.cpp b/src/global.cpp index d8132b20a..cd1409d9e 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -90,7 +90,7 @@ bool Dolphin::attachToExistingInstance(const QList& inputUrls, bool openFi do { auto &interface = dolphinInterfaces[i]; - auto isUrlOpenReply = openFiles ? interface.first->isUrlOrParentOpen(url) : interface.first->isUrlOpen(url); + auto isUrlOpenReply = openFiles ? interface.first->isItemVisibleInAnyView(url) : interface.first->isUrlOpen(url); isUrlOpenReply.waitForFinished(); if (!isUrlOpenReply.isError() && isUrlOpenReply.value()) { interface.second.append(url); -- cgit v1.3