┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinview.h
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2022-08-09 16:02:55 +0200
committerFelix Ernst <[email protected]>2022-10-11 15:26:31 +0200
commit4d81aabd1ee78c2fca61452ef3a866cfad0c88a5 (patch)
tree83b182680cfd8bab3a76054478a56896e60b8f61 /src/views/dolphinview.h
parent8916a647d6701c910c04c2cacecf60c014ac944f (diff)
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
Diffstat (limited to 'src/views/dolphinview.h')
-rw-r--r--src/views/dolphinview.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index 2ecd75957..aff4c51a8 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -292,6 +292,13 @@ public:
bool itemsExpandable() const;
/**
+ * @returns true if the @p item is one of the items() of this view and
+ * is currently expanded. false otherwise.
+ * Only directories in view modes that allow expanding can ever be expanded.
+ */
+ bool isExpanded(const KFileItem &item) const;
+
+ /**
* Restores the view state (current item, contents position, details view expansion state)
*/
void restoreState(QDataStream& stream);