void ScanGallery::slotUrlsDropped(QDropEvent *ev, FileTreeViewItem *item) { KUrl::List urls = ev->mimeData()->urls(); if (urls.isEmpty()) return; kDebug() << "onto" << (item==NULL ? "NULL" : item->url().prettyUrl()) << "srcs" << urls.count() << "first" << urls.first(); if (item==NULL) return; KUrl dest = item->url(); // Check whether the drop is on top of a directory (in which case we // want to move/copy into it) or a file (move/copy into its containing // directory). if (!item->isDir()) dest.setFileName(QString::null); dest.adjustPath(KUrl::AddTrailingSlash); kDebug() << "resolved destination" << dest; // Make the last URL to copy the one to select next KUrl nextSel = dest; nextSel.addPath(urls.back().fileName(KUrl::ObeyTrailingSlash)); m_nextUrlToShow = nextSel; KIO::Job *job; // TODO: top level window as 3rd parameter? if (ev->dropAction()==Qt::MoveAction) job = KIO::move(urls, dest); else job = KIO::copy(urls, dest); connect(job, SIGNAL(result(KJob *)), SLOT(slotJobResult(KJob *))); }