Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
19489:17f5db3a9149 | 19495:17e6c770e6ac |
---|---|
94 connect (_zoom_out_button, SIGNAL (clicked ()), this, SLOT (zoom_out ())); | 94 connect (_zoom_out_button, SIGNAL (clicked ()), this, SLOT (zoom_out ())); |
95 connect (_search_line_edit, SIGNAL (returnPressed ()), this, SLOT (search ())); | 95 connect (_search_line_edit, SIGNAL (returnPressed ()), this, SLOT (search ())); |
96 | 96 |
97 resize (500, 300); | 97 resize (500, 300); |
98 | 98 |
99 QFileInfo info_file = QFileInfo (QString::fromStdString (Vinfo_file)); | 99 if (! set_info_path (QString::fromStdString (Vinfo_file))) |
100 | |
101 if (info_file.exists ()) | |
102 set_info_path (QString::fromStdString (Vinfo_file)); | |
103 else | |
104 { // Info file does not exist | 100 { // Info file does not exist |
105 _search_check_box->setEnabled (false); | 101 _search_check_box->setEnabled (false); |
106 _search_line_edit->setEnabled (false); | 102 _search_line_edit->setEnabled (false); |
107 | 103 |
108 QTextBrowser *msg = addNewTab (tr ("Error")); | 104 QTextBrowser *msg = addNewTab (tr ("Error")); |
109 QString msg_text = QString ("<html><body><br><br><center><b>%1" | 105 QString msg_text = QString ( |
110 "</b></center></body></html>"). | 106 "<html><body><br><br><center><b>%1</b></center></body></html>"). |
111 arg (tr ("The info file %1 does not exist"). | 107 arg (tr ("The info file<p>%1<p>or compressed versions do not exist"). |
112 arg(info_file.absoluteFilePath ())); | 108 arg(QString::fromStdString (Vinfo_file))); |
113 msg->setHtml (msg_text); | 109 msg->setHtml (msg_text); |
114 } | 110 } |
115 } | 111 } |
116 | 112 |
117 void | 113 bool |
118 webinfo::set_info_path (const QString& info_path) | 114 webinfo::set_info_path (const QString& info_path) |
119 { | 115 { |
120 _parser.set_info_path (info_path); | 116 if (_parser.set_info_path (info_path)) |
121 load_node ("Top"); | 117 { |
118 load_node ("Top"); | |
119 return true; | |
120 } | |
121 else | |
122 return false; | |
122 } | 123 } |
123 | 124 |
124 void | 125 void |
125 webinfo::load_node (const QString& node_name) | 126 webinfo::load_node (const QString& node_name) |
126 { | 127 { |