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 | |||
@@ -10,23 +10,27 @@ | |||
10 | // * it under the terms of the GNU General Public License as published by * | 10 | // * it under the terms of the GNU General Public License as published by * |
11 | // * the Free Software Foundation; either version 2 of the License, or * | 11 | // * the Free Software Foundation; either version 2 of the License, or * |
12 | // * (at your option) any later version. * | 12 | // * (at your option) any later version. * |
13 | // ***************************************************************************/ | 13 | // ***************************************************************************/ |
14 | //ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL | 14 | //ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL |
15 | 15 | ||
16 | #include "LibraryDialog.h" | ||
17 | #include "output.h" | ||
18 | |||
19 | /* OPIE */ | ||
16 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
17 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/qpedialog.h> | 22 | #include <qpe/qpedialog.h> |
23 | #include <opie2/odebug.h> | ||
19 | 24 | ||
20 | #include "LibraryDialog.h" | 25 | /* QT */ |
21 | #include "output.h" | ||
22 | |||
23 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
24 | #include <qmultilineedit.h> | 27 | #include <qmultilineedit.h> |
25 | //#include <qlayout.h> | 28 | //#include <qlayout.h> |
26 | 29 | ||
30 | /* STD */ | ||
27 | #include <unistd.h> | 31 | #include <unistd.h> |
28 | #include <stdio.h> | 32 | #include <stdio.h> |
29 | #include <stdlib.h> | 33 | #include <stdlib.h> |
30 | 34 | ||
31 | /* | 35 | /* |
32 | * The dialog will by default be modeless, unless you set 'modal' to | 36 | * The dialog will by default be modeless, unless you set 'modal' to |
@@ -61,26 +65,26 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W | |||
61 | 65 | ||
62 | config.setGroup( "HttpServer" ); | 66 | config.setGroup( "HttpServer" ); |
63 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); | 67 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); |
64 | 68 | ||
65 | config.setGroup( "FTPsite" ); | 69 | config.setGroup( "FTPsite" ); |
66 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); | 70 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); |
67 | qDebug("Library Dialog: ftp_host is "+ftp_host); | 71 | odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; |
68 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 72 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
69 | // ftp_host=ftp_host.stripWhiteSpace(); | 73 | // ftp_host=ftp_host.stripWhiteSpace(); |
70 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); | 74 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); |
71 | 75 | ||
72 | i_binary = 0; | 76 | i_binary = 0; |
73 | 77 | ||
74 | config.setGroup("SortAuth"); | 78 | config.setGroup("SortAuth"); |
75 | if( config.readEntry("authSort", "FALSE") == "TRUE") | 79 | if( config.readEntry("authSort", "FALSE") == "TRUE") |
76 | authBox->setChecked(TRUE); | 80 | authBox->setChecked(TRUE); |
77 | 81 | ||
78 | config.setGroup("General"); | 82 | config.setGroup("General"); |
79 | downDir =config.readEntry( "DownloadDirectory",local_library); | 83 | downDir =config.readEntry( "DownloadDirectory",local_library); |
80 | qDebug("downDir is "+downDir); | 84 | odebug << "downDir is "+downDir << oendl; |
81 | newindexLib.setName( old_index); | 85 | newindexLib.setName( old_index); |
82 | indexLib.setName( old_index); | 86 | indexLib.setName( old_index); |
83 | 87 | ||
84 | new QPEDialogListener(this); | 88 | new QPEDialogListener(this); |
85 | } | 89 | } |
86 | 90 | ||
@@ -96,13 +100,13 @@ LibraryDialog::~LibraryDialog() | |||
96 | } | 100 | } |
97 | 101 | ||
98 | /*This groks using PGWHOLE.TXT */ | 102 | /*This groks using PGWHOLE.TXT */ |
99 | void LibraryDialog::Newlibrary() | 103 | void LibraryDialog::Newlibrary() |
100 | { | 104 | { |
101 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files | 105 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files |
102 | //qDebug("Opening new library index %s",newindexLib); | 106 | //odebug << "Opening new library index " << newindexLib << "" << oendl; |
103 | if ( newindexLib.open( IO_ReadOnly) ) { | 107 | if ( newindexLib.open( IO_ReadOnly) ) { |
104 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully | 108 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully |
105 | QTextStream indexStream( &newindexLib ); | 109 | QTextStream indexStream( &newindexLib ); |
106 | QString indexLine; | 110 | QString indexLine; |
107 | while ( !indexStream.atEnd() ) { // until end of file.. | 111 | while ( !indexStream.atEnd() ) { // until end of file.. |
108 | indexLine = indexStream.readLine(); | 112 | indexLine = indexStream.readLine(); |
@@ -118,13 +122,13 @@ void LibraryDialog::Newlibrary() | |||
118 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 122 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
119 | title = title.stripWhiteSpace(); | 123 | title = title.stripWhiteSpace(); |
120 | 124 | ||
121 | getAuthor(); // groks author | 125 | getAuthor(); // groks author |
122 | author = author.stripWhiteSpace(); | 126 | author = author.stripWhiteSpace(); |
123 | if (authBox->isChecked()) { // this reverses the first name and last name of the author | 127 | if (authBox->isChecked()) { // this reverses the first name and last name of the author |
124 | // qDebug("Sorting last name first"); | 128 | // odebug << "Sorting last name first" << oendl; |
125 | QString lastName, firstName=""; | 129 | QString lastName, firstName=""; |
126 | int finder=author.findRev( ' ', -1, TRUE); | 130 | int finder=author.findRev( ' ', -1, TRUE); |
127 | lastName=author.right( author.length()-finder); | 131 | lastName=author.right( author.length()-finder); |
128 | firstName=author.left(finder); | 132 | firstName=author.left(finder); |
129 | lastName=lastName.stripWhiteSpace(); | 133 | lastName=lastName.stripWhiteSpace(); |
130 | firstName=firstName.stripWhiteSpace(); | 134 | firstName=firstName.stripWhiteSpace(); |
@@ -177,13 +181,13 @@ void LibraryDialog::Library() | |||
177 | ListView1->clear(); | 181 | ListView1->clear(); |
178 | ListView2->clear(); | 182 | ListView2->clear(); |
179 | ListView3->clear(); | 183 | ListView3->clear(); |
180 | ListView4->clear(); | 184 | ListView4->clear(); |
181 | ListView5->clear(); | 185 | ListView5->clear(); |
182 | 186 | ||
183 | qDebug("opening GUTINDEX.ALL file"); | 187 | odebug << "opening GUTINDEX.ALL file" << oendl; |
184 | IDontKnowWhy = ""; | 188 | IDontKnowWhy = ""; |
185 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully | 189 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully |
186 | QTextStream indexStream( &indexLib ); | 190 | QTextStream indexStream( &indexLib ); |
187 | QString indexLine; | 191 | QString indexLine; |
188 | qApp->processEvents(); | 192 | qApp->processEvents(); |
189 | // int jig; | 193 | // int jig; |
@@ -197,23 +201,23 @@ void LibraryDialog::Library() | |||
197 | // title = indexLine.mid( 9, 50); | 201 | // title = indexLine.mid( 9, 50); |
198 | file = indexLine.mid(60,12); | 202 | file = indexLine.mid(60,12); |
199 | if(file.left(1).find("[",0,TRUE) != -1) | 203 | if(file.left(1).find("[",0,TRUE) != -1) |
200 | file.remove(1,1); | 204 | file.remove(1,1); |
201 | if( file.find("]",0,TRUE) != -1) | 205 | if( file.find("]",0,TRUE) != -1) |
202 | file = file.left( file.find("]",0,TRUE)); | 206 | file = file.left( file.find("]",0,TRUE)); |
203 | //qDebug("file is "+file); | 207 | //odebug << "file is "+file << oendl; |
204 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 208 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
205 | number = indexLine.mid(55,5); | 209 | number = indexLine.mid(55,5); |
206 | number = number.stripWhiteSpace(); | 210 | number = number.stripWhiteSpace(); |
207 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 211 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
208 | title = indexLine.mid( 9, 50 ); | 212 | title = indexLine.mid( 9, 50 ); |
209 | title = title.stripWhiteSpace(); | 213 | title = title.stripWhiteSpace(); |
210 | //qDebug("title is "+title); | 214 | //odebug << "title is "+title << oendl; |
211 | getAuthor(); // grok author | 215 | getAuthor(); // grok author |
212 | author = author.stripWhiteSpace(); | 216 | author = author.stripWhiteSpace(); |
213 | //qDebug("author is "+author); | 217 | //odebug << "author is "+author << oendl; |
214 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author | 218 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author |
215 | QString lastName, firstName=""; | 219 | QString lastName, firstName=""; |
216 | int finder=author.findRev( ' ', -1, TRUE); | 220 | int finder=author.findRev( ' ', -1, TRUE); |
217 | lastName=author.right( author.length()-finder); | 221 | lastName=author.right( author.length()-finder); |
218 | firstName=author.left(finder); | 222 | firstName=author.left(finder); |
219 | lastName=lastName.stripWhiteSpace(); | 223 | lastName=lastName.stripWhiteSpace(); |
@@ -394,20 +398,20 @@ void LibraryDialog::select_title( QListViewItem * item) | |||
394 | }; | 398 | }; |
395 | } | 399 | } |
396 | 400 | ||
397 | if(DlglistItemTitle.length()>2) { | 401 | if(DlglistItemTitle.length()>2) { |
398 | // DlglistItemNumber = item->text(0); | 402 | // DlglistItemNumber = item->text(0); |
399 | item = 0; | 403 | item = 0; |
400 | qDebug( "string from librarydialog is:%s %s %s", DlglistItemYear.latin1(),DlglistItemFile.latin1(),DlglistItemNumber.latin1()); | 404 | odebug << "string from librarydialog is:" << DlglistItemYear << " " << DlglistItemFile << " " << DlglistItemNumber << "" << oendl; |
401 | qDebug("Title is "+DlglistItemTitle); | 405 | odebug << "Title is "+DlglistItemTitle << oendl; |
402 | 406 | ||
403 | // check for connection here | 407 | // check for connection here |
404 | // if( get_extext()) | 408 | // if( get_extext()) |
405 | 409 | ||
406 | if(download_Etext()) { | 410 | if(download_Etext()) { |
407 | // qDebug("get here 2"); | 411 | // odebug << "get here 2" << oendl; |
408 | if(i_binary == 1) { | 412 | if(i_binary == 1) { |
409 | 413 | ||
410 | } | 414 | } |
411 | if(checkBox->isChecked () ) { | 415 | if(checkBox->isChecked () ) { |
412 | accept(); | 416 | accept(); |
413 | } | 417 | } |
@@ -420,38 +424,38 @@ bool LibraryDialog::download_Etext() | |||
420 | // might have to use old gpl'd ftp for embedded!! | 424 | // might have to use old gpl'd ftp for embedded!! |
421 | Config cfg("Gutenbrowser"); | 425 | Config cfg("Gutenbrowser"); |
422 | cfg.setGroup("FTPsite"); | 426 | cfg.setGroup("FTPsite"); |
423 | ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); | 427 | ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); |
424 | ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); | 428 | ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); |
425 | 429 | ||
426 | qDebug("about to network dialog"); | 430 | odebug << "about to network dialog" << oendl; |
427 | QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; | 431 | QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; |
428 | 432 | ||
429 | //////////////////// FIXME- if 'x' is part of real name.... | 433 | //////////////////// FIXME- if 'x' is part of real name.... |
430 | NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE)); | 434 | NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE)); |
431 | 435 | ||
432 | if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { | 436 | if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { |
433 | NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); | 437 | NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); |
434 | qDebug("NewlistItemFile is now "+NewlistItemFile); | 438 | odebug << "NewlistItemFile is now "+NewlistItemFile << oendl; |
435 | } | 439 | } |
436 | NewlistItemYear = DlglistItemYear.right(2); | 440 | NewlistItemYear = DlglistItemYear.right(2); |
437 | int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); | 441 | int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); |
438 | qDebug(NewlistItemYear); | 442 | odebug << NewlistItemYear << oendl; |
439 | if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { | 443 | if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { |
440 | NewlistItemYear = "90"; | 444 | NewlistItemYear = "90"; |
441 | } | 445 | } |
442 | Edir ="etext" +NewlistItemYear; | 446 | Edir ="etext" +NewlistItemYear; |
443 | dir= ftp_base_dir + "/etext" +NewlistItemYear+"/"; | 447 | dir= ftp_base_dir + "/etext" +NewlistItemYear+"/"; |
444 | if( ftp_base_dir.find("=",0,true) ) | 448 | if( ftp_base_dir.find("=",0,true) ) |
445 | ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1); | 449 | ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1); |
446 | 450 | ||
447 | networkUrl= "ftp://"+ftp_host+dir; | 451 | networkUrl= "ftp://"+ftp_host+dir; |
448 | 452 | ||
449 | outputFile=local_library+".guten_temp"; | 453 | outputFile=local_library+".guten_temp"; |
450 | //qDebug("Download file:%s",NewlistItemFile.latin1() ); | 454 | //odebug << "Download file:" << NewlistItemFile << "" << oendl; |
451 | qDebug("Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile); | 455 | odebug << "Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile << oendl; |
452 | QStringList networkList; | 456 | QStringList networkList; |
453 | networkList.append((const char *)ftp_host); | 457 | networkList.append((const char *)ftp_host); |
454 | networkList.append((const char *)dir); | 458 | networkList.append((const char *)dir); |
455 | networkList.append((const char *)outputFile); | 459 | networkList.append((const char *)outputFile); |
456 | networkList.append((const char *)NewlistItemFile); | 460 | networkList.append((const char *)NewlistItemFile); |
457 | //<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile; | 461 | //<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile; |
@@ -459,54 +463,54 @@ bool LibraryDialog::download_Etext() | |||
459 | NetworkDialog *NetworkDlg; | 463 | NetworkDialog *NetworkDlg; |
460 | NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList); | 464 | NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList); |
461 | 465 | ||
462 | 466 | ||
463 | if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer | 467 | if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer |
464 | File_Name= NetworkDlg->localFileName; | 468 | File_Name= NetworkDlg->localFileName; |
465 | qDebug("back to Library from Network Dialog"); | 469 | odebug << "back to Library from Network Dialog" << oendl; |
466 | qDebug("Just downloaded "+NetworkDlg->localFileName); | 470 | odebug << "Just downloaded "+NetworkDlg->localFileName << oendl; |
467 | 471 | ||
468 | // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found | 472 | // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found |
469 | // QString oldName=File_Name; | 473 | // QString oldName=File_Name; |
470 | // File_Name.replace(0,local_library.length(),downDir); | 474 | // File_Name.replace(0,local_library.length(),downDir); |
471 | // qDebug("File_Name now is "+File_Name); | 475 | // odebug << "File_Name now is "+File_Name << oendl; |
472 | 476 | ||
473 | // } | 477 | // } |
474 | // rename .txt to .etx | 478 | // rename .txt to .etx |
475 | if(NetworkDlg->successDownload) { | 479 | if(NetworkDlg->successDownload) { |
476 | qDebug("Filename is "+File_Name); | 480 | odebug << "Filename is "+File_Name << oendl; |
477 | if(File_Name.right(4)==".txt") { | 481 | if(File_Name.right(4)==".txt") { |
478 | QString s_fileName=File_Name; | 482 | QString s_fileName=File_Name; |
479 | s_fileName.replace( s_fileName.length()-3,3,"gtn"); | 483 | s_fileName.replace( s_fileName.length()-3,3,"gtn"); |
480 | // s_fileName.replace( s_fileName.length()-3,3,"etx"); | 484 | // s_fileName.replace( s_fileName.length()-3,3,"etx"); |
481 | rename(File_Name.latin1(),s_fileName.latin1()); | 485 | rename(File_Name.latin1(),s_fileName.latin1()); |
482 | File_Name=s_fileName; | 486 | File_Name=s_fileName; |
483 | 487 | ||
484 | qDebug("Filename is now "+File_Name); | 488 | odebug << "Filename is now "+File_Name << oendl; |
485 | 489 | ||
486 | } | 490 | } |
487 | if(File_Name.length() > 5 ) { | 491 | if(File_Name.length() > 5 ) { |
488 | setTitle(); | 492 | setTitle(); |
489 | QFileInfo fi(File_Name); | 493 | QFileInfo fi(File_Name); |
490 | QString name_file=fi.fileName(); | 494 | QString name_file=fi.fileName(); |
491 | name_file=name_file.left(name_file.length()-4); | 495 | name_file=name_file.left(name_file.length()-4); |
492 | 496 | ||
493 | qDebug("Setting doclink"); | 497 | odebug << "Setting doclink" << oendl; |
494 | DocLnk lnk; | 498 | DocLnk lnk; |
495 | qDebug("name is "+name_file); | 499 | odebug << "name is "+name_file << oendl; |
496 | lnk.setName(name_file); //sets file name | 500 | lnk.setName(name_file); //sets file name |
497 | qDebug("Title is "+DlglistItemTitle); | 501 | odebug << "Title is "+DlglistItemTitle << oendl; |
498 | lnk.setComment(DlglistItemTitle); | 502 | lnk.setComment(DlglistItemTitle); |
499 | 503 | ||
500 | qDebug("Filename is "+File_Name); | 504 | odebug << "Filename is "+File_Name << oendl; |
501 | lnk.setFile(File_Name); //sets File property | 505 | lnk.setFile(File_Name); //sets File property |
502 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D | 506 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D |
503 | lnk.setExec(File_Name); | 507 | lnk.setExec(File_Name); |
504 | lnk.setIcon("gutenbrowser/Gutenbrowser"); | 508 | lnk.setIcon("gutenbrowser/Gutenbrowser"); |
505 | if(!lnk.writeLink()) { | 509 | if(!lnk.writeLink()) { |
506 | qDebug("Writing doclink did not work"); | 510 | odebug << "Writing doclink did not work" << oendl; |
507 | } else { | 511 | } else { |
508 | } | 512 | } |
509 | } else | 513 | } else |
510 | QMessageBox::message("Note","There was an error\nwith the file"); | 514 | QMessageBox::message("Note","There was an error\nwith the file"); |
511 | } | 515 | } |
512 | } | 516 | } |
@@ -567,20 +571,20 @@ void LibraryDialog::cancelIt() | |||
567 | this->reject(); | 571 | this->reject(); |
568 | } | 572 | } |
569 | 573 | ||
570 | bool LibraryDialog::setTitle() | 574 | bool LibraryDialog::setTitle() |
571 | { | 575 | { |
572 | Config config("Gutenbrowser"); | 576 | Config config("Gutenbrowser"); |
573 | qDebug("setting title"); | 577 | odebug << "setting title" << oendl; |
574 | qDebug(DlglistItemTitle); | 578 | odebug << DlglistItemTitle << oendl; |
575 | 579 | ||
576 | if( DlglistItemTitle.find("[",0,TRUE) != -1) | 580 | if( DlglistItemTitle.find("[",0,TRUE) != -1) |
577 | DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" ); | 581 | DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" ); |
578 | if( DlglistItemTitle.find("]",0,TRUE) !=-1) | 582 | if( DlglistItemTitle.find("]",0,TRUE) !=-1) |
579 | DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); | 583 | DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); |
580 | qDebug("Title being set is "+DlglistItemTitle); | 584 | odebug << "Title being set is "+DlglistItemTitle << oendl; |
581 | int test = 0; | 585 | int test = 0; |
582 | QString ramble, temp; | 586 | QString ramble, temp; |
583 | config.setGroup("Files"); | 587 | config.setGroup("Files"); |
584 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 588 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
585 | int i_numofFiles = s_numofFiles.toInt(); | 589 | int i_numofFiles = s_numofFiles.toInt(); |
586 | for ( int i = 0; i <= i_numofFiles; i++){ | 590 | for ( int i = 0; i <= i_numofFiles; i++){ |
@@ -735,24 +739,24 @@ void LibraryDialog::onButtonSearch() | |||
735 | SearchResultsDlg* SearchResultsDialog; | 739 | SearchResultsDlg* SearchResultsDialog; |
736 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); | 740 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); |
737 | 741 | ||
738 | SearchResultsDialog->showMaximized(); | 742 | SearchResultsDialog->showMaximized(); |
739 | if( SearchResultsDialog->exec() != 0) { | 743 | if( SearchResultsDialog->exec() != 0) { |
740 | texter = SearchResultsDialog->selText; | 744 | texter = SearchResultsDialog->selText; |
741 | // qDebug(texter); | 745 | // odebug << texter << oendl; |
742 | resultLs= SearchResultsDialog->resultsList; | 746 | resultLs= SearchResultsDialog->resultsList; |
743 | i_berger = 1; | 747 | i_berger = 1; |
744 | } | 748 | } |
745 | Searchlist.clear(); | 749 | Searchlist.clear(); |
746 | 750 | ||
747 | // if(SearchResultsDialog) | 751 | // if(SearchResultsDialog) |
748 | // delete SearchResultsDialog; | 752 | // delete SearchResultsDialog; |
749 | QString tester; | 753 | QString tester; |
750 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { | 754 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { |
751 | texter.sprintf("%s \n",(*it).latin1()); | 755 | texter.sprintf("%s \n",(*it).latin1()); |
752 | // qDebug(texter); | 756 | // odebug << texter << oendl; |
753 | if( tester!=texter) | 757 | if( tester!=texter) |
754 | parseSearchResults( texter); | 758 | parseSearchResults( texter); |
755 | tester = texter; | 759 | tester = texter; |
756 | } | 760 | } |
757 | if(searchDlg) | 761 | if(searchDlg) |
758 | delete searchDlg; | 762 | delete searchDlg; |
@@ -803,13 +807,13 @@ void LibraryDialog::parseSearchResults( QString resultStr) | |||
803 | // // QString cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; | 807 | // // QString cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; |
804 | // cmd = "unzip " + zipFile; | 808 | // cmd = "unzip " + zipFile; |
805 | // #endif | 809 | // #endif |
806 | 810 | ||
807 | // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No); | 811 | // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No); |
808 | // if (exit==QMessageBox::Yes) { | 812 | // if (exit==QMessageBox::Yes) { |
809 | // qDebug("Issuing the command "+cmd); | 813 | // odebug << "Issuing the command "+cmd << oendl; |
810 | // #if defined(_WS_WIN_) | 814 | // #if defined(_WS_WIN_) |
811 | // WinExec( cmd, SW_HIDE ); | 815 | // WinExec( cmd, SW_HIDE ); |
812 | // #endif | 816 | // #endif |
813 | // #if defined(_WS_X11_) | 817 | // #if defined(_WS_X11_) |
814 | // system( cmd); | 818 | // system( cmd); |
815 | // #endif | 819 | // #endif |
@@ -837,13 +841,13 @@ void LibraryDialog::sort() | |||
837 | } | 841 | } |
838 | 842 | ||
839 | /* | 843 | /* |
840 | Downloads the current selected listitem*/ | 844 | Downloads the current selected listitem*/ |
841 | bool LibraryDialog::getItem(QListViewItem *it) | 845 | bool LibraryDialog::getItem(QListViewItem *it) |
842 | { | 846 | { |
843 | // qDebug("selected getItem"); | 847 | // odebug << "selected getItem" << oendl; |
844 | 848 | ||
845 | // DlglistItemNumber = it->text(0); | 849 | // DlglistItemNumber = it->text(0); |
846 | DlglistItemTitle = it->text(0); | 850 | DlglistItemTitle = it->text(0); |
847 | DlglistItemYear = it->text(2); | 851 | DlglistItemYear = it->text(2); |
848 | DlglistItemFile = it->text(3); | 852 | DlglistItemFile = it->text(3); |
849 | 853 | ||
@@ -855,13 +859,13 @@ bool LibraryDialog::getItem(QListViewItem *it) | |||
855 | } | 859 | } |
856 | 860 | ||
857 | /* | 861 | /* |
858 | download button is pushed so we get the current items to download*/ | 862 | download button is pushed so we get the current items to download*/ |
859 | bool LibraryDialog::onButtonDownload() | 863 | bool LibraryDialog::onButtonDownload() |
860 | { | 864 | { |
861 | // qDebug("selected onButtonDownloadz"); | 865 | // odebug << "selected onButtonDownloadz" << oendl; |
862 | 866 | ||
863 | QListViewItemIterator it1( ListView1 ); | 867 | QListViewItemIterator it1( ListView1 ); |
864 | QListViewItemIterator it2( ListView2 ); | 868 | QListViewItemIterator it2( ListView2 ); |
865 | QListViewItemIterator it3( ListView3 ); | 869 | QListViewItemIterator it3( ListView3 ); |
866 | QListViewItemIterator it4( ListView4 ); | 870 | QListViewItemIterator it4( ListView4 ); |
867 | QListViewItemIterator it5( ListView5 ); | 871 | QListViewItemIterator it5( ListView5 ); |
@@ -897,13 +901,13 @@ bool LibraryDialog::onButtonDownload() | |||
897 | 901 | ||
898 | 902 | ||
899 | /* | 903 | /* |
900 | handles the sorting combo box */ | 904 | handles the sorting combo box */ |
901 | void LibraryDialog::comboSelect(int index) | 905 | void LibraryDialog::comboSelect(int index) |
902 | { | 906 | { |
903 | // qDebug("we are sorting"); | 907 | // odebug << "we are sorting" << oendl; |
904 | ListView1->setSorting( index, TRUE); | 908 | ListView1->setSorting( index, TRUE); |
905 | ListView2->setSorting( index, TRUE); | 909 | ListView2->setSorting( index, TRUE); |
906 | ListView3->setSorting( index, TRUE); | 910 | ListView3->setSorting( index, TRUE); |
907 | ListView4->setSorting( index, TRUE); | 911 | ListView4->setSorting( index, TRUE); |
908 | ListView5->setSorting( index, TRUE); | 912 | ListView5->setSorting( index, TRUE); |
909 | 913 | ||
@@ -927,13 +931,13 @@ void LibraryDialog::newList() | |||
927 | } else { | 931 | } else { |
928 | Output *outDlg; | 932 | Output *outDlg; |
929 | buttonNewList->setDown(TRUE); | 933 | buttonNewList->setDown(TRUE); |
930 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); | 934 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); |
931 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); | 935 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); |
932 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { | 936 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { |
933 | qDebug("changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser"); | 937 | odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; |
934 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 938 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
935 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; | 939 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; |
936 | 940 | ||
937 | int result = QMessageBox::warning( this,"Download" | 941 | int result = QMessageBox::warning( this,"Download" |
938 | ,"Ok to use /'wget/' to download\na new library list?\n" | 942 | ,"Ok to use /'wget/' to download\na new library list?\n" |
939 | ,"Yes","No",0,0,1); | 943 | ,"Yes","No",0,0,1); |
@@ -948,13 +952,13 @@ void LibraryDialog::newList() | |||
948 | outDlg->OutputEdit->append( tr("Running wget") ); | 952 | outDlg->OutputEdit->append( tr("Running wget") ); |
949 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 953 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
950 | sleep(1); | 954 | sleep(1); |
951 | fp = popen( (const char *) cmd, "r"); | 955 | fp = popen( (const char *) cmd, "r"); |
952 | if ( !fp ) { | 956 | if ( !fp ) { |
953 | } else { | 957 | } else { |
954 | qDebug("Issuing the command\n"+cmd); | 958 | odebug << "Issuing the command\n"+cmd << oendl; |
955 | // system(cmd); | 959 | // system(cmd); |
956 | while ( fgets( line, sizeof line, fp)) { | 960 | while ( fgets( line, sizeof line, fp)) { |
957 | outDlg->OutputEdit->append(line); | 961 | outDlg->OutputEdit->append(line); |
958 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 962 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
959 | } | 963 | } |
960 | pclose(fp); | 964 | pclose(fp); |
@@ -962,13 +966,13 @@ void LibraryDialog::newList() | |||
962 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 966 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
963 | qApp->processEvents(); | 967 | qApp->processEvents(); |
964 | 968 | ||
965 | // if( QFile(gutenindex1).exists() ) { | 969 | // if( QFile(gutenindex1).exists() ) { |
966 | // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 970 | // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
967 | // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) | 971 | // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) |
968 | // qDebug("renaming error"); | 972 | // odebug << "renaming error" << oendl; |
969 | // } | 973 | // } |
970 | 974 | ||
971 | } | 975 | } |
972 | // outDlg->close(); | 976 | // outDlg->close(); |
973 | FindLibrary(); | 977 | FindLibrary(); |
974 | if(outDlg) delete outDlg; | 978 | if(outDlg) delete outDlg; |
@@ -1021,13 +1025,13 @@ bool LibraryDialog::moreInfo() | |||
1021 | titleString = item->text(0); | 1025 | titleString = item->text(0); |
1022 | ListView5->clearSelection(); | 1026 | ListView5->clearSelection(); |
1023 | item = 0; | 1027 | item = 0; |
1024 | } | 1028 | } |
1025 | item=0; | 1029 | item=0; |
1026 | if(titleString.length()>2) { | 1030 | if(titleString.length()>2) { |
1027 | qDebug( "Title is "+titleString ); | 1031 | odebug << "Title is "+titleString << oendl; |
1028 | titleString.replace( QRegExp("\\s"), "%20"); | 1032 | titleString.replace( QRegExp("\\s"), "%20"); |
1029 | titleString.replace( QRegExp("'"), "%20"); | 1033 | titleString.replace( QRegExp("'"), "%20"); |
1030 | titleString.replace( QRegExp("\""), "%20"); | 1034 | titleString.replace( QRegExp("\""), "%20"); |
1031 | titleString.replace( QRegExp("&"), "%20"); | 1035 | titleString.replace( QRegExp("&"), "%20"); |
1032 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; | 1036 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; |
1033 | cmd="opera "+cmd; | 1037 | cmd="opera "+cmd; |
@@ -1045,18 +1049,18 @@ void LibraryDialog::FindLibrary() | |||
1045 | buttonLibrary->setDown(TRUE); | 1049 | buttonLibrary->setDown(TRUE); |
1046 | 1050 | ||
1047 | qApp->processEvents(); | 1051 | qApp->processEvents(); |
1048 | if( QFile( new_index).exists() /* && this->isHidden() */) { | 1052 | if( QFile( new_index).exists() /* && this->isHidden() */) { |
1049 | newindexLib.setName( new_index); | 1053 | newindexLib.setName( new_index); |
1050 | indexLib.setName( new_index); | 1054 | indexLib.setName( new_index); |
1051 | qDebug("index file is "+ new_index); | 1055 | odebug << "index file is "+ new_index << oendl; |
1052 | Newlibrary(); | 1056 | Newlibrary(); |
1053 | } else { | 1057 | } else { |
1054 | newindexLib.setName( old_index); | 1058 | newindexLib.setName( old_index); |
1055 | indexLib.setName( old_index); | 1059 | indexLib.setName( old_index); |
1056 | qDebug("new index nameis "+ old_index); | 1060 | odebug << "new index nameis "+ old_index << oendl; |
1057 | Library(); | 1061 | Library(); |
1058 | } | 1062 | } |
1059 | indexLoaded=true; | 1063 | indexLoaded=true; |
1060 | buttonSearch->setEnabled(TRUE); | 1064 | buttonSearch->setEnabled(TRUE); |
1061 | moreInfoButton->setEnabled(TRUE); | 1065 | moreInfoButton->setEnabled(TRUE); |
1062 | 1066 | ||