diff libgui/src/qtinfo/webinfo.cc @ 19495:17e6c770e6ac gui-release

check existence of uncompressed or compressed info files for doc viewer * parser.cc (set_info_path): return type changed to bool, checking existence of info file uncompressed and with all known compressed file extensions, returns false if no file was found and true after parsing the found file; * parser.h: return type of set_info_path changed to bool * webinfo.cc (ctor): do not check existence of info file since this is done via set_info_path; (set_info_path): return type changed to bool, load Top-node if parser::set_info_path returns true and return the related return value * webinfo.h: return type of set_info_path changed to bool
author Torsten <ttl@justmail.de>
date Fri, 02 Jan 2015 18:47:29 +0100
parents 834f6e604dc3
children ffc339cea115
line wrap: on
line diff
--- a/libgui/src/qtinfo/webinfo.cc	Thu Jan 01 18:51:50 2015 -0800
+++ b/libgui/src/qtinfo/webinfo.cc	Fri Jan 02 18:47:29 2015 +0100
@@ -96,29 +96,30 @@
 
   resize (500, 300);
 
-  QFileInfo info_file = QFileInfo (QString::fromStdString (Vinfo_file));
-
-  if (info_file.exists ())
-    set_info_path (QString::fromStdString (Vinfo_file));
-  else
+  if (! set_info_path (QString::fromStdString (Vinfo_file)))
     { // Info file does not exist
       _search_check_box->setEnabled (false);
       _search_line_edit->setEnabled (false);
 
       QTextBrowser *msg = addNewTab (tr ("Error"));
-      QString msg_text = QString ("<html><body><br><br><center><b>%1"
-                                      "</b></center></body></html>").
-                         arg (tr ("The info file %1 does not exist").
-                              arg(info_file.absoluteFilePath ()));
+      QString msg_text = QString (
+          "<html><body><br><br><center><b>%1</b></center></body></html>").
+          arg (tr ("The info file<p>%1<p>or compressed versions do not exist").
+          arg(QString::fromStdString (Vinfo_file)));
       msg->setHtml (msg_text);
     }
 }
 
-void
+bool
 webinfo::set_info_path (const QString& info_path)
 {
-  _parser.set_info_path (info_path);
-  load_node ("Top");
+  if (_parser.set_info_path (info_path))
+    {
+      load_node ("Top");
+      return true;
+    }
+  else
+    return false;
 }
 
 void