Logo Search packages:      
Sourcecode: d3lphin version File versions  Download package

void Dolphin::paste (  )  [private, slot]

Pastes the clipboard data to the active view.

Definition at line 657 of file dolphin.cpp.

References m_clipboardContainsCutData, DolphinView::selectedURLs(), and DolphinView::url().

{
    QClipboard* clipboard = QApplication::clipboard();
    QMimeSource* data = clipboard->data();
    if (!KURLDrag::canDecode(data)) {
        return;
    }

    clearStatusBar();

    KURL::List sourceURLs;
    KURLDrag::decode(data, sourceURLs);

    // per default the pasting is done into the current URL of the view
    KURL destURL(m_activeView->url());

    // check whether the pasting should be done into a selected directory
    KURL::List selectedURLs = m_activeView->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();
        }
    }


    updateViewProperties(sourceURLs);
    if (m_clipboardContainsCutData) {
        moveURLs(sourceURLs, destURL);
        m_clipboardContainsCutData = false;
        clipboard->clear();
    }
    else {
        copyURLs(sourceURLs, destURL);
    }
}


Generated by  Doxygen 1.6.0   Back to index