Make Capture -> Refresh Interfaces work.

Add a "refresh the local interfaces" method to WiresharkApplication,
which reloads the interface list and emits the "interface list changed"
signal, and invoke it from the Capture -> Refresh Interfaces menu item.

Change-Id: I9641e4b341eb44d773c556691d8bb9dac776ea9d
Reviewed-on: https://code.wireshark.org/review/3195
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-07-25 00:44:50 -07:00
parent 35b4487538
commit 9ccf2e04c8
4 changed files with 25 additions and 0 deletions

View File

@ -286,6 +286,7 @@ private slots:
#ifdef HAVE_LIBPCAP
void on_actionCaptureOptions_triggered();
void on_actionCaptureRefreshInterfaces_triggered();
#endif
void matchFieldFilter(FilterAction::Action action, FilterAction::ActionType filter_type);

View File

@ -2390,6 +2390,11 @@ void MainWindow::on_actionCaptureOptions_triggered()
capture_interfaces_dialog_.raise();
capture_interfaces_dialog_.activateWindow();
}
void MainWindow::on_actionCaptureRefreshInterfaces_triggered()
{
wsApp->refreshLocalInterfaces();
}
#endif

View File

@ -706,6 +706,24 @@ void WiresharkApplication::ifChangeEventsAvailable()
#endif
}
void WiresharkApplication::refreshLocalInterfaces()
{
#ifdef HAVE_LIBPCAP
/*
* Reload the local interface list.
*/
scan_local_interfaces(main_window_update);
/*
* Now emit a signal to indicate that the list changed, so that all
* places displaying the list will get updated.
*
* XXX - only if it *did* change.
*/
emit localInterfaceListChanged();
#endif
}
void WiresharkApplication::allSystemsGo()
{
QString display_filter = NULL;

View File

@ -74,6 +74,7 @@ public:
void emitAppSignal(AppSignal signal);
void emitStatCommandSignal(const QString &menu_path, const char *arg, void *userdata);
void allSystemsGo();
void refreshLocalInterfaces();
e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path);
QList<recent_item_status *> recentItems() const;
void addRecentItem(const QString &filename, qint64 size, bool accessible);