summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp2
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowser.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 3b540c5..58babe9 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -803,257 +803,257 @@ void LibraryDialog::parseSearchResults( QString resultStr)
803 my.setNum( stringLeng, 10); 803 my.setNum( stringLeng, 10);
804 804
805 if( resultStr.length() > 2 && resultStr.length() < 130) { 805 if( resultStr.length() > 2 && resultStr.length() < 130) {
806 806
807 int titleInt = resultStr.find( " : ", 0, true); 807 int titleInt = resultStr.find( " : ", 0, true);
808 DlglistItemTitle = resultStr.left( titleInt); 808 DlglistItemTitle = resultStr.left( titleInt);
809 809
810 int yearInt = resultStr.find( " : ", titleInt+3, true); 810 int yearInt = resultStr.find( " : ", titleInt+3, true);
811 811
812 DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3); 812 DlglistItemYear = resultStr.mid( titleInt+3, (yearInt - titleInt)-3);
813 813
814 DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3)); 814 DlglistItemFile = resultStr.right( resultStr.length() - (yearInt + 3));
815 DlglistItemFile = DlglistItemFile.left( DlglistItemFile.length() - 2); 815 DlglistItemFile = DlglistItemFile.left( DlglistItemFile.length() - 2);
816 816
817 cleanStrings(); 817 cleanStrings();
818 818
819 if(DlglistItemFile.left(1) == "/") 819 if(DlglistItemFile.left(1) == "/")
820 DlglistItemFile = DlglistItemFile.right( DlglistItemFile.length() - 1); 820 DlglistItemFile = DlglistItemFile.right( DlglistItemFile.length() - 1);
821 821
822 822
823 if(DlglistItemFile.toInt() > 10000 ) { 823 if(DlglistItemFile.toInt() > 10000 ) {
824 // new directory sturcture 824 // new directory sturcture
825 download_newEtext(); //) 825 download_newEtext(); //)
826 } else { 826 } else {
827 download_Etext(); //) 827 download_Etext(); //)
828 } 828 }
829 } 829 }
830} 830}
831 831
832void LibraryDialog::sort() 832void LibraryDialog::sort()
833{ 833{
834 834
835} 835}
836 836
837/* 837/*
838 Downloads the current selected listitem*/ 838 Downloads the current selected listitem*/
839bool LibraryDialog::getItem(QListViewItem *it) 839bool LibraryDialog::getItem(QListViewItem *it)
840{ 840{
841 // //odebug << "selected getItem" << oendl; 841 // //odebug << "selected getItem" << oendl;
842 842
843 // DlglistItemNumber = it->text(0); 843 // DlglistItemNumber = it->text(0);
844 DlglistItemTitle = it->text(0); 844 DlglistItemTitle = it->text(0);
845 DlglistItemYear = it->text(2); 845 DlglistItemYear = it->text(2);
846 DlglistItemFile = it->text(3); 846 DlglistItemFile = it->text(3);
847 847
848 if(download_Etext()) { 848 if(download_Etext()) {
849 if(i_binary == 1) { 849 if(i_binary == 1) {
850 } 850 }
851 } 851 }
852 return true; 852 return true;
853} 853}
854 854
855/* 855/*
856 download button is pushed so we get the current items to download*/ 856 download button is pushed so we get the current items to download*/
857bool LibraryDialog::onButtonDownload() 857bool LibraryDialog::onButtonDownload()
858{ 858{
859 // //odebug << "selected onButtonDownloadz" << oendl; 859 // //odebug << "selected onButtonDownloadz" << oendl;
860 860
861 QListViewItemIterator it1( ListView1 ); 861 QListViewItemIterator it1( ListView1 );
862 QListViewItemIterator it2( ListView2 ); 862 QListViewItemIterator it2( ListView2 );
863 QListViewItemIterator it3( ListView3 ); 863 QListViewItemIterator it3( ListView3 );
864 QListViewItemIterator it4( ListView4 ); 864 QListViewItemIterator it4( ListView4 );
865 QListViewItemIterator it5( ListView5 ); 865 QListViewItemIterator it5( ListView5 );
866 866
867 // iterate through all items of the listview 867 // iterate through all items of the listview
868 for ( ; it1.current(); ++it1 ) { 868 for ( ; it1.current(); ++it1 ) {
869 if ( it1.current()->isSelected() ) 869 if ( it1.current()->isSelected() )
870 getItem(it1.current()); 870 getItem(it1.current());
871 it1.current()->setSelected(false); 871 it1.current()->setSelected(false);
872 } 872 }
873 for ( ; it2.current(); ++it2 ) { 873 for ( ; it2.current(); ++it2 ) {
874 if ( it2.current()->isSelected() ) 874 if ( it2.current()->isSelected() )
875 getItem(it2.current()); 875 getItem(it2.current());
876 it2.current()->setSelected(false); 876 it2.current()->setSelected(false);
877 } 877 }
878 for ( ; it3.current(); ++it3 ) { 878 for ( ; it3.current(); ++it3 ) {
879 if ( it3.current()->isSelected() ) 879 if ( it3.current()->isSelected() )
880 getItem(it3.current()); 880 getItem(it3.current());
881 it3.current()->setSelected(false); 881 it3.current()->setSelected(false);
882 } 882 }
883 for ( ; it4.current(); ++it4 ) { 883 for ( ; it4.current(); ++it4 ) {
884 if ( it4.current()->isSelected() ) 884 if ( it4.current()->isSelected() )
885 getItem(it4.current()); 885 getItem(it4.current());
886 it4.current()->setSelected(false); 886 it4.current()->setSelected(false);
887 } 887 }
888 for ( ; it5.current(); ++it5 ) { 888 for ( ; it5.current(); ++it5 ) {
889 if ( it5.current()->isSelected() ) 889 if ( it5.current()->isSelected() )
890 getItem(it5.current()); 890 getItem(it5.current());
891 it5.current()->setSelected(false); 891 it5.current()->setSelected(false);
892 } 892 }
893 return true; 893 return true;
894} 894}
895 895
896 896
897/* 897/*
898 handles the sorting combo box */ 898 handles the sorting combo box */
899void LibraryDialog::comboSelect(int index) 899void LibraryDialog::comboSelect(int index)
900{ 900{
901 // //odebug << "we are sorting" << oendl; 901 // //odebug << "we are sorting" << oendl;
902 ListView1->setSorting( index, true); 902 ListView1->setSorting( index, true);
903 ListView2->setSorting( index, true); 903 ListView2->setSorting( index, true);
904 ListView3->setSorting( index, true); 904 ListView3->setSorting( index, true);
905 ListView4->setSorting( index, true); 905 ListView4->setSorting( index, true);
906 ListView5->setSorting( index, true); 906 ListView5->setSorting( index, true);
907 907
908 ListView1->sort(); 908 ListView1->sort();
909 ListView2->sort(); 909 ListView2->sort();
910 ListView3->sort(); 910 ListView3->sort();
911 ListView4->sort(); 911 ListView4->sort();
912 ListView5->sort(); 912 ListView5->sort();
913 913
914 // ListView1->triggerUpdate(); 914 // ListView1->triggerUpdate();
915 // ListView2->triggerUpdate(); 915 // ListView2->triggerUpdate();
916 // ListView3->triggerUpdate(); 916 // ListView3->triggerUpdate();
917 // ListView4->triggerUpdate(); 917 // ListView4->triggerUpdate();
918 // ListView5->triggerUpdate(); 918 // ListView5->triggerUpdate();
919} 919}
920 920
921void LibraryDialog::newList() 921void LibraryDialog::newList()
922{ 922{
923 if(indexLoaded) { 923 if(indexLoaded) {
924 onButtonDownload(); 924 onButtonDownload();
925 } else { 925 } else {
926 Output *outDlg; 926 Output *outDlg;
927 buttonNewList->setDown(true); 927 buttonNewList->setDown(true);
928 //odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; 928 //odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl;
929 QString gutenindex1 = local_library + "/GUTINDEX.ALL"; 929 QString gutenindex1 = local_library + "/GUTINDEX.ALL";
930 930
931 QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; 931 QString cmd="wget -O " + gutenindex1 + " http://www.gutenberg.org/dirs/GUTINDEX.ALL 2>&1";
932 932
933 int result = QMessageBox::warning( this,"Download" 933 int result = QMessageBox::warning( this,"Download"
934 ,"<p>Ok to use /'wget/' to download a new library list?</P>" 934 ,"<p>Ok to use /'wget/' to download a new library list?</P>"
935 ,"Yes","No",0,0,1); 935 ,"Yes","No",0,0,1);
936 qApp->processEvents(); 936 qApp->processEvents();
937 if(result == 0) { 937 if(result == 0) {
938 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),true); 938 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),true);
939 outDlg->showMaximized(); 939 outDlg->showMaximized();
940 outDlg->show(); 940 outDlg->show();
941 qApp->processEvents(); 941 qApp->processEvents();
942 FILE *fp; 942 FILE *fp;
943 char line[130]; 943 char line[130];
944 outDlg->OutputEdit->append( tr("Running wget") ); 944 outDlg->OutputEdit->append( tr("Running wget") );
945 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,false); 945 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,false);
946 sleep(1); 946 sleep(1);
947 fp = popen( (const char *) cmd, "r"); 947 fp = popen( (const char *) cmd, "r");
948 if ( !fp ) { 948 if ( !fp ) {
949 } else { 949 } else {
950 //odebug << "Issuing the command\n"+cmd << oendl; 950 //odebug << "Issuing the command\n"+cmd << oendl;
951 // system(cmd); 951 // system(cmd);
952 while ( fgets( line, sizeof line, fp)) { 952 while ( fgets( line, sizeof line, fp)) {
953 outDlg->OutputEdit->append(line); 953 outDlg->OutputEdit->append(line);
954 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,false); 954 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,false);
955 } 955 }
956 pclose(fp); 956 pclose(fp);
957 outDlg->OutputEdit->append("Finished downloading\n"); 957 outDlg->OutputEdit->append("Finished downloading\n");
958 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,false); 958 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,false);
959 qApp->processEvents(); 959 qApp->processEvents();
960 960
961 // if( QFile(gutenindex1).exists() ) { 961 // if( QFile(gutenindex1).exists() ) {
962 // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 962 // QString gutenindex=QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
963 // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0) 963 // if( rename(gutenindex1.latin1(),gutenindex.latin1()) !=0)
964 // //odebug << "renaming error" << oendl; 964 // //odebug << "renaming error" << oendl;
965 // } 965 // }
966 966
967 } 967 }
968 // outDlg->close(); 968 // outDlg->close();
969 FindLibrary(); 969 FindLibrary();
970 if(outDlg) delete outDlg; 970 if(outDlg) delete outDlg;
971 } 971 }
972 buttonNewList->setDown(false); 972 buttonNewList->setDown(false);
973 973
974 // if(outDlg) 974 // if(outDlg)
975 // delete outDlg; 975 // delete outDlg;
976 } 976 }
977} 977}
978 978
979bool LibraryDialog::moreInfo() 979bool LibraryDialog::moreInfo()
980{ 980{
981 981
982 QListViewItem * item; 982 QListViewItem * item;
983 item = 0; 983 item = 0;
984 QString titleString; 984 QString titleString;
985 item = ListView1->currentItem(); 985 item = ListView1->currentItem();
986 if( item != 0) { 986 if( item != 0) {
987 titleString = item->text(0); 987 titleString = item->text(0);
988 ListView1->clearSelection(); 988 ListView1->clearSelection();
989 item = 0; 989 item = 0;
990 } 990 }
991 if( item == 0) 991 if( item == 0)
992 item = ListView2->currentItem(); 992 item = ListView2->currentItem();
993 if( item != 0) { 993 if( item != 0) {
994 titleString = item->text(0); 994 titleString = item->text(0);
995 ListView2->clearSelection(); 995 ListView2->clearSelection();
996 item = 0; 996 item = 0;
997 } 997 }
998 if( item == 0) 998 if( item == 0)
999 item = ListView3->currentItem(); 999 item = ListView3->currentItem();
1000 if( item != 0) { 1000 if( item != 0) {
1001 titleString = item->text(0); 1001 titleString = item->text(0);
1002 ListView3->clearSelection(); 1002 ListView3->clearSelection();
1003 item = 0; 1003 item = 0;
1004 } 1004 }
1005 if( item == 0) 1005 if( item == 0)
1006 item = ListView4->currentItem(); 1006 item = ListView4->currentItem();
1007 if( item != 0) { 1007 if( item != 0) {
1008 titleString = item->text(0); 1008 titleString = item->text(0);
1009 ListView4->clearSelection(); 1009 ListView4->clearSelection();
1010 item = 0; 1010 item = 0;
1011 } 1011 }
1012 if( item == 0) 1012 if( item == 0)
1013 item = ListView5->currentItem(); 1013 item = ListView5->currentItem();
1014 if( item != 0) { 1014 if( item != 0) {
1015 titleString = item->text(0); 1015 titleString = item->text(0);
1016 ListView5->clearSelection(); 1016 ListView5->clearSelection();
1017 item = 0; 1017 item = 0;
1018 } 1018 }
1019 item=0; 1019 item=0;
1020 if(titleString.length()>2) { 1020 if(titleString.length()>2) {
1021 //odebug << "Title is "+titleString << oendl; 1021 //odebug << "Title is "+titleString << oendl;
1022 titleString.replace( QRegExp("\\s"), "%20"); 1022 titleString.replace( QRegExp("\\s"), "%20");
1023 titleString.replace( QRegExp("'"), "%20"); 1023 titleString.replace( QRegExp("'"), "%20");
1024 titleString.replace( QRegExp("\""), "%20"); 1024 titleString.replace( QRegExp("\""), "%20");
1025 titleString.replace( QRegExp("&"), "%20"); 1025 titleString.replace( QRegExp("&"), "%20");
1026 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; 1026 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search";
1027 cmd="opera "+cmd; 1027 cmd="opera "+cmd;
1028 system(cmd); 1028 system(cmd);
1029 } else 1029 } else
1030 QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>"); 1030 QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>");
1031 return true; 1031 return true;
1032 1032
1033} 1033}
1034 1034
1035/* 1035/*
1036 This loads the library Index*/ 1036 This loads the library Index*/
1037void LibraryDialog::FindLibrary() 1037void LibraryDialog::FindLibrary()
1038{ 1038{
1039 buttonLibrary->setDown(true); 1039 buttonLibrary->setDown(true);
1040 1040
1041 qApp->processEvents(); 1041 qApp->processEvents();
1042 if( QFile( new_index).exists() /* && this->isHidden() */) { 1042 if( QFile( new_index).exists() /* && this->isHidden() */) {
1043 newindexLib.setName( new_index); 1043 newindexLib.setName( new_index);
1044 indexLib.setName( new_index); 1044 indexLib.setName( new_index);
1045 //odebug << "index file is "+ new_index << oendl; 1045 //odebug << "index file is "+ new_index << oendl;
1046 Newlibrary(); 1046 Newlibrary();
1047 } else { 1047 } else {
1048 newindexLib.setName( old_index); 1048 newindexLib.setName( old_index);
1049 indexLib.setName( old_index); 1049 indexLib.setName( old_index);
1050 //odebug << "new index nameis "+ old_index << oendl; 1050 //odebug << "new index nameis "+ old_index << oendl;
1051 Library(); 1051 Library();
1052 } 1052 }
1053 indexLoaded=true; 1053 indexLoaded=true;
1054 buttonSearch->setEnabled(true); 1054 buttonSearch->setEnabled(true);
1055 moreInfoButton->setEnabled(true); 1055 moreInfoButton->setEnabled(true);
1056 1056
1057 buttonLibrary->setDown(false); 1057 buttonLibrary->setDown(false);
1058 buttonNewList->setText("Download"); 1058 buttonNewList->setText("Download");
1059 qApp->processEvents(); 1059 qApp->processEvents();
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
index e639d4d..733db17 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp
@@ -257,257 +257,257 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
257 cmd = "konqueror "+url+" &"; 257 cmd = "konqueror "+url+" &";
258 } 258 }
259 if( brow == "Opera") { //for desktop testing 259 if( brow == "Opera") { //for desktop testing
260 cmd = "opera "+url+" &"; 260 cmd = "opera "+url+" &";
261 } 261 }
262 // if( brow == "Opera") { // on Zaurus 262 // if( brow == "Opera") { // on Zaurus
263 // cmd = "operagui "+url+" &"; 263 // cmd = "operagui "+url+" &";
264 // } 264 // }
265 if( brow == "Mozilla") { 265 if( brow == "Mozilla") {
266 cmd = "mozilla "+url+" &"; 266 cmd = "mozilla "+url+" &";
267 } 267 }
268 if( brow == "Netscape") { 268 if( brow == "Netscape") {
269 cmd = "netscape "+url+" &"; 269 cmd = "netscape "+url+" &";
270 } 270 }
271 if(brow == "wget") { 271 if(brow == "wget") {
272 // cmd="wget -q "+url+" &"; 272 // cmd="wget -q "+url+" &";
273 QString tempHtml=local_library+"webster.html"; 273 QString tempHtml=local_library+"webster.html";
274 cmd="wget -O "+tempHtml+" -q "+url; 274 cmd="wget -O "+tempHtml+" -q "+url;
275 } 275 }
276 276
277 chdir(local_library); 277 chdir(local_library);
278 // //odebug << "Issuing the sys command: " << cmd << "" << oendl; 278 // //odebug << "Issuing the sys command: " << cmd << "" << oendl;
279 system(cmd); 279 system(cmd);
280 } 280 }
281} 281}
282 282
283void Gutenbrowser::toggleButtonIcons( bool useEm) { 283void Gutenbrowser::toggleButtonIcons( bool useEm) {
284 QString pixDir; 284 QString pixDir;
285 if(useEm) 285 if(useEm)
286 useEm=TRUE; 286 useEm=TRUE;
287 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; 287 pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser";
288 odebug << "Docdir is "+QPEApplication::documentDir() << oendl; 288 odebug << "Docdir is "+QPEApplication::documentDir() << oendl;
289 289
290 if( useIcons && QDir( pixDir).exists() ) { 290 if( useIcons && QDir( pixDir).exists() ) {
291 LibraryButton->setPixmap( Opie::Core::OResource::loadPixmap("home", Opie::Core::OResource::SmallIcon ) ); 291 LibraryButton->setPixmap( Opie::Core::OResource::loadPixmap("home", Opie::Core::OResource::SmallIcon ) );
292 OpenButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", Opie::Core::OResource::SmallIcon )); 292 OpenButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", Opie::Core::OResource::SmallIcon ));
293 ForwardButton->setPixmap( Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon )); 293 ForwardButton->setPixmap( Opie::Core::OResource::loadPixmap("forward", Opie::Core::OResource::SmallIcon ));
294 BackButton->setPixmap( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon ) ); 294 BackButton->setPixmap( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon ) );
295 SearchButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/search", Opie::Core::OResource::SmallIcon ) ); 295 SearchButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/search", Opie::Core::OResource::SmallIcon ) );
296 lastBmkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark_folder", Opie::Core::OResource::SmallIcon )); 296 lastBmkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark_folder", Opie::Core::OResource::SmallIcon ));
297 setBookmarkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark", Opie::Core::OResource::SmallIcon ) ); 297 setBookmarkButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/bookmark", Opie::Core::OResource::SmallIcon ) );
298 dictionaryButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/spellcheck", Opie::Core::OResource::SmallIcon ) ); 298 dictionaryButton->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/spellcheck", Opie::Core::OResource::SmallIcon ) );
299 InfoBar->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/google", Opie::Core::OResource::SmallIcon )); 299 InfoBar->setPixmap( Opie::Core::OResource::loadPixmap("gutenbrowser/google", Opie::Core::OResource::SmallIcon ));
300 } 300 }
301} 301}
302 302
303 303
304bool Gutenbrowser::queryExit() 304bool Gutenbrowser::queryExit()
305{ 305{
306 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?", 306 int exit=QMessageBox::information(this, "Quit...", "Do your really want to quit?",
307 QMessageBox::Ok, QMessageBox::Cancel); 307 QMessageBox::Ok, QMessageBox::Cancel);
308 if (exit==1) { 308 if (exit==1) {
309 writeConfig(); 309 writeConfig();
310 qApp->quit(); 310 qApp->quit();
311 } else { 311 } else {
312 }; 312 };
313 return (exit==1); 313 return (exit==1);
314} 314}
315 315
316 // SLOT IMPLEMENTATION 316 // SLOT IMPLEMENTATION
317 317
318void Gutenbrowser::slotFilePrint() { 318void Gutenbrowser::slotFilePrint() {
319} 319}
320 320
321void Gutenbrowser::ByeBye() { 321void Gutenbrowser::ByeBye() {
322 if (b_queryExit) 322 if (b_queryExit)
323 queryExit(); 323 queryExit();
324 else { 324 else {
325 // writeConfig(); 325 // writeConfig();
326 qApp->quit(); 326 qApp->quit();
327 } 327 }
328} 328}
329 329
330void Gutenbrowser::HelpBtn() { 330void Gutenbrowser::HelpBtn() {
331 HelpMe* HelpDlg; 331 HelpMe* HelpDlg;
332 HelpDlg = new HelpMe( this, "Help Dialog"); 332 HelpDlg = new HelpMe( this, "Help Dialog");
333 HelpDlg->showMaximized(); 333 HelpDlg->showMaximized();
334} 334}
335 335
336void Gutenbrowser::DownloadIndex() { 336void Gutenbrowser::DownloadIndex() {
337#ifndef Q_WS_QWS 337#ifndef Q_WS_QWS
338 { 338 {
339 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")), 339 switch( QMessageBox::information( 0, (tr("Download Library Index, or FTP sites?")),
340 (tr("Do you want to download the newest\n" 340 (tr("Do you want to download the newest\n"
341 "Project Gutenberg Library Index?\n" 341 "Project Gutenberg Library Index?\n"
342 "or select an ftp site?\n")), 342 "or select an ftp site?\n")),
343 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) ) 343 (tr("&Library Index")), (tr("&Ftp Site")), (tr("&Cancel")), 2, 2 ) )
344 { 344 {
345 case 0: // index clicked, 345 case 0: // index clicked,
346 downloadLibIndex(); 346 downloadLibIndex();
347 break; 347 break;
348 348
349 case 1: // ftp selected 349 case 1: // ftp selected
350 downloadFtpList(); 350 downloadFtpList();
351 break; 351 break;
352 352
353 case 2: // Cancel 353 case 2: // Cancel
354 break; 354 break;
355 }; 355 };
356 } 356 }
357#endif 357#endif
358} // end DownloadIndex 358} // end DownloadIndex
359 359
360 360
361void Gutenbrowser::downloadFtpList() { 361void Gutenbrowser::downloadFtpList() {
362 // QString cmd="wget http://www.promo.net/pg/list.html"); 362 // QString cmd="wget http://www.promo.net/pg/list.html");
363 //system(cmd); 363 //system(cmd);
364 qApp->processEvents(); 364 qApp->processEvents();
365 optionsDialog* optDlg; 365 optionsDialog* optDlg;
366 optDlg = new optionsDialog( this,"Options_Dlg", true); 366 optDlg = new optionsDialog( this,"Options_Dlg", true);
367 optDlg->getSite(); 367 optDlg->getSite();
368 if(optDlg) 368 if(optDlg)
369 delete optDlg; 369 delete optDlg;
370} 370}
371 371
372 372
373void Gutenbrowser::downloadLibIndex() { 373void Gutenbrowser::downloadLibIndex() {
374 // QString dwmloader = local_library + "pgwhole.zip"; 374 // QString dwmloader = local_library + "pgwhole.zip";
375 // QString cmd = "lynx -source http://www.gutenberg.net/pgwhole.zip | cat >> " + dwmloader; 375 // QString cmd = "lynx -source http://www.gutenberg.net/pgwhole.zip | cat >> " + dwmloader;
376 // system(cmd); 376 // system(cmd);
377 377
378 // QString outputFile= local_library+ "GUTINDEX.ALL"; 378 // QString outputFile= local_library+ "GUTINDEX.ALL";
379 // config.setGroup( "FTPsite" ); // ftp server config 379 // config.setGroup( "FTPsite" ); // ftp server config
380 // ftp_host=config.readEntry("SiteName", ""); 380 // ftp_host=config.readEntry("SiteName", "");
381 // ftp_base_dir= config.readEntry("base", ""); 381 // ftp_base_dir= config.readEntry("base", "");
382 // QString networkUrl= "ftp://"+ftp_host+ftp_base_dir+"/GUTINDEX.ALL"; 382 // QString networkUrl= "ftp://"+ftp_host+ftp_base_dir+"/GUTINDEX.ALL";
383 QDir dir( local_library); 383 QDir dir( local_library);
384 dir.cd("", TRUE); 384 dir.cd("", TRUE);
385 goGetit( "http://sailor.gutenberg.org/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3 385 goGetit( "http://www.gutenberg.org/dirs/GUTINDEX.ALL", false); // until ghttp works on binaries -qt3
386 // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3 386 // goGetit( "http://www.gutenberg.net/pgwhole.zip", true); // until ghttp works on binaries -qt3
387 // NetworkDialog *NetworkDlg; 387 // NetworkDialog *NetworkDlg;
388 // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile ); 388 // NetworkDlg = new NetworkDialog( this,"Network Protocol Dialog", TRUE, 0, networkUrl, outputFile );
389 // if( NetworkDlg->exec() != 0 ) 389 // if( NetworkDlg->exec() != 0 )
390 // { // use new, improved, *INSTANT* network-dialog-file-getterer 390 // { // use new, improved, *INSTANT* network-dialog-file-getterer
391 //// QMessageBox::message("Note",""); 391 //// QMessageBox::message("Note","");
392 // } 392 // }
393 // if(NetworkDlg) 393 // if(NetworkDlg)
394 // delete NetworkDlg; 394 // delete NetworkDlg;
395} 395}
396 396
397 397
398void Gutenbrowser::PrintBtn() { 398void Gutenbrowser::PrintBtn() {
399} 399}
400 400
401void Gutenbrowser::SearchBtn() { 401void Gutenbrowser::SearchBtn() {
402 if( loadCheck) { 402 if( loadCheck) {
403 odebug << "loadCheck: we have a loaded doc" << oendl; 403 odebug << "loadCheck: we have a loaded doc" << oendl;
404 Search(); 404 Search();
405 } 405 }
406 // else 406 // else
407 // QMessageBox::message("Note","Sorry, can't search. No etext is loaded"); 407 // QMessageBox::message("Note","Sorry, can't search. No etext is loaded");
408} 408}
409 409
410 410
411void Gutenbrowser::ForwardBtn() { 411void Gutenbrowser::ForwardBtn() {
412 412
413 if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) { 413 if( !ForwardButton->autoRepeat() && !ForwardButton->isDown()) {
414 414
415 QString s; 415 QString s;
416 QString insertString; 416 QString insertString;
417 int pageSize= Lview->PageSize(); 417 int pageSize= Lview->PageSize();
418 Lview->clear(); 418 Lview->clear();
419 419
420 for(int fd=0; fd < pageSize - 1;fd++) { 420 for(int fd=0; fd < pageSize - 1;fd++) {
421 f.readLine(s, 256); 421 f.readLine(s, 256);
422 if(useWrap) 422 if(useWrap)
423 s.replace(QRegExp("\n"),""); 423 s.replace(QRegExp("\n"),"");
424 insertString+=s; 424 insertString+=s;
425 Lview->insertLine( s, -1); 425 Lview->insertLine( s, -1);
426 // odebug << s << oendl; 426 // odebug << s << oendl;
427 currentLine++; 427 currentLine++;
428 } 428 }
429 // Lview->insertAt( insertString,0,0, FALSE); 429 // Lview->insertAt( insertString,0,0, FALSE);
430 currentFilePos = f.at(); 430 currentFilePos = f.at();
431 // if( i_pageNum != pages) { 431 // if( i_pageNum != pages) {
432 // Lview->MultiLine_Ex::pageDown( FALSE); 432 // Lview->MultiLine_Ex::pageDown( FALSE);
433 i_pageNum++; 433 i_pageNum++;
434 pageStopArray.resize(i_pageNum + 1); 434 pageStopArray.resize(i_pageNum + 1);
435 // int length = Lview->length(); 435 // int length = Lview->length();
436 436
437 pageStopArray[i_pageNum ] = currentFilePos; 437 pageStopArray[i_pageNum ] = currentFilePos;
438 odebug << currentFilePos << " current page is number " << i_pageNum 438 odebug << currentFilePos << " current page is number " << i_pageNum
439 << ", pagesize " << pageSize << ", length " << Lview->length() 439 << ", pagesize " << pageSize << ", length " << Lview->length()
440 << ", current " << pageStopArray[i_pageNum] << oendl; 440 << ", current " << pageStopArray[i_pageNum] << oendl;
441 setStatus(); 441 setStatus();
442// Lview->setCursorPosition( 0, 0, FALSE); 442// Lview->setCursorPosition( 0, 0, FALSE);
443 // } 443 // }
444 444
445 } else { 445 } else {
446 odebug << "bal" << oendl; 446 odebug << "bal" << oendl;
447 // if( i_pageNum != pages) { 447 // if( i_pageNum != pages) {
448 448
449 // // int newTop = Lview->Top(); 449 // // int newTop = Lview->Top();
450 // // if(Lview->lastRow() > i) 450 // // if(Lview->lastRow() > i)
451 // Lview->ScrollUp(1); 451 // Lview->ScrollUp(1);
452 // // i_pageNum++; 452 // // i_pageNum++;
453 // setStatus(); 453 // setStatus();
454 // Lview->setCursorPosition( Lview->Top(), 0, FALSE); 454 // Lview->setCursorPosition( Lview->Top(), 0, FALSE);
455 455
456 // } 456 // }
457 457
458 } 458 }
459 Lview->setFocus(); 459 Lview->setFocus();
460 460
461 odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; 461 odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl;
462} 462}
463 463
464 464
465void Gutenbrowser::BackBtn() { 465void Gutenbrowser::BackBtn() {
466 if( i_pageNum > 0) { 466 if( i_pageNum > 0) {
467 int pageSize= Lview->PageSize(); 467 int pageSize= Lview->PageSize();
468 // int length=Lview->length(); 468 // int length=Lview->length();
469 469
470 i_pageNum--; 470 i_pageNum--;
471 currentFilePos = f.at(); 471 currentFilePos = f.at();
472 472
473 odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ] 473 odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ]
474 << ", current page number " << i_pageNum 474 << ", current page number " << i_pageNum
475 << ", " << pageSize << ", length " << Lview->length() << oendl; 475 << ", " << pageSize << ", length " << Lview->length() << oendl;
476 476
477 if( i_pageNum < 2) { 477 if( i_pageNum < 2) {
478 f.at( 0); 478 f.at( 0);
479 } else { 479 } else {
480 if(!f.at( pageStopArray[i_pageNum - 1] )) 480 if(!f.at( pageStopArray[i_pageNum - 1] ))
481 odebug << "File positioned backward did not work" << oendl; 481 odebug << "File positioned backward did not work" << oendl;
482 } 482 }
483 QString s; 483 QString s;
484 // int sizeLine=0; 484 // int sizeLine=0;
485 Lview->clear(); 485 Lview->clear();
486 // QString insertString; 486 // QString insertString;
487 487
488 for(int fd = 0; fd < pageSize ;fd++) { 488 for(int fd = 0; fd < pageSize ;fd++) {
489 // Lview->removeLine( Lview->PageSize() ); 489 // Lview->removeLine( Lview->PageSize() );
490 f.readLine(s, 256); 490 f.readLine(s, 256);
491 if(useWrap) 491 if(useWrap)
492 s.replace(QRegExp("\n"),""); 492 s.replace(QRegExp("\n"),"");
493 currentLine++; 493 currentLine++;
494 // insertString+=s; 494 // insertString+=s;
495 Lview->insertLine( s, -1); 495 Lview->insertLine( s, -1);
496 } 496 }
497 497
498 // Lview->insertAt( insertString,0,0, FALSE); 498 // Lview->insertAt( insertString,0,0, FALSE);
499 499
500 if( !BackButton->autoRepeat() && !BackButton->isDown()) { 500 if( !BackButton->autoRepeat() && !BackButton->isDown()) {
501 QString topR; 501 QString topR;
502 QString lastR; 502 QString lastR;
503 QString pageR; 503 QString pageR;
504 // int sizer = Lview->lastRow() - Lview->topRow(); 504 // int sizer = Lview->lastRow() - Lview->topRow();
505 // int i_topRow = Lview->topRow(); 505 // int i_topRow = Lview->topRow();
506 if( i_pageNum < 1) 506 if( i_pageNum < 1)
507 i_pageNum = 1; 507 i_pageNum = 1;
508 setCaption(QString::number(i_pageNum)); 508 setCaption(QString::number(i_pageNum));
509 } else { 509 } else {
510 // int newTop = Lview->Top(); 510 // int newTop = Lview->Top();
511 // if(Lview->lastRow() > i) 511 // if(Lview->lastRow() > i)
512 Lview->MultiLine_Ex::pageUp( FALSE); 512 Lview->MultiLine_Ex::pageUp( FALSE);
513 // Lview->ScrollDown(1); 513 // Lview->ScrollDown(1);