aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-08-12 12:43:38 +0200
committerRoland Knall <rknall@gmail.com>2019-08-12 13:57:29 +0000
commitd6a34592e15c542cbf9809fff9341d13c61d0c30 (patch)
treed05d8a21870d81cc627ae4db2d53481ab5a593c6 /ui
parent40b19131c26bdcff06af8085c14ea4433b011894 (diff)
Qt: Fix drop event for main window
Make sure, that the main window only recognizes drop events containing text/uri-list mime-types, as those are the only ones containing file drops. All other mime-types (e.g. display filter drops) will be ignored Bug: 15986 Change-Id: Id4338f75c563d2d177d858d2de470db1ab3499f7 Reviewed-on: https://code.wireshark.org/review/34248 Petri-Dish: Roland Knall <rknall@gmail.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/main_window.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 10c0c569ad..59d95172e7 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -953,6 +953,12 @@ void MainWindow::closeEvent(QCloseEvent *event) {
// order to set DROPDESCRIPTION.
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
+ if (!event->mimeData()->hasUrls())
+ {
+ event->ignore();
+ return;
+ }
+
if (!main_ui_->actionFileOpen->isEnabled()) {
// We could alternatively call setAcceptDrops(!capture_in_progress)
// in setMenusForCaptureInProgress but that wouldn't provide feedback.
@@ -978,6 +984,12 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
void MainWindow::dropEvent(QDropEvent *event)
{
+ if (!event->mimeData()->hasUrls())
+ {
+ event->ignore();
+ return;
+ }
+
QList<QByteArray> local_files;
int max_dropped_files = 100; // Arbitrary