┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinpart.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-11-04 17:27:11 +0000
committerPeter Penz <[email protected]>2010-11-04 17:27:11 +0000
commit7e311509a4ac89ebe95f3d81928fe78a9f398aa9 (patch)
tree5a906b0f4df2e2bb37dcd31c80dc97285fba131d /src/dolphinpart.cpp
parentbd7416d0af9d498d0f2b6611fabd16e8e508f094 (diff)
Interface cleanup: The DolphinView should not expose QAbstractItemView-specific things like QItemSelectionModel. Just providing interfaces for KFileItem and KUrl will make it easier in future to change the view-implementations internally to QML-specific itemviews or whatever.
svn path=/trunk/KDE/kdebase/apps/; revision=1193113
Diffstat (limited to 'src/dolphinpart.cpp')
-rw-r--r--src/dolphinpart.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 0691791a5..3d0748f84 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -480,49 +480,27 @@ void DolphinPart::slotSelectItemsMatchingPattern()
{
openSelectionDialog(i18nc("@title:window", "Select"),
i18n("Select all items matching this pattern:"),
- QItemSelectionModel::Select);
+ true);
}
void DolphinPart::slotUnselectItemsMatchingPattern()
{
openSelectionDialog(i18nc("@title:window", "Unselect"),
i18n("Unselect all items matching this pattern:"),
- QItemSelectionModel::Deselect);
+ false);
}
-void DolphinPart::openSelectionDialog(const QString& title, const QString& text, QItemSelectionModel::SelectionFlags command)
+void DolphinPart::openSelectionDialog(const QString& title, const QString& text, bool selectItems)
{
bool okClicked;
QString pattern = KInputDialog::getText(title, text, "*", &okClicked, m_view);
if (okClicked && !pattern.isEmpty()) {
QRegExp patternRegExp(pattern, Qt::CaseSensitive, QRegExp::Wildcard);
- QItemSelection matchingIndexes = childrenMatchingPattern(QModelIndex(), patternRegExp);
- m_view->selectionModel()->select(matchingIndexes, command);
+ m_view->setItemSelectionEnabled(patternRegExp, selectItems);
}
}
-QItemSelection DolphinPart::childrenMatchingPattern(const QModelIndex& parent, const QRegExp& patternRegExp)
-{
- QItemSelection matchingIndexes;
- int numRows = m_proxyModel->rowCount(parent);
-
- for (int row = 0; row < numRows; row++) {
- QModelIndex index = m_proxyModel->index(row, 0, parent);
- QModelIndex sourceIndex = m_proxyModel->mapToSource(index);
-
- if (sourceIndex.isValid() && patternRegExp.exactMatch(m_dolphinModel->data(sourceIndex).toString())) {
- matchingIndexes += QItemSelectionRange(index);
- }
-
- if (m_proxyModel->hasChildren(index)) {
- matchingIndexes += childrenMatchingPattern(index, patternRegExp);
- }
- }
-
- return matchingIndexes;
-}
-
void DolphinPart::setCurrentViewMode(const QString& viewModeName)
{
QAction* action = actionCollection()->action(viewModeName);
@@ -669,7 +647,7 @@ KFileItemList DolphinPartFileInfoExtension::queryFor(KParts::FileInfoExtension::
return part()->view()->selectedItems();
break;
case KParts::FileInfoExtension::AllItems:
- return part()->view()->allItems();
+ return part()->view()->items();
default:
break;
}