summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp10
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp3
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp82
3 files changed, 47 insertions, 48 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 270a4cf..124b6f3 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -41,96 +41,98 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W
41 if ( !name ) 41 if ( !name )
42 setName( "LibraryDialog" ); 42 setName( "LibraryDialog" );
43 indexLoaded=false; 43 indexLoaded=false;
44 initDialog(); 44 initDialog();
45 45
46 // this->setMaximumWidth(240); 46 // this->setMaximumWidth(240);
47 47
48 index = "GUTINDEX.ALL"; 48 index = "GUTINDEX.ALL";
49 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 49 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
50 local_index = local_library + index; 50 local_index = local_library + index;
51 51
52 QString iniFile ; 52 QString iniFile ;
53 iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; 53 iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc";
54 54
55 new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; 55 new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT";
56 56
57 old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; 57 old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL";
58 // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 58 // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
59 59
60 // iniFile = local_library+"gutenbrowserrc"; 60 // iniFile = local_library+"gutenbrowserrc";
61 // new_index = local_library + "PGWHOLE.TXT"; 61 // new_index = local_library + "PGWHOLE.TXT";
62 // old_index = local_library + "GUTINDEX.ALL"; 62 // old_index = local_library + "GUTINDEX.ALL";
63 63
64 Config config("Gutenbrowser"); 64 Config config("Gutenbrowser");
65 65
66 config.setGroup( "HttpServer" ); 66 config.setGroup( "HttpServer" );
67 proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); 67 proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
68 68
69 config.setGroup( "FTPsite" ); 69 config.setGroup( "FTPsite" );
70 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); 70 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
71 odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; 71 odebug << "Library Dialog: ftp_host is "+ftp_host << oendl;
72 // 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) );
73 // ftp_host=ftp_host.stripWhiteSpace(); 73 // ftp_host=ftp_host.stripWhiteSpace();
74 ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); 74 ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
75 75
76 i_binary = 0; 76 i_binary = 0;
77 77
78 config.setGroup("SortAuth"); 78 config.setGroup("SortAuth");
79 if( config.readEntry("authSort", "FALSE") == "TRUE") 79 if( config.readEntry("authSort", "FALSE") == "TRUE")
80 authBox->setChecked(TRUE); 80 authBox->setChecked(TRUE);
81 81
82 config.setGroup("General"); 82 config.setGroup("General");
83 downDir =config.readEntry( "DownloadDirectory",local_library); 83 downDir =config.readEntry( "DownloadDirectory",local_library);
84 odebug << "downDir is "+downDir << oendl; 84 odebug << "downDir is "+downDir << oendl;
85 newindexLib.setName( old_index); 85 newindexLib.setName( old_index);
86 indexLib.setName( old_index); 86 indexLib.setName( old_index);
87 87
88 new QPEDialogListener(this); 88 new QPEDialogListener(this);
89 QTimer::singleShot( 1000, this, SLOT( FindLibrary()) );
90
89} 91}
90 92
91LibraryDialog::~LibraryDialog() 93LibraryDialog::~LibraryDialog()
92{ 94{
93// delete QList_Item2; 95// delete QList_Item2;
94// delete QList_Item1; 96// delete QList_Item1;
95// delete QList_Item3; 97// delete QList_Item3;
96// delete QList_Item4; 98// delete QList_Item4;
97// delete QList_Item5; 99// delete QList_Item5;
98 100
99 // saveConfig(); 101 // saveConfig();
100} 102}
101 103
102 /*This groks using PGWHOLE.TXT */ 104 /*This groks using PGWHOLE.TXT */
103void LibraryDialog::Newlibrary() 105void LibraryDialog::Newlibrary()
104{ 106{
105#ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files 107#ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files
106 //odebug << "Opening new library index " << newindexLib << "" << oendl; 108 //odebug << "Opening new library index " << newindexLib << "" << oendl;
107 if ( newindexLib.open( IO_ReadOnly) ) { 109 if ( newindexLib.open( IO_ReadOnly) ) {
108 setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully 110 setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully
109 QTextStream indexStream( &newindexLib ); 111 QTextStream indexStream( &newindexLib );
110 QString indexLine; 112 QString indexLine;
111 while ( !indexStream.atEnd() ) { // until end of file.. 113 while ( !indexStream.atEnd() ) { // until end of file..
112 indexLine = indexStream.readLine(); 114 indexLine = indexStream.readLine();
113 if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { 115 if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) {
114 year = indexLine.mid(4,4); 116 year = indexLine.mid(4,4);
115 year = year.stripWhiteSpace(); 117 year = year.stripWhiteSpace();
116 file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); 118 file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 );
117 file = file.stripWhiteSpace(); 119 file = file.stripWhiteSpace();
118 number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); 120 number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 );
119 if( year.toInt() < 1984) 121 if( year.toInt() < 1984)
120 number = number.left( number.length() -1 ); 122 number = number.left( number.length() -1 );
121 number = number.stripWhiteSpace(); 123 number = number.stripWhiteSpace();
122 title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); 124 title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
123 title = title.stripWhiteSpace(); 125 title = title.stripWhiteSpace();
124 126
125 getAuthor(); // groks author 127 getAuthor(); // groks author
126 author = author.stripWhiteSpace(); 128 author = author.stripWhiteSpace();
127 if (authBox->isChecked()) { // this reverses the first name and last name of the author 129 if (authBox->isChecked()) { // this reverses the first name and last name of the author
128 // odebug << "Sorting last name first" << oendl; 130 // odebug << "Sorting last name first" << oendl;
129 QString lastName, firstName=""; 131 QString lastName, firstName="";
130 int finder=author.findRev( ' ', -1, TRUE); 132 int finder=author.findRev( ' ', -1, TRUE);
131 lastName=author.right( author.length()-finder); 133 lastName=author.right( author.length()-finder);
132 firstName=author.left(finder); 134 firstName=author.left(finder);
133 lastName=lastName.stripWhiteSpace(); 135 lastName=lastName.stripWhiteSpace();
134 firstName=firstName.stripWhiteSpace(); 136 firstName=firstName.stripWhiteSpace();
135 137
136 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names 138 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
@@ -210,97 +212,97 @@ void LibraryDialog::Library()
210 number = number.stripWhiteSpace(); 212 number = number.stripWhiteSpace();
211 // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); 213 // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
212 title = indexLine.mid( 9, 50 ); 214 title = indexLine.mid( 9, 50 );
213 title = title.stripWhiteSpace(); 215 title = title.stripWhiteSpace();
214 //odebug << "title is "+title << oendl; 216 //odebug << "title is "+title << oendl;
215 getAuthor(); // grok author 217 getAuthor(); // grok author
216 author = author.stripWhiteSpace(); 218 author = author.stripWhiteSpace();
217 //odebug << "author is "+author << oendl; 219 //odebug << "author is "+author << oendl;
218 if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author 220 if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author
219 QString lastName, firstName=""; 221 QString lastName, firstName="";
220 int finder=author.findRev( ' ', -1, TRUE); 222 int finder=author.findRev( ' ', -1, TRUE);
221 lastName=author.right( author.length()-finder); 223 lastName=author.right( author.length()-finder);
222 firstName=author.left(finder); 224 firstName=author.left(finder);
223 lastName=lastName.stripWhiteSpace(); 225 lastName=lastName.stripWhiteSpace();
224 firstName=firstName.stripWhiteSpace(); 226 firstName=firstName.stripWhiteSpace();
225 227
226 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names 228 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
227 author=lastName+", "+firstName; 229 author=lastName+", "+firstName;
228 } 230 }
229 231
230 if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) { 232 if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) {
231 // fill string list or something to be able to sort by Author 233 // fill string list or something to be able to sort by Author
232 if( author.isEmpty() ) 234 if( author.isEmpty() )
233 QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); 235 QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file );
234 else { 236 else {
235 if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || 237 if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) ||
236 (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) 238 (author.left(1) >= QString("a") && author.left(1) <= QString("f")) )
237 QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); 239 QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file );
238 240
239 else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || 241 else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) ||
240 (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) 242 (author.left(1) >= QString("g") && author.left(1) <= QString("m")) )
241 QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); 243 QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file );
242 244
243 else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || 245 else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) ||
244 (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) 246 (author.left(1) >= QString("n") && author.left(1) <= QString("r")) )
245 QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file ); 247 QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file );
246 248
247 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || 249 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) ||
248 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) 250 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) )
249 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); 251 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file );
250 } 252 }
251 } 253 }
252 } 254 }
253 } 255 }
254 } 256 }
255 indexLib.close(); 257 indexLib.close();
256 } else { 258 } else {
257 QString sMsg; 259 QString sMsg;
258 sMsg = ( tr("Error opening local library index:\n "))+local_index; 260 sMsg = ( tr("<p>Error opening local library index:</P> "))+local_index;
259 QMessageBox::message( "Error",sMsg); 261 QMessageBox::message( "Error",sMsg);
260 } 262 }
261 263
262} //end Library() 264} //end Library()
263 265
264 266
265 /* 267 /*
266 Groks the author out of the title */ 268 Groks the author out of the title */
267bool LibraryDialog::getAuthor() 269bool LibraryDialog::getAuthor()
268{ 270{
269 if( title.contains( ", by", TRUE)) { 271 if( title.contains( ", by", TRUE)) {
270 int auth; 272 int auth;
271 auth = title.find(", by", 0, TRUE); 273 auth = title.find(", by", 0, TRUE);
272 author = title.right(title.length() - (auth + 4) ); 274 author = title.right(title.length() - (auth + 4) );
273 if( int finder = author.find("[", 0, TRUE)) { 275 if( int finder = author.find("[", 0, TRUE)) {
274 author = author.left(finder); 276 author = author.left(finder);
275 } 277 }
276 } 278 }
277 else if ( title.contains( "by, ", TRUE) ) { 279 else if ( title.contains( "by, ", TRUE) ) {
278 int auth; 280 int auth;
279 auth = title.find("by, ", 0, TRUE); 281 auth = title.find("by, ", 0, TRUE);
280 author = title.right(title.length() - (auth + 4) ); 282 author = title.right(title.length() - (auth + 4) );
281 if( int finder = author.find("[", 0, TRUE)) { 283 if( int finder = author.find("[", 0, TRUE)) {
282 author = author.left( finder); 284 author = author.left( finder);
283 } 285 }
284 } 286 }
285 else if ( title.contains( " by", TRUE) ) { 287 else if ( title.contains( " by", TRUE) ) {
286 int auth; 288 int auth;
287 auth = title.find(" by", 0, TRUE); 289 auth = title.find(" by", 0, TRUE);
288 author = title.right(title.length() - (auth + 3) ); 290 author = title.right(title.length() - (auth + 3) );
289 if( int finder = author.find("[", 0, TRUE)) { 291 if( int finder = author.find("[", 0, TRUE)) {
290 author = author.left( finder); 292 author = author.left( finder);
291 } 293 }
292 } 294 }
293 else if ( title.contains( "by ", TRUE) ) { 295 else if ( title.contains( "by ", TRUE) ) {
294 int auth; 296 int auth;
295 auth = title.find("by ", 0, TRUE); 297 auth = title.find("by ", 0, TRUE);
296 author = title.right(title.length() - (auth + 3) ); 298 author = title.right(title.length() - (auth + 3) );
297 if( int finder = author.find("[", 0, TRUE)) { 299 if( int finder = author.find("[", 0, TRUE)) {
298 author = author.left( finder); 300 author = author.left( finder);
299 } 301 }
300 } 302 }
301 else if ( title.contains( ",", TRUE) ) { 303 else if ( title.contains( ",", TRUE) ) {
302 int auth; 304 int auth;
303 auth = title.find(",", 0, TRUE); 305 auth = title.find(",", 0, TRUE);
304 author = title.right( title.length() - (auth + 1) ); 306 author = title.right( title.length() - (auth + 1) );
305 if ( author.contains( ",", TRUE) ) { 307 if ( author.contains( ",", TRUE) ) {
306 int auth; 308 int auth;
@@ -466,97 +468,97 @@ bool LibraryDialog::download_Etext()
466 468
467 if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer 469 if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer
468 File_Name= NetworkDlg->localFileName; 470 File_Name= NetworkDlg->localFileName;
469 odebug << "back to Library from Network Dialog" << oendl; 471 odebug << "back to Library from Network Dialog" << oendl;
470 odebug << "Just downloaded "+NetworkDlg->localFileName << oendl; 472 odebug << "Just downloaded "+NetworkDlg->localFileName << oendl;
471 473
472 // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found 474 // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found
473 // QString oldName=File_Name; 475 // QString oldName=File_Name;
474 // File_Name.replace(0,local_library.length(),downDir); 476 // File_Name.replace(0,local_library.length(),downDir);
475 // odebug << "File_Name now is "+File_Name << oendl; 477 // odebug << "File_Name now is "+File_Name << oendl;
476 478
477 // } 479 // }
478 // rename .txt to .etx 480 // rename .txt to .etx
479 if(NetworkDlg->successDownload) { 481 if(NetworkDlg->successDownload) {
480 odebug << "Filename is "+File_Name << oendl; 482 odebug << "Filename is "+File_Name << oendl;
481 if(File_Name.right(4)==".txt") { 483 if(File_Name.right(4)==".txt") {
482 QString s_fileName=File_Name; 484 QString s_fileName=File_Name;
483 s_fileName.replace( s_fileName.length()-3,3,"gtn"); 485 s_fileName.replace( s_fileName.length()-3,3,"gtn");
484 // s_fileName.replace( s_fileName.length()-3,3,"etx"); 486 // s_fileName.replace( s_fileName.length()-3,3,"etx");
485 rename(File_Name.latin1(),s_fileName.latin1()); 487 rename(File_Name.latin1(),s_fileName.latin1());
486 File_Name=s_fileName; 488 File_Name=s_fileName;
487 489
488 odebug << "Filename is now "+File_Name << oendl; 490 odebug << "Filename is now "+File_Name << oendl;
489 491
490 } 492 }
491 if(File_Name.length() > 5 ) { 493 if(File_Name.length() > 5 ) {
492 setTitle(); 494 setTitle();
493 QFileInfo fi(File_Name); 495 QFileInfo fi(File_Name);
494 QString name_file=fi.fileName(); 496 QString name_file=fi.fileName();
495 name_file=name_file.left(name_file.length()-4); 497 name_file=name_file.left(name_file.length()-4);
496 498
497 odebug << "Setting doclink" << oendl; 499 odebug << "Setting doclink" << oendl;
498 DocLnk lnk; 500 DocLnk lnk;
499 odebug << "name is "+name_file << oendl; 501 odebug << "name is "+name_file << oendl;
500 lnk.setName(name_file); //sets file name 502 lnk.setName(name_file); //sets file name
501 odebug << "Title is "+DlglistItemTitle << oendl; 503 odebug << "Title is "+DlglistItemTitle << oendl;
502 lnk.setComment(DlglistItemTitle); 504 lnk.setComment(DlglistItemTitle);
503 505
504 odebug << "Filename is "+File_Name << oendl; 506 odebug << "Filename is "+File_Name << oendl;
505 lnk.setFile(File_Name); //sets File property 507 lnk.setFile(File_Name); //sets File property
506 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D 508 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
507 lnk.setExec(File_Name); 509 lnk.setExec(File_Name);
508 lnk.setIcon("gutenbrowser/Gutenbrowser"); 510 lnk.setIcon("gutenbrowser/Gutenbrowser");
509 if(!lnk.writeLink()) { 511 if(!lnk.writeLink()) {
510 odebug << "Writing doclink did not work" << oendl; 512 odebug << "Writing doclink did not work" << oendl;
511 } else { 513 } else {
512 } 514 }
513 } else 515 } else
514 QMessageBox::message("Note","There was an error\nwith the file"); 516 QMessageBox::message("Note","<p>There was an error with the file</p>");
515 } 517 }
516 } 518 }
517 return true; 519 return true;
518} 520}
519 521
520bool LibraryDialog::httpDownload() 522bool LibraryDialog::httpDownload()
521{// httpDownload 523{// httpDownload
522#ifndef Q_WS_QWS 524#ifndef Q_WS_QWS
523 Config config("Gutenbrowser"); 525 Config config("Gutenbrowser");
524 config.setGroup( "Browser" ); 526 config.setGroup( "Browser" );
525 QString brow = config.readEntry("Preferred", ""); 527 QString brow = config.readEntry("Preferred", "");
526 QString file_name = "./.guten_temp"; 528 QString file_name = "./.guten_temp";
527 // config.setGroup( "HttpServer" ); 529 // config.setGroup( "HttpServer" );
528 // QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); 530 // QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
529 QString httpName = proxy_http + "/"+Edir; 531 QString httpName = proxy_http + "/"+Edir;
530 // progressBar->setProgress( i); 532 // progressBar->setProgress( i);
531 i++; 533 i++;
532 if ( brow != "Konq") { /////////// use lynx 534 if ( brow != "Konq") { /////////// use lynx
533 // QString cmd = "lynx -source " + httpName +" | cat >> " + file_name; 535 // QString cmd = "lynx -source " + httpName +" | cat >> " + file_name;
534 // system(cmd); 536 // system(cmd);
535 } else { //////////// use KFM 537 } else { //////////// use KFM
536 // KFM::download( httpName, file_name); 538 // KFM::download( httpName, file_name);
537 } 539 }
538 i++; 540 i++;
539 QFile tmp( file_name); 541 QFile tmp( file_name);
540 QString str; 542 QString str;
541 if (tmp.open(IO_ReadOnly)) { 543 if (tmp.open(IO_ReadOnly)) {
542 QTextStream t( &tmp ); // use a text stream 544 QTextStream t( &tmp ); // use a text stream
543 while ( !t.eof()) { 545 while ( !t.eof()) {
544 QString s = t.readLine(); 546 QString s = t.readLine();
545 if (s.contains( NewlistItemFile, FALSE) && (s.contains(".txt")) ) { 547 if (s.contains( NewlistItemFile, FALSE) && (s.contains(".txt")) ) {
546 str = s.mid( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6, (s.find( ".txt</A>", 0, TRUE) + 4) - ( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6 ) ); 548 str = s.mid( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6, (s.find( ".txt</A>", 0, TRUE) + 4) - ( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6 ) );
547 httpName += "/" + str; 549 httpName += "/" + str;
548 } 550 }
549 } //end of while loop 551 } //end of while loop
550 } 552 }
551 tmp.close(); 553 tmp.close();
552 m_getFilePath = local_library + str; 554 m_getFilePath = local_library + str;
553 i++; 555 i++;
554 if ( brow != "KFM"){ ///////// use lynx 556 if ( brow != "KFM"){ ///////// use lynx
555 QString cmd = "lynx -source " + httpName +" | cat >> " + m_getFilePath; 557 QString cmd = "lynx -source " + httpName +" | cat >> " + m_getFilePath;
556 // QMessageBox::message("Error", cmd); 558 // QMessageBox::message("Error", cmd);
557 system(cmd); 559 system(cmd);
558 } else { ////////// use KFM 560 } else { ////////// use KFM
559 // KFM::download( httpName, m_getFilePath); 561 // KFM::download( httpName, m_getFilePath);
560 } 562 }
561 i++; 563 i++;
562#endif 564#endif
@@ -894,97 +896,97 @@ bool LibraryDialog::onButtonDownload()
894 for ( ; it5.current(); ++it5 ) { 896 for ( ; it5.current(); ++it5 ) {
895 if ( it5.current()->isSelected() ) 897 if ( it5.current()->isSelected() )
896 getItem(it5.current()); 898 getItem(it5.current());
897 it5.current()->setSelected(FALSE); 899 it5.current()->setSelected(FALSE);
898 } 900 }
899 return true; 901 return true;
900} 902}
901 903
902 904
903 /* 905 /*
904 handles the sorting combo box */ 906 handles the sorting combo box */
905void LibraryDialog::comboSelect(int index) 907void LibraryDialog::comboSelect(int index)
906{ 908{
907 // odebug << "we are sorting" << oendl; 909 // odebug << "we are sorting" << oendl;
908 ListView1->setSorting( index, TRUE); 910 ListView1->setSorting( index, TRUE);
909 ListView2->setSorting( index, TRUE); 911 ListView2->setSorting( index, TRUE);
910 ListView3->setSorting( index, TRUE); 912 ListView3->setSorting( index, TRUE);
911 ListView4->setSorting( index, TRUE); 913 ListView4->setSorting( index, TRUE);
912 ListView5->setSorting( index, TRUE); 914 ListView5->setSorting( index, TRUE);
913 915
914 ListView1->sort(); 916 ListView1->sort();
915 ListView2->sort(); 917 ListView2->sort();
916 ListView3->sort(); 918 ListView3->sort();
917 ListView4->sort(); 919 ListView4->sort();
918 ListView5->sort(); 920 ListView5->sort();
919 921
920 // ListView1->triggerUpdate(); 922 // ListView1->triggerUpdate();
921 // ListView2->triggerUpdate(); 923 // ListView2->triggerUpdate();
922 // ListView3->triggerUpdate(); 924 // ListView3->triggerUpdate();
923 // ListView4->triggerUpdate(); 925 // ListView4->triggerUpdate();
924 // ListView5->triggerUpdate(); 926 // ListView5->triggerUpdate();
925} 927}
926 928
927void LibraryDialog::newList() 929void LibraryDialog::newList()
928{ 930{
929 if(indexLoaded) { 931 if(indexLoaded) {
930 onButtonDownload(); 932 onButtonDownload();
931 } else { 933 } else {
932 Output *outDlg; 934 Output *outDlg;
933 buttonNewList->setDown(TRUE); 935 buttonNewList->setDown(TRUE);
934 QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); 936 QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser");
935 if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); 937 if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true);
936 if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { 938 if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) {
937 odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; 939 odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl;
938 QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 940 QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
939 QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; 941 QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1";
940 942
941 int result = QMessageBox::warning( this,"Download" 943 int result = QMessageBox::warning( this,"Download"
942 ,"Ok to use /'wget/' to download\na new library list?\n" 944 ,"<p>Ok to use /'wget/' to download a new library list?</P>"
943 ,"Yes","No",0,0,1); 945 ,"Yes","No",0,0,1);
944 qApp->processEvents(); 946 qApp->processEvents();
945 if(result == 0) { 947 if(result == 0) {
946 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); 948 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE);
947 outDlg->showMaximized(); 949 outDlg->showMaximized();
948 outDlg->show(); 950 outDlg->show();
949 qApp->processEvents(); 951 qApp->processEvents();
950 FILE *fp; 952 FILE *fp;
951 char line[130]; 953 char line[130];
952 outDlg->OutputEdit->append( tr("Running wget") ); 954 outDlg->OutputEdit->append( tr("Running wget") );
953 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 955 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
954 sleep(1); 956 sleep(1);
955 fp = popen( (const char *) cmd, "r"); 957 fp = popen( (const char *) cmd, "r");
956 if ( !fp ) { 958 if ( !fp ) {
957 } else { 959 } else {
958 odebug << "Issuing the command\n"+cmd << oendl; 960 odebug << "Issuing the command\n"+cmd << oendl;
959 // system(cmd); 961 // system(cmd);
960 while ( fgets( line, sizeof line, fp)) { 962 while ( fgets( line, sizeof line, fp)) {
961 outDlg->OutputEdit->append(line); 963 outDlg->OutputEdit->append(line);
962 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 964 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
963 } 965 }
964 pclose(fp); 966 pclose(fp);
965 outDlg->OutputEdit->append("Finished downloading\n"); 967 outDlg->OutputEdit->append("Finished downloading\n");
966 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 968 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
967 qApp->processEvents(); 969 qApp->processEvents();
968 970
969 // if( QFile(gutenindex1).exists() ) { 971 // if( QFile(gutenindex1).exists() ) {
970 // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 972 // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
971 // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) 973 // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0)
972 // odebug << "renaming error" << oendl; 974 // odebug << "renaming error" << oendl;
973 // } 975 // }
974 976
975 } 977 }
976 // outDlg->close(); 978 // outDlg->close();
977 FindLibrary(); 979 FindLibrary();
978 if(outDlg) delete outDlg; 980 if(outDlg) delete outDlg;
979 } 981 }
980 buttonNewList->setDown(FALSE); 982 buttonNewList->setDown(FALSE);
981 } else { 983 } else {
982 QMessageBox::message("Note","Could not change directories"); 984 QMessageBox::message("Note","Could not change directories");
983 } 985 }
984 // if(outDlg) 986 // if(outDlg)
985 // delete outDlg; 987 // delete outDlg;
986 } 988 }
987} 989}
988 990
989bool LibraryDialog::moreInfo() 991bool LibraryDialog::moreInfo()
990{ 992{
@@ -992,80 +994,80 @@ bool LibraryDialog::moreInfo()
992 QListViewItem * item; 994 QListViewItem * item;
993 item = 0; 995 item = 0;
994 QString titleString; 996 QString titleString;
995 item = ListView1->currentItem(); 997 item = ListView1->currentItem();
996 if( item != 0) { 998 if( item != 0) {
997 titleString = item->text(0); 999 titleString = item->text(0);
998 ListView1->clearSelection(); 1000 ListView1->clearSelection();
999 item = 0; 1001 item = 0;
1000 } 1002 }
1001 if( item == 0) 1003 if( item == 0)
1002 item = ListView2->currentItem(); 1004 item = ListView2->currentItem();
1003 if( item != 0) { 1005 if( item != 0) {
1004 titleString = item->text(0); 1006 titleString = item->text(0);
1005 ListView2->clearSelection(); 1007 ListView2->clearSelection();
1006 item = 0; 1008 item = 0;
1007 } 1009 }
1008 if( item == 0) 1010 if( item == 0)
1009 item = ListView3->currentItem(); 1011 item = ListView3->currentItem();
1010 if( item != 0) { 1012 if( item != 0) {
1011 titleString = item->text(0); 1013 titleString = item->text(0);
1012 ListView3->clearSelection(); 1014 ListView3->clearSelection();
1013 item = 0; 1015 item = 0;
1014 } 1016 }
1015 if( item == 0) 1017 if( item == 0)
1016 item = ListView4->currentItem(); 1018 item = ListView4->currentItem();
1017 if( item != 0) { 1019 if( item != 0) {
1018 titleString = item->text(0); 1020 titleString = item->text(0);
1019 ListView4->clearSelection(); 1021 ListView4->clearSelection();
1020 item = 0; 1022 item = 0;
1021 } 1023 }
1022 if( item == 0) 1024 if( item == 0)
1023 item = ListView5->currentItem(); 1025 item = ListView5->currentItem();
1024 if( item != 0) { 1026 if( item != 0) {
1025 titleString = item->text(0); 1027 titleString = item->text(0);
1026 ListView5->clearSelection(); 1028 ListView5->clearSelection();
1027 item = 0; 1029 item = 0;
1028 } 1030 }
1029 item=0; 1031 item=0;
1030 if(titleString.length()>2) { 1032 if(titleString.length()>2) {
1031 odebug << "Title is "+titleString << oendl; 1033 odebug << "Title is "+titleString << oendl;
1032 titleString.replace( QRegExp("\\s"), "%20"); 1034 titleString.replace( QRegExp("\\s"), "%20");
1033 titleString.replace( QRegExp("'"), "%20"); 1035 titleString.replace( QRegExp("'"), "%20");
1034 titleString.replace( QRegExp("\""), "%20"); 1036 titleString.replace( QRegExp("\""), "%20");
1035 titleString.replace( QRegExp("&"), "%20"); 1037 titleString.replace( QRegExp("&"), "%20");
1036 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; 1038 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search";
1037 cmd="opera "+cmd; 1039 cmd="opera "+cmd;
1038 system(cmd); 1040 system(cmd);
1039 } else 1041 } else
1040 QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title."); 1042 QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>");
1041 return true; 1043 return true;
1042 1044
1043} 1045}
1044 1046
1045 /* 1047 /*
1046 This loads the library Index*/ 1048 This loads the library Index*/
1047void LibraryDialog::FindLibrary() 1049void LibraryDialog::FindLibrary()
1048{ 1050{
1049 buttonLibrary->setDown(TRUE); 1051 buttonLibrary->setDown(TRUE);
1050 1052
1051 qApp->processEvents(); 1053 qApp->processEvents();
1052 if( QFile( new_index).exists() /* && this->isHidden() */) { 1054 if( QFile( new_index).exists() /* && this->isHidden() */) {
1053 newindexLib.setName( new_index); 1055 newindexLib.setName( new_index);
1054 indexLib.setName( new_index); 1056 indexLib.setName( new_index);
1055 odebug << "index file is "+ new_index << oendl; 1057 odebug << "index file is "+ new_index << oendl;
1056 Newlibrary(); 1058 Newlibrary();
1057 } else { 1059 } else {
1058 newindexLib.setName( old_index); 1060 newindexLib.setName( old_index);
1059 indexLib.setName( old_index); 1061 indexLib.setName( old_index);
1060 odebug << "new index nameis "+ old_index << oendl; 1062 odebug << "new index nameis "+ old_index << oendl;
1061 Library(); 1063 Library();
1062 } 1064 }
1063 indexLoaded=true; 1065 indexLoaded=true;
1064 buttonSearch->setEnabled(TRUE); 1066 buttonSearch->setEnabled(TRUE);
1065 moreInfoButton->setEnabled(TRUE); 1067 moreInfoButton->setEnabled(TRUE);
1066 1068
1067 buttonLibrary->setDown(FALSE); 1069 buttonLibrary->setDown(FALSE);
1068 buttonNewList->setText("Download"); 1070 buttonNewList->setText("Download");
1069 qApp->processEvents(); 1071 qApp->processEvents();
1070 1072
1071} 1073}
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
index 72d605e..60c1c75 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp
@@ -191,91 +191,92 @@ void LibraryDialog::initDialog(){
191 ListView1->setSorting( 2, TRUE); 191 ListView1->setSorting( 2, TRUE);
192 ListView2->setSorting( 2, TRUE); 192 ListView2->setSorting( 2, TRUE);
193 ListView3->setSorting( 2, TRUE); 193 ListView3->setSorting( 2, TRUE);
194 ListView4->setSorting( 2, TRUE); 194 ListView4->setSorting( 2, TRUE);
195 ListView5->setSorting( 2, TRUE); 195 ListView5->setSorting( 2, TRUE);
196 ListView1->setAllColumnsShowFocus( TRUE ); 196 ListView1->setAllColumnsShowFocus( TRUE );
197 ListView2->setAllColumnsShowFocus( TRUE ); 197 ListView2->setAllColumnsShowFocus( TRUE );
198 ListView3->setAllColumnsShowFocus( TRUE ); 198 ListView3->setAllColumnsShowFocus( TRUE );
199 ListView4->setAllColumnsShowFocus( TRUE ); 199 ListView4->setAllColumnsShowFocus( TRUE );
200 ListView5->setAllColumnsShowFocus( TRUE ); 200 ListView5->setAllColumnsShowFocus( TRUE );
201 201
202 QGridLayout *layout6 = new QGridLayout(widget_6 ); 202 QGridLayout *layout6 = new QGridLayout(widget_6 );
203 QComboBox * sortingCombo; 203 QComboBox * sortingCombo;
204 buttonCancel = new QPushButton( widget_6, "buttonCancel" ); 204 buttonCancel = new QPushButton( widget_6, "buttonCancel" );
205 checkBox = new QCheckBox( ( tr("Open Automatically")), widget_6); 205 checkBox = new QCheckBox( ( tr("Open Automatically")), widget_6);
206 checkBox->setChecked( FALSE); 206 checkBox->setChecked( FALSE);
207// httpBox = new QCheckBox( ( tr("Use http")),widget_6); 207// httpBox = new QCheckBox( ( tr("Use http")),widget_6);
208// httpBox->setChecked( FALSE); 208// httpBox->setChecked( FALSE);
209// QToolTip::add( httpBox, ( tr("Use http to download \nproxy users should probably use this.")) ); 209// QToolTip::add( httpBox, ( tr("Use http to download \nproxy users should probably use this.")) );
210 authBox= new QCheckBox( ( tr("Last name first \n(requires library restart)")),widget_6); 210 authBox= new QCheckBox( ( tr("Last name first \n(requires library restart)")),widget_6);
211 authBox->setChecked( FALSE); 211 authBox->setChecked( FALSE);
212 212
213 layout1->addMultiCellWidget( ListView1, 0, 0, 0, 4); 213 layout1->addMultiCellWidget( ListView1, 0, 0, 0, 4);
214 layout2->addMultiCellWidget( ListView2, 0, 0, 0, 4); 214 layout2->addMultiCellWidget( ListView2, 0, 0, 0, 4);
215 layout3->addMultiCellWidget( ListView3, 0, 0, 0, 4); 215 layout3->addMultiCellWidget( ListView3, 0, 0, 0, 4);
216 layout4->addMultiCellWidget( ListView4, 0, 0, 0, 4); 216 layout4->addMultiCellWidget( ListView4, 0, 0, 0, 4);
217 layout5->addMultiCellWidget( ListView5, 0, 0, 0, 4); 217 layout5->addMultiCellWidget( ListView5, 0, 0, 0, 4);
218 218
219 buttonSearch = new QPushButton(this,"buttonSearch"); 219 buttonSearch = new QPushButton(this,"buttonSearch");
220 buttonLibrary=new QPushButton(this,"buttenLibrary"); 220 buttonLibrary=new QPushButton(this,"buttenLibrary");
221 buttonNewList=new QPushButton(this,"NewList"); 221 buttonNewList=new QPushButton(this,"NewList");
222 moreInfoButton= new QPushButton(this,"moreInfo"); 222 moreInfoButton= new QPushButton(this,"moreInfo");
223 sortingCombo=new QComboBox(widget_6,"sort by combo"); 223 sortingCombo=new QComboBox(widget_6,"sort by combo");
224 224
225 225
226 layout6->addMultiCellWidget(buttonCancel, 0, 0, 4, 4); 226 layout6->addMultiCellWidget(buttonCancel, 0, 0, 4, 4);
227 layout6->addMultiCellWidget(checkBox, 1, 1, 0, 0); 227 layout6->addMultiCellWidget(checkBox, 1, 1, 0, 0);
228 layout6->addMultiCellWidget(sortingCombo, 2, 2, 0, 0); 228 layout6->addMultiCellWidget(sortingCombo, 2, 2, 0, 0);
229 layout6->addMultiCellWidget(authBox, 3, 3, 0, 0); 229 layout6->addMultiCellWidget(authBox, 3, 3, 0, 0);
230 230
231 layout->addMultiCellWidget( buttonSearch, 1, 1, 0, 0); 231 layout->addMultiCellWidget( buttonSearch, 1, 1, 0, 0);
232 layout->addMultiCellWidget( buttonLibrary, 1, 1, 1, 1); 232 layout->addMultiCellWidget( buttonLibrary, 1, 1, 1, 1);
233 layout->addMultiCellWidget( moreInfoButton, 1, 1, 2, 2); 233 layout->addMultiCellWidget( moreInfoButton, 1, 1, 2, 2);
234 layout->addMultiCellWidget( buttonNewList, 1, 1, 3, 3); 234 layout->addMultiCellWidget( buttonNewList, 1, 1, 3, 3);
235 235
236 moreInfoButton->setText("Info"); 236 moreInfoButton->setText("Info");
237 moreInfoButton->setDisabled(TRUE); 237 moreInfoButton->setDisabled(TRUE);
238 buttonSearch->setDisabled(TRUE); 238 buttonSearch->setDisabled(TRUE);
239 buttonSearch->setDefault(TRUE);
239 240
240 buttonSearch->setText(tr("Search")); 241 buttonSearch->setText(tr("Search"));
241 242
242 buttonCancel->setText(tr("Close")); 243 buttonCancel->setText(tr("Close"));
243 buttonLibrary->setText("Load"); 244 buttonLibrary->setText("Load");
244 buttonLibrary->setDefault(TRUE); 245// buttonLibrary->setDefault(TRUE);
245 buttonNewList->setText("New List"); 246 buttonNewList->setText("New List");
246 247
247 QStrList sortingList; 248 QStrList sortingList;
248 sortingList.append( "Sort by Number"); 249 sortingList.append( "Sort by Number");
249 sortingList.append("Sort by Title"); 250 sortingList.append("Sort by Title");
250 sortingList.append( "Sort by Author"); 251 sortingList.append( "Sort by Author");
251 sortingList.append("Sort by Year"); 252 sortingList.append("Sort by Year");
252 253
253 sortingCombo->insertStrList(sortingList,0); 254 sortingCombo->insertStrList(sortingList,0);
254 sortingCombo->setCurrentItem(2); 255 sortingCombo->setCurrentItem(2);
255 sortingCombo->setMaximumWidth(180); 256 sortingCombo->setMaximumWidth(180);
256 257
257 // signals and slots connections 258 // signals and slots connections
258 connect(buttonSearch,SIGNAL(clicked()),this,SLOT(onButtonSearch())); 259 connect(buttonSearch,SIGNAL(clicked()),this,SLOT(onButtonSearch()));
259 connect(buttonLibrary,SIGNAL(clicked()),this,SLOT(FindLibrary())); 260 connect(buttonLibrary,SIGNAL(clicked()),this,SLOT(FindLibrary()));
260 connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); 261 connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));
261 connect(moreInfoButton,SIGNAL(clicked()),this,SLOT(moreInfo())); 262 connect(moreInfoButton,SIGNAL(clicked()),this,SLOT(moreInfo()));
262 connect(buttonNewList,SIGNAL(clicked()),this,SLOT(newList())); 263 connect(buttonNewList,SIGNAL(clicked()),this,SLOT(newList()));
263 264
264 connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 265 connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
265 connect(ListView1,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 266 connect(ListView1,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
266 connect(ListView2,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 267 connect(ListView2,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
267 connect(ListView2,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 268 connect(ListView2,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
268 connect(ListView3,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 269 connect(ListView3,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
269 connect(ListView3,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 270 connect(ListView3,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
270 connect(ListView4,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 271 connect(ListView4,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
271 connect(ListView4,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 272 connect(ListView4,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
272 connect(ListView5,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); 273 connect(ListView5,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*)));
273 connect(ListView5,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); 274 connect(ListView5,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*)));
274 275
275 connect(sortingCombo,SIGNAL(activated(int)),SLOT(comboSelect(int))); 276 connect(sortingCombo,SIGNAL(activated(int)),SLOT(comboSelect(int)));
276 277
277} 278}
278 279
279void LibraryDialog::doListView() { 280void LibraryDialog::doListView() {
280 281
281} 282}
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
index f14080f..be920dd 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -60,224 +60,225 @@
60#include <stdlib.h> 60#include <stdlib.h>
61#include <unistd.h> 61#include <unistd.h>
62#include <sys/stat.h> 62#include <sys/stat.h>
63#include <fcntl.h> 63#include <fcntl.h>
64#include <errno.h> 64#include <errno.h>
65 65
66static const int nfontsizes = 9; 66static const int nfontsizes = 9;
67static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24}; 67static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24};
68 68
69#ifdef NOQUICKLAUNCH 69#ifdef NOQUICKLAUNCH
70Gutenbrowser::Gutenbrowser() 70Gutenbrowser::Gutenbrowser()
71 Gutenbrowser(); 71 Gutenbrowser();
72#else 72#else
73Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) 73Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
74#endif 74#endif
75 : QMainWindow() 75 : QMainWindow()
76 { 76 {
77 // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 77 // QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
78 // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" ); 78 // QCopEnvelope e("QPE/System", "grabKeyboard(QString)" );
79 // e << ""; 79 // e << "";
80 // QPEApplication::grabKeyboard(); 80 // QPEApplication::grabKeyboard();
81 showMainList=TRUE; 81 showMainList=TRUE;
82 working=false; 82 working=false;
83 this->setUpdatesEnabled(TRUE); 83 this->setUpdatesEnabled(TRUE);
84 // #ifndef Q_WS_QWS 84 // #ifndef Q_WS_QWS
85 QString msg; 85 QString msg;
86 msg="You have now entered unto gutenbrowser,\n"; 86 msg="You have now entered unto gutenbrowser,\n";
87 msg+="make your self at home, sit back, relax and read something great.\n"; 87 msg+="make your self at home, sit back, relax and read something great.\n";
88 88
89 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 89 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
90 setCaption("Gutenbrowser");// Embedded " VERSION); 90 setCaption("Gutenbrowser");// Embedded " VERSION);
91 this->setUpdatesEnabled(TRUE); 91 this->setUpdatesEnabled(TRUE);
92 92
93 // bool firstTime=FALSE; 93 // bool firstTime=FALSE;
94 topLayout = new QVBoxLayout( this, 0, 0, "topLayout"); 94 topLayout = new QVBoxLayout( this, 0, 0, "topLayout");
95 95
96 menu = new QHBoxLayout(-1,"menu"); 96 menu = new QHBoxLayout(-1,"menu");
97 buttons2 = new QHBoxLayout(-1,"buttons2"); 97 buttons2 = new QHBoxLayout(-1,"buttons2");
98 edits = new QHBoxLayout(-1,"edits"); 98 edits = new QHBoxLayout(-1,"edits");
99 99
100 useSplitter=TRUE; 100 useSplitter=TRUE;
101 101
102 initConfig(); 102 initConfig();
103 initMenuBar(); 103 initMenuBar();
104 initButtonBar(); 104 initButtonBar();
105 initStatusBar(); 105 initStatusBar();
106 initView(); 106 initView();
107 initSlots(); 107 initSlots();
108 108 qDebug("init finished");
109 QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); 109 QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold);
110 110
111 connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), 111 connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)),
112 this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); 112 this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) );
113 if( useIcons) 113 if( useIcons)
114 toggleButtonIcons( TRUE); 114 toggleButtonIcons( TRUE);
115 else 115 else
116 toggleButtonIcons( FALSE); 116 toggleButtonIcons( FALSE);
117 117
118 enableButtons(false); 118 enableButtons(false);
119 119
120 Config config("Gutenbrowser"); // populate menubuttonlist 120 Config config("Gutenbrowser"); // populate menubuttonlist
121 config.setGroup("General"); 121 config.setGroup("General");
122 122
123 config.setGroup( "Files" ); 123 config.setGroup( "Files" );
124 QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); 124 QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
125 int i_numofFiles = s_numofFiles.toInt(); 125 int i_numofFiles = s_numofFiles.toInt();
126 126
127 QString tempFileName; 127 QString tempFileName;
128 128
129 for (int i = 0; i <= i_numofFiles; i++) { 129 for (int i = 0; i <= i_numofFiles; i++) {
130 // tempFileName.setNum(i); 130 // tempFileName.setNum(i);
131 config.setGroup( "Files" ); 131 config.setGroup( "Files" );
132 QString ramble = config.readEntry( QString::number(i), "" ); 132 QString ramble = config.readEntry( QString::number(i), "" );
133 133
134 config.setGroup( "Titles" ); 134 config.setGroup( "Titles" );
135 QString tempTitle = config.readEntry( ramble, ""); 135 QString tempTitle = config.readEntry( ramble, "");
136 config.setGroup( tempTitle); 136 config.setGroup( tempTitle);
137 int index=config.readNumEntry( "LineNumber", -1 ); 137 int index=config.readNumEntry( "LineNumber", -1 );
138 if( index != -1) { 138 if( index != -1) {
139 // odebug << tempTitle << oendl; 139 odebug << tempTitle << oendl;
140 bookmarksMenu->insertItem( tempTitle); 140 bookmarksMenu->insertItem( tempTitle);
141 } 141 }
142 } 142 }
143 143
144 // QString gutenIndex= local_library + "GUTINDEX.ALL"; 144 // QString gutenIndex= local_library + "GUTINDEX.ALL";
145 QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; 145 QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL";
146 146 qDebug("gutenindex "+gutenIndex );
147 if( QFile( gutenIndex).exists() ) { 147 if( QFile( gutenIndex).exists() ) {
148 indexLib.setName( gutenIndex); 148 indexLib.setName( gutenIndex);
149 } else { 149 } else {
150 QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; 150 QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT";
151 // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; 151 // QString localLibIndexFile= local_library + "PGWHOLE.TXT";
152 newindexLib.setName( localLibIndexFile); 152 newindexLib.setName( localLibIndexFile);
153 } 153 }
154 qDebug("attempting new library");
154 LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); 155 LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */);
155 loadCheck=false; 156 loadCheck = false;
156 chdir(local_library); 157 chdir(local_library);
157 if(!showMainList) { 158 if(!showMainList) {
158 Lview->setFocus(); 159 Lview->setFocus();
159 // if(firstTime) 160 // if(firstTime)
160 // Bookmark(); 161 // Bookmark();
161 for (int i=1;i< qApp->argc();i++) { 162 for (int i=1;i< qApp->argc();i++) {
162 odebug << "Suppose we open somethin" << oendl; 163 qDebug("Suppose we open somethin");
163 load(qApp->argv()[i]); 164 load(qApp->argv()[i]);
164 } 165 }
165 } else { 166 } else {
166 fillWithTitles(); 167 fillWithTitles();
167 mainList->setFocus(); 168 mainList->setFocus();
168 // mainList->setCurrentItem(0); 169 // mainList->setCurrentItem(0);
169 170
170 } 171 }
171 writeConfig(); 172 writeConfig();
172} //end init 173} //end init
173 174
174Gutenbrowser::~Gutenbrowser() { 175Gutenbrowser::~Gutenbrowser() {
175 // QPEApplication::grabKeyboard(); 176 // QPEApplication::grabKeyboard();
176 // QPEApplication::ungrabKeyboard(); 177 // QPEApplication::ungrabKeyboard();
177 odebug << "Exit" << oendl; 178 odebug << "Exit" << oendl;
178} 179}
179 180
180 /* 181 /*
181 Google.com search */ 182 Google.com search */
182void Gutenbrowser::InfoBarClick() { 183void Gutenbrowser::InfoBarClick() {
183 QString text; 184 QString text;
184 if( Lview->hasSelectedText()) { 185 if( Lview->hasSelectedText()) {
185 Lview->copy(); 186 Lview->copy();
186 QClipboard *cb = QApplication::clipboard(); 187 QClipboard *cb = QApplication::clipboard();
187 text = cb->text(); 188 text = cb->text();
188 } else { 189 } else {
189 // text=title; 190 // text=title;
190 text=this->caption(); 191 text=this->caption();
191 } 192 }
192 searchGoogle(text); 193 searchGoogle(text);
193} 194}
194 195
195 /* 196 /*
196 download http with wget or preferred browser */ 197 download http with wget or preferred browser */
197void Gutenbrowser::goGetit( const QString &url, bool showMsg) { 198void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
198 // int eexit=0; 199 // int eexit=0;
199 QString cmd; 200 QString cmd;
200 // config.read(); 201 // config.read();
201 qApp->processEvents(); 202 qApp->processEvents();
202 QString filename = QPEApplication::qpeDir(); 203 QString filename = QPEApplication::qpeDir();
203 if(filename.right(1)!="/") 204 if(filename.right(1)!="/")
204 filename+="/etc/gutenbrowser/"; 205 filename+="/etc/gutenbrowser/";
205 else 206 else
206 filename+="etc/gutenbrowser/"; 207 filename+="etc/gutenbrowser/";
207 odebug << "filename "+filename << oendl; 208 odebug << "filename "+filename << oendl;
208 // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; 209 // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/";
209 210
210 filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); 211 filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1);
211 212
212 Config config("Gutenbrowser"); 213 Config config("Gutenbrowser");
213 config.setGroup( "Browser" ); 214 config.setGroup( "Browser" );
214 QString brow = config.readEntry("Preferred", "Opera"); 215 QString brow = config.readEntry("Preferred", "Opera");
215 odebug << "Preferred browser is "+brow << oendl; 216 odebug << "Preferred browser is "+brow << oendl;
216 if(!showMsg) { //if we just get the gutenindex.all 217 if(!showMsg) { //if we just get the gutenindex.all
217 cmd="wget -O " + filename +" " + url+" 2>&1" ; 218 cmd="wget -O " + filename +" " + url+" 2>&1" ;
218 chdir(local_library); 219 chdir(local_library);
219 odebug << "Issuing the system command: " << cmd << "" << oendl; 220 odebug << "Issuing the system command: " << cmd << "" << oendl;
220 221
221 Output *outDlg; 222 Output *outDlg;
222 outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); 223 outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE);
223 outDlg->showMaximized(); 224 outDlg->showMaximized();
224 outDlg->show(); 225 outDlg->show();
225 qApp->processEvents(); 226 qApp->processEvents();
226 FILE *fp; 227 FILE *fp;
227 char line[130]; 228 char line[130];
228 outDlg->OutputEdit->append( tr("Running wget") ); 229 outDlg->OutputEdit->append( tr("Running wget") );
229 sleep(1); 230 sleep(1);
230 fp = popen( (const char *) cmd, "r"); 231 fp = popen( (const char *) cmd, "r");
231 // odebug << "Issuing the command\n"+cmd << oendl; 232 odebug << "Issuing the command\n"+cmd << oendl;
232 // system(cmd); 233 // system(cmd);
233 while ( fgets( line, sizeof line, fp)) { 234 while ( fgets( line, sizeof line, fp)) {
234 outDlg->OutputEdit->append(line); 235 outDlg->OutputEdit->append(line);
235 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 236// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
236 } 237 }
237 pclose(fp); 238 pclose(fp);
238 outDlg->close(); 239 outDlg->close();
239 if(outDlg) 240 if(outDlg)
240 delete outDlg; 241 delete outDlg;
241 } else { 242 } else {
242 if( brow == "Konq") { 243 if( brow == "Konq") {
243 cmd = "konqueror "+url+" &"; 244 cmd = "konqueror "+url+" &";
244 } 245 }
245 if( brow == "Opera") { //for desktop testing 246 if( brow == "Opera") { //for desktop testing
246 cmd = "opera "+url+" &"; 247 cmd = "opera "+url+" &";
247 } 248 }
248 // if( brow == "Opera") { // on Zaurus 249 // if( brow == "Opera") { // on Zaurus
249 // cmd = "operagui "+url+" &"; 250 // cmd = "operagui "+url+" &";
250 // } 251 // }
251 if( brow == "Mozilla") { 252 if( brow == "Mozilla") {
252 cmd = "mozilla "+url+" &"; 253 cmd = "mozilla "+url+" &";
253 } 254 }
254 if( brow == "Netscape") { 255 if( brow == "Netscape") {
255 cmd = "netscape "+url+" &"; 256 cmd = "netscape "+url+" &";
256 } 257 }
257 if(brow == "wget") { 258 if(brow == "wget") {
258 // cmd="wget -q "+url+" &"; 259 // cmd="wget -q "+url+" &";
259 QString tempHtml=local_library+"webster.html"; 260 QString tempHtml=local_library+"webster.html";
260 cmd="wget -O "+tempHtml+" -q "+url; 261 cmd="wget -O "+tempHtml+" -q "+url;
261 } 262 }
262 263
263 chdir(local_library); 264 chdir(local_library);
264 odebug << "Issuing the sys command: " << cmd << "" << oendl; 265 odebug << "Issuing the sys command: " << cmd << "" << oendl;
265 system(cmd); 266 system(cmd);
266 } 267 }
267} 268}
268 269
269void Gutenbrowser::toggleButtonIcons( bool useEm) { 270void Gutenbrowser::toggleButtonIcons( bool useEm) {
270 QString pixDir; 271 QString pixDir;
271 if(useEm) 272 if(useEm)
272 useEm=TRUE; 273 useEm=TRUE;
273 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; 274 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser";
274 odebug << "Docdir is "+QPEApplication::documentDir() << oendl; 275 odebug << "Docdir is "+QPEApplication::documentDir() << oendl;
275 276
276 if( useIcons && QDir( pixDir).exists() ) { 277 if( useIcons && QDir( pixDir).exists() ) {
277 LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline 278 LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline
278 OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); 279 OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook"));
279 ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline 280 ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline
280 BackButton->setPixmap( Resource::loadPixmap("back") );//in inline 281 BackButton->setPixmap( Resource::loadPixmap("back") );//in inline
281 SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline 282 SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline
282 lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); 283 lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder"));
283 setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); 284 setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") );
@@ -364,673 +365,668 @@ void Gutenbrowser::downloadLibIndex() {
364 // QString outputFile= local_library+ "GUTINDEX.ALL"; 365 // QString outputFile= local_library+ "GUTINDEX.ALL";
365 // config.setGroup( "FTPsite" ); // ftp server config 366 // config.setGroup( "FTPsite" ); // ftp server config
366 // ftp_host=config.readEntry("SiteName", ""); 367 // ftp_host=config.readEntry("SiteName", "");
367 // ftp_base_dir= config.readEntry("base", ""); 368 // ftp_base_dir= config.readEntry("base", "");
368 // QString networkUrl= "ftp://"+ftp_host+ftp_base_dir+"/GUTINDEX.ALL"; 369 // QString networkUrl= "ftp://"+ftp_host+ftp_base_dir+"/GUTINDEX.ALL";
369 QDir dir( local_library); 370 QDir dir( local_library);
370 dir.cd("", TRUE); 371 dir.cd("", TRUE);
371 goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3 372 goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3
372 // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3 373 // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3
373 // NetworkDialog *NetworkDlg; 374 // NetworkDialog *NetworkDlg;
374 // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile ); 375 // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile );
375 // if( NetworkDlg->exec() != 0 ) 376 // if( NetworkDlg->exec() != 0 )
376 // { // use new, improved, *INSTANT* network-dialog-file-getterer 377 // { // use new, improved, *INSTANT* network-dialog-file-getterer
377 //// QMessageBox::message("Note",""); 378 //// QMessageBox::message("Note","");
378 // } 379 // }
379 // if(NetworkDlg) 380 // if(NetworkDlg)
380 // delete NetworkDlg; 381 // delete NetworkDlg;
381} 382}
382 383
383 384
384void Gutenbrowser::PrintBtn() { 385void Gutenbrowser::PrintBtn() {
385} 386}
386 387
387void Gutenbrowser::SearchBtn() { 388void Gutenbrowser::SearchBtn() {
388 if( loadCheck) { 389 if( loadCheck) {
389 odebug << "loadCheck: we have a loaded doc" << oendl; 390 odebug << "loadCheck: we have a loaded doc" << oendl;
390 Search(); 391 Search();
391 } 392 }
392 // else 393 // else
393 // QMessageBox::message("Note","Sorry, can't search. No etext is loaded"); 394 // QMessageBox::message("Note","Sorry, can't search. No etext is loaded");
394} 395}
395 396
396 397
397void Gutenbrowser::ForwardBtn() { 398void Gutenbrowser::ForwardBtn() {
398 399
399 if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) { 400 if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) {
400 401
401 QString s; 402 QString s;
402 QString insertString; 403 QString insertString;
403 int pageSize= Lview->PageSize(); 404 int pageSize= Lview->PageSize();
404 Lview->clear(); 405 Lview->clear();
405 406
406 for(int fd=0; fd < pageSize - 1;fd++) { 407 for(int fd=0; fd < pageSize - 1;fd++) {
407 f.readLine(s, 256); 408 f.readLine(s, 256);
408 if(useWrap) 409 if(useWrap)
409 s.replace(QRegExp("\n"),""); 410 s.replace(QRegExp("\n"),"");
410 insertString+=s; 411 insertString+=s;
411 Lview->insertLine( s, -1); 412 Lview->insertLine( s, -1);
412 // odebug << s << oendl; 413 odebug << s << oendl;
413 currentLine++; 414 currentLine++;
414 } 415 }
415 // Lview->insertAt( insertString,0,0, FALSE); 416 // Lview->insertAt( insertString,0,0, FALSE);
416 currentFilePos = f.at(); 417 currentFilePos = f.at();
417 // if( i_pageNum != pages) { 418 // if( i_pageNum != pages) {
418 // Lview->MultiLine_Ex::pageDown( FALSE); 419 // Lview->MultiLine_Ex::pageDown( FALSE);
419 i_pageNum++; 420 i_pageNum++;
420 pageStopArray.resize(i_pageNum + 1); 421 pageStopArray.resize(i_pageNum + 1);
421 // int length = Lview->length(); 422 // int length = Lview->length();
422 423
423 pageStopArray[i_pageNum ] = currentFilePos; 424 pageStopArray[i_pageNum ] = currentFilePos;
424 // odebug << currentFilePos << " current page is number " << i_pageNum 425 odebug << currentFilePos << " current page is number " << i_pageNum
425 // << ", pagesize " << pageSize << ", length " << Lview->length() 426 << ", pagesize " << pageSize << ", length " << Lview->length()
426 // << ", current " << pageStopArray[i_pageNum] << oendl; 427 << ", current " << pageStopArray[i_pageNum] << oendl;
427 setStatus(); 428 setStatus();
428 Lview->setCursorPosition( 0, 0, FALSE); 429// Lview->setCursorPosition( 0, 0, FALSE);
429 // } 430 // }
430 431
431 } else { 432 } else {
432 // odebug << "bal" << oendl; 433 odebug << "bal" << oendl;
433 // if( i_pageNum != pages) { 434 // if( i_pageNum != pages) {
434 435
435 // // int newTop = Lview->Top(); 436 // // int newTop = Lview->Top();
436 // // if(Lview->lastRow() > i) 437 // // if(Lview->lastRow() > i)
437 // Lview->ScrollUp(1); 438 // Lview->ScrollUp(1);
438 // // i_pageNum++; 439 // // i_pageNum++;
439 // setStatus(); 440 // setStatus();
440 // Lview->setCursorPosition( Lview->Top(), 0, FALSE); 441 // Lview->setCursorPosition( Lview->Top(), 0, FALSE);
441 442
442 // } 443 // }
443 444
444 } 445 }
445 Lview->setFocus(); 446 Lview->setFocus();
446 447
447 // odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; 448 odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl;
448} 449}
449 450
450 451
451void Gutenbrowser::BackBtn() { 452void Gutenbrowser::BackBtn() {
452 if( i_pageNum > 0) { 453 if( i_pageNum > 0) {
453 int pageSize= Lview->PageSize(); 454 int pageSize= Lview->PageSize();
454 // int length=Lview->length(); 455 // int length=Lview->length();
455 456
456 i_pageNum--; 457 i_pageNum--;
457 currentFilePos = f.at(); 458 currentFilePos = f.at();
458 459
459 // odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ] 460 odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ]
460 // << ", current page number " << i_pageNum 461 << ", current page number " << i_pageNum
461 // << ", " << pageSize << ", length " << Lview->length() << oendl; 462 << ", " << pageSize << ", length " << Lview->length() << oendl;
462 463
463 if( i_pageNum < 2) { 464 if( i_pageNum < 2) {
464 f.at( 0); 465 f.at( 0);
465 } else { 466 } else {
466 if(!f.at( pageStopArray[i_pageNum - 1] )) 467 if(!f.at( pageStopArray[i_pageNum - 1] ))
467 odebug << "File positioned backward did not work" << oendl; 468 odebug << "File positioned backward did not work" << oendl;
468 } 469 }
469 QString s; 470 QString s;
470 // int sizeLine=0; 471 // int sizeLine=0;
471 Lview->clear(); 472 Lview->clear();
472 // QString insertString; 473 // QString insertString;
473 474
474 for(int fd = 0; fd < pageSize ;fd++) { 475 for(int fd = 0; fd < pageSize ;fd++) {
475 // Lview->removeLine( Lview->PageSize() ); 476 // Lview->removeLine( Lview->PageSize() );
476 f.readLine(s, 256); 477 f.readLine(s, 256);
477 if(useWrap) 478 if(useWrap)
478 s.replace(QRegExp("\n"),""); 479 s.replace(QRegExp("\n"),"");
479 currentLine++; 480 currentLine++;
480 // insertString+=s; 481 // insertString+=s;
481 Lview->insertLine( s, -1); 482 Lview->insertLine( s, -1);
482 } 483 }
483 484
484 // Lview->insertAt( insertString,0,0, FALSE); 485 // Lview->insertAt( insertString,0,0, FALSE);
485 486
486 if( !BackButton->autoRepeat() && !BackButton->isDown()) { 487 if( !BackButton->autoRepeat() && !BackButton->isDown()) {
487 QString topR; 488 QString topR;
488 QString lastR; 489 QString lastR;
489 QString pageR; 490 QString pageR;
490 // int sizer = Lview->lastRow() - Lview->topRow(); 491 // int sizer = Lview->lastRow() - Lview->topRow();
491 // int i_topRow = Lview->topRow(); 492 // int i_topRow = Lview->topRow();
492 if( i_pageNum < 1) 493 if( i_pageNum < 1)
493 i_pageNum = 1; 494 i_pageNum = 1;
494 setCaption(QString::number(i_pageNum)); 495 setCaption(QString::number(i_pageNum));
495 } else { 496 } else {
496 // int newTop = Lview->Top(); 497 // int newTop = Lview->Top();
497 // if(Lview->lastRow() > i) 498 // if(Lview->lastRow() > i)
498 Lview->MultiLine_Ex::pageUp( FALSE); 499 Lview->MultiLine_Ex::pageUp( FALSE);
499 // Lview->ScrollDown(1); 500 // Lview->ScrollDown(1);
500 // i_pageNum--; 501 // i_pageNum--;
501 if( i_pageNum < 1) 502 if( i_pageNum < 1)
502 i_pageNum = 1; 503 i_pageNum = 1;
503 setStatus(); 504 setStatus();
504 Lview->setCursorPosition( Lview->Top(), 0, FALSE); 505// Lview->setCursorPosition( Lview->Top(), 0, FALSE);
505 506
506 } 507 }
507 } 508 }
508 Lview->setFocus(); 509 Lview->setFocus();
509} 510}
510 511
511void Gutenbrowser::doBeginBtn() { 512void Gutenbrowser::doBeginBtn() {
512 if(loadCheck) { 513 if(loadCheck) {
513 qApp->processEvents(); 514 qApp->processEvents();
514 BeginBtn(); 515 BeginBtn();
515 } 516 }
516} 517}
517 518
518 // moves text to the very top = 0 519 // moves text to the very top = 0
519void Gutenbrowser::TopBtn() { 520void Gutenbrowser::TopBtn() {
520 521
521 if(loadCheck) { 522 if(loadCheck) {
522 if( i_pageNum != 0) { 523 if( i_pageNum != 0) {
523 odebug << "top" << oendl; 524 odebug << "top" << oendl;
524 qApp->processEvents(); 525 qApp->processEvents();
525 currentLine = 0; 526 currentLine = 0;
526 i_pageNum = 1; 527 i_pageNum = 1;
527 int pageSize = Lview->PageSize() ; 528 int pageSize = Lview->PageSize() ;
528 Lview->clear(); 529 Lview->clear();
529 QString s; 530 QString s;
530 f.at(0); 531 f.at(0);
531 for(int fd=0; fd < pageSize ;fd++) { 532 for(int fd=0; fd < pageSize ;fd++) {
532 f.readLine(s, 256); 533 f.readLine(s, 256);
533 if(useWrap) 534 if(useWrap)
534 s.replace(QRegExp("\n"),""); 535 s.replace(QRegExp("\n"),"");
535 Lview->insertLine(s ,-1); 536 Lview->insertLine(s ,-1);
536 currentLine++; 537 currentLine++;
537 } 538 }
538 Lview->setCursorPosition( 0,0, FALSE); 539// Lview->setCursorPosition( 0,0, FALSE);
539 i_pageNum=1; 540 i_pageNum=1;
540 setStatus(); 541 setStatus();
541 } 542 }
542 Lview->setFocus(); 543 Lview->setFocus();
543 } 544 }
544} 545}
545 546
546 //moves text to the start of the EText 547 //moves text to the start of the EText
547void Gutenbrowser::BeginBtn() { 548void Gutenbrowser::BeginBtn() {
548 i_pageNum = 1; 549 i_pageNum = 1;
549 currentLine = 0; 550 currentLine = 0;
550 QString s_pattern="*END*THE SMALL PRINT"; 551 QString s_pattern="*END*THE SMALL PRINT";
551 QString sPattern2 = "*END THE SMALL PRINT"; 552 QString sPattern2 = "*END THE SMALL PRINT";
552 553
553 int pageSize = Lview->PageSize(); 554 int pageSize = Lview->PageSize();
554 Lview->clear(); 555 Lview->clear();
555 556
556 // int lines = Lview->numLines(); 557 // int lines = Lview->numLines();
557 int pos = 0;//, i = 0; 558 int pos = 0;//, i = 0;
558 int i_topRow = Lview->topRow(); 559 int i_topRow = Lview->topRow();
559 560
560 QString LeftText;// = Lview->text(); 561 QString LeftText;// = Lview->text();
561 562
562 int linesPerPage = Lview->lastRow() - Lview->topRow(); 563 int linesPerPage = Lview->lastRow() - Lview->topRow();
563 // int pages = (( linesPerPage / Lview->editSize() ) ) +1; 564 // int pages = (( linesPerPage / Lview->editSize() ) ) +1;
564 // int pageN = 0; 565 // int pageN = 0;
565 i_pageNum = 1; 566 i_pageNum = 1;
566 int lastPage=1; 567 int lastPage=1;
567 int lineNo=0; 568 int lineNo=0;
568 QString s; 569 QString s;
569 f.at( 0); 570 f.at( 0);
570 571
571 while ( !f.atEnd() ) { 572 while ( !f.atEnd() ) {
572 f.readLine(s, 256); 573 f.readLine(s, 256);
573 lineNo++; 574 lineNo++;
574 LeftText = s; 575 LeftText = s;
575 currentFilePos = f.at(); 576 currentFilePos = f.at();
576 577
577 i_pageNum = lineNo/pageSize; 578 i_pageNum = lineNo/pageSize;
578 if(lastPage < i_pageNum) { 579 if(lastPage < i_pageNum) {
579 pageStopArray.resize(i_pageNum + 1); 580 pageStopArray.resize(i_pageNum + 1);
580 pageStopArray[i_pageNum ] = currentFilePos; 581 pageStopArray[i_pageNum ] = currentFilePos;
581 // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; 582 odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
582 } 583 }
583 // lastPage = i_pageNum; 584 // lastPage = i_pageNum;
584 if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { 585 if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) {
585 odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; 586 odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
586 break; 587 break;
587 } 588 }
588 } 589 }
589 if(f.atEnd()) //in case we didnt find anything, we need to show something 590 if(f.atEnd()) //in case we didnt find anything, we need to show something
590 f.at(0); 591 f.at(0);
591 Lview->clear(); 592 Lview->clear();
592 for(int fd=0; fd < pageSize - 1;fd++) { 593 for(int fd=0; fd < pageSize - 1;fd++) {
593 f.readLine(s, 256); 594 f.readLine(s, 256);
594 if(useWrap) 595 if(useWrap)
595 s.replace(QRegExp("\n"),""); 596 s.replace(QRegExp("\n"),"");
596 Lview->insertLine( s, -1); 597 Lview->insertLine( s, -1);
597 currentLine++; 598 currentLine++;
598 } 599 }
599 600
600 i_pageNum = lineNo/pageSize; 601 i_pageNum = lineNo/pageSize;
601 pageStopArray.resize(i_pageNum + 1); 602 pageStopArray.resize(i_pageNum + 1);
602 // int length = Lview->length(); 603 // int length = Lview->length();
603 604
604 qApp->processEvents(); 605 qApp->processEvents();
605 606
606 if( pos > i_topRow ) { 607 if( pos > i_topRow ) {
607 Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE); 608// Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE);
608 } else { 609 } else {
609 Lview->setCursorPosition( pos+2 , 0, FALSE ); 610// Lview->setCursorPosition( pos+2 , 0, FALSE );
610 } 611 }
611 612
612 Lview->deselect(); 613 Lview->deselect();
613 // AdjustStatus(); 614 // AdjustStatus();
614 Lview->setFocus(); 615 Lview->setFocus();
615} 616}
616 617
617 /* 618 /*
618 sets the current page and place as a bookmark*/ 619 sets the current page and place as a bookmark*/
619void Gutenbrowser::setBookmark() { 620void Gutenbrowser::setBookmark() {
620 int eexit=QMessageBox::information(this, "Note", 621 int eexit=QMessageBox::information(this, "Note",
621 "Do you really want to \nset this bookmark?." 622 "Do you really want to \nset this bookmark?."
622 ,QMessageBox::Yes, QMessageBox::No); 623 ,QMessageBox::Yes, QMessageBox::No);
623 if (eexit== 3) { 624 if (eexit== 3) {
624 625
625 currentFilePos = f.at(); 626 currentFilePos = f.at();
626 627
627 Config cfg("Gutenbrowser"); 628 Config cfg("Gutenbrowser");
628 cfg.setGroup("General"); 629 cfg.setGroup("General");
629 file_name=cfg.readEntry("Current",""); 630 file_name=cfg.readEntry("Current","");
630 qApp->processEvents(); 631 qApp->processEvents();
631 odebug << "Settingbook mark "+file_name << oendl; 632 odebug << "Settingbook mark "+file_name << oendl;
632 633
633 cfg.setGroup("Titles"); 634 cfg.setGroup("Titles");
634 title=cfg.readEntry(file_name,""); 635 title=cfg.readEntry(file_name,"");
635 odebug << "title is "+ title << oendl; 636 odebug << "title is "+ title << oendl;
636 637
637 cfg.setGroup( "Bookmarks" ); 638 cfg.setGroup( "Bookmarks" );
638 639
639 cfg.writeEntry("File Name",file_name); 640 cfg.writeEntry("File Name",file_name);
640 cfg.writeEntry("Page Number",QString::number(i_pageNum) ); 641 cfg.writeEntry("Page Number",QString::number(i_pageNum) );
641 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); 642 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1]));
642 cfg.writeEntry("Title", title); 643 cfg.writeEntry("Title", title);
643 644
644 int row = Lview->topRow();// Lview->Top(); 645 int row = Lview->topRow();// Lview->Top();
645 cfg.writeEntry("LineNumber",QString::number(row) ); 646 cfg.writeEntry("LineNumber",QString::number(row) );
646 647
647 cfg.setGroup(title); 648 cfg.setGroup(title);
648 cfg.writeEntry("File Name",file_name); 649 cfg.writeEntry("File Name",file_name);
649 cfg.writeEntry( "LineNumber", QString::number( row)); 650 cfg.writeEntry( "LineNumber", QString::number( row));
650 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); 651 cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1]));
651 cfg.writeEntry( "Page Number", QString::number( i_pageNum) ); 652 cfg.writeEntry( "Page Number", QString::number( i_pageNum) );
652 bookmarksMenu->insertItem( title); 653 bookmarksMenu->insertItem( title);
653 } 654 }
654} //end setBookmark 655} //end setBookmark
655 656
656 657
657 /* goes to last set bookmark*/ 658 /* goes to last set bookmark*/
658void Gutenbrowser::Bookmark( int itemId) { 659void Gutenbrowser::Bookmark( int itemId) {
659 660
660 // qApp->processEvents(); 661 // qApp->processEvents();
661 Config config("Gutenbrowser"); 662 Config config("Gutenbrowser");
662 config.setGroup( "Bookmarks" ); 663 config.setGroup( "Bookmarks" );
663 664
664 // odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl; 665 odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl;
665 666
666 QString itemString; 667 QString itemString;
667 668
668 odebug << "menu item " << itemId << "" << oendl; 669 odebug << "menu item " << itemId << "" << oendl;
669 QString tempTitle; 670 QString tempTitle;
670 QString s_Bmrkrow; 671 QString s_Bmrkrow;
671 QString s_pageNum; 672 QString s_pageNum;
672 int Bmrkrow=0; 673 int Bmrkrow=0;
673 int bookmarkPosition = 0; 674 int bookmarkPosition = 0;
674 675
675 // qApp->processEvents(); 676 // qApp->processEvents();
676 config.setGroup( "Bookmarks" ); 677 config.setGroup( "Bookmarks" );
677 title = config.readEntry("Title", ""); 678 title = config.readEntry("Title", "");
678 file_name = config.readEntry("File Name", ""); 679 file_name = config.readEntry("File Name", "");
679 i_pageNum = config.readNumEntry("Page Number", 0); 680 i_pageNum = config.readNumEntry("Page Number", 0);
680 bookmarkPosition = config.readNumEntry( "PagePosition",0); 681 bookmarkPosition = config.readNumEntry( "PagePosition",0);
681 Bmrkrow = config.readNumEntry("LineNumber",0); 682 Bmrkrow = config.readNumEntry("LineNumber",0);
682 if( !file_name.contains("/")) { 683 if( !file_name.contains("/")) {
683 file_name = local_library + file_name; 684 file_name = local_library + file_name;
684 } 685 }
685 686
686 // getTitle(file_name); 687 // getTitle(file_name);
687 // qApp->processEvents(); 688 // qApp->processEvents();
688 // Lview->setFocus(); 689 // Lview->setFocus();
689 this->setFocus(); 690 this->setFocus();
690 691
691 Lview->clear(); 692 Lview->clear();
692 693
693 load(file_name); 694 load(file_name);
694 695
695 int pageSize= Lview->PageSize(); 696 int pageSize= Lview->PageSize();
696 f.at(0); 697 f.at(0);
697 // Lview->clear(); 698 // Lview->clear();
698 QString s; 699 QString s;
699 int lineNo=0; 700 int lineNo=0;
700 int lastPage=1; 701 int lastPage=1;
701 while ( !f.atEnd() ) { 702 while ( !f.atEnd() ) {
702 f.readLine(s, 256); 703 f.readLine(s, 256);
703 lineNo++; 704 lineNo++;
704 currentFilePos = f.at(); 705 currentFilePos = f.at();
705 706
706 i_pageNum = lineNo/pageSize; 707 i_pageNum = lineNo/pageSize;
707 if(lastPage < i_pageNum) { 708 if(lastPage < i_pageNum) {
708 pageStopArray.resize(i_pageNum + 1); 709 pageStopArray.resize(i_pageNum + 1);
709 pageStopArray[i_pageNum ] = currentFilePos; 710 pageStopArray[i_pageNum ] = currentFilePos;
710 // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; 711 odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl;
711 } 712 }
712 if(currentFilePos == bookmarkPosition) 713 if(currentFilePos == bookmarkPosition)
713 break; 714 break;
714 } 715 }
715 if(f.atEnd()) 716 if(f.atEnd())
716 f.at(0); 717 f.at(0);
717 else 718 else
718 f.at( bookmarkPosition); 719 f.at( bookmarkPosition);
719 720
720 for(int fd=0; fd < pageSize - 1;fd++) { 721 for(int fd=0; fd < pageSize - 1;fd++) {
721 f.readLine(s, 256); 722 f.readLine(s, 256);
722 lineNo++; 723 lineNo++;
723 if(useWrap) 724 if(useWrap)
724 s.replace(QRegExp("\n"),""); 725 s.replace(QRegExp("\n"),"");
725 Lview->insertLine( s, -1); 726 Lview->insertLine( s, -1);
726 currentLine++; 727 currentLine++;
727 } 728 }
728 729
729 i_pageNum = lineNo/pageSize; 730 i_pageNum = lineNo/pageSize;
730 pageStopArray.resize(i_pageNum + 1); 731 pageStopArray.resize(i_pageNum + 1);
731 732
732 if(showMainList) { 733 if(showMainList) {
733 showMainList=FALSE; 734 showMainList=FALSE;
734 mainList->hide(); 735 mainList->hide();
735 Lview->show(); 736 Lview->show();
736 // qApp->processEvents(); 737 // qApp->processEvents();
737 } 738 }
738 739
739 odebug << "bookmark loaded" << oendl; 740 odebug << "bookmark loaded" << oendl;
740 setCaption(title); 741 setCaption(title);
741} 742}
742 743
743 744
744bool Gutenbrowser::load( const char *fileName) { 745bool Gutenbrowser::load( const char *fileName) {
745 746
746 // QCopEnvelope ( "QPE/System", "busy()" ); 747 // QCopEnvelope ( "QPE/System", "busy()" );
747 // odebug << "Title is already set as "+title << oendl; 748 odebug << "Title is already set as "+title << oendl;
748 odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; 749 odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl;
749 if( Lview->PageSize() < 4) { 750 if( Lview->PageSize() < 4) {
750 751
751 Lview->setMaximumHeight( sizeHint().height() ); 752 Lview->setMaximumHeight( sizeHint().height() );
752 Lview->setMinimumHeight( sizeHint().height() ); 753 Lview->setMinimumHeight( sizeHint().height() );
753 pointSize = Lview->fontInfo().pointSize(); 754 pointSize = Lview->fontInfo().pointSize();
754 odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; 755 odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl;
755 if(pointSize < 10) 756 if(pointSize < 10)
756 Lview->setFixedVisibleLines(19); 757 Lview->setFixedVisibleLines(19);
757 else 758 else
758 Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); 759 Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2);
759 } 760 }
760 761
761 Config cfg("Gutenbrowser"); 762 Config cfg("Gutenbrowser");
762 cfg.setGroup("General"); 763 cfg.setGroup("General");
763 cfg.writeEntry("Current",fileName); 764 cfg.writeEntry("Current",fileName);
764 currentLine=0; 765 currentLine=0;
765 766
766 file_name=fileName; 767 file_name=fileName;
767 QString o_file = fileName; 768 QString o_file = fileName;
768 769
769 // if (i_pageNum < 1) { 770 // if (i_pageNum < 1) {
770 i_pageNum = 1; 771 i_pageNum = 1;
771 // } 772 // }
772 odebug << "ready to open "+o_file << oendl; 773 odebug << "ready to open "+o_file << oendl;
773 774
774 if(f.isOpen()) f.close(); 775 if(f.isOpen()) f.close();
775 f.setName( o_file); 776 f.setName( o_file);
776 777
777 if ( !f.open( IO_ReadOnly)) { 778 if ( !f.open( IO_ReadOnly)) {
778 QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n" +o_file)) ); 779 QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n" +o_file)) );
779 return false; 780 return false;
780 } 781 }
781 currentFilePos = 0; 782 currentFilePos = 0;
782 pageStopArray.resize(3); 783 pageStopArray.resize(3);
783 pageStopArray[0] = currentFilePos; 784 pageStopArray[0] = currentFilePos;
784 785
785 fileHandle = f.handle(); 786 fileHandle = f.handle();
786 QString insertString; 787 QString insertString;
787 QTextStream t(&f); 788 QTextStream t(&f);
788 QString s; 789 QString s;
789 for(int fd=0; fd < Lview->PageSize() ;fd++) { 790 for(int fd=0; fd < Lview->PageSize() ;fd++) {
790 s=t.readLine(); 791 s=t.readLine();
791 // insertString+=s; 792 // insertString+=s;
792 if(useWrap) 793 if(useWrap)
793 s.replace(QRegExp("\n"),""); 794 s.replace(QRegExp("\n"),"");
794 // s.replace(QRegExp("\r"),""); 795 // s.replace(QRegExp("\r"),"");
795 Lview->insertLine( s,-1); 796 Lview->insertLine( s,-1);
796 currentLine++; 797 currentLine++;
797 } 798 }
798 799
799 // int length = Lview->length(); 800 // int length = Lview->length();
800 currentFilePos = f.at(); 801 currentFilePos = f.at();
801 802
802 pageStopArray[1] = currentFilePos; 803 pageStopArray[1] = currentFilePos;
803 804
804 odebug << "<<<<<<<<<<<" << currentFilePos << " current page is number " << i_pageNum 805 odebug << "<<<<<<<<<<<" << currentFilePos << " current page is number " << i_pageNum
805 << ", length " << Lview->length() << ", current " << pageStopArray[i_pageNum] 806 << ", length " << Lview->length() << ", current " << pageStopArray[i_pageNum]
806 << ", pageSize " << Lview->PageSize() << oendl; 807 << ", pageSize " << Lview->PageSize() << oendl;
807 808
808 Lview->setMaxLines(Lview->PageSize()*2); 809 Lview->setMaxLines(Lview->PageSize()*2);
809 odebug << "Gulped " << currentLine << "" << oendl; 810 odebug << "Gulped " << currentLine << "" << oendl;
810 setCaption(title); 811 setCaption(title);
811 Lview->setAutoUpdate( TRUE); 812 Lview->setAutoUpdate( TRUE);
812 813
813 Lview->setCursorPosition(0,0,FALSE); 814// Lview->setCursorPosition(0,0,FALSE);
814 815
815 // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; 816 // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1;
816 //odebug << "number of pages " << pages << "" << oendl; 817 //odebug << "number of pages " << pages << "" << oendl;
817 818
818 loadCheck = true; 819 loadCheck = true;
819 enableButtons(true); 820 enableButtons(true);
820 if( donateMenu->count() == 3) { 821 if( donateMenu->count() == 3) {
821 donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); 822 donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() ));
822 } 823 }
823 Lview->setFocus(); 824 Lview->setFocus();
824 825
825 // QCopEnvelope("QPE/System", "notBusy()" ); 826 // QCopEnvelope("QPE/System", "notBusy()" );
826 return true; 827 return true;
827} // end load 828} // end load
828 829
829void Gutenbrowser::Search() { 830void Gutenbrowser::Search() {
830 831
831 // if( searchDlg->isHidden()) 832 // if( searchDlg->isHidden())
832 { 833 {
833 odebug << "Starting search dialog" << oendl; 834 odebug << "Starting search dialog" << oendl;
834 searchDlg = new SearchDialog( this, "Etext Search", true); 835 searchDlg = new SearchDialog( this, "Etext Search", true);
835 searchDlg->setCaption( tr( "Etext Search" )); 836 searchDlg->setCaption( tr( "Etext Search" ));
836 // searchDlg->setLabel( "- searches etext"); 837 // searchDlg->setLabel( "- searches etext");
837 connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot())); 838 connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot()));
838 connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot())); 839 connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot()));
839 840
840 QString resultString; 841 QString resultString;
841 QString string = searchDlg->searchString; 842 QString string = searchDlg->searchString;
842 Lview->deselect(); 843 Lview->deselect();
843 searchDlg->show(); 844 searchDlg->show();
844 searchDlg->result(); 845 searchDlg->result();
845 } 846 }
846} 847}
847 848
848void Gutenbrowser::search_slot( ) { 849void Gutenbrowser::search_slot( ) {
849 int line, col; 850 int line, col;
850 if (!searchDlg /*&& !loadCheck */) 851 if (!searchDlg /*&& !loadCheck */)
851 return; 852 return;
852 853
853 Lview->getCursorPosition(&line,&col); 854 Lview->getCursorPosition(&line,&col);
854 QString to_find_string=searchDlg->get_text(); 855 QString to_find_string=searchDlg->get_text();
855 856
856 // searchDlg->get_direction();// is true if searching backward 857 // searchDlg->get_direction();// is true if searching backward
857 if ( last_search != 0 && searchDlg->get_direction() ){ 858 if ( last_search != 0 && searchDlg->get_direction() ){
858 col = col - pattern.length() - 1 ; 859 col = col - pattern.length() - 1 ;
859 } 860 }
860 again: 861 again:
861 int result = doSearch( to_find_string , /* searchDlg->case_sensitive()*/ TRUE, searchDlg->forward_search(), line, col); 862 int result = doSearch( to_find_string , /* searchDlg->case_sensitive()*/ TRUE, searchDlg->forward_search(), line, col);
862 if(result == 0){ 863 if(result == 0){
863 if(!searchDlg->get_direction()){ // forward search 864 if(!searchDlg->get_direction()){ // forward search
864 int query = QMessageBox::information( searchDlg, "Find", 865 int query = QMessageBox::information( searchDlg, "Find",
865 "End of document reached.\nContinue from the beginning?", 866 "End of document reached.\nContinue from the beginning?",
866 "Yes", "No", "", 0,1); 867 "Yes", "No", "", 0,1);
867 if (query == 0){ 868 if (query == 0){
868 line = 0; 869 line = 0;
869 col = 0; 870 col = 0;
870 goto again; 871 goto again;
871 } 872 }
872 } else { //backward search 873 } else { //backward search
873 int query = QMessageBox::information( searchDlg, "Find", 874 int query = QMessageBox::information( searchDlg, "Find",
874 "End of document reached.\nContinue from the beginning?", 875 "End of document reached.\nContinue from the beginning?",
875 "Yes", "No", "", 0,1); 876 "Yes", "No", "", 0,1);
876 if (query == 0){ 877 if (query == 0){
877 QString string = Lview->textLine( Lview->numLines() - 1 ); 878 QString string = Lview->textLine( Lview->numLines() - 1 );
878 line = Lview->numLines() - 1; 879 line = Lview->numLines() - 1;
879 lineCheck = line; 880 lineCheck = line;
880 col = string.length(); 881 col = string.length();
881 last_search = -1; //BACKWARD; 882 last_search = -1; //BACKWARD;
882 goto again; 883 goto again;
883 } 884 }
884 } 885 }
885 } else { 886 } else {
886 887
887 //// emit CursorPositionChanged(); textLine 888 //// emit CursorPositionChanged(); textLine
888 } 889 }
889} 890}
890 891
891int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, bool forward, int line, int col ) { 892int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, bool forward, int line, int col ) {
892 int i, length; 893 int i, length;
893 int pos = -1; 894 int pos = -1;
894 if(forward) { 895 if(forward) {
895 QString string; 896 QString string;
896 for(i = line; i < Lview->numLines(); i++) { 897 for(i = line; i < Lview->numLines(); i++) {
897 898
898 string = Lview->textLine(i); 899 string = Lview->textLine(i);
899 pos = string.find(s_pattern, i == line ? col : 0, case_sensitive); 900 pos = string.find(s_pattern, i == line ? col : 0, case_sensitive);
900 if( pos != -1) { 901 if( pos != -1) {
901 int top = Lview->Top(); 902 int top = Lview->Top();
902 length = s_pattern.length(); 903 length = s_pattern.length();
903 if( i > Lview->lastRow() ) { 904 if( i > Lview->lastRow() ) {
904 Lview->setCursorPosition(i,pos,FALSE); 905// Lview->setCursorPosition(i,pos,FALSE);
905 for(int l = 0 ; l < length; l++) { 906 for(int l = 0 ; l < length; l++) {
906 Lview->cursorRight(TRUE); 907 Lview->cursorRight(TRUE);
907 } 908 }
908 Lview->setCursorPosition( i , pos + length, TRUE ); 909// Lview->setCursorPosition( i , pos + length, TRUE );
909 int newTop = Lview->Top(); 910 int newTop = Lview->Top();
910 if(Lview->lastRow() > i) 911 if(Lview->lastRow() > i)
911 Lview->ScrollUp( newTop - top); 912 Lview->ScrollUp( newTop - top);
912 // AdjustStatus(); 913 // AdjustStatus();
913 } else { 914 } else {
914 Lview->setCursorPosition(i,pos,FALSE); 915// Lview->setCursorPosition(i,pos,FALSE);
915 for(int l = 0 ; l < length; l++) { 916 for(int l = 0 ; l < length; l++) {
916 Lview->cursorRight(TRUE); 917 Lview->cursorRight(TRUE);
917 } 918 }
918 Lview->setCursorPosition( i , pos + length, TRUE ); 919// Lview->setCursorPosition( i , pos + length, TRUE );
919 // AdjustStatus(); 920 // AdjustStatus();
920 } 921 }
921 pattern = s_pattern; 922 pattern = s_pattern;
922 last_search = 1; //FORWARD; 923 last_search = 1; //FORWARD;
923 return 1; 924 return 1;
924 } 925 }
925 } 926 }
926 } else { //////////////// searching backwards 927 } else { //////////////// searching backwards
927 QString string; 928 QString string;
928 for( i = line; i >= 0; i--) { 929 for( i = line; i >= 0; i--) {
929 string = Lview->textLine(i); 930 string = Lview->textLine(i);
930 int line_length = string.length(); 931 int line_length = string.length();
931 pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive); 932 pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive);
932 if (pos != -1) { 933 if (pos != -1) {
933 // int top = Lview->Top(); 934 // int top = Lview->Top();
934 length = s_pattern.length(); 935 length = s_pattern.length();
935 if( i < Lview->Top() ) { 936 if( i < Lview->Top() ) {
936 Lview->ScrollDown( Lview->PageSize() ); 937 Lview->ScrollDown( Lview->PageSize() );
937 Lview->MultiLine_Ex::pageUp( FALSE ); 938 Lview->MultiLine_Ex::pageUp( FALSE );
938 if( ! (line == i && pos > col ) ) { 939 if( ! (line == i && pos > col ) ) {
939 Lview->setCursorPosition( i ,pos ,FALSE ); 940// Lview->setCursorPosition( i ,pos ,FALSE );
940 for(int l = 0 ; l < length; l++) { 941 for(int l = 0 ; l < length; l++) {
941 Lview->cursorRight(TRUE); 942 Lview->cursorRight(TRUE);
942 } 943 }
943 Lview->setCursorPosition(i ,pos + length ,TRUE ); 944// Lview->setCursorPosition(i ,pos + length ,TRUE );
944 // int newTop = Lview->Top(); 945 // int newTop = Lview->Top();
945 /* if(useSplitter) Rview->ScrollUp( newTop - top); 946 /* if(useSplitter) Rview->ScrollUp( newTop - top);
946 */ } 947 */ }
947 } else { 948 } else {
948 if( ! (line == i && pos > col ) ) { 949 if( ! (line == i && pos > col ) ) {
949 Lview->setCursorPosition( i, pos, FALSE ); 950// Lview->setCursorPosition( i, pos, FALSE );
950 for( int l = 0 ; l < length; l++) { 951 for( int l = 0 ; l < length; l++) {
951 Lview->cursorRight( TRUE); 952 Lview->cursorRight( TRUE);
952 } 953 }
953 Lview->setCursorPosition( i, pos + length, TRUE ); 954// Lview->setCursorPosition( i, pos + length, TRUE );
954 } 955 }
955 pattern = s_pattern; 956 pattern = s_pattern;
956 last_search = -1; 957 last_search = -1;
957 return 1; 958 return 1;
958 } 959 }
959 } 960 }
960 } 961 }
961 } 962 }
962 return 0; 963 return 0;
963} 964}
964 965
965void Gutenbrowser::LibraryBtn() { 966void Gutenbrowser::LibraryBtn() {
966 967
967 QString newestLibraryFile ="pgwhole.zip"; 968 QString newestLibraryFile ="pgwhole.zip";
968 QString zipFile; 969 QString zipFile;
969 // odebug << "Local Library is " << local_library << " " << oendl; 970 // odebug << "Local Library is " << local_library << " " << oendl;
970 zipFile="/usr/bin/unzip"; 971 zipFile="/usr/bin/unzip";
971 // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl; 972 // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl;
972 if( QFile::exists( local_library+newestLibraryFile)) { 973 if( QFile::exists( local_library+newestLibraryFile)) {
973 if( QFile::exists(zipFile) ) { 974 if( QFile::exists(zipFile) ) {
974 UnZipIt(newestLibraryFile); 975 UnZipIt(newestLibraryFile);
975 } 976 }
976 else 977 else
977 QMessageBox::message( "Note",( tr("Please install unzip")) ); 978 QMessageBox::message( "Note",( tr("Please install unzip")) );
978 } 979 }
979 // LibraryDlg = new LibraryDialog( this, "Library Index"); 980 // LibraryDlg = new LibraryDialog( this, "Library Index");
980 LibraryDlg->setCaption( tr( "Gutenberg Library")); 981 LibraryDlg->setCaption( tr( "Gutenberg Library"));
981 Config config("Gutenbrowser"); 982 Config config("Gutenbrowser");
982 config.setGroup("General"); 983 config.setGroup("General");
983 QString tmp=config.readEntry("RunBefore","FALSE"); 984
984 if(tmp=="FALSE") {
985 QMessageBox::message( "Note",
986 "<P>Your first time running gutenbrowser. You'll need to click the \"load library\" button to load the gutenberg index.</P>");
987 config.writeEntry("RunBefore","TRUE");
988 }
989 if(useSplitter) 985 if(useSplitter)
990 LibraryDlg->useSmallInterface=FALSE; 986 LibraryDlg->useSmallInterface=FALSE;
991 987
992 LibraryDlg->showMaximized(); 988 LibraryDlg->showMaximized();
993 989
994 if( LibraryDlg->exec() != 0 ) { 990 if( LibraryDlg->exec() != 0 ) {
995 listItemNumber = LibraryDlg->DlglistItemNumber; 991 listItemNumber = LibraryDlg->DlglistItemNumber;
996 listItemFile = LibraryDlg->DlglistItemFile; 992 listItemFile = LibraryDlg->DlglistItemFile;
997 listItemYear = LibraryDlg->DlglistItemYear; 993 listItemYear = LibraryDlg->DlglistItemYear;
998 listItemTitle = LibraryDlg->DlglistItemTitle; 994 listItemTitle = LibraryDlg->DlglistItemTitle;
999 file_name = LibraryDlg->File_Name; 995 file_name = LibraryDlg->File_Name;
1000 // odebug << "title is being set as "+title << oendl; 996 // odebug << "title is being set as "+title << oendl;
1001 title = listItemTitle; 997 title = listItemTitle;
1002 998
1003 // config.setGroup( "Proxy" ); 999 // config.setGroup( "Proxy" );
1004 // if( LibraryDlg->checked == 1) { 1000 // if( LibraryDlg->checked == 1) {
1005 // config.writeEntry("IsChecked", "TRUE"); 1001 // config.writeEntry("IsChecked", "TRUE");
1006 // } else { 1002 // } else {
1007 // config.writeEntry("IsChecked", "FALSE"); 1003 // config.writeEntry("IsChecked", "FALSE");
1008 // } 1004 // }
1009 // config.write(); 1005 // config.write();
1010 // config.read(); 1006 // config.read();
1011 if ( listItemNumber.isNull()) { 1007 if ( listItemNumber.isNull()) {
1012 } else { 1008 } else {
1013 i_pageNum = 1; 1009 i_pageNum = 1;
1014 if( file_name !="Error" && file_name.length() >2 && !file_name.isEmpty() ) { 1010 if( file_name !="Error" && file_name.length() >2 && !file_name.isEmpty() ) {
1015 //replace .zip with txt for opening it. 1011 //replace .zip with txt for opening it.
1016 // printf("\nFile name is now\n"); 1012 // printf("\nFile name is now\n");
1017 // printf(file_name); 1013 // printf(file_name);
1018 // printf("\n"); 1014 // printf("\n");
1019 // 1015 //
1020 if( file_name.find(".zip")) 1016 if( file_name.find(".zip"))
1021 { 1017 {
1022 odebug << "Found zip file\n" << oendl; 1018 odebug << "Found zip file\n" << oendl;
1023 // QStringList args; 1019 // QStringList args;
1024 // args="unzip"; 1020 // args="unzip";
1025 // args+="-o"; 1021 // args+="-o";
1026 // args+=local_library+file_name; 1022 // args+=local_library+file_name;
1027 // args+="-d"; 1023 // args+="-d";
1028 // args+=local_library; 1024 // args+=local_library;
1029 QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library; 1025 QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library;
1030 odebug << "Issuing the command "+ cmd << oendl; 1026 odebug << "Issuing the command "+ cmd << oendl;
1031 // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! 1027 // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea!
1032 // unzipProc->start(); 1028 // unzipProc->start();
1033 system(cmd); 1029 system(cmd);
1034 remove( file_name); 1030 remove( file_name);
1035 1031
1036 } 1032 }
@@ -1745,102 +1741,102 @@ void Gutenbrowser::enableButtons(bool b)
1745 editMenu->setItemEnabled( -8, b); 1741 editMenu->setItemEnabled( -8, b);
1746 1742
1747} 1743}
1748 1744
1749void Gutenbrowser::fillWithTitles() { 1745void Gutenbrowser::fillWithTitles() {
1750 Config config("Gutenbrowser"); 1746 Config config("Gutenbrowser");
1751 config.setGroup( "Files" ); 1747 config.setGroup( "Files" );
1752 int i_numofFiles = config.readNumEntry("NumberOfFiles", 0); 1748 int i_numofFiles = config.readNumEntry("NumberOfFiles", 0);
1753 mainList->clear(); 1749 mainList->clear();
1754 QString temp; 1750 QString temp;
1755 for (int i = 1; i <= i_numofFiles; i++) { 1751 for (int i = 1; i <= i_numofFiles; i++) {
1756 temp.setNum(i); 1752 temp.setNum(i);
1757 config.setGroup( "Files" ); 1753 config.setGroup( "Files" );
1758 QString ramble = config.readEntry(temp, "" ); 1754 QString ramble = config.readEntry(temp, "" );
1759 config.setGroup( "Titles" ); 1755 config.setGroup( "Titles" );
1760 temp = config.readEntry(ramble, ""); 1756 temp = config.readEntry(ramble, "");
1761 if( !temp.isEmpty()) { 1757 if( !temp.isEmpty()) {
1762 mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), temp, -1); 1758 mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), temp, -1);
1763 } 1759 }
1764 } 1760 }
1765} 1761}
1766 1762
1767void Gutenbrowser::listClickedSlot( QListBoxItem * index) { 1763void Gutenbrowser::listClickedSlot( QListBoxItem * index) {
1768 // if( !working) { 1764 // if( !working) {
1769 // working=true; 1765 // working=true;
1770 if(index) { 1766 if(index) {
1771 // QCopEnvelope ( "QPE/System", "busy()" ); 1767 // QCopEnvelope ( "QPE/System", "busy()" );
1772 title = index->text(); 1768 title = index->text();
1773 showMainList=FALSE; 1769 showMainList=FALSE;
1774 mainList->hide(); 1770 mainList->hide();
1775 Lview->show(); 1771 Lview->show();
1776 qApp->processEvents(); 1772 qApp->processEvents();
1777 QString temp; 1773 QString temp;
1778 temp.setNum( mainList->currentItem() + 1); 1774 temp.setNum( mainList->currentItem() + 1);
1779 // openFileTitle = title; 1775 // openFileTitle = title;
1780 Config config("Gutenbrowser"); 1776 Config config("Gutenbrowser");
1781 config.setGroup( "Files" ); 1777 config.setGroup( "Files" );
1782 QString file = config.readEntry(temp, ""); 1778 QString file = config.readEntry(temp, "");
1783 odebug << "About to load" << oendl; 1779 odebug << "About to load" << oendl;
1784 if( Lview->isVisible()) 1780 if( Lview->isVisible())
1785 load(file); 1781 load(file);
1786 1782
1787 config.setGroup( title); 1783 config.setGroup( title);
1788 file_name = config.readEntry("File Name", ""); 1784 file_name = config.readEntry("File Name", "");
1789 i_pageNum = config.readNumEntry("Page Number", 1); 1785 i_pageNum = config.readNumEntry("Page Number", 1);
1790 int Bmrkrow = config.readNumEntry("LineNumber", -1); 1786 int Bmrkrow = config.readNumEntry("LineNumber", -1);
1791 if(Bmrkrow > -1) { 1787 if(Bmrkrow > -1) {
1792 if( Bmrkrow > Lview->topRow() ) { 1788 if( Bmrkrow > Lview->topRow() ) {
1793 Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); 1789// Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE );
1794 Lview->ScrollUp( Bmrkrow - Lview->topRow() ); 1790 Lview->ScrollUp( Bmrkrow - Lview->topRow() );
1795 // AdjustStatus(); 1791 // AdjustStatus();
1796 } 1792 }
1797 else if( Bmrkrow < Lview->topRow() ) { 1793 else if( Bmrkrow < Lview->topRow() ) {
1798 Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); 1794// Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE );
1799 Lview->ScrollDown( Lview->topRow() - Bmrkrow ); 1795 Lview->ScrollDown( Lview->topRow() - Bmrkrow );
1800 // AdjustStatus(); 1796 // AdjustStatus();
1801 } 1797 }
1802 } 1798 }
1803 } 1799 }
1804} 1800}
1805 1801
1806void Gutenbrowser::infoGutenbrowser() { 1802void Gutenbrowser::infoGutenbrowser() {
1807 QMessageBox::message("Info","Gutenbrowser was developed by\n" 1803 QMessageBox::message("Info","Gutenbrowser was developed by\n"
1808 "Lorn Potter\n" 1804 "Lorn Potter\n"
1809 "ljp<ljp@llornkcor.com>\n"); 1805 "ljp<ljp@llornkcor.com>\n");
1810} 1806}
1811 1807
1812void Gutenbrowser::setDocument(const QString & frozenBoogers) { 1808void Gutenbrowser::setDocument(const QString & frozenBoogers) {
1813 this->hide(); 1809 this->hide();
1814 if(showMainList) { 1810 if(showMainList) {
1815 showMainList=FALSE; 1811 showMainList=FALSE;
1816 if(!mainList->isHidden()) 1812 if(!mainList->isHidden())
1817 mainList->hide(); 1813 mainList->hide();
1818 if(Lview->isHidden()) 1814 if(Lview->isHidden())
1819 Lview->show(); 1815 Lview->show();
1820 qApp->processEvents(); 1816 qApp->processEvents();
1821 } 1817 }
1822 DocLnk lnk; 1818 DocLnk lnk;
1823 lnk = DocLnk(frozenBoogers); 1819 lnk = DocLnk(frozenBoogers);
1824 // odebug << lnk.file() << oendl; 1820 // odebug << lnk.file() << oendl;
1825 title=lnk.comment(); 1821 title=lnk.comment();
1826 load( lnk.file()); 1822 load( lnk.file());
1827 this->show(); 1823 this->show();
1828 // odebug << title << oendl; 1824 // odebug << title << oendl;
1829 // qApp->processEvents(); 1825 // qApp->processEvents();
1830 // repaint(); 1826 // repaint();
1831} 1827}
1832 1828
1833void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) 1829void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & )
1834{ 1830{
1835 switch (mouse) { 1831 switch (mouse) {
1836 case 1: 1832 case 1:
1837 break; 1833 break;
1838 case 2: { 1834 case 2: {
1839 QPopupMenu m;// = new QPopupMenu( Local_View ); 1835 QPopupMenu m;// = new QPopupMenu( Local_View );
1840 m.insertItem( tr( "Open" ), this, SLOT( menuOpen() )); 1836 m.insertItem( tr( "Open" ), this, SLOT( menuOpen() ));
1841 m.insertSeparator(); 1837 m.insertSeparator();
1842 m.insertItem( tr( "Search google.com" ), this, SLOT( menuGoogle())); 1838 m.insertItem( tr( "Search google.com" ), this, SLOT( menuGoogle()));
1843 m.insertItem( tr( "Edit Title" ), this, SLOT( menuEditTitle())); 1839 m.insertItem( tr( "Edit Title" ), this, SLOT( menuEditTitle()));
1844 // m.insertSeparator(); 1840 // m.insertSeparator();
1845 // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 1841 // m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
1846 m.exec( QCursor::pos() ); 1842 m.exec( QCursor::pos() );