]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincolumnview.cpp
Hide unused and not drawn columns on the details view
[dolphin.git] / src / dolphincolumnview.cpp
index 979ff7649fe746b665387d6cbc53c795350117d0..a85e0198a6ebe17e6e47a28c07d9ab8d1ad2face 100644 (file)
@@ -503,6 +503,23 @@ void DolphinColumnView::reload()
     dirLister->openUrl(rootUrl, false, true);
 }
 
+void DolphinColumnView::invertSelection()
+{
+    // TODO: this approach of inverting the selection is quite slow. It should
+    // be possible to speedup the implementation by using QItemSelection, but
+    // all adempts have failed yet...
+
+    ColumnWidget* column = activeColumn();
+    QItemSelectionModel* selModel = column->selectionModel();
+
+    KDirLister* dirLister = m_dolphinModel->dirLister();
+    const KFileItemList list = dirLister->itemsForDir(column->url());
+    foreach (KFileItem* item, list) {
+        const QModelIndex index = m_dolphinModel->indexForUrl(item->url());
+        selModel->select(m_proxyModel->mapFromSource(index), QItemSelectionModel::Toggle);
+    }
+}
+
 void DolphinColumnView::showColumn(const KUrl& url)
 {
     const KUrl& rootUrl = m_columns[0]->url();
@@ -618,7 +635,14 @@ void DolphinColumnView::showColumn(const KUrl& url)
     m_index = columnIndex;
     activeColumn()->setActive(true);
 
-    expandToActiveUrl();
+    connect(dirLister, SIGNAL(completed()),
+            this, SLOT(expandToActiveUrl()));
+    dirLister->openUrl(rootUrl, false, true);
+}
+
+void DolphinColumnView::selectAll()
+{
+    activeColumn()->selectAll();
 }
 
 bool DolphinColumnView::isIndexHidden(const QModelIndex& index) const
@@ -756,6 +780,9 @@ void DolphinColumnView::updateDecorationSize()
 
 void DolphinColumnView::expandToActiveUrl()
 {
+    disconnect(m_dolphinModel->dirLister(), SIGNAL(completed()),
+               this, SLOT(expandToActiveUrl()));
+
     const int lastIndex = m_columns.count() - 1;
     Q_ASSERT(lastIndex >= 0);
     const KUrl& activeUrl = m_columns[lastIndex]->url();
@@ -781,9 +808,6 @@ void DolphinColumnView::reloadColumns()
     for (int i = 0; i <= end; ++i) {
         ColumnWidget* nextColumn = m_columns[i + 1];
 
-        KDirLister* dirLister = m_dolphinModel->dirLister();
-        dirLister->updateDirectory(nextColumn->url());
-
         const QModelIndex rootIndex = nextColumn->rootIndex();
         if (rootIndex.isValid()) {
             nextColumn->show();