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