aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2019-04-07 19:11:55 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2019-04-10 02:19:30 +0000
commit4dda4bac178debe04eac081aa23a951e807f6d31 (patch)
treeb867b29c11b44b041c939284d203ff66de9e9a49
parent96fa471542c07cfbdee09db919ab21851a45bfeb (diff)
Qt: use toLocalFile() instead of path() to check for existence.
path() incorrectly gives paths as /C:/Program Files/Wireshark/udpdump.html under windows. The leading slash gives a wrong test on the file. Instead toLocalFile() handles it correctly. isLocalFile() has been used to get if we have a local file or a network URL. The reported bug occurred under Windows only, but the change is compatible with Linux paths as well. Accidentally when the test on the file was successful, nothing got called. The routine has been reworked to open an existing local file. Bug: 15592 Change-Id: Id6e3a91dfb4c9d20ae8cb0735eabab64caeff47f Reviewed-on: https://code.wireshark.org/review/32772 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r--ui/qt/extcap_options_dialog.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/ui/qt/extcap_options_dialog.cpp b/ui/qt/extcap_options_dialog.cpp
index 9a2e602b62..2cd0ae0145 100644
--- a/ui/qt/extcap_options_dialog.cpp
+++ b/ui/qt/extcap_options_dialog.cpp
@@ -402,24 +402,20 @@ void ExtcapOptionsDialog::on_buttonBox_helpRequested()
QUrl help_url(interface_help);
- /* The help is not a local file, open it and exit */
- if (help_url.scheme().compare("file") != 0) {
- QDesktopServices::openUrl(help_url);
- return;
- }
-
- /* 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.
- */
- QFileInfo help_file(help_url.path());
- if ( !help_file.exists() )
- {
- QMessageBox::warning(this, tr("Extcap Help cannot be found"),
+ /* Check the existence for a local file */
+ if (help_url.isLocalFile()) {
+ QFileInfo help_file(help_url.toLocalFile());
+ if (!help_file.exists()) {
+ 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);
+ return;
+ }
}
+ /* We have an actual url or an existing local file. Let's open it. */
+ QDesktopServices::openUrl(help_url);
}
bool ExtcapOptionsDialog::saveOptionToCaptureInfo()