┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2006-12-14 19:54:59 +0000
committerPeter Penz <[email protected]>2006-12-14 19:54:59 +0000
commit418cfc1d7420eec3b8624b03e1e8250ba31dc08b (patch)
tree39de55725f2b941f299e928a0cd7ef8090a38119 /src
parent70782d6bb4d3b02c4c48c38ee2867561a706ed84 (diff)
Support 'select all' and 'invert selection' again.
svn path=/trunk/playground/utils/dolphin/; revision=613698
Diffstat (limited to 'src')
-rw-r--r--src/dolphinview.cpp52
-rw-r--r--src/dolphinview.h12
2 files changed, 21 insertions, 43 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 2f287f353..1dba37ad5 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -302,12 +302,12 @@ void DolphinView::renameSelectedItems()
void DolphinView::selectAll()
{
- //fileView()->selectAll();
+ selectAll(QItemSelectionModel::Select);
}
void DolphinView::invertSelection()
{
- //fileView()->invertSelection();
+ selectAll(QItemSelectionModel::Toggle);
}
DolphinStatusBar* DolphinView::statusBar() const
@@ -814,23 +814,6 @@ void DolphinView::slotContentsMoving(int x, int y)
}
}
-/*KFileView* DolphinView::fileView() const
-{
- return (m_mode == DetailsView) ? static_cast<KFileView*>(m_iconsView) :
- static_cast<KFileView*>(m_iconsView);
-}*/
-
-Q3ScrollView* DolphinView::scrollView() const
-{
- return 0; //(m_mode == DetailsView) ? static_cast<Q3ScrollView*>(m_iconsView) :
- // static_cast<Q3ScrollView*>(m_iconsView);
-}
-
-ItemEffectsManager* DolphinView::itemEffectsManager() const
-{
- return 0;
-}
-
void DolphinView::startDirLister(const KUrl& url, bool reload)
{
if (!url.isValid()) {
@@ -997,19 +980,6 @@ void DolphinView::slotChangeNameFilter(const QString& nameFilter)
m_dirLister->setNameFilter(adjustedFilter);
m_dirLister->emitChanges();
-
- // TODO: this is a workaround for QIconView: the item position
- // stay as they are by filtering, only an inserting of an item
- // results to an automatic adjusting of the item position. In Qt4/KDE4
- // this workaround should get obsolete due to Interview.
- /*KFileView* view = fileView();
- if (view == m_iconsView) {
- KFileItem* first = view->firstFileItem();
- if (first != 0) {
- view->removeItem(first);
- view->insertItem(first);
- }
- }*/
}
void DolphinView::applyModeToView()
@@ -1028,11 +998,6 @@ void DolphinView::applyModeToView()
m_iconsView->setViewMode(QListView::ListMode);
m_iconsView->setGridSize(QSize(256, 24));
break;
-
- //case PreviewsView:
- // m_iconsView->setViewMode(QListView::IconMode);
- // m_iconsView->setGridSize(QSize(128, 128));
- // break;
}
}
@@ -1048,4 +1013,17 @@ int DolphinView::columnIndex(Sorting sorting) const
return index;
}
+void DolphinView::selectAll(QItemSelectionModel::SelectionFlags flags)
+{
+ QItemSelectionModel* selectionModel = m_iconsView->selectionModel();
+ const QAbstractItemModel* itemModel = selectionModel->model();
+
+ const QModelIndex topLeft = itemModel->index(0, 0);
+ const QModelIndex bottomRight = itemModel->index(itemModel->rowCount() - 1,
+ itemModel->columnCount() - 1);
+
+ QItemSelection selection(topLeft, bottomRight);
+ selectionModel->select(selection, flags);
+}
+
#include "dolphinview.moc"
diff --git a/src/dolphinview.h b/src/dolphinview.h
index e5af61f3f..6aa5967f6 100644
--- a/src/dolphinview.h
+++ b/src/dolphinview.h
@@ -45,16 +45,13 @@ class QTimer;
class Q3IconViewItem;
class Q3ListViewItem;
class Q3VBoxLayout;
-//class KFileView;
class DolphinMainWindow;
class DolphinDirLister;
class DolphinStatusBar;
class DolphinIconsView;
class DolphinDetailsView;
class ViewProperties;
-class Q3ScrollView;
class KProgress;
-class ItemEffectsManager;
class FilterBar;
class QModelIndex;
@@ -413,9 +410,6 @@ private slots:
void slotChangeNameFilter(const QString& nameFilter);
private:
- //KFileView* fileView() const;
- Q3ScrollView* scrollView() const;
- ItemEffectsManager* itemEffectsManager() const;
void startDirLister(const KUrl& url, bool reload = false);
/**
@@ -447,6 +441,12 @@ private:
*/
int columnIndex(Sorting sorting) const;
+ /**
+ * Selects all items by using the selection flags \a flags. This is a helper
+ * method for the slots DolphinView::selectAll() and DolphinView::invertSelection().
+ */
+ void selectAll(QItemSelectionModel::SelectionFlags flags);
+
private:
bool m_refreshing;
bool m_showProgress;