┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-10-29 18:05:37 +0200
committerPeter Penz <[email protected]>2011-10-29 18:06:03 +0200
commit74bc3cac2530031c0ec78fc5039342ac0f077eb7 (patch)
treed6ba8d30838e1c4205322cda295c64cb93151373 /src/kitemviews/kfileitemmodel.h
parentf63daef339dde16c7ef598f6fdaa5d2191da4685 (diff)
Implement grouping for all roles
Diffstat (limited to 'src/kitemviews/kfileitemmodel.h')
-rw-r--r--src/kitemviews/kfileitemmodel.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index 8ccff95e8..f2e783f46 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -198,11 +198,17 @@ private:
QList<QPair<int, QVariant> > sizeRoleGroups() const;
QList<QPair<int, QVariant> > dateRoleGroups() const;
QList<QPair<int, QVariant> > permissionRoleGroups() const;
- QList<QPair<int, QVariant> > ownerRoleGroups() const;
- QList<QPair<int, QVariant> > groupRoleGroups() const;
- QList<QPair<int, QVariant> > typeRoleGroups() const;
- QList<QPair<int, QVariant> > destinationRoleGroups() const;
- QList<QPair<int, QVariant> > pathRoleGroups() const;
+ QList<QPair<int, QVariant> > genericStringRoleGroups(const QByteArray& role) const;
+
+ /**
+ * Helper method for all xxxRoleGroups() methods to check whether the
+ * item with the given index is a child-item. A child-item is defined
+ * as item having an expansion-level > 0. All xxxRoleGroups() methods
+ * should skip the grouping if the item is a child-item (although
+ * KItemListView would be capable to show sub-groups in groups this
+ * results in visual clutter for most usecases).
+ */
+ bool isChildItem(int index) const;
private:
QWeakPointer<KDirLister> m_dirLister;
@@ -241,6 +247,11 @@ private:
friend class KFileItemModelTest; // For unit testing
};
+inline bool KFileItemModel::isChildItem(int index) const
+{
+ return m_requestRole[ExpansionLevelRole] && m_data.at(index).value("expansionLevel").toInt() > 0;
+}
+
#endif