author | llornkcor <llornkcor> | 2005-08-24 20:22:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-08-24 20:22:10 (UTC) |
commit | 65edeafe2dc8689dce7c2ce94e954933b393dcf0 (patch) (unidiff) | |
tree | 17d0986ef0bce73f44a4b9900466fcc533954814 | |
parent | f0bb6c410f19d502cf563254d95158617a32b94e (diff) | |
download | opie-65edeafe2dc8689dce7c2ce94e954933b393dcf0.zip opie-65edeafe2dc8689dce7c2ce94e954933b393dcf0.tar.gz opie-65edeafe2dc8689dce7c2ce94e954933b393dcf0.tar.bz2 |
optimize search. fix other things
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 265 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.h | 15 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp | 90 |
3 files changed, 170 insertions, 200 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 58babe9..9858188 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -75,322 +75,350 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool /*modal* | |||
75 | if( config.readEntry("authSort", "false") == "true") | 75 | if( config.readEntry("authSort", "false") == "true") |
76 | authBox->setChecked(true); | 76 | authBox->setChecked(true); |
77 | 77 | ||
78 | config.setGroup("General"); | 78 | config.setGroup("General"); |
79 | downDir = config.readEntry( "DownloadDirectory",local_library); | 79 | downDir = config.readEntry( "DownloadDirectory",local_library); |
80 | //odebug << "downDir is "+downDir << oendl; | 80 | //odebug << "downDir is "+downDir << oendl; |
81 | newindexLib.setName( old_index); | 81 | newindexLib.setName( old_index); |
82 | indexLib.setName( old_index); | 82 | indexLib.setName( old_index); |
83 | 83 | ||
84 | new QPEDialogListener(this); | 84 | new QPEDialogListener(this); |
85 | QTimer::singleShot( 1000, this, SLOT( FindLibrary()) ); | 85 | QTimer::singleShot( 1000, this, SLOT( FindLibrary()) ); |
86 | 86 | ||
87 | } | 87 | } |
88 | 88 | ||
89 | LibraryDialog::~LibraryDialog() | 89 | LibraryDialog::~LibraryDialog() |
90 | { | 90 | { |
91 | } | 91 | } |
92 | 92 | ||
93 | void LibraryDialog::clearItems() { | 93 | void LibraryDialog::clearItems() { |
94 | ListView1->clear(); | 94 | ListView1->clear(); |
95 | ListView2->clear(); | 95 | ListView2->clear(); |
96 | ListView3->clear(); | 96 | ListView3->clear(); |
97 | ListView4->clear(); | 97 | ListView4->clear(); |
98 | ListView5->clear(); | 98 | ListView5->clear(); |
99 | } | 99 | } |
100 | 100 | ||
101 | /*This groks using PGWHOLE.TXT */ | 101 | /*This groks using PGWHOLE.TXT */ |
102 | void LibraryDialog::Newlibrary() | 102 | void LibraryDialog::Newlibrary() |
103 | { | 103 | { |
104 | clearItems(); | 104 | clearItems(); |
105 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files | 105 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files |
106 | ////odebug << "Opening new library index " << newindexLib << "" << oendl; | 106 | ////odebug << "Opening new library index " << newindexLib << "" << oendl; |
107 | if ( newindexLib.open( IO_ReadOnly) ) { | 107 | if ( newindexLib.open( IO_ReadOnly) ) { |
108 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully | 108 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully |
109 | QTextStream indexStream( &newindexLib ); | 109 | QTextStream indexStream( &newindexLib ); |
110 | QString indexLine; | 110 | QString indexLine; |
111 | while ( !indexStream.atEnd() ) { // until end of file.. | 111 | while ( !indexStream.atEnd() ) { // until end of file.. |
112 | indexLine = indexStream.readLine(); | 112 | indexLine = indexStream.readLine(); |
113 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { | 113 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { |
114 | year = indexLine.mid(4,4); | 114 | year = indexLine.mid(4,4); |
115 | file = indexLine.mid( indexLine.find( "[", 0, true )+1, 12 ); | 115 | file = indexLine.mid( indexLine.find( "[", 0, true )+1, 12 ); |
116 | number = indexLine.mid( indexLine.find( "]", 0, true ) +1, indexLine.find( " ", 0, true )+1 ); | 116 | number = indexLine.mid( indexLine.find( "]", 0, true ) +1, indexLine.find( " ", 0, true )+1 ); |
117 | if( year.toInt() < 1984) | 117 | if( year.toInt() < 1984) |
118 | number = number.left( number.length() -1 ); | 118 | number = number.left( number.length() -1 ); |
119 | title = indexLine.mid( indexLine.find(" ", 26, true), indexLine.length() ); | 119 | title = indexLine.mid( indexLine.find(" ", 26, true), indexLine.length() ); |
120 | 120 | ||
121 | addItems(); | 121 | addItems(); |
122 | 122 | ||
123 | }// end if | 123 | }// end if |
124 | }// end while | 124 | }// end while |
125 | newindexLib.close(); | 125 | newindexLib.close(); |
126 | } | 126 | } |
127 | #ifndef Q_WS_QWS | 127 | #ifndef Q_WS_QWS |
128 | setCursor( arrowCursor); | 128 | setCursor( arrowCursor); |
129 | #endif | 129 | #endif |
130 | #endif | 130 | #endif |
131 | } // end Newlibrary() | 131 | } // end Newlibrary() |
132 | 132 | ||
133 | 133 | ||
134 | void LibraryDialog::Library() { | 134 | void LibraryDialog::Library() { |
135 | clearItems(); | 135 | clearItems(); |
136 | 136 | ||
137 | // qDebug( "opening GUTINDEX.ALL file"); | 137 | // qDebug( "opening GUTINDEX.ALL file"); |
138 | IDontKnowWhy = ""; | 138 | IDontKnowWhy = ""; |
139 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully | 139 | system("date"); |
140 | if ( indexLib.open( IO_ReadOnly) ) { | ||
141 | // file opened successfully | ||
140 | QTextStream indexStream( &indexLib ); | 142 | QTextStream indexStream( &indexLib ); |
141 | QString indexLine; | 143 | QString indexLine; |
142 | qApp->processEvents(); | 144 | qApp->processEvents(); |
143 | 145 | ||
146 | bool okToRead = false; | ||
144 | while ( !indexStream.eof() ) { | 147 | while ( !indexStream.eof() ) { |
145 | |||
146 | indexLine = indexStream.readLine(); | 148 | indexLine = indexStream.readLine(); |
147 | if ( indexLine != "") { | 149 | if(indexLine == "<==Start GUTINDEX.ALL listings==>") |
148 | 150 | okToRead = true; | |
149 | if( (indexLine.mid(4,4)).toInt() ) { | 151 | if(indexLine == "<==End of GUTINDEX.ALL==>") { |
150 | 152 | okToRead = false; | |
151 | year = indexLine.mid(4,4); | 153 | indexLib.at(indexLib.size()); |
152 | file = indexLine.mid(60,12); | ||
153 | if(file.left(1).find("[",0,TRUE) != -1) | ||
154 | file.remove(1,1); | ||
155 | if( file.find("]",0,TRUE) != -1) | ||
156 | file = file.left( file.find("]",0,TRUE)); | ||
157 | |||
158 | if(file.find("?", 0, false) != -1 ) { | ||
159 | QString tmpfile = file.replace(QRegExp("[?]"), "8"); | ||
160 | file = tmpfile; | ||
161 | } | ||
162 | |||
163 | number = indexLine.mid(55,5); | ||
164 | title = indexLine.mid( 9, 50 ); | ||
165 | |||
166 | addItems(); | ||
167 | |||
168 | } | ||
169 | else if ( indexLine.mid(73,5).toInt() && indexLine.mid(73,5).toInt() > 10000 ) { | ||
170 | // newer files with numbers > 100000 have new dir structure and need to be parsed differently.. | ||
171 | number = indexLine.mid(73,5); | ||
172 | int num = number.toInt(); | ||
173 | if(num < 10626) | ||
174 | year = "2003"; | ||
175 | else if(num >= 10626 && num < 14600) | ||
176 | year = "2004"; | ||
177 | else if(num >= 14600) | ||
178 | year = "2005"; | ||
179 | |||
180 | file = number;// + ".txt"; | ||
181 | title = indexLine.mid(0,72); | ||
182 | |||
183 | addItems(); | ||
184 | //qDebug("file number is " + number + " title is " + title ); | ||
185 | } | ||
186 | } | 154 | } |
155 | |||
156 | if(okToRead) { | ||
157 | QStringList token = QStringList::split(' ', indexLine); | ||
158 | int textNumber; | ||
159 | if(( textNumber = token.last().toInt() )) | ||
160 | if(textNumber > 10001) { | ||
161 | // qWarning("Last "+token.last()); | ||
162 | // newer files with numbers > 100000 have new dir structure and need to be parsed differently.. | ||
163 | if(textNumber < 10626) | ||
164 | year = "2003"; | ||
165 | else if(textNumber >= 10626 && textNumber < 14600) | ||
166 | year = "2004"; | ||
167 | else if(textNumber >= 14600) | ||
168 | year = "2005"; | ||
169 | |||
170 | file = token.last(); | ||
171 | title = indexLine.mid(0,72); | ||
172 | |||
173 | addItems(); //author and qlistview | ||
174 | //qDebug("file number is " + number + " title is " + title ); | ||
175 | |||
176 | } else { //end new etexts | ||
177 | |||
178 | if(token[1].toInt() && token[1].toInt() > 1969) { | ||
179 | year = token[1]; | ||
180 | file = indexLine.mid(60,12); | ||
181 | |||
182 | if(file.left(1).find("[",0,TRUE) != -1) { | ||
183 | file.remove(1,1); | ||
184 | if( file.find("]",0,TRUE) != -1) | ||
185 | file = file.left( file.find("]",0,TRUE)); | ||
186 | |||
187 | if(file.find("?", 0, false) != -1 ) { | ||
188 | QString tmpfile = file.replace(QRegExp("[?]"), "8"); | ||
189 | file = tmpfile; | ||
190 | } | ||
191 | title = indexLine.mid( 9, 50); | ||
192 | |||
193 | addItems(); | ||
194 | } | ||
195 | } else { // then try new format texts | ||
196 | file = token.last(); | ||
197 | title = indexLine.mid(0,72); | ||
198 | year = "1980"; | ||
199 | |||
200 | addItems(); //author and qlistview | ||
201 | } | ||
202 | } //end old etexts | ||
203 | |||
204 | } //end okToTRead | ||
187 | } | 205 | } |
188 | indexLib.close(); | 206 | indexLib.close(); |
189 | } else { | 207 | } else { |
190 | QString sMsg; | 208 | QString sMsg; |
191 | 209 | ||
192 | sMsg = ( tr("<p>Error opening library index file. Please download a new one.</P> ")); | 210 | sMsg = ( tr("<p>Error opening library index file. Please download a new one.</P> ")); |
193 | QMessageBox::message( "Error",sMsg); | 211 | QMessageBox::message( "Error",sMsg); |
194 | } | 212 | } |
213 | system("date"); | ||
214 | sortLists(0); | ||
215 | |||
195 | } //end Library() | 216 | } //end Library() |
196 | 217 | ||
197 | 218 | ||
198 | /* | 219 | /* |
199 | Groks the author out of the title */ | 220 | Groks the author out of the title */ |
200 | bool LibraryDialog::getAuthor() | 221 | bool LibraryDialog::getAuthor() |
201 | { | 222 | { |
202 | if( title.contains( ", by", true)) { | 223 | if( title.contains( ", by", true)) { |
203 | int auth; | 224 | int auth; |
204 | auth = title.find(", by", 0, true); | 225 | auth = title.find(", by", 0, true); |
205 | author = title.right(title.length() - (auth + 4) ); | 226 | author = title.right(title.length() - (auth + 4) ); |
206 | if( int finder = author.find("[", 0, true)) { | 227 | if( int finder = author.find("[", 0, true)) { |
207 | author = author.left(finder); | 228 | author = author.left(finder); |
208 | } | 229 | } |
209 | } | 230 | } |
210 | else if ( title.contains( "by, ", true) ) { | 231 | else if ( title.contains( "by, ", true) ) { |
211 | int auth; | 232 | int auth; |
212 | auth = title.find("by, ", 0, true); | 233 | auth = title.find("by, ", 0, true); |
213 | author = title.right(title.length() - (auth + 4) ); | 234 | author = title.right(title.length() - (auth + 4) ); |
214 | if( int finder = author.find("[", 0, true)) { | 235 | if( int finder = author.find("[", 0, true)) { |
215 | author = author.left( finder); | 236 | author = author.left( finder); |
216 | } | 237 | } |
217 | } | 238 | } |
218 | else if ( title.contains( " by", true) ) { | 239 | else if ( title.contains( " by", true) ) { |
219 | int auth; | 240 | int auth; |
220 | auth = title.find(" by", 0, true); | 241 | auth = title.find(" by", 0, true); |
221 | author = title.right(title.length() - (auth + 3) ); | 242 | author = title.right(title.length() - (auth + 3) ); |
222 | if( int finder = author.find("[", 0, true)) { | 243 | if( int finder = author.find("[", 0, true)) { |
223 | author = author.left( finder); | 244 | author = author.left( finder); |
224 | } | 245 | } |
225 | } | 246 | } |
226 | else if ( title.contains( "by ", true) ) { | 247 | else if ( title.contains( "by ", true) ) { |
227 | int auth; | 248 | int auth; |
228 | auth = title.find("by ", 0, true); | 249 | auth = title.find("by ", 0, true); |
229 | author = title.right(title.length() - (auth + 3) ); | 250 | author = title.right(title.length() - (auth + 3) ); |
230 | if( int finder = author.find("[", 0, true)) { | 251 | if( int finder = author.find("[", 0, true)) { |
231 | author = author.left( finder); | 252 | author = author.left( finder); |
232 | } | 253 | } |
233 | } | 254 | } |
234 | else if ( title.contains( ",", true) ) { | 255 | else if ( title.contains( ",", true) ) { |
235 | int auth; | 256 | int auth; |
236 | auth = title.find(",", 0, true); | 257 | auth = title.find(",", 0, true); |
237 | author = title.right( title.length() - (auth + 1) ); | 258 | author = title.right( title.length() - (auth + 1) ); |
238 | if ( author.contains( ",", true) ) { | 259 | if ( author.contains( ",", true) ) { |
239 | int auth; | 260 | int auth; |
240 | auth = author.find(",", 0, true); | 261 | auth = author.find(",", 0, true); |
241 | author = author.right( author.length() - (auth + 1) ); | 262 | author = author.right( author.length() - (auth + 1) ); |
242 | } | 263 | } |
243 | if( int finder = author.find("[", 0, true)) { | 264 | if( int finder = author.find("[", 0, true)) { |
244 | author = author.left( finder); | 265 | author = author.left( finder); |
245 | } | 266 | } |
246 | } | 267 | } |
247 | else if ( title.contains( "/", true) ) { | 268 | else if ( title.contains( "/", true) ) { |
248 | int auth; | 269 | int auth; |
249 | auth = title.find("/", 0, true); | 270 | auth = title.find("/", 0, true); |
250 | author = title.right(title.length() - (auth + 1) ); | 271 | author = title.right(title.length() - (auth + 1) ); |
251 | if( int finder = author.find("[", 0, true)) { | 272 | if( int finder = author.find("[", 0, true)) { |
252 | author = author.left( finder); | 273 | author = author.left( finder); |
253 | } | 274 | } |
254 | } | 275 | } |
255 | else if ( title.contains( "of", true) ) { | 276 | else if ( title.contains( "of", true) ) { |
256 | int auth; | 277 | int auth; |
257 | auth = title.find("of", 0, true); | 278 | auth = title.find("of", 0, true); |
258 | author = title.right(title.length() - (auth + 2) ); | 279 | author = title.right(title.length() - (auth + 2) ); |
259 | if( int finder = author.find("[", 0, true)) | 280 | if( int finder = author.find("[", 0, true)) |
260 | { | 281 | { |
261 | author = author.left( finder); | 282 | author = author.left( finder); |
262 | } | 283 | } |
263 | } else { | 284 | } else { |
264 | author = ""; | 285 | author = ""; |
265 | } | 286 | } |
266 | if ( author.contains("et. al")) { | 287 | if ( author.contains("et. al")) { |
267 | int auth; | 288 | int auth; |
268 | auth = author.find("et. al", 0, true); | 289 | auth = author.find("et. al", 0, true); |
269 | author = author.left( auth ); | 290 | author = author.left( auth ); |
270 | } | 291 | } |
271 | if ( author.contains("#")) { | 292 | if ( author.contains("#")) { |
272 | int auth; | 293 | int auth; |
273 | auth = author.find("#", 0, true); | 294 | auth = author.find("#", 0, true); |
274 | author = author.left( auth); | 295 | author = author.left( auth); |
275 | } | 296 | } |
276 | if ( author.contains("(")) { | 297 | if ( author.contains("(")) { |
277 | int auth; | 298 | int auth; |
278 | auth = author.find("(", 0, true); | 299 | auth = author.find("(", 0, true); |
279 | author = author.left( auth); | 300 | author = author.left( auth); |
280 | } | 301 | } |
281 | if ( author.contains("et al")) { | 302 | if ( author.contains("et al")) { |
282 | int auth; | 303 | int auth; |
283 | auth = author.find("et al", 0, true); | 304 | auth = author.find("et al", 0, true); |
284 | author = author.left( auth ); | 305 | author = author.left( auth ); |
285 | } | 306 | } |
286 | QRegExp r = QRegExp("[0-9]", true, false); | 307 | QRegExp r = QRegExp("[0-9]", true, false); |
287 | if ( author.left(2).find( r) != -1 ) { | 308 | if ( author.left(2).find( r) != -1 ) { |
288 | author = ""; | 309 | author = ""; |
289 | } | 310 | } |
290 | 311 | ||
291 | author = author.stripWhiteSpace(); | 312 | author = author.stripWhiteSpace(); |
292 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author | 313 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author |
293 | QString lastName, firstName=""; | 314 | QString lastName, firstName=""; |
294 | int finder = author.findRev( ' ', -1, TRUE); | 315 | int finder = author.findRev( ' ', -1, TRUE); |
295 | lastName = author.right( author.length()-finder); | 316 | lastName = author.right( author.length()-finder); |
296 | firstName = author.left(finder); | 317 | firstName = author.left(finder); |
297 | lastName = lastName.stripWhiteSpace(); | 318 | lastName = lastName.stripWhiteSpace(); |
298 | firstName = firstName.stripWhiteSpace(); | 319 | firstName = firstName.stripWhiteSpace(); |
299 | 320 | ||
300 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 321 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
301 | author = lastName+", "+firstName; | 322 | author = lastName+", "+firstName; |
302 | } | 323 | } |
303 | return true; | 324 | return true; |
304 | }////// end getAuthor() | 325 | }////// end getAuthor() |
305 | 326 | ||
306 | void LibraryDialog::addItems() { | 327 | void LibraryDialog::addItems() |
328 | { | ||
307 | cleanStrings(); | 329 | cleanStrings(); |
308 | getAuthor(); // grok author | 330 | getAuthor(); // grok author |
309 | if( !number.isEmpty() | 331 | |
310 | && (title.find( "reserved",0, FALSE) == -1) | 332 | etext etextStruct; |
333 | if( /*!number.isEmpty() | ||
334 | && */ | ||
335 | (title.find( "reserved",0, FALSE) == -1) | ||
311 | && (file.find( "]",0, true) == -1) | 336 | && (file.find( "]",0, true) == -1) |
312 | &&(title.find( "Audio",0, FALSE) == -1)) { | 337 | &&(title.find( "Audio",0, FALSE) == -1)) { |
313 | // qDebug("new item "+title); | 338 | // qDebug("new item "+title); |
314 | // fill string list or something to be able to sort by Author | 339 | // fill string list or something to be able to sort by Author |
340 | etextStruct.title = title; | ||
341 | etextStruct.author = author; | ||
342 | etextStruct.year = year; | ||
343 | etextStruct.file = file; | ||
344 | |||
345 | etextLibrary.append( etextStruct); | ||
346 | |||
315 | if( author.isEmpty() ) | 347 | if( author.isEmpty() ) |
316 | QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); | 348 | QList_Item5 = new QListViewItem( ListView5, /*number, */author, title, year, file ); |
317 | else { | 349 | else { |
318 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 350 | if( author.find(QRegExp("[^a-fA-F]")) ) |
319 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) | 351 | QList_Item1 = new QListViewItem( ListView1, /* number,*/author, title, year, file ); |
320 | QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); | ||
321 | 352 | ||
322 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || | 353 | else if(author.find(QRegExp("[^g-mG-M]")) ) |
323 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) | 354 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ author, title,year, file ); |
324 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); | ||
325 | 355 | ||
326 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || | 356 | else if(author.find(QRegExp("[^n-rN-R]")) ) |
327 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) | 357 | QList_Item3 = new QListViewItem( ListView3, /* number,*/ author, title, year, file ); |
328 | QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file ); | ||
329 | 358 | ||
330 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || | 359 | else if(author.find(QRegExp("[^s-zS-Z]")) ) |
331 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) | 360 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ author, title, year, file ); |
332 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); | ||
333 | } | 361 | } |
334 | } | 362 | } |
335 | } | 363 | } |
336 | 364 | ||
337 | /* | 365 | /* |
338 | selected one etext*/ | 366 | selected one etext*/ |
339 | void LibraryDialog::select_title( QListViewItem * item) | 367 | void LibraryDialog::select_title( QListViewItem * item) |
340 | { | 368 | { |
341 | if(item != NULL) { | 369 | if(item != NULL) { |
342 | i++; | 370 | i++; |
343 | int index = tabWidget->currentPageIndex(); | 371 | int index = tabWidget->currentPageIndex(); |
344 | DlglistItemTitle = item->text(0); | 372 | DlglistItemTitle = item->text(0); |
345 | DlglistItemYear = item->text(2); | 373 | DlglistItemYear = item->text(2); |
346 | DlglistItemFile = item->text(3); | 374 | DlglistItemFile = item->text(3); |
347 | 375 | ||
348 | switch (index) { | 376 | switch (index) { |
349 | case 0: { | 377 | case 0: { |
350 | ListView1->clearSelection(); | 378 | ListView1->clearSelection(); |
351 | } | 379 | } |
352 | break; | 380 | break; |
353 | case 1: { | 381 | case 1: { |
354 | ListView2->clearSelection(); | 382 | ListView2->clearSelection(); |
355 | } | 383 | } |
356 | break; | 384 | break; |
357 | case 2: { | 385 | case 2: { |
358 | ListView3->clearSelection(); | 386 | ListView3->clearSelection(); |
359 | } | 387 | } |
360 | break; | 388 | break; |
361 | case 3: { | 389 | case 3: { |
362 | ListView4->clearSelection(); | 390 | ListView4->clearSelection(); |
363 | } | 391 | } |
364 | break; | 392 | break; |
365 | case 4: { | 393 | case 4: { |
366 | ListView5->clearSelection(); | 394 | ListView5->clearSelection(); |
367 | } | 395 | } |
368 | break; | 396 | break; |
369 | }; | 397 | }; |
370 | } | 398 | } |
371 | 399 | ||
372 | if(DlglistItemTitle.length() > 2) { | 400 | if(DlglistItemTitle.length() > 2) { |
373 | item = 0; | 401 | item = 0; |
374 | // todo check for connection here | 402 | // todo check for connection here |
375 | 403 | ||
376 | bool ok = false; | 404 | bool ok = false; |
377 | qDebug(DlglistItemFile); | 405 | qDebug(DlglistItemFile); |
378 | 406 | ||
379 | if(DlglistItemFile.toInt() > 10000 ) { | 407 | if(DlglistItemFile.toInt() > 10000 ) { |
380 | // new directory sturcture | 408 | // new directory sturcture |
381 | if( download_newEtext()) | 409 | if( download_newEtext()) |
382 | ok = true; | 410 | ok = true; |
383 | } else { | 411 | } else { |
384 | if(download_Etext()) | 412 | if(download_Etext()) |
385 | ok = true; | 413 | ok = true; |
386 | } | 414 | } |
387 | if(ok) { | 415 | if(ok) { |
388 | if(checkBox->isChecked () ) | 416 | if(checkBox->isChecked () ) |
389 | accept(); | 417 | accept(); |
390 | } | 418 | } |
391 | } | 419 | } |
392 | } | 420 | } |
393 | 421 | ||
394 | bool LibraryDialog::download_newEtext() | 422 | bool LibraryDialog::download_newEtext() |
395 | { // ftp method | 423 | { // ftp method |
396 | QString fileName = DlglistItemFile; | 424 | QString fileName = DlglistItemFile; |
@@ -614,285 +642,234 @@ bool LibraryDialog::setTitle() | |||
614 | } | 642 | } |
615 | 643 | ||
616 | if(test == 0 ) { | 644 | if(test == 0 ) { |
617 | 645 | ||
618 | config.setGroup("Files"); | 646 | config.setGroup("Files"); |
619 | config.writeEntry( "NumberOfFiles", i_numofFiles +1 ); | 647 | config.writeEntry( "NumberOfFiles", i_numofFiles +1 ); |
620 | QString interger; | 648 | QString interger; |
621 | interger.setNum( i_numofFiles +1); | 649 | interger.setNum( i_numofFiles +1); |
622 | config.writeEntry( interger, File_Name); | 650 | config.writeEntry( interger, File_Name); |
623 | config.setGroup( "Titles" ); | 651 | config.setGroup( "Titles" ); |
624 | config.writeEntry( File_Name, DlglistItemTitle); | 652 | config.writeEntry( File_Name, DlglistItemTitle); |
625 | } | 653 | } |
626 | test = 0; | 654 | test = 0; |
627 | return true; | 655 | return true; |
628 | } | 656 | } |
629 | 657 | ||
630 | 658 | ||
631 | void LibraryDialog::saveConfig() | 659 | void LibraryDialog::saveConfig() |
632 | { | 660 | { |
633 | Config config("Gutenbrowser"); | 661 | Config config("Gutenbrowser"); |
634 | if( httpBox->isChecked() == true) { | 662 | if( httpBox->isChecked() == true) { |
635 | checked = 1; | 663 | checked = 1; |
636 | config.setGroup( "Proxy" ); | 664 | config.setGroup( "Proxy" ); |
637 | config.writeEntry("IsChecked", "true"); | 665 | config.writeEntry("IsChecked", "true"); |
638 | } else { | 666 | } else { |
639 | checked = 0; | 667 | checked = 0; |
640 | config.setGroup( "Proxy" ); | 668 | config.setGroup( "Proxy" ); |
641 | config.writeEntry("IsChecked", "false"); | 669 | config.writeEntry("IsChecked", "false"); |
642 | } | 670 | } |
643 | if (authBox->isChecked() == true) { | 671 | if (authBox->isChecked() == true) { |
644 | config.setGroup("SortAuth"); | 672 | config.setGroup("SortAuth"); |
645 | config.writeEntry("authSort", "true"); | 673 | config.writeEntry("authSort", "true"); |
646 | } else { | 674 | } else { |
647 | config.setGroup("SortAuth"); | 675 | config.setGroup("SortAuth"); |
648 | config.writeEntry("authSort", "false"); | 676 | config.writeEntry("authSort", "false"); |
649 | } | 677 | } |
650 | // config.write(); | 678 | // config.write(); |
651 | } | 679 | } |
652 | 680 | ||
653 | /* | 681 | /* |
654 | searches library index for user word*/ | 682 | searches library index for user word*/ |
655 | void LibraryDialog::onButtonSearch() | 683 | void LibraryDialog::onButtonSearch() |
656 | { | 684 | { |
657 | ListView1->clearSelection(); | 685 | ListView1->clearSelection(); |
658 | ListView2->clearSelection(); | 686 | ListView2->clearSelection(); |
659 | ListView3->clearSelection(); | 687 | ListView3->clearSelection(); |
660 | ListView4->clearSelection(); | 688 | ListView4->clearSelection(); |
661 | ListView5->clearSelection(); | 689 | ListView5->clearSelection(); |
662 | 690 | ||
663 | int curTab = tabWidget->currentPageIndex(); | 691 | int curTab = tabWidget->currentPageIndex(); |
664 | SearchDialog* searchDlg; | 692 | SearchDialog* searchDlg; |
665 | 693 | ||
666 | // if( resultsList) | 694 | // if( resultsList) |
667 | searchDlg = new SearchDialog( this, "Library Search", true); | 695 | searchDlg = new SearchDialog( this, "Library Search", true); |
668 | searchDlg->setCaption( tr( "Library Search" ) ); | 696 | searchDlg->setCaption( tr( "Library Search" ) ); |
669 | searchDlg->setLabel( "- author or title"); | 697 | searchDlg->setLabel( "- author or title"); |
670 | 698 | ||
671 | QString resultString; | 699 | QString resultString; |
672 | 700 | ||
673 | int i_berger = 0; | 701 | int i_berger = 0; |
674 | if( searchDlg->exec() != 0 ) { | 702 | if( searchDlg->exec() != 0 ) { |
675 | QString searcherStr = searchDlg->get_text(); | 703 | QString searcherStr = searchDlg->get_text(); |
676 | int fluff = 0; | 704 | int fluff = 0; |
677 | 705 | ||
678 | // int tabPage = tabWidget->currentPageIndex(); | ||
679 | // TODO ititerate here... struct<listViews>?? | ||
680 | |||
681 | QListViewItemIterator it1( ListView1 ); | ||
682 | QListViewItemIterator it2( ListView2 ); | ||
683 | QListViewItemIterator it3( ListView3 ); | ||
684 | QListViewItemIterator it4( ListView4 ); | ||
685 | QListViewItemIterator it5( ListView5 ); | ||
686 | |||
687 | //// this is really pitiful work, | ||
688 | /////// | ||
689 | bool cS; | 706 | bool cS; |
690 | if( searchDlg->caseSensitiveCheckBox->isChecked()) | 707 | if( searchDlg->caseSensitiveCheckBox->isChecked()) |
691 | cS=true; //case sensitive | 708 | cS = true; //case sensitive |
692 | else | 709 | else |
693 | cS=false; | 710 | cS = false; |
694 | 711 | ||
695 | if(fluff==0) { | 712 | etext etextStruct; |
696 | for ( ; it1.current(); ++it1 ) { | 713 | QValueList<etext>::Iterator it; |
697 | resultString = ( it1.current() )->text(0); | 714 | |
698 | resultString += (" : "); | 715 | for( it = etextLibrary.begin(); it != etextLibrary.end(); ++it ) { |
699 | resultString += ( it1.current() )->text(2); | 716 | QString tempTitle = (*it).title; |
700 | resultString += (" : "); | 717 | QString tempAuthor = (*it).author; |
701 | resultString += ( it1.current() )->text(3); | 718 | QString tempFile = (*it).file; |
702 | if( resultString.find( searcherStr, 0, cS) != -1) | 719 | QString tempYear = (*it).year; |
703 | { | 720 | if(tempTitle.find( searcherStr, 0, cS) != -1 |
704 | Searchlist.append( resultString); | 721 | || tempAuthor.find( searcherStr, 0, cS) != -1) { |
705 | } | 722 | qWarning(tempTitle); |
706 | } | 723 | Searchlist.append( tempTitle + " : " + tempYear + " : " + tempFile); |
707 | } | 724 | } |
708 | if(fluff==0) {// search routine here | 725 | } |
709 | for ( ; it2.current(); ++it2 ) { | 726 | |
710 | resultString = ( it2.current() )->text(0); | ||
711 | resultString += (" : "); | ||
712 | resultString += ( it2.current() )->text(2); | ||
713 | resultString += (" : "); | ||
714 | resultString += ( it2.current() )->text(3); | ||
715 | if( resultString.find( searcherStr, 0, cS) != -1) { | ||
716 | Searchlist.append( resultString); | ||
717 | } | ||
718 | } | ||
719 | } | ||
720 | if(fluff==0) {// search routine here | ||
721 | for ( ; it3.current(); ++it3 ) { | ||
722 | resultString = ( it3.current() )->text(0); | ||
723 | resultString += (" : "); | ||
724 | resultString += ( it3.current() )->text(2); | ||
725 | resultString += (" : "); | ||
726 | resultString += ( it3.current() )->text(3); | ||
727 | |||
728 | if( resultString.find( searcherStr, 0, cS) != -1) { | ||
729 | Searchlist.append( resultString); | ||
730 | } | ||
731 | } | ||
732 | } | ||
733 | if(fluff==0) { | ||
734 | // search routine here | ||
735 | for ( ; it4.current(); ++it4 ) { | ||
736 | resultString = ( it4.current() )->text(0); | ||
737 | resultString += (" : "); | ||
738 | resultString += ( it4.current() )->text(2); | ||
739 | resultString += (" : "); | ||
740 | resultString += ( it4.current() )->text(3); | ||
741 | if( resultString.find( searcherStr, 0, cS) != -1) { | ||
742 | Searchlist.append( resultString); | ||
743 | } | ||
744 | } | ||
745 | } | ||
746 | if(fluff==0) { // search routine here | ||
747 | for ( ; it5.current(); ++it5 ) { | ||
748 | resultString = ( it5.current() )->text(0); | ||
749 | resultString += (" : "); | ||
750 | resultString += ( it5.current() )->text(2); | ||
751 | resultString += (" : "); | ||
752 | resultString += ( it5.current() )->text(3); | ||
753 | if( resultString.find( searcherStr, 0, cS) != -1) { | ||
754 | Searchlist.append( resultString); | ||
755 | } | ||
756 | } | ||
757 | } | ||
758 | 727 | ||
759 | tabWidget->setCurrentPage( curTab); | 728 | tabWidget->setCurrentPage( curTab); |
760 | 729 | ||
761 | Searchlist.sort(); | 730 | Searchlist.sort(); |
762 | SearchResultsDlg* SearchResultsDialog; | 731 | SearchResultsDlg* SearchResultsDialog; |
763 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); | 732 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); |
764 | 733 | ||
765 | SearchResultsDialog->showMaximized(); | 734 | SearchResultsDialog->showMaximized(); |
766 | if( SearchResultsDialog->exec() != 0) { | 735 | if( SearchResultsDialog->exec() != 0) { |
767 | texter = SearchResultsDialog->selText; | 736 | texter = SearchResultsDialog->selText; |
768 | // //odebug << texter << oendl; | 737 | // //odebug << texter << oendl; |
769 | resultLs = SearchResultsDialog->resultsList; | 738 | resultLs = SearchResultsDialog->resultsList; |
770 | i_berger = 1; | 739 | i_berger = 1; |
771 | } else { | 740 | } else { |
772 | resultLs.clear(); | 741 | resultLs.clear(); |
773 | } | 742 | } |
774 | Searchlist.clear(); | 743 | Searchlist.clear(); |
775 | 744 | ||
776 | // if(SearchResultsDialog) | ||
777 | // delete SearchResultsDialog; | ||
778 | QString tester; | 745 | QString tester; |
779 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { | 746 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { |
780 | texter.sprintf("%s \n",(*it).latin1()); | 747 | texter.sprintf("%s \n",(*it).latin1()); |
781 | // //odebug << texter << oendl; | 748 | // //odebug << texter << oendl; |
782 | if( tester!=texter) | 749 | if( tester!=texter) |
783 | parseSearchResults( texter); | 750 | parseSearchResults( texter); |
784 | tester = texter; | 751 | tester = texter; |
785 | } | 752 | } |
786 | if(searchDlg) | 753 | if(searchDlg) |
787 | delete searchDlg; | 754 | delete searchDlg; |
788 | } | 755 | } |
789 | if(checkBox->isChecked() ) { | 756 | if(checkBox->isChecked() ) { |
790 | accept(); | 757 | accept(); |
791 | } else { | 758 | } else { |
792 | setActiveWindow(); | 759 | setActiveWindow(); |
793 | } | 760 | } |
794 | } | 761 | } |
795 | 762 | ||
796 | /* | 763 | /* |
797 | splits the result string and calls download for the current search result*/ | 764 | splits the result string and calls download for the current search result*/ |
798 | void LibraryDialog::parseSearchResults( QString resultStr) | 765 | void LibraryDialog::parseSearchResults( QString resultStr) |
799 | { | 766 | { |
800 | int stringLeng = resultStr.length(); | 767 | int stringLeng = resultStr.length(); |
801 | 768 | ||
802 | QString my; | 769 | QString my; |
803 | my.setNum( stringLeng, 10); | 770 | my.setNum( stringLeng, 10); |
804 | 771 | ||
805 | if( resultStr.length() > 2 && resultStr.length() < 130) { | 772 | if( resultStr.length() > 2 && resultStr.length() < 130) { |
806 | 773 | ||
807 | int titleInt = resultStr.find( " : ", 0, true); | 774 | int titleInt = resultStr.find( " : ", 0, true); |
808 | DlglistItemTitle = resultStr.left( titleInt); | 775 | DlglistItemTitle = resultStr.left( titleInt); |
809 | 776 | ||
810 | int yearInt = resultStr.find( " : ", titleInt+3, true); | 777 | int yearInt = resultStr.find( " : ", titleInt+3, true); |
811 | 778 | ||
812 | DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3); | 779 | DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3); |
813 | 780 | ||
814 | DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3)); | 781 | DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3)); |
815 | DlglistItemFile = DlglistItemFile.left( DlglistItemFile.length() - 2); | 782 | DlglistItemFile = DlglistItemFile.left( DlglistItemFile.length() - 2); |
816 | 783 | ||
817 | cleanStrings(); | 784 | cleanStrings(); |
818 | 785 | ||
819 | if(DlglistItemFile.left(1) == "/") | 786 | if(DlglistItemFile.left(1) == "/") |
820 | DlglistItemFile = DlglistItemFile.right( DlglistItemFile.length() - 1); | 787 | DlglistItemFile = DlglistItemFile.right( DlglistItemFile.length() - 1); |
821 | 788 | ||
822 | 789 | ||
823 | if(DlglistItemFile.toInt() > 10000 ) { | 790 | if(DlglistItemFile.toInt() > 10000 || yearInt == 1980 ) { |
824 | // new directory sturcture | 791 | // new directory sturcture |
825 | download_newEtext(); //) | 792 | download_newEtext(); //) |
826 | } else { | 793 | } else { |
827 | download_Etext(); //) | 794 | download_Etext(); //) |
828 | } | 795 | } |
829 | } | 796 | } |
830 | } | 797 | } |
831 | 798 | ||
832 | void LibraryDialog::sort() | 799 | void LibraryDialog::sortLists(int index) |
833 | { | 800 | { |
834 | 801 | ||
802 | ListView1->setSorting(index); | ||
803 | ListView2->setSorting(index); | ||
804 | ListView3->setSorting(index); | ||
805 | ListView4->setSorting(index); | ||
806 | ListView5->setSorting(index); | ||
807 | ListView1->sort(); | ||
808 | ListView2->sort(); | ||
809 | ListView3->sort(); | ||
810 | ListView4->sort(); | ||
811 | ListView5->sort(); | ||
835 | } | 812 | } |
836 | 813 | ||
837 | /* | 814 | /* |
838 | Downloads the current selected listitem*/ | 815 | Downloads the current selected listitem*/ |
839 | bool LibraryDialog::getItem(QListViewItem *it) | 816 | bool LibraryDialog::getItem(QListViewItem *it) |
840 | { | 817 | { |
841 | // //odebug << "selected getItem" << oendl; | 818 | // //odebug << "selected getItem" << oendl; |
842 | 819 | ||
843 | // DlglistItemNumber = it->text(0); | 820 | // DlglistItemNumber = it->text(0); |
844 | DlglistItemTitle = it->text(0); | 821 | DlglistItemTitle = it->text(0); |
845 | DlglistItemYear = it->text(2); | 822 | DlglistItemYear = it->text(2); |
846 | DlglistItemFile = it->text(3); | 823 | DlglistItemFile = it->text(3); |
847 | 824 | ||
848 | if(download_Etext()) { | 825 | if(download_Etext()) { |
849 | if(i_binary == 1) { | 826 | if(i_binary == 1) { |
850 | } | 827 | } |
851 | } | 828 | } |
852 | return true; | 829 | return true; |
853 | } | 830 | } |
854 | 831 | ||
855 | /* | 832 | /* |
856 | download button is pushed so we get the current items to download*/ | 833 | download button is pushed so we get the current items to download*/ |
857 | bool LibraryDialog::onButtonDownload() | 834 | bool LibraryDialog::onButtonDownload() |
858 | { | 835 | { |
859 | // //odebug << "selected onButtonDownloadz" << oendl; | 836 | // //odebug << "selected onButtonDownloadz" << oendl; |
860 | 837 | ||
861 | QListViewItemIterator it1( ListView1 ); | 838 | QListViewItemIterator it1( ListView1 ); |
862 | QListViewItemIterator it2( ListView2 ); | 839 | QListViewItemIterator it2( ListView2 ); |
863 | QListViewItemIterator it3( ListView3 ); | 840 | QListViewItemIterator it3( ListView3 ); |
864 | QListViewItemIterator it4( ListView4 ); | 841 | QListViewItemIterator it4( ListView4 ); |
865 | QListViewItemIterator it5( ListView5 ); | 842 | QListViewItemIterator it5( ListView5 ); |
866 | 843 | ||
867 | // iterate through all items of the listview | 844 | // iterate through all items of the listview |
868 | for ( ; it1.current(); ++it1 ) { | 845 | for ( ; it1.current(); ++it1 ) { |
869 | if ( it1.current()->isSelected() ) | 846 | if ( it1.current()->isSelected() ) |
870 | getItem(it1.current()); | 847 | getItem(it1.current()); |
871 | it1.current()->setSelected(false); | 848 | it1.current()->setSelected(false); |
872 | } | 849 | } |
873 | for ( ; it2.current(); ++it2 ) { | 850 | for ( ; it2.current(); ++it2 ) { |
874 | if ( it2.current()->isSelected() ) | 851 | if ( it2.current()->isSelected() ) |
875 | getItem(it2.current()); | 852 | getItem(it2.current()); |
876 | it2.current()->setSelected(false); | 853 | it2.current()->setSelected(false); |
877 | } | 854 | } |
878 | for ( ; it3.current(); ++it3 ) { | 855 | for ( ; it3.current(); ++it3 ) { |
879 | if ( it3.current()->isSelected() ) | 856 | if ( it3.current()->isSelected() ) |
880 | getItem(it3.current()); | 857 | getItem(it3.current()); |
881 | it3.current()->setSelected(false); | 858 | it3.current()->setSelected(false); |
882 | } | 859 | } |
883 | for ( ; it4.current(); ++it4 ) { | 860 | for ( ; it4.current(); ++it4 ) { |
884 | if ( it4.current()->isSelected() ) | 861 | if ( it4.current()->isSelected() ) |
885 | getItem(it4.current()); | 862 | getItem(it4.current()); |
886 | it4.current()->setSelected(false); | 863 | it4.current()->setSelected(false); |
887 | } | 864 | } |
888 | for ( ; it5.current(); ++it5 ) { | 865 | for ( ; it5.current(); ++it5 ) { |
889 | if ( it5.current()->isSelected() ) | 866 | if ( it5.current()->isSelected() ) |
890 | getItem(it5.current()); | 867 | getItem(it5.current()); |
891 | it5.current()->setSelected(false); | 868 | it5.current()->setSelected(false); |
892 | } | 869 | } |
893 | return true; | 870 | return true; |
894 | } | 871 | } |
895 | 872 | ||
896 | 873 | ||
897 | /* | 874 | /* |
898 | handles the sorting combo box */ | 875 | handles the sorting combo box */ |
@@ -989,81 +966,87 @@ bool LibraryDialog::moreInfo() | |||
989 | item = 0; | 966 | item = 0; |
990 | } | 967 | } |
991 | if( item == 0) | 968 | if( item == 0) |
992 | item = ListView2->currentItem(); | 969 | item = ListView2->currentItem(); |
993 | if( item != 0) { | 970 | if( item != 0) { |
994 | titleString = item->text(0); | 971 | titleString = item->text(0); |
995 | ListView2->clearSelection(); | 972 | ListView2->clearSelection(); |
996 | item = 0; | 973 | item = 0; |
997 | } | 974 | } |
998 | if( item == 0) | 975 | if( item == 0) |
999 | item = ListView3->currentItem(); | 976 | item = ListView3->currentItem(); |
1000 | if( item != 0) { | 977 | if( item != 0) { |
1001 | titleString = item->text(0); | 978 | titleString = item->text(0); |
1002 | ListView3->clearSelection(); | 979 | ListView3->clearSelection(); |
1003 | item = 0; | 980 | item = 0; |
1004 | } | 981 | } |
1005 | if( item == 0) | 982 | if( item == 0) |
1006 | item = ListView4->currentItem(); | 983 | item = ListView4->currentItem(); |
1007 | if( item != 0) { | 984 | if( item != 0) { |
1008 | titleString = item->text(0); | 985 | titleString = item->text(0); |
1009 | ListView4->clearSelection(); | 986 | ListView4->clearSelection(); |
1010 | item = 0; | 987 | item = 0; |
1011 | } | 988 | } |
1012 | if( item == 0) | 989 | if( item == 0) |
1013 | item = ListView5->currentItem(); | 990 | item = ListView5->currentItem(); |
1014 | if( item != 0) { | 991 | if( item != 0) { |
1015 | titleString = item->text(0); | 992 | titleString = item->text(0); |
1016 | ListView5->clearSelection(); | 993 | ListView5->clearSelection(); |
1017 | item = 0; | 994 | item = 0; |
1018 | } | 995 | } |
1019 | item=0; | 996 | item=0; |
1020 | if(titleString.length()>2) { | 997 | if(titleString.length()>2) { |
1021 | //odebug << "Title is "+titleString << oendl; | 998 | //odebug << "Title is "+titleString << oendl; |
1022 | titleString.replace( QRegExp("\\s"), "%20"); | 999 | titleString.replace( QRegExp("\\s"), "%20"); |
1023 | titleString.replace( QRegExp("'"), "%20"); | 1000 | titleString.replace( QRegExp("'"), "%20"); |
1024 | titleString.replace( QRegExp("\""), "%20"); | 1001 | titleString.replace( QRegExp("\""), "%20"); |
1025 | titleString.replace( QRegExp("&"), "%20"); | 1002 | titleString.replace( QRegExp("&"), "%20"); |
1026 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; | 1003 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; |
1027 | cmd="opera "+cmd; | 1004 | cmd="opera "+cmd; |
1028 | system(cmd); | 1005 | system(cmd); |
1029 | } else | 1006 | } else |
1030 | QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>"); | 1007 | QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>"); |
1031 | return true; | 1008 | return true; |
1032 | 1009 | ||
1033 | } | 1010 | } |
1034 | 1011 | ||
1035 | /* | 1012 | /* |
1036 | This loads the library Index*/ | 1013 | This loads the library Index*/ |
1037 | void LibraryDialog::FindLibrary() | 1014 | void LibraryDialog::FindLibrary() |
1038 | { | 1015 | { |
1039 | buttonLibrary->setDown(true); | 1016 | buttonLibrary->setDown(true); |
1040 | 1017 | ||
1041 | qApp->processEvents(); | 1018 | qApp->processEvents(); |
1042 | if( QFile( new_index).exists() /* && this->isHidden() */) { | 1019 | if( QFile( new_index).exists() /* && this->isHidden() */) { |
1043 | newindexLib.setName( new_index); | 1020 | newindexLib.setName( new_index); |
1044 | indexLib.setName( new_index); | 1021 | indexLib.setName( new_index); |
1045 | //odebug << "index file is "+ new_index << oendl; | 1022 | //odebug << "index file is "+ new_index << oendl; |
1046 | Newlibrary(); | 1023 | Newlibrary(); |
1047 | } else { | 1024 | } else { |
1048 | newindexLib.setName( old_index); | 1025 | newindexLib.setName( old_index); |
1049 | indexLib.setName( old_index); | 1026 | indexLib.setName( old_index); |
1050 | //odebug << "new index nameis "+ old_index << oendl; | 1027 | //odebug << "new index nameis "+ old_index << oendl; |
1051 | Library(); | 1028 | Library(); |
1052 | } | 1029 | } |
1053 | indexLoaded=true; | 1030 | indexLoaded =true; |
1054 | buttonSearch->setEnabled(true); | 1031 | buttonSearch->setEnabled(true); |
1055 | moreInfoButton->setEnabled(true); | 1032 | moreInfoButton->setEnabled(true); |
1056 | 1033 | ||
1057 | buttonLibrary->setDown(false); | 1034 | buttonLibrary->setDown(false); |
1058 | buttonNewList->setText("Download"); | 1035 | buttonNewList->setText("Download"); |
1059 | qApp->processEvents(); | 1036 | qApp->processEvents(); |
1060 | 1037 | ||
1061 | } | 1038 | } |
1062 | 1039 | ||
1063 | void LibraryDialog::cleanStrings() { | 1040 | void LibraryDialog::cleanStrings() { |
1064 | year = year.stripWhiteSpace(); | 1041 | year = year.stripWhiteSpace(); |
1065 | file = file.stripWhiteSpace(); | 1042 | file = file.stripWhiteSpace(); |
1066 | title = title.stripWhiteSpace(); | 1043 | title = title.stripWhiteSpace(); |
1067 | number = number.stripWhiteSpace(); | 1044 | number = number.stripWhiteSpace(); |
1068 | 1045 | ||
1069 | } | 1046 | } |
1047 | |||
1048 | void LibraryDialog::authBoxClicked() | ||
1049 | { | ||
1050 | qApp->processEvents(); | ||
1051 | FindLibrary(); | ||
1052 | } | ||
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.h b/noncore/apps/opie-gutenbrowser/LibraryDialog.h index 8d6352f..95226b2 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.h +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.h | |||
@@ -1,133 +1,146 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | LibraryDialog.h - description | 2 | LibraryDialog.h - 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 | * 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 | #ifndef LIBRARYDIALOG_H | 12 | #ifndef LIBRARYDIALOG_H |
13 | #define LIBRARYDIALOG_H | 13 | #define LIBRARYDIALOG_H |
14 | 14 | ||
15 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
16 | 16 | ||
17 | #include "SearchDialog.h" | 17 | #include "SearchDialog.h" |
18 | #include "NetworkDialog.h" | 18 | #include "NetworkDialog.h" |
19 | #include <qstringlist.h> | 19 | #include <qstringlist.h> |
20 | #include <qdialog.h> | 20 | #include <qdialog.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qfile.h> | 23 | #include <qfile.h> |
24 | #include <qheader.h> | 24 | #include <qheader.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qmessagebox.h> | 26 | #include <qmessagebox.h> |
27 | #include <qregexp.h> | 27 | #include <qregexp.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qvaluelist.h> | ||
33 | 34 | ||
34 | class QVBoxLayout; | 35 | class QVBoxLayout; |
35 | class QHBoxLayout; | 36 | class QHBoxLayout; |
36 | class QGridLayout; | 37 | class QGridLayout; |
37 | class QListView; | 38 | class QListView; |
38 | class QListViewItem; | 39 | class QListViewItem; |
39 | class QPushButton; | 40 | class QPushButton; |
40 | //class QTabWidget; | 41 | //class QTabWidget; |
41 | class QWidget; | 42 | class QWidget; |
42 | //class Gutenbrowser; | 43 | //class Gutenbrowser; |
43 | 44 | ||
45 | typedef struct { | ||
46 | QString title; | ||
47 | QString author; | ||
48 | QString year; | ||
49 | QString file; | ||
50 | } etext; | ||
51 | |||
52 | |||
44 | class LibraryDialog : public QDialog { | 53 | class LibraryDialog : public QDialog { |
45 | Q_OBJECT | 54 | Q_OBJECT |
46 | 55 | ||
47 | public: | 56 | public: |
48 | LibraryDialog( QWidget* parent = 0, const char* name = 0 , bool modal = TRUE, WFlags fl = 0 ); | 57 | LibraryDialog( QWidget* parent = 0, const char* name = 0 , bool modal = TRUE, WFlags fl = 0 ); |
49 | ~LibraryDialog(); | 58 | ~LibraryDialog(); |
50 | 59 | ||
51 | QTabWidget *tabWidget; | 60 | QTabWidget *tabWidget; |
52 | QListView *ListView1,*ListView2,*ListView3,*ListView4,*ListView5; | 61 | QListView *ListView1,*ListView2,*ListView3,*ListView4,*ListView5; |
53 | QWidget *widget_1,*widget_2,*widget_3,*widget_4,*widget_5,*widget_6; | 62 | QWidget *widget_1,*widget_2,*widget_3,*widget_4,*widget_5,*widget_6; |
54 | QString ftp_host,ftp_base_dir; | 63 | QString ftp_host,ftp_base_dir; |
55 | QLabel *statusLabel; | 64 | QLabel *statusLabel; |
56 | QListViewItem *QList_Item1,*QList_Item2,*QList_Item3,*QList_Item4,*QList_Item5; | 65 | QListViewItem *QList_Item1,*QList_Item2,*QList_Item3,*QList_Item4,*QList_Item5; |
57 | QStringList list,ItemStrlist,Searchlist,resultLs; | 66 | QStringList list,ItemStrlist,Searchlist,resultLs; |
58 | // QStringList list1,list2,list3,list4; | 67 | // QStringList list1,list2,list3,list4; |
59 | 68 | ||
60 | QPushButton *buttonSearch,*buttonCancel,*buttonDownload,*buttonLibrary,*buttonNewList,*moreInfoButton; | 69 | QPushButton *buttonSearch,*buttonCancel,*buttonDownload,*buttonLibrary,*buttonNewList,*moreInfoButton; |
61 | QString new_index,old_index; | 70 | QString new_index,old_index; |
62 | QFile newindexLib,indexLib; | 71 | QFile newindexLib,indexLib; |
63 | 72 | ||
64 | int checked; | 73 | int checked; |
65 | int i_binary; | 74 | int i_binary; |
66 | bool useSmallInterface; | 75 | bool useSmallInterface; |
67 | bool indexLoaded; | 76 | bool indexLoaded; |
68 | QPushButton *cancel,*DownloadAll; | 77 | QPushButton *cancel,*DownloadAll; |
69 | QCheckBox *checkBox,*httpBox,*authBox; | 78 | QCheckBox *checkBox,*httpBox,*authBox; |
70 | // QCheckBox * httpBox; | 79 | // QCheckBox * httpBox; |
71 | 80 | ||
72 | QString filename; | 81 | QString filename; |
73 | QString downDir; | 82 | QString downDir; |
74 | int ftpNumb; | 83 | int ftpNumb; |
75 | int i; | 84 | int i; |
76 | QString year,title,number,file,author; | 85 | QString year,title,number,file,author; |
77 | QString DlglistItemNumber,DlglistItemFile,DlglistItemYear,DlglistItemTitle,NewlistItemFile; | 86 | QString DlglistItemNumber,DlglistItemFile,DlglistItemYear,DlglistItemTitle,NewlistItemFile; |
78 | QString m_getFilePath; | 87 | QString m_getFilePath; |
79 | QString Edir; | 88 | QString Edir; |
80 | 89 | ||
81 | QString index; | 90 | QString index; |
82 | QString IDontKnowWhy; | 91 | QString IDontKnowWhy; |
83 | QString local_library; | 92 | QString local_library; |
84 | QString local_index; | 93 | QString local_index; |
85 | QString File_Name; | 94 | QString File_Name; |
86 | QString proxy_http; | 95 | QString proxy_http; |
87 | int doitAll; | 96 | int doitAll; |
88 | QString texter; | 97 | QString texter; |
89 | // CConfigFile *config; | 98 | // CConfigFile *config; |
90 | void parseSearchResults( QString resultStr); | 99 | void parseSearchResults( QString resultStr); |
91 | 100 | ||
92 | public slots: | 101 | public slots: |
93 | bool getItem(QListViewItem* ); | 102 | bool getItem(QListViewItem* ); |
94 | void doListView(); | 103 | void doListView(); |
95 | void FindLibrary(); | 104 | void FindLibrary(); |
96 | void newList(); | 105 | void newList(); |
97 | void Newlibrary(); | 106 | void Newlibrary(); |
98 | void Library(); | 107 | void Library(); |
99 | bool getAuthor(); | 108 | bool getAuthor(); |
100 | void select_title(QListViewItem*); | 109 | void select_title(QListViewItem*); |
101 | void cancelIt(); | 110 | void cancelIt(); |
102 | void sort(); | 111 | void sortLists(int); |
103 | bool moreInfo(); | 112 | bool moreInfo(); |
104 | // void DownloadEmAll(); | 113 | // void DownloadEmAll(); |
105 | bool httpDownload(); | 114 | bool httpDownload(); |
106 | bool setTitle(); | 115 | bool setTitle(); |
107 | void saveConfig(); | 116 | void saveConfig(); |
108 | bool download_Etext(); | 117 | bool download_Etext(); |
109 | bool download_newEtext(); | 118 | bool download_newEtext(); |
110 | 119 | ||
111 | void onButtonSearch(); | 120 | void onButtonSearch(); |
112 | bool onButtonDownload(); | 121 | bool onButtonDownload(); |
113 | 122 | ||
114 | // bool UnzipIt( QString fileName); | 123 | // bool UnzipIt( QString fileName); |
115 | void comboSelect(int index); | 124 | void comboSelect(int index); |
116 | protected slots: | 125 | protected slots: |
117 | 126 | ||
118 | 127 | ||
119 | protected: | 128 | protected: |
120 | 129 | ||
130 | QValueList<etext> etextLibrary; | ||
131 | |||
121 | void initDialog(); | 132 | void initDialog(); |
122 | QHBoxLayout *hbox,*hbox1,*hbox2; | 133 | QHBoxLayout *hbox,*hbox1,*hbox2; |
123 | QVBoxLayout *vbox; | 134 | QVBoxLayout *vbox; |
124 | // void search_slot(); | 135 | // void search_slot(); |
125 | private: | 136 | private: |
126 | void addItems(); | 137 | void addItems(); |
127 | void clearItems(); | 138 | void clearItems(); |
128 | void cleanStrings(); | 139 | void cleanStrings(); |
129 | bool getEtext(const QStringList &); | 140 | bool getEtext(const QStringList &); |
141 | private slots: | ||
142 | void authBoxClicked(); | ||
130 | 143 | ||
131 | }; | 144 | }; |
132 | 145 | ||
133 | #endif // LIBRARYDIALOG_H | 146 | #endif // LIBRARYDIALOG_H |
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp index 60c1c75..bfbf84d 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp | |||
@@ -11,272 +11,246 @@ LibraryDialogData.cpp - description | |||
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 | #include "LibraryDialog.h" | 15 | #include "LibraryDialog.h" |
16 | #include <qpe/config.h> | 16 | #include <qpe/config.h> |
17 | 17 | ||
18 | #include <qpushbutton.h> | 18 | #include <qpushbutton.h> |
19 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
20 | #include <qwidget.h> | 20 | #include <qwidget.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | 22 | ||
23 | #include <qimage.h> | 23 | #include <qimage.h> |
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qtooltip.h> | 27 | #include <qtooltip.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qheader.h> | 32 | #include <qheader.h> |
33 | #include <qlistview.h> | 33 | #include <qlistview.h> |
34 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | 42 | ||
43 | 43 | ||
44 | void LibraryDialog::initDialog(){ | 44 | void LibraryDialog::initDialog(){ |
45 | 45 | ||
46 | 46 | ||
47 | QGridLayout *layout = new QGridLayout( this ); | 47 | QGridLayout *layout = new QGridLayout( this ); |
48 | layout->setSpacing(2); | 48 | layout->setSpacing(2); |
49 | layout->setMargin(4); | 49 | layout->setMargin(4); |
50 | 50 | ||
51 | tabWidget = new QTabWidget( this, "tabWidget" ); | 51 | tabWidget = new QTabWidget( this, "tabWidget" ); |
52 | layout->addMultiCellWidget( tabWidget, 0, 0, 0, 3); | 52 | layout->addMultiCellWidget( tabWidget, 0, 0, 0, 3); |
53 | 53 | ||
54 | widget_1 = new QWidget( tabWidget, "widget" ); | 54 | widget_1 = new QWidget( tabWidget, "widget" ); |
55 | ListView1 = new QListView( widget_1, "ListView1" ); | 55 | ListView1 = new QListView( widget_1, "ListView1" ); |
56 | QGridLayout *layout1 = new QGridLayout(widget_1 ); | 56 | QGridLayout *layout1 = new QGridLayout(widget_1 ); |
57 | 57 | ||
58 | widget_2 = new QWidget( tabWidget, "widget_2" ); | 58 | widget_2 = new QWidget( tabWidget, "widget_2" ); |
59 | ListView2 = new QListView( widget_2, "ListView2" ); | 59 | ListView2 = new QListView( widget_2, "ListView2" ); |
60 | QGridLayout *layout2 = new QGridLayout(widget_2 ); | 60 | QGridLayout *layout2 = new QGridLayout(widget_2 ); |
61 | 61 | ||
62 | widget_3 = new QWidget( tabWidget, "widget_3" ); | 62 | widget_3 = new QWidget( tabWidget, "widget_3" ); |
63 | ListView3 = new QListView( widget_3, "ListView3" ); | 63 | ListView3 = new QListView( widget_3, "ListView3" ); |
64 | QGridLayout *layout3 = new QGridLayout(widget_3 ); | 64 | QGridLayout *layout3 = new QGridLayout(widget_3 ); |
65 | 65 | ||
66 | widget_4 = new QWidget( tabWidget, "widget_4" ); | 66 | widget_4 = new QWidget( tabWidget, "widget_4" ); |
67 | ListView4 = new QListView( widget_4, "ListView4" ); | 67 | ListView4 = new QListView( widget_4, "ListView4" ); |
68 | QGridLayout *layout4 = new QGridLayout(widget_4 ); | 68 | QGridLayout *layout4 = new QGridLayout(widget_4 ); |
69 | 69 | ||
70 | widget_5 = new QWidget( tabWidget, "widget_5" ); | 70 | widget_5 = new QWidget( tabWidget, "widget_5" ); |
71 | ListView5 = new QListView( widget_5, "ListView5" ); | 71 | ListView5 = new QListView( widget_5, "ListView5" ); |
72 | QGridLayout *layout5 = new QGridLayout(widget_5 ); | 72 | QGridLayout *layout5 = new QGridLayout(widget_5 ); |
73 | 73 | ||
74 | 74 | ||
75 | ListView1->addColumn( tr( "Title" ) ); | 75 | ListView1->addColumn( tr( "Author" ), -1 ); |
76 | ListView1->setColumnWidthMode( 0, QListView::Manual ); | 76 | ListView1->setColumnAlignment( 1, 1 ); |
77 | ListView1->setColumnWidth(0, 330); | 77 | |
78 | ListView1->addColumn( tr( "Title" ), -1 ); | ||
78 | ListView1->setColumnAlignment( 0, 1 ); | 79 | ListView1->setColumnAlignment( 0, 1 ); |
79 | 80 | ||
80 | ListView1->addColumn( tr( "Author" ) ); | ||
81 | ListView1->setColumnWidthMode( 1, QListView::Manual ); | ||
82 | ListView1->setColumnWidth(1, 170); | ||
83 | ListView1->setColumnAlignment( 1, 1 ); | ||
84 | 81 | ||
85 | ListView1->addColumn( tr( "Year" ) ); | 82 | ListView1->addColumn( tr( "Year" ) ); |
86 | ListView1->setColumnWidthMode( 2, QListView::Manual ); | 83 | ListView1->setColumnWidthMode( 2, QListView::Manual ); |
87 | ListView1->setColumnWidth(2, 50); | ||
88 | ListView1->setColumnAlignment( 2, 1 ); | 84 | ListView1->setColumnAlignment( 2, 1 ); |
89 | 85 | ||
90 | ListView1->addColumn( tr( "File" ) ); | 86 | ListView1->addColumn( tr( "File" ), -1 ); |
91 | ListView1->setColumnWidthMode( 2, QListView::Manual ); | 87 | ListView1->setColumnWidthMode( 2, QListView::Manual ); |
92 | ListView1->setColumnWidth(2, 100); | ||
93 | ListView1->setColumnAlignment( 2, 1 ); | ||
94 | 88 | ||
95 | ListView2->addColumn( tr( "Title" ) ); | 89 | ListView1->setColumnAlignment( 2, 1 ); |
96 | ListView2->setColumnWidthMode( 0, QListView::Manual ); | ||
97 | ListView2->setColumnWidth(0, 330); | ||
98 | ListView2->setColumnAlignment( 0, 1 ); | ||
99 | 90 | ||
100 | ListView2->addColumn( tr( "Author" ) ); | 91 | ListView2->addColumn( tr( "Author" ), -1 ); |
101 | ListView2->setColumnWidthMode( 1, QListView::Manual ); | ||
102 | ListView2->setColumnWidth(1, 170); | ||
103 | ListView2->setColumnAlignment( 1, 1 ); | 92 | ListView2->setColumnAlignment( 1, 1 ); |
104 | 93 | ||
105 | ListView2->addColumn( tr( "Year" ) ); | 94 | ListView2->addColumn( tr( "Title" ), -1); |
95 | ListView2->setColumnAlignment( 0, 1 ); | ||
96 | |||
97 | ListView2->addColumn( tr( "Year" ), -1 ); | ||
106 | ListView2->setColumnWidthMode( 2, QListView::Manual ); | 98 | ListView2->setColumnWidthMode( 2, QListView::Manual ); |
107 | ListView2->setColumnWidth(2, 50); | ||
108 | ListView2->setColumnAlignment( 2, 1 ); | 99 | ListView2->setColumnAlignment( 2, 1 ); |
109 | 100 | ||
110 | ListView2->addColumn( tr( "File" ) ); | 101 | ListView2->addColumn( tr( "File" ), -1 ); |
111 | ListView2->setColumnWidthMode( 3, QListView::Manual ); | 102 | ListView2->setColumnWidthMode( 3, QListView::Manual ); |
112 | ListView2->setColumnWidth(3, 100); | ||
113 | ListView2->setColumnAlignment( 3, 1 ); | 103 | ListView2->setColumnAlignment( 3, 1 ); |
114 | 104 | ||
115 | ListView3->addColumn( tr( "Title" ) ); | 105 | ListView3->addColumn( tr( "Author" ), -1 ); |
116 | ListView3->setColumnWidthMode( 0, QListView::Manual ); | 106 | ListView3->setColumnAlignment( 1, 1 ); |
117 | ListView3->setColumnWidth(0, 330); | 107 | |
108 | ListView3->addColumn( tr( "Title" ), -1 ); | ||
118 | ListView3->setColumnAlignment( 0, 1 ); | 109 | ListView3->setColumnAlignment( 0, 1 ); |
119 | 110 | ||
120 | ListView3->addColumn( tr( "Author" ) ); | ||
121 | ListView3->setColumnWidthMode( 1, QListView::Manual ); | ||
122 | ListView3->setColumnWidth(1, 170); | ||
123 | ListView3->setColumnAlignment( 1, 1 ); | ||
124 | 111 | ||
125 | ListView3->addColumn( tr( "Year" ) ); | 112 | ListView3->addColumn( tr( "Year" ), -1 ); |
126 | ListView3->setColumnWidthMode( 2, QListView::Manual ); | 113 | ListView3->setColumnWidthMode( 2, QListView::Manual ); |
127 | ListView3->setColumnWidth(2, 50); | ||
128 | ListView3->setColumnAlignment( 2, 1 ); | 114 | ListView3->setColumnAlignment( 2, 1 ); |
129 | 115 | ||
130 | ListView3->addColumn( tr( "File" ) ); | 116 | ListView3->addColumn( tr( "File" ), -1 ); |
131 | ListView3->setColumnWidthMode( 3, QListView::Manual ); | 117 | ListView3->setColumnWidthMode( 3, QListView::Manual ); |
132 | ListView3->setColumnWidth(3, 100); | ||
133 | ListView3->setColumnAlignment( 3, 1 ); | 118 | ListView3->setColumnAlignment( 3, 1 ); |
134 | 119 | ||
135 | 120 | ||
136 | ListView4->addColumn( tr( "Title" ) ); | 121 | ListView4->addColumn( tr( "Author" ), -1 ); |
137 | ListView4->setColumnWidthMode( 0, QListView::Manual ); | ||
138 | ListView4->setColumnWidth(0, 330); | ||
139 | ListView4->setColumnAlignment( 0, 1 ); | ||
140 | |||
141 | ListView4->addColumn( tr( "Author" ) ); | ||
142 | ListView4->setColumnWidthMode( 1, QListView::Manual ); | ||
143 | ListView4->setColumnWidth(1, 170); | ||
144 | ListView4->setColumnAlignment( 1, 1 ); | 122 | ListView4->setColumnAlignment( 1, 1 ); |
123 | ListView4->addColumn( tr( "Title" ), -1 ); | ||
124 | ListView4->setColumnAlignment( 0, 1 ); | ||
145 | 125 | ||
146 | ListView4->addColumn( tr( "Year" ) ); | 126 | ListView4->addColumn( tr( "Year" ), -1 ); |
147 | ListView4->setColumnWidthMode( 2, QListView::Manual ); | 127 | ListView4->setColumnWidthMode( 2, QListView::Manual ); |
148 | ListView4->setColumnWidth(2, 50); | ||
149 | ListView4->setColumnAlignment( 2, 1 ); | 128 | ListView4->setColumnAlignment( 2, 1 ); |
150 | 129 | ||
151 | ListView4->addColumn( tr( "File" ) ); | 130 | ListView4->addColumn( tr( "File" ), -1 ); |
152 | ListView4->setColumnWidthMode( 3, QListView::Manual ); | 131 | ListView4->setColumnWidthMode( 3, QListView::Manual ); |
153 | ListView4->setColumnWidth(3, 100); | ||
154 | ListView4->setColumnAlignment( 3, 1 ); | 132 | ListView4->setColumnAlignment( 3, 1 ); |
155 | 133 | ||
156 | ListView5->addColumn( tr( "Title" ) ); | 134 | ListView5->addColumn( tr( "Author" ), -1 ); |
157 | ListView5->setColumnWidthMode( 0, QListView::Manual ); | 135 | ListView5->setColumnAlignment( 1, 1 ); |
158 | ListView5->setColumnWidth(0, 330); | 136 | |
137 | ListView5->addColumn( tr( "Title" ), -1 ); | ||
159 | ListView5->setColumnAlignment( 0, 1 ); | 138 | ListView5->setColumnAlignment( 0, 1 ); |
160 | 139 | ||
161 | ListView5->addColumn( tr( "Author" ) ); | ||
162 | ListView5->setColumnWidthMode( 1, QListView::Manual ); | ||
163 | ListView5->setColumnWidth(1, 170); | ||
164 | ListView5->setColumnAlignment( 1, 1 ); | ||
165 | 140 | ||
166 | ListView5->addColumn( tr( "Year" ) ); | 141 | ListView5->addColumn( tr( "Year" ), -1 ); |
167 | ListView5->setColumnWidthMode( 2, QListView::Manual ); | 142 | ListView5->setColumnWidthMode( 2, QListView::Manual ); |
168 | ListView5->setColumnWidth(2, 50); | ||
169 | ListView5->setColumnAlignment( 2, 1 ); | 143 | ListView5->setColumnAlignment( 2, 1 ); |
170 | 144 | ||
171 | ListView5->addColumn( tr( "File" ) ); | 145 | ListView5->addColumn( tr( "File" ), -1 ); |
172 | ListView5->setColumnWidthMode( 3, QListView::Manual ); | 146 | ListView5->setColumnWidthMode( 3, QListView::Manual ); |
173 | ListView5->setColumnWidth(3, 100); | ||
174 | ListView5->setColumnAlignment( 3, 1 ); | 147 | ListView5->setColumnAlignment( 3, 1 ); |
175 | 148 | ||
176 | tabWidget->insertTab( widget_1, tr( "A-F" ) ); | 149 | tabWidget->insertTab( widget_1, tr( "A-F" ) ); |
177 | tabWidget->insertTab( widget_2, tr( "G-M" ) ); | 150 | tabWidget->insertTab( widget_2, tr( "G-M" ) ); |
178 | tabWidget->insertTab( widget_3, tr( "N-R" ) ); | 151 | tabWidget->insertTab( widget_3, tr( "N-R" ) ); |
179 | tabWidget->insertTab( widget_4, tr( "S-Z" ) ); | 152 | tabWidget->insertTab( widget_4, tr( "S-Z" ) ); |
180 | tabWidget->insertTab( widget_5, tr( " " ) ); | 153 | tabWidget->insertTab( widget_5, tr( " " ) ); |
181 | 154 | ||
182 | ListView1->setMultiSelection(TRUE); | 155 | ListView1->setMultiSelection(TRUE); |
183 | ListView2->setMultiSelection(TRUE); | 156 | ListView2->setMultiSelection(TRUE); |
184 | ListView3->setMultiSelection(TRUE); | 157 | ListView3->setMultiSelection(TRUE); |
185 | ListView4->setMultiSelection(TRUE); | 158 | ListView4->setMultiSelection(TRUE); |
186 | ListView5->setMultiSelection(TRUE); | 159 | ListView5->setMultiSelection(TRUE); |
187 | 160 | ||
188 | widget_6 = new QWidget( tabWidget, "widget_6" ); | 161 | widget_6 = new QWidget( tabWidget, "widget_6" ); |
189 | tabWidget->insertTab(widget_6,tr("Options")); | 162 | tabWidget->insertTab(widget_6,tr("Options")); |
190 | 163 | ||
191 | ListView1->setSorting( 2, TRUE); | 164 | ListView1->setSorting( 2, TRUE); |
192 | ListView2->setSorting( 2, TRUE); | 165 | ListView2->setSorting( 2, TRUE); |
193 | ListView3->setSorting( 2, TRUE); | 166 | ListView3->setSorting( 2, TRUE); |
194 | ListView4->setSorting( 2, TRUE); | 167 | ListView4->setSorting( 2, TRUE); |
195 | ListView5->setSorting( 2, TRUE); | 168 | ListView5->setSorting( 2, TRUE); |
196 | ListView1->setAllColumnsShowFocus( TRUE ); | 169 | ListView1->setAllColumnsShowFocus( TRUE ); |
197 | ListView2->setAllColumnsShowFocus( TRUE ); | 170 | ListView2->setAllColumnsShowFocus( TRUE ); |
198 | ListView3->setAllColumnsShowFocus( TRUE ); | 171 | ListView3->setAllColumnsShowFocus( TRUE ); |
199 | ListView4->setAllColumnsShowFocus( TRUE ); | 172 | ListView4->setAllColumnsShowFocus( TRUE ); |
200 | ListView5->setAllColumnsShowFocus( TRUE ); | 173 | ListView5->setAllColumnsShowFocus( TRUE ); |
201 | 174 | ||
202 | QGridLayout *layout6 = new QGridLayout(widget_6 ); | 175 | QGridLayout *layout6 = new QGridLayout(widget_6 ); |
203 | QComboBox * sortingCombo; | 176 | QComboBox * sortingCombo; |
204 | buttonCancel = new QPushButton( widget_6, "buttonCancel" ); | 177 | buttonCancel = new QPushButton( widget_6, "buttonCancel" ); |
205 | checkBox = new QCheckBox( ( tr("Open Automatically")), widget_6); | 178 | checkBox = new QCheckBox( ( tr("Open Automatically")), widget_6); |
206 | checkBox->setChecked( FALSE); | 179 | checkBox->setChecked( FALSE); |
207 | // httpBox = new QCheckBox( ( tr("Use http")),widget_6); | 180 | // httpBox = new QCheckBox( ( tr("Use http")),widget_6); |
208 | // httpBox->setChecked( FALSE); | 181 | // httpBox->setChecked( FALSE); |
209 | // QToolTip::add( httpBox, ( tr("Use http to download \nproxy users should probably use this.")) ); | 182 | // QToolTip::add( httpBox, ( tr("Use http to download \nproxy users should probably use this.")) ); |
210 | authBox= new QCheckBox( ( tr("Last name first \n(requires library restart)")),widget_6); | 183 | authBox= new QCheckBox( ( tr("Last name first.")),widget_6); |
211 | authBox->setChecked( FALSE); | 184 | authBox->setChecked( true); |
212 | 185 | ||
213 | layout1->addMultiCellWidget( ListView1, 0, 0, 0, 4); | 186 | layout1->addMultiCellWidget( ListView1, 0, 0, 0, 4); |
214 | layout2->addMultiCellWidget( ListView2, 0, 0, 0, 4); | 187 | layout2->addMultiCellWidget( ListView2, 0, 0, 0, 4); |
215 | layout3->addMultiCellWidget( ListView3, 0, 0, 0, 4); | 188 | layout3->addMultiCellWidget( ListView3, 0, 0, 0, 4); |
216 | layout4->addMultiCellWidget( ListView4, 0, 0, 0, 4); | 189 | layout4->addMultiCellWidget( ListView4, 0, 0, 0, 4); |
217 | layout5->addMultiCellWidget( ListView5, 0, 0, 0, 4); | 190 | layout5->addMultiCellWidget( ListView5, 0, 0, 0, 4); |
218 | 191 | ||
219 | buttonSearch = new QPushButton(this,"buttonSearch"); | 192 | buttonSearch = new QPushButton(this,"buttonSearch"); |
220 | buttonLibrary=new QPushButton(this,"buttenLibrary"); | 193 | buttonLibrary=new QPushButton(this,"buttenLibrary"); |
221 | buttonNewList=new QPushButton(this,"NewList"); | 194 | buttonNewList=new QPushButton(this,"NewList"); |
222 | moreInfoButton= new QPushButton(this,"moreInfo"); | 195 | moreInfoButton= new QPushButton(this,"moreInfo"); |
223 | sortingCombo=new QComboBox(widget_6,"sort by combo"); | 196 | sortingCombo=new QComboBox(widget_6,"sort by combo"); |
224 | 197 | ||
225 | 198 | ||
226 | layout6->addMultiCellWidget(buttonCancel, 0, 0, 4, 4); | 199 | layout6->addMultiCellWidget(buttonCancel, 0, 0, 4, 4); |
227 | layout6->addMultiCellWidget(checkBox, 1, 1, 0, 0); | 200 | layout6->addMultiCellWidget(checkBox, 1, 1, 0, 0); |
228 | layout6->addMultiCellWidget(sortingCombo, 2, 2, 0, 0); | 201 | layout6->addMultiCellWidget(sortingCombo, 2, 2, 0, 0); |
229 | layout6->addMultiCellWidget(authBox, 3, 3, 0, 0); | 202 | layout6->addMultiCellWidget(authBox, 3, 3, 0, 0); |
230 | 203 | ||
231 | layout->addMultiCellWidget( buttonSearch, 1, 1, 0, 0); | 204 | layout->addMultiCellWidget( buttonSearch, 1, 1, 0, 0); |
232 | layout->addMultiCellWidget( buttonLibrary, 1, 1, 1, 1); | 205 | layout->addMultiCellWidget( buttonLibrary, 1, 1, 1, 1); |
233 | layout->addMultiCellWidget( moreInfoButton, 1, 1, 2, 2); | 206 | layout->addMultiCellWidget( moreInfoButton, 1, 1, 2, 2); |
234 | layout->addMultiCellWidget( buttonNewList, 1, 1, 3, 3); | 207 | layout->addMultiCellWidget( buttonNewList, 1, 1, 3, 3); |
235 | 208 | ||
236 | moreInfoButton->setText("Info"); | 209 | moreInfoButton->setText("Info"); |
237 | moreInfoButton->setDisabled(TRUE); | 210 | moreInfoButton->setDisabled(TRUE); |
238 | buttonSearch->setDisabled(TRUE); | 211 | buttonSearch->setDisabled(TRUE); |
239 | buttonSearch->setDefault(TRUE); | 212 | buttonSearch->setDefault(TRUE); |
240 | 213 | ||
241 | buttonSearch->setText(tr("Search")); | 214 | buttonSearch->setText(tr("Search")); |
242 | 215 | ||
243 | buttonCancel->setText(tr("Close")); | 216 | buttonCancel->setText(tr("Close")); |
244 | buttonLibrary->setText("Load"); | 217 | buttonLibrary->setText("Load"); |
245 | // buttonLibrary->setDefault(TRUE); | 218 | // buttonLibrary->setDefault(TRUE); |
246 | buttonNewList->setText("New List"); | 219 | buttonNewList->setText("New List"); |
247 | 220 | ||
248 | QStrList sortingList; | 221 | QStrList sortingList; |
249 | sortingList.append( "Sort by Number"); | 222 | sortingList.append( "Sort by Number"); |
250 | sortingList.append("Sort by Title"); | 223 | sortingList.append("Sort by Title"); |
251 | sortingList.append( "Sort by Author"); | 224 | sortingList.append( "Sort by Author"); |
252 | sortingList.append("Sort by Year"); | 225 | sortingList.append("Sort by Year"); |
253 | 226 | ||
254 | sortingCombo->insertStrList(sortingList,0); | 227 | sortingCombo->insertStrList(sortingList,0); |
255 | sortingCombo->setCurrentItem(2); | 228 | sortingCombo->setCurrentItem(2); |
256 | sortingCombo->setMaximumWidth(180); | 229 | sortingCombo->setMaximumWidth(180); |
257 | 230 | ||
258 | // signals and slots connections | 231 | // signals and slots connections |
259 | connect(buttonSearch,SIGNAL(clicked()),this,SLOT(onButtonSearch())); | 232 | connect(buttonSearch,SIGNAL(clicked()),this,SLOT(onButtonSearch())); |
260 | connect(buttonLibrary,SIGNAL(clicked()),this,SLOT(FindLibrary())); | 233 | connect(buttonLibrary,SIGNAL(clicked()),this,SLOT(FindLibrary())); |
261 | connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); | 234 | connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); |
262 | connect(moreInfoButton,SIGNAL(clicked()),this,SLOT(moreInfo())); | 235 | connect(moreInfoButton,SIGNAL(clicked()),this,SLOT(moreInfo())); |
263 | connect(buttonNewList,SIGNAL(clicked()),this,SLOT(newList())); | 236 | connect(buttonNewList,SIGNAL(clicked()),this,SLOT(newList())); |
264 | 237 | ||
265 | connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 238 | connect(ListView1,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
266 | connect(ListView1,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 239 | connect(ListView1,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
267 | connect(ListView2,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 240 | connect(ListView2,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
268 | connect(ListView2,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 241 | connect(ListView2,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
269 | connect(ListView3,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 242 | connect(ListView3,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
270 | connect(ListView3,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 243 | connect(ListView3,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
271 | connect(ListView4,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 244 | connect(ListView4,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
272 | connect(ListView4,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 245 | connect(ListView4,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
273 | connect(ListView5,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 246 | connect(ListView5,SIGNAL(doubleClicked(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
274 | connect(ListView5,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); | 247 | connect(ListView5,SIGNAL(returnPressed(QListViewItem*)),SLOT(select_title(QListViewItem*))); |
248 | connect(authBox,SIGNAL(clicked()),this,SLOT(authBoxClicked())); | ||
275 | 249 | ||
276 | connect(sortingCombo,SIGNAL(activated(int)),SLOT(comboSelect(int))); | 250 | connect(sortingCombo,SIGNAL(activated(int)),SLOT(comboSelect(int))); |
277 | 251 | ||
278 | } | 252 | } |
279 | 253 | ||
280 | void LibraryDialog::doListView() { | 254 | void LibraryDialog::doListView() { |
281 | 255 | ||
282 | } | 256 | } |