diff options
| author | Frank Reininghaus <[email protected]> | 2014-06-12 08:37:11 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2014-06-12 08:37:11 +0200 |
| commit | 9dc1513f8bae968a363ea74af90a4042382d3d20 (patch) | |
| tree | cc7d8b4b1f82a506d2c47cd4fbf21af60a428346 /src/panels | |
| parent | 3b119c4ff95876534783c53be3e72af0b6744100 (diff) | |
Do not crash if QApplication::clipboard()->mimeData() is a null pointer
This removes the remaining unchecked accesses to the clipboard mime
data after commit 7828b057da0491f1b08bfaec681067e195d7b6ca. According
to a bug report, it can be a null pointer on Wayland.
BUG: 335053
REVIEW: 118649
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/folders/treeviewcontextmenu.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index fa8844dfa..83ffa87a7 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -62,11 +62,10 @@ void TreeViewContextMenu::open() QAction* copyAction = new QAction(KIcon("edit-copy"), i18nc("@action:inmenu", "Copy"), this); connect(copyAction, SIGNAL(triggered()), this, SLOT(copy())); - QAction* pasteAction = new QAction(KIcon("edit-paste"), i18nc("@action:inmenu", "Paste"), this); - const QMimeData* mimeData = QApplication::clipboard()->mimeData(); - const KUrl::List pasteData = KUrl::List::fromMimeData(mimeData); + const QPair<bool, QString> pasteInfo = KonqOperations::pasteInfo(m_fileItem.url()); + QAction* pasteAction = new QAction(KIcon("edit-paste"), pasteInfo.second, this); connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste())); - pasteAction->setEnabled(!pasteData.isEmpty() && capabilities.supportsWriting()); + pasteAction->setEnabled(pasteInfo.first); popup->addAction(cutAction); popup->addAction(copyAction); @@ -172,17 +171,7 @@ void TreeViewContextMenu::copy() void TreeViewContextMenu::paste() { - QClipboard* clipboard = QApplication::clipboard(); - const QMimeData* mimeData = clipboard->mimeData(); - - const KUrl::List source = KUrl::List::fromMimeData(mimeData); - const KUrl& dest = m_fileItem.url(); - if (KonqMimeData::decodeIsCutSelection(mimeData)) { - KonqOperations::copy(m_parent, KonqOperations::MOVE, source, dest); - clipboard->clear(); - } else { - KonqOperations::copy(m_parent, KonqOperations::COPY, source, dest); - } + KonqOperations::doPaste(m_parent, m_fileItem.url()); } void TreeViewContextMenu::rename() |
