示例#1
0
KonqOperations *KonqOperations::doPasteV2(QWidget *parent, const KUrl &destUrl, const QPoint &pos)
{
    QClipboard *clipboard = QApplication::clipboard();
    const QMimeData *data = clipboard->mimeData();
    const bool move = KonqMimeData::decodeIsCutSelection(data);

    KIO::Job *job = KIO::pasteClipboard(destUrl, parent, move);
    if (job) {
        KonqOperations *op = new KonqOperations(parent);
        KIOPasteInfo *pi = new KIOPasteInfo;
        pi->mousePos = pos;
        op->setPasteInfo(pi);
        KIO::CopyJob *copyJob = qobject_cast<KIO::CopyJob*>(job);
        if (copyJob) {
            op->setOperation(job, move ? MOVE : COPY, copyJob->destUrl());
            KIO::FileUndoManager::self()->recordJob(move ? KIO::FileUndoManager::Move : KIO::FileUndoManager::Copy, KUrl::List(), destUrl, job);
            connect(copyJob, SIGNAL(copyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool)),
                    op, SLOT(slotCopyingDone(KIO::Job*,KUrl,KUrl)));
            connect(copyJob, SIGNAL(copyingLinkDone(KIO::Job*,KUrl,QString,KUrl)),
                    op, SLOT(slotCopyingLinkDone(KIO::Job*,KUrl,QString,KUrl)));
        } else if (KIO::SimpleJob *simpleJob = qobject_cast<KIO::SimpleJob*>(job)) {
            op->setOperation(job, PUT, simpleJob->url());
            KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Put, KUrl::List(), simpleJob->url(), job);
        }
        return op;
    }

    return 0;
}
示例#2
0
void Importer::slotCopyDone(KJob* _job)
{
    KIO::CopyJob* job = static_cast<KIO::CopyJob*>(_job);
    KUrl url = job->destUrl();
    if (job->error()) {
        kWarning() << "FIXME: What do we do with failed urls?";
        advance();
        d->importNext();
        return;
    }

    d->renameImportedUrl(url);
}