From d337ece6df43337eff338758ace5204937a000b7 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 26 Jul 2008 13:46:58 +0000 Subject: Provide a 'int selectedItemsCount() const' interface for performance reasons, so that code which just needs to know whether items have been selected does not need to invoke selectedItems().count(), which is quite expensive. svn path=/trunk/KDE/kdebase/apps/; revision=838037 --- src/dolphinview.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/dolphinview.cpp') diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 0b04d0afa..97bce5aac 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -329,6 +329,17 @@ KUrl::List DolphinView::selectedUrls() const return urls; } +int DolphinView::selectedItemsCount() const +{ + if (isColumnViewActive()) { + // TODO: get rid of this special case by adjusting the dir lister + // to the current column + return m_columnView->selectedItems().count(); + } + + return itemView()->selectionModel()->selection().count(); +} + void DolphinView::setContentsPosition(int x, int y) { QAbstractItemView* view = itemView(); -- cgit v1.3