Diffstat (limited to 'noncore/apps/opie-gutenbrowser') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 92 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | 50 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/SearchDialog.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/browserDialog.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/fontDialog.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | 27 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 153 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/helpme.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/main.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/openetext.cpp | 55 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/optionsDialog.cpp | 36 |
12 files changed, 258 insertions, 217 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 5b22b00..270a4cf 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -4,35 +4,39 @@ | |||
4 | // begin : Sat Aug 19 2000 | 4 | // begin : Sat Aug 19 2000 |
5 | // copyright : (C) 2000 - 2004 by llornkcor | 5 | // copyright : (C) 2000 - 2004 by llornkcor |
6 | // email : ljp@llornkcor.com | 6 | // email : ljp@llornkcor.com |
7 | // ***************************************************/ | 7 | // ***************************************************/ |
8 | // /*************************************************************************** | 8 | // /*************************************************************************** |
9 | // * This program is free software; you can redistribute it and/or modify * | 9 | // * This program is free software; you can redistribute it and/or modify * |
10 | // * it under the terms of the GNU General Public License as published by * | 10 | // * it under the terms of the GNU General Public License as published by * |
11 | // * the Free Software Foundation; either version 2 of the License, or * | 11 | // * the Free Software Foundation; either version 2 of the License, or * |
12 | // * (at your option) any later version. * | 12 | // * (at your option) any later version. * |
13 | // ***************************************************************************/ | 13 | // ***************************************************************************/ |
14 | //ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL | 14 | //ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL |
15 | 15 | ||
16 | #include "LibraryDialog.h" | ||
17 | #include "output.h" | ||
18 | |||
19 | /* OPIE */ | ||
16 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
17 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/qpedialog.h> | 22 | #include <qpe/qpedialog.h> |
23 | #include <opie2/odebug.h> | ||
19 | 24 | ||
20 | #include "LibraryDialog.h" | 25 | /* QT */ |
21 | #include "output.h" | ||
22 | |||
23 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
24 | #include <qmultilineedit.h> | 27 | #include <qmultilineedit.h> |
25 | //#include <qlayout.h> | 28 | //#include <qlayout.h> |
26 | 29 | ||
30 | /* STD */ | ||
27 | #include <unistd.h> | 31 | #include <unistd.h> |
28 | #include <stdio.h> | 32 | #include <stdio.h> |
29 | #include <stdlib.h> | 33 | #include <stdlib.h> |
30 | 34 | ||
31 | /* | 35 | /* |
32 | * The dialog will by default be modeless, unless you set 'modal' to | 36 | * The dialog will by default be modeless, unless you set 'modal' to |
33 | * TRUE to construct a modal dialog. */ | 37 | * TRUE to construct a modal dialog. */ |
34 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl ) | 38 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl ) |
35 | : QDialog( parent, name, true/* modal*/, fl ) | 39 | : QDialog( parent, name, true/* modal*/, fl ) |
36 | { | 40 | { |
37 | if ( !name ) | 41 | if ( !name ) |
38 | setName( "LibraryDialog" ); | 42 | setName( "LibraryDialog" ); |
@@ -55,82 +59,82 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W | |||
55 | 59 | ||
56 | // iniFile = local_library+"gutenbrowserrc"; | 60 | // iniFile = local_library+"gutenbrowserrc"; |
57 | // new_index = local_library + "PGWHOLE.TXT"; | 61 | // new_index = local_library + "PGWHOLE.TXT"; |
58 | // old_index = local_library + "GUTINDEX.ALL"; | 62 | // old_index = local_library + "GUTINDEX.ALL"; |
59 | 63 | ||
60 | Config config("Gutenbrowser"); | 64 | Config config("Gutenbrowser"); |
61 | 65 | ||
62 | config.setGroup( "HttpServer" ); | 66 | config.setGroup( "HttpServer" ); |
63 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); | 67 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); |
64 | 68 | ||
65 | config.setGroup( "FTPsite" ); | 69 | config.setGroup( "FTPsite" ); |
66 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); | 70 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); |
67 | qDebug("Library Dialog: ftp_host is "+ftp_host); | 71 | odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; |
68 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 72 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
69 | // ftp_host=ftp_host.stripWhiteSpace(); | 73 | // ftp_host=ftp_host.stripWhiteSpace(); |
70 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); | 74 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); |
71 | 75 | ||
72 | i_binary = 0; | 76 | i_binary = 0; |
73 | 77 | ||
74 | config.setGroup("SortAuth"); | 78 | config.setGroup("SortAuth"); |
75 | if( config.readEntry("authSort", "FALSE") == "TRUE") | 79 | if( config.readEntry("authSort", "FALSE") == "TRUE") |
76 | authBox->setChecked(TRUE); | 80 | authBox->setChecked(TRUE); |
77 | 81 | ||
78 | config.setGroup("General"); | 82 | config.setGroup("General"); |
79 | downDir =config.readEntry( "DownloadDirectory",local_library); | 83 | downDir =config.readEntry( "DownloadDirectory",local_library); |
80 | qDebug("downDir is "+downDir); | 84 | odebug << "downDir is "+downDir << oendl; |
81 | newindexLib.setName( old_index); | 85 | newindexLib.setName( old_index); |
82 | indexLib.setName( old_index); | 86 | indexLib.setName( old_index); |
83 | 87 | ||
84 | new QPEDialogListener(this); | 88 | new QPEDialogListener(this); |
85 | } | 89 | } |
86 | 90 | ||
87 | LibraryDialog::~LibraryDialog() | 91 | LibraryDialog::~LibraryDialog() |
88 | { | 92 | { |
89 | // delete QList_Item2; | 93 | // delete QList_Item2; |
90 | // delete QList_Item1; | 94 | // delete QList_Item1; |
91 | // delete QList_Item3; | 95 | // delete QList_Item3; |
92 | // delete QList_Item4; | 96 | // delete QList_Item4; |
93 | // delete QList_Item5; | 97 | // delete QList_Item5; |
94 | 98 | ||
95 | //saveConfig(); | 99 | //saveConfig(); |
96 | } | 100 | } |
97 | 101 | ||
98 | /*This groks using PGWHOLE.TXT */ | 102 | /*This groks using PGWHOLE.TXT */ |
99 | void LibraryDialog::Newlibrary() | 103 | void LibraryDialog::Newlibrary() |
100 | { | 104 | { |
101 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files | 105 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files |
102 | //qDebug("Opening new library index %s",newindexLib); | 106 | //odebug << "Opening new library index " << newindexLib << "" << oendl; |
103 | if ( newindexLib.open( IO_ReadOnly) ) { | 107 | if ( newindexLib.open( IO_ReadOnly) ) { |
104 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully | 108 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully |
105 | QTextStream indexStream( &newindexLib ); | 109 | QTextStream indexStream( &newindexLib ); |
106 | QString indexLine; | 110 | QString indexLine; |
107 | while ( !indexStream.atEnd() ) { // until end of file.. | 111 | while ( !indexStream.atEnd() ) { // until end of file.. |
108 | indexLine = indexStream.readLine(); | 112 | indexLine = indexStream.readLine(); |
109 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { | 113 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { |
110 | year = indexLine.mid(4,4); | 114 | year = indexLine.mid(4,4); |
111 | year = year.stripWhiteSpace(); | 115 | year = year.stripWhiteSpace(); |
112 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); | 116 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); |
113 | file = file.stripWhiteSpace(); | 117 | file = file.stripWhiteSpace(); |
114 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 118 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
115 | if( year.toInt() < 1984) | 119 | if( year.toInt() < 1984) |
116 | number = number.left( number.length() -1 ); | 120 | number = number.left( number.length() -1 ); |
117 | number = number.stripWhiteSpace(); | 121 | number = number.stripWhiteSpace(); |
118 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 122 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
119 | title = title.stripWhiteSpace(); | 123 | title = title.stripWhiteSpace(); |
120 | 124 | ||
121 | getAuthor(); // groks author | 125 | getAuthor(); // groks author |
122 | author = author.stripWhiteSpace(); | 126 | author = author.stripWhiteSpace(); |
123 | if (authBox->isChecked()) { // this reverses the first name and last name of the author | 127 | if (authBox->isChecked()) { // this reverses the first name and last name of the author |
124 | // qDebug("Sorting last name first"); | 128 | // odebug << "Sorting last name first" << oendl; |
125 | QString lastName, firstName=""; | 129 | QString lastName, firstName=""; |
126 | int finder=author.findRev( ' ', -1, TRUE); | 130 | int finder=author.findRev( ' ', -1, TRUE); |
127 | lastName=author.right( author.length()-finder); | 131 | lastName=author.right( author.length()-finder); |
128 | firstName=author.left(finder); | 132 | firstName=author.left(finder); |
129 | lastName=lastName.stripWhiteSpace(); | 133 | lastName=lastName.stripWhiteSpace(); |
130 | firstName=firstName.stripWhiteSpace(); | 134 | firstName=firstName.stripWhiteSpace(); |
131 | 135 | ||
132 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 136 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
133 | author=lastName+", "+firstName; | 137 | author=lastName+", "+firstName; |
134 | } | 138 | } |
135 | 139 | ||
136 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { | 140 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { |
@@ -171,55 +175,55 @@ void LibraryDialog::Newlibrary() | |||
171 | } // end Newlibrary() | 175 | } // end Newlibrary() |
172 | 176 | ||
173 | 177 | ||
174 | void LibraryDialog::Library() | 178 | void LibraryDialog::Library() |
175 | {// old library groking method | 179 | {// old library groking method |
176 | 180 | ||
177 | ListView1->clear(); | 181 | ListView1->clear(); |
178 | ListView2->clear(); | 182 | ListView2->clear(); |
179 | ListView3->clear(); | 183 | ListView3->clear(); |
180 | ListView4->clear(); | 184 | ListView4->clear(); |
181 | ListView5->clear(); | 185 | ListView5->clear(); |
182 | 186 | ||
183 | qDebug("opening GUTINDEX.ALL file"); | 187 | odebug << "opening GUTINDEX.ALL file" << oendl; |
184 | IDontKnowWhy = ""; | 188 | IDontKnowWhy = ""; |
185 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully | 189 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully |
186 | QTextStream indexStream( &indexLib ); | 190 | QTextStream indexStream( &indexLib ); |
187 | QString indexLine; | 191 | QString indexLine; |
188 | qApp->processEvents(); | 192 | qApp->processEvents(); |
189 | // int jig; | 193 | // int jig; |
190 | while ( !indexStream.eof() ) { | 194 | while ( !indexStream.eof() ) { |
191 | 195 | ||
192 | indexLine = indexStream.readLine(); | 196 | indexLine = indexStream.readLine(); |
193 | if ( indexLine != "") { | 197 | if ( indexLine != "") { |
194 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { | 198 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { |
195 | // month = indexLine.left( 3); | 199 | // month = indexLine.left( 3); |
196 | year = indexLine.mid(4,4); | 200 | year = indexLine.mid(4,4); |
197 | // title = indexLine.mid( 9, 50); | 201 | // title = indexLine.mid( 9, 50); |
198 | file = indexLine.mid(60,12); | 202 | file = indexLine.mid(60,12); |
199 | if(file.left(1).find("[",0,TRUE) != -1) | 203 | if(file.left(1).find("[",0,TRUE) != -1) |
200 | file.remove(1,1); | 204 | file.remove(1,1); |
201 | if( file.find("]",0,TRUE) != -1) | 205 | if( file.find("]",0,TRUE) != -1) |
202 | file = file.left( file.find("]",0,TRUE)); | 206 | file = file.left( file.find("]",0,TRUE)); |
203 | //qDebug("file is "+file); | 207 | //odebug << "file is "+file << oendl; |
204 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 208 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
205 | number = indexLine.mid(55,5); | 209 | number = indexLine.mid(55,5); |
206 | number = number.stripWhiteSpace(); | 210 | number = number.stripWhiteSpace(); |
207 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 211 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
208 | title = indexLine.mid( 9, 50 ); | 212 | title = indexLine.mid( 9, 50 ); |
209 | title = title.stripWhiteSpace(); | 213 | title = title.stripWhiteSpace(); |
210 | //qDebug("title is "+title); | 214 | //odebug << "title is "+title << oendl; |
211 | getAuthor(); // grok author | 215 | getAuthor(); // grok author |
212 | author = author.stripWhiteSpace(); | 216 | author = author.stripWhiteSpace(); |
213 | //qDebug("author is "+author); | 217 | //odebug << "author is "+author << oendl; |
214 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author | 218 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author |
215 | QString lastName, firstName=""; | 219 | QString lastName, firstName=""; |
216 | int finder=author.findRev( ' ', -1, TRUE); | 220 | int finder=author.findRev( ' ', -1, TRUE); |
217 | lastName=author.right( author.length()-finder); | 221 | lastName=author.right( author.length()-finder); |
218 | firstName=author.left(finder); | 222 | firstName=author.left(finder); |
219 | lastName=lastName.stripWhiteSpace(); | 223 | lastName=lastName.stripWhiteSpace(); |
220 | firstName=firstName.stripWhiteSpace(); | 224 | firstName=firstName.stripWhiteSpace(); |
221 | 225 | ||
222 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 226 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
223 | author=lastName+", "+firstName; | 227 | author=lastName+", "+firstName; |
224 | } | 228 | } |
225 | 229 | ||
@@ -388,131 +392,131 @@ void LibraryDialog::select_title( QListViewItem * item) | |||
388 | } | 392 | } |
389 | break; | 393 | break; |
390 | case 4: { | 394 | case 4: { |
391 | ListView5->clearSelection(); | 395 | ListView5->clearSelection(); |
392 | } | 396 | } |
393 | break; | 397 | break; |
394 | }; | 398 | }; |
395 | } | 399 | } |
396 | 400 | ||
397 | if(DlglistItemTitle.length()>2) { | 401 | if(DlglistItemTitle.length()>2) { |
398 | // DlglistItemNumber = item->text(0); | 402 | // DlglistItemNumber = item->text(0); |
399 | item = 0; | 403 | item = 0; |
400 | qDebug( "string from librarydialog is:%s %s %s", DlglistItemYear.latin1(),DlglistItemFile.latin1(),DlglistItemNumber.latin1()); | 404 | odebug << "string from librarydialog is:" << DlglistItemYear << " " << DlglistItemFile << " " << DlglistItemNumber << "" << oendl; |
401 | qDebug("Title is "+DlglistItemTitle); | 405 | odebug << "Title is "+DlglistItemTitle << oendl; |
402 | 406 | ||
403 | // check for connection here | 407 | // check for connection here |
404 | // if( get_extext()) | 408 | // if( get_extext()) |
405 | 409 | ||
406 | if(download_Etext()) { | 410 | if(download_Etext()) { |
407 | // qDebug("get here 2"); | 411 | // odebug << "get here 2" << oendl; |
408 | if(i_binary == 1) { | 412 | if(i_binary == 1) { |
409 | 413 | ||
410 | } | 414 | } |
411 | if(checkBox->isChecked () ) { | 415 | if(checkBox->isChecked () ) { |
412 | accept(); | 416 | accept(); |
413 | } | 417 | } |
414 | } | 418 | } |
415 | } | 419 | } |
416 | } | 420 | } |
417 | 421 | ||
418 | bool LibraryDialog::download_Etext() | 422 | bool LibraryDialog::download_Etext() |
419 | { // ftp method | 423 | { // ftp method |
420 | // might have to use old gpl'd ftp for embedded!! | 424 | // might have to use old gpl'd ftp for embedded!! |
421 | Config cfg("Gutenbrowser"); | 425 | Config cfg("Gutenbrowser"); |
422 | cfg.setGroup("FTPsite"); | 426 | cfg.setGroup("FTPsite"); |
423 | ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); | 427 | ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); |
424 | ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); | 428 | ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); |
425 | 429 | ||
426 | qDebug("about to network dialog"); | 430 | odebug << "about to network dialog" << oendl; |
427 | QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; | 431 | QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; |
428 | 432 | ||
429 | //////////////////// FIXME- if 'x' is part of real name.... | 433 | //////////////////// FIXME- if 'x' is part of real name.... |
430 | NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE)); | 434 | NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE)); |
431 | 435 | ||
432 | if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { | 436 | if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { |
433 | NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); | 437 | NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); |
434 | qDebug("NewlistItemFile is now "+NewlistItemFile); | 438 | odebug << "NewlistItemFile is now "+NewlistItemFile << oendl; |
435 | } | 439 | } |
436 | NewlistItemYear = DlglistItemYear.right(2); | 440 | NewlistItemYear = DlglistItemYear.right(2); |
437 | int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); | 441 | int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); |
438 | qDebug(NewlistItemYear); | 442 | odebug << NewlistItemYear << oendl; |
439 | if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { | 443 | if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { |
440 | NewlistItemYear = "90"; | 444 | NewlistItemYear = "90"; |
441 | } | 445 | } |
442 | Edir ="etext" +NewlistItemYear; | 446 | Edir ="etext" +NewlistItemYear; |
443 | dir= ftp_base_dir + "/etext" +NewlistItemYear+"/"; | 447 | dir= ftp_base_dir + "/etext" +NewlistItemYear+"/"; |
444 | if( ftp_base_dir.find("=",0,true) ) | 448 | if( ftp_base_dir.find("=",0,true) ) |
445 | ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1); | 449 | ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1); |
446 | 450 | ||
447 | networkUrl= "ftp://"+ftp_host+dir; | 451 | networkUrl= "ftp://"+ftp_host+dir; |
448 | 452 | ||
449 | outputFile=local_library+".guten_temp"; | 453 | outputFile=local_library+".guten_temp"; |
450 | //qDebug("Download file:%s",NewlistItemFile.latin1() ); | 454 | //odebug << "Download file:" << NewlistItemFile << "" << oendl; |
451 | qDebug("Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile); | 455 | odebug << "Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile << oendl; |
452 | QStringList networkList; | 456 | QStringList networkList; |
453 | networkList.append((const char *)ftp_host); | 457 | networkList.append((const char *)ftp_host); |
454 | networkList.append((const char *)dir); | 458 | networkList.append((const char *)dir); |
455 | networkList.append((const char *)outputFile); | 459 | networkList.append((const char *)outputFile); |
456 | networkList.append((const char *)NewlistItemFile); | 460 | networkList.append((const char *)NewlistItemFile); |
457 | //<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile; | 461 | //<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile; |
458 | 462 | ||
459 | NetworkDialog *NetworkDlg; | 463 | NetworkDialog *NetworkDlg; |
460 | NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList); | 464 | NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList); |
461 | 465 | ||
462 | 466 | ||
463 | if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer | 467 | if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer |
464 | File_Name= NetworkDlg->localFileName; | 468 | File_Name= NetworkDlg->localFileName; |
465 | qDebug("back to Library from Network Dialog"); | 469 | odebug << "back to Library from Network Dialog" << oendl; |
466 | qDebug("Just downloaded "+NetworkDlg->localFileName); | 470 | odebug << "Just downloaded "+NetworkDlg->localFileName << oendl; |
467 | 471 | ||
468 | // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found | 472 | // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found |
469 | // QString oldName=File_Name; | 473 | // QString oldName=File_Name; |
470 | // File_Name.replace(0,local_library.length(),downDir); | 474 | // File_Name.replace(0,local_library.length(),downDir); |
471 | // qDebug("File_Name now is "+File_Name); | 475 | // odebug << "File_Name now is "+File_Name << oendl; |
472 | 476 | ||
473 | // } | 477 | // } |
474 | // rename .txt to .etx | 478 | // rename .txt to .etx |
475 | if(NetworkDlg->successDownload) { | 479 | if(NetworkDlg->successDownload) { |
476 | qDebug("Filename is "+File_Name); | 480 | odebug << "Filename is "+File_Name << oendl; |
477 | if(File_Name.right(4)==".txt") { | 481 | if(File_Name.right(4)==".txt") { |
478 | QString s_fileName=File_Name; | 482 | QString s_fileName=File_Name; |
479 | s_fileName.replace( s_fileName.length()-3,3,"gtn"); | 483 | s_fileName.replace( s_fileName.length()-3,3,"gtn"); |
480 | // s_fileName.replace( s_fileName.length()-3,3,"etx"); | 484 | // s_fileName.replace( s_fileName.length()-3,3,"etx"); |
481 | rename(File_Name.latin1(),s_fileName.latin1()); | 485 | rename(File_Name.latin1(),s_fileName.latin1()); |
482 | File_Name=s_fileName; | 486 | File_Name=s_fileName; |
483 | 487 | ||
484 | qDebug("Filename is now "+File_Name); | 488 | odebug << "Filename is now "+File_Name << oendl; |
485 | 489 | ||
486 | } | 490 | } |
487 | if(File_Name.length() > 5 ) { | 491 | if(File_Name.length() > 5 ) { |
488 | setTitle(); | 492 | setTitle(); |
489 | QFileInfo fi(File_Name); | 493 | QFileInfo fi(File_Name); |
490 | QString name_file=fi.fileName(); | 494 | QString name_file=fi.fileName(); |
491 | name_file=name_file.left(name_file.length()-4); | 495 | name_file=name_file.left(name_file.length()-4); |
492 | 496 | ||
493 | qDebug("Setting doclink"); | 497 | odebug << "Setting doclink" << oendl; |
494 | DocLnk lnk; | 498 | DocLnk lnk; |
495 | qDebug("name is "+name_file); | 499 | odebug << "name is "+name_file << oendl; |
496 | lnk.setName(name_file); //sets file name | 500 | lnk.setName(name_file); //sets file name |
497 | qDebug("Title is "+DlglistItemTitle); | 501 | odebug << "Title is "+DlglistItemTitle << oendl; |
498 | lnk.setComment(DlglistItemTitle); | 502 | lnk.setComment(DlglistItemTitle); |
499 | 503 | ||
500 | qDebug("Filename is "+File_Name); | 504 | odebug << "Filename is "+File_Name << oendl; |
501 | lnk.setFile(File_Name); //sets File property | 505 | lnk.setFile(File_Name); //sets File property |
502 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D | 506 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D |
503 | lnk.setExec(File_Name); | 507 | lnk.setExec(File_Name); |
504 | lnk.setIcon("gutenbrowser/Gutenbrowser"); | 508 | lnk.setIcon("gutenbrowser/Gutenbrowser"); |
505 | if(!lnk.writeLink()) { | 509 | if(!lnk.writeLink()) { |
506 | qDebug("Writing doclink did not work"); | 510 | odebug << "Writing doclink did not work" << oendl; |
507 | } else { | 511 | } else { |
508 | } | 512 | } |
509 | } else | 513 | } else |
510 | QMessageBox::message("Note","There was an error\nwith the file"); | 514 | QMessageBox::message("Note","There was an error\nwith the file"); |
511 | } | 515 | } |
512 | } | 516 | } |
513 | return true; | 517 | return true; |
514 | } | 518 | } |
515 | 519 | ||
516 | bool LibraryDialog::httpDownload() | 520 | bool LibraryDialog::httpDownload() |
517 | {// httpDownload | 521 | {// httpDownload |
518 | #ifndef Q_WS_QWS | 522 | #ifndef Q_WS_QWS |
@@ -561,32 +565,32 @@ bool LibraryDialog::httpDownload() | |||
561 | 565 | ||
562 | void LibraryDialog::cancelIt() | 566 | void LibraryDialog::cancelIt() |
563 | { | 567 | { |
564 | saveConfig(); | 568 | saveConfig(); |
565 | 569 | ||
566 | DlglistItemNumber = ""; | 570 | DlglistItemNumber = ""; |
567 | this->reject(); | 571 | this->reject(); |
568 | } | 572 | } |
569 | 573 | ||
570 | bool LibraryDialog::setTitle() | 574 | bool LibraryDialog::setTitle() |
571 | { | 575 | { |
572 | Config config("Gutenbrowser"); | 576 | Config config("Gutenbrowser"); |
573 | qDebug("setting title"); | 577 | odebug << "setting title" << oendl; |
574 | qDebug(DlglistItemTitle); | 578 | odebug << DlglistItemTitle << oendl; |
575 | 579 | ||
576 | if( DlglistItemTitle.find("[",0,TRUE) != -1) | 580 | if( DlglistItemTitle.find("[",0,TRUE) != -1) |
577 | DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" ); | 581 | DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" ); |
578 | if( DlglistItemTitle.find("]",0,TRUE) !=-1) | 582 | if( DlglistItemTitle.find("]",0,TRUE) !=-1) |
579 | DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); | 583 | DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); |
580 | qDebug("Title being set is "+DlglistItemTitle); | 584 | odebug << "Title being set is "+DlglistItemTitle << oendl; |
581 | int test = 0; | 585 | int test = 0; |
582 | QString ramble, temp; | 586 | QString ramble, temp; |
583 | config.setGroup("Files"); | 587 | config.setGroup("Files"); |
584 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 588 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
585 | int i_numofFiles = s_numofFiles.toInt(); | 589 | int i_numofFiles = s_numofFiles.toInt(); |
586 | for ( int i = 0; i <= i_numofFiles; i++){ | 590 | for ( int i = 0; i <= i_numofFiles; i++){ |
587 | temp.setNum( i); | 591 | temp.setNum( i); |
588 | ramble = config.readEntry( temp, "" ); | 592 | ramble = config.readEntry( temp, "" ); |
589 | if( strcmp( ramble, File_Name) == 0){ | 593 | if( strcmp( ramble, File_Name) == 0){ |
590 | test = 1; | 594 | test = 1; |
591 | } | 595 | } |
592 | } | 596 | } |
@@ -729,36 +733,36 @@ void LibraryDialog::onButtonSearch() | |||
729 | } | 733 | } |
730 | } | 734 | } |
731 | 735 | ||
732 | tabWidget->setCurrentPage( curTab); | 736 | tabWidget->setCurrentPage( curTab); |
733 | 737 | ||
734 | Searchlist.sort(); | 738 | Searchlist.sort(); |
735 | SearchResultsDlg* SearchResultsDialog; | 739 | SearchResultsDlg* SearchResultsDialog; |
736 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); | 740 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); |
737 | 741 | ||
738 | SearchResultsDialog->showMaximized(); | 742 | SearchResultsDialog->showMaximized(); |
739 | if( SearchResultsDialog->exec() != 0) { | 743 | if( SearchResultsDialog->exec() != 0) { |
740 | texter = SearchResultsDialog->selText; | 744 | texter = SearchResultsDialog->selText; |
741 | // qDebug(texter); | 745 | // odebug << texter << oendl; |
742 | resultLs= SearchResultsDialog->resultsList; | 746 | resultLs= SearchResultsDialog->resultsList; |
743 | i_berger = 1; | 747 | i_berger = 1; |
744 | } | 748 | } |
745 | Searchlist.clear(); | 749 | Searchlist.clear(); |
746 | 750 | ||
747 | // if(SearchResultsDialog) | 751 | // if(SearchResultsDialog) |
748 | // delete SearchResultsDialog; | 752 | // delete SearchResultsDialog; |
749 | QString tester; | 753 | QString tester; |
750 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { | 754 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { |
751 | texter.sprintf("%s \n",(*it).latin1()); | 755 | texter.sprintf("%s \n",(*it).latin1()); |
752 | // qDebug(texter); | 756 | // odebug << texter << oendl; |
753 | if( tester!=texter) | 757 | if( tester!=texter) |
754 | parseSearchResults( texter); | 758 | parseSearchResults( texter); |
755 | tester = texter; | 759 | tester = texter; |
756 | } | 760 | } |
757 | if(searchDlg) | 761 | if(searchDlg) |
758 | delete searchDlg; | 762 | delete searchDlg; |
759 | } | 763 | } |
760 | if(checkBox->isChecked() ) { | 764 | if(checkBox->isChecked() ) { |
761 | accept(); | 765 | accept(); |
762 | } else { | 766 | } else { |
763 | setActiveWindow(); | 767 | setActiveWindow(); |
764 | } | 768 | } |
@@ -797,25 +801,25 @@ void LibraryDialog::parseSearchResults( QString resultStr) | |||
797 | // #if defined(_WS_WIN_) | 801 | // #if defined(_WS_WIN_) |
798 | // QString temp= QDir::convertSeparators(local_library); | 802 | // QString temp= QDir::convertSeparators(local_library); |
799 | // zipFile=QDir::convertSeparators( zipFile); | 803 | // zipFile=QDir::convertSeparators( zipFile); |
800 | // cmd = temp+"unzip.exe -o " +zipFile/*newestLibraryFile */+" -d " + temp; | 804 | // cmd = temp+"unzip.exe -o " +zipFile/*newestLibraryFile */+" -d " + temp; |
801 | // #endif | 805 | // #endif |
802 | // #ifndef Q_WS_QWS | 806 | // #ifndef Q_WS_QWS |
803 | // // QString cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; | 807 | // // QString cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; |
804 | // cmd = "unzip " + zipFile; | 808 | // cmd = "unzip " + zipFile; |
805 | // #endif | 809 | // #endif |
806 | 810 | ||
807 | // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No); | 811 | // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No); |
808 | // if (exit==QMessageBox::Yes) { | 812 | // if (exit==QMessageBox::Yes) { |
809 | // qDebug("Issuing the command "+cmd); | 813 | // odebug << "Issuing the command "+cmd << oendl; |
810 | // #if defined(_WS_WIN_) | 814 | // #if defined(_WS_WIN_) |
811 | // WinExec( cmd, SW_HIDE ); | 815 | // WinExec( cmd, SW_HIDE ); |
812 | // #endif | 816 | // #endif |
813 | // #if defined(_WS_X11_) | 817 | // #if defined(_WS_X11_) |
814 | // system( cmd); | 818 | // system( cmd); |
815 | // #endif | 819 | // #endif |
816 | // #ifndef Q_WS_QWS | 820 | // #ifndef Q_WS_QWS |
817 | // system( cmd); | 821 | // system( cmd); |
818 | // #endif | 822 | // #endif |
819 | // // printf("unzip\n"); | 823 | // // printf("unzip\n"); |
820 | // // remove( zipFile /*newestLibraryFile*/); | 824 | // // remove( zipFile /*newestLibraryFile*/); |
821 | // return true; | 825 | // return true; |
@@ -831,43 +835,43 @@ void LibraryDialog::parseSearchResults( QString resultStr) | |||
831 | // return true; | 835 | // return true; |
832 | // } | 836 | // } |
833 | 837 | ||
834 | void LibraryDialog::sort() | 838 | void LibraryDialog::sort() |
835 | { | 839 | { |
836 | 840 | ||
837 | } | 841 | } |
838 | 842 | ||
839 | /* | 843 | /* |
840 | Downloads the current selected listitem*/ | 844 | Downloads the current selected listitem*/ |
841 | bool LibraryDialog::getItem(QListViewItem *it) | 845 | bool LibraryDialog::getItem(QListViewItem *it) |
842 | { | 846 | { |
843 | // qDebug("selected getItem"); | 847 | // odebug << "selected getItem" << oendl; |
844 | 848 | ||
845 | // DlglistItemNumber = it->text(0); | 849 | // DlglistItemNumber = it->text(0); |
846 | DlglistItemTitle = it->text(0); | 850 | DlglistItemTitle = it->text(0); |
847 | DlglistItemYear = it->text(2); | 851 | DlglistItemYear = it->text(2); |
848 | DlglistItemFile = it->text(3); | 852 | DlglistItemFile = it->text(3); |
849 | 853 | ||
850 | if(download_Etext()) { | 854 | if(download_Etext()) { |
851 | if(i_binary == 1) { | 855 | if(i_binary == 1) { |
852 | } | 856 | } |
853 | } | 857 | } |
854 | return true; | 858 | return true; |
855 | } | 859 | } |
856 | 860 | ||
857 | /* | 861 | /* |
858 | download button is pushed so we get the current items to download*/ | 862 | download button is pushed so we get the current items to download*/ |
859 | bool LibraryDialog::onButtonDownload() | 863 | bool LibraryDialog::onButtonDownload() |
860 | { | 864 | { |
861 | // qDebug("selected onButtonDownloadz"); | 865 | // odebug << "selected onButtonDownloadz" << oendl; |
862 | 866 | ||
863 | QListViewItemIterator it1( ListView1 ); | 867 | QListViewItemIterator it1( ListView1 ); |
864 | QListViewItemIterator it2( ListView2 ); | 868 | QListViewItemIterator it2( ListView2 ); |
865 | QListViewItemIterator it3( ListView3 ); | 869 | QListViewItemIterator it3( ListView3 ); |
866 | QListViewItemIterator it4( ListView4 ); | 870 | QListViewItemIterator it4( ListView4 ); |
867 | QListViewItemIterator it5( ListView5 ); | 871 | QListViewItemIterator it5( ListView5 ); |
868 | 872 | ||
869 | // iterate through all items of the listview | 873 | // iterate through all items of the listview |
870 | for ( ; it1.current(); ++it1 ) { | 874 | for ( ; it1.current(); ++it1 ) { |
871 | if ( it1.current()->isSelected() ) | 875 | if ( it1.current()->isSelected() ) |
872 | getItem(it1.current()); | 876 | getItem(it1.current()); |
873 | it1.current()->setSelected(FALSE); | 877 | it1.current()->setSelected(FALSE); |
@@ -891,25 +895,25 @@ bool LibraryDialog::onButtonDownload() | |||
891 | if ( it5.current()->isSelected() ) | 895 | if ( it5.current()->isSelected() ) |
892 | getItem(it5.current()); | 896 | getItem(it5.current()); |
893 | it5.current()->setSelected(FALSE); | 897 | it5.current()->setSelected(FALSE); |
894 | } | 898 | } |
895 | return true; | 899 | return true; |
896 | } | 900 | } |
897 | 901 | ||
898 | 902 | ||
899 | /* | 903 | /* |
900 | handles the sorting combo box */ | 904 | handles the sorting combo box */ |
901 | void LibraryDialog::comboSelect(int index) | 905 | void LibraryDialog::comboSelect(int index) |
902 | { | 906 | { |
903 | // qDebug("we are sorting"); | 907 | // odebug << "we are sorting" << oendl; |
904 | ListView1->setSorting( index, TRUE); | 908 | ListView1->setSorting( index, TRUE); |
905 | ListView2->setSorting( index, TRUE); | 909 | ListView2->setSorting( index, TRUE); |
906 | ListView3->setSorting( index, TRUE); | 910 | ListView3->setSorting( index, TRUE); |
907 | ListView4->setSorting( index, TRUE); | 911 | ListView4->setSorting( index, TRUE); |
908 | ListView5->setSorting( index, TRUE); | 912 | ListView5->setSorting( index, TRUE); |
909 | 913 | ||
910 | ListView1->sort(); | 914 | ListView1->sort(); |
911 | ListView2->sort(); | 915 | ListView2->sort(); |
912 | ListView3->sort(); | 916 | ListView3->sort(); |
913 | ListView4->sort(); | 917 | ListView4->sort(); |
914 | ListView5->sort(); | 918 | ListView5->sort(); |
915 | 919 | ||
@@ -921,60 +925,60 @@ void LibraryDialog::comboSelect(int index) | |||
921 | } | 925 | } |
922 | 926 | ||
923 | void LibraryDialog::newList() | 927 | void LibraryDialog::newList() |
924 | { | 928 | { |
925 | if(indexLoaded) { | 929 | if(indexLoaded) { |
926 | onButtonDownload(); | 930 | onButtonDownload(); |
927 | } else { | 931 | } else { |
928 | Output *outDlg; | 932 | Output *outDlg; |
929 | buttonNewList->setDown(TRUE); | 933 | buttonNewList->setDown(TRUE); |
930 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); | 934 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); |
931 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); | 935 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); |
932 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { | 936 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { |
933 | qDebug("changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser"); | 937 | odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; |
934 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 938 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
935 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; | 939 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; |
936 | 940 | ||
937 | int result = QMessageBox::warning( this,"Download" | 941 | int result = QMessageBox::warning( this,"Download" |
938 | ,"Ok to use /'wget/' to download\na new library list?\n" | 942 | ,"Ok to use /'wget/' to download\na new library list?\n" |
939 | ,"Yes","No",0,0,1); | 943 | ,"Yes","No",0,0,1); |
940 | qApp->processEvents(); | 944 | qApp->processEvents(); |
941 | if(result == 0) { | 945 | if(result == 0) { |
942 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); | 946 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); |
943 | outDlg->showMaximized(); | 947 | outDlg->showMaximized(); |
944 | outDlg->show(); | 948 | outDlg->show(); |
945 | qApp->processEvents(); | 949 | qApp->processEvents(); |
946 | FILE *fp; | 950 | FILE *fp; |
947 | char line[130]; | 951 | char line[130]; |
948 | outDlg->OutputEdit->append( tr("Running wget") ); | 952 | outDlg->OutputEdit->append( tr("Running wget") ); |
949 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 953 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
950 | sleep(1); | 954 | sleep(1); |
951 | fp = popen( (const char *) cmd, "r"); | 955 | fp = popen( (const char *) cmd, "r"); |
952 | if ( !fp ) { | 956 | if ( !fp ) { |
953 | } else { | 957 | } else { |
954 | qDebug("Issuing the command\n"+cmd); | 958 | odebug << "Issuing the command\n"+cmd << oendl; |
955 | // system(cmd); | 959 | // system(cmd); |
956 | while ( fgets( line, sizeof line, fp)) { | 960 | while ( fgets( line, sizeof line, fp)) { |
957 | outDlg->OutputEdit->append(line); | 961 | outDlg->OutputEdit->append(line); |
958 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 962 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
959 | } | 963 | } |
960 | pclose(fp); | 964 | pclose(fp); |
961 | outDlg->OutputEdit->append("Finished downloading\n"); | 965 | outDlg->OutputEdit->append("Finished downloading\n"); |
962 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 966 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
963 | qApp->processEvents(); | 967 | qApp->processEvents(); |
964 | 968 | ||
965 | // if( QFile(gutenindex1).exists() ) { | 969 | // if( QFile(gutenindex1).exists() ) { |
966 | // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 970 | // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
967 | // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) | 971 | // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) |
968 | // qDebug("renaming error"); | 972 | // odebug << "renaming error" << oendl; |
969 | // } | 973 | // } |
970 | 974 | ||
971 | } | 975 | } |
972 | // outDlg->close(); | 976 | // outDlg->close(); |
973 | FindLibrary(); | 977 | FindLibrary(); |
974 | if(outDlg) delete outDlg; | 978 | if(outDlg) delete outDlg; |
975 | } | 979 | } |
976 | buttonNewList->setDown(FALSE); | 980 | buttonNewList->setDown(FALSE); |
977 | } else { | 981 | } else { |
978 | QMessageBox::message("Note","Could not change directories"); | 982 | QMessageBox::message("Note","Could not change directories"); |
979 | } | 983 | } |
980 | // if(outDlg) | 984 | // if(outDlg) |
@@ -1015,53 +1019,53 @@ bool LibraryDialog::moreInfo() | |||
1015 | ListView4->clearSelection(); | 1019 | ListView4->clearSelection(); |
1016 | item = 0; | 1020 | item = 0; |
1017 | } | 1021 | } |
1018 | if( item == 0) | 1022 | if( item == 0) |
1019 | item = ListView5->currentItem(); | 1023 | item = ListView5->currentItem(); |
1020 | if( item != 0) { | 1024 | if( item != 0) { |
1021 | titleString = item->text(0); | 1025 | titleString = item->text(0); |
1022 | ListView5->clearSelection(); | 1026 | ListView5->clearSelection(); |
1023 | item = 0; | 1027 | item = 0; |
1024 | } | 1028 | } |
1025 | item=0; | 1029 | item=0; |
1026 | if(titleString.length()>2) { | 1030 | if(titleString.length()>2) { |
1027 | qDebug( "Title is "+titleString ); | 1031 | odebug << "Title is "+titleString << oendl; |
1028 | titleString.replace( QRegExp("\\s"), "%20"); | 1032 | titleString.replace( QRegExp("\\s"), "%20"); |
1029 | titleString.replace( QRegExp("'"), "%20"); | 1033 | titleString.replace( QRegExp("'"), "%20"); |
1030 | titleString.replace( QRegExp("\""), "%20"); | 1034 | titleString.replace( QRegExp("\""), "%20"); |
1031 | titleString.replace( QRegExp("&"), "%20"); | 1035 | titleString.replace( QRegExp("&"), "%20"); |
1032 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; | 1036 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; |
1033 | cmd="opera "+cmd; | 1037 | cmd="opera "+cmd; |
1034 | system(cmd); | 1038 | system(cmd); |
1035 | } else | 1039 | } else |
1036 | QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title."); | 1040 | QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title."); |
1037 | return true; | 1041 | return true; |
1038 | 1042 | ||
1039 | } | 1043 | } |
1040 | 1044 | ||
1041 | /* | 1045 | /* |
1042 | This loads the library Index*/ | 1046 | This loads the library Index*/ |
1043 | void LibraryDialog::FindLibrary() | 1047 | void LibraryDialog::FindLibrary() |
1044 | { | 1048 | { |
1045 | buttonLibrary->setDown(TRUE); | 1049 | buttonLibrary->setDown(TRUE); |
1046 | 1050 | ||
1047 | qApp->processEvents(); | 1051 | qApp->processEvents(); |
1048 | if( QFile( new_index).exists() /* && this->isHidden() */) { | 1052 | if( QFile( new_index).exists() /* && this->isHidden() */) { |
1049 | newindexLib.setName( new_index); | 1053 | newindexLib.setName( new_index); |
1050 | indexLib.setName( new_index); | 1054 | indexLib.setName( new_index); |
1051 | qDebug("index file is "+ new_index); | 1055 | odebug << "index file is "+ new_index << oendl; |
1052 | Newlibrary(); | 1056 | Newlibrary(); |
1053 | } else { | 1057 | } else { |
1054 | newindexLib.setName( old_index); | 1058 | newindexLib.setName( old_index); |
1055 | indexLib.setName( old_index); | 1059 | indexLib.setName( old_index); |
1056 | qDebug("new index nameis "+ old_index); | 1060 | odebug << "new index nameis "+ old_index << oendl; |
1057 | Library(); | 1061 | Library(); |
1058 | } | 1062 | } |
1059 | indexLoaded=true; | 1063 | indexLoaded=true; |
1060 | buttonSearch->setEnabled(TRUE); | 1064 | buttonSearch->setEnabled(TRUE); |
1061 | moreInfoButton->setEnabled(TRUE); | 1065 | moreInfoButton->setEnabled(TRUE); |
1062 | 1066 | ||
1063 | buttonLibrary->setDown(FALSE); | 1067 | buttonLibrary->setDown(FALSE); |
1064 | buttonNewList->setText("Download"); | 1068 | buttonNewList->setText("Download"); |
1065 | qApp->processEvents(); | 1069 | qApp->processEvents(); |
1066 | 1070 | ||
1067 | } | 1071 | } |
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp index aed53c6..6e6b707 100644 --- a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | |||
@@ -1,44 +1,50 @@ | |||
1 | // /*************************************************************************** | 1 | // /*************************************************************************** |
2 | // NetworkDialog.cpp - description | 2 | // NetworkDialog.cpp - description |
3 | // begin : Sun Aug 27 2000 | 3 | // begin : Sun Aug 27 2000 |
4 | // copyright : (C) 2000 - 2004 by L.J. Potter | 4 | // copyright : (C) 2000 - 2004 by L.J. Potter |
5 | // email : ljp@llornkcor.com | 5 | // email : ljp@llornkcor.com |
6 | // * This program is free software; you can redistribute it and/or modify * | 6 | // * This program is free software; you can redistribute it and/or modify * |
7 | // * it under the terms of the GNU General Public License as published by * | 7 | // * it under the terms of the GNU General Public License as published by * |
8 | // * the Free Software Foundation; either version 2 of the License, or * | 8 | // * the Free Software Foundation; either version 2 of the License, or * |
9 | // * (at your option) any later version. * | 9 | // * (at your option) any later version. * |
10 | // ***************************************************************************/ | 10 | // ***************************************************************************/ |
11 | // // half-assed attempt at providing a network dialog. | 11 | // // half-assed attempt at providing a network dialog. |
12 | // /* Created: Sun Aug 27 15:24:52 2000*/ | 12 | // /* Created: Sun Aug 27 15:24:52 2000*/ |
13 | #include <unistd.h> | ||
14 | 13 | ||
15 | extern "C" { | ||
16 | #include <ftplib.h> | ||
17 | } | ||
18 | 14 | ||
19 | #include "NetworkDialog.h" | 15 | #include "NetworkDialog.h" |
20 | #include "gutenbrowser.h" | 16 | #include "gutenbrowser.h" |
21 | 17 | ||
18 | /* OPIE */ | ||
19 | #include <opie2/odebug.h> | ||
20 | |||
21 | /* QT */ | ||
22 | #include <qprogressbar.h> | 22 | #include <qprogressbar.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qvaluelist.h> | 25 | #include <qvaluelist.h> |
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | 32 | ||
33 | /* STD */ | ||
34 | #include <unistd.h> | ||
35 | extern "C" { | ||
36 | #include <ftplib.h> | ||
37 | } | ||
38 | |||
33 | QProgressBar* ProgressBar1; | 39 | QProgressBar* ProgressBar1; |
34 | QPushButton* buttonCancel; | 40 | QPushButton* buttonCancel; |
35 | static netbuf *conn = NULL; | 41 | static netbuf *conn = NULL; |
36 | 42 | ||
37 | static int log_progress(netbuf *ctl, int xfered, void *arg) { | 43 | static int log_progress(netbuf *ctl, int xfered, void *arg) { |
38 | int fsz = *(int *)arg; | 44 | int fsz = *(int *)arg; |
39 | int pct = (xfered * 100) / fsz; | 45 | int pct = (xfered * 100) / fsz; |
40 | printf("%3d%%\r", pct); | 46 | printf("%3d%%\r", pct); |
41 | fflush(stdout); | 47 | fflush(stdout); |
42 | ProgressBar1->setProgress(xfered); | 48 | ProgressBar1->setProgress(xfered); |
43 | qApp->processEvents(); | 49 | qApp->processEvents(); |
44 | 50 | ||
@@ -110,170 +116,170 @@ void NetworkDialog::initDialog() { | |||
110 | warnLabel ->setGeometry( QRect( 5,1,230,25)); | 116 | warnLabel ->setGeometry( QRect( 5,1,230,25)); |
111 | TextLabel3->setGeometry( QRect( 5,20,230,25)); | 117 | TextLabel3->setGeometry( QRect( 5,20,230,25)); |
112 | Layout1->setGeometry( QRect(1,60,235,50)); //TODO check these!! | 118 | Layout1->setGeometry( QRect(1,60,235,50)); //TODO check these!! |
113 | 119 | ||
114 | // timer= new QTimer(this,"vu timer"); | 120 | // timer= new QTimer(this,"vu timer"); |
115 | // connectionTimer=new QTimer(this,"connectionTimeout"); | 121 | // connectionTimer=new QTimer(this,"connectionTimeout"); |
116 | 122 | ||
117 | connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk())); | 123 | connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk())); |
118 | connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); | 124 | connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); |
119 | // connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot())); | 125 | // connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot())); |
120 | // connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot())); | 126 | // connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot())); |
121 | if(autoOk) { | 127 | if(autoOk) { |
122 | qWarning("XXXXXXXXXXXXXXXXXXXXXXXX"); | 128 | owarn << "XXXXXXXXXXXXXXXXXXXXXXXX" << oendl; |
123 | buttonOk->setDown(true); | 129 | buttonOk->setDown(true); |
124 | doOk(); | 130 | doOk(); |
125 | } | 131 | } |
126 | } | 132 | } |
127 | 133 | ||
128 | void NetworkDialog::timeSlot() { | 134 | void NetworkDialog::timeSlot() { |
129 | 135 | ||
130 | // if(timerProgess < 19 && posTimer) { | 136 | // if(timerProgess < 19 && posTimer) { |
131 | // ProgressBar1->setProgress(timerProgess); | 137 | // ProgressBar1->setProgress(timerProgess); |
132 | // timerProgess++; | 138 | // timerProgess++; |
133 | // } else if(timerProgess > 19 && posTimer) { | 139 | // } else if(timerProgess > 19 && posTimer) { |
134 | // ProgressBar1->setProgress(timerProgess); | 140 | // ProgressBar1->setProgress(timerProgess); |
135 | // timerProgess++; | 141 | // timerProgess++; |
136 | // posTimer=FALSE; | 142 | // posTimer=FALSE; |
137 | // } | 143 | // } |
138 | // if(timerProgess > 1 &&!posTimer) { | 144 | // if(timerProgess > 1 &&!posTimer) { |
139 | // ProgressBar1->setProgress(timerProgess); | 145 | // ProgressBar1->setProgress(timerProgess); |
140 | // timerProgess--; | 146 | // timerProgess--; |
141 | // } else if(timerProgess > 1 &&!posTimer){ | 147 | // } else if(timerProgess > 1 &&!posTimer){ |
142 | // ProgressBar1->setProgress(timerProgess); | 148 | // ProgressBar1->setProgress(timerProgess); |
143 | // timerProgess--; | 149 | // timerProgess--; |
144 | // posTimer=TRUE; | 150 | // posTimer=TRUE; |
145 | // } | 151 | // } |
146 | // // qDebug("timer event"); | 152 | // // odebug << "timer event" << oendl; |
147 | // qApp->processEvents(); | 153 | // qApp->processEvents(); |
148 | // repaint(); | 154 | // repaint(); |
149 | } | 155 | } |
150 | 156 | ||
151 | void NetworkDialog::connectionTimeSlot() { | 157 | void NetworkDialog::connectionTimeSlot() { |
152 | // qDebug("Connections timed out"); | 158 | // odebug << "Connections timed out" << oendl; |
153 | // ftpQuit(); | 159 | // ftpQuit(); |
154 | // qApp->processEvents(); | 160 | // qApp->processEvents(); |
155 | // repaint(); | 161 | // repaint(); |
156 | // reject(); | 162 | // reject(); |
157 | } | 163 | } |
158 | 164 | ||
159 | 165 | ||
160 | /* | 166 | /* |
161 | downloads the file networkUrl */ | 167 | downloads the file networkUrl */ |
162 | bool NetworkDialog::downloadFile( QString networkUrl ) | 168 | bool NetworkDialog::downloadFile( QString networkUrl ) |
163 | { | 169 | { |
164 | int fsz; | 170 | int fsz; |
165 | // timer->start( 250 , FALSE); | 171 | // timer->start( 250 , FALSE); |
166 | // posTimer=TRUE; | 172 | // posTimer=TRUE; |
167 | // connectionTimer->start( 600 , FALSE); | 173 | // connectionTimer->start( 600 , FALSE); |
168 | warnLabel ->setText( ""); | 174 | warnLabel ->setText( ""); |
169 | qApp->processEvents(); | 175 | qApp->processEvents(); |
170 | qDebug("Downloading: %s",networkUrl.latin1()); | 176 | odebug << "Downloading: " << networkUrl << "" << oendl; |
171 | qDebug("Into: %s",localFileName.latin1()); | 177 | odebug << "Into: " << localFileName << "" << oendl; |
172 | if( networkUrl.length() > 5) { | 178 | if( networkUrl.length() > 5) { |
173 | QString ftp_user = "anonymous"; | 179 | QString ftp_user = "anonymous"; |
174 | QString ftp_pass = "zaurus@gutenbrowser.com"; | 180 | QString ftp_pass = "zaurus@gutenbrowser.com"; |
175 | // ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE), | 181 | // ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE), |
176 | if(ftp_host.length() < 2) { | 182 | if(ftp_host.length() < 2) { |
177 | qDebug("Please select an ftp host" ); | 183 | odebug << "Please select an ftp host" << oendl; |
178 | successDownload=false; | 184 | successDownload=false; |
179 | QMessageBox::message("Note","You need to select an ftp host"); | 185 | QMessageBox::message("Note","You need to select an ftp host"); |
180 | return false; | 186 | return false; |
181 | } | 187 | } |
182 | QString msg; | 188 | QString msg; |
183 | qDebug(ftp_host); | 189 | odebug << ftp_host << oendl; |
184 | qDebug("Opening ftp connection."); | 190 | odebug << "Opening ftp connection." << oendl; |
185 | warnLabel->setText("connecting to: "+ftp_host ); | 191 | warnLabel->setText("connecting to: "+ftp_host ); |
186 | qApp->processEvents(); | 192 | qApp->processEvents(); |
187 | /////////// Open FTP connection | 193 | /////////// Open FTP connection |
188 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 194 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
189 | i=0; | 195 | i=0; |
190 | successDownload=false; | 196 | successDownload=false; |
191 | QMessageBox::message("Note","Unable to connect to\n"+ftp_host); | 197 | QMessageBox::message("Note","Unable to connect to\n"+ftp_host); |
192 | return false; | 198 | return false; |
193 | } | 199 | } |
194 | TextLabel3->setText("Opening ftp connection."); | 200 | TextLabel3->setText("Opening ftp connection."); |
195 | qApp->processEvents(); | 201 | qApp->processEvents(); |
196 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 202 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
197 | FtpQuit(conn); | 203 | FtpQuit(conn); |
198 | successDownload=false; | 204 | successDownload=false; |
199 | msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); | 205 | msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); |
200 | QMessageBox::message("Note",msg); | 206 | QMessageBox::message("Note",msg); |
201 | return false; | 207 | return false; |
202 | } | 208 | } |
203 | qDebug("Changing directories."); | 209 | odebug << "Changing directories." << oendl; |
204 | TextLabel3->setText("Changing directories."); | 210 | TextLabel3->setText("Changing directories."); |
205 | qApp->processEvents(); | 211 | qApp->processEvents(); |
206 | if (!FtpChdir( dir.latin1(), conn )) { | 212 | if (!FtpChdir( dir.latin1(), conn )) { |
207 | successDownload=false; | 213 | successDownload=false; |
208 | msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); | 214 | msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); |
209 | QMessageBox::message("Note",msg); | 215 | QMessageBox::message("Note",msg); |
210 | FtpQuit(conn); | 216 | FtpQuit(conn); |
211 | return false; | 217 | return false; |
212 | } | 218 | } |
213 | // if (!FtpNlst( "./.guten_temp", dir, conn)) { | 219 | // if (!FtpNlst( "./.guten_temp", dir, conn)) { |
214 | // successDownload=false; | 220 | // successDownload=false; |
215 | // msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); | 221 | // msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); |
216 | // QMessageBox::message("Note",msg); | 222 | // QMessageBox::message("Note",msg); |
217 | // FtpQuit(conn); | 223 | // FtpQuit(conn); |
218 | // return false; | 224 | // return false; |
219 | // } | 225 | // } |
220 | qDebug("Requesting directory list."); | 226 | odebug << "Requesting directory list." << oendl; |
221 | TextLabel3->setText("Getting directory list."); | 227 | TextLabel3->setText("Getting directory list."); |
222 | qApp->processEvents(); | 228 | qApp->processEvents(); |
223 | if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) { | 229 | if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) { |
224 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn)); | 230 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn)); |
225 | QMessageBox::message("Note",msg); | 231 | QMessageBox::message("Note",msg); |
226 | successDownload=false; | 232 | successDownload=false; |
227 | FtpQuit(conn); | 233 | FtpQuit(conn); |
228 | return false; | 234 | return false; |
229 | } | 235 | } |
230 | QFile tmp("./.guten_temp"); | 236 | QFile tmp("./.guten_temp"); |
231 | QString s, File_Name; | 237 | QString s, File_Name; |
232 | 238 | ||
233 | if (tmp.open(IO_ReadOnly)) { | 239 | if (tmp.open(IO_ReadOnly)) { |
234 | QTextStream t( &tmp ); // use a text stream | 240 | QTextStream t( &tmp ); // use a text stream |
235 | qDebug("Finding partial filename "+s_partialFileName); | 241 | odebug << "Finding partial filename "+s_partialFileName << oendl; |
236 | while ( !t.eof()) { | 242 | while ( !t.eof()) { |
237 | s = t.readLine(); | 243 | s = t.readLine(); |
238 | 244 | ||
239 | if (s.contains(s_partialFileName, FALSE)) { | 245 | if (s.contains(s_partialFileName, FALSE)) { |
240 | QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) ); | 246 | QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) ); |
241 | 247 | ||
242 | if (str.contains(".txt")) { | 248 | if (str.contains(".txt")) { |
243 | File_Name = str; | 249 | File_Name = str; |
244 | qDebug("Found file_name "+ File_Name); | 250 | odebug << "Found file_name "+ File_Name << oendl; |
245 | break; | 251 | break; |
246 | } | 252 | } |
247 | // if (str.contains(".zip")) { | 253 | // if (str.contains(".zip")) { |
248 | // File_Name = str; | 254 | // File_Name = str; |
249 | // qDebug("Found file_name "+ File_Name); | 255 | // odebug << "Found file_name "+ File_Name << oendl; |
250 | // break; | 256 | // break; |
251 | // } | 257 | // } |
252 | 258 | ||
253 | } | 259 | } |
254 | } //end of while loop | 260 | } //end of while loop |
255 | tmp.close(); | 261 | tmp.close(); |
256 | // tmp.remove(); ///TODO this is for release version Zaurus | 262 | // tmp.remove(); ///TODO this is for release version Zaurus |
257 | } | 263 | } |
258 | else | 264 | else |
259 | qDebug("Error opening temp file."); | 265 | odebug << "Error opening temp file." << oendl; |
260 | 266 | ||
261 | Config cfg("Gutenbrowser"); | 267 | Config cfg("Gutenbrowser"); |
262 | cfg.setGroup("General"); | 268 | cfg.setGroup("General"); |
263 | QString temp=cfg.readEntry("DownloadDirectory",local_library); | 269 | QString temp=cfg.readEntry("DownloadDirectory",local_library); |
264 | 270 | ||
265 | localFileName = temp+File_Name; | 271 | localFileName = temp+File_Name; |
266 | qDebug("Requesting file "+ File_Name); | 272 | odebug << "Requesting file "+ File_Name << oendl; |
267 | qDebug( "Saving as "+localFileName); | 273 | odebug << "Saving as "+localFileName << oendl; |
268 | msg="Requesting file "+ File_Name; | 274 | msg="Requesting file "+ File_Name; |
269 | TextLabel3->setText(msg); | 275 | TextLabel3->setText(msg); |
270 | qApp->processEvents(); | 276 | qApp->processEvents(); |
271 | if( File_Name.length()>3) { | 277 | if( File_Name.length()>3) { |
272 | if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn)) | 278 | if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn)) |
273 | fsz = 0; | 279 | fsz = 0; |
274 | QString temp; | 280 | QString temp; |
275 | temp.sprintf( File_Name+" "+" %dkb", fsz); | 281 | temp.sprintf( File_Name+" "+" %dkb", fsz); |
276 | TextLabel3->setText(temp); | 282 | TextLabel3->setText(temp); |
277 | 283 | ||
278 | ProgressBar1->setTotalSteps(fsz); | 284 | ProgressBar1->setTotalSteps(fsz); |
279 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 285 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
@@ -284,34 +290,34 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
284 | if (!FtpGet( localFileName.latin1(), File_Name.latin1(), FTPLIB_ASCII, conn)) { | 290 | if (!FtpGet( localFileName.latin1(), File_Name.latin1(), FTPLIB_ASCII, conn)) { |
285 | msg.sprintf("Could not download "+ File_Name+"\n%s",FtpLastResponse(conn)); | 291 | msg.sprintf("Could not download "+ File_Name+"\n%s",FtpLastResponse(conn)); |
286 | successDownload=false; | 292 | successDownload=false; |
287 | QMessageBox::message("Note",msg); | 293 | QMessageBox::message("Note",msg); |
288 | update(); | 294 | update(); |
289 | } | 295 | } |
290 | } else { | 296 | } else { |
291 | QMessageBox::message("Note","Could not download file "+ File_Name); | 297 | QMessageBox::message("Note","Could not download file "+ File_Name); |
292 | successDownload=false; | 298 | successDownload=false; |
293 | FtpQuit(conn); | 299 | FtpQuit(conn); |
294 | return false; | 300 | return false; |
295 | } | 301 | } |
296 | qDebug("Ftp session successful"); | 302 | odebug << "Ftp session successful" << oendl; |
297 | successDownload=TRUE; | 303 | successDownload=TRUE; |
298 | FtpQuit(conn); | 304 | FtpQuit(conn); |
299 | return true; | 305 | return true; |
300 | } //no network url | 306 | } //no network url |
301 | return false; | 307 | return false; |
302 | } | 308 | } |
303 | 309 | ||
304 | void NetworkDialog::doOk() { | 310 | void NetworkDialog::doOk() { |
305 | qWarning("Do OK"); | 311 | owarn << "Do OK" << oendl; |
306 | QString loginStr; | 312 | QString loginStr; |
307 | loginStr = "gutenbrowser"; | 313 | loginStr = "gutenbrowser"; |
308 | if ( !ftp_host.isEmpty() ) { | 314 | if ( !ftp_host.isEmpty() ) { |
309 | if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) { | 315 | if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) { |
310 | TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) ); | 316 | TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) ); |
311 | // TextLabel2->setText( tr( "local file to download into: " +localFileName ) ); | 317 | // TextLabel2->setText( tr( "local file to download into: " +localFileName ) ); |
312 | 318 | ||
313 | if( downloadFile(ftp_host)) | 319 | if( downloadFile(ftp_host)) |
314 | successDownload = true; | 320 | successDownload = true; |
315 | else { | 321 | else { |
316 | successDownload = false; | 322 | successDownload = false; |
317 | reject(); | 323 | reject(); |
diff --git a/noncore/apps/opie-gutenbrowser/SearchDialog.cpp b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp index 4ddb3f0..d989304 100644 --- a/noncore/apps/opie-gutenbrowser/SearchDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp | |||
@@ -89,46 +89,46 @@ bool SearchDialog::get_direction() { | |||
89 | bool SearchDialog::case_sensitive() { | 89 | bool SearchDialog::case_sensitive() { |
90 | return true; | 90 | return true; |
91 | } | 91 | } |
92 | 92 | ||
93 | bool SearchDialog::forward_search() { | 93 | bool SearchDialog::forward_search() { |
94 | return true; | 94 | return true; |
95 | } | 95 | } |
96 | 96 | ||
97 | void SearchDialog::byeBye() | 97 | void SearchDialog::byeBye() |
98 | { | 98 | { |
99 | 99 | ||
100 | searchString = get_text(); | 100 | searchString = get_text(); |
101 | // qDebug("Search string is "+searchString); | 101 | // odebug << "Search string is "+searchString << oendl; |
102 | Config cfg("Gutenbrowser"); | 102 | Config cfg("Gutenbrowser"); |
103 | cfg.setGroup("General"); | 103 | cfg.setGroup("General"); |
104 | cfg.writeEntry("LastSearch",searchString); | 104 | cfg.writeEntry("LastSearch",searchString); |
105 | 105 | ||
106 | QString thisName=name(); | 106 | QString thisName=name(); |
107 | if( thisName.find("Library Search", 0, TRUE) != -1) { | 107 | if( thisName.find("Library Search", 0, TRUE) != -1) { |
108 | // searchString = SearchLineEdit->text(); | 108 | // searchString = SearchLineEdit->text(); |
109 | accept(); | 109 | accept(); |
110 | } else { | 110 | } else { |
111 | 111 | ||
112 | buttonOk->setDown(TRUE); | 112 | buttonOk->setDown(TRUE); |
113 | 113 | ||
114 | emit search_signal(); | 114 | emit search_signal(); |
115 | buttonOk->setDown(FALSE); | 115 | buttonOk->setDown(FALSE); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | void SearchDialog::closed() | 119 | void SearchDialog::closed() |
120 | { | 120 | { |
121 | searchString = get_text(); | 121 | searchString = get_text(); |
122 | // qDebug("Search string is "+searchString); | 122 | // odebug << "Search string is "+searchString << oendl; |
123 | Config cfg("Gutenbrowser"); | 123 | Config cfg("Gutenbrowser"); |
124 | cfg.setGroup("General"); | 124 | cfg.setGroup("General"); |
125 | cfg.writeEntry("LastSearch",searchString); | 125 | cfg.writeEntry("LastSearch",searchString); |
126 | 126 | ||
127 | emit search_done_signal(); | 127 | emit search_done_signal(); |
128 | //this->reject(); | 128 | //this->reject(); |
129 | this->hide(); | 129 | this->hide(); |
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | void SearchDialog::setLabel(QString labelText) | 133 | void SearchDialog::setLabel(QString labelText) |
134 | { | 134 | { |
diff --git a/noncore/apps/opie-gutenbrowser/browserDialog.cpp b/noncore/apps/opie-gutenbrowser/browserDialog.cpp index 81dd516..cc05d04 100644 --- a/noncore/apps/opie-gutenbrowser/browserDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/browserDialog.cpp | |||
@@ -1,24 +1,25 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | copyright 2001 by L.J. Potter ljp@llornkcor.com | 2 | copyright 2001 by L.J. Potter ljp@llornkcor.com |
3 | copyright : (C) 2000 -2004 by llornkcor | 3 | copyright : (C) 2000 -2004 by llornkcor |
4 | email : ljp@llornkcor.com | 4 | email : ljp@llornkcor.com |
5 | 5 | ||
6 | ****************************************************************************/ | 6 | ****************************************************************************/ |
7 | 7 | ||
8 | #include "optionsDialog.h" | 8 | #include "optionsDialog.h" |
9 | //#include "fileBrowser.h" | 9 | //#include "fileBrowser.h" |
10 | 10 | ||
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | #include <opie2/ofiledialog.h> | 12 | #include <opie2/ofiledialog.h> |
13 | #include <opie2/odebug.h> | ||
13 | using namespace Opie::Ui; | 14 | using namespace Opie::Ui; |
14 | 15 | ||
15 | /* QT */ | 16 | /* QT */ |
16 | #include <qlabel.h> | 17 | #include <qlabel.h> |
17 | #include <qlistbox.h> | 18 | #include <qlistbox.h> |
18 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
19 | #include <qlayout.h> | 20 | #include <qlayout.h> |
20 | 21 | ||
21 | void optionsDialog::BrowserDlg( ) | 22 | void optionsDialog::BrowserDlg( ) |
22 | { | 23 | { |
23 | // setCaption( tr( "Choose Browser" ) ); | 24 | // setCaption( tr( "Choose Browser" ) ); |
24 | http_ListBox1->insertItem( tr( "Opera")); | 25 | http_ListBox1->insertItem( tr( "Opera")); |
@@ -43,44 +44,44 @@ void optionsDialog::BrowseSelected() { | |||
43 | QMap<QString, QStringList> map; | 44 | QMap<QString, QStringList> map; |
44 | map.insert(tr("All"), QStringList() ); | 45 | map.insert(tr("All"), QStringList() ); |
45 | QStringList text; | 46 | QStringList text; |
46 | text << "text/*"; | 47 | text << "text/*"; |
47 | map.insert(tr("Text"), text ); | 48 | map.insert(tr("Text"), text ); |
48 | text << "*"; | 49 | text << "*"; |
49 | map.insert(tr("All"), text ); | 50 | map.insert(tr("All"), text ); |
50 | 51 | ||
51 | QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map); | 52 | QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map); |
52 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) { | 53 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) { |
53 | fileName = str; | 54 | fileName = str; |
54 | // QStringList fileList=browseForFiles->fileList; | 55 | // QStringList fileList=browseForFiles->fileList; |
55 | // qDebug(selFile); | 56 | // odebug << selFile << oendl; |
56 | // QStringList::ConstIterator f; | 57 | // QStringList::ConstIterator f; |
57 | // QString fileTemp,filer; | 58 | // QString fileTemp,filer; |
58 | // for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 59 | // for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
59 | 60 | ||
60 | // fileTemp = *f; | 61 | // fileTemp = *f; |
61 | // fileTemp.right( fileTemp.length()-5); | 62 | // fileTemp.right( fileTemp.length()-5); |
62 | // fileName = fileTemp; | 63 | // fileName = fileTemp; |
63 | // if( !fileName.isEmpty() ){ | 64 | // if( !fileName.isEmpty() ){ |
64 | // filer = fileName; | 65 | // filer = fileName; |
65 | // } else { | 66 | // } else { |
66 | // QString sMsg; | 67 | // QString sMsg; |
67 | // sMsg = "Error opening library filelist "+fileName; | 68 | // sMsg = "Error opening library filelist "+fileName; |
68 | // } | 69 | // } |
69 | if ( !fileName.isNull() ) { // got a file name | 70 | if ( !fileName.isNull() ) { // got a file name |
70 | // ... | 71 | // ... |
71 | } | 72 | } |
72 | } | 73 | } |
73 | 74 | ||
74 | } | 75 | } |
75 | 76 | ||
76 | void optionsDialog::setHttp(int index) { | 77 | void optionsDialog::setHttp(int index) { |
77 | Config config("Gutenbrowser"); | 78 | Config config("Gutenbrowser"); |
78 | config.setGroup( "HttpServer" ); | 79 | config.setGroup( "HttpServer" ); |
79 | qDebug("writing http server"); | 80 | odebug << "writing http server" << oendl; |
80 | if( index== 0) { | 81 | if( index== 0) { |
81 | config.writeEntry("Preferred", "http://sailor.gutenberg.org"); | 82 | config.writeEntry("Preferred", "http://sailor.gutenberg.org"); |
82 | } else { | 83 | } else { |
83 | config.writeEntry("Preferred", "http://www.prairienet.org/pg"); | 84 | config.writeEntry("Preferred", "http://www.prairienet.org/pg"); |
84 | } | 85 | } |
85 | 86 | ||
86 | } | 87 | } |
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.cpp b/noncore/apps/opie-gutenbrowser/fontDialog.cpp index a17b1d3..fa964a6 100644 --- a/noncore/apps/opie-gutenbrowser/fontDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/fontDialog.cpp | |||
@@ -81,35 +81,35 @@ FontDialog::~FontDialog() | |||
81 | { | 81 | { |
82 | } | 82 | } |
83 | 83 | ||
84 | void FontDialog::familyListBoxSlot(const QString & text) | 84 | void FontDialog::familyListBoxSlot(const QString & text) |
85 | { | 85 | { |
86 | int styleInt = styleListBox->currentItem(); | 86 | int styleInt = styleListBox->currentItem(); |
87 | int sizeInt = sizeComboBox->currentText().toInt(); | 87 | int sizeInt = sizeComboBox->currentText().toInt(); |
88 | 88 | ||
89 | sizeComboBox->clear(); | 89 | sizeComboBox->clear(); |
90 | styleListBox->clear(); | 90 | styleListBox->clear(); |
91 | // clearListBoxes(); | 91 | // clearListBoxes(); |
92 | family = text; | 92 | family = text; |
93 | // qDebug(family); | 93 | // odebug << family << oendl; |
94 | QStringList styles = fdb.styles( family ); // string list of styles of our current font family | 94 | QStringList styles = fdb.styles( family ); // string list of styles of our current font family |
95 | styleListBox->insertStringList( styles); | 95 | styleListBox->insertStringList( styles); |
96 | QString dstyle;// = "\t" + style + " ("; | 96 | QString dstyle;// = "\t" + style + " ("; |
97 | 97 | ||
98 | #ifdef BUGGY_SHARP_ZAURUS | 98 | #ifdef BUGGY_SHARP_ZAURUS |
99 | 99 | ||
100 | QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) ); | 100 | QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) ); |
101 | for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) { | 101 | for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) { |
102 | dstyle = QString::number( *points ); | 102 | dstyle = QString::number( *points ); |
103 | qDebug(dstyle); | 103 | odebug << dstyle << oendl; |
104 | sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 )); | 104 | sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 )); |
105 | } | 105 | } |
106 | #else | 106 | #else |
107 | 107 | ||
108 | for (int i=0; i<nfontsizes; i++) { | 108 | for (int i=0; i<nfontsizes; i++) { |
109 | sizeComboBox->insertItem( QString::number(fontsize[i])); | 109 | sizeComboBox->insertItem( QString::number(fontsize[i])); |
110 | if(fontsize[i] == sizeInt) { | 110 | if(fontsize[i] == sizeInt) { |
111 | sizeComboBox->setCurrentItem(i); | 111 | sizeComboBox->setCurrentItem(i); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | #endif | 114 | #endif |
115 | 115 | ||
@@ -142,25 +142,25 @@ void FontDialog::populateLists() | |||
142 | QString styleStr = config.readEntry("Style", "Regular"); | 142 | QString styleStr = config.readEntry("Style", "Regular"); |
143 | QString sizeStr = config.readEntry("Size", "10"); | 143 | QString sizeStr = config.readEntry("Size", "10"); |
144 | QString charSetStr = config.readEntry("CharSet", "iso10646-1" ); | 144 | QString charSetStr = config.readEntry("CharSet", "iso10646-1" ); |
145 | bool ok; | 145 | bool ok; |
146 | int i_size = sizeStr.toInt(&ok,10); | 146 | int i_size = sizeStr.toInt(&ok,10); |
147 | selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr); | 147 | selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr); |
148 | // defaultFont.setItalic(TRUE); | 148 | // defaultFont.setItalic(TRUE); |
149 | families = fdb.families(); | 149 | families = fdb.families(); |
150 | 150 | ||
151 | for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) { | 151 | for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) { |
152 | QString family = *f; | 152 | QString family = *f; |
153 | // if(family == defaultFont.family()) | 153 | // if(family == defaultFont.family()) |
154 | // qDebug(family); | 154 | // odebug << family << oendl; |
155 | familyListBox->insertItem( family); | 155 | familyListBox->insertItem( family); |
156 | 156 | ||
157 | if( familyListBox->text(0) == family) { | 157 | if( familyListBox->text(0) == family) { |
158 | QStringList styles = fdb.styles( family ); | 158 | QStringList styles = fdb.styles( family ); |
159 | // string list of styles of our current font family | 159 | // string list of styles of our current font family |
160 | styleListBox->insertStringList( styles); | 160 | styleListBox->insertStringList( styles); |
161 | 161 | ||
162 | for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style | 162 | for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style |
163 | style = *s; | 163 | style = *s; |
164 | QString dstyle;// = "\t" + style + " ("; | 164 | QString dstyle;// = "\t" + style + " ("; |
165 | if(styleListBox->text(0) == style) { | 165 | if(styleListBox->text(0) == style) { |
166 | 166 | ||
@@ -200,61 +200,61 @@ void FontDialog::clearListBoxes() { | |||
200 | familyListBox->clear(); | 200 | familyListBox->clear(); |
201 | sizeComboBox->clear(); | 201 | sizeComboBox->clear(); |
202 | styleListBox->clear(); | 202 | styleListBox->clear(); |
203 | } | 203 | } |
204 | 204 | ||
205 | void FontDialog::changeText() | 205 | void FontDialog::changeText() |
206 | { | 206 | { |
207 | if( familyListBox->currentItem() == -1) | 207 | if( familyListBox->currentItem() == -1) |
208 | family= familyListBox->text(0); | 208 | family= familyListBox->text(0); |
209 | else { | 209 | else { |
210 | family = familyListBox->currentText(); | 210 | family = familyListBox->currentText(); |
211 | } | 211 | } |
212 | // qDebug("Font family is "+family); | 212 | // odebug << "Font family is "+family << oendl; |
213 | if( styleListBox->currentItem() == -1) | 213 | if( styleListBox->currentItem() == -1) |
214 | style=styleListBox->text(0); | 214 | style=styleListBox->text(0); |
215 | else { | 215 | else { |
216 | style = styleListBox->currentText(); | 216 | style = styleListBox->currentText(); |
217 | } | 217 | } |
218 | // qDebug("font style is "+style); | 218 | // odebug << "font style is "+style << oendl; |
219 | 219 | ||
220 | if( sizeComboBox->currentItem() == -1 ) | 220 | if( sizeComboBox->currentItem() == -1 ) |
221 | size = sizeComboBox->text(0); | 221 | size = sizeComboBox->text(0); |
222 | else { | 222 | else { |
223 | size = sizeComboBox->currentText(); | 223 | size = sizeComboBox->currentText(); |
224 | } | 224 | } |
225 | 225 | ||
226 | // qDebug("Font size is "+size); | 226 | // odebug << "Font size is "+size << oendl; |
227 | bool ok; | 227 | bool ok; |
228 | int i_size = size.toInt(&ok,10); | 228 | int i_size = size.toInt(&ok,10); |
229 | QStringList charSetList = fdb.charSets(family); | 229 | QStringList charSetList = fdb.charSets(family); |
230 | // QStringList styles = fdb.styles( family ); // string list of styles of our current font family | 230 | // QStringList styles = fdb.styles( family ); // string list of styles of our current font family |
231 | QString charSet; | 231 | QString charSet; |
232 | for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style | 232 | for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style |
233 | charSet = *s; | 233 | charSet = *s; |
234 | // qDebug(charSet); | 234 | // odebug << charSet << oendl; |
235 | } | 235 | } |
236 | selectedFont = fdb.font(family,style,i_size,charSet); | 236 | selectedFont = fdb.font(family,style,i_size,charSet); |
237 | QFontInfo fontInfo( selectedFont); | 237 | QFontInfo fontInfo( selectedFont); |
238 | // if(fontInfo.italic() ) qDebug("italic"); | 238 | // if(fontInfo.italic() ) odebug << "italic" << oendl; |
239 | selectedFont.setWeight(fontInfo.weight() ); | 239 | selectedFont.setWeight(fontInfo.weight() ); |
240 | // qDebug("Style are "+style+" %d ",fontInfo.weight()); | 240 | // odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl; |
241 | Config cfg("Gutenbrowser"); | 241 | Config cfg("Gutenbrowser"); |
242 | cfg.setGroup("Font"); | 242 | cfg.setGroup("Font"); |
243 | cfg.writeEntry("Family",family); | 243 | cfg.writeEntry("Family",family); |
244 | cfg.writeEntry("Style",style); | 244 | cfg.writeEntry("Style",style); |
245 | cfg.writeEntry("Size",size); | 245 | cfg.writeEntry("Size",size); |
246 | cfg.writeEntry("CharSet",charSet); | 246 | cfg.writeEntry("CharSet",charSet); |
247 | 247 | ||
248 | if(style.find("Italic",0,TRUE) != -1) { | 248 | if(style.find("Italic",0,TRUE) != -1) { |
249 | selectedFont = fdb.font(family,"Regular",i_size,charSet); | 249 | selectedFont = fdb.font(family,"Regular",i_size,charSet); |
250 | selectedFont.setItalic(TRUE); //ya right | 250 | selectedFont.setItalic(TRUE); //ya right |
251 | cfg.writeEntry("Italic","TRUE"); | 251 | cfg.writeEntry("Italic","TRUE"); |
252 | // qDebug("Style is "+styleListBox->currentText()); | 252 | // odebug << "Style is "+styleListBox->currentText() << oendl; |
253 | } else | 253 | } else |
254 | cfg.writeEntry("Italic","FALSE"); | 254 | cfg.writeEntry("Italic","FALSE"); |
255 | 255 | ||
256 | MultiLineEdit1->setFont( selectedFont); | 256 | MultiLineEdit1->setFont( selectedFont); |
257 | MultiLineEdit1->update(); | 257 | MultiLineEdit1->update(); |
258 | changedFonts=TRUE; | 258 | changedFonts=TRUE; |
259 | } | 259 | } |
260 | 260 | ||
diff --git a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp index ad770b5..a9c7346 100644 --- a/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp +++ b/noncore/apps/opie-gutenbrowser/ftpsitedlg.cpp | |||
@@ -2,52 +2,57 @@ | |||
2 | ftpsitedlg.cpp - description | 2 | ftpsitedlg.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Tue Jul 25 2000 | 4 | begin : Tue Jul 25 2000 |
5 | copyright : (C) 2000 -2004 by llornkcor | 5 | copyright : (C) 2000 -2004 by llornkcor |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | |||
14 | #include "optionsDialog.h" | 15 | #include "optionsDialog.h" |
15 | #include "gutenbrowser.h" | 16 | #include "gutenbrowser.h" |
16 | //#include "NetworkDialog.h" | 17 | //#include "NetworkDialog.h" |
17 | #include "output.h" | 18 | #include "output.h" |
18 | 19 | ||
20 | /* OPIE */ | ||
21 | #include <opie2/odebug.h> | ||
22 | #include <qpe/config.h> | ||
23 | |||
24 | /* QT */ | ||
19 | #include <qprogressbar.h> | 25 | #include <qprogressbar.h> |
20 | #include <stdlib.h> | ||
21 | #include <qurloperator.h> | 26 | #include <qurloperator.h> |
22 | #include <qpe/config.h> | ||
23 | #include <qlistbox.h> | 27 | #include <qlistbox.h> |
24 | 28 | ||
29 | /* STD */ | ||
30 | #include <stdlib.h> | ||
25 | #include <unistd.h> | 31 | #include <unistd.h> |
26 | #include <stdio.h> | 32 | #include <stdio.h> |
27 | #include <stdlib.h> | ||
28 | 33 | ||
29 | // :)~ | 34 | // :)~ |
30 | void optionsDialog::ftpSiteDlg( ) | 35 | void optionsDialog::ftpSiteDlg( ) |
31 | { | 36 | { |
32 | //printf( "ftpSiteDlg: ListFile is "+ ListFile +"\n" ); | 37 | //printf( "ftpSiteDlg: ListFile is "+ ListFile +"\n" ); |
33 | // initDialog(); | 38 | // initDialog(); |
34 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 39 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
35 | // ListFile = local_library + "ftpList"; | 40 | // ListFile = local_library + "ftpList"; |
36 | ListFile = QPEApplication::qpeDir() + "/etc/gutenbrowser"; | 41 | ListFile = QPEApplication::qpeDir() + "/etc/gutenbrowser"; |
37 | QDir dir(ListFile); | 42 | QDir dir(ListFile); |
38 | if( !dir.exists()) | 43 | if( !dir.exists()) |
39 | dir.mkdir(ListFile,true); | 44 | dir.mkdir(ListFile,true); |
40 | ListFile+="/ftpList"; | 45 | ListFile+="/ftpList"; |
41 | qDebug("opening "+ListFile); | 46 | odebug << "opening "+ListFile << oendl; |
42 | if ( QFile(ListFile).exists() ) { | 47 | if ( QFile(ListFile).exists() ) { |
43 | openSiteList(); | 48 | openSiteList(); |
44 | } else { | 49 | } else { |
45 | switch( QMessageBox::warning( this, "Gutenbrowser", | 50 | switch( QMessageBox::warning( this, "Gutenbrowser", |
46 | "Do you want to download \nan ftp site list?", | 51 | "Do you want to download \nan ftp site list?", |
47 | QMessageBox::Yes, QMessageBox::No)) { | 52 | QMessageBox::Yes, QMessageBox::No)) { |
48 | case QMessageBox::Yes: // yes | 53 | case QMessageBox::Yes: // yes |
49 | getSite(); | 54 | getSite(); |
50 | break; | 55 | break; |
51 | case QMessageBox::No: // No | 56 | case QMessageBox::No: // No |
52 | // exit | 57 | // exit |
53 | break; | 58 | break; |
@@ -67,33 +72,33 @@ void optionsDialog::getSite() | |||
67 | // outputFile = local_library+ "list.html"; | 72 | // outputFile = local_library+ "list.html"; |
68 | outputFile = ListFile + "list.html"; | 73 | outputFile = ListFile + "list.html"; |
69 | QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html"; | 74 | QString networkUrl= "http://www.gutenberg.org/www/mirror.sites.html"; |
70 | //http://www.gutenberg.org/index.html"; | 75 | //http://www.gutenberg.org/index.html"; |
71 | // QString networkUrl= "http://llornkcor.com/index.shtml"; | 76 | // QString networkUrl= "http://llornkcor.com/index.shtml"; |
72 | // // "http://www.gutenberg.org/index.html" | 77 | // // "http://www.gutenberg.org/index.html" |
73 | // | 78 | // |
74 | //Qhttp stops working at times.... :( | 79 | //Qhttp stops working at times.... :( |
75 | // NetworkDialog *NetworkDlg; | 80 | // NetworkDialog *NetworkDlg; |
76 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog",TRUE,0,networkUrl,outputFile); | 81 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog",TRUE,0,networkUrl,outputFile); |
77 | // if( NetworkDlg->exec() != 0 ) | 82 | // if( NetworkDlg->exec() != 0 ) |
78 | // { // use new, improved, *INSTANT* network-dialog-file-getterer | 83 | // { // use new, improved, *INSTANT* network-dialog-file-getterer |
79 | // qDebug("gitcha!"); | 84 | // odebug << "gitcha!" << oendl; |
80 | // } | 85 | // } |
81 | // delete NetworkDlg; | 86 | // delete NetworkDlg; |
82 | //#ifdef Q_WS_QWS | 87 | //#ifdef Q_WS_QWS |
83 | 88 | ||
84 | // TODO qprocess here | 89 | // TODO qprocess here |
85 | 90 | ||
86 | QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ; | 91 | QString cmd="wget -T 15 -O " +outputFile + " " + networkUrl + " 2>&1" ; |
87 | qDebug("Issuing the command "+cmd); | 92 | odebug << "Issuing the command "+cmd << oendl; |
88 | Output *outDlg; | 93 | Output *outDlg; |
89 | outDlg = new Output( 0, tr("Downloading ftp sites...."),TRUE); | 94 | outDlg = new Output( 0, tr("Downloading ftp sites...."),TRUE); |
90 | outDlg->showMaximized(); | 95 | outDlg->showMaximized(); |
91 | outDlg->show(); | 96 | outDlg->show(); |
92 | qApp->processEvents(); | 97 | qApp->processEvents(); |
93 | FILE *fp; | 98 | FILE *fp; |
94 | char line[130]; | 99 | char line[130]; |
95 | outDlg->OutputEdit->append( tr("Running wget") ); | 100 | outDlg->OutputEdit->append( tr("Running wget") ); |
96 | sleep(1); | 101 | sleep(1); |
97 | fp = popen( (const char *) cmd, "r"); | 102 | fp = popen( (const char *) cmd, "r"); |
98 | while ( fgets( line, sizeof line, fp)) { | 103 | while ( fgets( line, sizeof line, fp)) { |
99 | outDlg->OutputEdit->append(line); | 104 | outDlg->OutputEdit->append(line); |
@@ -104,25 +109,25 @@ void optionsDialog::getSite() | |||
104 | if(outDlg) | 109 | if(outDlg) |
105 | delete outDlg; | 110 | delete outDlg; |
106 | 111 | ||
107 | // outputFile=ListFile; | 112 | // outputFile=ListFile; |
108 | ftp_QListBox_1->clear(); | 113 | ftp_QListBox_1->clear(); |
109 | parseFtpList( outputFile); // got the html list, now parse it so we can use it | 114 | parseFtpList( outputFile); // got the html list, now parse it so we can use it |
110 | } | 115 | } |
111 | 116 | ||
112 | bool optionsDialog::parseFtpList( QString outputFile) | 117 | bool optionsDialog::parseFtpList( QString outputFile) |
113 | { | 118 | { |
114 | // parse ftplist html and extract just the machine names/directories | 119 | // parse ftplist html and extract just the machine names/directories |
115 | // TODO: add locations!! | 120 | // TODO: add locations!! |
116 | qDebug("parse ftplist "+outputFile); | 121 | odebug << "parse ftplist "+outputFile << oendl; |
117 | QString ftpList, s_location; | 122 | QString ftpList, s_location; |
118 | QFile f( outputFile ); | 123 | QFile f( outputFile ); |
119 | 124 | ||
120 | if( f.open( IO_ReadWrite )) { | 125 | if( f.open( IO_ReadWrite )) { |
121 | QTextStream t( &f); | 126 | QTextStream t( &f); |
122 | QString countryName; | 127 | QString countryName; |
123 | bool b_gotchTest=false; | 128 | bool b_gotchTest=false; |
124 | 129 | ||
125 | while ( !t.eof() ) { | 130 | while ( !t.eof() ) { |
126 | QString s = t.readLine(); | 131 | QString s = t.readLine(); |
127 | int start; | 132 | int start; |
128 | int end; | 133 | int end; |
@@ -143,29 +148,29 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
143 | if( ftpSite.find("\n", 0, TRUE) ) | 148 | if( ftpSite.find("\n", 0, TRUE) ) |
144 | ftpSite.remove( ftpSite.find("\n", 0, TRUE), 1); | 149 | ftpSite.remove( ftpSite.find("\n", 0, TRUE), 1); |
145 | 150 | ||
146 | if( ftpSite.find("\"", 0, TRUE) ) | 151 | if( ftpSite.find("\"", 0, TRUE) ) |
147 | ftpSite.remove( ftpSite.find("\"", 0, TRUE), 1); | 152 | ftpSite.remove( ftpSite.find("\"", 0, TRUE), 1); |
148 | if( ftpSite.find("a>", 0, TRUE) ) | 153 | if( ftpSite.find("a>", 0, TRUE) ) |
149 | ftpSite.remove( ftpSite.find("a>", 0, TRUE) -2, 4); | 154 | ftpSite.remove( ftpSite.find("a>", 0, TRUE) -2, 4); |
150 | 155 | ||
151 | 156 | ||
152 | s = t.readLine(); | 157 | s = t.readLine(); |
153 | s = t.readLine(); | 158 | s = t.readLine(); |
154 | if(( start=s.find("<BR>(", 0, TRUE) ) != -1) { | 159 | if(( start=s.find("<BR>(", 0, TRUE) ) != -1) { |
155 | // qDebug("%s",s.latin1()); | 160 | // odebug << "" << s << "" << oendl; |
156 | end = s.find( ")", 0, TRUE)+1; | 161 | end = s.find( ")", 0, TRUE)+1; |
157 | s_location= s.mid( start+4, (end - start) ); | 162 | s_location= s.mid( start+4, (end - start) ); |
158 | 163 | ||
159 | // qDebug("%s", s_location.latin1()); | 164 | // odebug << "" << s_location << "" << oendl; |
160 | // ftpList += ftpSite + "\n"; | 165 | // ftpList += ftpSite + "\n"; |
161 | // ftp_QListBox_1->sort( TRUE ); | 166 | // ftp_QListBox_1->sort( TRUE ); |
162 | ftpList += s_location+ " "+ftpSite+"\n"; | 167 | ftpList += s_location+ " "+ftpSite+"\n"; |
163 | 168 | ||
164 | ftp_QListBox_1->sort( TRUE ); | 169 | ftp_QListBox_1->sort( TRUE ); |
165 | QString winbug=" "; | 170 | QString winbug=" "; |
166 | ftp_QListBox_1->insertItem ( s_location.latin1() +winbug+ftpSite); | 171 | ftp_QListBox_1->insertItem ( s_location.latin1() +winbug+ftpSite); |
167 | // ftp_QListBox_1->insertItem ( ftpSite+" "+s_location.latin1()); | 172 | // ftp_QListBox_1->insertItem ( ftpSite+" "+s_location.latin1()); |
168 | } | 173 | } |
169 | 174 | ||
170 | // ftp_QListBox_1->insertItem ( ftpSite); | 175 | // ftp_QListBox_1->insertItem ( ftpSite); |
171 | } | 176 | } |
@@ -181,25 +186,25 @@ bool optionsDialog::parseFtpList( QString outputFile) | |||
181 | if( f.exists() ) | 186 | if( f.exists() ) |
182 | f.remove(); | 187 | f.remove(); |
183 | } else { | 188 | } else { |
184 | QMessageBox::message( (tr("ftpSiteDlg")), (tr("List File not opened sucessfully." )) ); | 189 | QMessageBox::message( (tr("ftpSiteDlg")), (tr("List File not opened sucessfully." )) ); |
185 | return false; | 190 | return false; |
186 | } | 191 | } |
187 | setActiveWindow(); | 192 | setActiveWindow(); |
188 | return true; | 193 | return true; |
189 | } | 194 | } |
190 | 195 | ||
191 | void optionsDialog::openSiteList() { | 196 | void optionsDialog::openSiteList() { |
192 | 197 | ||
193 | qDebug(" just opens the ftp site list"); | 198 | odebug << " just opens the ftp site list" << oendl; |
194 | // ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList"; | 199 | // ListFile = ( QDir::homeDirPath ()) +"/.gutenbrowser/ftpList"; |
195 | QFile f( ListFile); | 200 | QFile f( ListFile); |
196 | if(!f.open( IO_ReadWrite )) { | 201 | if(!f.open( IO_ReadWrite )) { |
197 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully." )) ); | 202 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully." )) ); |
198 | } else { | 203 | } else { |
199 | QTextStream t( &f); | 204 | QTextStream t( &f); |
200 | while ( !t.atEnd() ) { | 205 | while ( !t.atEnd() ) { |
201 | QString ftpSite = t.readLine(); | 206 | QString ftpSite = t.readLine(); |
202 | ftp_QListBox_1->sort( TRUE ); | 207 | ftp_QListBox_1->sort( TRUE ); |
203 | ftp_QListBox_1->insertItem ( ftpSite); | 208 | ftp_QListBox_1->insertItem ( ftpSite); |
204 | 209 | ||
205 | } // end while loop | 210 | } // end while loop |
@@ -221,25 +226,25 @@ void optionsDialog::getSelection( QListBoxItem *item) | |||
221 | // printf( selctionStr+"\n" ); | 226 | // printf( selctionStr+"\n" ); |
222 | select_site( selctionStr ); | 227 | select_site( selctionStr ); |
223 | } | 228 | } |
224 | 229 | ||
225 | void optionsDialog::select_site( const char *index ) | 230 | void optionsDialog::select_site( const char *index ) |
226 | { | 231 | { |
227 | // ftp://ftp.datacanyon.com/pub/gutenberg/ | 232 | // ftp://ftp.datacanyon.com/pub/gutenberg/ |
228 | 233 | ||
229 | s_site = index; | 234 | s_site = index; |
230 | QString s_site2; | 235 | QString s_site2; |
231 | // if(s_site.find("(",0,TRUE)) | 236 | // if(s_site.find("(",0,TRUE)) |
232 | s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) ); | 237 | s_site2=s_site.right( s_site.length()-(s_site.find(" ",0,TRUE)+4) ); |
233 | qDebug("Selected ftp site is "+ s_site2); | 238 | odebug << "Selected ftp site is "+ s_site2 << oendl; |
234 | int i_ftp = s_site2.find("/", 0, FALSE); | 239 | int i_ftp = s_site2.find("/", 0, FALSE); |
235 | ftp_host = s_site2.left(i_ftp ); | 240 | ftp_host = s_site2.left(i_ftp ); |
236 | ftp_base_dir = s_site2.right( s_site2.length() - i_ftp); | 241 | ftp_base_dir = s_site2.right( s_site2.length() - i_ftp); |
237 | 242 | ||
238 | // config->read(); | 243 | // config->read(); |
239 | Config config("Gutenbrowser"); | 244 | Config config("Gutenbrowser"); |
240 | config.setGroup( "FTPsite" ); | 245 | config.setGroup( "FTPsite" ); |
241 | config.writeEntry("SiteName",ftp_host); | 246 | config.writeEntry("SiteName",ftp_host); |
242 | config.writeEntry("base",ftp_base_dir); | 247 | config.writeEntry("base",ftp_base_dir); |
243 | // config->write(); | 248 | // config->write(); |
244 | TextLabel3->setText( "Current ftp server:\n"+ftp_host /*+ ftp_base_dir*/ ); | 249 | TextLabel3->setText( "Current ftp server:\n"+ftp_host /*+ ftp_base_dir*/ ); |
245 | // optionsDialog::accept(); | 250 | // optionsDialog::accept(); |
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index 2a9a71e..be2b897 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | |||
@@ -5,61 +5,66 @@ | |||
5 | copyright : (C) 2000 -2004 by llornkcor | 5 | copyright : (C) 2000 -2004 by llornkcor |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | // http search | 12 | // http search |
13 | // http://digital.library.upenn.edu/books/authors.html | 13 | // http://digital.library.upenn.edu/books/authors.html |
14 | // http://digital.library.upenn.edu/books/titles.html | 14 | // http://digital.library.upenn.edu/books/titles.html |
15 | // ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL | 15 | // ftp://ibiblio.org/pub/docs/books/gutenberg/GUTINDEX.ALL |
16 | // donate@gutenberg.net | 16 | // donate@gutenberg.net |
17 | #include <qpe/qpeapplication.h> | 17 | |
18 | #include <qpe/fontdatabase.h> | ||
19 | #include <qpe/config.h> | ||
20 | #include <qpe/qcopenvelope_qws.h> | ||
21 | #include <qpe/mimetype.h> | ||
22 | #include <qpe/resource.h> | ||
23 | #include <qpe/applnk.h> | ||
24 | 18 | ||
25 | #include "editTitle.h" | 19 | #include "editTitle.h" |
26 | #include "gutenbrowser.h" | 20 | #include "gutenbrowser.h" |
27 | #include "LibraryDialog.h" | 21 | #include "LibraryDialog.h" |
28 | //#include "bookmarksdlg.h" | 22 | //#include "bookmarksdlg.h" |
29 | #include "optionsDialog.h" | 23 | #include "optionsDialog.h" |
30 | #include "helpme.h" | 24 | #include "helpme.h" |
31 | #include "NetworkDialog.h" | 25 | #include "NetworkDialog.h" |
32 | 26 | ||
33 | #include "openetext.h" | 27 | #include "openetext.h" |
34 | #include "output.h" | 28 | #include "output.h" |
35 | 29 | ||
30 | /* OPIE */ | ||
31 | #include <opie2/odebug.h> | ||
32 | #include <qpe/qpeapplication.h> | ||
33 | #include <qpe/fontdatabase.h> | ||
34 | #include <qpe/config.h> | ||
35 | #include <qpe/qcopenvelope_qws.h> | ||
36 | #include <qpe/mimetype.h> | ||
37 | #include <qpe/resource.h> | ||
38 | #include <qpe/applnk.h> | ||
36 | 39 | ||
40 | /* QT */ | ||
37 | #include <qregexp.h> | 41 | #include <qregexp.h> |
38 | #include <qregion.h> | 42 | #include <qregion.h> |
39 | #include <qpaintdevicemetrics.h> | 43 | #include <qpaintdevicemetrics.h> |
40 | #include <qvaluelist.h> | 44 | #include <qvaluelist.h> |
41 | #include <qlabel.h> | 45 | #include <qlabel.h> |
42 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
43 | #include <qpainter.h> | 47 | #include <qpainter.h> |
44 | #include <qpalette.h> | 48 | #include <qpalette.h> |
45 | #include <qobjectlist.h> | 49 | #include <qobjectlist.h> |
46 | #include <qfontdialog.h> | 50 | #include <qfontdialog.h> |
47 | #include <qtextview.h> | 51 | #include <qtextview.h> |
48 | #include <qbrush.h> | 52 | #include <qbrush.h> |
49 | #include <qfile.h> | 53 | #include <qfile.h> |
50 | #include <qfontinfo.h> | 54 | #include <qfontinfo.h> |
51 | #include <qscrollview.h> | 55 | #include <qscrollview.h> |
52 | #include <qpoint.h> | 56 | #include <qpoint.h> |
53 | 57 | ||
58 | /* STD */ | ||
54 | #include <stdio.h> | 59 | #include <stdio.h> |
55 | #include <stdlib.h> | 60 | #include <stdlib.h> |
56 | #include <unistd.h> | 61 | #include <unistd.h> |
57 | #include <sys/stat.h> | 62 | #include <sys/stat.h> |
58 | #include <fcntl.h> | 63 | #include <fcntl.h> |
59 | #include <errno.h> | 64 | #include <errno.h> |
60 | 65 | ||
61 | static const int nfontsizes = 9; | 66 | static const int nfontsizes = 9; |
62 | static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24}; | 67 | static const int fontsize[nfontsizes] = {8,9,10,11,12,13,14,18,24}; |
63 | 68 | ||
64 | #ifdef NOQUICKLAUNCH | 69 | #ifdef NOQUICKLAUNCH |
65 | Gutenbrowser::Gutenbrowser() | 70 | Gutenbrowser::Gutenbrowser() |
@@ -122,63 +127,63 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
122 | QString tempFileName; | 127 | QString tempFileName; |
123 | 128 | ||
124 | for (int i = 0; i <= i_numofFiles; i++) { | 129 | for (int i = 0; i <= i_numofFiles; i++) { |
125 | // tempFileName.setNum(i); | 130 | // tempFileName.setNum(i); |
126 | config.setGroup( "Files" ); | 131 | config.setGroup( "Files" ); |
127 | QString ramble = config.readEntry( QString::number(i), "" ); | 132 | QString ramble = config.readEntry( QString::number(i), "" ); |
128 | 133 | ||
129 | config.setGroup( "Titles" ); | 134 | config.setGroup( "Titles" ); |
130 | QString tempTitle = config.readEntry( ramble, ""); | 135 | QString tempTitle = config.readEntry( ramble, ""); |
131 | config.setGroup( tempTitle); | 136 | config.setGroup( tempTitle); |
132 | int index=config.readNumEntry( "LineNumber", -1 ); | 137 | int index=config.readNumEntry( "LineNumber", -1 ); |
133 | if( index != -1) { | 138 | if( index != -1) { |
134 | // qDebug( tempTitle); | 139 | // odebug << tempTitle << oendl; |
135 | bookmarksMenu->insertItem( tempTitle); | 140 | bookmarksMenu->insertItem( tempTitle); |
136 | } | 141 | } |
137 | } | 142 | } |
138 | 143 | ||
139 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; | 144 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; |
140 | QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; | 145 | QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; |
141 | 146 | ||
142 | if( QFile( gutenIndex).exists() ) { | 147 | if( QFile( gutenIndex).exists() ) { |
143 | indexLib.setName( gutenIndex); | 148 | indexLib.setName( gutenIndex); |
144 | } else { | 149 | } else { |
145 | QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; | 150 | QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; |
146 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; | 151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; |
147 | newindexLib.setName( localLibIndexFile); | 152 | newindexLib.setName( localLibIndexFile); |
148 | } | 153 | } |
149 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); | 154 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); |
150 | loadCheck=false; | 155 | loadCheck=false; |
151 | chdir(local_library); | 156 | chdir(local_library); |
152 | if(!showMainList) { | 157 | if(!showMainList) { |
153 | Lview->setFocus(); | 158 | Lview->setFocus(); |
154 | // if(firstTime) | 159 | // if(firstTime) |
155 | // Bookmark(); | 160 | // Bookmark(); |
156 | for (int i=1;i< qApp->argc();i++) { | 161 | for (int i=1;i< qApp->argc();i++) { |
157 | qDebug("Suppose we open somethin"); | 162 | odebug << "Suppose we open somethin" << oendl; |
158 | load(qApp->argv()[i]); | 163 | load(qApp->argv()[i]); |
159 | } | 164 | } |
160 | } else { | 165 | } else { |
161 | fillWithTitles(); | 166 | fillWithTitles(); |
162 | mainList->setFocus(); | 167 | mainList->setFocus(); |
163 | // mainList->setCurrentItem(0); | 168 | // mainList->setCurrentItem(0); |
164 | 169 | ||
165 | } | 170 | } |
166 | writeConfig(); | 171 | writeConfig(); |
167 | } //end init | 172 | } //end init |
168 | 173 | ||
169 | Gutenbrowser::~Gutenbrowser() { | 174 | Gutenbrowser::~Gutenbrowser() { |
170 | // QPEApplication::grabKeyboard(); | 175 | // QPEApplication::grabKeyboard(); |
171 | // QPEApplication::ungrabKeyboard(); | 176 | // QPEApplication::ungrabKeyboard(); |
172 | qDebug("Exit"); | 177 | odebug << "Exit" << oendl; |
173 | } | 178 | } |
174 | 179 | ||
175 | /* | 180 | /* |
176 | Google.com search */ | 181 | Google.com search */ |
177 | void Gutenbrowser::InfoBarClick() { | 182 | void Gutenbrowser::InfoBarClick() { |
178 | QString text; | 183 | QString text; |
179 | if( Lview->hasSelectedText()) { | 184 | if( Lview->hasSelectedText()) { |
180 | Lview->copy(); | 185 | Lview->copy(); |
181 | QClipboard *cb = QApplication::clipboard(); | 186 | QClipboard *cb = QApplication::clipboard(); |
182 | text = cb->text(); | 187 | text = cb->text(); |
183 | } else { | 188 | } else { |
184 | // text=title; | 189 | // text=title; |
@@ -190,49 +195,49 @@ void Gutenbrowser::InfoBarClick() { | |||
190 | /* | 195 | /* |
191 | download http with wget or preferred browser */ | 196 | download http with wget or preferred browser */ |
192 | void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | 197 | void Gutenbrowser::goGetit( const QString &url, bool showMsg) { |
193 | // int eexit=0; | 198 | // int eexit=0; |
194 | QString cmd; | 199 | QString cmd; |
195 | // config.read(); | 200 | // config.read(); |
196 | qApp->processEvents(); | 201 | qApp->processEvents(); |
197 | QString filename = QPEApplication::qpeDir(); | 202 | QString filename = QPEApplication::qpeDir(); |
198 | if(filename.right(1)!="/") | 203 | if(filename.right(1)!="/") |
199 | filename+="/etc/gutenbrowser/"; | 204 | filename+="/etc/gutenbrowser/"; |
200 | else | 205 | else |
201 | filename+="etc/gutenbrowser/"; | 206 | filename+="etc/gutenbrowser/"; |
202 | qDebug("filename "+filename); | 207 | odebug << "filename "+filename << oendl; |
203 | // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; | 208 | // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; |
204 | 209 | ||
205 | filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); | 210 | filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); |
206 | 211 | ||
207 | Config config("Gutenbrowser"); | 212 | Config config("Gutenbrowser"); |
208 | config.setGroup( "Browser" ); | 213 | config.setGroup( "Browser" ); |
209 | QString brow = config.readEntry("Preferred", "Opera"); | 214 | QString brow = config.readEntry("Preferred", "Opera"); |
210 | qDebug("Preferred browser is "+brow); | 215 | odebug << "Preferred browser is "+brow << oendl; |
211 | if(!showMsg) { //if we just get the gutenindex.all | 216 | if(!showMsg) { //if we just get the gutenindex.all |
212 | cmd="wget -O " + filename +" " + url+" 2>&1" ; | 217 | cmd="wget -O " + filename +" " + url+" 2>&1" ; |
213 | chdir(local_library); | 218 | chdir(local_library); |
214 | qDebug("Issuing the system command: %s", cmd.latin1()); | 219 | odebug << "Issuing the system command: " << cmd << "" << oendl; |
215 | 220 | ||
216 | Output *outDlg; | 221 | Output *outDlg; |
217 | outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); | 222 | outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); |
218 | outDlg->showMaximized(); | 223 | outDlg->showMaximized(); |
219 | outDlg->show(); | 224 | outDlg->show(); |
220 | qApp->processEvents(); | 225 | qApp->processEvents(); |
221 | FILE *fp; | 226 | FILE *fp; |
222 | char line[130]; | 227 | char line[130]; |
223 | outDlg->OutputEdit->append( tr("Running wget") ); | 228 | outDlg->OutputEdit->append( tr("Running wget") ); |
224 | sleep(1); | 229 | sleep(1); |
225 | fp = popen( (const char *) cmd, "r"); | 230 | fp = popen( (const char *) cmd, "r"); |
226 | // qDebug("Issuing the command\n"+cmd); | 231 | // odebug << "Issuing the command\n"+cmd << oendl; |
227 | // system(cmd); | 232 | // system(cmd); |
228 | while ( fgets( line, sizeof line, fp)) { | 233 | while ( fgets( line, sizeof line, fp)) { |
229 | outDlg->OutputEdit->append(line); | 234 | outDlg->OutputEdit->append(line); |
230 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 235 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
231 | } | 236 | } |
232 | pclose(fp); | 237 | pclose(fp); |
233 | outDlg->close(); | 238 | outDlg->close(); |
234 | if(outDlg) | 239 | if(outDlg) |
235 | delete outDlg; | 240 | delete outDlg; |
236 | } else { | 241 | } else { |
237 | if( brow == "Konq") { | 242 | if( brow == "Konq") { |
238 | cmd = "konqueror "+url+" &"; | 243 | cmd = "konqueror "+url+" &"; |
@@ -247,35 +252,35 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | |||
247 | cmd = "mozilla "+url+" &"; | 252 | cmd = "mozilla "+url+" &"; |
248 | } | 253 | } |
249 | if( brow == "Netscape") { | 254 | if( brow == "Netscape") { |
250 | cmd = "netscape "+url+" &"; | 255 | cmd = "netscape "+url+" &"; |
251 | } | 256 | } |
252 | if(brow == "wget") { | 257 | if(brow == "wget") { |
253 | // cmd="wget -q "+url+" &"; | 258 | // cmd="wget -q "+url+" &"; |
254 | QString tempHtml=local_library+"webster.html"; | 259 | QString tempHtml=local_library+"webster.html"; |
255 | cmd="wget -O "+tempHtml+" -q "+url; | 260 | cmd="wget -O "+tempHtml+" -q "+url; |
256 | } | 261 | } |
257 | 262 | ||
258 | chdir(local_library); | 263 | chdir(local_library); |
259 | qDebug("Issuing the sys command: %s", cmd.latin1()); | 264 | odebug << "Issuing the sys command: " << cmd << "" << oendl; |
260 | system(cmd); | 265 | system(cmd); |
261 | } | 266 | } |
262 | } | 267 | } |
263 | 268 | ||
264 | void Gutenbrowser::toggleButtonIcons( bool useEm) { | 269 | void Gutenbrowser::toggleButtonIcons( bool useEm) { |
265 | QString pixDir; | 270 | QString pixDir; |
266 | if(useEm) | 271 | if(useEm) |
267 | useEm=TRUE; | 272 | useEm=TRUE; |
268 | pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; | 273 | pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; |
269 | qDebug("Docdir is "+QPEApplication::documentDir()); | 274 | odebug << "Docdir is "+QPEApplication::documentDir() << oendl; |
270 | 275 | ||
271 | if( useIcons && QDir( pixDir).exists() ) { | 276 | if( useIcons && QDir( pixDir).exists() ) { |
272 | LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline | 277 | LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline |
273 | OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); | 278 | OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); |
274 | ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline | 279 | ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline |
275 | BackButton->setPixmap( Resource::loadPixmap("back") );//in inline | 280 | BackButton->setPixmap( Resource::loadPixmap("back") );//in inline |
276 | SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline | 281 | SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline |
277 | lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); | 282 | lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); |
278 | setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); | 283 | setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); |
279 | dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") ); | 284 | dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") ); |
280 | InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google")); | 285 | InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google")); |
281 | } | 286 | } |
@@ -372,101 +377,101 @@ void Gutenbrowser::downloadLibIndex() { | |||
372 | //// QMessageBox::message("Note",""); | 377 | //// QMessageBox::message("Note",""); |
373 | // } | 378 | // } |
374 | // if(NetworkDlg) | 379 | // if(NetworkDlg) |
375 | // delete NetworkDlg; | 380 | // delete NetworkDlg; |
376 | } | 381 | } |
377 | 382 | ||
378 | 383 | ||
379 | void Gutenbrowser::PrintBtn() { | 384 | void Gutenbrowser::PrintBtn() { |
380 | } | 385 | } |
381 | 386 | ||
382 | void Gutenbrowser::SearchBtn() { | 387 | void Gutenbrowser::SearchBtn() { |
383 | if( loadCheck) { | 388 | if( loadCheck) { |
384 | qDebug("loadCheck: we have a loaded doc"); | 389 | odebug << "loadCheck: we have a loaded doc" << oendl; |
385 | Search(); | 390 | Search(); |
386 | } | 391 | } |
387 | // else | 392 | // else |
388 | // QMessageBox::message("Note","Sorry, can't search. No etext is loaded"); | 393 | // QMessageBox::message("Note","Sorry, can't search. No etext is loaded"); |
389 | } | 394 | } |
390 | 395 | ||
391 | 396 | ||
392 | void Gutenbrowser::ForwardBtn() { | 397 | void Gutenbrowser::ForwardBtn() { |
393 | 398 | ||
394 | if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) { | 399 | if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) { |
395 | 400 | ||
396 | QString s; | 401 | QString s; |
397 | QString insertString; | 402 | QString insertString; |
398 | int pageSize= Lview->PageSize(); | 403 | int pageSize= Lview->PageSize(); |
399 | Lview->clear(); | 404 | Lview->clear(); |
400 | 405 | ||
401 | for(int fd=0; fd < pageSize - 1;fd++) { | 406 | for(int fd=0; fd < pageSize - 1;fd++) { |
402 | f.readLine(s, 256); | 407 | f.readLine(s, 256); |
403 | if(useWrap) | 408 | if(useWrap) |
404 | s.replace(QRegExp("\n"),""); | 409 | s.replace(QRegExp("\n"),""); |
405 | insertString+=s; | 410 | insertString+=s; |
406 | Lview->insertLine( s, -1); | 411 | Lview->insertLine( s, -1); |
407 | // qDebug(s); | 412 | // odebug << s << oendl; |
408 | currentLine++; | 413 | currentLine++; |
409 | } | 414 | } |
410 | // Lview->insertAt( insertString,0,0, FALSE); | 415 | // Lview->insertAt( insertString,0,0, FALSE); |
411 | currentFilePos = f.at(); | 416 | currentFilePos = f.at(); |
412 | // if( i_pageNum != pages) { | 417 | // if( i_pageNum != pages) { |
413 | // Lview->MultiLine_Ex::pageDown( FALSE); | 418 | // Lview->MultiLine_Ex::pageDown( FALSE); |
414 | i_pageNum++; | 419 | i_pageNum++; |
415 | pageStopArray.resize(i_pageNum + 1); | 420 | pageStopArray.resize(i_pageNum + 1); |
416 | // int length = Lview->length(); | 421 | // int length = Lview->length(); |
417 | 422 | ||
418 | pageStopArray[i_pageNum ] = currentFilePos; | 423 | pageStopArray[i_pageNum ] = currentFilePos; |
419 | // qDebug("%d current page is number %d, pagesize %d, length %d, current %d", | 424 | // qDebug("%d current page is number %d, pagesize %d, length %d, current %d", |
420 | // currentFilePos, i_pageNum, pageSize, Lview->length(), pageStopArray[i_pageNum] ); | 425 | // currentFilePos, i_pageNum, pageSize, Lview->length(), pageStopArray[i_pageNum] ); |
421 | setStatus(); | 426 | setStatus(); |
422 | Lview->setCursorPosition( 0, 0, FALSE); | 427 | Lview->setCursorPosition( 0, 0, FALSE); |
423 | // } | 428 | // } |
424 | 429 | ||
425 | } else { | 430 | } else { |
426 | // qDebug("bal"); | 431 | // odebug << "bal" << oendl; |
427 | // if( i_pageNum != pages) { | 432 | // if( i_pageNum != pages) { |
428 | 433 | ||
429 | // // int newTop = Lview->Top(); | 434 | // // int newTop = Lview->Top(); |
430 | // // if(Lview->lastRow() > i) | 435 | // // if(Lview->lastRow() > i) |
431 | // Lview->ScrollUp(1); | 436 | // Lview->ScrollUp(1); |
432 | // // i_pageNum++; | 437 | // // i_pageNum++; |
433 | // setStatus(); | 438 | // setStatus(); |
434 | // Lview->setCursorPosition( Lview->Top(), 0, FALSE); | 439 | // Lview->setCursorPosition( Lview->Top(), 0, FALSE); |
435 | 440 | ||
436 | // } | 441 | // } |
437 | 442 | ||
438 | } | 443 | } |
439 | Lview->setFocus(); | 444 | Lview->setFocus(); |
440 | 445 | ||
441 | // qDebug("page number %d line number %d", i_pageNum, currentLine); | 446 | // odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; |
442 | } | 447 | } |
443 | 448 | ||
444 | 449 | ||
445 | void Gutenbrowser::BackBtn() { | 450 | void Gutenbrowser::BackBtn() { |
446 | if( i_pageNum > 0) { | 451 | if( i_pageNum > 0) { |
447 | int pageSize= Lview->PageSize(); | 452 | int pageSize= Lview->PageSize(); |
448 | // int length=Lview->length(); | 453 | // int length=Lview->length(); |
449 | 454 | ||
450 | i_pageNum--; | 455 | i_pageNum--; |
451 | currentFilePos = f.at(); | 456 | currentFilePos = f.at(); |
452 | 457 | ||
453 | // qDebug("%d move back to %d, current page number %d, %d, length %d", | 458 | // qDebug("%d move back to %d, current page number %d, %d, length %d", |
454 | // currentFilePos, pageStopArray[i_pageNum - 1 ], i_pageNum, pageSize, Lview->length() ); | 459 | // currentFilePos, pageStopArray[i_pageNum - 1 ], i_pageNum, pageSize, Lview->length() ); |
455 | 460 | ||
456 | if( i_pageNum < 2) { | 461 | if( i_pageNum < 2) { |
457 | f.at( 0); | 462 | f.at( 0); |
458 | } else { | 463 | } else { |
459 | if(!f.at( pageStopArray[i_pageNum - 1] )) | 464 | if(!f.at( pageStopArray[i_pageNum - 1] )) |
460 | qDebug("File positioned backward did not work"); | 465 | odebug << "File positioned backward did not work" << oendl; |
461 | } | 466 | } |
462 | QString s; | 467 | QString s; |
463 | // int sizeLine=0; | 468 | // int sizeLine=0; |
464 | Lview->clear(); | 469 | Lview->clear(); |
465 | // QString insertString; | 470 | // QString insertString; |
466 | 471 | ||
467 | for(int fd = 0; fd < pageSize ;fd++) { | 472 | for(int fd = 0; fd < pageSize ;fd++) { |
468 | // Lview->removeLine( Lview->PageSize() ); | 473 | // Lview->removeLine( Lview->PageSize() ); |
469 | f.readLine(s, 256); | 474 | f.readLine(s, 256); |
470 | if(useWrap) | 475 | if(useWrap) |
471 | s.replace(QRegExp("\n"),""); | 476 | s.replace(QRegExp("\n"),""); |
472 | currentLine++; | 477 | currentLine++; |
@@ -504,25 +509,25 @@ void Gutenbrowser::BackBtn() { | |||
504 | void Gutenbrowser::doBeginBtn() { | 509 | void Gutenbrowser::doBeginBtn() { |
505 | if(loadCheck) { | 510 | if(loadCheck) { |
506 | qApp->processEvents(); | 511 | qApp->processEvents(); |
507 | BeginBtn(); | 512 | BeginBtn(); |
508 | } | 513 | } |
509 | } | 514 | } |
510 | 515 | ||
511 | // moves text to the very top = 0 | 516 | // moves text to the very top = 0 |
512 | void Gutenbrowser::TopBtn() { | 517 | void Gutenbrowser::TopBtn() { |
513 | 518 | ||
514 | if(loadCheck) { | 519 | if(loadCheck) { |
515 | if( i_pageNum != 0) { | 520 | if( i_pageNum != 0) { |
516 | qDebug("top"); | 521 | odebug << "top" << oendl; |
517 | qApp->processEvents(); | 522 | qApp->processEvents(); |
518 | currentLine = 0; | 523 | currentLine = 0; |
519 | i_pageNum = 1; | 524 | i_pageNum = 1; |
520 | int pageSize = Lview->PageSize() ; | 525 | int pageSize = Lview->PageSize() ; |
521 | Lview->clear(); | 526 | Lview->clear(); |
522 | QString s; | 527 | QString s; |
523 | f.at(0); | 528 | f.at(0); |
524 | for(int fd=0; fd < pageSize ;fd++) { | 529 | for(int fd=0; fd < pageSize ;fd++) { |
525 | f.readLine(s, 256); | 530 | f.readLine(s, 256); |
526 | if(useWrap) | 531 | if(useWrap) |
527 | s.replace(QRegExp("\n"),""); | 532 | s.replace(QRegExp("\n"),""); |
528 | Lview->insertLine(s ,-1); | 533 | Lview->insertLine(s ,-1); |
@@ -562,29 +567,29 @@ void Gutenbrowser::BeginBtn() { | |||
562 | f.at( 0); | 567 | f.at( 0); |
563 | 568 | ||
564 | while ( !f.atEnd() ) { | 569 | while ( !f.atEnd() ) { |
565 | f.readLine(s, 256); | 570 | f.readLine(s, 256); |
566 | lineNo++; | 571 | lineNo++; |
567 | LeftText = s; | 572 | LeftText = s; |
568 | currentFilePos = f.at(); | 573 | currentFilePos = f.at(); |
569 | 574 | ||
570 | i_pageNum = lineNo/pageSize; | 575 | i_pageNum = lineNo/pageSize; |
571 | if(lastPage < i_pageNum) { | 576 | if(lastPage < i_pageNum) { |
572 | pageStopArray.resize(i_pageNum + 1); | 577 | pageStopArray.resize(i_pageNum + 1); |
573 | pageStopArray[i_pageNum ] = currentFilePos; | 578 | pageStopArray[i_pageNum ] = currentFilePos; |
574 | // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos); | 579 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
575 | } | 580 | } |
576 | // lastPage = i_pageNum; | 581 | // lastPage = i_pageNum; |
577 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { | 582 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { |
578 | qDebug("<<<<<< FOUND IT!! new page number %d, found at %d", i_pageNum, currentFilePos); | 583 | odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
579 | break; | 584 | break; |
580 | } | 585 | } |
581 | } | 586 | } |
582 | if(f.atEnd()) //in case we didnt find anything, we need to show something | 587 | if(f.atEnd()) //in case we didnt find anything, we need to show something |
583 | f.at(0); | 588 | f.at(0); |
584 | Lview->clear(); | 589 | Lview->clear(); |
585 | for(int fd=0; fd < pageSize - 1;fd++) { | 590 | for(int fd=0; fd < pageSize - 1;fd++) { |
586 | f.readLine(s, 256); | 591 | f.readLine(s, 256); |
587 | if(useWrap) | 592 | if(useWrap) |
588 | s.replace(QRegExp("\n"),""); | 593 | s.replace(QRegExp("\n"),""); |
589 | Lview->insertLine( s, -1); | 594 | Lview->insertLine( s, -1); |
590 | currentLine++; | 595 | currentLine++; |
@@ -612,29 +617,29 @@ void Gutenbrowser::BeginBtn() { | |||
612 | void Gutenbrowser::setBookmark() { | 617 | void Gutenbrowser::setBookmark() { |
613 | int eexit=QMessageBox::information(this, "Note", | 618 | int eexit=QMessageBox::information(this, "Note", |
614 | "Do you really want to \nset this bookmark?." | 619 | "Do you really want to \nset this bookmark?." |
615 | ,QMessageBox::Yes, QMessageBox::No); | 620 | ,QMessageBox::Yes, QMessageBox::No); |
616 | if (eexit== 3) { | 621 | if (eexit== 3) { |
617 | 622 | ||
618 | currentFilePos = f.at(); | 623 | currentFilePos = f.at(); |
619 | 624 | ||
620 | Config cfg("Gutenbrowser"); | 625 | Config cfg("Gutenbrowser"); |
621 | cfg.setGroup("General"); | 626 | cfg.setGroup("General"); |
622 | file_name=cfg.readEntry("Current",""); | 627 | file_name=cfg.readEntry("Current",""); |
623 | qApp->processEvents(); | 628 | qApp->processEvents(); |
624 | qDebug("Settingbook mark "+file_name); | 629 | odebug << "Settingbook mark "+file_name << oendl; |
625 | 630 | ||
626 | cfg.setGroup("Titles"); | 631 | cfg.setGroup("Titles"); |
627 | title=cfg.readEntry(file_name,""); | 632 | title=cfg.readEntry(file_name,""); |
628 | qDebug("title is "+ title); | 633 | odebug << "title is "+ title << oendl; |
629 | 634 | ||
630 | cfg.setGroup( "Bookmarks" ); | 635 | cfg.setGroup( "Bookmarks" ); |
631 | 636 | ||
632 | cfg.writeEntry("File Name",file_name); | 637 | cfg.writeEntry("File Name",file_name); |
633 | cfg.writeEntry("Page Number",QString::number(i_pageNum) ); | 638 | cfg.writeEntry("Page Number",QString::number(i_pageNum) ); |
634 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); | 639 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); |
635 | cfg.writeEntry("Title", title); | 640 | cfg.writeEntry("Title", title); |
636 | 641 | ||
637 | int row = Lview->topRow();// Lview->Top(); | 642 | int row = Lview->topRow();// Lview->Top(); |
638 | cfg.writeEntry("LineNumber",QString::number(row) ); | 643 | cfg.writeEntry("LineNumber",QString::number(row) ); |
639 | 644 | ||
640 | cfg.setGroup(title); | 645 | cfg.setGroup(title); |
@@ -645,29 +650,29 @@ void Gutenbrowser::setBookmark() { | |||
645 | bookmarksMenu->insertItem( title); | 650 | bookmarksMenu->insertItem( title); |
646 | } | 651 | } |
647 | } //end setBookmark | 652 | } //end setBookmark |
648 | 653 | ||
649 | 654 | ||
650 | /* goes to last set bookmark*/ | 655 | /* goes to last set bookmark*/ |
651 | void Gutenbrowser::Bookmark( int itemId) { | 656 | void Gutenbrowser::Bookmark( int itemId) { |
652 | 657 | ||
653 | // qApp->processEvents(); | 658 | // qApp->processEvents(); |
654 | Config config("Gutenbrowser"); | 659 | Config config("Gutenbrowser"); |
655 | config.setGroup( "Bookmarks" ); | 660 | config.setGroup( "Bookmarks" ); |
656 | 661 | ||
657 | // qDebug("<<<<<< %d, %d", Lview->PageSize(), Lview->lastRow() - Lview->topRow() ); | 662 | // odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl; |
658 | 663 | ||
659 | QString itemString; | 664 | QString itemString; |
660 | 665 | ||
661 | qDebug("menu item %d", itemId); | 666 | odebug << "menu item " << itemId << "" << oendl; |
662 | QString tempTitle; | 667 | QString tempTitle; |
663 | QString s_Bmrkrow; | 668 | QString s_Bmrkrow; |
664 | QString s_pageNum; | 669 | QString s_pageNum; |
665 | int Bmrkrow=0; | 670 | int Bmrkrow=0; |
666 | int bookmarkPosition = 0; | 671 | int bookmarkPosition = 0; |
667 | 672 | ||
668 | // qApp->processEvents(); | 673 | // qApp->processEvents(); |
669 | config.setGroup( "Bookmarks" ); | 674 | config.setGroup( "Bookmarks" ); |
670 | title = config.readEntry("Title", ""); | 675 | title = config.readEntry("Title", ""); |
671 | file_name = config.readEntry("File Name", ""); | 676 | file_name = config.readEntry("File Name", ""); |
672 | i_pageNum = config.readNumEntry("Page Number", 0); | 677 | i_pageNum = config.readNumEntry("Page Number", 0); |
673 | bookmarkPosition = config.readNumEntry( "PagePosition",0); | 678 | bookmarkPosition = config.readNumEntry( "PagePosition",0); |
@@ -691,25 +696,25 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
691 | QString s; | 696 | QString s; |
692 | int lineNo=0; | 697 | int lineNo=0; |
693 | int lastPage=1; | 698 | int lastPage=1; |
694 | while ( !f.atEnd() ) { | 699 | while ( !f.atEnd() ) { |
695 | f.readLine(s, 256); | 700 | f.readLine(s, 256); |
696 | lineNo++; | 701 | lineNo++; |
697 | currentFilePos = f.at(); | 702 | currentFilePos = f.at(); |
698 | 703 | ||
699 | i_pageNum = lineNo/pageSize; | 704 | i_pageNum = lineNo/pageSize; |
700 | if(lastPage < i_pageNum) { | 705 | if(lastPage < i_pageNum) { |
701 | pageStopArray.resize(i_pageNum + 1); | 706 | pageStopArray.resize(i_pageNum + 1); |
702 | pageStopArray[i_pageNum ] = currentFilePos; | 707 | pageStopArray[i_pageNum ] = currentFilePos; |
703 | // qDebug("new page number %d, found at %d", i_pageNum, currentFilePos); | 708 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
704 | } | 709 | } |
705 | if(currentFilePos == bookmarkPosition) | 710 | if(currentFilePos == bookmarkPosition) |
706 | break; | 711 | break; |
707 | } | 712 | } |
708 | if(f.atEnd()) | 713 | if(f.atEnd()) |
709 | f.at(0); | 714 | f.at(0); |
710 | else | 715 | else |
711 | f.at( bookmarkPosition); | 716 | f.at( bookmarkPosition); |
712 | 717 | ||
713 | for(int fd=0; fd < pageSize - 1;fd++) { | 718 | for(int fd=0; fd < pageSize - 1;fd++) { |
714 | f.readLine(s, 256); | 719 | f.readLine(s, 256); |
715 | lineNo++; | 720 | lineNo++; |
@@ -720,58 +725,58 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
720 | } | 725 | } |
721 | 726 | ||
722 | i_pageNum = lineNo/pageSize; | 727 | i_pageNum = lineNo/pageSize; |
723 | pageStopArray.resize(i_pageNum + 1); | 728 | pageStopArray.resize(i_pageNum + 1); |
724 | 729 | ||
725 | if(showMainList) { | 730 | if(showMainList) { |
726 | showMainList=FALSE; | 731 | showMainList=FALSE; |
727 | mainList->hide(); | 732 | mainList->hide(); |
728 | Lview->show(); | 733 | Lview->show(); |
729 | // qApp->processEvents(); | 734 | // qApp->processEvents(); |
730 | } | 735 | } |
731 | 736 | ||
732 | qDebug("bookmark loaded"); | 737 | odebug << "bookmark loaded" << oendl; |
733 | setCaption(title); | 738 | setCaption(title); |
734 | } | 739 | } |
735 | 740 | ||
736 | 741 | ||
737 | bool Gutenbrowser::load( const char *fileName) { | 742 | bool Gutenbrowser::load( const char *fileName) { |
738 | 743 | ||
739 | // QCopEnvelope ( "QPE/System", "busy()" ); | 744 | // QCopEnvelope ( "QPE/System", "busy()" ); |
740 | // qDebug("Title is already set as "+title); | 745 | // odebug << "Title is already set as "+title << oendl; |
741 | qDebug("sizeHint %d pageSize %d", sizeHint().height(),Lview->PageSize() ); | 746 | odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; |
742 | if( Lview->PageSize() < 4) { | 747 | if( Lview->PageSize() < 4) { |
743 | 748 | ||
744 | Lview->setMaximumHeight( sizeHint().height() ); | 749 | Lview->setMaximumHeight( sizeHint().height() ); |
745 | Lview->setMinimumHeight( sizeHint().height() ); | 750 | Lview->setMinimumHeight( sizeHint().height() ); |
746 | pointSize = Lview->fontInfo().pointSize(); | 751 | pointSize = Lview->fontInfo().pointSize(); |
747 | qDebug("sizeHint %d point size %d", sizeHint().height(), pointSize); | 752 | odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; |
748 | if(pointSize < 10) | 753 | if(pointSize < 10) |
749 | Lview->setFixedVisibleLines(19); | 754 | Lview->setFixedVisibleLines(19); |
750 | else | 755 | else |
751 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); | 756 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); |
752 | } | 757 | } |
753 | 758 | ||
754 | Config cfg("Gutenbrowser"); | 759 | Config cfg("Gutenbrowser"); |
755 | cfg.setGroup("General"); | 760 | cfg.setGroup("General"); |
756 | cfg.writeEntry("Current",fileName); | 761 | cfg.writeEntry("Current",fileName); |
757 | currentLine=0; | 762 | currentLine=0; |
758 | 763 | ||
759 | file_name=fileName; | 764 | file_name=fileName; |
760 | QString o_file = fileName; | 765 | QString o_file = fileName; |
761 | 766 | ||
762 | // if (i_pageNum < 1) { | 767 | // if (i_pageNum < 1) { |
763 | i_pageNum = 1; | 768 | i_pageNum = 1; |
764 | // } | 769 | // } |
765 | qDebug("ready to open "+o_file); | 770 | odebug << "ready to open "+o_file << oendl; |
766 | 771 | ||
767 | if(f.isOpen()) f.close(); | 772 | if(f.isOpen()) f.close(); |
768 | f.setName( o_file); | 773 | f.setName( o_file); |
769 | 774 | ||
770 | if ( !f.open( IO_ReadOnly)) { | 775 | if ( !f.open( IO_ReadOnly)) { |
771 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n" +o_file)) ); | 776 | QMessageBox::message( (tr("Note")), (tr("File not opened sucessfully.\n" +o_file)) ); |
772 | return false; | 777 | return false; |
773 | } | 778 | } |
774 | currentFilePos = 0; | 779 | currentFilePos = 0; |
775 | pageStopArray.resize(3); | 780 | pageStopArray.resize(3); |
776 | pageStopArray[0] = currentFilePos; | 781 | pageStopArray[0] = currentFilePos; |
777 | 782 | ||
@@ -789,49 +794,49 @@ bool Gutenbrowser::load( const char *fileName) { | |||
789 | currentLine++; | 794 | currentLine++; |
790 | } | 795 | } |
791 | 796 | ||
792 | // int length = Lview->length(); | 797 | // int length = Lview->length(); |
793 | currentFilePos = f.at(); | 798 | currentFilePos = f.at(); |
794 | 799 | ||
795 | pageStopArray[1] = currentFilePos; | 800 | pageStopArray[1] = currentFilePos; |
796 | 801 | ||
797 | qDebug("<<<<<<<<<<<%d current page is number %d, length %d, current %d, pageSize %d", | 802 | qDebug("<<<<<<<<<<<%d current page is number %d, length %d, current %d, pageSize %d", |
798 | currentFilePos, i_pageNum, Lview->length(), pageStopArray[i_pageNum], Lview->PageSize() ); | 803 | currentFilePos, i_pageNum, Lview->length(), pageStopArray[i_pageNum], Lview->PageSize() ); |
799 | 804 | ||
800 | Lview->setMaxLines(Lview->PageSize()*2); | 805 | Lview->setMaxLines(Lview->PageSize()*2); |
801 | qDebug("Gulped %d", currentLine); | 806 | odebug << "Gulped " << currentLine << "" << oendl; |
802 | setCaption(title); | 807 | setCaption(title); |
803 | Lview->setAutoUpdate( TRUE); | 808 | Lview->setAutoUpdate( TRUE); |
804 | 809 | ||
805 | Lview->setCursorPosition(0,0,FALSE); | 810 | Lview->setCursorPosition(0,0,FALSE); |
806 | 811 | ||
807 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; | 812 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; |
808 | //qDebug("number of pages %d", pages); | 813 | //odebug << "number of pages " << pages << "" << oendl; |
809 | 814 | ||
810 | loadCheck = true; | 815 | loadCheck = true; |
811 | enableButtons(true); | 816 | enableButtons(true); |
812 | if( donateMenu->count() == 3) { | 817 | if( donateMenu->count() == 3) { |
813 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); | 818 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); |
814 | } | 819 | } |
815 | Lview->setFocus(); | 820 | Lview->setFocus(); |
816 | 821 | ||
817 | // QCopEnvelope("QPE/System", "notBusy()" ); | 822 | // QCopEnvelope("QPE/System", "notBusy()" ); |
818 | return true; | 823 | return true; |
819 | } // end load | 824 | } // end load |
820 | 825 | ||
821 | void Gutenbrowser::Search() { | 826 | void Gutenbrowser::Search() { |
822 | 827 | ||
823 | // if( searchDlg->isHidden()) | 828 | // if( searchDlg->isHidden()) |
824 | { | 829 | { |
825 | qDebug("Starting search dialog"); | 830 | odebug << "Starting search dialog" << oendl; |
826 | searchDlg = new SearchDialog( this, "Etext Search", true); | 831 | searchDlg = new SearchDialog( this, "Etext Search", true); |
827 | searchDlg->setCaption( tr( "Etext Search" )); | 832 | searchDlg->setCaption( tr( "Etext Search" )); |
828 | // searchDlg->setLabel( "- searches etext"); | 833 | // searchDlg->setLabel( "- searches etext"); |
829 | connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot())); | 834 | connect( searchDlg,SIGNAL( search_signal()),this,SLOT( search_slot())); |
830 | connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot())); | 835 | connect( searchDlg,SIGNAL( search_done_signal()),this,SLOT( searchdone_slot())); |
831 | 836 | ||
832 | QString resultString; | 837 | QString resultString; |
833 | QString string = searchDlg->searchString; | 838 | QString string = searchDlg->searchString; |
834 | Lview->deselect(); | 839 | Lview->deselect(); |
835 | searchDlg->show(); | 840 | searchDlg->show(); |
836 | searchDlg->result(); | 841 | searchDlg->result(); |
837 | } | 842 | } |
@@ -949,27 +954,27 @@ int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, boo | |||
949 | return 1; | 954 | return 1; |
950 | } | 955 | } |
951 | } | 956 | } |
952 | } | 957 | } |
953 | } | 958 | } |
954 | return 0; | 959 | return 0; |
955 | } | 960 | } |
956 | 961 | ||
957 | void Gutenbrowser::LibraryBtn() { | 962 | void Gutenbrowser::LibraryBtn() { |
958 | 963 | ||
959 | QString newestLibraryFile ="pgwhole.zip"; | 964 | QString newestLibraryFile ="pgwhole.zip"; |
960 | QString zipFile; | 965 | QString zipFile; |
961 | // qDebug("Local Library is %s ", local_library.latin1()); | 966 | // odebug << "Local Library is " << local_library << " " << oendl; |
962 | zipFile="/usr/bin/unzip"; | 967 | zipFile="/usr/bin/unzip"; |
963 | // qDebug("newestLibraryFile is %s ", newestLibraryFile.latin1()); | 968 | // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl; |
964 | if( QFile::exists( local_library+newestLibraryFile)) { | 969 | if( QFile::exists( local_library+newestLibraryFile)) { |
965 | if( QFile::exists(zipFile) ) { | 970 | if( QFile::exists(zipFile) ) { |
966 | UnZipIt(newestLibraryFile); | 971 | UnZipIt(newestLibraryFile); |
967 | } | 972 | } |
968 | else | 973 | else |
969 | QMessageBox::message( "Note",( tr("Please install unzip")) ); | 974 | QMessageBox::message( "Note",( tr("Please install unzip")) ); |
970 | } | 975 | } |
971 | // LibraryDlg = new LibraryDialog( this, "Library Index"); | 976 | // LibraryDlg = new LibraryDialog( this, "Library Index"); |
972 | LibraryDlg->setCaption( tr( "Gutenberg Library")); | 977 | LibraryDlg->setCaption( tr( "Gutenberg Library")); |
973 | Config config("Gutenbrowser"); | 978 | Config config("Gutenbrowser"); |
974 | config.setGroup("General"); | 979 | config.setGroup("General"); |
975 | QString tmp=config.readEntry("RunBefore","FALSE"); | 980 | QString tmp=config.readEntry("RunBefore","FALSE"); |
@@ -980,55 +985,55 @@ void Gutenbrowser::LibraryBtn() { | |||
980 | } | 985 | } |
981 | if(useSplitter) | 986 | if(useSplitter) |
982 | LibraryDlg->useSmallInterface=FALSE; | 987 | LibraryDlg->useSmallInterface=FALSE; |
983 | 988 | ||
984 | LibraryDlg->showMaximized(); | 989 | LibraryDlg->showMaximized(); |
985 | 990 | ||
986 | if( LibraryDlg->exec() != 0 ) { | 991 | if( LibraryDlg->exec() != 0 ) { |
987 | listItemNumber = LibraryDlg->DlglistItemNumber; | 992 | listItemNumber = LibraryDlg->DlglistItemNumber; |
988 | listItemFile = LibraryDlg->DlglistItemFile; | 993 | listItemFile = LibraryDlg->DlglistItemFile; |
989 | listItemYear = LibraryDlg->DlglistItemYear; | 994 | listItemYear = LibraryDlg->DlglistItemYear; |
990 | listItemTitle = LibraryDlg->DlglistItemTitle; | 995 | listItemTitle = LibraryDlg->DlglistItemTitle; |
991 | file_name = LibraryDlg->File_Name; | 996 | file_name = LibraryDlg->File_Name; |
992 | // qDebug("title is being set as "+title); | 997 | // odebug << "title is being set as "+title << oendl; |
993 | title = listItemTitle; | 998 | title = listItemTitle; |
994 | 999 | ||
995 | // config.setGroup( "Proxy" ); | 1000 | // config.setGroup( "Proxy" ); |
996 | // if( LibraryDlg->checked == 1) { | 1001 | // if( LibraryDlg->checked == 1) { |
997 | // config.writeEntry("IsChecked", "TRUE"); | 1002 | // config.writeEntry("IsChecked", "TRUE"); |
998 | // } else { | 1003 | // } else { |
999 | // config.writeEntry("IsChecked", "FALSE"); | 1004 | // config.writeEntry("IsChecked", "FALSE"); |
1000 | // } | 1005 | // } |
1001 | // config.write(); | 1006 | // config.write(); |
1002 | // config.read(); | 1007 | // config.read(); |
1003 | if ( listItemNumber.isNull()) { | 1008 | if ( listItemNumber.isNull()) { |
1004 | } else { | 1009 | } else { |
1005 | i_pageNum = 1; | 1010 | i_pageNum = 1; |
1006 | if( file_name !="Error" && file_name.length() >2 && !file_name.isEmpty() ) { | 1011 | if( file_name !="Error" && file_name.length() >2 && !file_name.isEmpty() ) { |
1007 | //replace .zip with txt for opening it. | 1012 | //replace .zip with txt for opening it. |
1008 | // printf("\nFile name is now\n"); | 1013 | // printf("\nFile name is now\n"); |
1009 | // printf(file_name); | 1014 | // printf(file_name); |
1010 | // printf("\n"); | 1015 | // printf("\n"); |
1011 | // | 1016 | // |
1012 | if( file_name.find(".zip")) | 1017 | if( file_name.find(".zip")) |
1013 | { | 1018 | { |
1014 | qDebug("Found zip file\n"); | 1019 | odebug << "Found zip file\n" << oendl; |
1015 | // QStringList args; | 1020 | // QStringList args; |
1016 | // args="unzip"; | 1021 | // args="unzip"; |
1017 | // args+="-o"; | 1022 | // args+="-o"; |
1018 | // args+=local_library+file_name; | 1023 | // args+=local_library+file_name; |
1019 | // args+="-d"; | 1024 | // args+="-d"; |
1020 | // args+=local_library; | 1025 | // args+=local_library; |
1021 | QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library; | 1026 | QString cmd = "/usr/bin/unzip -o " + local_library+file_name + " -d " + local_library; |
1022 | qDebug("Issuing the command "+ cmd); | 1027 | odebug << "Issuing the command "+ cmd << oendl; |
1023 | // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! | 1028 | // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! |
1024 | // unzipProc->start(); | 1029 | // unzipProc->start(); |
1025 | system(cmd); | 1030 | system(cmd); |
1026 | remove( file_name); | 1031 | remove( file_name); |
1027 | 1032 | ||
1028 | } | 1033 | } |
1029 | // // | 1034 | // // |
1030 | // file_name = file_name.left(4)+ ".txt"; | 1035 | // file_name = file_name.left(4)+ ".txt"; |
1031 | if( LibraryDlg) | 1036 | if( LibraryDlg) |
1032 | delete LibraryDlg; | 1037 | delete LibraryDlg; |
1033 | setTitle(); | 1038 | setTitle(); |
1034 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1039 | // QCopEnvelope ( "QPE/System", "busy()" ); |
@@ -1053,41 +1058,41 @@ void Gutenbrowser::LibraryBtn() { | |||
1053 | // fixKeys(); | 1058 | // fixKeys(); |
1054 | } | 1059 | } |
1055 | 1060 | ||
1056 | void Gutenbrowser::OpenBtn() { | 1061 | void Gutenbrowser::OpenBtn() { |
1057 | QString s_temp; | 1062 | QString s_temp; |
1058 | s_temp = status; | 1063 | s_temp = status; |
1059 | OpenEtext* OpenDlg; | 1064 | OpenEtext* OpenDlg; |
1060 | OpenDlg = new OpenEtext(this,"OpenDlg"); | 1065 | OpenDlg = new OpenEtext(this,"OpenDlg"); |
1061 | OpenDlg->showMaximized(); | 1066 | OpenDlg->showMaximized(); |
1062 | 1067 | ||
1063 | if( OpenDlg->exec() != 0) { | 1068 | if( OpenDlg->exec() != 0) { |
1064 | title = OpenDlg->openFileTitle; | 1069 | title = OpenDlg->openFileTitle; |
1065 | qDebug("title open as "+title); | 1070 | odebug << "title open as "+title << oendl; |
1066 | file_name = OpenDlg->file; | 1071 | file_name = OpenDlg->file; |
1067 | i_pageNum = 1; | 1072 | i_pageNum = 1; |
1068 | 1073 | ||
1069 | if( !file_name.isEmpty() || file_name.length() > 2 ) { | 1074 | if( !file_name.isEmpty() || file_name.length() > 2 ) { |
1070 | if(showMainList) { | 1075 | if(showMainList) { |
1071 | showMainList=FALSE; | 1076 | showMainList=FALSE; |
1072 | qDebug("ShowMainList is now false"); | 1077 | odebug << "ShowMainList is now false" << oendl; |
1073 | mainList->hide(); | 1078 | mainList->hide(); |
1074 | Lview->show(); | 1079 | Lview->show(); |
1075 | qApp->processEvents(); | 1080 | qApp->processEvents(); |
1076 | } | 1081 | } |
1077 | Lview->clear(); | 1082 | Lview->clear(); |
1078 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1083 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1079 | load(file_name); | 1084 | load(file_name); |
1080 | } else { | 1085 | } else { |
1081 | qDebug("file_name is empty!"); | 1086 | odebug << "file_name is empty!" << oendl; |
1082 | if(showMainList) { | 1087 | if(showMainList) { |
1083 | if(!Lview->isHidden()) | 1088 | if(!Lview->isHidden()) |
1084 | Lview->hide(); | 1089 | Lview->hide(); |
1085 | qApp->processEvents(); | 1090 | qApp->processEvents(); |
1086 | if(mainList->isHidden()) | 1091 | if(mainList->isHidden()) |
1087 | mainList->show(); | 1092 | mainList->show(); |
1088 | fillWithTitles(); | 1093 | fillWithTitles(); |
1089 | qApp->processEvents(); | 1094 | qApp->processEvents(); |
1090 | } | 1095 | } |
1091 | 1096 | ||
1092 | } | 1097 | } |
1093 | } | 1098 | } |
@@ -1235,25 +1240,25 @@ bool Gutenbrowser::getTitle( const char *file ) { | |||
1235 | config.setGroup( "Files" ); | 1240 | config.setGroup( "Files" ); |
1236 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 1241 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
1237 | int i_numofFiles = s_numofFiles.toInt(); | 1242 | int i_numofFiles = s_numofFiles.toInt(); |
1238 | 1243 | ||
1239 | for (int i = 1; i <= i_numofFiles; i++) { | 1244 | for (int i = 1; i <= i_numofFiles; i++) { |
1240 | QString temp; | 1245 | QString temp; |
1241 | temp.setNum(i); | 1246 | temp.setNum(i); |
1242 | QString ramble = config.readEntry(temp, "" ); | 1247 | QString ramble = config.readEntry(temp, "" ); |
1243 | 1248 | ||
1244 | if( strcmp(ramble, s_file) == 0) { | 1249 | if( strcmp(ramble, s_file) == 0) { |
1245 | config.setGroup( "Titles" ); | 1250 | config.setGroup( "Titles" ); |
1246 | title = config.readEntry(ramble, ""); | 1251 | title = config.readEntry(ramble, ""); |
1247 | // qDebug("(getTitle)title is being set as "+title); | 1252 | // odebug << "(getTitle)title is being set as "+title << oendl; |
1248 | } | 1253 | } |
1249 | } | 1254 | } |
1250 | return true; | 1255 | return true; |
1251 | } | 1256 | } |
1252 | 1257 | ||
1253 | void Gutenbrowser::searchdone_slot() { | 1258 | void Gutenbrowser::searchdone_slot() { |
1254 | // if (!searchDlg) | 1259 | // if (!searchDlg) |
1255 | // return; | 1260 | // return; |
1256 | // searchDlg->hide(); | 1261 | // searchDlg->hide(); |
1257 | // Lview->setFocus(); | 1262 | // Lview->setFocus(); |
1258 | this->setFocus(); | 1263 | this->setFocus(); |
1259 | last_search = 0; | 1264 | last_search = 0; |
@@ -1437,25 +1442,25 @@ void Gutenbrowser::keyPressEvent( QKeyEvent *e) { | |||
1437 | // if(useSplitter) Rview->MultiLine_Ex::ScrollUp( 1); | 1442 | // if(useSplitter) Rview->MultiLine_Ex::ScrollUp( 1); |
1438 | // break; | 1443 | // break; |
1439 | // case Key_Up: | 1444 | // case Key_Up: |
1440 | // if( Lview->Top() != 0) { | 1445 | // if( Lview->Top() != 0) { |
1441 | // Lview->MultiLine_Ex::ScrollDown( 1); | 1446 | // Lview->MultiLine_Ex::ScrollDown( 1); |
1442 | // if(useSplitter) Rview->MultiLine_Ex::ScrollDown( 1); | 1447 | // if(useSplitter) Rview->MultiLine_Ex::ScrollDown( 1); |
1443 | // } | 1448 | // } |
1444 | // break; | 1449 | // break; |
1445 | } | 1450 | } |
1446 | } | 1451 | } |
1447 | 1452 | ||
1448 | void Gutenbrowser::resizeEvent( QResizeEvent *ev) { | 1453 | void Gutenbrowser::resizeEvent( QResizeEvent *ev) { |
1449 | // qDebug("resize: %d,%d\n",ev->size().width(),ev->size().height()); | 1454 | // odebug << "resize: " << ev->size().width() << "," << ev->size().height() << "\n" << oendl; |
1450 | 1455 | ||
1451 | if( !LibraryDlg->isHidden()) | 1456 | if( !LibraryDlg->isHidden()) |
1452 | LibraryDlg->resize(ev->size().width(),ev->size().height() ); | 1457 | LibraryDlg->resize(ev->size().width(),ev->size().height() ); |
1453 | 1458 | ||
1454 | // if( loadCheck == true) { | 1459 | // if( loadCheck == true) { |
1455 | // ResizeEdits(); | 1460 | // ResizeEdits(); |
1456 | // AdjustStatus(); | 1461 | // AdjustStatus(); |
1457 | // } | 1462 | // } |
1458 | } | 1463 | } |
1459 | 1464 | ||
1460 | 1465 | ||
1461 | void Gutenbrowser::doOptions() { | 1466 | void Gutenbrowser::doOptions() { |
@@ -1467,68 +1472,68 @@ void Gutenbrowser::doOptions() { | |||
1467 | QFont myFont; | 1472 | QFont myFont; |
1468 | optDlg->showMaximized(); | 1473 | optDlg->showMaximized(); |
1469 | 1474 | ||
1470 | if( optDlg->exec() !=0) { | 1475 | if( optDlg->exec() !=0) { |
1471 | qApp->processEvents(); | 1476 | qApp->processEvents(); |
1472 | brow=optDlg->browserName; | 1477 | brow=optDlg->browserName; |
1473 | toggleButtonIcons( optDlg->useIcon); | 1478 | toggleButtonIcons( optDlg->useIcon); |
1474 | ftp_host= optDlg->ftp_host; | 1479 | ftp_host= optDlg->ftp_host; |
1475 | ftp_base_dir= optDlg->ftp_base_dir; | 1480 | ftp_base_dir= optDlg->ftp_base_dir; |
1476 | brow=optDlg->browserName; | 1481 | brow=optDlg->browserName; |
1477 | Ddir=optDlg->downloadDirEdit->text(); | 1482 | Ddir=optDlg->downloadDirEdit->text(); |
1478 | 1483 | ||
1479 | qDebug("writing library config"); | 1484 | odebug << "writing library config" << oendl; |
1480 | Config config("Gutenbrowser"); | 1485 | Config config("Gutenbrowser"); |
1481 | config.setGroup("General"); | 1486 | config.setGroup("General"); |
1482 | 1487 | ||
1483 | QString dirname= optDlg->downloadDirEdit->text(); | 1488 | QString dirname= optDlg->downloadDirEdit->text(); |
1484 | if(dirname.right(1)!="/") | 1489 | if(dirname.right(1)!="/") |
1485 | dirname+="/"; | 1490 | dirname+="/"; |
1486 | config.writeEntry( "DownloadDirectory",dirname); | 1491 | config.writeEntry( "DownloadDirectory",dirname); |
1487 | QDir newDir( optDlg->downloadDirEdit->text()); | 1492 | QDir newDir( optDlg->downloadDirEdit->text()); |
1488 | 1493 | ||
1489 | if( !newDir.exists() ) { | 1494 | if( !newDir.exists() ) { |
1490 | int exit=QMessageBox::information(this, "Note", "Ok, to make a new directory\n"+Ddir+" ?", | 1495 | int exit=QMessageBox::information(this, "Note", "Ok, to make a new directory\n"+Ddir+" ?", |
1491 | QMessageBox::Ok, QMessageBox::Cancel); | 1496 | QMessageBox::Ok, QMessageBox::Cancel); |
1492 | if (exit==1) { | 1497 | if (exit==1) { |
1493 | QString cmd="mkdir -p "; | 1498 | QString cmd="mkdir -p "; |
1494 | cmd+=Ddir.latin1(); | 1499 | cmd+=Ddir.latin1(); |
1495 | system(cmd); | 1500 | system(cmd); |
1496 | qDebug("Making new dir "+cmd); | 1501 | odebug << "Making new dir "+cmd << oendl; |
1497 | if(Ddir.right(1)!="/") { | 1502 | if(Ddir.right(1)!="/") { |
1498 | Ddir+="/"; | 1503 | Ddir+="/"; |
1499 | } | 1504 | } |
1500 | config.writeEntry("DownloadDirectory",Ddir); | 1505 | config.writeEntry("DownloadDirectory",Ddir); |
1501 | } | 1506 | } |
1502 | } | 1507 | } |
1503 | 1508 | ||
1504 | // if(optDlg->styleChanged) | 1509 | // if(optDlg->styleChanged) |
1505 | // setStyle( optDlg->styleInt); | 1510 | // setStyle( optDlg->styleInt); |
1506 | if(optDlg->b_qExit==TRUE) | 1511 | if(optDlg->b_qExit==TRUE) |
1507 | b_queryExit=TRUE; | 1512 | b_queryExit=TRUE; |
1508 | else | 1513 | else |
1509 | b_queryExit=FALSE; | 1514 | b_queryExit=FALSE; |
1510 | 1515 | ||
1511 | if(optDlg->fontDlg-> changedFonts) { | 1516 | if(optDlg->fontDlg-> changedFonts) { |
1512 | qDebug("Setting font"); | 1517 | odebug << "Setting font" << oendl; |
1513 | myFont=optDlg->fontDlg->selectedFont; | 1518 | myFont=optDlg->fontDlg->selectedFont; |
1514 | Lview->setFont( myFont); | 1519 | Lview->setFont( myFont); |
1515 | } | 1520 | } |
1516 | 1521 | ||
1517 | if(optDlg->useWordWrap_CheckBox->isChecked() ) { | 1522 | if(optDlg->useWordWrap_CheckBox->isChecked() ) { |
1518 | qDebug("WORD WRAP is set"); | 1523 | odebug << "WORD WRAP is set" << oendl; |
1519 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); | 1524 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); |
1520 | useWrap=true; | 1525 | useWrap=true; |
1521 | } else { | 1526 | } else { |
1522 | qDebug("Word wrap is NOT set"); | 1527 | odebug << "Word wrap is NOT set" << oendl; |
1523 | Lview->setWordWrap(QMultiLineEdit::NoWrap); | 1528 | Lview->setWordWrap(QMultiLineEdit::NoWrap); |
1524 | useWrap=false; | 1529 | useWrap=false; |
1525 | } | 1530 | } |
1526 | } | 1531 | } |
1527 | if(showMainList) { | 1532 | if(showMainList) { |
1528 | if(!Lview->isHidden()) | 1533 | if(!Lview->isHidden()) |
1529 | Lview->hide(); | 1534 | Lview->hide(); |
1530 | qApp->processEvents(); | 1535 | qApp->processEvents(); |
1531 | if(mainList->isHidden()) | 1536 | if(mainList->isHidden()) |
1532 | mainList->show(); | 1537 | mainList->show(); |
1533 | fillWithTitles(); | 1538 | fillWithTitles(); |
1534 | } else { | 1539 | } else { |
@@ -1569,26 +1574,26 @@ bool Gutenbrowser::setTitle() { | |||
1569 | config.writeEntry(interger, file_name); | 1574 | config.writeEntry(interger, file_name); |
1570 | 1575 | ||
1571 | config.setGroup( "Titles" ); | 1576 | config.setGroup( "Titles" ); |
1572 | config.writeEntry(file_name,listItemTitle); | 1577 | config.writeEntry(file_name,listItemTitle); |
1573 | } | 1578 | } |
1574 | test = 0; | 1579 | test = 0; |
1575 | // config.write(); | 1580 | // config.write(); |
1576 | return true; | 1581 | return true; |
1577 | } | 1582 | } |
1578 | /*Calls new fangled network dialog */ | 1583 | /*Calls new fangled network dialog */ |
1579 | void Gutenbrowser::OnNetworkDialog( const QString &/*networkUrl*/, const QString &/*output*/) | 1584 | void Gutenbrowser::OnNetworkDialog( const QString &/*networkUrl*/, const QString &/*output*/) |
1580 | { | 1585 | { |
1581 | // qDebug(networkUrl); | 1586 | // odebug << networkUrl << oendl; |
1582 | // qDebug(output); | 1587 | // odebug << output << oendl; |
1583 | // #ifndef Q_WS_QWS | 1588 | // #ifndef Q_WS_QWS |
1584 | // NetworkDialog *NetworkDlg; | 1589 | // NetworkDialog *NetworkDlg; |
1585 | // if( networkUrl.length() < 4 ) networkUrl= "http://sailor.gutenberg.org/mirror.sites.html"; | 1590 | // if( networkUrl.length() < 4 ) networkUrl= "http://sailor.gutenberg.org/mirror.sites.html"; |
1586 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, output); | 1591 | // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, output); |
1587 | // if( NetworkDlg->exec() != 0 ) { | 1592 | // if( NetworkDlg->exec() != 0 ) { |
1588 | // } | 1593 | // } |
1589 | // if(NetworkDlg) | 1594 | // if(NetworkDlg) |
1590 | // delete NetworkDlg; | 1595 | // delete NetworkDlg; |
1591 | // #endif | 1596 | // #endif |
1592 | } | 1597 | } |
1593 | 1598 | ||
1594 | void Gutenbrowser::donateGutenberg() | 1599 | void Gutenbrowser::donateGutenberg() |
@@ -1703,31 +1708,31 @@ void Gutenbrowser::focusInEvent( QFocusEvent* ) | |||
1703 | { | 1708 | { |
1704 | } | 1709 | } |
1705 | void Gutenbrowser::focusOutEvent( QFocusEvent* ) | 1710 | void Gutenbrowser::focusOutEvent( QFocusEvent* ) |
1706 | { | 1711 | { |
1707 | } | 1712 | } |
1708 | 1713 | ||
1709 | void Gutenbrowser::cleanUp( ) | 1714 | void Gutenbrowser::cleanUp( ) |
1710 | { | 1715 | { |
1711 | writeConfig(); | 1716 | writeConfig(); |
1712 | QPEApplication::grabKeyboard(); | 1717 | QPEApplication::grabKeyboard(); |
1713 | 1718 | ||
1714 | QPEApplication::ungrabKeyboard(); | 1719 | QPEApplication::ungrabKeyboard(); |
1715 | // qDebug("Cleanup"); | 1720 | // odebug << "Cleanup" << oendl; |
1716 | if(f.isOpen()) f.close(); | 1721 | if(f.isOpen()) f.close(); |
1717 | } | 1722 | } |
1718 | 1723 | ||
1719 | void Gutenbrowser::fixKeys() | 1724 | void Gutenbrowser::fixKeys() |
1720 | { | 1725 | { |
1721 | qDebug("Attempting to fix keys"); | 1726 | odebug << "Attempting to fix keys" << oendl; |
1722 | 1727 | ||
1723 | } | 1728 | } |
1724 | 1729 | ||
1725 | void Gutenbrowser::enableButtons(bool b) | 1730 | void Gutenbrowser::enableButtons(bool b) |
1726 | { | 1731 | { |
1727 | BackButton->setEnabled(b); | 1732 | BackButton->setEnabled(b); |
1728 | ForwardButton->setEnabled(b); | 1733 | ForwardButton->setEnabled(b); |
1729 | SearchButton->setEnabled(b); | 1734 | SearchButton->setEnabled(b); |
1730 | setBookmarkButton->setEnabled(b); | 1735 | setBookmarkButton->setEnabled(b); |
1731 | dictionaryButton->setEnabled(b); | 1736 | dictionaryButton->setEnabled(b); |
1732 | InfoBar->setEnabled(b); | 1737 | InfoBar->setEnabled(b); |
1733 | 1738 | ||
@@ -1763,25 +1768,25 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { | |||
1763 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1768 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1764 | title = index->text(); | 1769 | title = index->text(); |
1765 | showMainList=FALSE; | 1770 | showMainList=FALSE; |
1766 | mainList->hide(); | 1771 | mainList->hide(); |
1767 | Lview->show(); | 1772 | Lview->show(); |
1768 | qApp->processEvents(); | 1773 | qApp->processEvents(); |
1769 | QString temp; | 1774 | QString temp; |
1770 | temp.setNum( mainList->currentItem() + 1); | 1775 | temp.setNum( mainList->currentItem() + 1); |
1771 | // openFileTitle = title; | 1776 | // openFileTitle = title; |
1772 | Config config("Gutenbrowser"); | 1777 | Config config("Gutenbrowser"); |
1773 | config.setGroup( "Files" ); | 1778 | config.setGroup( "Files" ); |
1774 | QString file = config.readEntry(temp, ""); | 1779 | QString file = config.readEntry(temp, ""); |
1775 | qDebug("About to load"); | 1780 | odebug << "About to load" << oendl; |
1776 | if( Lview->isVisible()) | 1781 | if( Lview->isVisible()) |
1777 | load(file); | 1782 | load(file); |
1778 | 1783 | ||
1779 | config.setGroup( title); | 1784 | config.setGroup( title); |
1780 | file_name = config.readEntry("File Name", ""); | 1785 | file_name = config.readEntry("File Name", ""); |
1781 | i_pageNum = config.readNumEntry("Page Number", 1); | 1786 | i_pageNum = config.readNumEntry("Page Number", 1); |
1782 | int Bmrkrow = config.readNumEntry("LineNumber", -1); | 1787 | int Bmrkrow = config.readNumEntry("LineNumber", -1); |
1783 | if(Bmrkrow > -1) { | 1788 | if(Bmrkrow > -1) { |
1784 | if( Bmrkrow > Lview->topRow() ) { | 1789 | if( Bmrkrow > Lview->topRow() ) { |
1785 | Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); | 1790 | Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); |
1786 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); | 1791 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); |
1787 | // AdjustStatus(); | 1792 | // AdjustStatus(); |
@@ -1804,29 +1809,29 @@ void Gutenbrowser::infoGutenbrowser() { | |||
1804 | void Gutenbrowser::setDocument(const QString & frozenBoogers) { | 1809 | void Gutenbrowser::setDocument(const QString & frozenBoogers) { |
1805 | this->hide(); | 1810 | this->hide(); |
1806 | if(showMainList) { | 1811 | if(showMainList) { |
1807 | showMainList=FALSE; | 1812 | showMainList=FALSE; |
1808 | if(!mainList->isHidden()) | 1813 | if(!mainList->isHidden()) |
1809 | mainList->hide(); | 1814 | mainList->hide(); |
1810 | if(Lview->isHidden()) | 1815 | if(Lview->isHidden()) |
1811 | Lview->show(); | 1816 | Lview->show(); |
1812 | qApp->processEvents(); | 1817 | qApp->processEvents(); |
1813 | } | 1818 | } |
1814 | DocLnk lnk; | 1819 | DocLnk lnk; |
1815 | lnk = DocLnk(frozenBoogers); | 1820 | lnk = DocLnk(frozenBoogers); |
1816 | // qDebug(lnk.file() ); | 1821 | // odebug << lnk.file() << oendl; |
1817 | title=lnk.comment(); | 1822 | title=lnk.comment(); |
1818 | load( lnk.file()); | 1823 | load( lnk.file()); |
1819 | this->show(); | 1824 | this->show(); |
1820 | // qDebug(title); | 1825 | // odebug << title << oendl; |
1821 | // qApp->processEvents(); | 1826 | // qApp->processEvents(); |
1822 | // repaint(); | 1827 | // repaint(); |
1823 | } | 1828 | } |
1824 | 1829 | ||
1825 | void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) | 1830 | void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) |
1826 | { | 1831 | { |
1827 | switch (mouse) { | 1832 | switch (mouse) { |
1828 | case 1: | 1833 | case 1: |
1829 | break; | 1834 | break; |
1830 | case 2: { | 1835 | case 2: { |
1831 | QPopupMenu m;// = new QPopupMenu( Local_View ); | 1836 | QPopupMenu m;// = new QPopupMenu( Local_View ); |
1832 | m.insertItem( tr( "Open" ), this, SLOT( menuOpen() )); | 1837 | m.insertItem( tr( "Open" ), this, SLOT( menuOpen() )); |
@@ -1864,121 +1869,121 @@ void Gutenbrowser::searchGoogle( const QString &tempText) { | |||
1864 | text.replace( QRegExp(")"), ""); | 1869 | text.replace( QRegExp(")"), ""); |
1865 | // text.replace( QRegExp("[0-9]"), ""); | 1870 | // text.replace( QRegExp("[0-9]"), ""); |
1866 | QString s_lookup = "http://google.com/search?q="+text+"&num=30&sa=Google+Search"; | 1871 | QString s_lookup = "http://google.com/search?q="+text+"&num=30&sa=Google+Search"; |
1867 | goGetit( s_lookup, true); | 1872 | goGetit( s_lookup, true); |
1868 | } | 1873 | } |
1869 | 1874 | ||
1870 | } | 1875 | } |
1871 | 1876 | ||
1872 | void Gutenbrowser::menuEditTitle() | 1877 | void Gutenbrowser::menuEditTitle() |
1873 | { | 1878 | { |
1874 | int currentItem = mainList->currentItem(); | 1879 | int currentItem = mainList->currentItem(); |
1875 | QString title_text = mainList->text( currentItem); | 1880 | QString title_text = mainList->text( currentItem); |
1876 | //qDebug("Selected "+title_text); | 1881 | //odebug << "Selected "+title_text << oendl; |
1877 | 1882 | ||
1878 | Config config("Gutenbrowser"); | 1883 | Config config("Gutenbrowser"); |
1879 | config.setGroup( "Files" ); | 1884 | config.setGroup( "Files" ); |
1880 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); | 1885 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); |
1881 | int i_numofFiles = s_numofFiles.toInt(); | 1886 | int i_numofFiles = s_numofFiles.toInt(); |
1882 | QString fileNum; | 1887 | QString fileNum; |
1883 | for (int i = 1; i <= i_numofFiles+1; i++) { | 1888 | for (int i = 1; i <= i_numofFiles+1; i++) { |
1884 | 1889 | ||
1885 | fileNum.setNum(i); | 1890 | fileNum.setNum(i); |
1886 | config.setGroup( "Files" ); | 1891 | config.setGroup( "Files" ); |
1887 | QString s_filename = config.readEntry(fileNum, "" ); | 1892 | QString s_filename = config.readEntry(fileNum, "" ); |
1888 | config.setGroup( "Titles" ); | 1893 | config.setGroup( "Titles" ); |
1889 | QString file_title = config.readEntry( s_filename, ""); | 1894 | QString file_title = config.readEntry( s_filename, ""); |
1890 | //qDebug("file_title is "+file_title); | 1895 | //odebug << "file_title is "+file_title << oendl; |
1891 | if(title_text == file_title ) { | 1896 | if(title_text == file_title ) { |
1892 | // selFile = s_filename; | 1897 | // selFile = s_filename; |
1893 | //qDebug("Edit: "+ file_title ); | 1898 | //odebug << "Edit: "+ file_title << oendl; |
1894 | i=i_numofFiles+1; | 1899 | i=i_numofFiles+1; |
1895 | Edit_Title *titleEdit; | 1900 | Edit_Title *titleEdit; |
1896 | titleEdit = new Edit_Title(this,file_title ,TRUE); | 1901 | titleEdit = new Edit_Title(this,file_title ,TRUE); |
1897 | if(titleEdit->exec() !=0) { | 1902 | if(titleEdit->exec() !=0) { |
1898 | //qDebug(titleEdit->newTitle); | 1903 | //odebug << titleEdit->newTitle << oendl; |
1899 | config.writeEntry( s_filename, titleEdit->newTitle); | 1904 | config.writeEntry( s_filename, titleEdit->newTitle); |
1900 | mainList->removeItem(currentItem); | 1905 | mainList->removeItem(currentItem); |
1901 | mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem); | 1906 | mainList->insertItem ( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), titleEdit->newTitle, currentItem); |
1902 | } | 1907 | } |
1903 | } | 1908 | } |
1904 | } | 1909 | } |
1905 | 1910 | ||
1906 | // getTitles(); | 1911 | // getTitles(); |
1907 | mainList->triggerUpdate(true); | 1912 | mainList->triggerUpdate(true); |
1908 | 1913 | ||
1909 | } | 1914 | } |
1910 | 1915 | ||
1911 | 1916 | ||
1912 | 1917 | ||
1913 | bool Gutenbrowser::UnZipIt(const QString &zipFile) { | 1918 | bool Gutenbrowser::UnZipIt(const QString &zipFile) { |
1914 | qDebug(zipFile); | 1919 | odebug << zipFile << oendl; |
1915 | #ifndef Q_WS_QWS | 1920 | #ifndef Q_WS_QWS |
1916 | if( QFile::exists( zipFile)) { // TODO findsome other way of dealingwithzip files. | 1921 | if( QFile::exists( zipFile)) { // TODO findsome other way of dealingwithzip files. |
1917 | bool isPgWhole=false; | 1922 | bool isPgWhole=false; |
1918 | QString thatFile; | 1923 | QString thatFile; |
1919 | if(zipFile.find("pgwhole",0,TRUE)) { | 1924 | if(zipFile.find("pgwhole",0,TRUE)) { |
1920 | isPgWhole=TRUE; | 1925 | isPgWhole=TRUE; |
1921 | thatFile= local_library +"PGWHOLE.TXT"; | 1926 | thatFile= local_library +"PGWHOLE.TXT"; |
1922 | } | 1927 | } |
1923 | // else { | 1928 | // else { |
1924 | // thatFile=zipFile.left(4); | 1929 | // thatFile=zipFile.left(4); |
1925 | // } | 1930 | // } |
1926 | // qDebug((const char*)local_library.latin1()); | 1931 | // odebug << (const char*)local_library.latin1() << oendl; |
1927 | QString cmd; | 1932 | QString cmd; |
1928 | #if defined(_WS_X11_) | 1933 | #if defined(_WS_X11_) |
1929 | if( chdir((const char*)local_library.latin1())!=0) | 1934 | if( chdir((const char*)local_library.latin1())!=0) |
1930 | qDebug("chdir failed."); | 1935 | odebug << "chdir failed." << oendl; |
1931 | cmd = "gunzip -S .zip " + local_library+zipFile; | 1936 | cmd = "gunzip -S .zip " + local_library+zipFile; |
1932 | //cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; | 1937 | //cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; |
1933 | #endif | 1938 | #endif |
1934 | #ifdef Q_WS_QWS | 1939 | #ifdef Q_WS_QWS |
1935 | if( chdir((const char*)local_library.latin1())!=0) | 1940 | if( chdir((const char*)local_library.latin1())!=0) |
1936 | qDebug("chdir failed."); | 1941 | odebug << "chdir failed." << oendl; |
1937 | cmd = "unzip " + local_library+zipFile; | 1942 | cmd = "unzip " + local_library+zipFile; |
1938 | // cmd = "/usr/bin/unzip -o " + local_library+zipFile +" -d /usr/share/doc/gutenbrowser" ;//+ local_library; | 1943 | // cmd = "/usr/bin/unzip -o " + local_library+zipFile +" -d /usr/share/doc/gutenbrowser" ;//+ local_library; |
1939 | #endif | 1944 | #endif |
1940 | int exit=QMessageBox::information(this, "Ok to unzip?", | 1945 | int exit=QMessageBox::information(this, "Ok to unzip?", |
1941 | "Ok to unnzip\n"+ zipFile+" ?", | 1946 | "Ok to unnzip\n"+ zipFile+" ?", |
1942 | QMessageBox::Yes, QMessageBox::No); | 1947 | QMessageBox::Yes, QMessageBox::No); |
1943 | if (exit==QMessageBox::Yes) { | 1948 | if (exit==QMessageBox::Yes) { |
1944 | #if defined(_WS_X11_)// | 1949 | #if defined(_WS_X11_)// |
1945 | qDebug("Issuing the command "+cmd); | 1950 | odebug << "Issuing the command "+cmd << oendl; |
1946 | system( cmd); | 1951 | system( cmd); |
1947 | if( QFile::exists(thatFile)) | 1952 | if( QFile::exists(thatFile)) |
1948 | remove (thatFile); | 1953 | remove (thatFile); |
1949 | if(isPgWhole) { | 1954 | if(isPgWhole) { |
1950 | if( rename("pgwhole","PGWHOLE.TXT") !=0) | 1955 | if( rename("pgwhole","PGWHOLE.TXT") !=0) |
1951 | qDebug("rename failed"); | 1956 | odebug << "rename failed" << oendl; |
1952 | } else { | 1957 | } else { |
1953 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) | 1958 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) |
1954 | qDebug("rename failed"); | 1959 | odebug << "rename failed" << oendl; |
1955 | } | 1960 | } |
1956 | #endif | 1961 | #endif |
1957 | #ifdef Q_WS_QWS | 1962 | #ifdef Q_WS_QWS |
1958 | qDebug("Issuing the command "+cmd); | 1963 | odebug << "Issuing the command "+cmd << oendl; |
1959 | system( cmd); | 1964 | system( cmd); |
1960 | if( QFile::exists(thatFile)) | 1965 | if( QFile::exists(thatFile)) |
1961 | remove(thatFile); | 1966 | remove(thatFile); |
1962 | if(isPgWhole) { | 1967 | if(isPgWhole) { |
1963 | if( rename("pgwhole","PGWHOLE.TXT") !=0) | 1968 | if( rename("pgwhole","PGWHOLE.TXT") !=0) |
1964 | qDebug("rename failed"); | 1969 | odebug << "rename failed" << oendl; |
1965 | } else { | 1970 | } else { |
1966 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) | 1971 | if( rename(thatFile.left(4),thatFile.left(4)+".txt") !=0) |
1967 | qDebug("rename failed"); | 1972 | odebug << "rename failed" << oendl; |
1968 | } | 1973 | } |
1969 | #endif | 1974 | #endif |
1970 | // remove( zipFile); | 1975 | // remove( zipFile); |
1971 | return true; | 1976 | return true; |
1972 | } | 1977 | } |
1973 | else if(exit==QMessageBox::No) { | 1978 | else if(exit==QMessageBox::No) { |
1974 | // qDebug("unzip"); | 1979 | // odebug << "unzip" << oendl; |
1975 | return false; | 1980 | return false; |
1976 | } | 1981 | } |
1977 | } | 1982 | } |
1978 | else | 1983 | else |
1979 | QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) ); | 1984 | QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) ); |
1980 | #endif | 1985 | #endif |
1981 | return false; | 1986 | return false; |
1982 | } | 1987 | } |
1983 | 1988 | ||
1984 | 1989 | ||
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp index c9149ac..a226258 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | |||
@@ -2,71 +2,75 @@ | |||
2 | gutenbrowser.cpp - description | 2 | gutenbrowser.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Jul 24 22:33:12 MDT 2000 | 4 | begin : Mon Jul 24 22:33:12 MDT 2000 |
5 | copyright : (C) 2000 -2004 by llornkcor | 5 | copyright : (C) 2000 -2004 by llornkcor |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | |||
14 | //#include "gutenbrowserData.h" | 15 | //#include "gutenbrowserData.h" |
15 | #include "gutenbrowser.h" | 16 | #include "gutenbrowser.h" |
16 | 17 | ||
18 | /* OPIE */ | ||
19 | #include <opie2/odebug.h> | ||
17 | #include <qpe/config.h> | 20 | #include <qpe/config.h> |
18 | #include <qpe/fontdatabase.h> | 21 | #include <qpe/fontdatabase.h> |
19 | #include <qpe/menubutton.h> | 22 | #include <qpe/menubutton.h> |
20 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
21 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
22 | 25 | ||
26 | /* QT */ | ||
23 | #include <qfontinfo.h> | 27 | #include <qfontinfo.h> |
24 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
25 | 29 | ||
26 | void Gutenbrowser::initSlots() { | 30 | void Gutenbrowser::initSlots() { |
27 | 31 | ||
28 | connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn())); | 32 | connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn())); |
29 | connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn())); | 33 | connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn())); |
30 | connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn())); | 34 | connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn())); |
31 | connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn())); | 35 | connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn())); |
32 | connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn())); | 36 | connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn())); |
33 | connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark())); | 37 | connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark())); |
34 | connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn())); | 38 | connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn())); |
35 | connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick())); | 39 | connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick())); |
36 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); | 40 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); |
37 | connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); | 41 | connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); |
38 | connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); | 42 | connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); |
39 | } | 43 | } |
40 | 44 | ||
41 | void Gutenbrowser::initConfig() { | 45 | void Gutenbrowser::initConfig() { |
42 | //qDebug("Starting configuration."); | 46 | //odebug << "Starting configuration." << oendl; |
43 | QDir library(local_library); | 47 | QDir library(local_library); |
44 | if ( !library.exists()) { | 48 | if ( !library.exists()) { |
45 | library.mkdir(local_library, TRUE); | 49 | library.mkdir(local_library, TRUE); |
46 | QString msg; | 50 | QString msg; |
47 | // #ifndef Q_WS_WIN | 51 | // #ifndef Q_WS_WIN |
48 | msg = "chmod 755 " + local_library; | 52 | msg = "chmod 755 " + local_library; |
49 | system(msg); | 53 | system(msg); |
50 | // QDir pixdir(local_library+"pix"); | 54 | // QDir pixdir(local_library+"pix"); |
51 | // if ( !pixdir.exists()) { | 55 | // if ( !pixdir.exists()) { |
52 | // pixdir.mkdir(local_library+"pix", TRUE); | 56 | // pixdir.mkdir(local_library+"pix", TRUE); |
53 | // QString msg; | 57 | // QString msg; |
54 | // msg = "chmod 755 " + local_library+"pix"; | 58 | // msg = "chmod 755 " + local_library+"pix"; |
55 | // system(msg); | 59 | // system(msg); |
56 | // } | 60 | // } |
57 | // #endif | 61 | // #endif |
58 | 62 | ||
59 | } | 63 | } |
60 | // qDebug( "init file is %s",iniFile.latin1()); | 64 | // odebug << "init file is " << iniFile << "" << oendl; |
61 | 65 | ||
62 | #ifdef Q_WS_QWS | 66 | #ifdef Q_WS_QWS |
63 | useSplitter=FALSE; | 67 | useSplitter=FALSE; |
64 | Config config("Gutenbrowser"); | 68 | Config config("Gutenbrowser"); |
65 | 69 | ||
66 | config.setGroup( "General" ); | 70 | config.setGroup( "General" ); |
67 | //useWordWrap_CheckBox | 71 | //useWordWrap_CheckBox |
68 | useIcons=TRUE; | 72 | useIcons=TRUE; |
69 | #else | 73 | #else |
70 | 74 | ||
71 | config.setGroup( "General" ); | 75 | config.setGroup( "General" ); |
72 | QString s_Split=config.readEntry("Splitter", "TRUE" ); | 76 | QString s_Split=config.readEntry("Splitter", "TRUE" ); |
@@ -138,39 +142,39 @@ void Gutenbrowser::initConfig() { | |||
138 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); | 142 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); |
139 | 143 | ||
140 | //bool ok2; | 144 | //bool ok2; |
141 | QString temp; | 145 | QString temp; |
142 | QString copying; | 146 | QString copying; |
143 | copying=""; | 147 | copying=""; |
144 | 148 | ||
145 | config.setGroup("General"); | 149 | config.setGroup("General"); |
146 | QString qExit; | 150 | QString qExit; |
147 | qExit=config.readEntry("queryExit","TRUE"); | 151 | qExit=config.readEntry("queryExit","TRUE"); |
148 | if(qExit=="TRUE") { | 152 | if(qExit=="TRUE") { |
149 | b_queryExit=TRUE; | 153 | b_queryExit=TRUE; |
150 | // qDebug("Please query before leaving the library."); | 154 | // odebug << "Please query before leaving the library." << oendl; |
151 | } else { | 155 | } else { |
152 | // qDebug("Please DO NOT query before leaving the library."); | 156 | // odebug << "Please DO NOT query before leaving the library." << oendl; |
153 | b_queryExit=FALSE; | 157 | b_queryExit=FALSE; |
154 | } | 158 | } |
155 | // bookmarks | 159 | // bookmarks |
156 | // config.setGroup("Titles"); | 160 | // config.setGroup("Titles"); |
157 | // QString tmpTitle=config.readEntry(file_name,""); | 161 | // QString tmpTitle=config.readEntry(file_name,""); |
158 | 162 | ||
159 | 163 | ||
160 | }// end initConfig() | 164 | }// end initConfig() |
161 | 165 | ||
162 | void Gutenbrowser::initMenuBar() | 166 | void Gutenbrowser::initMenuBar() |
163 | { | 167 | { |
164 | // qDebug("Starting menu init."); | 168 | // odebug << "Starting menu init." << oendl; |
165 | // menuBar entry fileMenu | 169 | // menuBar entry fileMenu |
166 | menubar = new QPEMenuBar(this); | 170 | menubar = new QPEMenuBar(this); |
167 | 171 | ||
168 | fileMenu=new QPopupMenu(); | 172 | fileMenu=new QPopupMenu(); |
169 | fileMenu->insertItem(Resource::loadPixmap("gutenbrowser/openbook"), | 173 | fileMenu->insertItem(Resource::loadPixmap("gutenbrowser/openbook"), |
170 | "Open Local Library...", this, SLOT( OpenBtn()) ); | 174 | "Open Local Library...", this, SLOT( OpenBtn()) ); |
171 | // fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) ); | 175 | // fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) ); |
172 | fileMenu->insertItem( Resource::loadPixmap("home"), | 176 | fileMenu->insertItem( Resource::loadPixmap("home"), |
173 | "Download Library Index", this, SLOT( downloadLibIndex()) ); | 177 | "Download Library Index", this, SLOT( downloadLibIndex()) ); |
174 | fileMenu->insertItem( Resource::loadPixmap("quit"), | 178 | fileMenu->insertItem( Resource::loadPixmap("quit"), |
175 | "Quit Gutenbrowser...", this, SLOT( ByeBye()) ); | 179 | "Quit Gutenbrowser...", this, SLOT( ByeBye()) ); |
176 | // menuBar entry editMenu | 180 | // menuBar entry editMenu |
@@ -198,25 +202,25 @@ void Gutenbrowser::initMenuBar() | |||
198 | menubar->insertItem("File", fileMenu); | 202 | menubar->insertItem("File", fileMenu); |
199 | menubar->insertItem("Page", editMenu); | 203 | menubar->insertItem("Page", editMenu); |
200 | menubar->insertItem("Options", optionsMenu); | 204 | menubar->insertItem("Options", optionsMenu); |
201 | // menubar->insertItem("More Info", donateMenu); | 205 | // menubar->insertItem("More Info", donateMenu); |
202 | 206 | ||
203 | menu->addWidget( menubar,0); | 207 | menu->addWidget( menubar,0); |
204 | 208 | ||
205 | topLayout->addLayout( menu, 0); | 209 | topLayout->addLayout( menu, 0); |
206 | } | 210 | } |
207 | 211 | ||
208 | void Gutenbrowser::initButtonBar() | 212 | void Gutenbrowser::initButtonBar() |
209 | { | 213 | { |
210 | //qDebug("Starting buttonbar init."); | 214 | //odebug << "Starting buttonbar init." << oendl; |
211 | 215 | ||
212 | OpenButton = new QPushButton( this, "OpenButton" ); | 216 | OpenButton = new QPushButton( this, "OpenButton" ); |
213 | OpenButton->setFocusPolicy( QWidget::TabFocus ); | 217 | OpenButton->setFocusPolicy( QWidget::TabFocus ); |
214 | 218 | ||
215 | LibraryButton = new QPushButton( this, "LibraryButton" ); | 219 | LibraryButton = new QPushButton( this, "LibraryButton" ); |
216 | LibraryButton->setFocusPolicy( QWidget::TabFocus ); | 220 | LibraryButton->setFocusPolicy( QWidget::TabFocus ); |
217 | 221 | ||
218 | BackButton = new QPushButton( this, "BackButton" ); | 222 | BackButton = new QPushButton( this, "BackButton" ); |
219 | BackButton->setFocusPolicy( QWidget::TabFocus ); | 223 | BackButton->setFocusPolicy( QWidget::TabFocus ); |
220 | BackButton->setAutoRepeat(TRUE); | 224 | BackButton->setAutoRepeat(TRUE); |
221 | 225 | ||
222 | ForwardButton = new QPushButton( this, "ForwardButton" ); | 226 | ForwardButton = new QPushButton( this, "ForwardButton" ); |
@@ -232,25 +236,25 @@ void Gutenbrowser::initButtonBar() | |||
232 | lastBmkButton = new MenuButton( this, "lastBmkButton" ); | 236 | lastBmkButton = new MenuButton( this, "lastBmkButton" ); |
233 | lastBmkButton->setFocusPolicy( QWidget::TabFocus ); | 237 | lastBmkButton->setFocusPolicy( QWidget::TabFocus ); |
234 | 238 | ||
235 | bookmarksMenu = new QPopupMenu(); | 239 | bookmarksMenu = new QPopupMenu(); |
236 | bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) )); | 240 | bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) )); |
237 | 241 | ||
238 | lastBmkButton->setPopup(bookmarksMenu); | 242 | lastBmkButton->setPopup(bookmarksMenu); |
239 | 243 | ||
240 | dictionaryButton = new QPushButton( this, "dictionaryButton" ); | 244 | dictionaryButton = new QPushButton( this, "dictionaryButton" ); |
241 | dictionaryButton->setFocusPolicy( QWidget::TabFocus ); | 245 | dictionaryButton->setFocusPolicy( QWidget::TabFocus ); |
242 | 246 | ||
243 | InfoBar = new QPushButton( this, "Info_Bar" ); | 247 | InfoBar = new QPushButton( this, "Info_Bar" ); |
244 | // qDebug("Infobar"); | 248 | // odebug << "Infobar" << oendl; |
245 | // if(!useSplitter) { | 249 | // if(!useSplitter) { |
246 | 250 | ||
247 | buttonsHidden=FALSE; | 251 | buttonsHidden=FALSE; |
248 | buttons2->setSpacing(2); | 252 | buttons2->setSpacing(2); |
249 | buttons2->addWidget(OpenButton, 0, AlignCenter); | 253 | buttons2->addWidget(OpenButton, 0, AlignCenter); |
250 | buttons2->addWidget(LibraryButton, 0, AlignCenter); | 254 | buttons2->addWidget(LibraryButton, 0, AlignCenter); |
251 | buttons2->addWidget(BackButton, 0, AlignCenter); | 255 | buttons2->addWidget(BackButton, 0, AlignCenter); |
252 | buttons2->addWidget(ForwardButton, 0, AlignCenter); | 256 | buttons2->addWidget(ForwardButton, 0, AlignCenter); |
253 | buttons2->addWidget(SearchButton, 0, AlignCenter); | 257 | buttons2->addWidget(SearchButton, 0, AlignCenter); |
254 | buttons2->addWidget(setBookmarkButton, 0, AlignCenter); | 258 | buttons2->addWidget(setBookmarkButton, 0, AlignCenter); |
255 | buttons2->addWidget(lastBmkButton, 0, AlignCenter); | 259 | buttons2->addWidget(lastBmkButton, 0, AlignCenter); |
256 | buttons2->addWidget(dictionaryButton, 0, AlignCenter); | 260 | buttons2->addWidget(dictionaryButton, 0, AlignCenter); |
@@ -284,25 +288,25 @@ void Gutenbrowser::initView() | |||
284 | QFont defaultFont=Lview->font(); | 288 | QFont defaultFont=Lview->font(); |
285 | QFontInfo fontInfo(defaultFont); | 289 | QFontInfo fontInfo(defaultFont); |
286 | 290 | ||
287 | QString family = cfg.readEntry("Family", fontInfo.family()); | 291 | QString family = cfg.readEntry("Family", fontInfo.family()); |
288 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); | 292 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); |
289 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); | 293 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); |
290 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); | 294 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); |
291 | 295 | ||
292 | defaultFont = fdb.font(family,style,i_size,charSet); | 296 | defaultFont = fdb.font(family,style,i_size,charSet); |
293 | 297 | ||
294 | QString italic=cfg.readEntry("Italic","FALSE"); | 298 | QString italic=cfg.readEntry("Italic","FALSE"); |
295 | if(italic=="TRUE") { | 299 | if(italic=="TRUE") { |
296 | qDebug("Set Italic font"); | 300 | odebug << "Set Italic font" << oendl; |
297 | defaultFont = fdb.font(family,"Regular",i_size,charSet); //workaround | 301 | defaultFont = fdb.font(family,"Regular",i_size,charSet); //workaround |
298 | defaultFont.setItalic(TRUE); | 302 | defaultFont.setItalic(TRUE); |
299 | } | 303 | } |
300 | 304 | ||
301 | Lview->setFont( defaultFont); | 305 | Lview->setFont( defaultFont); |
302 | update(); | 306 | update(); |
303 | 307 | ||
304 | cfg.setGroup("General"); | 308 | cfg.setGroup("General"); |
305 | 309 | ||
306 | if( cfg.readBoolEntry("WordWrap", 1)) { | 310 | if( cfg.readBoolEntry("WordWrap", 1)) { |
307 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); | 311 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); |
308 | useWrap=true; | 312 | useWrap=true; |
diff --git a/noncore/apps/opie-gutenbrowser/helpme.cpp b/noncore/apps/opie-gutenbrowser/helpme.cpp index 6a9b8c0..53e0236 100644 --- a/noncore/apps/opie-gutenbrowser/helpme.cpp +++ b/noncore/apps/opie-gutenbrowser/helpme.cpp | |||
@@ -5,33 +5,38 @@ | |||
5 | begin : Sat Dec 4 1999 | 5 | begin : Sat Dec 4 1999 |
6 | copyright : (C) 2000 -2004 by llornkcor | 6 | copyright : (C) 2000 -2004 by llornkcor |
7 | email : ljp@llornkcor.com | 7 | email : ljp@llornkcor.com |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | #include <qpe/qcopenvelope_qws.h> | ||
18 | #include <qpe/qpeapplication.h> | ||
19 | 17 | ||
20 | #include "helpme.h" | 18 | #include "helpme.h" |
21 | #include "helpwindow.h" | 19 | #include "helpwindow.h" |
22 | 20 | ||
21 | /* OPIE */ | ||
22 | #include <qpe/qcopenvelope_qws.h> | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | #include <opie2/odebug.h> | ||
25 | |||
26 | /* QT */ | ||
23 | #include <qprogressdialog.h> | 27 | #include <qprogressdialog.h> |
24 | #include <qlayout.h> | 28 | #include <qlayout.h> |
25 | 29 | ||
30 | /* STD */ | ||
26 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
27 | #include <unistd.h> | 32 | #include <unistd.h> |
28 | 33 | ||
29 | HelpMe::HelpMe(QWidget *parent, QString name ) : QDialog(parent,name) | 34 | HelpMe::HelpMe(QWidget *parent, QString name ) : QDialog(parent,name) |
30 | { | 35 | { |
31 | local_library = ( QDir::homeDirPath ())+"/Applications/gutenbrowser/"; | 36 | local_library = ( QDir::homeDirPath ())+"/Applications/gutenbrowser/"; |
32 | setCaption(tr("Gutenbrowser About " VERSION)); | 37 | setCaption(tr("Gutenbrowser About " VERSION)); |
33 | 38 | ||
34 | QGridLayout *layout = new QGridLayout( this ); | 39 | QGridLayout *layout = new QGridLayout( this ); |
35 | layout->setSpacing( 4 ); | 40 | layout->setSpacing( 4 ); |
36 | layout->setMargin( 4 ); | 41 | layout->setMargin( 4 ); |
37 | 42 | ||
@@ -102,21 +107,21 @@ void HelpMe::goToURL3() | |||
102 | void HelpMe::goGetit( QString url) | 107 | void HelpMe::goGetit( QString url) |
103 | { | 108 | { |
104 | HelpWindow *help = new HelpWindow( url, ".", 0, "gutenbrowser"); | 109 | HelpWindow *help = new HelpWindow( url, ".", 0, "gutenbrowser"); |
105 | help->setCaption("Qt Example - Helpviewer"); | 110 | help->setCaption("Qt Example - Helpviewer"); |
106 | help->showMaximized(); | 111 | help->showMaximized(); |
107 | help->show(); | 112 | help->show(); |
108 | } | 113 | } |
109 | 114 | ||
110 | void HelpMe::help() | 115 | void HelpMe::help() |
111 | { | 116 | { |
112 | QString msg ; | 117 | QString msg ; |
113 | msg=QPEApplication::qpeDir()+"help/html/gutenbrowser-index.html"; // or where ever this ends up to be | 118 | msg=QPEApplication::qpeDir()+"help/html/gutenbrowser-index.html"; // or where ever this ends up to be |
114 | qDebug(msg); | 119 | odebug << msg << oendl; |
115 | QString url = "file://"+msg; | 120 | QString url = "file://"+msg; |
116 | goGetit( url); | 121 | goGetit( url); |
117 | 122 | ||
118 | // QCopEnvelope e("QPE/Application/helpbrowser", "setDocument(QString)" ); | 123 | // QCopEnvelope e("QPE/Application/helpbrowser", "setDocument(QString)" ); |
119 | // e << msg; | 124 | // e << msg; |
120 | 125 | ||
121 | // goGetit( msg); | 126 | // goGetit( msg); |
122 | } | 127 | } |
diff --git a/noncore/apps/opie-gutenbrowser/main.cpp b/noncore/apps/opie-gutenbrowser/main.cpp index 5c3348c..71c836d 100644 --- a/noncore/apps/opie-gutenbrowser/main.cpp +++ b/noncore/apps/opie-gutenbrowser/main.cpp | |||
@@ -28,25 +28,25 @@ OPIE_EXPORT_APP( OApplicationFactory<Gutenbrowser> ) | |||
28 | // int main(int argc, char *argv[]){ | 28 | // int main(int argc, char *argv[]){ |
29 | // QPEApplication a(argc, argv); | 29 | // QPEApplication a(argc, argv); |
30 | // // char * psz; | 30 | // // char * psz; |
31 | // // if (argc > 1) { | 31 | // // if (argc > 1) { |
32 | // // for( int i=0; i < argc; i++) { | 32 | // // for( int i=0; i < argc; i++) { |
33 | // // psz = argv[i]; | 33 | // // psz = argv[i]; |
34 | // // if( psz[0] == '-' || psz[0] == '/' ) { | 34 | // // if( psz[0] == '-' || psz[0] == '/' ) { |
35 | // // // The next character is the option. | 35 | // // // The next character is the option. |
36 | // // switch( psz[1] ) | 36 | // // switch( psz[1] ) |
37 | // // { | 37 | // // { |
38 | // // case 'v': // help | 38 | // // case 'v': // help |
39 | // // printf("Gutenbrowser: "VERSION"\n"); | 39 | // // printf("Gutenbrowser: "VERSION"\n"); |
40 | // // // qDebug("Gutenbrowser: "VERSION); | 40 | // // // odebug << "Gutenbrowser: "VERSION << oendl; |
41 | // // // return 0; | 41 | // // // return 0; |
42 | // // break; | 42 | // // break; |
43 | // // case 't': // current time 19:34:20 04/03/00 | 43 | // // case 't': // current time 19:34:20 04/03/00 |
44 | // // // return 0; | 44 | // // // return 0; |
45 | // // break; | 45 | // // break; |
46 | // // case 'f': // | 46 | // // case 'f': // |
47 | // // // file_Name=argv[i+1]; | 47 | // // // file_Name=argv[i+1]; |
48 | // // break; | 48 | // // break; |
49 | // // } | 49 | // // } |
50 | // // } | 50 | // // } |
51 | // // } | 51 | // // } |
52 | // // } | 52 | // // } |
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp index bd44ce6..0267416 100644 --- a/noncore/apps/opie-gutenbrowser/openetext.cpp +++ b/noncore/apps/opie-gutenbrowser/openetext.cpp | |||
@@ -9,38 +9,41 @@ | |||
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | 14 | ||
15 | #include "gutenbrowser.h" | 15 | #include "gutenbrowser.h" |
16 | #include "openetext.h" | 16 | #include "openetext.h" |
17 | #include "editTitle.h" | 17 | #include "editTitle.h" |
18 | 18 | ||
19 | /* OPIE */ | 19 | /* OPIE */ |
20 | #include <opie2/ofiledialog.h> | 20 | #include <opie2/ofiledialog.h> |
21 | #include <opie2/odebug.h> | ||
21 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
22 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
23 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
24 | using namespace Opie::Ui; | 25 | using namespace Opie::Ui; |
25 | 26 | ||
26 | #include <stdlib.h> | 27 | /* QT */ |
27 | #include <qtextstream.h> | 28 | #include <qtextstream.h> |
28 | #include <qfileinfo.h> | 29 | #include <qfileinfo.h> |
29 | 30 | ||
31 | /* STD */ | ||
30 | #if defined(_WS_WIN_) | 32 | #if defined(_WS_WIN_) |
31 | #include <windows.h> | 33 | #include <windows.h> |
32 | #else | 34 | #else |
33 | #include <unistd.h> | 35 | #include <unistd.h> |
34 | #include "sys/stat.h" | 36 | #include <stdlib.h> |
37 | #include <sys/stat.h> | ||
35 | #endif | 38 | #endif |
36 | 39 | ||
37 | OpenEtext::OpenEtext(QWidget *parent, QString name) : QDialog(parent,name,true) | 40 | OpenEtext::OpenEtext(QWidget *parent, QString name) : QDialog(parent,name,true) |
38 | { | 41 | { |
39 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 42 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
40 | local_index=local_library+"GUTINDEX.ALL"; | 43 | local_index=local_library+"GUTINDEX.ALL"; |
41 | initDialog(); | 44 | initDialog(); |
42 | connect( QListBox_1, SIGNAL(selected ( int)),this, SLOT(select_title(int)) ); | 45 | connect( QListBox_1, SIGNAL(selected ( int)),this, SLOT(select_title(int)) ); |
43 | 46 | ||
44 | getTitles(); | 47 | getTitles(); |
45 | } | 48 | } |
46 | 49 | ||
@@ -125,25 +128,25 @@ OpenFileButton->setDown(TRUE); | |||
125 | map.insert(tr("All"), QStringList() ); | 128 | map.insert(tr("All"), QStringList() ); |
126 | QStringList text; | 129 | QStringList text; |
127 | text << "text/*"; | 130 | text << "text/*"; |
128 | map.insert(tr("Text"), text ); | 131 | map.insert(tr("Text"), text ); |
129 | text << "*"; | 132 | text << "*"; |
130 | map.insert(tr("All"), text ); | 133 | map.insert(tr("All"), text ); |
131 | 134 | ||
132 | QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map); | 135 | QString str = OFileDialog::getOpenFileName( 2, dir , QString::null, map); |
133 | 136 | ||
134 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) { | 137 | if( !str.isEmpty() && QFile(str).exists() && !QFileInfo(str).isDir() ) { |
135 | filer = str; | 138 | filer = str; |
136 | 139 | ||
137 | qDebug("Open file: "+str); | 140 | odebug << "Open file: "+str << oendl; |
138 | 141 | ||
139 | // QStringList::ConstIterator f; | 142 | // QStringList::ConstIterator f; |
140 | // QString fileTemp; | 143 | // QString fileTemp; |
141 | // for ( f = fileList.begin(); f != fileList.end(); f++ ) { | 144 | // for ( f = fileList.begin(); f != fileList.end(); f++ ) { |
142 | // fileTemp = *f; | 145 | // fileTemp = *f; |
143 | // fileTemp.right( fileTemp.length()-5); | 146 | // fileTemp.right( fileTemp.length()-5); |
144 | // fileName = fileTemp; | 147 | // fileName = fileTemp; |
145 | // if( !fileName.isEmpty() ){ | 148 | // if( !fileName.isEmpty() ){ |
146 | // filer = fileName; | 149 | // filer = fileName; |
147 | // } else { //filename is empty | 150 | // } else { //filename is empty |
148 | // // QString sMsg; | 151 | // // QString sMsg; |
149 | // // sMsg = "Error opening library filelist "+fileName; | 152 | // // sMsg = "Error opening library filelist "+fileName; |
@@ -155,154 +158,154 @@ OpenFileButton->setDown(TRUE); | |||
155 | || filer.right(4) == ".ETX" | 158 | || filer.right(4) == ".ETX" |
156 | || filer.right(4) == ".etx" | 159 | || filer.right(4) == ".etx" |
157 | || filer.right(4) == ".ETX" | 160 | || filer.right(4) == ".ETX" |
158 | || filer.right(4) == ".zip" | 161 | || filer.right(4) == ".zip" |
159 | || filer.right(4) == ".ZIP" ) { | 162 | || filer.right(4) == ".ZIP" ) { |
160 | QFileInfo zipFile( filer); | 163 | QFileInfo zipFile( filer); |
161 | QString s_fileName = zipFile.fileName(); | 164 | QString s_fileName = zipFile.fileName(); |
162 | QString cmd; | 165 | QString cmd; |
163 | 166 | ||
164 | if( s_fileName.right(4) == ".zip") { // unzip that sucker.... | 167 | if( s_fileName.right(4) == ".zip") { // unzip that sucker.... |
165 | s_fileName = s_fileName.left( s_fileName.length() - 4); | 168 | s_fileName = s_fileName.left( s_fileName.length() - 4); |
166 | if( chdir((const char*)local_library.latin1())!=0) | 169 | if( chdir((const char*)local_library.latin1())!=0) |
167 | qDebug("chdir failed.");// QString cmd = "gunzip -d " + filer + " -d " + local_library; | 170 | odebug << "chdir failed." << oendl; // QString cmd = "gunzip -d " + filer + " -d " + local_library; |
168 | cmd = "gunzip -S .zip " + filer; | 171 | cmd = "gunzip -S .zip " + filer; |
169 | fileName = local_library + s_fileName + ".txt"; | 172 | fileName = local_library + s_fileName + ".txt"; |
170 | system( cmd); | 173 | system( cmd); |
171 | } | 174 | } |
172 | // this renames the .txt to .etx!! | 175 | // this renames the .txt to .etx!! |
173 | else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ { | 176 | else /*if( s_fileName.right(4) == ".txt" || if( s_fileName.right(4) == ".TXT"))*/ { |
174 | // qDebug("Filename is "+fileName); | 177 | // odebug << "Filename is "+fileName << oendl; |
175 | s_fileName = fileName; | 178 | s_fileName = fileName; |
176 | s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx"); | 179 | s_fileName.replace( s_fileName.length()-3,3,"gtn");// s_fileName.replace( s_fileName.length()-3,3,"etx"); |
177 | rename(fileName.latin1(),s_fileName.latin1()); | 180 | rename(fileName.latin1(),s_fileName.latin1()); |
178 | fileName = s_fileName; | 181 | fileName = s_fileName; |
179 | // qDebug("Filename is now "+fileName); | 182 | // odebug << "Filename is now "+fileName << oendl; |
180 | } | 183 | } |
181 | } else | 184 | } else |
182 | fileName = str; | 185 | fileName = str; |
183 | 186 | ||
184 | FindTitle(fileName); | 187 | FindTitle(fileName); |
185 | 188 | ||
186 | QFileInfo fi( fileName); | 189 | QFileInfo fi( fileName); |
187 | name_file = fi.fileName(); | 190 | name_file = fi.fileName(); |
188 | name_file = name_file.left(name_file.length() - 4); | 191 | name_file = name_file.left(name_file.length() - 4); |
189 | 192 | ||
190 | qDebug("Setting doclink"); | 193 | odebug << "Setting doclink" << oendl; |
191 | DocLnk lnk; | 194 | DocLnk lnk; |
192 | qDebug("name is " + name_file); | 195 | odebug << "name is " + name_file << oendl; |
193 | lnk.setName(name_file); //sets file name | 196 | lnk.setName(name_file); //sets file name |
194 | qDebug("Title is "+title); | 197 | odebug << "Title is "+title << oendl; |
195 | lnk.setComment(title); | 198 | lnk.setComment(title); |
196 | 199 | ||
197 | QListBox_1->clear(); | 200 | QListBox_1->clear(); |
198 | getTitles(); | 201 | getTitles(); |
199 | qDebug("Filename is "+fileName); | 202 | odebug << "Filename is "+fileName << oendl; |
200 | lnk.setFile(fileName); //sets File property | 203 | lnk.setFile(fileName); //sets File property |
201 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D | 204 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D |
202 | lnk.setExec(fileName); | 205 | lnk.setExec(fileName); |
203 | lnk.setIcon("gutenbrowser/Gutenbrowser"); | 206 | lnk.setIcon("gutenbrowser/Gutenbrowser"); |
204 | if(!lnk.writeLink()) | 207 | if(!lnk.writeLink()) |
205 | qDebug("Writing doclink did not work"); | 208 | odebug << "Writing doclink did not work" << oendl; |
206 | 209 | ||
207 | } // end of for each file name.... | 210 | } // end of for each file name.... |
208 | OpenFileButton->setDown(FALSE); | 211 | OpenFileButton->setDown(FALSE); |
209 | } | 212 | } |
210 | 213 | ||
211 | /* | 214 | /* |
212 | find the title in the config file */ | 215 | find the title in the config file */ |
213 | bool OpenEtext::FindTitle( QString filename) | 216 | bool OpenEtext::FindTitle( QString filename) |
214 | { | 217 | { |
215 | Config config("Gutenbrowser"); | 218 | Config config("Gutenbrowser"); |
216 | config.setGroup( "Files" ); | 219 | config.setGroup( "Files" ); |
217 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); | 220 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0"); |
218 | int i_numofFiles = s_numofFiles.toInt(); | 221 | int i_numofFiles = s_numofFiles.toInt(); |
219 | 222 | ||
220 | QFileInfo fi(filename); | 223 | QFileInfo fi(filename); |
221 | name = fi.fileName(); | 224 | name = fi.fileName(); |
222 | qDebug("filename to open is " + name); | 225 | odebug << "filename to open is " + name << oendl; |
223 | QFile indexLib( filename); | 226 | QFile indexLib( filename); |
224 | bool findCheck = FALSE; | 227 | bool findCheck = FALSE; |
225 | // int Titlenumber=0; | 228 | // int Titlenumber=0; |
226 | 229 | ||
227 | if ( indexLib.open( IO_ReadOnly) ) { | 230 | if ( indexLib.open( IO_ReadOnly) ) { |
228 | qDebug("file opened successfully"); | 231 | odebug << "file opened successfully" << oendl; |
229 | QTextStream indexStream( &indexLib ); | 232 | QTextStream indexStream( &indexLib ); |
230 | QString target = "Project Gutenberg Etext of"; | 233 | QString target = "Project Gutenberg Etext of"; |
231 | QString target2 = "Project Gutenberg Etext"; | 234 | QString target2 = "Project Gutenberg Etext"; |
232 | QString target3 = "Project Gutenberg's Etext of"; | 235 | QString target3 = "Project Gutenberg's Etext of"; |
233 | QString target4 = "Project Gutenberg's Etext"; | 236 | QString target4 = "Project Gutenberg's Etext"; |
234 | QString indexLine; | 237 | QString indexLine; |
235 | while ( !indexStream.eof() ) { | 238 | while ( !indexStream.eof() ) { |
236 | // until end of file.. | 239 | // until end of file.. |
237 | indexLine = indexStream.readLine(); | 240 | indexLine = indexStream.readLine(); |
238 | if( indexLine.find(target, 0, TRUE) > -1 && !findCheck) {findCheck = TRUE; | 241 | if( indexLine.find(target, 0, TRUE) > -1 && !findCheck) {findCheck = TRUE; |
239 | title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE)); | 242 | title = indexLine.mid( indexLine.find(target, 0, TRUE) + (target.length()) , indexLine.find("\r", 0, TRUE)); |
240 | title = title.left( title.find( "*",0, TRUE)); | 243 | title = title.left( title.find( "*",0, TRUE)); |
241 | title = title.stripWhiteSpace (); | 244 | title = title.stripWhiteSpace (); |
242 | // qDebug("Found the title 1 and it is %s", title.latin1()); | 245 | // odebug << "Found the title 1 and it is " << title << "" << oendl; |
243 | // QListBox_1->insertItem ( title); | 246 | // QListBox_1->insertItem ( title); |
244 | } | 247 | } |
245 | if( indexLine.find( target2, 0, TRUE) > -1 && !findCheck) { | 248 | if( indexLine.find( target2, 0, TRUE) > -1 && !findCheck) { |
246 | findCheck = TRUE; | 249 | findCheck = TRUE; |
247 | title = indexLine.mid( indexLine.find( target2, 0, TRUE ) + ( target2.length()) , indexLine.find("\r", 0, TRUE) ); | 250 | title = indexLine.mid( indexLine.find( target2, 0, TRUE ) + ( target2.length()) , indexLine.find("\r", 0, TRUE) ); |
248 | title = title.left( title.find( "*",0, TRUE)); | 251 | title = title.left( title.find( "*",0, TRUE)); |
249 | title = title.stripWhiteSpace (); | 252 | title = title.stripWhiteSpace (); |
250 | // qDebug("Found the title 2 and it is %s", title.latin1()); | 253 | // odebug << "Found the title 2 and it is " << title << "" << oendl; |
251 | // QListBox_1->insertItem ( title); | 254 | // QListBox_1->insertItem ( title); |
252 | } | 255 | } |
253 | if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) { | 256 | if( indexLine.find( target3, 0, TRUE) > -1 && !findCheck) { |
254 | findCheck = TRUE; | 257 | findCheck = TRUE; |
255 | title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE)); | 258 | title = indexLine.mid( indexLine.find( target3, 0, TRUE) + ( target3.length()) , indexLine.find("\r", 0, TRUE)); |
256 | title = title.left( title.find( "*",0, TRUE)); | 259 | title = title.left( title.find( "*",0, TRUE)); |
257 | title = title.stripWhiteSpace (); | 260 | title = title.stripWhiteSpace (); |
258 | // qDebug("Found the title 3 and it is %s", title.latin1()); | 261 | // odebug << "Found the title 3 and it is " << title << "" << oendl; |
259 | } | 262 | } |
260 | if( indexLine.find( target4, 0, TRUE) > -1 && !findCheck) { | 263 | if( indexLine.find( target4, 0, TRUE) > -1 && !findCheck) { |
261 | findCheck = TRUE; | 264 | findCheck = TRUE; |
262 | title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE)); | 265 | title = indexLine.mid( indexLine.find( target4, 0, TRUE) + ( target4.length()) , indexLine.find("\r", 0, TRUE)); |
263 | title = title.left( title.find( "*",0, TRUE)); | 266 | title = title.left( title.find( "*",0, TRUE)); |
264 | title = title.stripWhiteSpace (); | 267 | title = title.stripWhiteSpace (); |
265 | // qDebug("Found the title 4 and it is %s", title.latin1()); | 268 | // odebug << "Found the title 4 and it is " << title << "" << oendl; |
266 | } | 269 | } |
267 | } //endof file | 270 | } //endof file |
268 | indexLib.close(); | 271 | indexLib.close(); |
269 | 272 | ||
270 | if( !findCheck || title.length() < 2) { | 273 | if( !findCheck || title.length() < 2) { |
271 | qDebug("Trying hard to find title from GUTINDEX.ALL"); | 274 | odebug << "Trying hard to find title from GUTINDEX.ALL" << oendl; |
272 | title = titleFromLibrary( filename); | 275 | title = titleFromLibrary( filename); |
273 | findCheck = TRUE; | 276 | findCheck = TRUE; |
274 | } | 277 | } |
275 | 278 | ||
276 | if ( checkConf() == false && findCheck == TRUE) { | 279 | if ( checkConf() == false && findCheck == TRUE) { |
277 | 280 | ||
278 | config.setGroup( "Files"); | 281 | config.setGroup( "Files"); |
279 | config.writeEntry("NumberOfFiles",i_numofFiles + 1 ); | 282 | config.writeEntry("NumberOfFiles",i_numofFiles + 1 ); |
280 | QString interger; | 283 | QString interger; |
281 | interger.setNum( i_numofFiles +1); | 284 | interger.setNum( i_numofFiles +1); |
282 | config.writeEntry(interger, filename); | 285 | config.writeEntry(interger, filename); |
283 | config.setGroup( "Titles" ); | 286 | config.setGroup( "Titles" ); |
284 | for (int i = 1; i <= i_numofFiles; i++) { //find dup titles in config file | 287 | for (int i = 1; i <= i_numofFiles; i++) { //find dup titles in config file |
285 | QString temp; | 288 | QString temp; |
286 | temp.setNum(i); | 289 | temp.setNum(i); |
287 | config.setGroup( "Files" ); | 290 | config.setGroup( "Files" ); |
288 | QString ramble = config.readEntry(temp, "" ); | 291 | QString ramble = config.readEntry(temp, "" ); |
289 | config.setGroup( "Titles" ); | 292 | config.setGroup( "Titles" ); |
290 | QString title1 = config.readEntry(ramble, ""); | 293 | QString title1 = config.readEntry(ramble, ""); |
291 | if(title1==title) | 294 | if(title1==title) |
292 | title+="1"; | 295 | title+="1"; |
293 | i= i_numofFiles+1; | 296 | i= i_numofFiles+1; |
294 | } | 297 | } |
295 | if(title.length()<3) { | 298 | if(title.length()<3) { |
296 | // qDebug("title is empty"); | 299 | // odebug << "title is empty" << oendl; |
297 | title="Unknown"; | 300 | title="Unknown"; |
298 | } | 301 | } |
299 | config.writeEntry( filename,title); | 302 | config.writeEntry( filename,title); |
300 | } | 303 | } |
301 | } else { | 304 | } else { |
302 | QString sMsg; | 305 | QString sMsg; |
303 | sMsg = "Error opening library file: "+filename; | 306 | sMsg = "Error opening library file: "+filename; |
304 | printf( sMsg+"\n"); | 307 | printf( sMsg+"\n"); |
305 | } | 308 | } |
306 | return true; | 309 | return true; |
307 | } | 310 | } |
308 | 311 | ||
@@ -334,31 +337,31 @@ QString OpenEtext::titleFromLibrary( QString fileName) | |||
334 | // file opened successfully | 337 | // file opened successfully |
335 | QTextStream indexStream( &indexLib ); | 338 | QTextStream indexStream( &indexLib ); |
336 | QString indexLine; | 339 | QString indexLine; |
337 | bool findCheck = FALSE; | 340 | bool findCheck = FALSE; |
338 | while ( !indexStream.atEnd() ) { // until end of file.. | 341 | while ( !indexStream.atEnd() ) { // until end of file.. |
339 | indexLine = indexStream.readLine(); | 342 | indexLine = indexStream.readLine(); |
340 | 343 | ||
341 | if( indexLine.find( target,0,FALSE) > 0 ) { | 344 | if( indexLine.find( target,0,FALSE) > 0 ) { |
342 | findCheck = TRUE; | 345 | findCheck = TRUE; |
343 | title = indexLine.mid( 9, 50); | 346 | title = indexLine.mid( 9, 50); |
344 | // title = indexLine.mid( 26, indexLine.length() ); | 347 | // title = indexLine.mid( 26, indexLine.length() ); |
345 | title = title.stripWhiteSpace (); | 348 | title = title.stripWhiteSpace (); |
346 | // qDebug("Finally Found the title and it is\n %s", title.latin1()); | 349 | // odebug << "Finally Found the title and it is\n " << title << "" << oendl; |
347 | // QListBox_1->insertItem ( title); | 350 | // QListBox_1->insertItem ( title); |
348 | } | 351 | } |
349 | } //end while loop | 352 | } //end while loop |
350 | } | 353 | } |
351 | else | 354 | else |
352 | qDebug("Error opening library index "+ local_index); | 355 | odebug << "Error opening library index "+ local_index << oendl; |
353 | return title; | 356 | return title; |
354 | } | 357 | } |
355 | 358 | ||
356 | bool OpenEtext::checkConf() | 359 | bool OpenEtext::checkConf() |
357 | { | 360 | { |
358 | QString file = fileName; | 361 | QString file = fileName; |
359 | Config config("Gutenbrowser"); | 362 | Config config("Gutenbrowser"); |
360 | config.setGroup( "Files" ); | 363 | config.setGroup( "Files" ); |
361 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 364 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
362 | int i_numofFiles = s_numofFiles.toInt(); | 365 | int i_numofFiles = s_numofFiles.toInt(); |
363 | 366 | ||
364 | for (int i = 1; i <= i_numofFiles; i++) { | 367 | for (int i = 1; i <= i_numofFiles; i++) { |
@@ -405,25 +408,25 @@ void OpenEtext::removeSelection() | |||
405 | QString fileNum; | 408 | QString fileNum; |
406 | 409 | ||
407 | for (int i = 1; i <= i_numofFiles; i++) { | 410 | for (int i = 1; i <= i_numofFiles; i++) { |
408 | fileNum.setNum(i); | 411 | fileNum.setNum(i); |
409 | config.setGroup( "Files" ); | 412 | config.setGroup( "Files" ); |
410 | 413 | ||
411 | QString s_filename = config.readEntry(fileNum, "" ); | 414 | QString s_filename = config.readEntry(fileNum, "" ); |
412 | config.setGroup( "Titles" ); | 415 | config.setGroup( "Titles" ); |
413 | 416 | ||
414 | QString file_title = config.readEntry( s_filename, ""); | 417 | QString file_title = config.readEntry( s_filename, ""); |
415 | if(title_text == file_title) { | 418 | if(title_text == file_title) { |
416 | rem=i; | 419 | rem=i; |
417 | //qDebug("file title to remove is "+file_title); | 420 | //odebug << "file title to remove is "+file_title << oendl; |
418 | selFile = s_filename; | 421 | selFile = s_filename; |
419 | config.removeEntry( s_filename); //removes file=title | 422 | config.removeEntry( s_filename); //removes file=title |
420 | } | 423 | } |
421 | } | 424 | } |
422 | config.setGroup( "Files" ); | 425 | config.setGroup( "Files" ); |
423 | 426 | ||
424 | for(int fg = rem; fg < i_numofFiles ; fg++ ) { //this rewrites Files number entry | 427 | for(int fg = rem; fg < i_numofFiles ; fg++ ) { //this rewrites Files number entry |
425 | fileNum.setNum(fg); | 428 | fileNum.setNum(fg); |
426 | fileNum2.setNum( fg + 1); | 429 | fileNum2.setNum( fg + 1); |
427 | 430 | ||
428 | QString s_filename2 = config.readEntry(fileNum2, "" ); | 431 | QString s_filename2 = config.readEntry(fileNum2, "" ); |
429 | 432 | ||
@@ -473,46 +476,46 @@ void OpenEtext::remFile() | |||
473 | /* | 476 | /* |
474 | sorts the list*/ | 477 | sorts the list*/ |
475 | void OpenEtext::scan() { | 478 | void OpenEtext::scan() { |
476 | 479 | ||
477 | QListBox_1->sort(TRUE); | 480 | QListBox_1->sort(TRUE); |
478 | QListBox_1->triggerUpdate(true); | 481 | QListBox_1->triggerUpdate(true); |
479 | } | 482 | } |
480 | 483 | ||
481 | void OpenEtext::editTitle() { | 484 | void OpenEtext::editTitle() { |
482 | 485 | ||
483 | int currentItem=QListBox_1->currentItem(); | 486 | int currentItem=QListBox_1->currentItem(); |
484 | QString title_text = QListBox_1->text( currentItem); | 487 | QString title_text = QListBox_1->text( currentItem); |
485 | //qDebug("Selected "+title_text); | 488 | //odebug << "Selected "+title_text << oendl; |
486 | 489 | ||
487 | Config config("Gutenbrowser"); | 490 | Config config("Gutenbrowser"); |
488 | config.setGroup( "Files" ); | 491 | config.setGroup( "Files" ); |
489 | s_numofFiles = config.readEntry("NumberOfFiles", "0"); | 492 | s_numofFiles = config.readEntry("NumberOfFiles", "0"); |
490 | int i_numofFiles = s_numofFiles.toInt(); | 493 | int i_numofFiles = s_numofFiles.toInt(); |
491 | QString fileNum; | 494 | QString fileNum; |
492 | for (int i = 1; i <= i_numofFiles+1; i++) { | 495 | for (int i = 1; i <= i_numofFiles+1; i++) { |
493 | 496 | ||
494 | fileNum.setNum(i); | 497 | fileNum.setNum(i); |
495 | config.setGroup( "Files" ); | 498 | config.setGroup( "Files" ); |
496 | QString s_filename = config.readEntry(fileNum, "" ); | 499 | QString s_filename = config.readEntry(fileNum, "" ); |
497 | config.setGroup( "Titles" ); | 500 | config.setGroup( "Titles" ); |
498 | QString file_title = config.readEntry( s_filename, ""); | 501 | QString file_title = config.readEntry( s_filename, ""); |
499 | //qDebug("file_title is "+file_title); | 502 | //odebug << "file_title is "+file_title << oendl; |
500 | if(title_text == file_title ) { | 503 | if(title_text == file_title ) { |
501 | selFile = s_filename; | 504 | selFile = s_filename; |
502 | //qDebug("Edit: "+ file_title ); | 505 | //odebug << "Edit: "+ file_title << oendl; |
503 | i=i_numofFiles+1; | 506 | i=i_numofFiles+1; |
504 | Edit_Title *titleEdit; | 507 | Edit_Title *titleEdit; |
505 | titleEdit = new Edit_Title(this,file_title ,TRUE); | 508 | titleEdit = new Edit_Title(this,file_title ,TRUE); |
506 | if(titleEdit->exec() !=0) { | 509 | if(titleEdit->exec() !=0) { |
507 | //qDebug(titleEdit->newTitle); | 510 | //odebug << titleEdit->newTitle << oendl; |
508 | config.writeEntry( s_filename, titleEdit->newTitle); | 511 | config.writeEntry( s_filename, titleEdit->newTitle); |
509 | QListBox_1->removeItem(currentItem); | 512 | QListBox_1->removeItem(currentItem); |
510 | QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), titleEdit->newTitle, currentItem); | 513 | QListBox_1->insertItem ( QPixmap( QPEApplication::qpeDir()+"pics/gutenbrowser/gutenbrowser_sm.png"), titleEdit->newTitle, currentItem); |
511 | } | 514 | } |
512 | } | 515 | } |
513 | } | 516 | } |
514 | 517 | ||
515 | // getTitles(); | 518 | // getTitles(); |
516 | QListBox_1->triggerUpdate(true); | 519 | QListBox_1->triggerUpdate(true); |
517 | } | 520 | } |
518 | 521 | ||
diff --git a/noncore/apps/opie-gutenbrowser/optionsDialog.cpp b/noncore/apps/opie-gutenbrowser/optionsDialog.cpp index bfd9c26..8cc83da 100644 --- a/noncore/apps/opie-gutenbrowser/optionsDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/optionsDialog.cpp | |||
@@ -4,72 +4,80 @@ | |||
4 | begin : Tue Jul 25 2000 | 4 | begin : Tue Jul 25 2000 |
5 | copyright : (C) 2000 -2004 by llornkcor | 5 | copyright : (C) 2000 -2004 by llornkcor |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | #include "optionsDialog.h" | ||
17 | #include <qpe/config.h> | ||
18 | #include "fontDialog.h" | ||
19 | 16 | ||
20 | // #include <unistd.h> | ||
21 | // #include <stdio.h> | ||
22 | // #include <stdlib.h> | ||
23 | 17 | ||
18 | #include "optionsDialog.h" | ||
19 | #include "fontDialog.h" | ||
24 | //#include "ftpsitedlg.h" | 20 | //#include "ftpsitedlg.h" |
25 | //#include "browserDialog.h" | 21 | //#include "browserDialog.h" |
26 | //#define Inherited QDialog | 22 | //#define Inherited QDialog |
23 | |||
24 | /* OPIE */ | ||
25 | #include <opie2/odebug.h> | ||
26 | #include <qpe/config.h> | ||
27 | |||
28 | /* QT */ | ||
27 | #include <qfont.h> | 29 | #include <qfont.h> |
28 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
29 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
30 | #include <qlabel.h> | 32 | #include <qlabel.h> |
31 | #include <qlistbox.h> | 33 | #include <qlistbox.h> |
32 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
33 | #include <qtabwidget.h> | 35 | #include <qtabwidget.h> |
34 | #include <qwidget.h> | 36 | #include <qwidget.h> |
35 | #include <qlayout.h> | 37 | #include <qlayout.h> |
36 | #include <qvariant.h> | 38 | #include <qvariant.h> |
37 | #include <qtooltip.h> | 39 | #include <qtooltip.h> |
38 | #ifndef Q_WS_QWS | 40 | #ifndef Q_WS_QWS |
39 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
40 | #endif | 42 | #endif |
43 | |||
44 | /* STD */ | ||
45 | // #include <unistd.h> | ||
46 | // #include <stdio.h> | ||
47 | // #include <stdlib.h> | ||
48 | |||
41 | /* | 49 | /* |
42 | * The dialog will by default be modeless, unless you set 'modal' to | 50 | * The dialog will by default be modeless, unless you set 'modal' to |
43 | * TRUE to construct a modal dialog. | 51 | * TRUE to construct a modal dialog. |
44 | */ | 52 | */ |
45 | optionsDialog::optionsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 53 | optionsDialog::optionsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
46 | : QDialog( parent, name, modal, fl ) | 54 | : QDialog( parent, name, modal, fl ) |
47 | { | 55 | { |
48 | if ( !name ) | 56 | if ( !name ) |
49 | setName( "optionsDialog" ); | 57 | setName( "optionsDialog" ); |
50 | changedFonts=FALSE; | 58 | changedFonts=FALSE; |
51 | // styleChanged=FALSE; | 59 | // styleChanged=FALSE; |
52 | // connect( this,SIGNAL( aboutToQuit()),SLOT( OnExit()) ); | 60 | // connect( this,SIGNAL( aboutToQuit()),SLOT( OnExit()) ); |
53 | b_qExit=TRUE; | 61 | b_qExit=TRUE; |
54 | initDialog(); | 62 | initDialog(); |
55 | 63 | ||
56 | ftpSiteDlg(); | 64 | ftpSiteDlg(); |
57 | BrowserDlg(); | 65 | BrowserDlg(); |
58 | FontDialog(); | 66 | FontDialog(); |
59 | } | 67 | } |
60 | 68 | ||
61 | optionsDialog::~optionsDialog() | 69 | optionsDialog::~optionsDialog() |
62 | { | 70 | { |
63 | //qDebug("OnExit()"); | 71 | //odebug << "OnExit()" << oendl; |
64 | // writeConfig(); | 72 | // writeConfig(); |
65 | } | 73 | } |
66 | 74 | ||
67 | /// optionsDialog | 75 | /// optionsDialog |
68 | void optionsDialog::doOptions() { | 76 | void optionsDialog::doOptions() { |
69 | 77 | ||
70 | // config.read(); | 78 | // config.read(); |
71 | getConfig(); | 79 | getConfig(); |
72 | } | 80 | } |
73 | 81 | ||
74 | void optionsDialog::getConfig() | 82 | void optionsDialog::getConfig() |
75 | { | 83 | { |
@@ -116,41 +124,41 @@ void optionsDialog::getConfig() | |||
116 | // if( i_style==3) { styleInt=3; ComboBoxStyle->setCurrentItem(3);}//"styleMotif") ); | 124 | // if( i_style==3) { styleInt=3; ComboBoxStyle->setCurrentItem(3);}//"styleMotif") ); |
117 | // if( i_style==4) { styleInt=4; ComboBoxStyle->setCurrentItem(4);}//"styleMotifPlus")); | 125 | // if( i_style==4) { styleInt=4; ComboBoxStyle->setCurrentItem(4);}//"styleMotifPlus")); |
118 | // // if( i_style==5) { styleInt=5; ComboBoxStyle->setCurrentItem(5);}//"styleWood") ); | 126 | // // if( i_style==5) { styleInt=5; ComboBoxStyle->setCurrentItem(5);}//"styleWood") ); |
119 | // if( i_style==6) { styleInt=6; ComboBoxStyle->setCurrentItem(6);}//"styleSgi") ); | 127 | // if( i_style==6) { styleInt=6; ComboBoxStyle->setCurrentItem(6);}//"styleSgi") ); |
120 | // if( i_style==7) { styleInt=7; ComboBoxStyle->setCurrentItem(7);}//"stylePlatinumPlus") ); | 128 | // if( i_style==7) { styleInt=7; ComboBoxStyle->setCurrentItem(7);}//"stylePlatinumPlus") ); |
121 | // if( i_style==9){ styleInt=9; ComboBoxStyle->setCurrentItem(9);}//"styleLace")); | 129 | // if( i_style==9){ styleInt=9; ComboBoxStyle->setCurrentItem(9);}//"styleLace")); |
122 | // if( i_style==10){ styleInt=10; ComboBoxStyle->setCurrentItem(10);}//"styleLacePlus")); | 130 | // if( i_style==10){ styleInt=10; ComboBoxStyle->setCurrentItem(10);}//"styleLacePlus")); |
123 | // #endif | 131 | // #endif |
124 | config.setGroup("General"); | 132 | config.setGroup("General"); |
125 | QString qExit=config.readEntry("queryExit","TRUE"); | 133 | QString qExit=config.readEntry("queryExit","TRUE"); |
126 | if(qExit=="TRUE") { | 134 | if(qExit=="TRUE") { |
127 | cb_queryExit->setChecked(TRUE); | 135 | cb_queryExit->setChecked(TRUE); |
128 | qDebug("Config Setting b_qExit=TRUE;"); | 136 | odebug << "Config Setting b_qExit=TRUE;" << oendl; |
129 | b_qExit=TRUE; | 137 | b_qExit=TRUE; |
130 | } else { | 138 | } else { |
131 | cb_queryExit->setChecked(FALSE); | 139 | cb_queryExit->setChecked(FALSE); |
132 | qDebug("ConfigSetting b_qExit=FALSE;"); | 140 | odebug << "ConfigSetting b_qExit=FALSE;" << oendl; |
133 | b_qExit=FALSE; | 141 | b_qExit=FALSE; |
134 | } | 142 | } |
135 | 143 | ||
136 | 144 | ||
137 | useWordWrap_CheckBox->setChecked( config.readBoolEntry("WordWrap", 1)); | 145 | useWordWrap_CheckBox->setChecked( config.readBoolEntry("WordWrap", 1)); |
138 | QString downDir=config.readEntry( "DownloadDirectory",local_library); | 146 | QString downDir=config.readEntry( "DownloadDirectory",local_library); |
139 | downloadDirEdit->setText(downDir); | 147 | downloadDirEdit->setText(downDir); |
140 | } // end getConfig | 148 | } // end getConfig |
141 | 149 | ||
142 | // // void optionsDialog::setStyle( int index) { | 150 | // // void optionsDialog::setStyle( int index) { |
143 | 151 | ||
144 | // // qDebug("Set style%d",index); | 152 | // // odebug << "Set style" << index << "" << oendl; |
145 | // // //int styleInt= index; | 153 | // // //int styleInt= index; |
146 | // // styleChanged=TRUE; | 154 | // // styleChanged=TRUE; |
147 | // // if( ComboBoxStyle->currentItem()==0) styleInt=0;//"styleMetal")); | 155 | // // if( ComboBoxStyle->currentItem()==0) styleInt=0;//"styleMetal")); |
148 | // // if( ComboBoxStyle->currentItem()==1) styleInt=1;//"styleWindows") ); | 156 | // // if( ComboBoxStyle->currentItem()==1) styleInt=1;//"styleWindows") ); |
149 | // // if( ComboBoxStyle->currentItem()==2) styleInt=2;//"stylePlatinum")); | 157 | // // if( ComboBoxStyle->currentItem()==2) styleInt=2;//"stylePlatinum")); |
150 | // // // if( ComboBoxStyle->currentItem()==2) styleInt=2;//"styleCDE") ); | 158 | // // // if( ComboBoxStyle->currentItem()==2) styleInt=2;//"styleCDE") ); |
151 | // // // if( ComboBoxStyle->currentItem()==3) styleInt=3;//"styleMotif") ); | 159 | // // // if( ComboBoxStyle->currentItem()==3) styleInt=3;//"styleMotif") ); |
152 | // // // if( ComboBoxStyle->currentItem()==4) styleInt=4;//"styleMotifPlus")); | 160 | // // // if( ComboBoxStyle->currentItem()==4) styleInt=4;//"styleMotifPlus")); |
153 | // // // // if( ComboBoxStyle->currentItem()==5) styleInt=5;//"styleWood") ); | 161 | // // // // if( ComboBoxStyle->currentItem()==5) styleInt=5;//"styleWood") ); |
154 | // // // if( ComboBoxStyle->currentItem()==6) styleInt=6;//"styleSgi") ); | 162 | // // // if( ComboBoxStyle->currentItem()==6) styleInt=6;//"styleSgi") ); |
155 | // // // if( ComboBoxStyle->currentItem()==7) styleInt=7;//"stylePlatinumPlus") ); | 163 | // // // if( ComboBoxStyle->currentItem()==7) styleInt=7;//"stylePlatinumPlus") ); |
156 | // // // if( ComboBoxStyle->currentItem()==9) styleInt=9;//"styleLace")); | 164 | // // // if( ComboBoxStyle->currentItem()==9) styleInt=9;//"styleLace")); |
@@ -158,45 +166,45 @@ void optionsDialog::getConfig() | |||
158 | // // QString temp; | 166 | // // QString temp; |
159 | // // temp.setNum(styleInt, 10); | 167 | // // temp.setNum(styleInt, 10); |
160 | // // Config config("Gutenbrowser"); | 168 | // // Config config("Gutenbrowser"); |
161 | // // config.setGroup( "StyleIze" ); | 169 | // // config.setGroup( "StyleIze" ); |
162 | // // config.writeEntry( "Style", temp); | 170 | // // config.writeEntry( "Style", temp); |
163 | // // config.write(); | 171 | // // config.write(); |
164 | // // } | 172 | // // } |
165 | 173 | ||
166 | void optionsDialog::slotQueryExit() | 174 | void optionsDialog::slotQueryExit() |
167 | { | 175 | { |
168 | Config config("Gutenbrowser"); | 176 | Config config("Gutenbrowser"); |
169 | config.setGroup("General"); | 177 | config.setGroup("General"); |
170 | qDebug("writing queryExit"); | 178 | odebug << "writing queryExit" << oendl; |
171 | if(cb_queryExit->isChecked()) { | 179 | if(cb_queryExit->isChecked()) { |
172 | b_qExit=TRUE; | 180 | b_qExit=TRUE; |
173 | config.writeEntry("queryExit","TRUE"); | 181 | config.writeEntry("queryExit","TRUE"); |
174 | qDebug("WritingConfig queryExit=TRUE"); | 182 | odebug << "WritingConfig queryExit=TRUE" << oendl; |
175 | } else { | 183 | } else { |
176 | b_qExit=FALSE; | 184 | b_qExit=FALSE; |
177 | config.writeEntry("queryExit","FALSE"); | 185 | config.writeEntry("queryExit","FALSE"); |
178 | qDebug("WritingConfig queryExit=FALSE"); | 186 | odebug << "WritingConfig queryExit=FALSE" << oendl; |
179 | } | 187 | } |
180 | config.write(); | 188 | config.write(); |
181 | } | 189 | } |
182 | 190 | ||
183 | 191 | ||
184 | // void optionsDialog::slotUseSplit() | 192 | // void optionsDialog::slotUseSplit() |
185 | // { | 193 | // { |
186 | 194 | ||
187 | // } | 195 | // } |
188 | 196 | ||
189 | // void optionsDialog::lineEditChanged(const QString &editText) { | 197 | // void optionsDialog::lineEditChanged(const QString &editText) { |
190 | // qDebug(editText); | 198 | // odebug << editText << oendl; |
191 | // } | 199 | // } |
192 | 200 | ||
193 | void optionsDialog::changeFonts() | 201 | void optionsDialog::changeFonts() |
194 | { | 202 | { |
195 | changedFonts=TRUE; | 203 | changedFonts=TRUE; |
196 | } | 204 | } |
197 | 205 | ||
198 | 206 | ||
199 | void optionsDialog::slotWordWrap(bool b) { | 207 | void optionsDialog::slotWordWrap(bool b) { |
200 | 208 | ||
201 | Config config("Gutenbrowser"); | 209 | Config config("Gutenbrowser"); |
202 | config.setGroup("General"); | 210 | config.setGroup("General"); |