-rw-r--r-- | core/apps/helpbrowser/helpbrowser.cpp | 103 | ||||
-rw-r--r-- | core/apps/taboapp/main.cpp | 48 | ||||
-rw-r--r-- | core/apps/textedit/filePermissions.cpp | 2 | ||||
-rw-r--r-- | core/apps/textedit/textedit.cpp | 83 |
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 @@ -22,8 +22,13 @@ #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> #include <qtoolbar.h> @@ -32,8 +37,4 @@ #include <qaction.h> -#include <cctype> - -#include "magictextbrowser.h" - HelpBrowser::HelpBrowser( QWidget* parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ), @@ -53,5 +54,5 @@ void HelpBrowser::init( const QString& _home ) browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); connect( browser, SIGNAL( textChanged() ), - this, SLOT( textChanged() ) ); + this, SLOT( textChanged() ) ); setCentralWidget( browser ); @@ -59,5 +60,5 @@ void HelpBrowser::init( const QString& _home ) if ( !_home.isEmpty() ) - browser->setSource( _home ); + browser->setSource( _home ); QToolBar* toolbar = new QToolBar( this ); @@ -72,5 +73,5 @@ void HelpBrowser::init( const QString& _home ) connect( backAction, SIGNAL( activated() ), browser, SLOT( backward() ) ); connect( browser, SIGNAL( backwardAvailable(bool) ), - backAction, SLOT( setEnabled(bool) ) ); + backAction, SLOT( setEnabled(bool) ) ); backAction->addTo( go ); backAction->addTo( toolbar ); @@ -80,5 +81,5 @@ void HelpBrowser::init( const QString& _home ) connect( forwardAction, SIGNAL( activated() ), browser, SLOT( forward() ) ); connect( browser, SIGNAL( forwardAvailable(bool) ), - forwardAction, SLOT( setEnabled(bool) ) ); + forwardAction, SLOT( setEnabled(bool) ) ); forwardAction->addTo( go ); forwardAction->addTo( toolbar ); @@ -95,5 +96,5 @@ void HelpBrowser::init( const QString& _home ) bookm->insertSeparator(); connect( bookm, SIGNAL( activated(int) ), - this, SLOT( bookmChosen(int) ) ); + this, SLOT( bookmChosen(int) ) ); readBookmarks(); @@ -113,21 +114,21 @@ 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&)) ); } 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 ); QPEApplication::setKeepRunning(); - showMaximized(); - setActiveWindow(); - raise(); + showMaximized(); + setActiveWindow(); + raise(); } } @@ -136,5 +137,5 @@ void HelpBrowser::setDocument( const QString &doc ) { if ( !doc.isEmpty() ) - browser->setSource( doc ); + browser->setSource( doc ); raise(); } @@ -144,7 +145,7 @@ void HelpBrowser::textChanged() { if ( browser->documentTitle().isNull() ) - setCaption( tr("Help Browser") ); + setCaption( tr("Help Browser") ); else - setCaption( browser->documentTitle() ) ; + setCaption( browser->documentTitle() ) ; selectedURL = caption(); @@ -156,11 +157,11 @@ HelpBrowser::~HelpBrowser() QMap<int, Bookmark>::Iterator it2 = mBookmarks.begin(); for ( ; it2 != mBookmarks.end(); ++it2 ) - bookmarks.append( (*it2).name + "=" + (*it2).file ); + bookmarks.append( (*it2).name + "=" + (*it2).file ); QFile f2( Global::applicationFileName("helpbrowser", "bookmarks") ); if ( f2.open( IO_WriteOnly ) ) { - QDataStream s2( &f2 ); - s2 << bookmarks; - f2.close(); + QDataStream s2( &f2 ); + s2 << bookmarks; + f2.close(); } } @@ -175,22 +176,22 @@ void HelpBrowser::readBookmarks() QString file = Global::applicationFileName("helpbrowser", "bookmarks"); 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; + } } } @@ -199,5 +200,5 @@ void HelpBrowser::bookmChosen( int i ) { if ( mBookmarks.contains( i ) ) - browser->setSource( mBookmarks[ i ].file ); + browser->setSource( mBookmarks[ i ].file ); } @@ -208,9 +209,9 @@ void HelpBrowser::addBookmark() b.file = browser->source(); 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 } QMap<int, Bookmark>::Iterator it; 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; } @@ -221,8 +222,8 @@ void HelpBrowser::removeBookmark() QMap<int, Bookmark>::Iterator it = mBookmarks.begin(); 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,10 +1,14 @@ -#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> int main( int argc, char **argv ) @@ -12,5 +16,5 @@ int main( int argc, char **argv ) QPEApplication a( argc, argv ); - Opie::Ui::OTabWidget *tabwidget = new Opie::Ui::OTabWidget(0, "tab widget"); + OTabWidget *tabwidget = new OTabWidget(0, "tab widget"); QString path = QPEApplication::qpeDir() + "/plugins/app"; @@ -24,9 +28,9 @@ int main( int argc, char **argv ) QLibrary *lib = new QLibrary( path + "/" + *it ); - 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; for ( widget = list.first(); widget != 0; widget = list.next() ) @@ -34,17 +38,17 @@ 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 @@ -33,5 +33,5 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal if ( !name ) setName( tr("File Permissions") ); -// qDebug("FilePermissions "+fileName); +// odebug << "FilePermissions "+fileName << oendl; resize( 236, 210 ); setMaximumSize( QSize( 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 @@ -12,18 +12,22 @@ **********************************************************************/ // changes added by L. J. Potter Sun 02-17-2002 21:31:31 + #include "textedit.h" #include "filePermissions.h" - +/* OPIE */ +#include <opie2/odebug.h> #include <opie2/ofileselector.h> #include <opie2/ofiledialog.h> #include <opie2/ofontselector.h> - #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/qpeapplication.h> +using namespace Opie::Core; +using namespace Opie::Ui; + +/* QT */ #include <qmenubar.h> #include <qtoolbar.h> - #include <qtextstream.h> #include <qclipboard.h> @@ -34,12 +38,11 @@ #include <qtimer.h> #include <qdir.h> + +/* STD */ #include <unistd.h> #include <sys/stat.h> #include <stdlib.h> //getenv -using namespace Opie::Ui; - #if QT_VERSION < 300 - class QpeEditor : public QMultiLineEdit { @@ -412,5 +415,5 @@ TextEdit::TextEdit( QWidget *parent, const char *name, WFlags f ) TextEdit::~TextEdit() { - qWarning("textedit d'tor"); + owarn << "textedit d'tor" << oendl; delete editor; } @@ -647,5 +650,5 @@ void TextEdit::newFile( const DocLnk &f ) { doc = new DocLnk(nf); currentFileName = "Unnamed"; - qDebug("newFile "+currentFileName); + odebug << "newFile "+currentFileName << oendl; updateCaption( currentFileName); // editor->setEdited( false); @@ -656,5 +659,5 @@ void TextEdit::openDotFile( const QString &f ) { currentFileName=f; - qDebug("openFile dotfile " + currentFileName); + odebug << "openFile dotfile " + currentFileName << oendl; QString txt; QFile file(f); @@ -675,5 +678,5 @@ void TextEdit::openDotFile( const QString &f ) { void TextEdit::openFile( const QString &f ) { - qDebug("filename is "+ f); + odebug << "filename is "+ f << oendl; QString filer; QFileInfo fi( f); @@ -694,5 +697,5 @@ void TextEdit::openFile( const QString &f ) { else if(fi.baseName().left(1) == "") { - qDebug("opening dotfile"); + odebug << "opening dotfile" << oendl; currentFileName=f; openDotFile(currentFileName); @@ -722,5 +725,5 @@ void TextEdit::openFile( const QString &f ) { openFile(nf); - qDebug("openFile string "+currentFileName); + odebug << "openFile string "+currentFileName << oendl; showEditTools(); @@ -739,8 +742,8 @@ void TextEdit::openFile( const DocLnk &f ) { QString txt; 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; } // fileNew(); @@ -771,5 +774,5 @@ void TextEdit::showEditTools() { unprompted save */ bool TextEdit::save() { - qDebug("saveAsFile " + currentFileName); + odebug << "saveAsFile " + currentFileName << oendl; if(currentFileName.isEmpty()) { saveAs(); @@ -778,7 +781,7 @@ 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(); if( !rt.isEmpty() ) { @@ -787,5 +790,5 @@ bool TextEdit::save() { } else { currentFileName= name ; - qDebug("saveFile "+currentFileName); + odebug << "saveFile "+currentFileName << oendl; struct stat buf; @@ -798,9 +801,9 @@ bool TextEdit::save() { FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { - QMessageBox::message(tr("Text Edit"),tr("Save Failed")); + QMessageBox::message(tr("Text Edit"),tr("Save Failed")); return false; } } else { - qDebug("regular save file"); + odebug << "regular save file" << oendl; QFile f(file); if( f.open(IO_WriteOnly)) { @@ -809,5 +812,5 @@ bool TextEdit::save() { } else { QMessageBox::message(tr("Text Edit"),tr("Write Failed")); - return false; + return false; } @@ -833,9 +836,9 @@ bool TextEdit::saveAs() { if(caption() == tr("Text Editor")) return false; - qDebug("saveAsFile " + currentFileName); + odebug << "saveAsFile " + currentFileName << oendl; // case of nothing to save... // if ( !doc && !currentFileName.isEmpty()) { // //|| !bFromDocView) -// qDebug("no doc"); +// odebug << "no doc" << oendl; // return true; // } @@ -847,10 +850,10 @@ bool TextEdit::saveAs() { QString rt = editor->text(); - qDebug(currentFileName); + odebug << currentFileName << oendl; if( currentFileName.isEmpty() || currentFileName == tr("Unnamed") || currentFileName == tr("Text Editor")) { - qDebug("do silly TT filename thing"); + odebug << "do silly TT filename thing" << oendl; // if ( doc && doc->name().isEmpty() ) { QString pt = rt.simplifyWhiteSpace(); @@ -873,5 +876,5 @@ bool TextEdit::saveAs() { // } // else -// qDebug("hmmmmmm"); +// odebug << "hmmmmmm" << oendl; } @@ -901,5 +904,5 @@ bool TextEdit::saveAs() { QString fileNm=str; - qDebug("saving filename "+fileNm); + odebug << "saving filename "+fileNm << oendl; QFileInfo fi(fileNm); currentFileName=fi.fileName(); @@ -913,5 +916,5 @@ bool TextEdit::saveAs() { doc = new DocLnk(nf); // editor->setText(rt); - qDebug("Saving file as "+currentFileName); + odebug << "Saving file as "+currentFileName << oendl; doc->setName( currentFileName); updateCaption( currentFileName); @@ -919,5 +922,5 @@ bool TextEdit::saveAs() { FileManager fm; if ( !fm.saveFile( *doc, rt ) ) { - QMessageBox::message(tr("Text Edit"),tr("Save Failed")); + QMessageBox::message(tr("Text Edit"),tr("Save Failed")); return false; } @@ -942,5 +945,5 @@ bool TextEdit::saveAs() { return true; } - qDebug("returning false"); + odebug << "returning false" << oendl; return false; } //end saveAs @@ -973,12 +976,12 @@ void TextEdit::setDocument(const QString& fileref) { if(fileref != "Unnamed") { 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() ) { openDotFile(currentFileName); } else { - qDebug("setDoc open"); + odebug << "setDoc open" << oendl; bFromDocView = true; openFile(fileref); @@ -1035,5 +1038,5 @@ void TextEdit::changeStartConfig( bool b ) { void TextEdit::editorChanged() { -// qDebug("editor changed"); +// odebug << "editor changed" << oendl; if( /*editor->edited() &&*/ /*edited && */!edited1) { setCaption( "*"+caption()); @@ -1044,7 +1047,7 @@ 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; } @@ -1130,5 +1133,5 @@ void TextEdit::timerCrank() else { -// qDebug("autosave"); +// odebug << "autosave" << oendl; save(); } @@ -1146,9 +1149,9 @@ void TextEdit::doTimer(bool b) if(b) { -// qDebug("doTimer true"); +// odebug << "doTimer true" << oendl; setTimer(); } // else -// qDebug("doTimer false"); +// odebug << "doTimer false" << oendl; } @@ -1157,5 +1160,5 @@ void TextEdit::setTimer() if(featureAutoSave) { -// qDebug("setting autosave"); +// odebug << "setting autosave" << oendl; QTimer *timer = new QTimer(this ); connect( timer, SIGNAL(timeout()), this, SLOT(timerCrank()) ); |