Diffstat (limited to 'noncore/apps/opie-gutenbrowser/NetworkDialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp index a321952..ba583ad 100644 --- a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | |||
@@ -167,46 +167,45 @@ bool NetworkDialog::downloadFile( QString networkUrl ) | |||
167 | // FtpQuit(conn); | 167 | // FtpQuit(conn); |
168 | // return false; | 168 | // return false; |
169 | // } | 169 | // } |
170 | odebug << "Requesting directory list." << oendl; | 170 | QString File_Name; |
171 | TextLabel3->setText("Getting directory list."); | ||
172 | qApp->processEvents(); | ||
173 | if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) { | ||
174 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn)); | ||
175 | QMessageBox::message("Note",msg); | ||
176 | successDownload=false; | ||
177 | FtpQuit(conn); | ||
178 | return false; | ||
179 | } | ||
180 | QFile tmp("./.guten_temp"); | ||
181 | QString s, File_Name; | ||
182 | 171 | ||
183 | if (tmp.open(IO_ReadOnly)) { | 172 | if( s_partialFileName.right(4) != ".txt") { |
184 | QTextStream t( &tmp ); // use a text stream | 173 | TextLabel3->setText("Getting directory list."); |
185 | odebug << "Finding partial filename "+s_partialFileName << oendl; | 174 | qApp->processEvents(); |
186 | while ( !t.eof()) { | 175 | if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) { |
187 | s = t.readLine(); | 176 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn)); |
177 | QMessageBox::message("Note",msg); | ||
178 | successDownload = false; | ||
179 | FtpQuit(conn); | ||
180 | return false; | ||
181 | } | ||
182 | QFile tmp("./.guten_temp"); | ||
183 | if (tmp.open(IO_ReadOnly)) { | ||
184 | QTextStream t( &tmp ); // use a text stream | ||
185 | //odebug << "Finding partial filename "+s_partialFileName << oendl; | ||
186 | QString s; | ||
188 | 187 | ||
189 | if (s.contains(s_partialFileName, FALSE)) { | 188 | while ( !t.eof()) { |
190 | QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) ); | 189 | s = t.readLine(); |
191 | 190 | ||
192 | if (str.contains(".txt")) { | 191 | if (s.contains(s_partialFileName, FALSE)) { |
193 | File_Name = str; | 192 | QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) ); |
194 | odebug << "Found file_name "+ File_Name << oendl; | ||
195 | break; | ||
196 | } | ||
197 | // if (str.contains(".zip")) { | ||
198 | // File_Name = str; | ||
199 | // odebug << "Found file_name "+ File_Name << oendl; | ||
200 | // break; | ||
201 | // } | ||
202 | 193 | ||
203 | } | 194 | if (str.contains(".txt")) { |
204 | } //end of while loop | 195 | File_Name = str; |
205 | tmp.close(); | 196 | //odebug << "Found file_name "+ File_Name << oendl; |
197 | break; | ||
198 | } | ||
199 | } | ||
200 | } //end of while loop | ||
201 | tmp.close(); | ||
206 | // tmp.remove(); ///TODO this is for release version Zaurus | 202 | // tmp.remove(); ///TODO this is for release version Zaurus |
203 | } | ||
204 | } else { | ||
205 | File_Name = s_partialFileName; | ||
206 | qDebug("new dir " + File_Name); | ||
207 | } | 207 | } |
208 | else | 208 | |
209 | odebug << "Error opening temp file." << oendl; | ||
210 | 209 | ||
211 | Config cfg("Gutenbrowser"); | 210 | Config cfg("Gutenbrowser"); |
212 | cfg.setGroup("General"); | 211 | cfg.setGroup("General"); |