summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/LibraryDialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/LibraryDialog.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
index 270a4cf..124b6f3 100644
--- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp
@@ -77,24 +77,26 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W
77 77
78 config.setGroup("SortAuth"); 78 config.setGroup("SortAuth");
79 if( config.readEntry("authSort", "FALSE") == "TRUE") 79 if( config.readEntry("authSort", "FALSE") == "TRUE")
80 authBox->setChecked(TRUE); 80 authBox->setChecked(TRUE);
81 81
82 config.setGroup("General"); 82 config.setGroup("General");
83 downDir =config.readEntry( "DownloadDirectory",local_library); 83 downDir =config.readEntry( "DownloadDirectory",local_library);
84 odebug << "downDir is "+downDir << oendl; 84 odebug << "downDir is "+downDir << oendl;
85 newindexLib.setName( old_index); 85 newindexLib.setName( old_index);
86 indexLib.setName( old_index); 86 indexLib.setName( old_index);
87 87
88 new QPEDialogListener(this); 88 new QPEDialogListener(this);
89 QTimer::singleShot( 1000, this, SLOT( FindLibrary()) );
90
89} 91}
90 92
91LibraryDialog::~LibraryDialog() 93LibraryDialog::~LibraryDialog()
92{ 94{
93// delete QList_Item2; 95// delete QList_Item2;
94// delete QList_Item1; 96// delete QList_Item1;
95// delete QList_Item3; 97// delete QList_Item3;
96// delete QList_Item4; 98// delete QList_Item4;
97// delete QList_Item5; 99// delete QList_Item5;
98 100
99 // saveConfig(); 101 // saveConfig();
100} 102}
@@ -246,25 +248,25 @@ void LibraryDialog::Library()
246 248
247 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || 249 else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) ||
248 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) 250 (author.left(1) >= QString("s") && author.left(1) <= QString("z")) )
249 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); 251 QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file );
250 } 252 }
251 } 253 }
252 } 254 }
253 } 255 }
254 } 256 }
255 indexLib.close(); 257 indexLib.close();
256 } else { 258 } else {
257 QString sMsg; 259 QString sMsg;
258 sMsg = ( tr("Error opening local library index:\n "))+local_index; 260 sMsg = ( tr("<p>Error opening local library index:</P> "))+local_index;
259 QMessageBox::message( "Error",sMsg); 261 QMessageBox::message( "Error",sMsg);
260 } 262 }
261 263
262} //end Library() 264} //end Library()
263 265
264 266
265 /* 267 /*
266 Groks the author out of the title */ 268 Groks the author out of the title */
267bool LibraryDialog::getAuthor() 269bool LibraryDialog::getAuthor()
268{ 270{
269 if( title.contains( ", by", TRUE)) { 271 if( title.contains( ", by", TRUE)) {
270 int auth; 272 int auth;
@@ -502,25 +504,25 @@ bool LibraryDialog::download_Etext()
502 lnk.setComment(DlglistItemTitle); 504 lnk.setComment(DlglistItemTitle);
503 505
504 odebug << "Filename is "+File_Name << oendl; 506 odebug << "Filename is "+File_Name << oendl;
505 lnk.setFile(File_Name); //sets File property 507 lnk.setFile(File_Name); //sets File property
506 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D 508 lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D
507 lnk.setExec(File_Name); 509 lnk.setExec(File_Name);
508 lnk.setIcon("gutenbrowser/Gutenbrowser"); 510 lnk.setIcon("gutenbrowser/Gutenbrowser");
509 if(!lnk.writeLink()) { 511 if(!lnk.writeLink()) {
510 odebug << "Writing doclink did not work" << oendl; 512 odebug << "Writing doclink did not work" << oendl;
511 } else { 513 } else {
512 } 514 }
513 } else 515 } else
514 QMessageBox::message("Note","There was an error\nwith the file"); 516 QMessageBox::message("Note","<p>There was an error with the file</p>");
515 } 517 }
516 } 518 }
517 return true; 519 return true;
518} 520}
519 521
520bool LibraryDialog::httpDownload() 522bool LibraryDialog::httpDownload()
521{// httpDownload 523{// httpDownload
522#ifndef Q_WS_QWS 524#ifndef Q_WS_QWS
523 Config config("Gutenbrowser"); 525 Config config("Gutenbrowser");
524 config.setGroup( "Browser" ); 526 config.setGroup( "Browser" );
525 QString brow = config.readEntry("Preferred", ""); 527 QString brow = config.readEntry("Preferred", "");
526 QString file_name = "./.guten_temp"; 528 QString file_name = "./.guten_temp";
@@ -930,25 +932,25 @@ void LibraryDialog::newList()
930 onButtonDownload(); 932 onButtonDownload();
931 } else { 933 } else {
932 Output *outDlg; 934 Output *outDlg;
933 buttonNewList->setDown(TRUE); 935 buttonNewList->setDown(TRUE);
934 QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); 936 QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser");
935 if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); 937 if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true);
936 if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { 938 if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) {
937 odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; 939 odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl;
938 QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; 940 QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL";
939 QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; 941 QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1";
940 942
941 int result = QMessageBox::warning( this,"Download" 943 int result = QMessageBox::warning( this,"Download"
942 ,"Ok to use /'wget/' to download\na new library list?\n" 944 ,"<p>Ok to use /'wget/' to download a new library list?</P>"
943 ,"Yes","No",0,0,1); 945 ,"Yes","No",0,0,1);
944 qApp->processEvents(); 946 qApp->processEvents();
945 if(result == 0) { 947 if(result == 0) {
946 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); 948 outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE);
947 outDlg->showMaximized(); 949 outDlg->showMaximized();
948 outDlg->show(); 950 outDlg->show();
949 qApp->processEvents(); 951 qApp->processEvents();
950 FILE *fp; 952 FILE *fp;
951 char line[130]; 953 char line[130];
952 outDlg->OutputEdit->append( tr("Running wget") ); 954 outDlg->OutputEdit->append( tr("Running wget") );
953 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 955 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
954 sleep(1); 956 sleep(1);
@@ -1028,25 +1030,25 @@ bool LibraryDialog::moreInfo()
1028 } 1030 }
1029 item=0; 1031 item=0;
1030 if(titleString.length()>2) { 1032 if(titleString.length()>2) {
1031 odebug << "Title is "+titleString << oendl; 1033 odebug << "Title is "+titleString << oendl;
1032 titleString.replace( QRegExp("\\s"), "%20"); 1034 titleString.replace( QRegExp("\\s"), "%20");
1033 titleString.replace( QRegExp("'"), "%20"); 1035 titleString.replace( QRegExp("'"), "%20");
1034 titleString.replace( QRegExp("\""), "%20"); 1036 titleString.replace( QRegExp("\""), "%20");
1035 titleString.replace( QRegExp("&"), "%20"); 1037 titleString.replace( QRegExp("&"), "%20");
1036 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; 1038 QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search";
1037 cmd="opera "+cmd; 1039 cmd="opera "+cmd;
1038 system(cmd); 1040 system(cmd);
1039 } else 1041 } else
1040 QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title."); 1042 QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>");
1041 return true; 1043 return true;
1042 1044
1043} 1045}
1044 1046
1045 /* 1047 /*
1046 This loads the library Index*/ 1048 This loads the library Index*/
1047void LibraryDialog::FindLibrary() 1049void LibraryDialog::FindLibrary()
1048{ 1050{
1049 buttonLibrary->setDown(TRUE); 1051 buttonLibrary->setDown(TRUE);
1050 1052
1051 qApp->processEvents(); 1053 qApp->processEvents();
1052 if( QFile( new_index).exists() /* && this->isHidden() */) { 1054 if( QFile( new_index).exists() /* && this->isHidden() */) {