aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2018-01-30 13:17:01 +0100
committerAnders Broman <a.broman58@gmail.com>2018-01-31 04:53:39 +0000
commit55e74ba841126797b2a5b82142fb1db8f61a1288 (patch)
tree7d9a42eb92ab222dd2efb1e505f97766a6c273ba
parent043b45e840bf742bb54749b2f4cec2a722109b79 (diff)
Qt: Write recent before applying profile changes
The selected profile may be renamed in apply_profile_changes() so write the recent file before renaming the directory to ensure that we reload the latest changes. Change-Id: I8988a00647926d93b0a1903090aadc8c61f1a34e Reviewed-on: https://code.wireshark.org/review/25516 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--ui/qt/profile_dialog.cpp14
-rw-r--r--ui/qt/wireshark_application.cpp3
-rw-r--r--ui/qt/wireshark_application.h1
3 files changed, 16 insertions, 2 deletions
diff --git a/ui/qt/profile_dialog.cpp b/ui/qt/profile_dialog.cpp
index 7abb85c2d6..198370021f 100644
--- a/ui/qt/profile_dialog.cpp
+++ b/ui/qt/profile_dialog.cpp
@@ -28,6 +28,7 @@
#include <ui/qt/utils/qt_ui_utils.h>
#include "ui/profile.h"
+#include "ui/recent.h"
#include <ui/qt/utils/variant_pointer.h>
@@ -351,6 +352,15 @@ void ProfileDialog::on_buttonBox_accepted()
item_data_removed = (item == default_item);
}
+ if (write_recent) {
+ /* Get the current geometry, before writing it to disk */
+ wsApp->emitAppSignal(WiresharkApplication::ProfileChanging);
+
+ /* Write recent file for current profile now because
+ * the profile may be renamed in apply_profile_changes() */
+ write_profile_recent();
+ }
+
if ((err_msg = apply_profile_changes()) != NULL) {
QMessageBox::critical(this, tr("Profile Error"),
err_msg,
@@ -366,11 +376,11 @@ void ProfileDialog::on_buttonBox_accepted()
if (profile_exists (profile_name, FALSE) || profile_exists (profile_name, TRUE)) {
// The new profile exists, change.
- wsApp->setConfigurationProfile (profile_name, write_recent);
+ wsApp->setConfigurationProfile (profile_name, FALSE);
} else if (!profile_exists (get_profile_name(), FALSE)) {
// The new profile does not exist, and the previous profile has
// been deleted. Change to the default profile.
- wsApp->setConfigurationProfile (NULL, write_recent);
+ wsApp->setConfigurationProfile (NULL, FALSE);
}
}
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index cfe6a91f7f..e6ad3f4732 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -918,6 +918,9 @@ void WiresharkApplication::emitAppSignal(AppSignal signal)
case PacketDissectionChanged:
emit packetDissectionChanged();
break;
+ case ProfileChanging:
+ emit profileChanging();
+ break;
case RecentCapturesChanged:
emit updateRecentCaptureStatus(NULL, 0, false);
break;
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index 186a676e72..c043edc00c 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -62,6 +62,7 @@ public:
NameResolutionChanged,
PacketDissectionChanged,
PreferencesChanged,
+ ProfileChanging,
RecentCapturesChanged,
RecentPreferencesRead
};