]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Provide a 'int selectedItemsCount() const' interface for performance reasons, so...
authorPeter Penz <peter.penz19@gmail.com>
Sat, 26 Jul 2008 13:46:58 +0000 (13:46 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Sat, 26 Jul 2008 13:46:58 +0000 (13:46 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=838037

src/dolphinview.cpp
src/dolphinview.h

index 0b04d0afad8eb1be1cf1612bb75503c9ef34abbb..97bce5aacea6dfffae2cdffc85592ce8cdc90a1e 100644 (file)
@@ -329,6 +329,17 @@ KUrl::List DolphinView::selectedUrls() const
     return urls;
 }
 
     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();
 void DolphinView::setContentsPosition(int x, int y)
 {
     QAbstractItemView* view = itemView();
index 6f4327c52a3970bca1120850c11b304b1923ab9b..e74975f67a492ced15c9f03a3b748bc092ce59da 100644 (file)
@@ -218,6 +218,12 @@ public:
      */
     KUrl::List selectedUrls() const;
 
      */
     KUrl::List selectedUrls() const;
 
+    /**
+     * Returns the number of selected items (this is faster than
+     * invoking selectedItems().count()).
+     */
+    int selectedItemsCount() const;
+
     /**
      * Sets the upper left position of the view content
      * to (x,y). The content of the view might be larger than the visible area
     /**
      * Sets the upper left position of the view content
      * to (x,y). The content of the view might be larger than the visible area