Rev 1100 | Rev 1105 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
564 | cbradney | 1 | /*************************************************************************** |
2 | * Copyright (C) 2004 by Craig Bradney * |
||
3 | * cbradney@zip.com.au * |
||
4 | * * |
||
5 | * This program is free software; you can redistribute it and/or modify * |
||
6 | * it under the terms of the GNU General Public License as published by * |
||
7 | * the Free Software Foundation; either version 2 of the License, or * |
||
8 | * (at your option) any later version. * |
||
9 | * * |
||
10 | * This program is distributed in the hope that it will be useful, * |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
13 | * GNU General Public License for more details. * |
||
14 | * * |
||
15 | * You should have received a copy of the GNU General Public License * |
||
16 | * along with this program; if not, write to the * |
||
17 | * Free Software Foundation, Inc., * |
||
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
19 | ***************************************************************************/ |
||
560 | cbradney | 20 | |
3 | paul | 21 | #include "helpbrowser.h" |
22 | #include "helpbrowser.moc" |
||
560 | cbradney | 23 | |
3 | paul | 24 | #include <qvariant.h> |
560 | cbradney | 25 | #include <qpushbutton.h> |
26 | #include <qtabwidget.h> |
||
27 | #include <qwidget.h> |
||
28 | #include <qheader.h> |
||
29 | #include <qlistview.h> |
||
30 | #include <qtextbrowser.h> |
||
31 | #include <qlayout.h> |
||
3 | paul | 32 | #include <qtooltip.h> |
560 | cbradney | 33 | #include <qtoolbutton.h> |
34 | #include <qwhatsthis.h> |
||
3 | paul | 35 | #include <qimage.h> |
36 | #include <qpixmap.h> |
||
560 | cbradney | 37 | #include <qpopupmenu.h> |
38 | #include <qfileinfo.h> |
||
3 | paul | 39 | #include <qtextcodec.h> |
560 | cbradney | 40 | #include <qdom.h> |
1033 | cbradney | 41 | #include <qdir.h> |
786 | cbradney | 42 | #include <qsplitter.h> |
128 | Franz | 43 | |
617 | cbradney | 44 | #ifdef _MSC_VER |
1033 | cbradney | 45 | #if (_MSC_VER >= 1200) |
46 | #include "win-config.h" |
||
47 | #endif |
||
128 | Franz | 48 | #else |
1033 | cbradney | 49 | #include "config.h" |
128 | Franz | 50 | #endif |
51 | |||
3 | paul | 52 | extern QPixmap loadIcon(QString nam); |
53 | |||
560 | cbradney | 54 | |
564 | cbradney | 55 | HelpBrowser::HelpBrowser( QWidget* parent, QString caption, QString guiLanguage, QString jumpToSection, QString jumpToFile) |
56 | : QWidget( parent, "Help", WType_TopLevel | WDestructiveClose ) |
||
3 | paul | 57 | { |
560 | cbradney | 58 | QString fileName; |
564 | cbradney | 59 | mHistory.clear(); |
60 | struct histd his; |
||
1092 | cbradney | 61 | language = guiLanguage=="" ? "en" : guiLanguage.left(2); |
564 | cbradney | 62 | helpBrowsermainLayout = new QVBoxLayout( this); |
63 | buttonLayout = new QHBoxLayout; |
||
64 | buttonLayout->setSpacing( 6 ); |
||
65 | buttonLayout->setMargin( 2 ); |
||
3 | paul | 66 | |
564 | cbradney | 67 | homeButton = new QToolButton( this, "homeButton" ); |
68 | homeButton->setText( "" ); |
||
69 | homeButton->setPixmap(loadIcon("gohome.png")); |
||
786 | cbradney | 70 | homeButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed, homeButton->sizePolicy().hasHeightForWidth() ) ); |
564 | cbradney | 71 | buttonLayout->addWidget( homeButton ); |
3 | paul | 72 | |
564 | cbradney | 73 | histMenu = new QPopupMenu( this ); |
74 | backButton = new QToolButton( this, "backButton" ); |
||
75 | backButton->setPixmap(loadIcon("back.png")); |
||
786 | cbradney | 76 | backButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed, backButton->sizePolicy().hasHeightForWidth() ) ); |
564 | cbradney | 77 | backButton->setPopup(histMenu); |
78 | backButton->setPopupDelay(0); |
||
79 | buttonLayout->addWidget( backButton ); |
||
3 | paul | 80 | |
564 | cbradney | 81 | forwButton = new QToolButton( this, "forwButton" ); |
82 | forwButton->setPixmap(loadIcon("forward.png")); |
||
786 | cbradney | 83 | forwButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed, forwButton->sizePolicy().hasHeightForWidth() ) ); |
564 | cbradney | 84 | buttonLayout->addWidget( forwButton ); |
85 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
||
86 | buttonLayout->addItem( spacer ); |
||
560 | cbradney | 87 | helpBrowsermainLayout->addLayout( buttonLayout ); |
88 | |||
564 | cbradney | 89 | helpBrowserLayout = new QHBoxLayout; |
786 | cbradney | 90 | splitter = new QSplitter(this, "splitter"); |
91 | splitter->setChildrenCollapsible( false ); |
||
92 | helpBrowserLayout->addWidget( splitter ); |
||
560 | cbradney | 93 | |
786 | cbradney | 94 | tabWidget = new QTabWidget( splitter, "tabWidget" ); |
95 | //tabWidget = new QTabWidget( this, "tabWidget" ); |
||
96 | splitter->setResizeMode(tabWidget, QSplitter::Stretch ); |
||
97 | tabWidget->setSizePolicy( QSizePolicy( QSizePolicy::Maximum, QSizePolicy::Expanding, false) ); |
||
564 | cbradney | 98 | tabContents = new QWidget( tabWidget, "tabContents" ); |
99 | tabLayout = new QHBoxLayout( tabContents, 11, 6, "tabLayout"); |
||
560 | cbradney | 100 | |
564 | cbradney | 101 | listView = new QListView( tabContents, "listView" ); |
102 | listView->addColumn( tr( "Contents" ) ); |
||
1097 | cbradney | 103 | listView->addColumn( tr( "Link" ) , 0 ); |
104 | // listView->addColumn( tr( "Link" ) ); |
||
105 | listView->setColumnWidthMode( 0, QListView::Maximum ); |
||
106 | listView->setColumnWidthMode( 1, QListView::Manual ); |
||
560 | cbradney | 107 | listView->setSorting(-1,-1); |
108 | listView->setRootIsDecorated( true ); |
||
109 | listView->setSelectionMode(QListView::Single); |
||
110 | listView->setDefaultRenameAction(QListView::Reject); |
||
111 | listView->clear(); |
||
564 | cbradney | 112 | tabLayout->addWidget( listView ); |
113 | |||
114 | tabWidget->insertTab( tabContents, QString("Contents") ); |
||
786 | cbradney | 115 | //helpBrowserLayout->addWidget( tabWidget ); |
560 | cbradney | 116 | |
786 | cbradney | 117 | textBrowser = new QTextBrowser( splitter, "textBrowser" ); |
118 | splitter->setResizeMode(textBrowser, QSplitter::Stretch); |
||
119 | //textBrowser = new QTextBrowser( this, "textBrowser" ); |
||
120 | textBrowser->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Expanding, false ) ); |
||
564 | cbradney | 121 | textBrowser->setFrameShape( QTextBrowser::StyledPanel ); |
786 | cbradney | 122 | //helpBrowserLayout->addWidget( textBrowser ); |
564 | cbradney | 123 | helpBrowsermainLayout->addLayout( helpBrowserLayout ); |
560 | cbradney | 124 | |
564 | cbradney | 125 | languageChange(); |
126 | resize( QSize(602, 491).expandedTo(minimumSizeHint()) ); |
||
127 | clearWState( WState_Polished ); |
||
1092 | cbradney | 128 | loadMenu(); |
560 | cbradney | 129 | listView->header()->hide(); |
1092 | cbradney | 130 | jumpToHelpSection(jumpToSection, jumpToFile ); |
560 | cbradney | 131 | |
132 | connect( homeButton, SIGNAL( clicked() ), textBrowser, SLOT( home() ) ); |
||
133 | connect( forwButton, SIGNAL( clicked() ), textBrowser, SLOT( forward() ) ); |
||
134 | connect( backButton, SIGNAL( clicked() ), textBrowser, SLOT( backward() ) ); |
||
564 | cbradney | 135 | connect( histMenu, SIGNAL(activated(int)), this, SLOT(histChosen(int))); |
136 | connect( listView, SIGNAL(clicked( QListViewItem *)), this, SLOT(itemSelected( QListViewItem *))); |
||
560 | cbradney | 137 | } |
138 | |||
139 | HelpBrowser::~HelpBrowser() |
||
140 | { |
||
564 | cbradney | 141 | // no need to delete child widgets, Qt does it all for us |
560 | cbradney | 142 | } |
143 | |||
144 | void HelpBrowser::languageChange() |
||
145 | { |
||
564 | cbradney | 146 | setCaption( tr( "Scribus Online Help" ) ); |
147 | listView->header()->setLabel( 0, tr( "Contents" ) ); |
||
148 | listView->clear(); |
||
560 | cbradney | 149 | |
564 | cbradney | 150 | tabWidget->changeTab( tabContents, tr( "Contents" ) ); |
560 | cbradney | 151 | } |
152 | |||
153 | |||
154 | void HelpBrowser::sourceChanged(const QString& url) |
||
155 | { |
||
564 | cbradney | 156 | bool inList = false; |
157 | struct histd his; |
||
158 | QString title = ""; |
||
159 | title = textBrowser->documentTitle(); |
||
160 | if (title == "") |
||
161 | title = url; |
||
786 | cbradney | 162 | for (QMap<int, histd>::Iterator it = mHistory.begin(); it != mHistory.end(); ++it) |
564 | cbradney | 163 | { |
164 | if (it.data().Title == title) |
||
165 | inList = true; |
||
166 | } |
||
167 | if (!inList) |
||
168 | { |
||
169 | his.Title = title; |
||
170 | his.Url = url; |
||
171 | mHistory[histMenu->insertItem(title)] = his; |
||
172 | } |
||
173 | if (mHistory.count() > 15) |
||
174 | { |
||
175 | int itk = histMenu->idAt(0); |
||
176 | mHistory.remove(itk); |
||
177 | histMenu->removeItem(itk); |
||
178 | } |
||
560 | cbradney | 179 | } |
180 | |||
181 | void HelpBrowser::histChosen(int i) |
||
182 | { |
||
564 | cbradney | 183 | if (mHistory.contains(i)) |
184 | textBrowser->setSource(mHistory[i].Url); |
||
560 | cbradney | 185 | } |
186 | |||
1092 | cbradney | 187 | void HelpBrowser::jumpToHelpSection(QString jumpToSection, QString jumpToFile) |
560 | cbradney | 188 | { |
189 | QString toLoad; |
||
190 | |||
564 | cbradney | 191 | if (jumpToFile=="") |
192 | { |
||
872 | cbradney | 193 | QString pfad = DOCDIR; |
1092 | cbradney | 194 | toLoad = pfad + language + "/"; //clean this later to handle 5 char locales |
564 | cbradney | 195 | if (jumpToSection=="") |
196 | { |
||
1097 | cbradney | 197 | //toLoad+="index.html"; |
198 | toLoad+=listView->firstChild()->text(1); |
||
560 | cbradney | 199 | listView->setSelected( listView->firstChild(), true ); |
205 | Franz | 200 | } |
564 | cbradney | 201 | else if (jumpToSection=="scripter") |
202 | { |
||
560 | cbradney | 203 | toLoad+="scripter1.html"; |
204 | QListViewItemIterator it(listView); |
||
564 | cbradney | 205 | while (it.current()) |
206 | { |
||
560 | cbradney | 207 | if (it.current()->text(1)=="scripter1.html") |
208 | listView->setSelected( it.current(), true ); |
||
209 | if (it.current()->text(1)=="developers.html") |
||
210 | it.current()->setOpen( true ); |
||
211 | ++it; |
||
212 | } |
||
213 | } |
||
205 | Franz | 214 | } |
560 | cbradney | 215 | else |
564 | cbradney | 216 | toLoad=jumpToFile; |
3 | paul | 217 | |
560 | cbradney | 218 | loadHelp(toLoad); |
3 | paul | 219 | } |
220 | |||
560 | cbradney | 221 | void HelpBrowser::loadHelp(QString filename) |
68 | Franz | 222 | { |
75 | Franz | 223 | struct histd his; |
564 | cbradney | 224 | bool Avail = true; |
560 | cbradney | 225 | QString toLoad; |
564 | cbradney | 226 | QFileInfo fi; |
227 | fi = QFileInfo(filename); |
||
1100 | cbradney | 228 | if (fi.fileName().length()>0) |
564 | cbradney | 229 | { |
1100 | cbradney | 230 | if (fi.exists()) |
231 | toLoad=filename; |
||
232 | else |
||
564 | cbradney | 233 | { |
1100 | cbradney | 234 | QString pfad = DOCDIR; |
235 | toLoad = pfad + "en/index.html"; |
||
236 | language="en"; |
||
237 | fi = QFileInfo(toLoad); |
||
238 | if (!fi.exists()) |
||
239 | { |
||
240 | textBrowser->setText("<h2>"+ tr("Sorry, no manual available! Please see: http://docs.scribus.net for updated docs\nand www.scribus.net for downloads.")+"</h2>"); |
||
241 | Avail = false; |
||
242 | } |
||
564 | cbradney | 243 | } |
244 | } |
||
1100 | cbradney | 245 | else |
246 | Avail=false; |
||
564 | cbradney | 247 | if (Avail) |
248 | { |
||
249 | textBrowser->setSource(toLoad); |
||
250 | his.Title = textBrowser->documentTitle(); |
||
251 | if (his.Title == "") |
||
252 | his.Title = toLoad; |
||
253 | his.Url = toLoad; |
||
254 | mHistory[histMenu->insertItem(his.Title)] = his; |
||
255 | } |
||
560 | cbradney | 256 | } |
257 | |||
1092 | cbradney | 258 | void HelpBrowser::loadMenu() |
560 | cbradney | 259 | { |
872 | cbradney | 260 | QString pfad = DOCDIR; |
786 | cbradney | 261 | QString toLoad; |
1092 | cbradney | 262 | QString pfad2 = pfad + language + "/menu.xml"; |
564 | cbradney | 263 | QFileInfo fi = QFileInfo(pfad2); |
786 | cbradney | 264 | |
793 | cbradney | 265 | if (fi.exists()) |
266 | toLoad=pfad2; |
||
267 | else |
||
268 | { |
||
872 | cbradney | 269 | toLoad = pfad + "en/menu.xml"; |
1092 | cbradney | 270 | language="en"; |
786 | cbradney | 271 | fi = QFileInfo(toLoad); |
272 | qDebug("Scribus help in your selected language does not exist, trying English. Otherwise, please visit http://docs.scribus.net."); |
||
273 | } |
||
274 | |||
560 | cbradney | 275 | if (fi.exists()) |
564 | cbradney | 276 | { |
560 | cbradney | 277 | QDomDocument doc( "menuentries" ); |
786 | cbradney | 278 | QFile file( toLoad ); |
560 | cbradney | 279 | if ( !file.open( IO_ReadOnly ) ) |
280 | return; |
||
564 | cbradney | 281 | if ( !doc.setContent( &file ) ) |
282 | { |
||
560 | cbradney | 283 | file.close(); |
284 | return; |
||
285 | } |
||
286 | file.close(); |
||
287 | |||
288 | QDomElement docElem = doc.documentElement(); |
||
289 | QDomNode n = docElem.firstChild(); |
||
290 | QListViewItem *qlvi=NULL, *qlvi2=NULL, *qlvi3=NULL, *qlvi4=NULL, *qlvi5=NULL, *qlvi6=NULL; |
||
1033 | cbradney | 291 | QListViewItem *tutorialsMenuItem; |
292 | bool haveTutorials=false; |
||
560 | cbradney | 293 | |
564 | cbradney | 294 | while( !n.isNull() ) |
295 | { |
||
560 | cbradney | 296 | QDomElement e = n.toElement(); // try to convert the node to an element. |
564 | cbradney | 297 | if( !e.isNull() ) |
298 | { |
||
299 | if (e.hasAttribute( "text" ) && e.hasAttribute( "file" )) |
||
300 | { |
||
560 | cbradney | 301 | QDomAttr textAttr = e.attributeNode( "text" ); |
302 | QDomAttr fileAttr = e.attributeNode( "file" ); |
||
303 | if (qlvi2==NULL) |
||
304 | qlvi=new QListViewItem(listView, textAttr.value(), fileAttr.value()); |
||
564 | cbradney | 305 | else |
1033 | cbradney | 306 | qlvi=new QListViewItem(listView, qlvi2, textAttr.value(), fileAttr.value()); |
1103 | cbradney | 307 | if (qlvi!=NULL && e.hasAttribute( "section" )) |
564 | cbradney | 308 | { |
1103 | cbradney | 309 | QDomAttr sectionAttr = e.attributeNode( "section" ); |
310 | if (sectionAttr.value()=="tutorials") |
||
311 | { |
||
312 | haveTutorials=true; |
||
313 | tutorialsMenuItem=qlvi; |
||
314 | } |
||
560 | cbradney | 315 | } |
1033 | cbradney | 316 | |
560 | cbradney | 317 | if (qlvi!=NULL) |
318 | qlvi2=qlvi; |
||
319 | } |
||
320 | |||
321 | QDomNodeList nl=n.childNodes(); |
||
564 | cbradney | 322 | for(uint i=0 ; i<= nl.count() ; i++) |
323 | { |
||
560 | cbradney | 324 | QDomNode child=nl.item(i); |
564 | cbradney | 325 | if (child.isElement()) |
326 | { |
||
560 | cbradney | 327 | QDomElement ec = child.toElement(); |
564 | cbradney | 328 | if (!ec.isNull()) |
329 | { |
||
330 | if (ec.hasAttribute( "text" ) && ec.hasAttribute( "file" )) |
||
331 | { |
||
560 | cbradney | 332 | QDomAttr textAttr = ec.attributeNode( "text" ); |
333 | QDomAttr fileAttr = ec.attributeNode( "file" ); |
||
334 | if (qlvi4==NULL) |
||
335 | qlvi3=new QListViewItem(qlvi, textAttr.value(), fileAttr.value()); |
||
564 | cbradney | 336 | else |
1033 | cbradney | 337 | qlvi3=new QListViewItem(qlvi, qlvi4, textAttr.value(), fileAttr.value()); |
1103 | cbradney | 338 | if (qlvi3!=NULL && ec.hasAttribute( "section" )) |
564 | cbradney | 339 | { |
1103 | cbradney | 340 | QDomAttr sectionAttr = e.attributeNode( "section" ); |
341 | if (sectionAttr.value()=="tutorials") |
||
342 | { |
||
343 | haveTutorials=true; |
||
344 | tutorialsMenuItem=qlvi3; |
||
345 | } |
||
560 | cbradney | 346 | } |
347 | if (qlvi3!=NULL) |
||
348 | qlvi4=qlvi3; |
||
349 | } |
||
350 | //3rd level |
||
351 | QDomNodeList nl2=child.childNodes(); |
||
564 | cbradney | 352 | for(uint i=0 ; i<= nl2.count() ; i++) |
353 | { |
||
560 | cbradney | 354 | QDomNode childchild=nl2.item(i); |
564 | cbradney | 355 | if (childchild.isElement()) |
356 | { |
||
560 | cbradney | 357 | QDomElement ecc = childchild.toElement(); |
564 | cbradney | 358 | if (!ecc.isNull()) |
359 | { |
||
360 | if (ecc.hasAttribute( "text" ) && ecc.hasAttribute( "file" )) |
||
361 | { |
||
560 | cbradney | 362 | QDomAttr textAttr = ecc.attributeNode( "text" ); |
363 | QDomAttr fileAttr = ecc.attributeNode( "file" ); |
||
364 | if (qlvi6==NULL) |
||
365 | qlvi5=new QListViewItem(qlvi3, textAttr.value(), fileAttr.value()); |
||
564 | cbradney | 366 | else |
1033 | cbradney | 367 | qlvi5=new QListViewItem(qlvi3, qlvi6, textAttr.value(), fileAttr.value()); |
1103 | cbradney | 368 | if (qlvi5!=NULL && ecc.hasAttribute( "section" )) |
564 | cbradney | 369 | { |
1103 | cbradney | 370 | QDomAttr sectionAttr = e.attributeNode( "section" ); |
371 | if (sectionAttr.value()=="tutorials") |
||
372 | { |
||
373 | haveTutorials=true; |
||
374 | tutorialsMenuItem=qlvi5; |
||
375 | } |
||
560 | cbradney | 376 | } |
377 | } |
||
378 | if (qlvi5!=NULL) |
||
379 | qlvi6=qlvi5; |
||
380 | } |
||
381 | } |
||
382 | } |
||
383 | } |
||
384 | } |
||
385 | } |
||
386 | } |
||
387 | n = n.nextSibling(); |
||
388 | } |
||
1033 | cbradney | 389 | //scan for installed tutorials |
390 | if (haveTutorials) |
||
391 | { |
||
392 | QString path = DOCDIR; |
||
1092 | cbradney | 393 | path += language + "/tutorials/"; |
1033 | cbradney | 394 | QDir dir(path, "*", QDir::Name, QDir::Dirs | QDir::NoSymLinks); |
395 | |||
396 | if (dir.exists() && (dir.count() != 0)) |
||
397 | { |
||
398 | for (uint i = 0; i < dir.count(); ++i) |
||
399 | { |
||
400 | if (dir[i]!="." && dir[i]!="..") |
||
401 | { |
||
1092 | cbradney | 402 | QString tutorialdir = "tutorials/" + dir[i] + "/"; |
1033 | cbradney | 403 | QFileInfo file(path + dir[i] + "/menu.xml"); |
404 | if (file.exists()) // menu.xml exists for tutorial |
||
405 | { |
||
406 | QDomDocument docTutorial( "tutorialmenuentries" ); |
||
407 | QFile fileTutorialMenu( file.filePath() ); |
||
408 | if ( !fileTutorialMenu.open( IO_ReadOnly ) ) |
||
409 | break; |
||
410 | if ( !docTutorial.setContent( &fileTutorialMenu ) ) |
||
411 | { |
||
412 | fileTutorialMenu.close(); |
||
413 | break; |
||
414 | } |
||
415 | fileTutorialMenu.close(); |
||
416 | |||
417 | QDomElement docElemTutorial = docTutorial.documentElement(); |
||
418 | QDomNode nTutorial = docElemTutorial.firstChild(); |
||
419 | QListViewItem *tutorialQLVI=NULL; |
||
420 | |||
421 | while( !nTutorial.isNull() ) |
||
422 | { |
||
423 | QDomElement eTutorial = nTutorial.toElement(); // try to convert the node to an element. |
||
424 | if( !eTutorial.isNull() ) |
||
425 | { |
||
426 | if (tutorialsMenuItem!=NULL && eTutorial.hasAttribute( "text" ) && eTutorial.hasAttribute( "file" )) |
||
427 | { |
||
428 | QDomAttr textAttr = eTutorial.attributeNode( "text" ); |
||
429 | QDomAttr fileAttr = eTutorial.attributeNode( "file" ); |
||
1092 | cbradney | 430 | tutorialQLVI=new QListViewItem(tutorialsMenuItem, textAttr.value(), tutorialdir + fileAttr.value()); |
1033 | cbradney | 431 | } |
432 | QDomNodeList nl=nTutorial.childNodes(); |
||
433 | QListViewItem *tutorialSubMenuItem, *tutorialSubMenuItemLast=NULL; |
||
1092 | cbradney | 434 | for(uint j=0 ; j<= nl.count() ; j++) |
1033 | cbradney | 435 | { |
1092 | cbradney | 436 | QDomNode child=nl.item(j); |
1033 | cbradney | 437 | if (child.isElement()) |
438 | { |
||
439 | QDomElement ec = child.toElement(); |
||
440 | if (!ec.isNull()) |
||
441 | { |
||
442 | if (ec.hasAttribute( "text" ) && ec.hasAttribute( "file" )) |
||
443 | { |
||
444 | QDomAttr textAttr = ec.attributeNode( "text" ); |
||
445 | QDomAttr fileAttr = ec.attributeNode( "file" ); |
||
446 | if (tutorialSubMenuItemLast==NULL) |
||
1092 | cbradney | 447 | tutorialSubMenuItem=new QListViewItem(tutorialQLVI, textAttr.value(), tutorialdir + fileAttr.value()); |
1033 | cbradney | 448 | else |
1092 | cbradney | 449 | tutorialSubMenuItem=new QListViewItem(tutorialQLVI, tutorialSubMenuItemLast, textAttr.value(), tutorialdir + fileAttr.value()); |
1033 | cbradney | 450 | if (tutorialSubMenuItem!=NULL) |
451 | tutorialSubMenuItemLast=tutorialSubMenuItem; |
||
452 | } |
||
453 | } |
||
454 | } |
||
455 | } |
||
456 | } |
||
457 | nTutorial = nTutorial.nextSibling(); |
||
458 | } |
||
459 | } |
||
460 | } |
||
461 | } |
||
462 | } |
||
463 | |||
464 | } |
||
205 | Franz | 465 | } |
68 | Franz | 466 | } |
467 | |||
560 | cbradney | 468 | void HelpBrowser::itemSelected(QListViewItem *item) |
68 | Franz | 469 | { |
560 | cbradney | 470 | if ( !item ) |
471 | return; |
||
1033 | cbradney | 472 | if (item->text(1)!=QString::null) |
473 | { |
||
474 | QString pfad = DOCDIR; |
||
1092 | cbradney | 475 | loadHelp(pfad + language + "/" + item->text(1)); |
1033 | cbradney | 476 | } |
68 | Franz | 477 | } |