aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2016-12-09 15:01:54 +0100
committerRoland Knall <rknall@gmail.com>2016-12-23 10:27:09 +0000
commit46caff30c8234d011bdde44d051e405971cfa9d9 (patch)
treeecae44e176c7d02518fdedcf09f319c9558c0926 /ui
parentf15b3a0f73568ca928827ee746792478c907845a (diff)
Qt: add local file existence check for extcap help.
The extcap help pages point to local manpages. Check the existence of local file before attempting to open them, and if it fails, give the user an error. Ping-Bug: 13218 Change-Id: I0e0ff1e66e439d3ff8c992dbb42652782c047bb5 Reviewed-on: https://code.wireshark.org/review/19180 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/extcap_options_dialog.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/ui/qt/extcap_options_dialog.cpp b/ui/qt/extcap_options_dialog.cpp
index 2aea0dc490..fceb2bc120 100644
--- a/ui/qt/extcap_options_dialog.cpp
+++ b/ui/qt/extcap_options_dialog.cpp
@@ -316,20 +316,33 @@ void ExtcapOptionsDialog::on_buttonBox_rejected()
void ExtcapOptionsDialog::on_buttonBox_helpRequested()
{
interface_t device;
- gchar * interface_help = NULL;
+ QString interface_help = NULL;
device = g_array_index(global_capture_opts.all_ifaces, interface_t, device_idx);
- interface_help = extcap_get_help_for_ifname(device.name);
+ interface_help = QString(extcap_get_help_for_ifname(device.name));
+ /* The extcap interface didn't provide an help. Let's go with the default */
+ if (interface_help.isEmpty()) {
+ wsApp->helpTopicAction(HELP_EXTCAP_OPTIONS_DIALOG);
+ return;
+ }
- if (interface_help)
- {
- QUrl help_url = QString(interface_help);
+ QUrl help_url(interface_help);
+
+ /* The help is not a local file, open it and exit */
+ if (! help_url.scheme().compare("file"))
QDesktopServices::openUrl(help_url);
- }
- else
+
+ /* The help information is a file url and has been provided as-is by the extcap.
+ Before attempting to open the it, check if it actually exists.
+ */
+ if ( ! QFileInfo::exists(help_url.path()) )
{
- wsApp->helpTopicAction(HELP_EXTCAP_OPTIONS_DIALOG);
+ QMessageBox::warning(this, tr("Extcap Help cannot be found"),
+ QString(tr("The help for the extcap interface %1 cannot be found. Given file: %2"))
+ .arg(device.name).arg(help_url.path()),
+ QMessageBox::Ok);
}
+
}
bool ExtcapOptionsDialog::saveOptionToCaptureInfo()