diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinsortfilterproxymodel.cpp | 15 | ||||
| -rw-r--r-- | src/dolphinsortfilterproxymodel.h | 6 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/dolphinsortfilterproxymodel.cpp b/src/dolphinsortfilterproxymodel.cpp index c2ae4039a..9374a40ad 100644 --- a/src/dolphinsortfilterproxymodel.cpp +++ b/src/dolphinsortfilterproxymodel.cpp @@ -55,7 +55,6 @@ DolphinSortFilterProxyModel::DolphinSortFilterProxyModel(QObject* parent) : // sort by the user visible string for now setSortRole(Qt::DisplayRole); setSortCaseSensitivity(Qt::CaseInsensitive); - sort(KDirModel::Name, Qt::Ascending); } DolphinSortFilterProxyModel::~DolphinSortFilterProxyModel() @@ -68,7 +67,7 @@ void DolphinSortFilterProxyModel::setSorting(DolphinView::Sorting sorting) // KDirModel::ModelColumns. We will keep the sortOrder. Q_ASSERT(static_cast<int>(sorting) >= 0 && static_cast<int>(sorting) < dolphinMapSize); sort(dolphinViewToDirModelColumn[static_cast<int>(sorting)], - m_sortOrder ); + m_sortOrder); } void DolphinSortFilterProxyModel::setSortOrder(Qt::SortOrder sortOrder) @@ -87,6 +86,18 @@ void DolphinSortFilterProxyModel::sort(int column, Qt::SortOrder sortOrder) QSortFilterProxyModel::sort(column, sortOrder); } +bool DolphinSortFilterProxyModel::hasChildren(const QModelIndex& parent) const +{ + const QModelIndex sourceParent = mapToSource(parent); + return sourceModel()->hasChildren(sourceParent); +} + +bool DolphinSortFilterProxyModel::canFetchMore(const QModelIndex& parent) const +{ + const QModelIndex sourceParent = mapToSource(parent); + return sourceModel()->canFetchMore(sourceParent); +} + DolphinView::Sorting DolphinSortFilterProxyModel::sortingForColumn(int column) { if ((column >= 0) && (column < dolphinMapSize)) { diff --git a/src/dolphinsortfilterproxymodel.h b/src/dolphinsortfilterproxymodel.h index 44b4ce918..2db8ee267 100644 --- a/src/dolphinsortfilterproxymodel.h +++ b/src/dolphinsortfilterproxymodel.h @@ -62,6 +62,12 @@ public: virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); + /** Reimplemented from QAbstractItemModel. Returns true for directories. */ + virtual bool hasChildren(const QModelIndex& parent = QModelIndex()) const; + + /** Reimplemented from QAbstractItemModel. Returns true for empty directories. */ + virtual bool canFetchMore(const QModelIndex& parent) const; + /** * Helper method to get the DolphinView::Sorting type for a given * column \a column. If the column is smaller 0 or greater than the |
