diff options
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinview.cpp | 10 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 6372266d4..590fe336b 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1490,6 +1490,16 @@ bool DolphinView::itemsExpandable() const return m_mode == DetailsView; } +bool DolphinView::isExpanded(const KFileItem& item) const +{ + Q_ASSERT(item.isDir()); + Q_ASSERT(items().contains(item)); + if (!itemsExpandable()) { + return false; + } + return m_model->isExpanded(m_model->index(item)); +} + void DolphinView::restoreState(QDataStream& stream) { // Read the version number of the view state and check if the version is supported. 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); |
