Diffstat (limited to 'core/apps/helpbrowser/helpbrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/helpbrowser/helpbrowser.cpp | 103 |
1 files changed, 52 insertions, 51 deletions
diff --git a/core/apps/helpbrowser/helpbrowser.cpp b/core/apps/helpbrowser/helpbrowser.cpp index 336d9fb..cbb4059 100644 --- a/core/apps/helpbrowser/helpbrowser.cpp +++ b/core/apps/helpbrowser/helpbrowser.cpp | |||
@@ -23,6 +23,11 @@ | |||
23 | #include "helpbrowser.h" | 23 | #include "helpbrowser.h" |
24 | #include "magictextbrowser.h" | ||
24 | 25 | ||
26 | /* OPIE */ | ||
27 | #include <opie2/odebug.h> | ||
25 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/resource.h> | 29 | #include <qpe/resource.h> |
30 | using namespace Opie::Core; | ||
27 | 31 | ||
32 | /* QT */ | ||
28 | #include <qmenubar.h> | 33 | #include <qmenubar.h> |
@@ -33,6 +38,2 @@ | |||
33 | 38 | ||
34 | #include <cctype> | ||
35 | |||
36 | #include "magictextbrowser.h" | ||
37 | |||
38 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) | 39 | HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) |
@@ -54,3 +55,3 @@ void HelpBrowser::init( const QString& _home ) | |||
54 | connect( browser, SIGNAL( textChanged() ), | 55 | connect( browser, SIGNAL( textChanged() ), |
55 | this, SLOT( textChanged() ) ); | 56 | this, SLOT( textChanged() ) ); |
56 | 57 | ||
@@ -60,3 +61,3 @@ void HelpBrowser::init( const QString& _home ) | |||
60 | if ( !_home.isEmpty() ) | 61 | if ( !_home.isEmpty() ) |
61 | browser->setSource( _home ); | 62 | browser->setSource( _home ); |
62 | 63 | ||
@@ -73,3 +74,3 @@ void HelpBrowser::init( const QString& _home ) | |||
73 | connect( browser, SIGNAL( backwardAvailable(bool) ), | 74 | connect( browser, SIGNAL( backwardAvailable(bool) ), |
74 | backAction, SLOT( setEnabled(bool) ) ); | 75 | backAction, SLOT( setEnabled(bool) ) ); |
75 | backAction->addTo( go ); | 76 | backAction->addTo( go ); |
@@ -81,3 +82,3 @@ void HelpBrowser::init( const QString& _home ) | |||
81 | connect( browser, SIGNAL( forwardAvailable(bool) ), | 82 | connect( browser, SIGNAL( forwardAvailable(bool) ), |
82 | forwardAction, SLOT( setEnabled(bool) ) ); | 83 | forwardAction, SLOT( setEnabled(bool) ) ); |
83 | forwardAction->addTo( go ); | 84 | forwardAction->addTo( go ); |
@@ -96,3 +97,3 @@ void HelpBrowser::init( const QString& _home ) | |||
96 | connect( bookm, SIGNAL( activated(int) ), | 97 | connect( bookm, SIGNAL( activated(int) ), |
97 | this, SLOT( bookmChosen(int) ) ); | 98 | this, SLOT( bookmChosen(int) ) ); |
98 | 99 | ||
@@ -114,3 +115,3 @@ void HelpBrowser::init( const QString& _home ) | |||
114 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 115 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
115 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 116 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
116 | } | 117 | } |
@@ -119,8 +120,8 @@ void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) | |||
119 | { | 120 | { |
120 | qDebug("reached appMessage"); | 121 | odebug << "reached appMessage" << oendl; |
121 | if ( msg == "showFile(QString)" ) { | 122 | if ( msg == "showFile(QString)" ) { |
122 | QDataStream ds(data,IO_ReadOnly); | 123 | QDataStream ds(data,IO_ReadOnly); |
123 | QString fn; | 124 | QString fn; |
124 | ds >> fn; | 125 | ds >> fn; |
125 | setDocument( fn ); | 126 | setDocument( fn ); |
126 | 127 | ||
@@ -128,5 +129,5 @@ void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data) | |||
128 | 129 | ||
129 | showMaximized(); | 130 | showMaximized(); |
130 | setActiveWindow(); | 131 | setActiveWindow(); |
131 | raise(); | 132 | raise(); |
132 | } | 133 | } |
@@ -137,3 +138,3 @@ void HelpBrowser::setDocument( const QString &doc ) | |||
137 | if ( !doc.isEmpty() ) | 138 | if ( !doc.isEmpty() ) |
138 | browser->setSource( doc ); | 139 | browser->setSource( doc ); |
139 | raise(); | 140 | raise(); |
@@ -145,5 +146,5 @@ void HelpBrowser::textChanged() | |||
145 | if ( browser->documentTitle().isNull() ) | 146 | if ( browser->documentTitle().isNull() ) |
146 | setCaption( tr("Help Browser") ); | 147 | setCaption( tr("Help Browser") ); |
147 | else | 148 | else |
148 | setCaption( browser->documentTitle() ) ; | 149 | setCaption( browser->documentTitle() ) ; |
149 | 150 | ||
@@ -157,3 +158,3 @@ HelpBrowser::~HelpBrowser() | |||
157 | for ( ; it2 != mBookmarks.end(); ++it2 ) | 158 | for ( ; it2 != mBookmarks.end(); ++it2 ) |
158 | bookmarks.append( (*it2).name + "=" + (*it2).file ); | 159 | bookmarks.append( (*it2).name + "=" + (*it2).file ); |
159 | 160 | ||
@@ -161,5 +162,5 @@ HelpBrowser::~HelpBrowser() | |||
161 | if ( f2.open( IO_WriteOnly ) ) { | 162 | if ( f2.open( IO_WriteOnly ) ) { |
162 | QDataStream s2( &f2 ); | 163 | QDataStream s2( &f2 ); |
163 | s2 << bookmarks; | 164 | s2 << bookmarks; |
164 | f2.close(); | 165 | f2.close(); |
165 | } | 166 | } |
@@ -176,20 +177,20 @@ void HelpBrowser::readBookmarks() | |||
176 | if ( QFile::exists( file ) ) { | 177 | if ( QFile::exists( file ) ) { |
177 | QStringList bookmarks; | 178 | QStringList bookmarks; |
178 | QFile f( file ); | 179 | QFile f( file ); |
179 | if ( f.open( IO_ReadOnly ) ) { | 180 | if ( f.open( IO_ReadOnly ) ) { |
180 | QDataStream s( &f ); | 181 | QDataStream s( &f ); |
181 | s >> bookmarks; | 182 | s >> bookmarks; |
182 | f.close(); | 183 | f.close(); |
183 | } | 184 | } |
184 | QStringList::Iterator it = bookmarks.begin(); | 185 | QStringList::Iterator it = bookmarks.begin(); |
185 | for ( ; it != bookmarks.end(); ++it ) { | 186 | for ( ; it != bookmarks.end(); ++it ) { |
186 | Bookmark b; | 187 | Bookmark b; |
187 | QString current = *it; | 188 | QString current = *it; |
188 | int equal = current.find( "=" ); | 189 | int equal = current.find( "=" ); |
189 | if ( equal < 1 || equal == (int)current.length() - 1 ) | 190 | if ( equal < 1 || equal == (int)current.length() - 1 ) |
190 | continue; | 191 | continue; |
191 | b.name = current.left( equal ); | 192 | b.name = current.left( equal ); |
192 | b.file = current.mid( equal + 1 ); | 193 | b.file = current.mid( equal + 1 ); |
193 | mBookmarks[ bookm->insertItem( b.name ) ] = b; | 194 | mBookmarks[ bookm->insertItem( b.name ) ] = b; |
194 | } | 195 | } |
195 | } | 196 | } |
@@ -200,3 +201,3 @@ void HelpBrowser::bookmChosen( int i ) | |||
200 | if ( mBookmarks.contains( i ) ) | 201 | if ( mBookmarks.contains( i ) ) |
201 | browser->setSource( mBookmarks[ i ].file ); | 202 | browser->setSource( mBookmarks[ i ].file ); |
202 | } | 203 | } |
@@ -209,3 +210,3 @@ void HelpBrowser::addBookmark() | |||
209 | if (b.name.isEmpty() ) { | 210 | if (b.name.isEmpty() ) { |
210 | b.name = b.file.left( b.file.length() - 5 ); // remove .html | 211 | b.name = b.file.left( b.file.length() - 5 ); // remove .html |
211 | } | 212 | } |
@@ -213,3 +214,3 @@ void HelpBrowser::addBookmark() | |||
213 | for( it = mBookmarks.begin(); it != mBookmarks.end(); ++it ) | 214 | for( it = mBookmarks.begin(); it != mBookmarks.end(); ++it ) |
214 | if ( (*it).file == b.file ) return; | 215 | if ( (*it).file == b.file ) return; |
215 | mBookmarks[ bookm->insertItem( b.name ) ] = b; | 216 | mBookmarks[ bookm->insertItem( b.name ) ] = b; |
@@ -222,7 +223,7 @@ void HelpBrowser::removeBookmark() | |||
222 | for( ; it != mBookmarks.end(); ++it ) | 223 | for( ; it != mBookmarks.end(); ++it ) |
223 | if ( (*it).file == file ) { | 224 | if ( (*it).file == file ) { |
224 | bookm->removeItem( it.key() ); | 225 | bookm->removeItem( it.key() ); |
225 | mBookmarks.remove( it ); | 226 | mBookmarks.remove( it ); |
226 | break; | 227 | break; |
227 | } | 228 | } |
228 | } | 229 | } |