summaryrefslogtreecommitdiff
path: root/core/apps/helpbrowser/helpbrowser.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/helpbrowser/helpbrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/helpbrowser/helpbrowser.cpp103
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 @@
#include "helpbrowser.h"
+#include "magictextbrowser.h"
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
+using namespace Opie::Core;
+/* QT */
#include <qmenubar.h>
@@ -33,6 +38,2 @@
-#include <cctype>
-
-#include "magictextbrowser.h"
-
HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f )
@@ -54,3 +55,3 @@ void HelpBrowser::init( const QString& _home )
connect( browser, SIGNAL( textChanged() ),
- this, SLOT( textChanged() ) );
+ this, SLOT( textChanged() ) );
@@ -60,3 +61,3 @@ void HelpBrowser::init( const QString& _home )
if ( !_home.isEmpty() )
- browser->setSource( _home );
+ browser->setSource( _home );
@@ -73,3 +74,3 @@ void HelpBrowser::init( const QString& _home )
connect( browser, SIGNAL( backwardAvailable(bool) ),
- backAction, SLOT( setEnabled(bool) ) );
+ backAction, SLOT( setEnabled(bool) ) );
backAction->addTo( go );
@@ -81,3 +82,3 @@ void HelpBrowser::init( const QString& _home )
connect( browser, SIGNAL( forwardAvailable(bool) ),
- forwardAction, SLOT( setEnabled(bool) ) );
+ forwardAction, SLOT( setEnabled(bool) ) );
forwardAction->addTo( go );
@@ -96,3 +97,3 @@ void HelpBrowser::init( const QString& _home )
connect( bookm, SIGNAL( activated(int) ),
- this, SLOT( bookmChosen(int) ) );
+ this, SLOT( bookmChosen(int) ) );
@@ -114,3 +115,3 @@ void HelpBrowser::init( const QString& _home )
connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
- this, SLOT(appMessage(const QCString&,const QByteArray&)) );
+ this, SLOT(appMessage(const QCString&,const QByteArray&)) );
}
@@ -119,8 +120,8 @@ void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data)
{
- qDebug("reached appMessage");
+ odebug << "reached appMessage" << oendl;
if ( msg == "showFile(QString)" ) {
- QDataStream ds(data,IO_ReadOnly);
- QString fn;
- ds >> fn;
- setDocument( fn );
+ QDataStream ds(data,IO_ReadOnly);
+ QString fn;
+ ds >> fn;
+ setDocument( fn );
@@ -128,5 +129,5 @@ void HelpBrowser::appMessage(const QCString& msg, const QByteArray& data)
- showMaximized();
- setActiveWindow();
- raise();
+ showMaximized();
+ setActiveWindow();
+ raise();
}
@@ -137,3 +138,3 @@ void HelpBrowser::setDocument( const QString &doc )
if ( !doc.isEmpty() )
- browser->setSource( doc );
+ browser->setSource( doc );
raise();
@@ -145,5 +146,5 @@ void HelpBrowser::textChanged()
if ( browser->documentTitle().isNull() )
- setCaption( tr("Help Browser") );
+ setCaption( tr("Help Browser") );
else
- setCaption( browser->documentTitle() ) ;
+ setCaption( browser->documentTitle() ) ;
@@ -157,3 +158,3 @@ HelpBrowser::~HelpBrowser()
for ( ; it2 != mBookmarks.end(); ++it2 )
- bookmarks.append( (*it2).name + "=" + (*it2).file );
+ bookmarks.append( (*it2).name + "=" + (*it2).file );
@@ -161,5 +162,5 @@ HelpBrowser::~HelpBrowser()
if ( f2.open( IO_WriteOnly ) ) {
- QDataStream s2( &f2 );
- s2 << bookmarks;
- f2.close();
+ QDataStream s2( &f2 );
+ s2 << bookmarks;
+ f2.close();
}
@@ -176,20 +177,20 @@ void HelpBrowser::readBookmarks()
if ( QFile::exists( file ) ) {
- QStringList bookmarks;
- QFile f( file );
- if ( f.open( IO_ReadOnly ) ) {
- QDataStream s( &f );
- s >> bookmarks;
- f.close();
- }
- QStringList::Iterator it = bookmarks.begin();
- for ( ; it != bookmarks.end(); ++it ) {
- Bookmark b;
- QString current = *it;
- int equal = current.find( "=" );
- if ( equal < 1 || equal == (int)current.length() - 1 )
- continue;
- b.name = current.left( equal );
- b.file = current.mid( equal + 1 );
- mBookmarks[ bookm->insertItem( b.name ) ] = b;
- }
+ QStringList bookmarks;
+ QFile f( file );
+ if ( f.open( IO_ReadOnly ) ) {
+ QDataStream s( &f );
+ s >> bookmarks;
+ f.close();
+ }
+ QStringList::Iterator it = bookmarks.begin();
+ for ( ; it != bookmarks.end(); ++it ) {
+ Bookmark b;
+ QString current = *it;
+ int equal = current.find( "=" );
+ if ( equal < 1 || equal == (int)current.length() - 1 )
+ continue;
+ b.name = current.left( equal );
+ b.file = current.mid( equal + 1 );
+ mBookmarks[ bookm->insertItem( b.name ) ] = b;
+ }
}
@@ -200,3 +201,3 @@ void HelpBrowser::bookmChosen( int i )
if ( mBookmarks.contains( i ) )
- browser->setSource( mBookmarks[ i ].file );
+ browser->setSource( mBookmarks[ i ].file );
}
@@ -209,3 +210,3 @@ void HelpBrowser::addBookmark()
if (b.name.isEmpty() ) {
- b.name = b.file.left( b.file.length() - 5 ); // remove .html
+ b.name = b.file.left( b.file.length() - 5 ); // remove .html
}
@@ -213,3 +214,3 @@ void HelpBrowser::addBookmark()
for( it = mBookmarks.begin(); it != mBookmarks.end(); ++it )
- if ( (*it).file == b.file ) return;
+ if ( (*it).file == b.file ) return;
mBookmarks[ bookm->insertItem( b.name ) ] = b;
@@ -222,7 +223,7 @@ void HelpBrowser::removeBookmark()
for( ; it != mBookmarks.end(); ++it )
- if ( (*it).file == file ) {
- bookm->removeItem( it.key() );
- mBookmarks.remove( it );
- break;
- }
+ if ( (*it).file == file ) {
+ bookm->removeItem( it.key() );
+ mBookmarks.remove( it );
+ break;
+ }
}