Diffstat (limited to 'noncore/apps/opie-gutenbrowser/gutenbrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index c7cdd83..413ab51 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | |||
@@ -132,31 +132,31 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
132 | QString ramble = config.readEntry( QString::number(i), "" ); | 132 | QString ramble = config.readEntry( QString::number(i), "" ); |
133 | 133 | ||
134 | config.setGroup( "Titles" ); | 134 | config.setGroup( "Titles" ); |
135 | QString tempTitle = config.readEntry( ramble, ""); | 135 | QString tempTitle = config.readEntry( ramble, ""); |
136 | config.setGroup( tempTitle); | 136 | config.setGroup( tempTitle); |
137 | int index = config.readNumEntry( "LineNumber", -1 ); | 137 | int index = config.readNumEntry( "LineNumber", -1 ); |
138 | if( index != -1) { | 138 | if( index != -1) { |
139 | odebug << tempTitle << oendl; | 139 | odebug << tempTitle << oendl; |
140 | if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle); | 140 | if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; | 144 | QString gutenIndex = local_library + "/GUTINDEX.ALL"; |
145 | QString gutenIndex = QPEApplication::qpeDir()+ "etc/gutenbrowser/GUTINDEX.ALL"; | ||
146 | qDebug("gutenindex "+gutenIndex ); | 145 | qDebug("gutenindex "+gutenIndex ); |
146 | |||
147 | if( QFile( gutenIndex).exists() ) { | 147 | if( QFile( gutenIndex).exists() ) { |
148 | indexLib.setName( gutenIndex); | 148 | indexLib.setName( gutenIndex); |
149 | } else { | 149 | } else { |
150 | QString localLibIndexFile = QPEApplication::qpeDir()+ "etc/gutenbrowser/PGWHOLE.TXT"; | 150 | QString localLibIndexFile = local_library + "/PGWHOLE.TXT"; |
151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; | 151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; |
152 | newindexLib.setName( localLibIndexFile); | 152 | newindexLib.setName( localLibIndexFile); |
153 | } | 153 | } |
154 | qDebug("attempting new library"); | 154 | qDebug("attempting new library"); |
155 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); | 155 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); |
156 | loadCheck = false; | 156 | loadCheck = false; |
157 | chdir(local_library); | 157 | chdir(local_library); |
158 | if(!showMainList) { | 158 | if(!showMainList) { |
159 | Lview->setFocus(); | 159 | Lview->setFocus(); |
160 | // if(firstTime) | 160 | // if(firstTime) |
161 | // Bookmark(); | 161 | // Bookmark(); |
162 | for (int i=1;i< qApp->argc();i++) { | 162 | for (int i=1;i< qApp->argc();i++) { |
@@ -188,46 +188,46 @@ void Gutenbrowser::InfoBarClick() { | |||
188 | QClipboard *cb = QApplication::clipboard(); | 188 | QClipboard *cb = QApplication::clipboard(); |
189 | text = cb->text(); | 189 | text = cb->text(); |
190 | } else { | 190 | } else { |
191 | // text=title; | 191 | // text=title; |
192 | text=this->caption(); | 192 | text=this->caption(); |
193 | } | 193 | } |
194 | searchGoogle(text); | 194 | searchGoogle(text); |
195 | } | 195 | } |
196 | 196 | ||
197 | /* | 197 | /* |
198 | download http with wget or preferred browser */ | 198 | download http with wget or preferred browser */ |
199 | void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | 199 | void Gutenbrowser::goGetit( const QString &url, bool showMsg) { |
200 | // int eexit=0; | ||
201 | QString cmd; | 200 | QString cmd; |
202 | // config.read(); | ||
203 | qApp->processEvents(); | 201 | qApp->processEvents(); |
204 | QString filename = QPEApplication::qpeDir(); | ||
205 | if(filename.right(1)!="/") | ||
206 | filename+="/etc/gutenbrowser/"; | ||
207 | else | ||
208 | filename+="etc/gutenbrowser/"; | ||
209 | odebug << "filename "+filename << oendl; | ||
210 | // QString filename = QDir::homeDirPath()+"/Applications/gutenbrowser/"; | ||
211 | 202 | ||
212 | filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); | 203 | QString filename = local_library + "/GUTINDEX.ALL"; |
204 | // QString filename = old_index; | ||
213 | 205 | ||
214 | Config config("Gutenbrowser"); | 206 | // filename += url.right( url.length() - url.findRev("/",-1,TRUE) -1); |
215 | config.setGroup( "Browser" ); | 207 | |
216 | QString brow = config.readEntry("Preferred", "Opera"); | 208 | Config cfg("Gutenbrowser"); |
217 | odebug << "Preferred browser is "+brow << oendl; | 209 | cfg.setGroup("FTPsite"); |
210 | ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org"); | ||
211 | ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg"); | ||
212 | |||
213 | // Config config("Gutenbrowser"); | ||
214 | // config.setGroup( "Browser" ); | ||
215 | // QString brow = config.readEntry("Preferred", "Opera"); | ||
216 | // //odebug << "Preferred browser is "+brow << oendl; | ||
218 | if(!showMsg) { //if we just get the gutenindex.all | 217 | if(!showMsg) { //if we just get the gutenindex.all |
218 | // QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; | ||
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 | 224 | ||
225 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); | 225 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); |
226 | 226 | ||
227 | outDlg->showMaximized(); | 227 | outDlg->showMaximized(); |
228 | outDlg->show(); | 228 | outDlg->show(); |
229 | qApp->processEvents(); | 229 | qApp->processEvents(); |
230 | FILE *fp; | 230 | FILE *fp; |
231 | char line[130]; | 231 | char line[130]; |
232 | outDlg->OutputEdit->append( tr("Running wget") ); | 232 | outDlg->OutputEdit->append( tr("Running wget") ); |
233 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 233 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
@@ -265,25 +265,25 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | |||
265 | cmd = "mozilla "+url+" &"; | 265 | cmd = "mozilla "+url+" &"; |
266 | } | 266 | } |
267 | if( brow == "Netscape") { | 267 | if( brow == "Netscape") { |
268 | cmd = "netscape "+url+" &"; | 268 | cmd = "netscape "+url+" &"; |
269 | } | 269 | } |
270 | if(brow == "wget") { | 270 | if(brow == "wget") { |
271 | // cmd="wget -q "+url+" &"; | 271 | // cmd="wget -q "+url+" &"; |
272 | QString tempHtml=local_library+"webster.html"; | 272 | QString tempHtml=local_library+"webster.html"; |
273 | cmd="wget -O "+tempHtml+" -q "+url; | 273 | cmd="wget -O "+tempHtml+" -q "+url; |
274 | } | 274 | } |
275 | 275 | ||
276 | chdir(local_library); | 276 | chdir(local_library); |
277 | odebug << "Issuing the sys command: " << cmd << "" << oendl; | 277 | // //odebug << "Issuing the sys command: " << cmd << "" << oendl; |
278 | system(cmd); | 278 | system(cmd); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | void Gutenbrowser::toggleButtonIcons( bool useEm) { | 282 | void Gutenbrowser::toggleButtonIcons( bool useEm) { |
283 | QString pixDir; | 283 | QString pixDir; |
284 | if(useEm) | 284 | if(useEm) |
285 | useEm=TRUE; | 285 | useEm=TRUE; |
286 | pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; | 286 | pixDir=QPEApplication::qpeDir()+"pics/gutenbrowser"; |
287 | odebug << "Docdir is "+QPEApplication::documentDir() << oendl; | 287 | odebug << "Docdir is "+QPEApplication::documentDir() << oendl; |
288 | 288 | ||
289 | if( useIcons && QDir( pixDir).exists() ) { | 289 | if( useIcons && QDir( pixDir).exists() ) { |