+void DolphinPart::slotEditMimeType()
+{
+ const KFileItemList items = m_view->selectedItems();
+ if (!items.isEmpty()) {
+ KonqOperations::editMimeType(items.first().mimetype(), m_view);
+ }
+}
+
+void DolphinPart::slotSelectItemsMatchingPattern()
+{
+ openSelectionDialog(i18nc("@title:window", "Select"),
+ i18n("Select all items matching this pattern:"),
+ QItemSelectionModel::Select);
+}
+
+void DolphinPart::slotUnselectItemsMatchingPattern()
+{
+ openSelectionDialog(i18nc("@title:window", "Unselect"),
+ i18n("Unselect all items matching this pattern:"),
+ QItemSelectionModel::Deselect);
+}
+
+void DolphinPart::openSelectionDialog(const QString& title, const QString& text, QItemSelectionModel::SelectionFlags command)
+{
+ 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);
+ }
+}
+
+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);
+ Q_ASSERT(action);
+ action->trigger();
+}
+
+QString DolphinPart::currentViewMode() const
+{
+ return m_actionHandler->currentViewModeActionName();
+}
+
+void DolphinPart::setNameFilter(const QString& nameFilter)
+{
+ // This is the "/home/dfaure/*.diff" kind of name filter (KDirLister::setNameFilter)
+ // which is unrelated to DolphinView::setNameFilter which is substring filtering in a proxy.
+ m_nameFilter = nameFilter;
+ // TODO save/restore name filter in saveState/restoreState like KonqDirPart did in kde3?
+}
+
+void DolphinPart::slotOpenTerminal()
+{
+ QString dir(QDir::homePath());
+
+ KUrl u(url());
+
+ // If the given directory is not local, it can still be the URL of an
+ // ioslave using UDS_LOCAL_PATH which to be converted first.
+ u = KIO::NetAccess::mostLocalUrl(u, widget());
+
+ //If the URL is local after the above conversion, set the directory.
+ if (u.isLocalFile()) {
+ dir = u.toLocalFile();
+ }
+
+ KToolInvocation::invokeTerminal(QString(), dir);
+}
+
+void DolphinPart::updateNewMenu()
+{
+ // As requested by KNewFileMenu :
+ m_newMenu->checkUpToDate();
+ m_newMenu->setViewShowsHiddenFiles(m_view->showHiddenFiles());
+ // And set the files that the menu apply on :
+ m_newMenu->setPopupFiles(url());
+}
+
+void DolphinPart::updateStatusBar()
+{
+ emit ReadOnlyPart::setStatusBarText(m_view->statusBarText());
+}
+
+void DolphinPart::updateProgress(int percent)
+{
+ m_extension->loadingProgress(percent);
+}
+
+void DolphinPart::createDirectory()