Diffstat (limited to 'noncore/apps/opie-gutenbrowser/gutenbrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index fac21da..c7cdd83 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | |||
@@ -208,49 +208,60 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | |||
208 | filename+="etc/gutenbrowser/"; | 208 | filename+="etc/gutenbrowser/"; |
209 | odebug << "filename "+filename << oendl; | 209 | odebug << "filename "+filename << oendl; |
210 | // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; | 210 | // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; |
211 | 211 | ||
212 | filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); | 212 | filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); |
213 | 213 | ||
214 | Config config("Gutenbrowser"); | 214 | Config config("Gutenbrowser"); |
215 | config.setGroup( "Browser" ); | 215 | config.setGroup( "Browser" ); |
216 | QString brow = config.readEntry("Preferred", "Opera"); | 216 | QString brow = config.readEntry("Preferred", "Opera"); |
217 | odebug << "Preferred browser is "+brow << oendl; | 217 | odebug << "Preferred browser is "+brow << oendl; |
218 | if(!showMsg) { //if we just get the gutenindex.all | 218 | if(!showMsg) { //if we just get the gutenindex.all |
219 | cmd="wget -O " + filename +" " + url+" 2>&1" ; | 219 | cmd="wget -O " + filename +" " + url+" 2>&1" ; |
220 | chdir(local_library); | 220 | chdir(local_library); |
221 | odebug << "Issuing the system command: " << cmd << "" << oendl; | 221 | odebug << "Issuing the system command: " << cmd << "" << oendl; |
222 | 222 | ||
223 | Output *outDlg; | 223 | Output *outDlg; |
224 | outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); | 224 | |
225 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); | ||
226 | |||
225 | outDlg->showMaximized(); | 227 | outDlg->showMaximized(); |
226 | outDlg->show(); | 228 | outDlg->show(); |
227 | qApp->processEvents(); | 229 | qApp->processEvents(); |
228 | FILE *fp; | 230 | FILE *fp; |
229 | char line[130]; | 231 | char line[130]; |
230 | outDlg->OutputEdit->append( tr("Running wget") ); | 232 | outDlg->OutputEdit->append( tr("Running wget") ); |
233 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | ||
231 | sleep(1); | 234 | sleep(1); |
232 | fp = popen( (const char *) cmd, "r"); | 235 | fp = popen( (const char *) cmd, "r"); |
233 | odebug << "Issuing the command\n"+cmd << oendl; | 236 | if ( !fp ) { |
234 | // system(cmd); | 237 | } else { |
235 | while ( fgets( line, sizeof line, fp)) { | 238 | //odebug << "Issuing the command\n"+cmd << oendl; |
236 | outDlg->OutputEdit->append(line); | 239 | // system(cmd); |
237 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 240 | while ( fgets( line, sizeof line, fp)) { |
241 | outDlg->OutputEdit->append(line); | ||
242 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | ||
243 | } | ||
244 | pclose(fp); | ||
245 | outDlg->OutputEdit->append("Finished downloading\n"); | ||
246 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | ||
247 | qApp->processEvents(); | ||
248 | |||
238 | } | 249 | } |
239 | pclose(fp); | 250 | outDlg->close(); |
240 | outDlg->close(); | 251 | |
241 | if(outDlg) | 252 | if(outDlg) |
242 | delete outDlg; | 253 | delete outDlg; |
243 | } else { | 254 | } else { |
244 | if( brow == "Konq") { | 255 | if( brow == "Konq") { |
245 | cmd = "konqueror "+url+" &"; | 256 | cmd = "konqueror "+url+" &"; |
246 | } | 257 | } |
247 | if( brow == "Opera") { //for desktop testing | 258 | if( brow == "Opera") { //for desktop testing |
248 | cmd = "opera "+url+" &"; | 259 | cmd = "opera "+url+" &"; |
249 | } | 260 | } |
250 | // if( brow == "Opera") { // on Zaurus | 261 | // if( brow == "Opera") { // on Zaurus |
251 | // cmd = "operagui "+url+" &"; | 262 | // cmd = "operagui "+url+" &"; |
252 | // } | 263 | // } |
253 | if( brow == "Mozilla") { | 264 | if( brow == "Mozilla") { |
254 | cmd = "mozilla "+url+" &"; | 265 | cmd = "mozilla "+url+" &"; |
255 | } | 266 | } |
256 | if( brow == "Netscape") { | 267 | if( brow == "Netscape") { |