summaryrefslogtreecommitdiffhomepage
path: root/api/plugin-api.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-02-26 14:25:43 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-02-26 14:26:14 +0100
commit19ef27d7f3d3b4df0e4c45a4e88d1a63186ffb76 (patch)
tree9ee0346f9b737a5fabdefeda19aef208e31fdb91 /api/plugin-api.cpp
parent4dd645f1d8eee72b02c86346969edbb6452ac42b (diff)
{api/base,gui/options}-dialog: prevent closing without signal
Use hide() to avoid emitting idempotent events. There's isVisible() but no isClosed() or equivalent. Worse yet, close() can return true twice in a row, despite what docs for `bool QWidget::close()' say.
Diffstat (limited to 'api/plugin-api.cpp')
-rw-r--r--api/plugin-api.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp
index 1bf56200..100902eb 100644
--- a/api/plugin-api.cpp
+++ b/api/plugin-api.cpp
@@ -11,7 +11,13 @@ ITracker::~ITracker() {}
ITrackerDialog::~ITrackerDialog() {}
plugin_api::detail::BaseDialog::BaseDialog() {}
-void plugin_api::detail::BaseDialog::closeEvent(QCloseEvent*) { emit closing(); }
+
+void plugin_api::detail::BaseDialog::closeEvent(QCloseEvent*)
+{
+ if (isVisible())
+ emit closing();
+}
+
Metadata::Metadata() {}
IFilter::IFilter() {}
IFilterDialog::IFilterDialog() {}
@@ -19,3 +25,5 @@ IProtocol::IProtocol() {}
IProtocolDialog::IProtocolDialog() {}
ITracker::ITracker() {}
ITrackerDialog::ITrackerDialog() {}
+
+void plugin_api::detail::BaseDialog::done(int) { close(); hide(); }