aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-05-11 12:46:49 -0700
committerGerald Combs <gerald@wireshark.org>2018-05-14 15:43:32 +0000
commitf4724d0b37c32d17a4e1d2a7e9db138f0ca9ad2f (patch)
treeb072f72a3ec7f1e09e05002484001559184e6d28 /ui
parent4413d43962e1aed72a285ae8fb68780bb64a11fe (diff)
Qt: MainWindow::dropEvent fixes.
Limit our dropped file count to 100. Make sure we always accept our proposed action and either accept or ignore the event. Blind attempt at fixing bug 14609. Change-Id: Id08b179b6eb63529aa15bce7284460fbd19f7fec Ping-Bug: 14609 Reviewed-on: https://code.wireshark.org/review/27462 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/main_window.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 60df683ffc..77a9668f2f 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -989,19 +989,26 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event)
void MainWindow::dropEvent(QDropEvent *event)
{
QList<QByteArray> local_files;
+ int max_dropped_files = 100; // Arbitrary
foreach (QUrl drop_url, event->mimeData()->urls()) {
QString drop_file = drop_url.toLocalFile();
if (!drop_file.isEmpty()) {
local_files << drop_file.toUtf8();
+ if (local_files.size() >= max_dropped_files) {
+ break;
+ }
}
}
+ event->acceptProposedAction();
+
if (local_files.size() < 1) {
+ event->ignore();
return;
}
- event->acceptProposedAction();
+ event->accept();
if (local_files.size() == 1) {
openCaptureFile(local_files.at(0));