Diffstat (limited to 'noncore/apps/opie-gutenbrowser/gutenbrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 153 |
1 files changed, 79 insertions, 74 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index 2a9a71e..be2b897 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp @@ -16,9 +16,3 @@ // donate@gutenberg.net -#include <qpe/qpeapplication.h> -#include <qpe/fontdatabase.h> -#include <qpe/config.h> -#include <qpe/qcopenvelope_qws.h> -#include <qpe/mimetype.h> -#include <qpe/resource.h> -#include <qpe/applnk.h> + @@ -35,3 +29,13 @@ +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> +#include <qpe/fontdatabase.h> +#include <qpe/config.h> +#include <qpe/qcopenvelope_qws.h> +#include <qpe/mimetype.h> +#include <qpe/resource.h> +#include <qpe/applnk.h> +/* QT */ #include <qregexp.h> @@ -53,2 +57,3 @@ +/* STD */ #include <stdio.h> @@ -133,3 +138,3 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) if( index != -1) { - // qDebug( tempTitle); + // odebug << tempTitle << oendl; bookmarksMenu->insertItem( tempTitle); @@ -156,3 +161,3 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) for (int i=1;i< qApp->argc();i++) { - qDebug("Suppose we open somethin"); + odebug << "Suppose we open somethin" << oendl; load(qApp->argv()[i]); @@ -171,3 +176,3 @@ Gutenbrowser::~Gutenbrowser() { // QPEApplication::ungrabKeyboard(); - qDebug("Exit"); + odebug << "Exit" << oendl; } @@ -201,3 +206,3 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { filename+="etc/gutenbrowser/"; - qDebug("filename "+filename); + odebug << "filename "+filename << oendl; // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; @@ -209,3 +214,3 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { QString brow = config.readEntry("Preferred", "Opera"); - qDebug("Preferred browser is "+brow); + odebug << "Preferred browser is "+brow << oendl; if(!showMsg) { //if we just get the gutenindex.all @@ -213,3 +218,3 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { chdir(local_library); - qDebug("Issuing the system command: %s", cmd.latin1()); + odebug << "Issuing the system command: " << cmd << "" << oendl; @@ -225,3 +230,3 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { fp = popen( (const char *) cmd, "r"); - // qDebug("Issuing the command\n"+cmd); + // odebug << "Issuing the command\n"+cmd << oendl; // system(cmd); @@ -258,3 +263,3 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { chdir(local_library); - qDebug("Issuing the sys command: %s", cmd.latin1()); + odebug << "Issuing the sys command: " << cmd << "" << oendl; system(cmd); @@ -268,3 +273,3 @@ void Gutenbrowser::toggleButtonIcons( bool useEm) { pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; - qDebug("Docdir is "+QPEApplication::documentDir()); + odebug << "Docdir is "+QPEApplication::documentDir() << oendl; @@ -383,3 +388,3 @@ void Gutenbrowser::SearchBtn() { if( loadCheck) { - qDebug("loadCheck: we have a loaded doc"); + odebug << "loadCheck: we have a loaded doc" << oendl; Search(); @@ -406,3 +411,3 @@ void Gutenbrowser::ForwardBtn() { Lview->insertLine( s, -1); - // qDebug(s); + // odebug << s << oendl; currentLine++; @@ -425,3 +430,3 @@ void Gutenbrowser::ForwardBtn() { } else { - // qDebug("bal"); + // odebug << "bal" << oendl; // if( i_pageNum != pages) { @@ -440,3 +445,3 @@ void Gutenbrowser::ForwardBtn() { - // qDebug("page number %d line number %d", i_pageNum, currentLine); + // odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; } @@ -459,3 +464,3 @@ void Gutenbrowser::BackBtn() { if(!f.at( pageStopArray[i_pageNum - 1] )) - qDebug("File positioned backward did not work"); + odebug << "File positioned backward did not work" << oendl; } @@ -515,3 +520,3 @@ void Gutenbrowser::TopBtn() { if( i_pageNum != 0) { - qDebug("top"); + odebug << "top" << oendl; qApp->processEvents(); @@ -573,3 +578,3 @@ void Gutenbrowser::BeginBtn() { pageStopArray[i_pageNum ] = currentFilePos; - // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos); + // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; } @@ -577,3 +582,3 @@ void Gutenbrowser::BeginBtn() { if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { - qDebug("<<<<<< FOUND IT!! new page number %d, found at %d", i_pageNum, currentFilePos); + odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; break; @@ -623,3 +628,3 @@ void Gutenbrowser::setBookmark() { qApp->processEvents(); - qDebug("Settingbook mark "+file_name); + odebug << "Settingbook mark "+file_name << oendl; @@ -627,3 +632,3 @@ void Gutenbrowser::setBookmark() { title=cfg.readEntry(file_name,""); - qDebug("title is "+ title); + odebug << "title is "+ title << oendl; @@ -656,3 +661,3 @@ void Gutenbrowser::Bookmark( int itemId) { - // qDebug("<<<<<< %d, %d", Lview->PageSize(), Lview->lastRow() - Lview->topRow() ); + // odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl; @@ -660,3 +665,3 @@ void Gutenbrowser::Bookmark( int itemId) { - qDebug("menu item %d", itemId); + odebug << "menu item " << itemId << "" << oendl; QString tempTitle; @@ -702,3 +707,3 @@ void Gutenbrowser::Bookmark( int itemId) { pageStopArray[i_pageNum ] = currentFilePos; - // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos); + // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; } @@ -731,3 +736,3 @@ void Gutenbrowser::Bookmark( int itemId) { - qDebug("bookmark loaded"); + odebug << "bookmark loaded" << oendl; setCaption(title); @@ -739,4 +744,4 @@ bool Gutenbrowser::load( const char *fileName) { // QCopEnvelope ( "QPE/System", "busy()" ); - // qDebug("Title is already set as "+title); - qDebug("sizeHint %d pageSize %d", sizeHint().height(),Lview->PageSize() ); + // odebug << "Title is already set as "+title << oendl; + odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; if( Lview->PageSize() < 4) { @@ -746,3 +751,3 @@ bool Gutenbrowser::load( const char *fileName) { pointSize = Lview->fontInfo().pointSize(); - qDebug("sizeHint %d point size %d", sizeHint().height(), pointSize); + odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; if(pointSize < 10) @@ -764,3 +769,3 @@ bool Gutenbrowser::load( const char *fileName) { // } - qDebug("ready to open "+o_file); + odebug << "ready to open "+o_file << oendl; @@ -800,3 +805,3 @@ bool Gutenbrowser::load( const char *fileName) { Lview->setMaxLines(Lview->PageSize()*2); - qDebug("Gulped %d", currentLine); + odebug << "Gulped " << currentLine << "" << oendl; setCaption(title); @@ -807,3 +812,3 @@ bool Gutenbrowser::load( const char *fileName) { // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; - //qDebug("number of pages %d", pages); + //odebug << "number of pages " << pages << "" << oendl; @@ -824,3 +829,3 @@ void Gutenbrowser::Search() { { - qDebug("Starting search dialog"); + odebug << "Starting search dialog" << oendl; searchDlg = new SearchDialog( this, "Etext Search", true); @@ -960,5 +965,5 @@ void Gutenbrowser::LibraryBtn() { QString zipFile; - // qDebug("Local Library is %s ", local_library.latin1()); + // odebug << "Local Library is " << local_library << " " << oendl; zipFile="/usr/bin/unzip"; - // qDebug("newestLibraryFile is %s ", newestLibraryFile.latin1()); + // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl; if( QFile::exists( local_library+newestLibraryFile)) { @@ -991,3 +996,3 @@ void Gutenbrowser::LibraryBtn() { file_name = LibraryDlg->File_Name; - // qDebug("title is being set as "+title); + // odebug << "title is being set as "+title << oendl; title = listItemTitle; @@ -1013,3 +1018,3 @@ void Gutenbrowser::LibraryBtn() { { - qDebug("Found zip file\n"); + odebug << "Found zip file\n" << oendl; // QStringList args; @@ -1021,3 +1026,3 @@ void Gutenbrowser::LibraryBtn() { QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library; - qDebug("Issuing the command "+ cmd); + odebug << "Issuing the command "+ cmd << oendl; // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! @@ -1064,3 +1069,3 @@ void Gutenbrowser::OpenBtn() { title = OpenDlg->openFileTitle; - qDebug("title open as "+title); + odebug << "title open as "+title << oendl; file_name = OpenDlg->file; @@ -1071,3 +1076,3 @@ void Gutenbrowser::OpenBtn() { showMainList=FALSE; - qDebug("ShowMainList is now false"); + odebug << "ShowMainList is now false" << oendl; mainList->hide(); @@ -1080,3 +1085,3 @@ void Gutenbrowser::OpenBtn() { } else { - qDebug("file_name is empty!"); + odebug << "file_name is empty!" << oendl; if(showMainList) { @@ -1246,3 +1251,3 @@ bool Gutenbrowser::getTitle( const char *file ) { title = config.readEntry(ramble, ""); - // qDebug("(getTitle)title is being set as "+title); + // odebug << "(getTitle)title is being set as "+title << oendl; } @@ -1448,3 +1453,3 @@ void Gutenbrowser::keyPressEvent( QKeyEvent *e) { void Gutenbrowser::resizeEvent( QResizeEvent *ev) { - // qDebug("resize: %d,%d\n",ev->size().width(),ev->size().height()); + // odebug << "resize: " << ev->size().width() << "," << ev->size().height() << "\n" << oendl; @@ -1478,3 +1483,3 @@ void Gutenbrowser::doOptions() { - qDebug("writing library config"); + odebug << "writing library config" << oendl; Config config("Gutenbrowser"); @@ -1495,3 +1500,3 @@ void Gutenbrowser::doOptions() { system(cmd); - qDebug("Making new dir "+cmd); + odebug << "Making new dir "+cmd << oendl; if(Ddir.right(1)!="/") { @@ -1511,3 +1516,3 @@ void Gutenbrowser::doOptions() { if(optDlg->fontDlg-> changedFonts) { - qDebug("Setting font"); + odebug << "Setting font" << oendl; myFont=optDlg->fontDlg->selectedFont; @@ -1517,3 +1522,3 @@ void Gutenbrowser::doOptions() { if(optDlg->useWordWrap_CheckBox->isChecked() ) { - qDebug("WORD WRAP is set"); + odebug << "WORD WRAP is set" << oendl; Lview->setWordWrap(QMultiLineEdit::WidgetWidth); @@ -1521,3 +1526,3 @@ void Gutenbrowser::doOptions() { } else { - qDebug("Word wrap is NOT set"); + odebug << "Word wrap is NOT set" << oendl; Lview->setWordWrap(QMultiLineEdit::NoWrap); @@ -1580,4 +1585,4 @@ void Gutenbrowser::OnNetworkDialog( const QString &/*networkUrl*/, const QString { - // qDebug(networkUrl); - // qDebug(output); + // odebug << networkUrl << oendl; + // odebug << output << oendl; // #ifndef Q_WS_QWS @@ -1714,3 +1719,3 @@ void Gutenbrowser::cleanUp( ) QPEApplication::ungrabKeyboard(); - // qDebug("Cleanup"); + // odebug << "Cleanup" << oendl; if(f.isOpen()) f.close(); @@ -1720,3 +1725,3 @@ void Gutenbrowser::fixKeys() { - qDebug("Attempting to fix keys"); + odebug << "Attempting to fix keys" << oendl; @@ -1774,3 +1779,3 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { QString file = config.readEntry(temp, ""); - qDebug("About to load"); + odebug << "About to load" << oendl; if( Lview->isVisible()) @@ -1815,3 +1820,3 @@ void Gutenbrowser::setDocument(const QString & frozenBoogers) { lnk = DocLnk(frozenBoogers); - // qDebug(lnk.file() ); + // odebug << lnk.file() << oendl; title=lnk.comment(); @@ -1819,3 +1824,3 @@ void Gutenbrowser::setDocument(const QString & frozenBoogers) { this->show(); - // qDebug(title); + // odebug << title << oendl; // qApp->processEvents(); @@ -1875,3 +1880,3 @@ void Gutenbrowser::menuEditTitle() QString title_text = mainList->text( currentItem); - //qDebug("Selected "+title_text); + //odebug << "Selected "+title_text << oendl; @@ -1889,6 +1894,6 @@ void Gutenbrowser::menuEditTitle() QString file_title = config.readEntry( s_filename, ""); - //qDebug("file_title is "+file_title); + //odebug << "file_title is "+file_title << oendl; if(title_text == file_title ) { // selFile = s_filename; - //qDebug("Edit: "+ file_title ); + //odebug << "Edit: "+ file_title << oendl; i=i_numofFiles+1; @@ -1897,3 +1902,3 @@ void Gutenbrowser::menuEditTitle() if(titleEdit->exec() !=0) { - //qDebug(titleEdit->newTitle); + //odebug << titleEdit->newTitle << oendl; config.writeEntry( s_filename, titleEdit->newTitle); @@ -1913,3 +1918,3 @@ void Gutenbrowser::menuEditTitle() bool Gutenbrowser::UnZipIt(const QString &zipFile) { - qDebug(zipFile); + odebug << zipFile << oendl; #ifndef Q_WS_QWS @@ -1925,3 +1930,3 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { // } - // qDebug((const char*)local_library.latin1()); + // odebug << (const char*)local_library.latin1() << oendl; QString cmd; @@ -1929,3 +1934,3 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { if( chdir((const char*)local_library.latin1())!=0) - qDebug("chdir failed."); + odebug << "chdir failed." << oendl; cmd = "gunzip -S .zip " + local_library+zipFile; @@ -1935,3 +1940,3 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { if( chdir((const char*)local_library.latin1())!=0) - qDebug("chdir failed."); + odebug << "chdir failed." << oendl; cmd = "unzip " + local_library+zipFile; @@ -1944,3 +1949,3 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { #if defined(_WS_X11_)// - qDebug("Issuing the command "+cmd); + odebug << "Issuing the command "+cmd << oendl; system( cmd); @@ -1950,6 +1955,6 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { if( rename("pgwhole","PGWHOLE.TXT") !=0) - qDebug("rename failed"); + odebug << "rename failed" << oendl; } else { if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) - qDebug("rename failed"); + odebug << "rename failed" << oendl; } @@ -1957,3 +1962,3 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { #ifdef Q_WS_QWS - qDebug("Issuing the command "+cmd); + odebug << "Issuing the command "+cmd << oendl; system( cmd); @@ -1963,6 +1968,6 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { if( rename("pgwhole","PGWHOLE.TXT") !=0) - qDebug("rename failed"); + odebug << "rename failed" << oendl; } else { if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) - qDebug("rename failed"); + odebug << "rename failed" << oendl; } @@ -1973,3 +1978,3 @@ bool Gutenbrowser::UnZipIt(const QString &zipFile) { else if(exit==QMessageBox::No) { - // qDebug("unzip"); + // odebug << "unzip" << oendl; return false; |