author | llornkcor <llornkcor> | 2005-02-28 09:24:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-02-28 09:24:10 (UTC) |
commit | 61fa699140c5efbb6ba0bf2a62f7e8fbf62976be (patch) (unidiff) | |
tree | 7b3695c8a13d694487011526e3ae052b69b6d5fb /noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |
parent | 7d4beaf7922f15451da6ba65c2e21fb569887b52 (diff) | |
download | opie-61fa699140c5efbb6ba0bf2a62f7e8fbf62976be.zip opie-61fa699140c5efbb6ba0bf2a62f7e8fbf62976be.tar.gz opie-61fa699140c5efbb6ba0bf2a62f7e8fbf62976be.tar.bz2 |
fix index dl from main view, user 8 bit files by default, do not show audio files
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/LibraryDialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 7426e80..549c1d2 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -130,25 +130,28 @@ void LibraryDialog::Newlibrary() | |||
130 | // odebug << "Sorting last name first" << oendl; | 130 | // odebug << "Sorting last name first" << oendl; |
131 | QString lastName, firstName=""; | 131 | QString lastName, firstName=""; |
132 | int finder=author.findRev( ' ', -1, TRUE); | 132 | int finder=author.findRev( ' ', -1, TRUE); |
133 | lastName=author.right( author.length()-finder); | 133 | lastName=author.right( author.length()-finder); |
134 | firstName=author.left(finder); | 134 | firstName=author.left(finder); |
135 | lastName=lastName.stripWhiteSpace(); | 135 | lastName=lastName.stripWhiteSpace(); |
136 | firstName=firstName.stripWhiteSpace(); | 136 | firstName=firstName.stripWhiteSpace(); |
137 | 137 | ||
138 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 138 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
139 | author=lastName+", "+firstName; | 139 | author=lastName+", "+firstName; |
140 | } | 140 | } |
141 | 141 | ||
142 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { | 142 | if( !number.isEmpty() |
143 | && (title.find( "reserved",0, FALSE) == -1) | ||
144 | && (file.find( "]",0, TRUE) == -1) | ||
145 | && (title.find( "Audio",0, FALSE) == -1)) { | ||
143 | 146 | ||
144 | // fill string list or something to be able to resort the whole library | 147 | // fill string list or something to be able to resort the whole library |
145 | if( author.isEmpty() ) | 148 | if( author.isEmpty() ) |
146 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); | 149 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); |
147 | else { | 150 | else { |
148 | 151 | ||
149 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 152 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || |
150 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) | 153 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) |
151 | QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file ); | 154 | QList_Item1 = new QListViewItem( ListView1,/* number,*/ title, author, year, file ); |
152 | 155 | ||
153 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || | 156 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || |
154 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) | 157 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) |
@@ -197,48 +200,57 @@ void LibraryDialog::Library() | |||
197 | 200 | ||
198 | indexLine = indexStream.readLine(); | 201 | indexLine = indexStream.readLine(); |
199 | if ( indexLine != "") { | 202 | if ( indexLine != "") { |
200 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { | 203 | if( (indexLine.mid(4,4)).toInt() /* && !( indexLine.left(3)).toInt()*/ ) { |
201 | // month = indexLine.left( 3); | 204 | // month = indexLine.left( 3); |
202 | year = indexLine.mid(4,4); | 205 | year = indexLine.mid(4,4); |
203 | // title = indexLine.mid( 9, 50); | 206 | // title = indexLine.mid( 9, 50); |
204 | file = indexLine.mid(60,12); | 207 | file = indexLine.mid(60,12); |
205 | if(file.left(1).find("[",0,TRUE) != -1) | 208 | if(file.left(1).find("[",0,TRUE) != -1) |
206 | file.remove(1,1); | 209 | file.remove(1,1); |
207 | if( file.find("]",0,TRUE) != -1) | 210 | if( file.find("]",0,TRUE) != -1) |
208 | file = file.left( file.find("]",0,TRUE)); | 211 | file = file.left( file.find("]",0,TRUE)); |
209 | //odebug << "file is "+file << oendl; | 212 | |
210 | /// number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 213 | |
214 | if(file.find("?", 0, false) != -1 ) { | ||
215 | QString tmpfile = file.replace(QRegExp("[?]"), "8"); | ||
216 | // qDebug( "file is now " + tmpfile ); | ||
217 | file = tmpfile; | ||
218 | } | ||
219 | |||
220 | // number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | ||
211 | number = indexLine.mid(55,5); | 221 | number = indexLine.mid(55,5); |
212 | number = number.stripWhiteSpace(); | 222 | number = number.stripWhiteSpace(); |
213 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 223 | // title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
214 | title = indexLine.mid( 9, 50 ); | 224 | title = indexLine.mid( 9, 50 ); |
215 | title = title.stripWhiteSpace(); | 225 | title = title.stripWhiteSpace(); |
216 | //odebug << "title is "+title << oendl; | 226 | //odebug << "title is "+title << oendl; |
217 | getAuthor(); // grok author | 227 | getAuthor(); // grok author |
218 | author = author.stripWhiteSpace(); | 228 | author = author.stripWhiteSpace(); |
219 | //odebug << "author is "+author << oendl; | 229 | //odebug << "author is "+author << oendl; |
220 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author | 230 | if (authBox->isChecked() == TRUE) { // this reverses the first name and last name of the author |
221 | QString lastName, firstName=""; | 231 | QString lastName, firstName=""; |
222 | int finder=author.findRev( ' ', -1, TRUE); | 232 | int finder=author.findRev( ' ', -1, TRUE); |
223 | lastName=author.right( author.length()-finder); | 233 | lastName=author.right( author.length()-finder); |
224 | firstName=author.left(finder); | 234 | firstName=author.left(finder); |
225 | lastName=lastName.stripWhiteSpace(); | 235 | lastName=lastName.stripWhiteSpace(); |
226 | firstName=firstName.stripWhiteSpace(); | 236 | firstName=firstName.stripWhiteSpace(); |
227 | 237 | ||
228 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 238 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
229 | author=lastName+", "+firstName; | 239 | author=lastName+", "+firstName; |
230 | } | 240 | } |
231 | 241 | ||
232 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) /*&& (file.find( "]",0, TRUE))*/ ) { | 242 | if( !number.isEmpty() |
243 | && (title.find( "reserved",0, FALSE) == -1) | ||
244 | &&(title.find( "Audio",0, FALSE) == -1)) { | ||
233 | // fill string list or something to be able to sort by Author | 245 | // fill string list or something to be able to sort by Author |
234 | if( author.isEmpty() ) | 246 | if( author.isEmpty() ) |
235 | QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); | 247 | QList_Item5 = new QListViewItem( ListView5, /*number, */title, author, year, file ); |
236 | else { | 248 | else { |
237 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 249 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || |
238 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) | 250 | (author.left(1) >= QString("a") && author.left(1) <= QString("f")) ) |
239 | QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); | 251 | QList_Item1 = new QListViewItem( ListView1, /* number,*/ title, author, year, file ); |
240 | 252 | ||
241 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || | 253 | else if( (author.left(1) >= QString("G") && author.left(1) <= QString("M")) || |
242 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) | 254 | (author.left(1) >= QString("g") && author.left(1) <= QString("m")) ) |
243 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); | 255 | QList_Item2 = new QListViewItem( ListView2, /* number,*/ title, author, year, file ); |
244 | 256 | ||
@@ -587,35 +599,32 @@ bool LibraryDialog::setTitle() | |||
587 | int test = 0; | 599 | int test = 0; |
588 | QString ramble, temp; | 600 | QString ramble, temp; |
589 | config.setGroup("Files"); | 601 | config.setGroup("Files"); |
590 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); | 602 | QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); |
591 | int i_numofFiles = s_numofFiles.toInt(); | 603 | int i_numofFiles = s_numofFiles.toInt(); |
592 | for ( int i = 0; i <= i_numofFiles; i++){ | 604 | for ( int i = 0; i <= i_numofFiles; i++){ |
593 | temp.setNum( i); | 605 | temp.setNum( i); |
594 | ramble = config.readEntry( temp, "" ); | 606 | ramble = config.readEntry( temp, "" ); |
595 | if( strcmp( ramble, File_Name) == 0){ | 607 | if( strcmp( ramble, File_Name) == 0){ |
596 | test = 1; | 608 | test = 1; |
597 | } | 609 | } |
598 | } | 610 | } |
599 | |||
600 | if(test == 0 ) { | ||
601 | |||
602 | config.setGroup("Files"); | 611 | config.setGroup("Files"); |
603 | config.writeEntry( "NumberOfFiles", i_numofFiles +1 ); | 612 | config.writeEntry( "NumberOfFiles", i_numofFiles +1 ); |
604 | QString interger; | 613 | QString interger; |
605 | interger.setNum( i_numofFiles +1); | 614 | interger.setNum( i_numofFiles +1); |
606 | config.writeEntry( interger, File_Name); | 615 | config.writeEntry( interger, File_Name); |
607 | config.setGroup( "Titles" ); | 616 | config.setGroup( "Titles" ); |
608 | config.writeEntry( File_Name, DlglistItemTitle); | 617 | config.writeEntry( File_Name, DlglistItemTitle); |
609 | } | 618 | |
610 | test = 0; | 619 | test = 0; |
611 | return true; | 620 | return true; |
612 | } | 621 | } |
613 | 622 | ||
614 | 623 | ||
615 | void LibraryDialog::saveConfig() | 624 | void LibraryDialog::saveConfig() |
616 | { | 625 | { |
617 | Config config("Gutenbrowser"); | 626 | Config config("Gutenbrowser"); |
618 | if( httpBox->isChecked() == TRUE) { | 627 | if( httpBox->isChecked() == TRUE) { |
619 | checked = 1; | 628 | checked = 1; |
620 | config.setGroup( "Proxy" ); | 629 | config.setGroup( "Proxy" ); |
621 | config.writeEntry("IsChecked", "TRUE"); | 630 | config.writeEntry("IsChecked", "TRUE"); |
@@ -741,26 +750,24 @@ void LibraryDialog::onButtonSearch() | |||
741 | tabWidget->setCurrentPage( curTab); | 750 | tabWidget->setCurrentPage( curTab); |
742 | 751 | ||
743 | Searchlist.sort(); | 752 | Searchlist.sort(); |
744 | SearchResultsDlg* SearchResultsDialog; | 753 | SearchResultsDlg* SearchResultsDialog; |
745 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); | 754 | SearchResultsDialog = new SearchResultsDlg( searchDlg, "Results Dialog", true, 0 , Searchlist); |
746 | 755 | ||
747 | SearchResultsDialog->showMaximized(); | 756 | SearchResultsDialog->showMaximized(); |
748 | if( SearchResultsDialog->exec() != 0) { | 757 | if( SearchResultsDialog->exec() != 0) { |
749 | texter = SearchResultsDialog->selText; | 758 | texter = SearchResultsDialog->selText; |
750 | // odebug << texter << oendl; | 759 | // odebug << texter << oendl; |
751 | resultLs = SearchResultsDialog->resultsList; | 760 | resultLs = SearchResultsDialog->resultsList; |
752 | i_berger = 1; | 761 | i_berger = 1; |
753 | } else { | ||
754 | resultLs.clear(); | ||
755 | } | 762 | } |
756 | Searchlist.clear(); | 763 | Searchlist.clear(); |
757 | 764 | ||
758 | // if(SearchResultsDialog) | 765 | // if(SearchResultsDialog) |
759 | // delete SearchResultsDialog; | 766 | // delete SearchResultsDialog; |
760 | QString tester; | 767 | QString tester; |
761 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { | 768 | for ( QStringList::Iterator it = resultLs.begin(); it != resultLs.end(); ++it ) { |
762 | texter.sprintf("%s \n",(*it).latin1()); | 769 | texter.sprintf("%s \n",(*it).latin1()); |
763 | // odebug << texter << oendl; | 770 | // odebug << texter << oendl; |
764 | if( tester!=texter) | 771 | if( tester!=texter) |
765 | parseSearchResults( texter); | 772 | parseSearchResults( texter); |
766 | tester = texter; | 773 | tester = texter; |