+
+ if (m_selectClipboardItems) {
+ m_selectClipboardItems = false;
+
+ // select all items that have been pasted from the clipboard to
+ // the current directory
+ const QMimeData* mimeData = QApplication::clipboard()->mimeData();
+ const KUrl::List copiedUrls = KUrl::List::fromMimeData(mimeData);
+
+ QSet<QString> fileNames;
+ foreach (const KUrl& url, copiedUrls) {
+ fileNames.insert(url.fileName());
+ }
+
+ QItemSelectionModel* selectionModel = itemView()->selectionModel();
+ const int rowCount = m_proxyModel->rowCount();
+ for (int row = 0; row < rowCount; ++row) {
+ const QModelIndex proxyIndex = m_proxyModel->index(row, 0);
+ const QModelIndex dirIndex = m_proxyModel->mapToSource(proxyIndex);
+ const KUrl url = m_dolphinModel->itemForIndex(dirIndex).url();
+ if (fileNames.contains(url.fileName())) {
+ selectionModel->select(proxyIndex, QItemSelectionModel::Select);
+ }
+ }
+ }