-rw-r--r-- | core/apps/helpbrowser/helpbrowser.cpp | 1 | ||||
-rw-r--r-- | core/apps/helpbrowser/magictextbrowser.cpp | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/core/apps/helpbrowser/helpbrowser.cpp b/core/apps/helpbrowser/helpbrowser.cpp index cbb4059..4bd9565 100644 --- a/core/apps/helpbrowser/helpbrowser.cpp +++ b/core/apps/helpbrowser/helpbrowser.cpp | |||
@@ -25,193 +25,192 @@ | |||
25 | 25 | ||
26 | /* OPIE */ | 26 | /* OPIE */ |
27 | #include <opie2/odebug.h> | 27 | #include <opie2/odebug.h> |
28 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
30 | using namespace Opie::Core; | 30 | using namespace Opie::Core; |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qmenubar.h> | 33 | #include <qmenubar.h> |
34 | #include <qtoolbar.h> | 34 | #include <qtoolbar.h> |
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
36 | #include <qfileinfo.h> | 36 | #include <qfileinfo.h> |
37 | #include <qaction.h> | 37 | #include <qaction.h> |
38 | 38 | ||
39 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) | 39 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) |
40 | : QMainWindow( parent, name, f ), | 40 | : QMainWindow( parent, name, f ), |
41 | selectedURL() | 41 | selectedURL() |
42 | { | 42 | { |
43 | init( "index.html" ); | 43 | init( "index.html" ); |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | void HelpBrowser::init( const QString& _home ) | 48 | void HelpBrowser::init( const QString& _home ) |
49 | { | 49 | { |
50 | setIcon( Resource::loadPixmap( "HelpBrowser" ) ); | 50 | setIcon( Resource::loadPixmap( "HelpBrowser" ) ); |
51 | setBackgroundMode( PaletteButton ); | 51 | setBackgroundMode( PaletteButton ); |
52 | 52 | ||
53 | browser = new MagicTextBrowser( this ); | 53 | browser = new MagicTextBrowser( this ); |
54 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 54 | browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
55 | connect( browser, SIGNAL( textChanged() ), | 55 | connect( browser, SIGNAL( textChanged() ), |
56 | this, SLOT( textChanged() ) ); | 56 | this, SLOT( textChanged() ) ); |
57 | 57 | ||
58 | setCentralWidget( browser ); | 58 | setCentralWidget( browser ); |
59 | setToolBarsMovable( FALSE ); | 59 | setToolBarsMovable( FALSE ); |
60 | 60 | ||
61 | if ( !_home.isEmpty() ) | 61 | if ( !_home.isEmpty() ) |
62 | browser->setSource( _home ); | 62 | browser->setSource( _home ); |
63 | 63 | ||
64 | QToolBar* toolbar = new QToolBar( this ); | 64 | QToolBar* toolbar = new QToolBar( this ); |
65 | toolbar->setHorizontalStretchable( TRUE ); | 65 | toolbar->setHorizontalStretchable( TRUE ); |
66 | QMenuBar *menu = new QMenuBar( toolbar ); | 66 | QMenuBar *menu = new QMenuBar( toolbar ); |
67 | 67 | ||
68 | toolbar = new QToolBar( this ); | 68 | toolbar = new QToolBar( this ); |
69 | // addToolBar( toolbar, "Toolbar"); | 69 | // addToolBar( toolbar, "Toolbar"); |
70 | 70 | ||
71 | QPopupMenu* go = new QPopupMenu( this ); | 71 | QPopupMenu* go = new QPopupMenu( this ); |
72 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); | 72 | backAction = new QAction( tr( "Backward" ), Resource::loadIconSet( "back" ), QString::null, 0, this, 0 ); |
73 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); | 73 | connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); |
74 | connect( browser, SIGNAL( backwardAvailable(bool) ), | 74 | connect( browser, SIGNAL( backwardAvailable(bool) ), |
75 | backAction, SLOT( setEnabled(bool) ) ); | 75 | backAction, SLOT( setEnabled(bool) ) ); |
76 | backAction->addTo( go ); | 76 | backAction->addTo( go ); |
77 | backAction->addTo( toolbar ); | 77 | backAction->addTo( toolbar ); |
78 | backAction->setEnabled( FALSE ); | 78 | backAction->setEnabled( FALSE ); |
79 | 79 | ||
80 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); | 80 | forwardAction = new QAction( tr( "Forward" ), Resource::loadIconSet( "forward" ), QString::null, 0, this, 0 ); |
81 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); | 81 | connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); |
82 | connect( browser, SIGNAL( forwardAvailable(bool) ), | 82 | connect( browser, SIGNAL( forwardAvailable(bool) ), |
83 | forwardAction, SLOT( setEnabled(bool) ) ); | 83 | forwardAction, SLOT( setEnabled(bool) ) ); |
84 | forwardAction->addTo( go ); | 84 | forwardAction->addTo( go ); |
85 | forwardAction->addTo( toolbar ); | 85 | forwardAction->addTo( toolbar ); |
86 | forwardAction->setEnabled( FALSE ); | 86 | forwardAction->setEnabled( FALSE ); |
87 | 87 | ||
88 | QAction *a = new QAction( tr( "Home" ), Resource::loadIconSet( "home" ), QString::null, 0, this, 0 ); | 88 | QAction *a = new QAction( tr( "Home" ), Resource::loadIconSet( "home" ), QString::null, 0, this, 0 ); |
89 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); | 89 | connect( a, SIGNAL( activated() ), browser, SLOT( home() ) ); |
90 | a->addTo( go ); | 90 | a->addTo( go ); |
91 | a->addTo( toolbar ); | 91 | a->addTo( toolbar ); |
92 | 92 | ||
93 | bookm = new QPopupMenu( this ); | 93 | bookm = new QPopupMenu( this ); |
94 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); | 94 | bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) ); |
95 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); | 95 | bookm->insertItem( tr( "Remove from Bookmarks" ), this, SLOT( removeBookmark() ) ); |
96 | bookm->insertSeparator(); | 96 | bookm->insertSeparator(); |
97 | connect( bookm, SIGNAL( activated(int) ), | 97 | connect( bookm, SIGNAL( activated(int) ), |
98 | this, SLOT( bookmChosen(int) ) ); | 98 | this, SLOT( bookmChosen(int) ) ); |
99 | 99 | ||
100 | readBookmarks(); | 100 | readBookmarks(); |
101 | 101 | ||
102 | menu->insertItem( tr("Go"), go ); | 102 | menu->insertItem( tr("Go"), go ); |
103 | menu->insertItem( tr( "Bookmarks" ), bookm ); | 103 | menu->insertItem( tr( "Bookmarks" ), bookm ); |
104 | 104 | ||
105 | resize( 240, 300 ); | 105 | resize( 240, 300 ); |
106 | browser->setFocus(); | 106 | browser->setFocus(); |
107 | browser->setFrameStyle( QFrame::NoFrame ); | 107 | browser->setFrameStyle( QFrame::NoFrame ); |
108 | 108 | ||
109 | #if !defined(QT_NO_COP) | 109 | #if !defined(QT_NO_COP) |
110 | QCopChannel *addressChannel = new QCopChannel("QPE/HelpBrowser" , this ); | 110 | QCopChannel *addressChannel = new QCopChannel("QPE/HelpBrowser" , this ); |
111 | connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), | 111 | connect (addressChannel, SIGNAL( received(const QCString&,const QByteArray&)), |
112 | this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); | 112 | this, SLOT ( appMessage(const QCString&,const QByteArray&) ) ); |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 115 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
116 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 116 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
117 | } | 117 | } |
118 | 118 | ||
119 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) | 119 | void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) |
120 | { | 120 | { |
121 | odebug << "reached appMessage" << oendl; | ||
122 | if ( msg == "showFile(QString)" ) { | 121 | if ( msg == "showFile(QString)" ) { |
123 | QDataStream ds(data,IO_ReadOnly); | 122 | QDataStream ds(data,IO_ReadOnly); |
124 | QString fn; | 123 | QString fn; |
125 | ds >> fn; | 124 | ds >> fn; |
126 | setDocument( fn ); | 125 | setDocument( fn ); |
127 | 126 | ||
128 | QPEApplication::setKeepRunning(); | 127 | QPEApplication::setKeepRunning(); |
129 | 128 | ||
130 | showMaximized(); | 129 | showMaximized(); |
131 | setActiveWindow(); | 130 | setActiveWindow(); |
132 | raise(); | 131 | raise(); |
133 | } | 132 | } |
134 | } | 133 | } |
135 | 134 | ||
136 | void HelpBrowser::setDocument( const QString &doc ) | 135 | void HelpBrowser::setDocument( const QString &doc ) |
137 | { | 136 | { |
138 | if ( !doc.isEmpty() ) | 137 | if ( !doc.isEmpty() ) |
139 | browser->setSource( doc ); | 138 | browser->setSource( doc ); |
140 | raise(); | 139 | raise(); |
141 | } | 140 | } |
142 | 141 | ||
143 | 142 | ||
144 | void HelpBrowser::textChanged() | 143 | void HelpBrowser::textChanged() |
145 | { | 144 | { |
146 | if ( browser->documentTitle().isNull() ) | 145 | if ( browser->documentTitle().isNull() ) |
147 | setCaption( tr("Help Browser") ); | 146 | setCaption( tr("Help Browser") ); |
148 | else | 147 | else |
149 | setCaption( browser->documentTitle() ) ; | 148 | setCaption( browser->documentTitle() ) ; |
150 | 149 | ||
151 | selectedURL = caption(); | 150 | selectedURL = caption(); |
152 | } | 151 | } |
153 | 152 | ||
154 | HelpBrowser::~HelpBrowser() | 153 | HelpBrowser::~HelpBrowser() |
155 | { | 154 | { |
156 | QStringList bookmarks; | 155 | QStringList bookmarks; |
157 | QMap<int, Bookmark>::Iterator it2 = mBookmarks.begin(); | 156 | QMap<int, Bookmark>::Iterator it2 = mBookmarks.begin(); |
158 | for ( ; it2 != mBookmarks.end(); ++it2 ) | 157 | for ( ; it2 != mBookmarks.end(); ++it2 ) |
159 | bookmarks.append( (*it2).name + "=" + (*it2).file ); | 158 | bookmarks.append( (*it2).name + "=" + (*it2).file ); |
160 | 159 | ||
161 | QFile f2( Global::applicationFileName("helpbrowser", "bookmarks") ); | 160 | QFile f2( Global::applicationFileName("helpbrowser", "bookmarks") ); |
162 | if ( f2.open( IO_WriteOnly ) ) { | 161 | if ( f2.open( IO_WriteOnly ) ) { |
163 | QDataStream s2( &f2 ); | 162 | QDataStream s2( &f2 ); |
164 | s2 << bookmarks; | 163 | s2 << bookmarks; |
165 | f2.close(); | 164 | f2.close(); |
166 | } | 165 | } |
167 | } | 166 | } |
168 | 167 | ||
169 | void HelpBrowser::pathSelected( const QString &_path ) | 168 | void HelpBrowser::pathSelected( const QString &_path ) |
170 | { | 169 | { |
171 | browser->setSource( _path ); | 170 | browser->setSource( _path ); |
172 | } | 171 | } |
173 | 172 | ||
174 | void HelpBrowser::readBookmarks() | 173 | void HelpBrowser::readBookmarks() |
175 | { | 174 | { |
176 | QString file = Global::applicationFileName("helpbrowser", "bookmarks"); | 175 | QString file = Global::applicationFileName("helpbrowser", "bookmarks"); |
177 | if ( QFile::exists( file ) ) { | 176 | if ( QFile::exists( file ) ) { |
178 | QStringList bookmarks; | 177 | QStringList bookmarks; |
179 | QFile f( file ); | 178 | QFile f( file ); |
180 | if ( f.open( IO_ReadOnly ) ) { | 179 | if ( f.open( IO_ReadOnly ) ) { |
181 | QDataStream s( &f ); | 180 | QDataStream s( &f ); |
182 | s >> bookmarks; | 181 | s >> bookmarks; |
183 | f.close(); | 182 | f.close(); |
184 | } | 183 | } |
185 | QStringList::Iterator it = bookmarks.begin(); | 184 | QStringList::Iterator it = bookmarks.begin(); |
186 | for ( ; it != bookmarks.end(); ++it ) { | 185 | for ( ; it != bookmarks.end(); ++it ) { |
187 | Bookmark b; | 186 | Bookmark b; |
188 | QString current = *it; | 187 | QString current = *it; |
189 | int equal = current.find( "=" ); | 188 | int equal = current.find( "=" ); |
190 | if ( equal < 1 || equal == (int)current.length() - 1 ) | 189 | if ( equal < 1 || equal == (int)current.length() - 1 ) |
191 | continue; | 190 | continue; |
192 | b.name = current.left( equal ); | 191 | b.name = current.left( equal ); |
193 | b.file = current.mid( equal + 1 ); | 192 | b.file = current.mid( equal + 1 ); |
194 | mBookmarks[ bookm->insertItem( b.name ) ] = b; | 193 | mBookmarks[ bookm->insertItem( b.name ) ] = b; |
195 | } | 194 | } |
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | void HelpBrowser::bookmChosen( int i ) | 198 | void HelpBrowser::bookmChosen( int i ) |
200 | { | 199 | { |
201 | if ( mBookmarks.contains( i ) ) | 200 | if ( mBookmarks.contains( i ) ) |
202 | browser->setSource( mBookmarks[ i ].file ); | 201 | browser->setSource( mBookmarks[ i ].file ); |
203 | } | 202 | } |
204 | 203 | ||
205 | void HelpBrowser::addBookmark() | 204 | void HelpBrowser::addBookmark() |
206 | { | 205 | { |
207 | Bookmark b; | 206 | Bookmark b; |
208 | b.name = browser->documentTitle(); | 207 | b.name = browser->documentTitle(); |
209 | b.file = browser->source(); | 208 | b.file = browser->source(); |
210 | if (b.name.isEmpty() ) { | 209 | if (b.name.isEmpty() ) { |
211 | b.name = b.file.left( b.file.length() - 5 ); // remove .html | 210 | b.name = b.file.left( b.file.length() - 5 ); // remove .html |
212 | } | 211 | } |
213 | QMap<int, Bookmark>::Iterator it; | 212 | QMap<int, Bookmark>::Iterator it; |
214 | for( it = mBookmarks.begin(); it != mBookmarks.end(); ++it ) | 213 | for( it = mBookmarks.begin(); it != mBookmarks.end(); ++it ) |
215 | if ( (*it).file == b.file ) return; | 214 | if ( (*it).file == b.file ) return; |
216 | mBookmarks[ bookm->insertItem( b.name ) ] = b; | 215 | mBookmarks[ bookm->insertItem( b.name ) ] = b; |
217 | } | 216 | } |
diff --git a/core/apps/helpbrowser/magictextbrowser.cpp b/core/apps/helpbrowser/magictextbrowser.cpp index 80495c9..44bf19f 100644 --- a/core/apps/helpbrowser/magictextbrowser.cpp +++ b/core/apps/helpbrowser/magictextbrowser.cpp | |||
@@ -1,97 +1,104 @@ | |||
1 | #include <qfile.h> | 1 | #include <qfile.h> |
2 | #include <qdragobject.h> | 2 | #include <qdragobject.h> |
3 | 3 | ||
4 | /* need to get Global::helpPath() */ | 4 | /* need to get Global::helpPath() */ |
5 | #define QTOPIA_INTERNAL_LANGLIST | 5 | #define QTOPIA_INTERNAL_LANGLIST |
6 | 6 | ||
7 | #include <qtopia/global.h> | 7 | #include <qtopia/global.h> |
8 | #include <qtopia/mimetype.h> | 8 | #include <qtopia/mimetype.h> |
9 | #include <qtopia/applnk.h> | 9 | #include <qtopia/applnk.h> |
10 | 10 | ||
11 | #include "magictextbrowser.h" | 11 | #include "magictextbrowser.h" |
12 | 12 | ||
13 | 13 | ||
14 | 14 | ||
15 | MagicTextBrowser::MagicTextBrowser(QWidget* parent) : | 15 | MagicTextBrowser::MagicTextBrowser(QWidget* parent) : |
16 | QTextBrowser(parent){ | 16 | QTextBrowser(parent){ |
17 | } | 17 | } |
18 | 18 | ||
19 | void MagicTextBrowser::setSource( const QString& source ) { | 19 | void MagicTextBrowser::setSource( const QString& source ) { |
20 | QTextBrowser::setSource(source); | 20 | QTextBrowser::setSource(source); |
21 | if ( magicQpe(source,"applications") || magicQpe(source,"games") || magicQpe(source,"settings") || magicQpe(source, "1Pim") ) // No tr | 21 | if ( magicQpe(source,"applications") || magicQpe(source,"games") || magicQpe(source,"settings") || magicQpe(source, "1Pim") ) // No tr |
22 | return; | 22 | return; |
23 | if ( magicOpe(source, "applets") || magicOpe(source, "input") ) | 23 | if ( magicOpe(source, "applets") || magicOpe(source, "input") ) |
24 | return; | 24 | return; |
25 | // Just those are magic (for now). Could do CGI here, | 25 | // Just those are magic (for now). Could do CGI here, |
26 | // or in Qtopia's mime source factory. | 26 | // or in Qtopia's mime source factory. |
27 | } | 27 | } |
28 | 28 | ||
29 | bool MagicTextBrowser::magicQpe(const QString& source, const QString& name) { | 29 | bool MagicTextBrowser::magicQpe(const QString& source, const QString& name) { |
30 | if ( name+".html" == source || "help/"+name+".html" == source) { | 30 | if ( name+".html" == source || "help/"+name+".html" == source) { |
31 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); | 31 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); |
32 | const QMimeSource* m = mimeSourceFactory()->data( fn, context() ); | 32 | const QMimeSource* m = mimeSourceFactory()->data( fn, context() ); |
33 | if ( m ) { | 33 | if ( m ) { |
34 | QString txt; | 34 | QString txt; |
35 | if ( QTextDrag::decode(m,txt) ) { | 35 | if ( QTextDrag::decode(m,txt) ) { |
36 | QRegExp re("<qtopia-"+name+">.*</qtopia-"+name+">"); | 36 | QRegExp re("<qtopia-"+name+">.*</qtopia-"+name+">"); |
37 | int start,len; | 37 | int start,len; |
38 | if ( (start=re.match(txt,0,&len))>=0 ) { | 38 | if ( (start=re.match(txt,0,&len))>=0 ) { |
39 | QString generated = generateQpe(name); | 39 | QString generated = generateQpe(name); |
40 | txt.replace(start,len,generated); | 40 | txt.replace(start,len,generated); |
41 | setText(txt); | 41 | setText(txt); |
42 | return true; | 42 | return true; |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } | 45 | } |
46 | } | 46 | } |
47 | return false; | 47 | return false; |
48 | } | 48 | } |
49 | bool MagicTextBrowser::magicOpe( const QString& source, const QString& name ) { | 49 | bool MagicTextBrowser::magicOpe( const QString& source, const QString& name ) { |
50 | if ( name+".html" != source && "help/"+name+".html" != source) return false; | 50 | if ( name+".html" != source && "help/"+name+".html" != source) return false; |
51 | 51 | ||
52 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); | 52 | QString fn = mimeSourceFactory()->makeAbsolute( source, context() ); |
53 | const QMimeSource* m = mimeSourceFactory()->data(fn, context() ); | 53 | const QMimeSource* m = mimeSourceFactory()->data(fn, context() ); |
54 | if (!m) return false; | 54 | if (!m) return false; |
55 | 55 | ||
56 | QString txt; | 56 | QString txt; |
57 | if ( !QTextDrag::decode(m, txt ) ) return false; | 57 | if ( !QTextDrag::decode(m, txt ) ) return false; |
58 | 58 | ||
59 | QRegExp re("<opie-"+name+">.*</opie-"+name+">"); | 59 | QRegExp re("<opie-"+name+">.*</opie-"+name+">"); |
60 | int start,len; | 60 | int start,len; |
61 | if ( (start=re.match(txt,0,&len))>=0 ) { | 61 | if ( (start=re.match(txt,0,&len))>=0 ) { |
62 | QString generated = generateOpe(name); | 62 | QString generated = generateOpe(name); |
63 | txt.replace(start,len,generated); | 63 | txt.replace(start,len,generated); |
64 | setText(txt); | 64 | setText(txt); |
65 | return true; | 65 | return true; |
66 | } | 66 | } |
67 | return false; | 67 | return false; |
68 | } | 68 | } |
69 | QString MagicTextBrowser::generateOpe(const QString& name)const { | 69 | QString MagicTextBrowser::generateOpe(const QString& name)const { |
70 | if ( name == QString::fromLatin1("applets") ) { | 70 | if ( name == QString::fromLatin1("applets") ) { |
71 | return QString::fromLatin1("<h3>No Applets found</h3>"); | 71 | return QString::fromLatin1("<h3>No Applets found</h3>"); |
72 | }else if ( name == QString::fromLatin1("input") ) { | 72 | }else if ( name == QString::fromLatin1("input") ) { |
73 | return QString::fromLatin1("<h3>No input methods available</h3>"); | 73 | return QString::fromLatin1("<h3>No input methods available</h3>"); |
74 | }else | 74 | }else |
75 | return QString::null; | 75 | return QString::null; |
76 | } | 76 | } |
77 | 77 | ||
78 | QString MagicTextBrowser::generateQpe(const QString& name) const { | 78 | QString MagicTextBrowser::generateQpe(const QString& name) const { |
79 | QString dir = MimeType::appsFolderName()+"/"+name[0].upper()+name.mid(1); | 79 | QString dir = MimeType::appsFolderName()+"/"+name[0].upper()+name.mid(1); |
80 | AppLnkSet lnkset(dir); | 80 | AppLnkSet lnkset(dir); |
81 | AppLnk* lnk; | 81 | AppLnk* lnk; |
82 | QString r; | 82 | QString r; |
83 | for (QListIterator<AppLnk> it(lnkset.children()); (lnk=it.current()); ++it) { | 83 | for (QListIterator<AppLnk> it(lnkset.children()); (lnk=it.current()); ++it) { |
84 | QString name = lnk->name(); | 84 | QString name = lnk->name(); |
85 | QString icon = lnk->icon(); | 85 | QString icon = lnk->icon(); |
86 | QString helpFile = lnk->exec()+".html"; | 86 | QString exec = lnk->exec(); |
87 | QString helpFile = exec+".html"; | ||
87 | QStringList helpPath = Global::helpPath(); | 88 | QStringList helpPath = Global::helpPath(); |
88 | bool helpExists = FALSE; | 89 | bool helpExists = FALSE; |
89 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) | 90 | for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) { |
90 | helpExists = QFile::exists( *it + "/" + helpFile ); | 91 | helpExists = QFile::exists( *it + "/" + helpFile ); |
92 | |||
93 | if( !helpExists && QFile::exists( *it + "/" + exec + "/" + helpFile ) ) { | ||
94 | helpFile = exec + "/" + helpFile; | ||
95 | helpExists = true; | ||
96 | } | ||
97 | } | ||
91 | 98 | ||
92 | if ( helpExists ) { | 99 | if ( helpExists ) { |
93 | r += "<h3><a href="+helpFile+"><img src="+icon+">"+name+"</a></h3>\n"; | 100 | r += "<h3><a href="+helpFile+"><img src="+icon+">"+name+"</a></h3>\n"; |
94 | } | 101 | } |
95 | } | 102 | } |
96 | return r; | 103 | return r; |
97 | } | 104 | } |