aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/gtk/drag_and_drop.c4
-rw-r--r--ui/qt/main_window.cpp19
2 files changed, 18 insertions, 5 deletions
diff --git a/ui/gtk/drag_and_drop.c b/ui/gtk/drag_and_drop.c
index 84479d0908..dcd5306b0a 100644
--- a/ui/gtk/drag_and_drop.c
+++ b/ui/gtk/drag_and_drop.c
@@ -251,7 +251,7 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin
if((global_capture_session.state != CAPTURE_STOPPED)) {
simple_dialog(ESD_TYPE_CONFIRMATION,
ESD_BTN_OK,
- "%sDrag and Drop currently not possible!%s\n\n"
+ "%sDrag and Drop currently not possible.%s\n\n"
"Dropping a file isn't possible while a capture is in progress.",
simple_dialog_primary_start(), simple_dialog_primary_end());
return;
@@ -262,7 +262,7 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin
if(cfile.state == FILE_READ_IN_PROGRESS) {
simple_dialog(ESD_TYPE_CONFIRMATION,
ESD_BTN_OK,
- "%sDrag and Drop currently not possible!%s\n\n"
+ "%sDrag and Drop currently not possible.%s\n\n"
"Dropping a file isn't possible while loading another capture file.",
simple_dialog_primary_start(), simple_dialog_primary_end());
return;
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index ab1dbf4bc6..b13e89480d 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -873,14 +873,27 @@ void MainWindow::closeEvent(QCloseEvent *event) {
// order to set DROPDESCRIPTION.
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
- bool accept = false;
+ if (!main_ui_->actionFileOpen->isEnabled()) {
+ // We could alternatively call setAcceptDrops(!capture_in_progress)
+ // in setMenusForCaptureInProgress but that wouldn't provide feedback.
+
+ main_ui_->statusBar->pushTemporaryStatus(tr("Unable to drop files during capture."));
+ event->setDropAction(Qt::IgnoreAction);
+ event->ignore();
+ return;
+ }
+
+ bool have_files = false;
foreach (QUrl drag_url, event->mimeData()->urls()) {
if (!drag_url.toLocalFile().isEmpty()) {
- accept = true;
+ have_files = true;
break;
}
}
- if (accept) event->acceptProposedAction();
+
+ if (have_files) {
+ event->acceptProposedAction();
+ }
}
void MainWindow::dropEvent(QDropEvent *event)