-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 157a3da..5b22b00 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -1,287 +1,287 @@ | |||
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 <qpe/applnk.h> | 16 | #include <qpe/applnk.h> |
17 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/qpedialog.h> | 18 | #include <qpe/qpedialog.h> |
19 | 19 | ||
20 | #include "LibraryDialog.h" | 20 | #include "LibraryDialog.h" |
21 | #include "output.h" | 21 | #include "output.h" |
22 | 22 | ||
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qmultilineedit.h> | 24 | #include <qmultilineedit.h> |
25 | //#include <qlayout.h> | 25 | //#include <qlayout.h> |
26 | 26 | ||
27 | #include <unistd.h> | 27 | #include <unistd.h> |
28 | #include <stdio.h> | 28 | #include <stdio.h> |
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * The dialog will by default be modeless, unless you set 'modal' to | 32 | * The dialog will by default be modeless, unless you set 'modal' to |
33 | * TRUE to construct a modal dialog. */ | 33 | * TRUE to construct a modal dialog. */ |
34 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl ) | 34 | LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, WFlags fl ) |
35 | : QDialog( parent, name, true/* modal*/, fl ) | 35 | : QDialog( parent, name, true/* modal*/, fl ) |
36 | { | 36 | { |
37 | if ( !name ) | 37 | if ( !name ) |
38 | setName( "LibraryDialog" ); | 38 | setName( "LibraryDialog" ); |
39 | indexLoaded=false; | 39 | indexLoaded=false; |
40 | initDialog(); | 40 | initDialog(); |
41 | 41 | ||
42 | // this->setMaximumWidth(240); | 42 | // this->setMaximumWidth(240); |
43 | 43 | ||
44 | index = "GUTINDEX.ALL"; | 44 | index = "GUTINDEX.ALL"; |
45 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 45 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
46 | local_index = local_library + index; | 46 | local_index = local_library + index; |
47 | 47 | ||
48 | QString iniFile ; | 48 | QString iniFile ; |
49 | iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; | 49 | iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; |
50 | 50 | ||
51 | new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; | 51 | new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; |
52 | 52 | ||
53 | old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; | 53 | old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; |
54 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 54 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
55 | 55 | ||
56 | // iniFile = local_library+"gutenbrowserrc"; | 56 | // iniFile = local_library+"gutenbrowserrc"; |
57 | // new_index = local_library + "PGWHOLE.TXT"; | 57 | // new_index = local_library + "PGWHOLE.TXT"; |
58 | // old_index = local_library + "GUTINDEX.ALL"; | 58 | // old_index = local_library + "GUTINDEX.ALL"; |
59 | 59 | ||
60 | Config config("Gutenbrowser"); | 60 | Config config("Gutenbrowser"); |
61 | 61 | ||
62 | config.setGroup( "HttpServer" ); | 62 | config.setGroup( "HttpServer" ); |
63 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); | 63 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); |
64 | 64 | ||
65 | config.setGroup( "FTPsite" ); | 65 | config.setGroup( "FTPsite" ); |
66 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); | 66 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); |
67 | qDebug("Library Dialog: ftp_host is "+ftp_host); | 67 | qDebug("Library Dialog: ftp_host is "+ftp_host); |
68 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 68 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
69 | // ftp_host=ftp_host.stripWhiteSpace(); | 69 | // ftp_host=ftp_host.stripWhiteSpace(); |
70 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); | 70 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); |
71 | 71 | ||
72 | i_binary = 0; | 72 | i_binary = 0; |
73 | 73 | ||
74 | config.setGroup("SortAuth"); | 74 | config.setGroup("SortAuth"); |
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 | qDebug("downDir is "+downDir); | 80 | qDebug("downDir is "+downDir); |
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 | } | 85 | } |
86 | 86 | ||
87 | LibraryDialog::~LibraryDialog() | 87 | LibraryDialog::~LibraryDialog() |
88 | { | 88 | { |
89 | delete QList_Item2; | 89 | // delete QList_Item2; |
90 | delete QList_Item1; | 90 | // delete QList_Item1; |
91 | delete QList_Item3; | 91 | // delete QList_Item3; |
92 | delete QList_Item4; | 92 | // delete QList_Item4; |
93 | delete QList_Item5; | 93 | // delete QList_Item5; |
94 | 94 | ||
95 | saveConfig(); | 95 | //saveConfig(); |
96 | } | 96 | } |
97 | 97 | ||
98 | /*This groks using PGWHOLE.TXT */ | 98 | /*This groks using PGWHOLE.TXT */ |
99 | void LibraryDialog::Newlibrary() | 99 | void LibraryDialog::Newlibrary() |
100 | { | 100 | { |
101 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files | 101 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files |
102 | //qDebug("Opening new library index %s",newindexLib); | 102 | //qDebug("Opening new library index %s",newindexLib); |
103 | if ( newindexLib.open( IO_ReadOnly) ) { | 103 | if ( newindexLib.open( IO_ReadOnly) ) { |
104 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully | 104 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully |
105 | QTextStream indexStream( &newindexLib ); | 105 | QTextStream indexStream( &newindexLib ); |
106 | QString indexLine; | 106 | QString indexLine; |
107 | while ( !indexStream.atEnd() ) { // until end of file.. | 107 | while ( !indexStream.atEnd() ) { // until end of file.. |
108 | indexLine = indexStream.readLine(); | 108 | indexLine = indexStream.readLine(); |
109 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { | 109 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { |
110 | year = indexLine.mid(4,4); | 110 | year = indexLine.mid(4,4); |
111 | year = year.stripWhiteSpace(); | 111 | year = year.stripWhiteSpace(); |
112 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); | 112 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); |
113 | file = file.stripWhiteSpace(); | 113 | file = file.stripWhiteSpace(); |
114 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 114 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
115 | if( year.toInt() < 1984) | 115 | if( year.toInt() < 1984) |
116 | number = number.left( number.length() -1 ); | 116 | number = number.left( number.length() -1 ); |
117 | number = number.stripWhiteSpace(); | 117 | number = number.stripWhiteSpace(); |
118 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 118 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
119 | title = title.stripWhiteSpace(); | 119 | title = title.stripWhiteSpace(); |
120 | 120 | ||
121 | getAuthor(); // groks author | 121 | getAuthor(); // groks author |
122 | author = author.stripWhiteSpace(); | 122 | author = author.stripWhiteSpace(); |
123 | if (authBox->isChecked()) { // this reverses the first name and last name of the author | 123 | if (authBox->isChecked()) { // this reverses the first name and last name of the author |
124 | // qDebug("Sorting last name first"); | 124 | // qDebug("Sorting last name first"); |
125 | QString lastName, firstName=""; | 125 | QString lastName, firstName=""; |
126 | int finder=author.findRev( ' ', -1, TRUE); | 126 | int finder=author.findRev( ' ', -1, TRUE); |
127 | lastName=author.right( author.length()-finder); | 127 | lastName=author.right( author.length()-finder); |
128 | firstName=author.left(finder); | 128 | firstName=author.left(finder); |
129 | lastName=lastName.stripWhiteSpace(); | 129 | lastName=lastName.stripWhiteSpace(); |
130 | firstName=firstName.stripWhiteSpace(); | 130 | firstName=firstName.stripWhiteSpace(); |
131 | 131 | ||
132 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 132 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
133 | author=lastName+", "+firstName; | 133 | author=lastName+", "+firstName; |
134 | } | 134 | } |
135 | 135 | ||
136 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { | 136 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { |
137 | 137 | ||
138 | // fill string list or something to be able to resort the whole library | 138 | // fill string list or something to be able to resort the whole library |
139 | if( author.isEmpty() ) | 139 | if( author.isEmpty() ) |
140 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); | 140 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); |
141 | else { | 141 | else { |
142 | 142 | ||
143 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 143 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || |
144 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) | 144 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) |
145 | QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file ); | 145 | QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file ); |
146 | 146 | ||
147 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || | 147 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || |
148 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) | 148 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) |
149 | QList_Item2 = new QListViewItem( ListView2, /*number, */title, author, year, file ); | 149 | QList_Item2 = new QListViewItem( ListView2, /*number, */title, author, year, file ); |
150 | 150 | ||
151 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || | 151 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || |
152 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) | 152 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) |
153 | QList_Item3 = new QListViewItem( ListView3, /*number,*/ title, author, year, file ); | 153 | QList_Item3 = new QListViewItem( ListView3, /*number,*/ title, author, year, file ); |
154 | 154 | ||
155 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || | 155 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || |
156 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) | 156 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) |
157 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); | 157 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); |
158 | 158 | ||
159 | else | 159 | else |
160 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); | 160 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | }// end if | 163 | }// end if |
164 | }// end while | 164 | }// end while |
165 | newindexLib.close(); | 165 | newindexLib.close(); |
166 | } | 166 | } |
167 | #ifndef Q_WS_QWS | 167 | #ifndef Q_WS_QWS |
168 | setCursor( arrowCursor); | 168 | setCursor( arrowCursor); |
169 | #endif | 169 | #endif |
170 | #endif | 170 | #endif |
171 | } // end Newlibrary() | 171 | } // end Newlibrary() |
172 | 172 | ||
173 | 173 | ||
174 | void LibraryDialog::Library() | 174 | void LibraryDialog::Library() |
175 | {// old library groking method | 175 | {// old library groking method |
176 | 176 | ||
177 | ListView1->clear(); | 177 | ListView1->clear(); |
178 | ListView2->clear(); | 178 | ListView2->clear(); |
179 | ListView3->clear(); | 179 | ListView3->clear(); |
180 | ListView4->clear(); | 180 | ListView4->clear(); |
181 | ListView5->clear(); | 181 | ListView5->clear(); |
182 | 182 | ||
183 | qDebug("opening GUTINDEX.ALL file"); | 183 | qDebug("opening GUTINDEX.ALL file"); |
184 | IDontKnowWhy = ""; | 184 | IDontKnowWhy = ""; |
185 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully | 185 | if ( indexLib.open( IO_ReadOnly) ) { // file opened successfully |
186 | QTextStream indexStream( &indexLib ); | 186 | QTextStream indexStream( &indexLib ); |
187 | QString indexLine; | 187 | QString indexLine; |
188 | qApp->processEvents(); | 188 | qApp->processEvents(); |
189 | // int jig; | 189 | // int jig; |
190 | while ( !indexStream.eof() ) { | 190 | while ( !indexStream.eof() ) { |
191 | 191 | ||
192 | indexLine = indexStream.readLine(); | 192 | indexLine = indexStream.readLine(); |
193 | if ( indexLine != "") { | 193 | if ( indexLine != "") { |
194 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { | 194 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { |
195 | // month = indexLine.left( 3); | 195 | // month = indexLine.left( 3); |
196 | year = indexLine.mid(4,4); | 196 | year = indexLine.mid(4,4); |
197 | // title = indexLine.mid( 9, 50); | 197 | // title = indexLine.mid( 9, 50); |
198 | file = indexLine.mid(60,12); | 198 | file = indexLine.mid(60,12); |
199 | if(file.left(1).find("[",0,TRUE) != -1) | 199 | if(file.left(1).find("[",0,TRUE) != -1) |
200 | file.remove(1,1); | 200 | file.remove(1,1); |
201 | if( file.find("]",0,TRUE) != -1) | 201 | if( file.find("]",0,TRUE) != -1) |
202 | file = file.left( file.find("]",0,TRUE)); | 202 | file = file.left( file.find("]",0,TRUE)); |
203 | //qDebug("file is "+file); | 203 | //qDebug("file is "+file); |
204 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 204 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
205 | number = indexLine.mid(55,5); | 205 | number = indexLine.mid(55,5); |
206 | number = number.stripWhiteSpace(); | 206 | number = number.stripWhiteSpace(); |
207 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 207 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
208 | title = indexLine.mid( 9, 50 ); | 208 | title = indexLine.mid( 9, 50 ); |
209 | title = title.stripWhiteSpace(); | 209 | title = title.stripWhiteSpace(); |
210 | //qDebug("title is "+title); | 210 | //qDebug("title is "+title); |
211 | getAuthor(); // grok author | 211 | getAuthor(); // grok author |
212 | author = author.stripWhiteSpace(); | 212 | author = author.stripWhiteSpace(); |
213 | //qDebug("author is "+author); | 213 | //qDebug("author is "+author); |
214 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author | 214 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author |
215 | QString lastName, firstName=""; | 215 | QString lastName, firstName=""; |
216 | int finder=author.findRev( ' ', -1, TRUE); | 216 | int finder=author.findRev( ' ', -1, TRUE); |
217 | lastName=author.right( author.length()-finder); | 217 | lastName=author.right( author.length()-finder); |
218 | firstName=author.left(finder); | 218 | firstName=author.left(finder); |
219 | lastName=lastName.stripWhiteSpace(); | 219 | lastName=lastName.stripWhiteSpace(); |
220 | firstName=firstName.stripWhiteSpace(); | 220 | firstName=firstName.stripWhiteSpace(); |
221 | 221 | ||
222 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 222 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
223 | author=lastName+", "+firstName; | 223 | author=lastName+", "+firstName; |
224 | } | 224 | } |
225 | 225 | ||
226 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) { | 226 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) { |
227 | // fill string list or something to be able to sort by Author | 227 | // fill string list or something to be able to sort by Author |
228 | if( author.isEmpty() ) | 228 | if( author.isEmpty() ) |
229 | QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); | 229 | QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); |
230 | else { | 230 | else { |
231 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 231 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || |
232 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) | 232 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) |
233 | QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); | 233 | QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); |
234 | 234 | ||
235 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || | 235 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || |
236 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) | 236 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) |
237 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); | 237 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); |
238 | 238 | ||
239 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || | 239 | else if( (author.left(1) >= QString("N") && author.left(1) <= QString("R")) || |
240 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) | 240 | (author.left(1) >= QString("n") && author.left(1) <= QString("r")) ) |
241 | QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file ); | 241 | QList_Item3 = new QListViewItem( ListView3, /* number,*/ title, author, year, file ); |
242 | 242 | ||
243 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || | 243 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || |
244 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) | 244 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) |
245 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); | 245 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } | 249 | } |
250 | } | 250 | } |
251 | indexLib.close(); | 251 | indexLib.close(); |
252 | } else { | 252 | } else { |
253 | QString sMsg; | 253 | QString sMsg; |
254 | sMsg = ( tr("Error opening local library index:\n "))+local_index; | 254 | sMsg = ( tr("Error opening local library index:\n "))+local_index; |
255 | QMessageBox::message( "Error",sMsg); | 255 | QMessageBox::message( "Error",sMsg); |
256 | } | 256 | } |
257 | 257 | ||
258 | } //end Library() | 258 | } //end Library() |
259 | 259 | ||
260 | 260 | ||
261 | /* | 261 | /* |
262 | Groks the author out of the title */ | 262 | Groks the author out of the title */ |
263 | bool LibraryDialog::getAuthor() | 263 | bool LibraryDialog::getAuthor() |
264 | { | 264 | { |
265 | if( title.contains( ", by", TRUE)) { | 265 | if( title.contains( ", by", TRUE)) { |
266 | int auth; | 266 | int auth; |
267 | auth = title.find(", by", 0, TRUE); | 267 | auth = title.find(", by", 0, TRUE); |
268 | author = title.right(title.length() - (auth + 4) ); | 268 | author = title.right(title.length() - (auth + 4) ); |
269 | if( int finder = author.find("[", 0, TRUE)) { | 269 | if( int finder = author.find("[", 0, TRUE)) { |
270 | author = author.left(finder); | 270 | author = author.left(finder); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | else if ( title.contains( "by, ", TRUE) ) { | 273 | else if ( title.contains( "by, ", TRUE) ) { |
274 | int auth; | 274 | int auth; |
275 | auth = title.find("by, ", 0, TRUE); | 275 | auth = title.find("by, ", 0, TRUE); |
276 | author = title.right(title.length() - (auth + 4) ); | 276 | author = title.right(title.length() - (auth + 4) ); |
277 | if( int finder = author.find("[", 0, TRUE)) { | 277 | if( int finder = author.find("[", 0, TRUE)) { |
278 | author = author.left( finder); | 278 | author = author.left( finder); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | else if ( title.contains( " by", TRUE) ) { | 281 | else if ( title.contains( " by", TRUE) ) { |
282 | int auth; | 282 | int auth; |
283 | auth = title.find(" by", 0, TRUE); | 283 | auth = title.find(" by", 0, TRUE); |
284 | author = title.right(title.length() - (auth + 3) ); | 284 | author = title.right(title.length() - (auth + 3) ); |
285 | if( int finder = author.find("[", 0, TRUE)) { | 285 | if( int finder = author.find("[", 0, TRUE)) { |
286 | author = author.left( finder); | 286 | author = author.left( finder); |
287 | } | 287 | } |