From 5b996654cf13468285d2f7bbab0b79546486ef49 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Mon, 12 Nov 2018 20:12:30 +0800 Subject: [PATCH] DirectoryTree: warn if user does not drop on a folder item --- src/vdirectorytree.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/vdirectorytree.cpp b/src/vdirectorytree.cpp index 3ad3b6f7..23a4eb1c 100644 --- a/src/vdirectorytree.cpp +++ b/src/vdirectorytree.cpp @@ -1245,6 +1245,17 @@ bool VDirectoryTree::dropMimeData(QTreeWidgetItem *p_parent, { Q_UNUSED(p_index); + if (!p_parent) { + VUtils::showMessage(QMessageBox::Warning, + tr("Warning"), + tr("Please drop it on a folder item."), + "", + QMessageBox::Ok, + QMessageBox::Ok, + this); + return false; + } + if (p_data->hasFormat(ClipboardConfig::c_format)) { VDirectory *dir = getVDirectory(p_parent); if (!dir) {