Have UatFrame send out proper notifications.
authorMichael Mann <mmann78@netscape.net>
Fri, 21 Jul 2017 23:12:52 +0000 (19:12 -0400)
committerMichael Mann <mmann78@netscape.net>
Sat, 22 Jul 2017 12:16:04 +0000 (12:16 +0000)
UatFrame was originally written for filter expressions, so it still
had some "filter expression specific" functionality in it.
Move the "filter expression notifications" to the preferences dialog
and add support for proper notification if UAT affects fields or
dissection (like expert info UAT).

Change-Id: I84cd0c7923450692916bbc6c2cdce93a9830d722
Reviewed-on: https://code.wireshark.org/review/22758
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
ui/qt/preferences_dialog.cpp
ui/qt/uat_frame.cpp
ui/qt/uat_frame.h

index 590dc251b97ded103e886eeac2a77345b5b1beb0..725f9d58dde55a15a56f8e30ec45e0734316ceff 100644 (file)
@@ -917,6 +917,11 @@ void PreferencesDialog::on_buttonBox_accepted()
     pd_ui_->filterExpressonsFrame->acceptChanges();
     pd_ui_->expertFrame->acceptChanges();
 
+    //Filter expressions don't affect dissection, so there is no need to
+    //send any events to that effect.  However, the app needs to know
+    //about any button changes.
+    wsApp->emitAppSignal(WiresharkApplication::FilterExpressionsChanged);
+
     prefs_main_write();
     if (save_decode_as_entries(&err) < 0)
     {
index afaf6a4859a11e812a5259ace4959f55020ae551..ca330082fd9566fdfece1e6a759179984fb1c9bf 100644 (file)
@@ -114,6 +114,20 @@ void UatFrame::setUat(epan_uat *uat)
     setWindowTitle(title);
 }
 
+void UatFrame::applyChanges()
+{
+    if (!uat_) return;
+
+    if (uat_->flags & UAT_AFFECTS_FIELDS) {
+        /* Recreate list with new fields and redissect packets */
+        wsApp->queueAppSignal(WiresharkApplication::FieldsChanged);
+    }
+    if (uat_->flags & UAT_AFFECTS_DISSECTION) {
+        /* Just redissect packets if we have any */
+        wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged);
+    }
+}
+
 void UatFrame::acceptChanges()
 {
     if (!uat_) return;
@@ -130,10 +144,7 @@ void UatFrame::acceptChanges()
             uat_->post_update_cb();
         }
 
-        //Filter expressions don't affect dissection, so there is no need to
-        //send any events to that effect.  However, the app needs to know
-        //about any button changes.
-        wsApp->emitAppSignal(WiresharkApplication::FilterExpressionsChanged);
+        applyChanges();
     }
 }
 
index 85acb55105f93d7af0b29748e65ae867a627096a..2d056ef20b3b2f322256642621b9834dce948c08 100644 (file)
@@ -55,6 +55,7 @@ private:
     void checkForErrorHint(const QModelIndex &current, const QModelIndex &previous);
     bool trySetErrorHintFromField(const QModelIndex &index);
     void addRecord(bool copy_from_current = false);
+    void applyChanges();
 
 private slots:
     void modelDataChanged(const QModelIndex &topLeft);