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>
This commit is contained in:
Stig Bjørlykke 2018-01-30 13:17:01 +01:00 committed by Anders Broman
parent 043b45e840
commit 55e74ba841
3 changed files with 16 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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;

View File

@ -62,6 +62,7 @@ public:
NameResolutionChanged,
PacketDissectionChanged,
PreferencesChanged,
ProfileChanging,
RecentCapturesChanged,
RecentPreferencesRead
};