summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp1553
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp27
2 files changed, 799 insertions, 781 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 7426e80..549c1d2 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -1,1078 +1,1085 @@
1/*************************************************************************** 1/***************************************************************************
2// LibraryDialog.cpp - description 2// LibraryDialog.cpp - description
3// ------------------- 3// -------------------
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" 16#include "LibraryDialog.h"
17#include "output.h" 17#include "output.h"
18 18
19/* OPIE */ 19/* OPIE */
20#include <qpe/applnk.h> 20#include <qpe/applnk.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/qpedialog.h> 22#include <qpe/qpedialog.h>
23#include <opie2/odebug.h> 23#include <opie2/odebug.h>
24 24
25/* QT */ 25/* QT */
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qmultilineedit.h> 27#include <qmultilineedit.h>
28//#include <qlayout.h> 28//#include <qlayout.h>
29 29
30/* STD */ 30/* STD */
31#include <unistd.h> 31#include <unistd.h>
32#include <stdio.h> 32#include <stdio.h>
33#include <stdlib.h> 33#include <stdlib.h>
34 34
35/* 35/*
36 * 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
37 * TRUE to construct a modal dialog. */ 37 * TRUE to construct a modal dialog. */
38LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal*/, WFlags fl ) 38LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal*/, WFlags fl )
39 : QDialog( parent, name, true/* modal*/, fl ) 39 : QDialog( parent, name, true/* modal*/, fl )
40{ 40{
41 if ( !name ) 41 if ( !name )
42 setName( "LibraryDialog" ); 42 setName( "LibraryDialog" );
43 indexLoaded=false; 43 indexLoaded=false;
44 initDialog(); 44 initDialog();
45 45
46 // this->setMaximumWidth(240); 46 // this->setMaximumWidth(240);
47 47
48 index = "GUTINDEX.ALL"; 48 index = "GUTINDEX.ALL";
49 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; 49 local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
50 local_index = local_library + index; 50 local_index = local_library + index;
51 51
52 QString iniFile ; 52 QString iniFile ;
53 iniFile = QPEApplication::qpeDir()+"etc/gutenbrowser/gutenbrowserrc"; 53 iniFile = QPEApplication::qpeDir()+"etc/gutenbrowser/gutenbrowserrc";
54 54
55 new_index =QPEApplication::qpeDir()+"etc/gutenbrowser/PGWHOLE.TXT"; 55 new_index =QPEApplication::qpeDir()+"etc/gutenbrowser/PGWHOLE.TXT";
56 56
57 old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 57 old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
58 // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 58 // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
59 59
60 // iniFile = local_library+"gutenbrowserrc"; 60 // iniFile = local_library+"gutenbrowserrc";
61 // new_index = local_library + "PGWHOLE.TXT"; 61 // new_index = local_library + "PGWHOLE.TXT";
62 // old_index = local_library + "GUTINDEX.ALL"; 62 // old_index = local_library + "GUTINDEX.ALL";
63 63
64 Config config("Gutenbrowser"); 64 Config config("Gutenbrowser");
65 65
66 config.setGroup( "HttpServer" ); 66 config.setGroup( "HttpServer" );
67 proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); 67 proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
68 68
69 config.setGroup( "FTPsite" ); 69 config.setGroup( "FTPsite" );
70 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); 70 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
71 odebug << "Library Dialog: ftp_host is "+ftp_host << oendl; 71 odebug << "Library Dialog: ftp_host is "+ftp_host << oendl;
72 // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); 72 // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
73 // ftp_host=ftp_host.stripWhiteSpace(); 73 // ftp_host=ftp_host.stripWhiteSpace();
74 ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); 74 ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
75 75
76 i_binary = 0; 76 i_binary = 0;
77 77
78 config.setGroup("SortAuth"); 78 config.setGroup("SortAuth");
79 if( config.readEntry("authSort", "FALSE") == "TRUE") 79 if( config.readEntry("authSort", "FALSE") == "TRUE")
80 authBox->setChecked(TRUE); 80 authBox->setChecked(TRUE);
81 81
82 config.setGroup("General"); 82 config.setGroup("General");
83 downDir =config.readEntry( "DownloadDirectory",local_library); 83 downDir =config.readEntry( "DownloadDirectory",local_library);
84 odebug << "downDir is "+downDir << oendl; 84 odebug << "downDir is "+downDir << oendl;
85 newindexLib.setName( old_index); 85 newindexLib.setName( old_index);
86 indexLib.setName( old_index); 86 indexLib.setName( old_index);
87 87
88 new QPEDialogListener(this); 88 new QPEDialogListener(this);
89 QTimer::singleShot( 1000, this, SLOT( FindLibrary()) ); 89 QTimer::singleShot( 1000, this, SLOT( FindLibrary()) );
90 90
91} 91}
92 92
93LibraryDialog::~LibraryDialog() 93LibraryDialog::~LibraryDialog()
94{ 94{
95// delete QList_Item2; 95// delete QList_Item2;
96// delete QList_Item1; 96// delete QList_Item1;
97// delete QList_Item3; 97// delete QList_Item3;
98// delete QList_Item4; 98// delete QList_Item4;
99// delete QList_Item5; 99// delete QList_Item5;
100 100
101 // saveConfig(); 101 // saveConfig();
102} 102}
103 103
104 /*This groks using PGWHOLE.TXT */ 104 /*This groks using PGWHOLE.TXT */
105void LibraryDialog::Newlibrary() 105void LibraryDialog::Newlibrary()
106{ 106{
107#ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files 107#ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files
108 //odebug << "Opening new library index " << newindexLib << "" << oendl; 108 //odebug << "Opening new library index " << newindexLib << "" << oendl;
109 if ( newindexLib.open( IO_ReadOnly) ) { 109 if ( newindexLib.open( IO_ReadOnly) ) {
110 setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully 110 setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully
111 QTextStream indexStream( &newindexLib ); 111 QTextStream indexStream( &newindexLib );
112 QString indexLine; 112 QString indexLine;
113 while ( !indexStream.atEnd() ) { // until end of file.. 113 while ( !indexStream.atEnd() ) { // until end of file..
114 indexLine = indexStream.readLine(); 114 indexLine = indexStream.readLine();
115 if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { 115 if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) {
116 year = indexLine.mid(4,4); 116 year = indexLine.mid(4,4);
117 year = year.stripWhiteSpace(); 117 year = year.stripWhiteSpace();
118 file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); 118 file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 );
119 file = file.stripWhiteSpace(); 119 file = file.stripWhiteSpace();
120 number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); 120 number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 );
121 if( year.toInt() < 1984) 121 if( year.toInt() < 1984)
122 number = number.left( number.length() -1 ); 122 number = number.left( number.length() -1 );
123 number = number.stripWhiteSpace(); 123 number = number.stripWhiteSpace();
124 title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); 124 title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
125 title = title.stripWhiteSpace(); 125 title = title.stripWhiteSpace();
126 126
127 getAuthor(); // groks author 127 getAuthor(); // groks author
128 author = author.stripWhiteSpace(); 128 author = author.stripWhiteSpace();
129 if (authBox->isChecked()) { // this reverses the first name and last name of the author 129 if (authBox->isChecked()) { // this reverses the first name and last name of the author
130 // odebug << "Sorting last name first" << oendl; 130 // odebug << "Sorting last name first" << oendl;
131 QString lastName, firstName=""; 131 QString lastName, firstName="";
132 int finder=author.findRev( ' ', -1, TRUE); 132 int finder=author.findRev( ' ', -1, TRUE);
133 lastName=author.right( author.length()-finder); 133 lastName=author.right( author.length()-finder);
134 firstName=author.left(finder); 134 firstName=author.left(finder);
135 lastName=lastName.stripWhiteSpace(); 135 lastName=lastName.stripWhiteSpace();
136 firstName=firstName.stripWhiteSpace(); 136 firstName=firstName.stripWhiteSpace();
137 137
138 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names 138 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
139 author=lastName+", "+firstName; 139 author=lastName+", "+firstName;
140 } 140 }
141 141
142 if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { 142 if( !number.isEmpty()
143 143 && (title.find( "reserved",0, FALSE) == -1)
144 // fill string list or something to be able to resort the whole library 144 && (file.find( "]",0, TRUE) == -1)
145 if( author.isEmpty() ) 145 && (title.find( "Audio",0, FALSE) == -1)) {
146 QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); 146
147 else { 147 // fill string list or something to be able to resort the whole library
148 148 if( author.isEmpty() )
149 if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || 149 QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file );
150 (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) 150 else {
151 QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file ); 151
152 152 if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) ||
153 else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || 153 (author.left(1) >= QString("a") && author.left(1) <= QString("f")) )
154 (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) 154 QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file );
155 QList_Item2 = new QListViewItem( ListView2, /*number, */title, author, year, file ); 155
156 156 else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) ||
157 else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || 157 (author.left(1) >= QString("g") && author.left(1) <= QString("m")) )
158 (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) 158 QList_Item2 = new QListViewItem( ListView2, /*number, */title, author, year, file );
159 QList_Item3 = new QListViewItem( ListView3, /*number,*/ title, author, year, file ); 159
160 160 else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) ||
161 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || 161 (author.left(1) >= QString("n") && author.left(1) <= QString("r")) )
162 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) 162 QList_Item3 = new QListViewItem( ListView3, /*number,*/ title, author, year, file );
163 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); 163
164 164 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) ||
165 else 165 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) )
166 QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); 166 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file );
167 } 167
168 } 168 else
169 }// end if 169 QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file );
170 }// end while 170 }
171 newindexLib.close(); 171 }
172 } 172 }// end if
173 }// end while
174 newindexLib.close();
175 }
173#ifndef Q_WS_QWS 176#ifndef Q_WS_QWS
174 setCursor( arrowCursor); 177 setCursor( arrowCursor);
175#endif 178#endif
176#endif 179#endif
177} // end Newlibrary() 180} // end Newlibrary()
178 181
179 182
180void LibraryDialog::Library() 183void LibraryDialog::Library()
181{// old library groking method 184{// old library groking method
182 185
183 ListView1->clear(); 186 ListView1->clear();
184 ListView2->clear(); 187 ListView2->clear();
185 ListView3->clear(); 188 ListView3->clear();
186 ListView4->clear(); 189 ListView4->clear();
187 ListView5->clear(); 190 ListView5->clear();
188 191
189 odebug << "opening GUTINDEX.ALL file" << oendl; 192 odebug << "opening GUTINDEX.ALL file" << oendl;
190 IDontKnowWhy = ""; 193 IDontKnowWhy = "";
191 if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully 194 if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully
192 QTextStream indexStream( &indexLib ); 195 QTextStream indexStream( &indexLib );
193 QString indexLine; 196 QString indexLine;
194 qApp->processEvents(); 197 qApp->processEvents();
195 // int jig; 198 // int jig;
196 while ( !indexStream.eof() ) { 199 while ( !indexStream.eof() ) {
197 200
198 indexLine = indexStream.readLine(); 201 indexLine = indexStream.readLine();
199 if ( indexLine != "") { 202 if ( indexLine != "") {
200 if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { 203 if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) {
201 // month = indexLine.left( 3); 204 // month = indexLine.left( 3);
202 year = indexLine.mid(4,4); 205 year = indexLine.mid(4,4);
203 // title = indexLine.mid( 9, 50); 206 // title = indexLine.mid( 9, 50);
204 file = indexLine.mid(60,12); 207 file = indexLine.mid(60,12);
205 if(file.left(1).find("[",0,TRUE) != -1) 208 if(file.left(1).find("[",0,TRUE) != -1)
206 file.remove(1,1); 209 file.remove(1,1);
207 if( file.find("]",0,TRUE) != -1) 210 if( file.find("]",0,TRUE) != -1)
208 file = file.left( file.find("]",0,TRUE)); 211 file = file.left( file.find("]",0,TRUE));
209 //odebug << "file is "+file << oendl; 212
210 /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); 213
211 number = indexLine.mid(55,5); 214 if(file.find("?", 0, false) != -1 ) {
212 number = number.stripWhiteSpace(); 215 QString tmpfile = file.replace(QRegExp("[?]"), "8");
213 // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); 216 // qDebug( "file is now " + tmpfile );
214 title = indexLine.mid( 9, 50 ); 217 file = tmpfile;
215 title = title.stripWhiteSpace(); 218 }
216 //odebug << "title is "+title << oendl; 219
217 getAuthor(); // grok author 220// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 );
218 author = author.stripWhiteSpace(); 221 number = indexLine.mid(55,5);
219 //odebug << "author is "+author << oendl; 222 number = number.stripWhiteSpace();
220 if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author 223 // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() );
221 QString lastName, firstName=""; 224 title = indexLine.mid( 9, 50 );
222 int finder=author.findRev( ' ', -1, TRUE); 225 title = title.stripWhiteSpace();
223 lastName=author.right( author.length()-finder); 226 //odebug << "title is "+title << oendl;
224 firstName=author.left(finder); 227 getAuthor(); // grok author
225 lastName=lastName.stripWhiteSpace(); 228 author = author.stripWhiteSpace();
226 firstName=firstName.stripWhiteSpace(); 229 //odebug << "author is "+author << oendl;
227 230 if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author
228 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names 231 QString lastName, firstName="";
229 author=lastName+", "+firstName; 232 int finder=author.findRev( ' ', -1, TRUE);
230 } 233 lastName=author.right( author.length()-finder);
231 234 firstName=author.left(finder);
232 if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) { 235 lastName=lastName.stripWhiteSpace();
233 // fill string list or something to be able to sort by Author 236 firstName=firstName.stripWhiteSpace();
234 if( author.isEmpty() ) 237
235 QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); 238 if( lastName.find( firstName, 0, true) == -1) // this avoids dup names
236 else { 239 author=lastName+", "+firstName;
237 if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || 240 }
238 (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) 241
239 QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); 242 if( !number.isEmpty()
240 243 && (title.find( "reserved",0, FALSE) == -1)
241 else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || 244 &&(title.find( "Audio",0, FALSE) == -1)) {
242 (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) 245 // fill string list or something to be able to sort by Author
243 QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); 246 if( author.isEmpty() )
244 247 QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file );
245 else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || 248 else {
246 (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) 249 if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) ||
247 QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file ); 250 (author.left(1) >= QString("a") && author.left(1) <= QString("f")) )
248 251 QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file );
249 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || 252
250 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) 253 else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) ||
251 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); 254 (author.left(1) >= QString("g") && author.left(1) <= QString("m")) )
252 } 255 QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file );
253 } 256
254 } 257 else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) ||
255 } 258 (author.left(1) >= QString("n") && author.left(1) <= QString("r")) )
256 } 259 QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file );
257 indexLib.close(); 260
258 } else { 261 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) ||
259 QString sMsg; 262 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) )
260 sMsg = ( tr("<p>Error opening local library index:</P> "))+local_index; 263 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file );
261 QMessageBox::message( "Error",sMsg); 264 }
262 } 265 }
266 }
267 }
268 }
269 indexLib.close();
270 } else {
271 QString sMsg;
272 sMsg = ( tr("<p>Error opening local library index:</P> "))+local_index;
273 QMessageBox::message( "Error",sMsg);
274 }
263 275
264} //end Library() 276} //end Library()
265 277
266 278
267 /* 279 /*
268 Groks the author out of the title */ 280 Groks the author out of the title */
269bool LibraryDialog::getAuthor() 281bool LibraryDialog::getAuthor()
270{ 282{
271 if( title.contains( ", by", TRUE)) { 283 if( title.contains( ", by", TRUE)) {
272 int auth; 284 int auth;
273 auth = title.find(", by", 0, TRUE); 285 auth = title.find(", by", 0, TRUE);
274 author = title.right(title.length() - (auth + 4) ); 286 author = title.right(title.length() - (auth + 4) );
275 if( int finder = author.find("[", 0, TRUE)) { 287 if( int finder = author.find("[", 0, TRUE)) {
276 author = author.left(finder); 288 author = author.left(finder);
277 } 289 }
278 } 290 }
279 else if ( title.contains( "by, ", TRUE) ) { 291 else if ( title.contains( "by, ", TRUE) ) {
280 int auth; 292 int auth;
281 auth = title.find("by, ", 0, TRUE); 293 auth = title.find("by, ", 0, TRUE);
282 author = title.right(title.length() - (auth + 4) ); 294 author = title.right(title.length() - (auth + 4) );
283 if( int finder = author.find("[", 0, TRUE)) { 295 if( int finder = author.find("[", 0, TRUE)) {
284 author = author.left( finder); 296 author = author.left( finder);
285 } 297 }
286 } 298 }
287 else if ( title.contains( " by", TRUE) ) { 299 else if ( title.contains( " by", TRUE) ) {
288 int auth; 300 int auth;
289 auth = title.find(" by", 0, TRUE); 301 auth = title.find(" by", 0, TRUE);
290 author = title.right(title.length() - (auth + 3) ); 302 author = title.right(title.length() - (auth + 3) );
291 if( int finder = author.find("[", 0, TRUE)) { 303 if( int finder = author.find("[", 0, TRUE)) {
292 author = author.left( finder); 304 author = author.left( finder);
293 } 305 }
294 } 306 }
295 else if ( title.contains( "by ", TRUE) ) { 307 else if ( title.contains( "by ", TRUE) ) {
296 int auth; 308 int auth;
297 auth = title.find("by ", 0, TRUE); 309 auth = title.find("by ", 0, TRUE);
298 author = title.right(title.length() - (auth + 3) ); 310 author = title.right(title.length() - (auth + 3) );
299 if( int finder = author.find("[", 0, TRUE)) { 311 if( int finder = author.find("[", 0, TRUE)) {
300 author = author.left( finder); 312 author = author.left( finder);
301 } 313 }
302 } 314 }
303 else if ( title.contains( ",", TRUE) ) { 315 else if ( title.contains( ",", TRUE) ) {
304 int auth; 316 int auth;
305 auth = title.find(",", 0, TRUE); 317 auth = title.find(",", 0, TRUE);
306 author = title.right( title.length() - (auth + 1) ); 318 author = title.right( title.length() - (auth + 1) );
307 if ( author.contains( ",", TRUE) ) { 319 if ( author.contains( ",", TRUE) ) {
308 int auth; 320 int auth;
309 auth = author.find(",", 0, TRUE); 321 auth = author.find(",", 0, TRUE);
310 author = author.right( author.length() - (auth + 1) ); 322 author = author.right( author.length() - (auth + 1) );
311 } 323 }
312 if( int finder = author.find("[", 0, TRUE)) { 324 if( int finder = author.find("[", 0, TRUE)) {
313 author = author.left( finder); 325 author = author.left( finder);
314 } 326 }
315 } 327 }
316 else if ( title.contains( "/", TRUE) ) { 328 else if ( title.contains( "/", TRUE) ) {
317 int auth; 329 int auth;
318 auth = title.find("/", 0, TRUE); 330 auth = title.find("/", 0, TRUE);
319 author = title.right(title.length() - (auth + 1) ); 331 author = title.right(title.length() - (auth + 1) );
320 if( int finder = author.find("[", 0, TRUE)) { 332 if( int finder = author.find("[", 0, TRUE)) {
321 author = author.left( finder); 333 author = author.left( finder);
322 } 334 }
323 } 335 }
324 else if ( title.contains( "of", TRUE) ) { 336 else if ( title.contains( "of", TRUE) ) {
325 int auth; 337 int auth;
326 auth = title.find("of", 0, TRUE); 338 auth = title.find("of", 0, TRUE);
327 author = title.right(title.length() - (auth + 2) ); 339 author = title.right(title.length() - (auth + 2) );
328 if( int finder = author.find("[", 0, TRUE)) 340 if( int finder = author.find("[", 0, TRUE))
329 { 341 {
330 author = author.left( finder); 342 author = author.left( finder);
331 } 343 }
332 } else { 344 } else {
333 author = ""; 345 author = "";
334 } 346 }
335 if ( author.contains("et. al")) { 347 if ( author.contains("et. al")) {
336 int auth; 348 int auth;
337 auth = author.find("et. al", 0, TRUE); 349 auth = author.find("et. al", 0, TRUE);
338 author = author.left( auth ); 350 author = author.left( auth );
339 } 351 }
340 if ( author.contains("#")) { 352 if ( author.contains("#")) {
341 int auth; 353 int auth;
342 auth = author.find("#", 0, TRUE); 354 auth = author.find("#", 0, TRUE);
343 author = author.left( auth); 355 author = author.left( auth);
344 } 356 }
345 if ( author.contains("(")) { 357 if ( author.contains("(")) {
346 int auth; 358 int auth;
347 auth = author.find("(", 0, TRUE); 359 auth = author.find("(", 0, TRUE);
348 author = author.left( auth); 360 author = author.left( auth);
349 } 361 }
350 if ( author.contains("et al")) { 362 if ( author.contains("et al")) {
351 int auth; 363 int auth;
352 auth = author.find("et al", 0, TRUE); 364 auth = author.find("et al", 0, TRUE);
353 author = author.left( auth ); 365 author = author.left( auth );
354 } 366 }
355 QRegExp r = QRegExp("[0-9]", TRUE, FALSE); 367 QRegExp r = QRegExp("[0-9]", TRUE, FALSE);
356 if ( author.left(2).find( r) != -1 ) { 368 if ( author.left(2).find( r) != -1 ) {
357 author = ""; 369 author = "";
358 } 370 }
359 // if( author.contains(" ", TRUE)) { 371 // if( author.contains(" ", TRUE)) {
360 // int suth = author.findRev(" ", -1, TRUE); 372 // int suth = author.findRev(" ", -1, TRUE);
361 // author = author.right( author.length() - suth); 373 // author = author.right( author.length() - suth);
362 // } 374 // }
363 375
364 // title 376 // title
365 // author 377 // author
366 return true; 378 return true;
367}////// end getAuthor() 379}////// end getAuthor()
368 380
369 /* 381 /*
370 selected one etext*/ 382 selected one etext*/
371void LibraryDialog::select_title( QListViewItem * item) 383void LibraryDialog::select_title( QListViewItem * item)
372{ 384{
373 if(item != NULL) { 385 if(item != NULL) {
374 i++; 386 i++;
375 int index = tabWidget->currentPageIndex(); 387 int index = tabWidget->currentPageIndex();
376 DlglistItemTitle = item->text(0); 388 DlglistItemTitle = item->text(0);
377 DlglistItemYear = item->text(2); 389 DlglistItemYear = item->text(2);
378 DlglistItemFile = item->text(3); 390 DlglistItemFile = item->text(3);
379 switch (index) { 391 switch (index) {
380 case 0: { 392 case 0: {
381 ListView1->clearSelection(); 393 ListView1->clearSelection();
382 } 394 }
383 break; 395 break;
384 case 1: { 396 case 1: {
385 ListView2->clearSelection(); 397 ListView2->clearSelection();
386 } 398 }
387 break; 399 break;
388 case 2: { 400 case 2: {
389 ListView3->clearSelection(); 401 ListView3->clearSelection();
390 } 402 }
391 break; 403 break;
392 case 3: { 404 case 3: {
393 ListView4->clearSelection(); 405 ListView4->clearSelection();
394 } 406 }
395 break; 407 break;
396 case 4: { 408 case 4: {
397 ListView5->clearSelection(); 409 ListView5->clearSelection();
398 } 410 }
399 break; 411 break;
400 }; 412 };
401 } 413 }
402 414
403 if(DlglistItemTitle.length()>2) { 415 if(DlglistItemTitle.length()>2) {
404 // DlglistItemNumber = item->text(0); 416 // DlglistItemNumber = item->text(0);
405 item = 0; 417 item = 0;
406 odebug << "string from librarydialog is:" << DlglistItemYear << " " << DlglistItemFile << " " << DlglistItemNumber << "" << oendl; 418 odebug << "string from librarydialog is:" << DlglistItemYear << " " << DlglistItemFile << " " << DlglistItemNumber << "" << oendl;
407 odebug << "Title is "+DlglistItemTitle << oendl; 419 odebug << "Title is "+DlglistItemTitle << oendl;
408 420
409 // check for connection here 421 // check for connection here
410 // if( get_extext()) 422 // if( get_extext())
411 423
412 if(download_Etext()) { 424 if(download_Etext()) {
413 // odebug << "get here 2" << oendl; 425 // odebug << "get here 2" << oendl;
414 if(i_binary == 1) { 426 if(i_binary == 1) {
415 427
416 } 428 }
417 if(checkBox->isChecked () ) { 429 if(checkBox->isChecked () ) {
418 accept(); 430 accept();
419 } 431 }
420 } 432 }
421 } 433 }
422} 434}
423 435
424bool LibraryDialog::download_Etext() 436bool LibraryDialog::download_Etext()
425{ // ftp method 437{ // ftp method
426 // might have to use old gpl'd ftp for embedded!! 438 // might have to use old gpl'd ftp for embedded!!
427 Config cfg("Gutenbrowser"); 439 Config cfg("Gutenbrowser");
428 cfg.setGroup("FTPsite"); 440 cfg.setGroup("FTPsite");
429 ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); 441 ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org");
430 ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); 442 ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg");
431 443
432 odebug << "about to network dialog" << oendl; 444 odebug << "about to network dialog" << oendl;
433 QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile; 445 QString NewlistItemNumber, NewlistItemYear, ls_result, result_line, s, dir, networkUrl, outputFile;
434 446
435 //////////////////// FIXME- if 'x' is part of real name.... 447 //////////////////// FIXME- if 'x' is part of real name....
436 NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE)); 448 NewlistItemFile = DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).left(DlglistItemFile.left(DlglistItemFile.find(".xxx", 1, FALSE)).find("x", 1, FALSE));
437 449
438 if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) { 450 if( NewlistItemFile.find( DlglistItemFile.left(4) ,0,TRUE) ==-1 ) {
439 NewlistItemFile.replace( 0,4, DlglistItemFile.left(4)); 451 NewlistItemFile.replace( 0,4, DlglistItemFile.left(4));
440 odebug << "NewlistItemFile is now "+NewlistItemFile << oendl; 452 odebug << "NewlistItemFile is now "+NewlistItemFile << oendl;
441 } 453 }
442 NewlistItemYear = DlglistItemYear.right(2); 454 NewlistItemYear = DlglistItemYear.right(2);
443 int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10); 455 int NewlistItemYear_Int = NewlistItemYear.toInt(0, 10);
444 odebug << NewlistItemYear << oendl; 456 odebug << NewlistItemYear << oendl;
445 if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) { 457 if (NewlistItemYear_Int < 91 && NewlistItemYear_Int > 70) {
446 NewlistItemYear = "90"; 458 NewlistItemYear = "90";
447 } 459 }
448 Edir ="etext" +NewlistItemYear; 460 Edir ="etext" +NewlistItemYear;
449 dir= ftp_base_dir + "/etext" +NewlistItemYear+"/"; 461 dir= ftp_base_dir + "/etext" +NewlistItemYear+"/";
450 if( ftp_base_dir.find("=",0,true) ) 462 if( ftp_base_dir.find("=",0,true) )
451 ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1); 463 ftp_base_dir.remove( ftp_base_dir.find("=",0,true),1);
452 464
453 networkUrl= "ftp://"+ftp_host+dir; 465 networkUrl= "ftp://"+ftp_host+dir;
454 466
455 outputFile=local_library+".guten_temp"; 467 outputFile=local_library+".guten_temp";
456 //odebug << "Download file:" << NewlistItemFile << "" << oendl; 468 //odebug << "Download file:" << NewlistItemFile << "" << oendl;
457 odebug << "Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile << oendl; 469 odebug << "Checking: "+ftp_host+" "+dir+" "+outputFile+" "+NewlistItemFile << oendl;
458 QStringList networkList; 470 QStringList networkList;
459 networkList.append((const char *)ftp_host); 471 networkList.append((const char *)ftp_host);
460 networkList.append((const char *)dir); 472 networkList.append((const char *)dir);
461 networkList.append((const char *)outputFile); 473 networkList.append((const char *)outputFile);
462 networkList.append((const char *)NewlistItemFile); 474 networkList.append((const char *)NewlistItemFile);
463//<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile; 475//<< (char *)ftp_host << (char *)dir << (char *)outputFile << (char *)NewlistItemFile;
464 476
465 NetworkDialog *NetworkDlg; 477 NetworkDialog *NetworkDlg;
466 NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList); 478 NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkList);
467 479
468 480
469 if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer 481 if( NetworkDlg->exec() != 0 ) { // use new, improved, *INSTANT* network-dialog-file-getterer
470 File_Name= NetworkDlg->localFileName; 482 File_Name= NetworkDlg->localFileName;
471 odebug << "back to Library from Network Dialog" << oendl; 483 odebug << "back to Library from Network Dialog" << oendl;
472 odebug << "Just downloaded "+NetworkDlg->localFileName << oendl; 484 odebug << "Just downloaded "+NetworkDlg->localFileName << oendl;
473 485
474 // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found 486 // if (File_Name.find( local_library, 0, TRUE) != -1 ) { //could not be found
475 // QString oldName=File_Name; 487 // QString oldName=File_Name;
476 // File_Name.replace(0,local_library.length(),downDir); 488 // File_Name.replace(0,local_library.length(),downDir);
477 // odebug << "File_Name now is "+File_Name << oendl; 489 // odebug << "File_Name now is "+File_Name << oendl;
478 490
479 // } 491 // }
480 // rename .txt to .etx 492 // rename .txt to .etx
481 if(NetworkDlg->successDownload) { 493 if(NetworkDlg->successDownload) {
482 odebug << "Filename is "+File_Name << oendl; 494 odebug << "Filename is "+File_Name << oendl;
483 if(File_Name.right(4)==".txt") { 495 if(File_Name.right(4)==".txt") {
484 QString s_fileName=File_Name; 496 QString s_fileName=File_Name;
485 s_fileName.replace( s_fileName.length()-3,3,"gtn"); 497 s_fileName.replace( s_fileName.length()-3,3,"gtn");
486 // s_fileName.replace( s_fileName.length()-3,3,"etx"); 498 // s_fileName.replace( s_fileName.length()-3,3,"etx");
487 rename(File_Name.latin1(),s_fileName.latin1()); 499 rename(File_Name.latin1(),s_fileName.latin1());
488 File_Name=s_fileName; 500 File_Name=s_fileName;
489 501
490 odebug << "Filename is now "+File_Name << oendl; 502 odebug << "Filename is now "+File_Name << oendl;
491 503
492 } 504 }
493 if(File_Name.length() > 5 ) { 505 if(File_Name.length() > 5 ) {
494 setTitle(); 506 setTitle();
495 QFileInfo fi(File_Name); 507 QFileInfo fi(File_Name);
496 QString name_file=fi.fileName(); 508 QString name_file=fi.fileName();
497 name_file=name_file.left(name_file.length()-4); 509 name_file=name_file.left(name_file.length()-4);
498 510
499 odebug << "Setting doclink" << oendl; 511 odebug << "Setting doclink" << oendl;
500 DocLnk lnk; 512 DocLnk lnk;
501 odebug << "name is "+name_file << oendl; 513 odebug << "name is "+name_file << oendl;
502 lnk.setName(name_file); //sets file name 514 lnk.setName(name_file); //sets file name
503 odebug << "Title is "+DlglistItemTitle << oendl; 515 odebug << "Title is "+DlglistItemTitle << oendl;
504 lnk.setComment(DlglistItemTitle); 516 lnk.setComment(DlglistItemTitle);
505 517
506 odebug << "Filename is "+File_Name << oendl; 518 odebug << "Filename is "+File_Name << oendl;
507 lnk.setFile(File_Name); //sets File property 519 lnk.setFile(File_Name); //sets File property
508 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D 520 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
509 lnk.setExec(File_Name); 521 lnk.setExec(File_Name);
510 lnk.setIcon("gutenbrowser/Gutenbrowser"); 522 lnk.setIcon("gutenbrowser/Gutenbrowser");
511 if(!lnk.writeLink()) { 523 if(!lnk.writeLink()) {
512 odebug << "Writing doclink did not work" << oendl; 524 odebug << "Writing doclink did not work" << oendl;
513 } else { 525 } else {
514 } 526 }
515 } else 527 } else
516 QMessageBox::message("Note","<p>There was an error with the file</p>"); 528 QMessageBox::message("Note","<p>There was an error with the file</p>");
517 } 529 }
518 } 530 }
519 return true; 531 return true;
520} 532}
521 533
522bool LibraryDialog::httpDownload() 534bool LibraryDialog::httpDownload()
523{// httpDownload 535{// httpDownload
524#ifndef Q_WS_QWS 536#ifndef Q_WS_QWS
525 Config config("Gutenbrowser"); 537 Config config("Gutenbrowser");
526 config.setGroup( "Browser" ); 538 config.setGroup( "Browser" );
527 QString brow = config.readEntry("Preferred", ""); 539 QString brow = config.readEntry("Preferred", "");
528 QString file_name = "./.guten_temp"; 540 QString file_name = "./.guten_temp";
529 // config.setGroup( "HttpServer" ); 541 // config.setGroup( "HttpServer" );
530 // QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); 542 // QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
531 QString httpName = proxy_http + "/"+Edir; 543 QString httpName = proxy_http + "/"+Edir;
532 // progressBar->setProgress( i); 544 // progressBar->setProgress( i);
533 i++; 545 i++;
534 if ( brow != "Konq") { /////////// use lynx 546 if ( brow != "Konq") { /////////// use lynx
535 // QString cmd = "lynx -source " + httpName +" | cat >> " + file_name; 547 // QString cmd = "lynx -source " + httpName +" | cat >> " + file_name;
536 // system(cmd); 548 // system(cmd);
537 } else { //////////// use KFM 549 } else { //////////// use KFM
538 // KFM::download( httpName, file_name); 550 // KFM::download( httpName, file_name);
539 } 551 }
540 i++; 552 i++;
541 QFile tmp( file_name); 553 QFile tmp( file_name);
542 QString str; 554 QString str;
543 if (tmp.open(IO_ReadOnly)) { 555 if (tmp.open(IO_ReadOnly)) {
544 QTextStream t( &tmp ); // use a text stream 556 QTextStream t( &tmp ); // use a text stream
545 while ( !t.eof()) { 557 while ( !t.eof()) {
546 QString s = t.readLine(); 558 QString s = t.readLine();
547 if (s.contains( NewlistItemFile, FALSE) && (s.contains(".txt")) ) { 559 if (s.contains( NewlistItemFile, FALSE) && (s.contains(".txt")) ) {
548 str = s.mid( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6, (s.find( ".txt</A>", 0, TRUE) + 4) - ( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6 ) ); 560 str = s.mid( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6, (s.find( ".txt</A>", 0, TRUE) + 4) - ( s.find( ".txt\">"+NewlistItemFile, 0, TRUE)+6 ) );
549 httpName += "/" + str; 561 httpName += "/" + str;
550 } 562 }
551 } //end of while loop 563 } //end of while loop
552 } 564 }
553 tmp.close(); 565 tmp.close();
554 m_getFilePath = local_library + str; 566 m_getFilePath = local_library + str;
555 i++; 567 i++;
556 if ( brow != "KFM"){ ///////// use lynx 568 if ( brow != "KFM"){ ///////// use lynx
557 QString cmd = "lynx -source " + httpName +" | cat >> " + m_getFilePath; 569 QString cmd = "lynx -source " + httpName +" | cat >> " + m_getFilePath;
558 // QMessageBox::message("Error", cmd); 570 // QMessageBox::message("Error", cmd);
559 system(cmd); 571 system(cmd);
560 } else { ////////// use KFM 572 } else { ////////// use KFM
561 // KFM::download( httpName, m_getFilePath); 573 // KFM::download( httpName, m_getFilePath);
562 } 574 }
563 i++; 575 i++;
564#endif 576#endif
565 return false; 577 return false;
566} 578}
567 579
568void LibraryDialog::cancelIt() 580void LibraryDialog::cancelIt()
569{ 581{
570 saveConfig(); 582 saveConfig();
571 583
572 DlglistItemNumber = ""; 584 DlglistItemNumber = "";
573 this->reject(); 585 this->reject();
574} 586}
575 587
576bool LibraryDialog::setTitle() 588bool LibraryDialog::setTitle()
577{ 589{
578 Config config("Gutenbrowser"); 590 Config config("Gutenbrowser");
579 odebug << "setting title" << oendl; 591 odebug << "setting title" << oendl;
580 odebug << DlglistItemTitle << oendl; 592 odebug << DlglistItemTitle << oendl;
581 593
582 if( DlglistItemTitle.find("[",0,TRUE) != -1) 594 if( DlglistItemTitle.find("[",0,TRUE) != -1)
583 DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" ); 595 DlglistItemTitle.replace(DlglistItemTitle.find("[",0,TRUE),1, "(" );
584 if( DlglistItemTitle.find("]",0,TRUE) !=-1) 596 if( DlglistItemTitle.find("]",0,TRUE) !=-1)
585 DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" ); 597 DlglistItemTitle.replace(DlglistItemTitle.find("]",0,TRUE),1, ")" );
586 odebug << "Title being set is "+DlglistItemTitle << oendl; 598 odebug << "Title being set is "+DlglistItemTitle << oendl;
587 int test = 0; 599 int test = 0;
588 QString ramble, temp; 600 QString ramble, temp;
589 config.setGroup("Files"); 601 config.setGroup("Files");
590 QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); 602 QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
591 int i_numofFiles = s_numofFiles.toInt(); 603 int i_numofFiles = s_numofFiles.toInt();
592 for ( int i = 0; i <= i_numofFiles; i++){ 604 for ( int i = 0; i <= i_numofFiles; i++){
593 temp.setNum( i); 605 temp.setNum( i);
594 ramble = config.readEntry( temp, "" ); 606 ramble = config.readEntry( temp, "" );
595 if( strcmp( ramble, File_Name) == 0){ 607 if( strcmp( ramble, File_Name) == 0){
596 test = 1; 608 test = 1;
597 } 609 }
598 } 610 }
611 config.setGroup("Files");
612 config.writeEntry( "NumberOfFiles", i_numofFiles +1 );
613 QString interger;
614 interger.setNum( i_numofFiles +1);
615 config.writeEntry( interger, File_Name);
616 config.setGroup( "Titles" );
617 config.writeEntry( File_Name, DlglistItemTitle);
599 618
600 if(test == 0 ) {
601
602 config.setGroup("Files");
603 config.writeEntry( "NumberOfFiles", i_numofFiles +1 );
604 QString interger;
605 interger.setNum( i_numofFiles +1);
606 config.writeEntry( interger, File_Name);
607 config.setGroup( "Titles" );
608 config.writeEntry( File_Name, DlglistItemTitle);
609 }
610 test = 0; 619 test = 0;
611 return true; 620 return true;
612} 621}
613 622
614 623
615void LibraryDialog::saveConfig() 624void LibraryDialog::saveConfig()
616{ 625{
617 Config config("Gutenbrowser"); 626 Config config("Gutenbrowser");
618 if( httpBox->isChecked() == TRUE) { 627 if( httpBox->isChecked() == TRUE) {
619 checked = 1; 628 checked = 1;
620 config.setGroup( "Proxy" ); 629 config.setGroup( "Proxy" );
621 config.writeEntry("IsChecked", "TRUE"); 630 config.writeEntry("IsChecked", "TRUE");
622 } else { 631 } else {
623 checked = 0; 632 checked = 0;
624 config.setGroup( "Proxy" ); 633 config.setGroup( "Proxy" );
625 config.writeEntry("IsChecked", "FALSE"); 634 config.writeEntry("IsChecked", "FALSE");
626 } 635 }
627 if (authBox->isChecked() == TRUE) { 636 if (authBox->isChecked() == TRUE) {
628 config.setGroup("SortAuth"); 637 config.setGroup("SortAuth");
629 config.writeEntry("authSort", "TRUE"); 638 config.writeEntry("authSort", "TRUE");
630 } else { 639 } else {
631 config.setGroup("SortAuth"); 640 config.setGroup("SortAuth");
632 config.writeEntry("authSort", "FALSE"); 641 config.writeEntry("authSort", "FALSE");
633 } 642 }
634 // config.write(); 643 // config.write();
635} 644}
636 645
637 /* 646 /*
638 searches library index for user word*/ 647 searches library index for user word*/
639void LibraryDialog::onButtonSearch() 648void LibraryDialog::onButtonSearch()
640{ 649{
641 ListView1->clearSelection(); 650 ListView1->clearSelection();
642 ListView2->clearSelection(); 651 ListView2->clearSelection();
643 ListView3->clearSelection(); 652 ListView3->clearSelection();
644 ListView4->clearSelection(); 653 ListView4->clearSelection();
645 ListView5->clearSelection(); 654 ListView5->clearSelection();
646 655
647 int curTab=tabWidget->currentPageIndex(); 656 int curTab=tabWidget->currentPageIndex();
648 SearchDialog* searchDlg; 657 SearchDialog* searchDlg;
649 658
650 // if( resultsList) 659 // if( resultsList)
651 searchDlg = new SearchDialog( this, "Library Search", TRUE); 660 searchDlg = new SearchDialog( this, "Library Search", TRUE);
652 searchDlg->setCaption( tr( "Library Search" ) ); 661 searchDlg->setCaption( tr( "Library Search" ) );
653 searchDlg->setLabel( "- author or title"); 662 searchDlg->setLabel( "- author or title");
654 QString resultString; 663 QString resultString;
655 int i_berger = 0; 664 int i_berger = 0;
656 if( searchDlg->exec() != 0 ) { 665 if( searchDlg->exec() != 0 ) {
657 QString searcherStr = searchDlg->get_text(); 666 QString searcherStr = searchDlg->get_text();
658 int fluff=0; 667 int fluff=0;
659 668
660 // int tabPage = tabWidget->currentPageIndex(); 669 // int tabPage = tabWidget->currentPageIndex();
661 // TODO ititerate here... struct<listViews>?? 670 // TODO ititerate here... struct<listViews>??
662 671
663 QListViewItemIterator it1( ListView1 ); 672 QListViewItemIterator it1( ListView1 );
664 QListViewItemIterator it2( ListView2 ); 673 QListViewItemIterator it2( ListView2 );
665 QListViewItemIterator it3( ListView3 ); 674 QListViewItemIterator it3( ListView3 );
666 QListViewItemIterator it4( ListView4 ); 675 QListViewItemIterator it4( ListView4 );
667 QListViewItemIterator it5( ListView5 ); 676 QListViewItemIterator it5( ListView5 );
668 677
669 //// this is really pitiful work, 678 //// this is really pitiful work,
670 /////// 679 ///////
671 bool cS; 680 bool cS;
672 if( searchDlg->caseSensitiveCheckBox->isChecked()) 681 if( searchDlg->caseSensitiveCheckBox->isChecked())
673 cS=true; //case sensitive 682 cS=true; //case sensitive
674 else 683 else
675 cS=false; 684 cS=false;
676 685
677 if(fluff==0) { 686 if(fluff==0) {
678 for ( ; it1.current(); ++it1 ) { 687 for ( ; it1.current(); ++it1 ) {
679 resultString = ( it1.current() )->text(0); 688 resultString = ( it1.current() )->text(0);
680 resultString += (" : "); 689 resultString += (" : ");
681 resultString += ( it1.current() )->text(2); 690 resultString += ( it1.current() )->text(2);
682 resultString += (" : "); 691 resultString += (" : ");
683 resultString += ( it1.current() )->text(3); 692 resultString += ( it1.current() )->text(3);
684 if( resultString.find( searcherStr, 0, cS) != -1) 693 if( resultString.find( searcherStr, 0, cS) != -1)
685 { 694 {
686 Searchlist.append( resultString); 695 Searchlist.append( resultString);
687 } 696 }
688 } 697 }
689 } 698 }
690 if(fluff==0) {// search routine here 699 if(fluff==0) {// search routine here
691 for ( ; it2.current(); ++it2 ) { 700 for ( ; it2.current(); ++it2 ) {
692 resultString = ( it2.current() )->text(0); 701 resultString = ( it2.current() )->text(0);
693 resultString += (" : "); 702 resultString += (" : ");
694 resultString += ( it2.current() )->text(2); 703 resultString += ( it2.current() )->text(2);
695 resultString += (" : "); 704 resultString += (" : ");
696 resultString += ( it2.current() )->text(3); 705 resultString += ( it2.current() )->text(3);
697 if( resultString.find( searcherStr, 0, cS) != -1) { 706 if( resultString.find( searcherStr, 0, cS) != -1) {
698 Searchlist.append( resultString); 707 Searchlist.append( resultString);
699 } 708 }
700 } 709 }
701 } 710 }
702 if(fluff==0) {// search routine here 711 if(fluff==0) {// search routine here
703 for ( ; it3.current(); ++it3 ) { 712 for ( ; it3.current(); ++it3 ) {
704 resultString = ( it3.current() )->text(0); 713 resultString = ( it3.current() )->text(0);
705 resultString += (" : "); 714 resultString += (" : ");
706 resultString += ( it3.current() )->text(2); 715 resultString += ( it3.current() )->text(2);
707 resultString += (" : "); 716 resultString += (" : ");
708 resultString += ( it3.current() )->text(3); 717 resultString += ( it3.current() )->text(3);
709 718
710 if( resultString.find( searcherStr, 0, cS) != -1) { 719 if( resultString.find( searcherStr, 0, cS) != -1) {
711 Searchlist.append( resultString); 720 Searchlist.append( resultString);
712 }
713 }
714 }
715 if(fluff==0) {
716 // search routine here
717 for ( ; it4.current(); ++it4 ) {
718 resultString = ( it4.current() )->text(0);
719 resultString += (" : ");
720 resultString += ( it4.current() )->text(2);
721 resultString += (" : ");
722 resultString += ( it4.current() )->text(3);
723 if( resultString.find( searcherStr, 0, cS) != -1) {
724 Searchlist.append( resultString);
725 }
726 }
727 }
728 if(fluff==0) { // search routine here
729 for ( ; it5.current(); ++it5 ) {
730 resultString = ( it5.current() )->text(0);
731 resultString += (" : ");
732 resultString += ( it5.current() )->text(2);
733 resultString += (" : ");
734 resultString += ( it5.current() )->text(3);
735 if( resultString.find( searcherStr, 0, cS) != -1) {
736 Searchlist.append( resultString);
737 }
738 }
739 }
740
741 tabWidget->setCurrentPage( curTab);
742
743 Searchlist.sort();
744 SearchResultsDlg* SearchResultsDialog;
745 SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist);
746
747 SearchResultsDialog->showMaximized();
748 if( SearchResultsDialog->exec() != 0) {
749 texter = SearchResultsDialog->selText;
750 // odebug << texter << oendl;
751 resultLs = SearchResultsDialog->resultsList;
752 i_berger = 1;
753 } else {
754 resultLs.clear();
755 } 721 }
756 Searchlist.clear(); 722 }
757 723 }
758 // if(SearchResultsDialog) 724 if(fluff==0) {
759 // delete SearchResultsDialog; 725 // search routine here
760 QString tester; 726 for ( ; it4.current(); ++it4 ) {
761 for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { 727 resultString = ( it4.current() )->text(0);
762 texter.sprintf("%s \n",(*it).latin1()); 728 resultString += (" : ");
763 // odebug << texter << oendl; 729 resultString += ( it4.current() )->text(2);
764 if( tester!=texter) 730 resultString += (" : ");
765 parseSearchResults( texter); 731 resultString += ( it4.current() )->text(3);
766 tester = texter; 732 if( resultString.find( searcherStr, 0, cS) != -1) {
767 } 733 Searchlist.append( resultString);
768 if(searchDlg) 734 }
769 delete searchDlg; 735 }
770 } 736 }
771 if(checkBox->isChecked() ) { 737 if(fluff==0) { // search routine here
772 accept(); 738 for ( ; it5.current(); ++it5 ) {
773 } else { 739 resultString = ( it5.current() )->text(0);
774 setActiveWindow(); 740 resultString += (" : ");
775 } 741 resultString += ( it5.current() )->text(2);
742 resultString += (" : ");
743 resultString += ( it5.current() )->text(3);
744 if( resultString.find( searcherStr, 0, cS) != -1) {
745 Searchlist.append( resultString);
746 }
747 }
748 }
749
750 tabWidget->setCurrentPage( curTab);
751
752 Searchlist.sort();
753 SearchResultsDlg* SearchResultsDialog;
754 SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist);
755
756 SearchResultsDialog->showMaximized();
757 if( SearchResultsDialog->exec() != 0) {
758 texter = SearchResultsDialog->selText;
759 // odebug << texter << oendl;
760 resultLs= SearchResultsDialog->resultsList;
761 i_berger = 1;
762 }
763 Searchlist.clear();
764
765 // if(SearchResultsDialog)
766 // delete SearchResultsDialog;
767 QString tester;
768 for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) {
769 texter.sprintf("%s \n",(*it).latin1());
770 // odebug << texter << oendl;
771 if( tester!=texter)
772 parseSearchResults( texter);
773 tester = texter;
774 }
775 if(searchDlg)
776 delete searchDlg;
777 }
778 if(checkBox->isChecked() ) {
779 accept();
780 } else {
781 setActiveWindow();
782 }
776} 783}
777 784
778 /* 785 /*
779 splits the result string and calls download for the current search result*/ 786 splits the result string and calls download for the current search result*/
780void LibraryDialog::parseSearchResults( QString resultStr) 787void LibraryDialog::parseSearchResults( QString resultStr)
781{ 788{
782 789
783 int stringLeng=resultStr.length(); 790 int stringLeng=resultStr.length();
784 QString my; 791 QString my;
785 my.setNum( stringLeng, 10); 792 my.setNum( stringLeng, 10);
786 793
787 if( resultStr.length() > 2 && resultStr.length() < 130) { 794 if( resultStr.length() > 2 && resultStr.length() < 130) {
788 int titleInt = resultStr.find( " : ", 0, TRUE); 795 int titleInt = resultStr.find( " : ", 0, TRUE);
789 DlglistItemTitle = resultStr.left( titleInt); 796 DlglistItemTitle = resultStr.left( titleInt);
790 int yearInt = resultStr.find( " : ", titleInt+3, TRUE); 797 int yearInt = resultStr.find( " : ", titleInt+3, TRUE);
791 DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3); 798 DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3);
792 DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3)); 799 DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3));
793 download_Etext(); 800 download_Etext();
794 } 801 }
795 /* 802 /*
796 printf( DlglistItemTitle+"\n"); printf( DlglistItemYear+"\n"); printf( DlglistItemFile+"\n");*/ 803 printf( DlglistItemTitle+"\n"); printf( DlglistItemYear+"\n"); printf( DlglistItemFile+"\n");*/
797} 804}
798 805
799 // bool LibraryDialog::UnzipIt( QString zipFile) { 806 // bool LibraryDialog::UnzipIt( QString zipFile) {
800 // //////////TODO findsome other way of dealingwithzip files. 807 // //////////TODO findsome other way of dealingwithzip files.
801 // ///usr/bin/unzip"; 808 // ///usr/bin/unzip";
802 // if( QFile::exists( zipFile)) { 809 // if( QFile::exists( zipFile)) {
803 // // QString thatFile = local_library +"PGWHOLE.TXT"; 810 // // QString thatFile = local_library +"PGWHOLE.TXT";
804 // QString cmd; 811 // QString cmd;
805 // #if defined(_WS_X11_) 812 // #if defined(_WS_X11_)
806 // cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; 813 // cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library;
807 // #endif 814 // #endif
808 // #if defined(_WS_WIN_) 815 // #if defined(_WS_WIN_)
809 // QString temp= QDir::convertSeparators(local_library); 816 // QString temp= QDir::convertSeparators(local_library);
810 // zipFile=QDir::convertSeparators( zipFile); 817 // zipFile=QDir::convertSeparators( zipFile);
811 // cmd = temp+"unzip.exe -o " +zipFile/*newestLibraryFile */+" -d " + temp; 818 // cmd = temp+"unzip.exe -o " +zipFile/*newestLibraryFile */+" -d " + temp;
812 // #endif 819 // #endif
813 // #ifndef Q_WS_QWS 820 // #ifndef Q_WS_QWS
814 // // QString cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library; 821 // // QString cmd = "gunzip -d " + zipFile /*newestLibraryFile */+" -d " + local_library;
815 // cmd = "unzip " + zipFile; 822 // cmd = "unzip " + zipFile;
816 // #endif 823 // #endif
817 824
818 // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No); 825 // int exit=QMessageBox::information(this, "Unzip?", "Ok to unzip "+ zipFile+" ?", QMessageBox::Yes, QMessageBox::No);
819 // if (exit==QMessageBox::Yes) { 826 // if (exit==QMessageBox::Yes) {
820 // odebug << "Issuing the command "+cmd << oendl; 827 // odebug << "Issuing the command "+cmd << oendl;
821 // #if defined(_WS_WIN_) 828 // #if defined(_WS_WIN_)
822 // WinExec( cmd, SW_HIDE ); 829 // WinExec( cmd, SW_HIDE );
823 // #endif 830 // #endif
824 // #if defined(_WS_X11_) 831 // #if defined(_WS_X11_)
825 // system( cmd); 832 // system( cmd);
826 // #endif 833 // #endif
827 // #ifndef Q_WS_QWS 834 // #ifndef Q_WS_QWS
828 // system( cmd); 835 // system( cmd);
829 // #endif 836 // #endif
830 // // printf("unzip\n"); 837 // // printf("unzip\n");
831 // // remove( zipFile /*newestLibraryFile*/); 838 // // remove( zipFile /*newestLibraryFile*/);
832 // return true; 839 // return true;
833 // } 840 // }
834 // else if(exit==QMessageBox::No) { 841 // else if(exit==QMessageBox::No) {
835 // // printf("unzip\n"); 842 // // printf("unzip\n");
836 // return false; 843 // return false;
837 // } 844 // }
838 // } else { 845 // } else {
839 // // QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) ); 846 // // QMessageBox::message( "Note",( tr("Please install unzip in your PATH")) );
840 // return false; 847 // return false;
841 // } 848 // }
842 // return true; 849 // return true;
843 // } 850 // }
844 851
845void LibraryDialog::sort() 852void LibraryDialog::sort()
846{ 853{
847 854
848} 855}
849 856
850 /* 857 /*
851 Downloads the current selected listitem*/ 858 Downloads the current selected listitem*/
852bool LibraryDialog::getItem(QListViewItem *it) 859bool LibraryDialog::getItem(QListViewItem *it)
853{ 860{
854 // odebug << "selected getItem" << oendl; 861 // odebug << "selected getItem" << oendl;
855 862
856 // DlglistItemNumber = it->text(0); 863 // DlglistItemNumber = it->text(0);
857 DlglistItemTitle = it->text(0); 864 DlglistItemTitle = it->text(0);
858 DlglistItemYear = it->text(2); 865 DlglistItemYear = it->text(2);
859 DlglistItemFile = it->text(3); 866 DlglistItemFile = it->text(3);
860 867
861 if(download_Etext()) { 868 if(download_Etext()) {
862 if(i_binary == 1) { 869 if(i_binary == 1) {
863 } 870 }
864 } 871 }
865 return true; 872 return true;
866} 873}
867 874
868 /* 875 /*
869 download button is pushed so we get the current items to download*/ 876 download button is pushed so we get the current items to download*/
870bool LibraryDialog::onButtonDownload() 877bool LibraryDialog::onButtonDownload()
871{ 878{
872 // odebug << "selected onButtonDownloadz" << oendl; 879 // odebug << "selected onButtonDownloadz" << oendl;
873 880
874 QListViewItemIterator it1( ListView1 ); 881 QListViewItemIterator it1( ListView1 );
875 QListViewItemIterator it2( ListView2 ); 882 QListViewItemIterator it2( ListView2 );
876 QListViewItemIterator it3( ListView3 ); 883 QListViewItemIterator it3( ListView3 );
877 QListViewItemIterator it4( ListView4 ); 884 QListViewItemIterator it4( ListView4 );
878 QListViewItemIterator it5( ListView5 ); 885 QListViewItemIterator it5( ListView5 );
879 886
880 // iterate through all items of the listview 887 // iterate through all items of the listview
881 for ( ; it1.current(); ++it1 ) { 888 for ( ; it1.current(); ++it1 ) {
882 if ( it1.current()->isSelected() ) 889 if ( it1.current()->isSelected() )
883 getItem(it1.current()); 890 getItem(it1.current());
884 it1.current()->setSelected(FALSE); 891 it1.current()->setSelected(FALSE);
885 } 892 }
886 for ( ; it2.current(); ++it2 ) { 893 for ( ; it2.current(); ++it2 ) {
887 if ( it2.current()->isSelected() ) 894 if ( it2.current()->isSelected() )
888 getItem(it2.current()); 895 getItem(it2.current());
889 it2.current()->setSelected(FALSE); 896 it2.current()->setSelected(FALSE);
890 } 897 }
891 for ( ; it3.current(); ++it3 ) { 898 for ( ; it3.current(); ++it3 ) {
892 if ( it3.current()->isSelected() ) 899 if ( it3.current()->isSelected() )
893 getItem(it3.current()); 900 getItem(it3.current());
894 it3.current()->setSelected(FALSE); 901 it3.current()->setSelected(FALSE);
895 } 902 }
896 for ( ; it4.current(); ++it4 ) { 903 for ( ; it4.current(); ++it4 ) {
897 if ( it4.current()->isSelected() ) 904 if ( it4.current()->isSelected() )
898 getItem(it4.current()); 905 getItem(it4.current());
899 it4.current()->setSelected(FALSE); 906 it4.current()->setSelected(FALSE);
900 } 907 }
901 for ( ; it5.current(); ++it5 ) { 908 for ( ; it5.current(); ++it5 ) {
902 if ( it5.current()->isSelected() ) 909 if ( it5.current()->isSelected() )
903 getItem(it5.current()); 910 getItem(it5.current());
904 it5.current()->setSelected(FALSE); 911 it5.current()->setSelected(FALSE);
905 } 912 }
906 return true; 913 return true;
907} 914}
908 915
909 916
910 /* 917 /*
911 handles the sorting combo box */ 918 handles the sorting combo box */
912void LibraryDialog::comboSelect(int index) 919void LibraryDialog::comboSelect(int index)
913{ 920{
914 // odebug << "we are sorting" << oendl; 921 // odebug << "we are sorting" << oendl;
915 ListView1->setSorting( index, TRUE); 922 ListView1->setSorting( index, TRUE);
916 ListView2->setSorting( index, TRUE); 923 ListView2->setSorting( index, TRUE);
917 ListView3->setSorting( index, TRUE); 924 ListView3->setSorting( index, TRUE);
918 ListView4->setSorting( index, TRUE); 925 ListView4->setSorting( index, TRUE);
919 ListView5->setSorting( index, TRUE); 926 ListView5->setSorting( index, TRUE);
920 927
921 ListView1->sort(); 928 ListView1->sort();
922 ListView2->sort(); 929 ListView2->sort();
923 ListView3->sort(); 930 ListView3->sort();
924 ListView4->sort(); 931 ListView4->sort();
925 ListView5->sort(); 932 ListView5->sort();
926 933
927 // ListView1->triggerUpdate(); 934 // ListView1->triggerUpdate();
928 // ListView2->triggerUpdate(); 935 // ListView2->triggerUpdate();
929 // ListView3->triggerUpdate(); 936 // ListView3->triggerUpdate();
930 // ListView4->triggerUpdate(); 937 // ListView4->triggerUpdate();
931 // ListView5->triggerUpdate(); 938 // ListView5->triggerUpdate();
932} 939}
933 940
934void LibraryDialog::newList() 941void LibraryDialog::newList()
935{ 942{
936 if(indexLoaded) { 943 if(indexLoaded) {
937 onButtonDownload(); 944 onButtonDownload();
938 } else { 945 } else {
939 Output *outDlg; 946 Output *outDlg;
940 buttonNewList->setDown(TRUE); 947 buttonNewList->setDown(TRUE);
941 QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); 948 QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser");
942 if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); 949 if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true);
943 if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { 950 if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) {
944 odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; 951 odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl;
945 QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 952 QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
946 QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; 953 QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1";
947 954
948 int result = QMessageBox::warning( this,"Download" 955 int result = QMessageBox::warning( this,"Download"
949 ,"<p>Ok to use /'wget/' to download a new library list?</P>" 956 ,"<p>Ok to use /'wget/' to download a new library list?</P>"
950 ,"Yes","No",0,0,1); 957 ,"Yes","No",0,0,1);
951 qApp->processEvents(); 958 qApp->processEvents();
952 if(result == 0) { 959 if(result == 0) {
953 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); 960 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE);
954 outDlg->showMaximized(); 961 outDlg->showMaximized();
955 outDlg->show(); 962 outDlg->show();
956 qApp->processEvents(); 963 qApp->processEvents();
957 FILE *fp; 964 FILE *fp;
958 char line[130]; 965 char line[130];
959 outDlg->OutputEdit->append( tr("Running wget") ); 966 outDlg->OutputEdit->append( tr("Running wget") );
960 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 967 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
961 sleep(1); 968 sleep(1);
962 fp = popen( (const char *) cmd, "r"); 969 fp = popen( (const char *) cmd, "r");
963 if ( !fp ) { 970 if ( !fp ) {
964 } else { 971 } else {
965 odebug << "Issuing the command\n"+cmd << oendl; 972 odebug << "Issuing the command\n"+cmd << oendl;
966 // system(cmd); 973 // system(cmd);
967 while ( fgets( line, sizeof line, fp)) { 974 while ( fgets( line, sizeof line, fp)) {
968 outDlg->OutputEdit->append(line); 975 outDlg->OutputEdit->append(line);
969 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 976 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
970 } 977 }
971 pclose(fp); 978 pclose(fp);
972 outDlg->OutputEdit->append("Finished downloading\n"); 979 outDlg->OutputEdit->append("Finished downloading\n");
973 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 980 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
974 qApp->processEvents(); 981 qApp->processEvents();
975 982
976 // if( QFile(gutenindex1).exists() ) { 983 // if( QFile(gutenindex1).exists() ) {
977 // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 984 // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
978 // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) 985 // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0)
979 // odebug << "renaming error" << oendl; 986 // odebug << "renaming error" << oendl;
980 // } 987 // }
981 988
982 } 989 }
983 // outDlg->close(); 990 // outDlg->close();
984 FindLibrary(); 991 FindLibrary();
985 if(outDlg) delete outDlg; 992 if(outDlg) delete outDlg;
986 } 993 }
987 buttonNewList->setDown(FALSE); 994 buttonNewList->setDown(FALSE);
988 } else { 995 } else {
989 QMessageBox::message("Note","Could not change directories"); 996 QMessageBox::message("Note","Could not change directories");
990 } 997 }
991 // if(outDlg) 998 // if(outDlg)
992 // delete outDlg; 999 // delete outDlg;
993 } 1000 }
994} 1001}
995 1002
996bool LibraryDialog::moreInfo() 1003bool LibraryDialog::moreInfo()
997{ 1004{
998 1005
999 QListViewItem * item; 1006 QListViewItem * item;
1000 item = 0; 1007 item = 0;
1001 QString titleString; 1008 QString titleString;
1002 item = ListView1->currentItem(); 1009 item = ListView1->currentItem();
1003 if( item != 0) { 1010 if( item != 0) {
1004 titleString = item->text(0); 1011 titleString = item->text(0);
1005 ListView1->clearSelection(); 1012 ListView1->clearSelection();
1006 item = 0; 1013 item = 0;
1007 } 1014 }
1008 if( item == 0) 1015 if( item == 0)
1009 item = ListView2->currentItem(); 1016 item = ListView2->currentItem();
1010 if( item != 0) { 1017 if( item != 0) {
1011 titleString = item->text(0); 1018 titleString = item->text(0);
1012 ListView2->clearSelection(); 1019 ListView2->clearSelection();
1013 item = 0; 1020 item = 0;
1014 } 1021 }
1015 if( item == 0) 1022 if( item == 0)
1016 item = ListView3->currentItem(); 1023 item = ListView3->currentItem();
1017 if( item != 0) { 1024 if( item != 0) {
1018 titleString = item->text(0); 1025 titleString = item->text(0);
1019 ListView3->clearSelection(); 1026 ListView3->clearSelection();
1020 item = 0; 1027 item = 0;
1021 } 1028 }
1022 if( item == 0) 1029 if( item == 0)
1023 item = ListView4->currentItem(); 1030 item = ListView4->currentItem();
1024 if( item != 0) { 1031 if( item != 0) {
1025 titleString = item->text(0); 1032 titleString = item->text(0);
1026 ListView4->clearSelection(); 1033 ListView4->clearSelection();
1027 item = 0; 1034 item = 0;
1028 } 1035 }
1029 if( item == 0) 1036 if( item == 0)
1030 item = ListView5->currentItem(); 1037 item = ListView5->currentItem();
1031 if( item != 0) { 1038 if( item != 0) {
1032 titleString = item->text(0); 1039 titleString = item->text(0);
1033 ListView5->clearSelection(); 1040 ListView5->clearSelection();
1034 item = 0; 1041 item = 0;
1035 } 1042 }
1036 item=0; 1043 item=0;
1037 if(titleString.length()>2) { 1044 if(titleString.length()>2) {
1038 odebug << "Title is "+titleString << oendl; 1045 odebug << "Title is "+titleString << oendl;
1039 titleString.replace( QRegExp("\\s"), "%20"); 1046 titleString.replace( QRegExp("\\s"), "%20");
1040 titleString.replace( QRegExp("'"), "%20"); 1047 titleString.replace( QRegExp("'"), "%20");
1041 titleString.replace( QRegExp("\""), "%20"); 1048 titleString.replace( QRegExp("\""), "%20");
1042 titleString.replace( QRegExp("&"), "%20"); 1049 titleString.replace( QRegExp("&"), "%20");
1043 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; 1050 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search";
1044 cmd="opera "+cmd; 1051 cmd="opera "+cmd;
1045 system(cmd); 1052 system(cmd);
1046 } else 1053 } else
1047 QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>"); 1054 QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>");
1048 return true; 1055 return true;
1049 1056
1050} 1057}
1051 1058
1052 /* 1059 /*
1053 This loads the library Index*/ 1060 This loads the library Index*/
1054void LibraryDialog::FindLibrary() 1061void LibraryDialog::FindLibrary()
1055{ 1062{
1056 buttonLibrary->setDown(TRUE); 1063 buttonLibrary->setDown(TRUE);
1057 1064
1058 qApp->processEvents(); 1065 qApp->processEvents();
1059 if( QFile( new_index).exists() /* && this->isHidden() */) { 1066 if( QFile( new_index).exists() /* && this->isHidden() */) {
1060 newindexLib.setName( new_index); 1067 newindexLib.setName( new_index);
1061 indexLib.setName( new_index); 1068 indexLib.setName( new_index);
1062 odebug << "index file is "+ new_index << oendl; 1069 odebug << "index file is "+ new_index << oendl;
1063 Newlibrary(); 1070 Newlibrary();
1064 } else { 1071 } else {
1065 newindexLib.setName( old_index); 1072 newindexLib.setName( old_index);
1066 indexLib.setName( old_index); 1073 indexLib.setName( old_index);
1067 odebug << "new index nameis "+ old_index << oendl; 1074 odebug << "new index nameis "+ old_index << oendl;
1068 Library(); 1075 Library();
1069 } 1076 }
1070 indexLoaded=true; 1077 indexLoaded=true;
1071 buttonSearch->setEnabled(TRUE); 1078 buttonSearch->setEnabled(TRUE);
1072 moreInfoButton->setEnabled(TRUE); 1079 moreInfoButton->setEnabled(TRUE);
1073 1080
1074 buttonLibrary->setDown(FALSE); 1081 buttonLibrary->setDown(FALSE);
1075 buttonNewList->setText("Download"); 1082 buttonNewList->setText("Download");
1076 qApp->processEvents(); 1083 qApp->processEvents();
1077 1084
1078} 1085}
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
index fac21da..c7cdd83 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -128,209 +128,220 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags )
128 128
129 for (int i = 0; i <= i_numofFiles; i++) { 129 for (int i = 0; i <= i_numofFiles; i++) {
130 // tempFileName.setNum(i); 130 // tempFileName.setNum(i);
131 config.setGroup( "Files" ); 131 config.setGroup( "Files" );
132 QString ramble = config.readEntry( QString::number(i), "" ); 132 QString ramble = config.readEntry( QString::number(i), "" );
133 133
134 config.setGroup( "Titles" ); 134 config.setGroup( "Titles" );
135 QString tempTitle = config.readEntry( ramble, ""); 135 QString tempTitle = config.readEntry( ramble, "");
136 config.setGroup( tempTitle); 136 config.setGroup( tempTitle);
137 int index = config.readNumEntry( "LineNumber", -1 ); 137 int index = config.readNumEntry( "LineNumber", -1 );
138 if( index != -1) { 138 if( index != -1) {
139 odebug << tempTitle << oendl; 139 odebug << tempTitle << oendl;
140 if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle); 140 if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle);
141 } 141 }
142 } 142 }
143 143
144 // QString gutenIndex= local_library + "GUTINDEX.ALL"; 144 // QString gutenIndex= local_library + "GUTINDEX.ALL";
145 QString gutenIndex = QPEApplication::qpeDir()+ "etc/gutenbrowser/GUTINDEX.ALL"; 145 QString gutenIndex = QPEApplication::qpeDir()+ "etc/gutenbrowser/GUTINDEX.ALL";
146 qDebug("gutenindex "+gutenIndex ); 146 qDebug("gutenindex "+gutenIndex );
147 if( QFile( gutenIndex).exists() ) { 147 if( QFile( gutenIndex).exists() ) {
148 indexLib.setName( gutenIndex); 148 indexLib.setName( gutenIndex);
149 } else { 149 } else {
150 QString localLibIndexFile = QPEApplication::qpeDir()+ "etc/gutenbrowser/PGWHOLE.TXT"; 150 QString localLibIndexFile = QPEApplication::qpeDir()+ "etc/gutenbrowser/PGWHOLE.TXT";
151 // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; 151 // QString localLibIndexFile= local_library + "PGWHOLE.TXT";
152 newindexLib.setName( localLibIndexFile); 152 newindexLib.setName( localLibIndexFile);
153 } 153 }
154 qDebug("attempting new library"); 154 qDebug("attempting new library");
155 LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); 155 LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */);
156 loadCheck = false; 156 loadCheck = false;
157 chdir(local_library); 157 chdir(local_library);
158 if(!showMainList) { 158 if(!showMainList) {
159 Lview->setFocus(); 159 Lview->setFocus();
160 // if(firstTime) 160 // if(firstTime)
161 // Bookmark(); 161 // Bookmark();
162 for (int i=1;i< qApp->argc();i++) { 162 for (int i=1;i< qApp->argc();i++) {
163 qDebug("Suppose we open somethin"); 163 qDebug("Suppose we open somethin");
164 if(!load(qApp->argv()[i])) return; 164 if(!load(qApp->argv()[i])) return;
165 } 165 }
166 } else { 166 } else {
167 fillWithTitles(); 167 fillWithTitles();
168 mainList->setFocus(); 168 mainList->setFocus();
169 // mainList->setCurrentItem(0); 169 // mainList->setCurrentItem(0);
170 170
171 } 171 }
172 writeConfig(); 172 writeConfig();
173 QTimer::singleShot( 250, this, SLOT(hideView()) ); 173 QTimer::singleShot( 250, this, SLOT(hideView()) );
174} //end init 174} //end init
175 175
176Gutenbrowser::~Gutenbrowser() { 176Gutenbrowser::~Gutenbrowser() {
177 // QPEApplication::grabKeyboard(); 177 // QPEApplication::grabKeyboard();
178 // QPEApplication::ungrabKeyboard(); 178 // QPEApplication::ungrabKeyboard();
179 odebug << "Exit" << oendl; 179 odebug << "Exit" << oendl;
180} 180}
181 181
182 /* 182 /*
183 Google.com search */ 183 Google.com search */
184void Gutenbrowser::InfoBarClick() { 184void Gutenbrowser::InfoBarClick() {
185 QString text; 185 QString text;
186 if( Lview->hasSelectedText()) { 186 if( Lview->hasSelectedText()) {
187 Lview->copy(); 187 Lview->copy();
188 QClipboard *cb = QApplication::clipboard(); 188 QClipboard *cb = QApplication::clipboard();
189 text = cb->text(); 189 text = cb->text();
190 } else { 190 } else {
191 // text=title; 191 // text=title;
192 text=this->caption(); 192 text=this->caption();
193 } 193 }
194 searchGoogle(text); 194 searchGoogle(text);
195} 195}
196 196
197 /* 197 /*
198 download http with wget or preferred browser */ 198 download http with wget or preferred browser */
199void Gutenbrowser::goGetit( const QString &url, bool showMsg) { 199void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
200 // int eexit=0; 200 // int eexit=0;
201 QString cmd; 201 QString cmd;
202 // config.read(); 202 // config.read();
203 qApp->processEvents(); 203 qApp->processEvents();
204 QString filename = QPEApplication::qpeDir(); 204 QString filename = QPEApplication::qpeDir();
205 if(filename.right(1)!="/") 205 if(filename.right(1)!="/")
206 filename+="/etc/gutenbrowser/"; 206 filename+="/etc/gutenbrowser/";
207 else 207 else
208 filename+="etc/gutenbrowser/"; 208 filename+="etc/gutenbrowser/";
209 odebug << "filename "+filename << oendl; 209 odebug << "filename "+filename << oendl;
210 // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; 210 // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/";
211 211
212 filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); 212 filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1);
213 213
214 Config config("Gutenbrowser"); 214 Config config("Gutenbrowser");
215 config.setGroup( "Browser" ); 215 config.setGroup( "Browser" );
216 QString brow = config.readEntry("Preferred", "Opera"); 216 QString brow = config.readEntry("Preferred", "Opera");
217 odebug << "Preferred browser is "+brow << oendl; 217 odebug << "Preferred browser is "+brow << oendl;
218 if(!showMsg) { //if we just get the gutenindex.all 218 if(!showMsg) { //if we just get the gutenindex.all
219 cmd="wget -O " + filename +" " + url+" 2>&1" ; 219 cmd="wget -O " + filename +" " + url+" 2>&1" ;
220 chdir(local_library); 220 chdir(local_library);
221 odebug << "Issuing the system command: " << cmd << "" << oendl; 221 odebug << "Issuing the system command: " << cmd << "" << oendl;
222 222
223 Output *outDlg; 223 Output *outDlg;
224 outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); 224
225 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE);
226
225 outDlg->showMaximized(); 227 outDlg->showMaximized();
226 outDlg->show(); 228 outDlg->show();
227 qApp->processEvents(); 229 qApp->processEvents();
228 FILE *fp; 230 FILE *fp;
229 char line[130]; 231 char line[130];
230 outDlg->OutputEdit->append( tr("Running wget") ); 232 outDlg->OutputEdit->append( tr("Running wget") );
233 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
231 sleep(1); 234 sleep(1);
232 fp = popen( (const char *) cmd, "r"); 235 fp = popen( (const char *) cmd, "r");
233 odebug << "Issuing the command\n"+cmd << oendl; 236 if ( !fp ) {
234 // system(cmd); 237 } else {
235 while ( fgets( line, sizeof line, fp)) { 238 //odebug << "Issuing the command\n"+cmd << oendl;
236 outDlg->OutputEdit->append(line); 239 // system(cmd);
237// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 240 while ( fgets( line, sizeof line, fp)) {
241 outDlg->OutputEdit->append(line);
242 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
243 }
244 pclose(fp);
245 outDlg->OutputEdit->append("Finished downloading\n");
246 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
247 qApp->processEvents();
248
238 } 249 }
239 pclose(fp); 250 outDlg->close();
240 outDlg->close(); 251
241 if(outDlg) 252 if(outDlg)
242 delete outDlg; 253 delete outDlg;
243 } else { 254 } else {
244 if( brow == "Konq") { 255 if( brow == "Konq") {
245 cmd = "konqueror "+url+" &"; 256 cmd = "konqueror "+url+" &";
246 } 257 }
247 if( brow == "Opera") { //for desktop testing 258 if( brow == "Opera") { //for desktop testing
248 cmd = "opera "+url+" &"; 259 cmd = "opera "+url+" &";
249 } 260 }
250 // if( brow == "Opera") { // on Zaurus 261 // if( brow == "Opera") { // on Zaurus
251 // cmd = "operagui "+url+" &"; 262 // cmd = "operagui "+url+" &";
252 // } 263 // }
253 if( brow == "Mozilla") { 264 if( brow == "Mozilla") {
254 cmd = "mozilla "+url+" &"; 265 cmd = "mozilla "+url+" &";
255 } 266 }
256 if( brow == "Netscape") { 267 if( brow == "Netscape") {
257 cmd = "netscape "+url+" &"; 268 cmd = "netscape "+url+" &";
258 } 269 }
259 if(brow == "wget") { 270 if(brow == "wget") {
260 // cmd="wget -q "+url+" &"; 271 // cmd="wget -q "+url+" &";
261 QString tempHtml=local_library+"webster.html"; 272 QString tempHtml=local_library+"webster.html";
262 cmd="wget -O "+tempHtml+" -q "+url; 273 cmd="wget -O "+tempHtml+" -q "+url;
263 } 274 }
264 275
265 chdir(local_library); 276 chdir(local_library);
266 odebug << "Issuing the sys command: " << cmd << "" << oendl; 277 odebug << "Issuing the sys command: " << cmd << "" << oendl;
267 system(cmd); 278 system(cmd);
268 } 279 }
269} 280}
270 281
271void Gutenbrowser::toggleButtonIcons( bool useEm) { 282void Gutenbrowser::toggleButtonIcons( bool useEm) {
272 QString pixDir; 283 QString pixDir;
273 if(useEm) 284 if(useEm)
274 useEm=TRUE; 285 useEm=TRUE;
275 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; 286 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser";
276 odebug << "Docdir is "+QPEApplication::documentDir() << oendl; 287 odebug << "Docdir is "+QPEApplication::documentDir() << oendl;
277 288
278 if( useIcons && QDir( pixDir).exists() ) { 289 if( useIcons && QDir( pixDir).exists() ) {
279 LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline 290 LibraryButton->setPixmap( Resource::loadPixmap("home") ); //in inline
280 OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook")); 291 OpenButton->setPixmap( Resource::loadPixmap("gutenbrowser/openbook"));
281 ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline 292 ForwardButton->setPixmap( Resource::loadPixmap("forward"));//in inline
282 BackButton->setPixmap( Resource::loadPixmap("back") );//in inline 293 BackButton->setPixmap( Resource::loadPixmap("back") );//in inline
283 SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline 294 SearchButton->setPixmap( Resource::loadPixmap("gutenbrowser/search") );//in inline
284 lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder")); 295 lastBmkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark_folder"));
285 setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") ); 296 setBookmarkButton->setPixmap( Resource::loadPixmap("gutenbrowser/bookmark") );
286 dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") ); 297 dictionaryButton->setPixmap( Resource::loadPixmap("gutenbrowser/spellcheck") );
287 InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google")); 298 InfoBar->setPixmap( Resource::loadPixmap("gutenbrowser/google"));
288 } 299 }
289} 300}
290 301
291 302
292bool Gutenbrowser::queryExit() 303bool Gutenbrowser::queryExit()
293{ 304{
294 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?", 305 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?",
295 QMessageBox::Ok, QMessageBox::Cancel); 306 QMessageBox::Ok, QMessageBox::Cancel);
296 if (exit==1) { 307 if (exit==1) {
297 writeConfig(); 308 writeConfig();
298 qApp->quit(); 309 qApp->quit();
299 } else { 310 } else {
300 }; 311 };
301 return (exit==1); 312 return (exit==1);
302} 313}
303 314
304 // SLOT IMPLEMENTATION 315 // SLOT IMPLEMENTATION
305 316
306void Gutenbrowser::slotFilePrint() { 317void Gutenbrowser::slotFilePrint() {
307} 318}
308 319
309void Gutenbrowser::ByeBye() { 320void Gutenbrowser::ByeBye() {
310 if (b_queryExit) 321 if (b_queryExit)
311 queryExit(); 322 queryExit();
312 else { 323 else {
313 // writeConfig(); 324 // writeConfig();
314 qApp->quit(); 325 qApp->quit();
315 } 326 }
316} 327}
317 328
318void Gutenbrowser::HelpBtn() { 329void Gutenbrowser::HelpBtn() {
319 HelpMe* HelpDlg; 330 HelpMe* HelpDlg;
320 HelpDlg = new HelpMe( this, "Help Dialog"); 331 HelpDlg = new HelpMe( this, "Help Dialog");
321 HelpDlg->showMaximized(); 332 HelpDlg->showMaximized();
322} 333}
323 334
324void Gutenbrowser::DownloadIndex() { 335void Gutenbrowser::DownloadIndex() {
325#ifndef Q_WS_QWS 336#ifndef Q_WS_QWS
326 { 337 {
327 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")), 338 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")),
328 (tr("Do you want to download the newest\n" 339 (tr("Do you want to download the newest\n"
329 "Project Gutenberg Library Index?\n" 340 "Project Gutenberg Library Index?\n"
330 "or select an ftp site?\n")), 341 "or select an ftp site?\n")),
331 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) ) 342 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) )
332 { 343 {
333 case 0: // index clicked, 344 case 0: // index clicked,
334 downloadLibIndex(); 345 downloadLibIndex();
335 break; 346 break;
336 347