forked from osmocom/wireshark
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>
This commit is contained in:
parent
4413d43962
commit
f4724d0b37
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (local_files.size() < 1) {
|
||||
return;
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
|
||||
if (local_files.size() < 1) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
event->accept();
|
||||
|
||||
if (local_files.size() == 1) {
|
||||
openCaptureFile(local_files.at(0));
|
||||
|
|
Loading…
Reference in New Issue