Diffstat (limited to 'noncore/apps/opie-gutenbrowser/LibraryDialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 92 |
1 files changed, 48 insertions, 44 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 5b22b00..270a4cf 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp @@ -14,15 +14,19 @@ //ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL +#include "LibraryDialog.h" +#include "output.h" + +/* OPIE */ #include <qpe/applnk.h> #include <qpe/qpeapplication.h> #include <qpe/qpedialog.h> +#include <opie2/odebug.h> -#include "LibraryDialog.h" -#include "output.h" - +/* QT */ #include <qpushbutton.h> #include <qmultilineedit.h> //#include <qlayout.h> +/* STD */ #include <unistd.h> #include <stdio.h> @@ -65,5 +69,5 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W config.setGroup( "FTPsite" ); ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); - qDebug("Library Dialog: ftp_host is "+ftp_host); + odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); // ftp_host=ftp_host.stripWhiteSpace(); @@ -78,5 +82,5 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W config.setGroup("General"); downDir =config.readEntry( "DownloadDirectory",local_library); - qDebug("downDir is "+downDir); + odebug << "downDir is "+downDir << oendl; newindexLib.setName( old_index); indexLib.setName( old_index); @@ -100,5 +104,5 @@ void LibraryDialog::Newlibrary() { #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files - //qDebug("Opening new library index %s",newindexLib); + //odebug << "Opening new library index " << newindexLib << "" << oendl; if ( newindexLib.open( IO_ReadOnly) ) { setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully @@ -122,5 +126,5 @@ void LibraryDialog::Newlibrary() author = author.stripWhiteSpace(); if (authBox->isChecked()) { // this reverses the first name and last name of the author - // qDebug("Sorting last name first"); + // odebug << "Sorting last name first" << oendl; QString lastName, firstName=""; int finder=author.findRev( ' ', -1, TRUE); @@ -181,5 +185,5 @@ void LibraryDialog::Library() ListView5->clear(); - qDebug("opening GUTINDEX.ALL file"); + odebug << "opening GUTINDEX.ALL file" << oendl; IDontKnowWhy = ""; if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully @@ -201,5 +205,5 @@ void LibraryDialog::Library() if( file.find("]",0,TRUE) != -1) file = file.left( file.find("]",0,TRUE)); - //qDebug("file is "+file); + //odebug << "file is "+file << oendl; /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); number = indexLine.mid(55,5); @@ -208,8 +212,8 @@ void LibraryDialog::Library() title = indexLine.mid( 9, 50 ); title = title.stripWhiteSpace(); - //qDebug("title is "+title); + //odebug << "title is "+title << oendl; getAuthor(); // grok author author = author.stripWhiteSpace(); - //qDebug("author is "+author); + //odebug << "author is "+author << oendl; if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author QString lastName, firstName=""; @@ -398,6 +402,6 @@ void LibraryDialog::select_title( QListViewItem * item) // DlglistItemNumber = item->text(0); item = 0; - qDebug( "string from librarydialog is:%s %s %s", DlglistItemYear.latin1(),DlglistItemFile.latin1(),DlglistItemNumber.latin1()); - qDebug("Title is "+DlglistItemTitle); + odebug << "string from librarydialog is:" << DlglistItemYear << " " << DlglistItemFile << " " << DlglistItemNumber << "" << oendl; + odebug << "Title is "+DlglistItemTitle << oendl; // check for connection here @@ -405,5 +409,5 @@ void LibraryDialog::select_title( QListViewItem * item) if(download_Etext()) { - // qDebug("get here 2"); + // odebug << "get here 2" << oendl; if(i_binary == 1) { @@ -424,5 +428,5 @@ bool LibraryDialog::download_Etext() ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); - qDebug("about to network dialog"); + odebug << "about to network dialog" << oendl; QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; @@ -432,9 +436,9 @@ bool LibraryDialog::download_Etext() if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); - qDebug("NewlistItemFile is now "+NewlistItemFile); + odebug << "NewlistItemFile is now "+NewlistItemFile << oendl; } NewlistItemYear = DlglistItemYear.right(2); int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); - qDebug(NewlistItemYear); + odebug << NewlistItemYear << oendl; if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { NewlistItemYear = "90"; @@ -448,6 +452,6 @@ bool LibraryDialog::download_Etext() outputFile=local_library+".guten_temp"; - //qDebug("Download file:%s",NewlistItemFile.latin1() ); - qDebug("Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile); + //odebug << "Download file:" << NewlistItemFile << "" << oendl; + odebug << "Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile << oendl; QStringList networkList; networkList.append((const char *)ftp_host); @@ -463,16 +467,16 @@ bool LibraryDialog::download_Etext() if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer File_Name= NetworkDlg->localFileName; - qDebug("back to Library from Network Dialog"); - qDebug("Just downloaded "+NetworkDlg->localFileName); + odebug << "back to Library from Network Dialog" << oendl; + odebug << "Just downloaded "+NetworkDlg->localFileName << oendl; // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found // QString oldName=File_Name; // File_Name.replace(0,local_library.length(),downDir); - // qDebug("File_Name now is "+File_Name); + // odebug << "File_Name now is "+File_Name << oendl; // } // rename .txt to .etx if(NetworkDlg->successDownload) { - qDebug("Filename is "+File_Name); + odebug << "Filename is "+File_Name << oendl; if(File_Name.right(4)==".txt") { QString s_fileName=File_Name; @@ -482,5 +486,5 @@ bool LibraryDialog::download_Etext() File_Name=s_fileName; - qDebug("Filename is now "+File_Name); + odebug << "Filename is now "+File_Name << oendl; } @@ -491,12 +495,12 @@ bool LibraryDialog::download_Etext() name_file=name_file.left(name_file.length()-4); - qDebug("Setting doclink"); + odebug << "Setting doclink" << oendl; DocLnk lnk; - qDebug("name is "+name_file); + odebug << "name is "+name_file << oendl; lnk.setName(name_file); //sets file name - qDebug("Title is "+DlglistItemTitle); + odebug << "Title is "+DlglistItemTitle << oendl; lnk.setComment(DlglistItemTitle); - qDebug("Filename is "+File_Name); + odebug << "Filename is "+File_Name << oendl; lnk.setFile(File_Name); //sets File property lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D @@ -504,5 +508,5 @@ bool LibraryDialog::download_Etext() lnk.setIcon("gutenbrowser/Gutenbrowser"); if(!lnk.writeLink()) { - qDebug("Writing doclink did not work"); + odebug << "Writing doclink did not work" << oendl; } else { } @@ -571,6 +575,6 @@ bool LibraryDialog::setTitle() { Config config("Gutenbrowser"); - qDebug("setting title"); - qDebug(DlglistItemTitle); + odebug << "setting title" << oendl; + odebug << DlglistItemTitle << oendl; if( DlglistItemTitle.find("[",0,TRUE) != -1) @@ -578,5 +582,5 @@ bool LibraryDialog::setTitle() if( DlglistItemTitle.find("]",0,TRUE) !=-1) DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); - qDebug("Title being set is "+DlglistItemTitle); + odebug << "Title being set is "+DlglistItemTitle << oendl; int test = 0; QString ramble, temp; @@ -739,5 +743,5 @@ void LibraryDialog::onButtonSearch() if( SearchResultsDialog->exec() != 0) { texter = SearchResultsDialog->selText; - // qDebug(texter); + // odebug << texter << oendl; resultLs= SearchResultsDialog->resultsList; i_berger = 1; @@ -750,5 +754,5 @@ void LibraryDialog::onButtonSearch() for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { texter.sprintf("%s \n",(*it).latin1()); - // qDebug(texter); + // odebug << texter << oendl; if( tester!=texter) parseSearchResults( texter); @@ -807,5 +811,5 @@ void LibraryDialog::parseSearchResults( QString resultStr) // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No); // if (exit==QMessageBox::Yes) { - // qDebug("Issuing the command "+cmd); + // odebug << "Issuing the command "+cmd << oendl; // #if defined(_WS_WIN_) // WinExec( cmd, SW_HIDE ); @@ -841,5 +845,5 @@ void LibraryDialog::sort() bool LibraryDialog::getItem(QListViewItem *it) { - // qDebug("selected getItem"); + // odebug << "selected getItem" << oendl; // DlglistItemNumber = it->text(0); @@ -859,5 +863,5 @@ bool LibraryDialog::getItem(QListViewItem *it) bool LibraryDialog::onButtonDownload() { - // qDebug("selected onButtonDownloadz"); + // odebug << "selected onButtonDownloadz" << oendl; QListViewItemIterator it1( ListView1 ); @@ -901,5 +905,5 @@ bool LibraryDialog::onButtonDownload() void LibraryDialog::comboSelect(int index) { - // qDebug("we are sorting"); + // odebug << "we are sorting" << oendl; ListView1->setSorting( index, TRUE); ListView2->setSorting( index, TRUE); @@ -931,5 +935,5 @@ void LibraryDialog::newList() if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { - qDebug("changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser"); + odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; @@ -952,5 +956,5 @@ void LibraryDialog::newList() if ( !fp ) { } else { - qDebug("Issuing the command\n"+cmd); + odebug << "Issuing the command\n"+cmd << oendl; // system(cmd); while ( fgets( line, sizeof line, fp)) { @@ -966,5 +970,5 @@ void LibraryDialog::newList() // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) - // qDebug("renaming error"); + // odebug << "renaming error" << oendl; // } @@ -1025,5 +1029,5 @@ bool LibraryDialog::moreInfo() item=0; if(titleString.length()>2) { - qDebug( "Title is "+titleString ); + odebug << "Title is "+titleString << oendl; titleString.replace( QRegExp("\\s"), "%20"); titleString.replace( QRegExp("'"), "%20"); @@ -1049,10 +1053,10 @@ void LibraryDialog::FindLibrary() newindexLib.setName( new_index); indexLib.setName( new_index); - qDebug("index file is "+ new_index); + odebug << "index file is "+ new_index << oendl; Newlibrary(); } else { newindexLib.setName( old_index); indexLib.setName( old_index); - qDebug("new index nameis "+ old_index); + odebug << "new index nameis "+ old_index << oendl; Library(); } |