-
- // per default the pasting is done into the current URL of the view
- KUrl destUrl = url();
-
- // check whether the pasting should be done into a selected directory
- const KUrl::List selectedUrls = this->selectedUrls();
- if (selectedUrls.count() == 1) {
- const KFileItem fileItem(S_IFDIR,
- KFileItem::Unknown,
- selectedUrls.first(),
- true);
- if (fileItem.isDir()) {
- // only one item is selected which is a directory, hence paste
- // into this directory
- destUrl = selectedUrls.first();
- if (sourceUrls.contains(destUrl)) {
- const QString text = i18nc("@info", "The folder <filename>%1</filename> is pasted into itself. Is this intended?", fileItem.name());
- int result = KMessageBox::questionYesNo(window(),
- text,
- i18nc("@title:window", "Paste into Folder"),
- KGuiItem(i18nc("@action:button", "Paste"), "dialog-ok"),
- KGuiItem(i18nc("@action:button", "Cancel"), "dialog-cancel"));
- if (result == KMessageBox::No) {
- return;
- }
- }
- }
- }
-