summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-05 13:30:36 (UTC)
committer mickeyl <mickeyl>2004-04-05 13:30:36 (UTC)
commit743adf3ed3032feb15e71002613a4643d059aa09 (patch) (side-by-side diff)
treeda8c0549515f694775a1cd169cdc5abe615a3847
parentb136b4d55c810c35c54b18b435aa4172b7f6b9fe (diff)
downloadopie-743adf3ed3032feb15e71002613a4643d059aa09.zip
opie-743adf3ed3032feb15e71002613a4643d059aa09.tar.gz
opie-743adf3ed3032feb15e71002613a4643d059aa09.tar.bz2
convert helpbrowser, taboapp and textedit to Opie debugging framework
qcop and embeddedkonsole needs more work. the diagnostics part uses printf
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/helpbrowser/helpbrowser.cpp103
-rw-r--r--core/apps/taboapp/main.cpp48
-rw-r--r--core/apps/textedit/filePermissions.cpp2
-rw-r--r--core/apps/textedit/textedit.cpp83
4 files changed, 122 insertions, 114 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;
+ }
}
diff --git a/core/apps/taboapp/main.cpp b/core/apps/taboapp/main.cpp
index e46c71f..e43f118 100644
--- a/core/apps/taboapp/main.cpp
+++ b/core/apps/taboapp/main.cpp
@@ -1,9 +1,13 @@
-#include <qdir.h>
-
-#include <qpe/qpeapplication.h>
-#include <qpe/qlibrary.h>
+/* OPIE */
#include <oappinterface.h>
#include <oappplugin.h>
-
+#include <opie2/odebug.h>
#include <opie2/otabwidget.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/qlibrary.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
+
+/* QT */
+#include <qdir.h>
@@ -13,3 +17,3 @@ int main( int argc, char **argv )
- Opie::Ui::OTabWidget *tabwidget = new Opie::Ui::OTabWidget(0, "tab widget");
+ OTabWidget *tabwidget = new OTabWidget(0, "tab widget");
@@ -25,7 +29,7 @@ int main( int argc, char **argv )
- qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
+ odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl;
if ( lib->queryInterface( IID_OAppInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
- qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() );
+ odebug << "accepted: " << QString( path + "/" + *it ) << "" << oendl;
- QList<QWidget> list = iface->widgets();
+ QList<QWidget> list = iface->widgets();
QWidget *widget;
@@ -35,15 +39,15 @@ int main( int argc, char **argv )
QString lang = getenv( "LANG" );
- if (lang.isNull())
- lang = "en";
- QTranslator *trans = new QTranslator(qApp);
- QString type = (*it).left( (*it).find(".") );
- if (type.left(3) == "lib")
- type = type.mid(3);
- type = type.right( type.find("lib") );
- QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
- if ( trans->load( tfn ))
- qApp->installTranslator( trans );
- else
- delete trans;
- }
+ if (lang.isNull())
+ lang = "en";
+ QTranslator *trans = new QTranslator(qApp);
+ QString type = (*it).left( (*it).find(".") );
+ if (type.left(3) == "lib")
+ type = type.mid(3);
+ type = type.right( type.find("lib") );
+ QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
+ if ( trans->load( tfn ))
+ qApp->installTranslator( trans );
+ else
+ delete trans;
+ }
}
diff --git a/core/apps/textedit/filePermissions.cpp b/core/apps/textedit/filePermissions.cpp
index db353a9..a059dce 100644
--- a/core/apps/textedit/filePermissions.cpp
+++ b/core/apps/textedit/filePermissions.cpp
@@ -34,3 +34,3 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal
setName( tr("File Permissions") );
-// qDebug("FilePermissions "+fileName);
+// odebug << "FilePermissions "+fileName << oendl;
resize( 236, 210 );
diff --git a/core/apps/textedit/textedit.cpp b/core/apps/textedit/textedit.cpp
index 5bb65a9..c9178a5 100644
--- a/core/apps/textedit/textedit.cpp
+++ b/core/apps/textedit/textedit.cpp
@@ -13,2 +13,3 @@
// changes added by L. J. Potter Sun 02-17-2002 21:31:31
+
#include "textedit.h"
@@ -16,3 +17,4 @@
-
+/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/ofileselector.h>
@@ -20,3 +22,2 @@
#include <opie2/ofontselector.h>
-
#include <qpe/resource.h>
@@ -24,5 +25,8 @@
#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
+using namespace Opie::Ui;
+
+/* QT */
#include <qmenubar.h>
#include <qtoolbar.h>
-
#include <qtextstream.h>
@@ -35,2 +39,4 @@
#include <qdir.h>
+
+/* STD */
#include <unistd.h>
@@ -39,6 +45,3 @@
-using namespace Opie::Ui;
-
#if QT_VERSION < 300
-
class QpeEditor : public QMultiLineEdit
@@ -413,3 +416,3 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f )
TextEdit::~TextEdit() {
- qWarning("textedit d'tor");
+ owarn << "textedit d'tor" << oendl;
delete editor;
@@ -648,3 +651,3 @@ void TextEdit::newFile( const DocLnk &f ) {
currentFileName = "Unnamed";
- qDebug("newFile "+currentFileName);
+ odebug << "newFile "+currentFileName << oendl;
updateCaption( currentFileName);
@@ -657,3 +660,3 @@ void TextEdit::openDotFile( const QString &f ) {
- qDebug("openFile dotfile " + currentFileName);
+ odebug << "openFile dotfile " + currentFileName << oendl;
QString txt;
@@ -676,3 +679,3 @@ void TextEdit::openDotFile( const QString &f ) {
void TextEdit::openFile( const QString &f ) {
- qDebug("filename is "+ f);
+ odebug << "filename is "+ f << oendl;
QString filer;
@@ -695,3 +698,3 @@ void TextEdit::openFile( const QString &f ) {
{
- qDebug("opening dotfile");
+ odebug << "opening dotfile" << oendl;
currentFileName=f;
@@ -723,3 +726,3 @@ void TextEdit::openFile( const QString &f ) {
- qDebug("openFile string "+currentFileName);
+ odebug << "openFile string "+currentFileName << oendl;
@@ -740,6 +743,6 @@ void TextEdit::openFile( const DocLnk &f ) {
currentFileName=f.file();
- qDebug("openFile doclnk " + currentFileName);
+ odebug << "openFile doclnk " + currentFileName << oendl;
if ( !fm.loadFile( f, txt ) ) {
// ####### could be a new file
- qDebug( "Cannot open file" );
+ odebug << "Cannot open file" << oendl;
}
@@ -772,3 +775,3 @@ void TextEdit::showEditTools() {
bool TextEdit::save() {
- qDebug("saveAsFile " + currentFileName);
+ odebug << "saveAsFile " + currentFileName << oendl;
if(currentFileName.isEmpty()) {
@@ -779,5 +782,5 @@ bool TextEdit::save() {
QString file = doc->file();
- qDebug("saver file "+file);
+ odebug << "saver file "+file << oendl;
QString name= doc->name();
- qDebug("File named "+name);
+ odebug << "File named "+name << oendl;
QString rt = editor->text();
@@ -788,3 +791,3 @@ bool TextEdit::save() {
currentFileName= name ;
- qDebug("saveFile "+currentFileName);
+ odebug << "saveFile "+currentFileName << oendl;
@@ -799,3 +802,3 @@ bool TextEdit::save() {
if ( !fm.saveFile( *doc, rt ) ) {
- QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
+ QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
return false;
@@ -803,3 +806,3 @@ bool TextEdit::save() {
} else {
- qDebug("regular save file");
+ odebug << "regular save file" << oendl;
QFile f(file);
@@ -810,3 +813,3 @@ bool TextEdit::save() {
QMessageBox::message(tr("Text Edit"),tr("Write Failed"));
- return false;
+ return false;
}
@@ -834,3 +837,3 @@ bool TextEdit::saveAs() {
return false;
- qDebug("saveAsFile " + currentFileName);
+ odebug << "saveAsFile " + currentFileName << oendl;
// case of nothing to save...
@@ -838,3 +841,3 @@ bool TextEdit::saveAs() {
// //|| !bFromDocView)
-// qDebug("no doc");
+// odebug << "no doc" << oendl;
// return true;
@@ -848,3 +851,3 @@ bool TextEdit::saveAs() {
QString rt = editor->text();
- qDebug(currentFileName);
+ odebug << currentFileName << oendl;
@@ -853,3 +856,3 @@ bool TextEdit::saveAs() {
|| currentFileName == tr("Text Editor")) {
- qDebug("do silly TT filename thing");
+ odebug << "do silly TT filename thing" << oendl;
// if ( doc && doc->name().isEmpty() ) {
@@ -874,3 +877,3 @@ bool TextEdit::saveAs() {
// else
-// qDebug("hmmmmmm");
+// odebug << "hmmmmmm" << oendl;
}
@@ -902,3 +905,3 @@ bool TextEdit::saveAs() {
- qDebug("saving filename "+fileNm);
+ odebug << "saving filename "+fileNm << oendl;
QFileInfo fi(fileNm);
@@ -914,3 +917,3 @@ bool TextEdit::saveAs() {
// editor->setText(rt);
- qDebug("Saving file as "+currentFileName);
+ odebug << "Saving file as "+currentFileName << oendl;
doc->setName( currentFileName);
@@ -920,3 +923,3 @@ bool TextEdit::saveAs() {
if ( !fm.saveFile( *doc, rt ) ) {
- QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
+ QMessageBox::message(tr("Text Edit"),tr("Save Failed"));
return false;
@@ -943,3 +946,3 @@ bool TextEdit::saveAs() {
}
- qDebug("returning false");
+ odebug << "returning false" << oendl;
return false;
@@ -974,5 +977,5 @@ void TextEdit::setDocument(const QString& fileref) {
currentFileName=fileref;
- qDebug("setDocument");
+ odebug << "setDocument" << oendl;
QFileInfo fi(currentFileName);
- qDebug("basename:"+fi.baseName()+": current filenmame "+currentFileName);
+ odebug << "basename:"+fi.baseName()+": current filenmame "+currentFileName << oendl;
if( (fi.baseName().left(1)).isEmpty() ) {
@@ -981,3 +984,3 @@ void TextEdit::setDocument(const QString& fileref) {
} else {
- qDebug("setDoc open");
+ odebug << "setDoc open" << oendl;
bFromDocView = true;
@@ -1036,3 +1039,3 @@ void TextEdit::changeStartConfig( bool b ) {
void TextEdit::editorChanged() {
-// qDebug("editor changed");
+// odebug << "editor changed" << oendl;
if( /*editor->edited() &&*/ /*edited && */!edited1) {
@@ -1045,5 +1048,5 @@ void TextEdit::editorChanged() {
void TextEdit::receive(const QCString&msg, const QByteArray &) {
- qDebug("QCop "+msg);
+ odebug << "QCop "+msg << oendl;
if ( msg == "setDocument(QString)" ) {
- qDebug("bugger all");
+ odebug << "bugger all" << oendl;
@@ -1131,3 +1134,3 @@ void TextEdit::timerCrank()
{
-// qDebug("autosave");
+// odebug << "autosave" << oendl;
save();
@@ -1147,3 +1150,3 @@ void TextEdit::doTimer(bool b)
{
-// qDebug("doTimer true");
+// odebug << "doTimer true" << oendl;
setTimer();
@@ -1151,3 +1154,3 @@ void TextEdit::doTimer(bool b)
// else
-// qDebug("doTimer false");
+// odebug << "doTimer false" << oendl;
}
@@ -1158,3 +1161,3 @@ if(featureAutoSave)
{
-// qDebug("setting autosave");
+// odebug << "setting autosave" << oendl;
QTimer *timer = new QTimer(this );