Diffstat (limited to 'noncore/apps/opie-gutenbrowser/NetworkDialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp index aed53c6..6e6b707 100644 --- a/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/NetworkDialog.cpp | |||
@@ -1,74 +1,80 @@ | |||
1 | // /*************************************************************************** | 1 | // /*************************************************************************** |
2 | // NetworkDialog.cpp - description | 2 | // NetworkDialog.cpp - description |
3 | // begin : Sun Aug 27 2000 | 3 | // begin : Sun Aug 27 2000 |
4 | // copyright : (C) 2000 - 2004 by L.J. Potter | 4 | // copyright : (C) 2000 - 2004 by L.J. Potter |
5 | // email : ljp@llornkcor.com | 5 | // email : ljp@llornkcor.com |
6 | // * This program is free software; you can redistribute it and/or modify * | 6 | // * This program is free software; you can redistribute it and/or modify * |
7 | // * it under the terms of the GNU General Public License as published by * | 7 | // * it under the terms of the GNU General Public License as published by * |
8 | // * the Free Software Foundation; either version 2 of the License, or * | 8 | // * the Free Software Foundation; either version 2 of the License, or * |
9 | // * (at your option) any later version. * | 9 | // * (at your option) any later version. * |
10 | // ***************************************************************************/ | 10 | // ***************************************************************************/ |
11 | // // half-assed attempt at providing a network dialog. | 11 | // // half-assed attempt at providing a network dialog. |
12 | // /* Created: Sun Aug 27 15:24:52 2000*/ | 12 | // /* Created: Sun Aug 27 15:24:52 2000*/ |
13 | #include <unistd.h> | ||
14 | 13 | ||
15 | extern "C" { | ||
16 | #include <ftplib.h> | ||
17 | } | ||
18 | 14 | ||
19 | #include "NetworkDialog.h" | 15 | #include "NetworkDialog.h" |
20 | #include "gutenbrowser.h" | 16 | #include "gutenbrowser.h" |
21 | 17 | ||
18 | /* OPIE */ | ||
19 | #include <opie2/odebug.h> | ||
20 | |||
21 | /* QT */ | ||
22 | #include <qprogressbar.h> | 22 | #include <qprogressbar.h> |
23 | #include <qstringlist.h> | 23 | #include <qstringlist.h> |
24 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
25 | #include <qvaluelist.h> | 25 | #include <qvaluelist.h> |
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | 32 | ||
33 | /* STD */ | ||
34 | #include <unistd.h> | ||
35 | extern "C" { | ||
36 | #include <ftplib.h> | ||
37 | } | ||
38 | |||
33 | QProgressBar* ProgressBar1; | 39 | QProgressBar* ProgressBar1; |
34 | QPushButton* buttonCancel; | 40 | QPushButton* buttonCancel; |
35 | static netbuf *conn = NULL; | 41 | static netbuf *conn = NULL; |
36 | 42 | ||
37 | static int log_progress(netbuf *ctl, int xfered, void *arg) { | 43 | static int log_progress(netbuf *ctl, int xfered, void *arg) { |
38 | int fsz = *(int *)arg; | 44 | int fsz = *(int *)arg; |
39 | int pct = (xfered * 100) / fsz; | 45 | int pct = (xfered * 100) / fsz; |
40 | printf("%3d%%\r", pct); | 46 | printf("%3d%%\r", pct); |
41 | fflush(stdout); | 47 | fflush(stdout); |
42 | ProgressBar1->setProgress(xfered); | 48 | ProgressBar1->setProgress(xfered); |
43 | qApp->processEvents(); | 49 | qApp->processEvents(); |
44 | 50 | ||
45 | return 1; | 51 | return 1; |
46 | } | 52 | } |
47 | 53 | ||
48 | NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL) | 54 | NetworkDialog::NetworkDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QStringList netL) |
49 | : QDialog( parent, name, modal, fl ) | 55 | : QDialog( parent, name, modal, fl ) |
50 | { | 56 | { |
51 | 57 | ||
52 | ftp_host = netL[0]; | 58 | ftp_host = netL[0]; |
53 | networkUrl = strUrl = netL[0]; | 59 | networkUrl = strUrl = netL[0]; |
54 | 60 | ||
55 | dir = ftp_base_dir = netL[1]; | 61 | dir = ftp_base_dir = netL[1]; |
56 | localFileName = netL[2]; | 62 | localFileName = netL[2]; |
57 | s_partialFileName = netL[3]; | 63 | s_partialFileName = netL[3]; |
58 | 64 | ||
59 | resize(240,110); | 65 | resize(240,110); |
60 | 66 | ||
61 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 67 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
62 | // autoOk = autoDownload; | 68 | // autoOk = autoDownload; |
63 | // if( networkUrl.find("ftp",0,false)== -1 ) { | 69 | // if( networkUrl.find("ftp",0,false)== -1 ) { |
64 | // if ( !name ) | 70 | // if ( !name ) |
65 | // setName( "HTTP NetworkDialog" ); | 71 | // setName( "HTTP NetworkDialog" ); |
66 | // setCaption( tr( "HTTP Download ) ); | 72 | // setCaption( tr( "HTTP Download ) ); |
67 | // qInitNetworkProtocols(); // registers ftp protocol // for now | 73 | // qInitNetworkProtocols(); // registers ftp protocol // for now |
68 | // QNetworkProtocol::registerNetworkProtocol( "http", new QNetworkProtocolFactory<Http> ); | 74 | // QNetworkProtocol::registerNetworkProtocol( "http", new QNetworkProtocolFactory<Http> ); |
69 | // } else { | 75 | // } else { |
70 | if ( !name ) | 76 | if ( !name ) |
71 | setName( "FTP NetworkDialog" ); | 77 | setName( "FTP NetworkDialog" ); |
72 | setCaption(tr("FTP Download")); | 78 | setCaption(tr("FTP Download")); |
73 | // } | 79 | // } |
74 | initDialog(); //opens file to be written | 80 | initDialog(); //opens file to be written |
@@ -109,221 +115,221 @@ void NetworkDialog::initDialog() { | |||
109 | buttonCancel->setFixedSize(35,22); | 115 | buttonCancel->setFixedSize(35,22); |
110 | warnLabel ->setGeometry( QRect( 5,1,230,25)); | 116 | warnLabel ->setGeometry( QRect( 5,1,230,25)); |
111 | TextLabel3->setGeometry( QRect( 5,20,230,25)); | 117 | TextLabel3->setGeometry( QRect( 5,20,230,25)); |
112 | Layout1->setGeometry( QRect(1,60,235,50)); //TODO check these!! | 118 | Layout1->setGeometry( QRect(1,60,235,50)); //TODO check these!! |
113 | 119 | ||
114 | // timer= new QTimer(this,"vu timer"); | 120 | // timer= new QTimer(this,"vu timer"); |
115 | // connectionTimer=new QTimer(this,"connectionTimeout"); | 121 | // connectionTimer=new QTimer(this,"connectionTimeout"); |
116 | 122 | ||
117 | connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk())); | 123 | connect(buttonOk,SIGNAL(clicked()),this,SLOT(doOk())); |
118 | connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); | 124 | connect(buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); |
119 | // connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot())); | 125 | // connect( timer, SIGNAL(timeout()), this , SLOT(timeSlot())); |
120 | // connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot())); | 126 | // connect( connectionTimer,SIGNAL( timeout()),this,SLOT( connectionTimeSlot())); |
121 | if(autoOk) { | 127 | if(autoOk) { |
122 | qWarning("XXXXXXXXXXXXXXXXXXXXXXXX"); | 128 | owarn << "XXXXXXXXXXXXXXXXXXXXXXXX" << oendl; |
123 | buttonOk->setDown(true); | 129 | buttonOk->setDown(true); |
124 | doOk(); | 130 | doOk(); |
125 | } | 131 | } |
126 | } | 132 | } |
127 | 133 | ||
128 | void NetworkDialog::timeSlot() { | 134 | void NetworkDialog::timeSlot() { |
129 | 135 | ||
130 | // if(timerProgess < 19 && posTimer) { | 136 | // if(timerProgess < 19 && posTimer) { |
131 | // ProgressBar1->setProgress(timerProgess); | 137 | // ProgressBar1->setProgress(timerProgess); |
132 | // timerProgess++; | 138 | // timerProgess++; |
133 | // } else if(timerProgess > 19 && posTimer) { | 139 | // } else if(timerProgess > 19 && posTimer) { |
134 | // ProgressBar1->setProgress(timerProgess); | 140 | // ProgressBar1->setProgress(timerProgess); |
135 | // timerProgess++; | 141 | // timerProgess++; |
136 | // posTimer=FALSE; | 142 | // posTimer=FALSE; |
137 | // } | 143 | // } |
138 | // if(timerProgess > 1 &&!posTimer) { | 144 | // if(timerProgess > 1 &&!posTimer) { |
139 | // ProgressBar1->setProgress(timerProgess); | 145 | // ProgressBar1->setProgress(timerProgess); |
140 | // timerProgess--; | 146 | // timerProgess--; |
141 | // } else if(timerProgess > 1 &&!posTimer){ | 147 | // } else if(timerProgess > 1 &&!posTimer){ |
142 | // ProgressBar1->setProgress(timerProgess); | 148 | // ProgressBar1->setProgress(timerProgess); |
143 | // timerProgess--; | 149 | // timerProgess--; |
144 | // posTimer=TRUE; | 150 | // posTimer=TRUE; |
145 | // } | 151 | // } |
146 | // // qDebug("timer event"); | 152 | // // odebug << "timer event" << oendl; |
147 | // qApp->processEvents(); | 153 | // qApp->processEvents(); |
148 | // repaint(); | 154 | // repaint(); |
149 | } | 155 | } |
150 | 156 | ||
151 | void NetworkDialog::connectionTimeSlot() { | 157 | void NetworkDialog::connectionTimeSlot() { |
152 | // qDebug("Connections timed out"); | 158 | // odebug << "Connections timed out" << oendl; |
153 | // ftpQuit(); | 159 | // ftpQuit(); |
154 | // qApp->processEvents(); | 160 | // qApp->processEvents(); |
155 | // repaint(); | 161 | // repaint(); |
156 | // reject(); | 162 | // reject(); |
157 | } | 163 | } |
158 | 164 | ||
159 | 165 | ||
160 | /* | 166 | /* |
161 | downloads the file networkUrl */ | 167 | downloads the file networkUrl */ |
162 | bool NetworkDialog::downloadFile( QString networkUrl ) | 168 | bool NetworkDialog::downloadFile( QString networkUrl ) |
163 | { | 169 | { |
164 | int fsz; | 170 | int fsz; |
165 | // timer->start( 250 , FALSE); | 171 | // timer->start( 250 , FALSE); |
166 | // posTimer=TRUE; | 172 | // posTimer=TRUE; |
167 | // connectionTimer->start( 600 , FALSE); | 173 | // connectionTimer->start( 600 , FALSE); |
168 | warnLabel ->setText( ""); | 174 | warnLabel ->setText( ""); |
169 | qApp->processEvents(); | 175 | qApp->processEvents(); |
170 | qDebug("Downloading: %s",networkUrl.latin1()); | 176 | odebug << "Downloading: " << networkUrl << "" << oendl; |
171 | qDebug("Into: %s",localFileName.latin1()); | 177 | odebug << "Into: " << localFileName << "" << oendl; |
172 | if( networkUrl.length() > 5) { | 178 | if( networkUrl.length() > 5) { |
173 | QString ftp_user = "anonymous"; | 179 | QString ftp_user = "anonymous"; |
174 | QString ftp_pass = "zaurus@gutenbrowser.com"; | 180 | QString ftp_pass = "zaurus@gutenbrowser.com"; |
175 | // ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE), | 181 | // ftp_host= networkUrl.mid(networkUrl.find("ftp://",0, TRUE), |
176 | if(ftp_host.length() < 2) { | 182 | if(ftp_host.length() < 2) { |
177 | qDebug("Please select an ftp host" ); | 183 | odebug << "Please select an ftp host" << oendl; |
178 | successDownload=false; | 184 | successDownload=false; |
179 | QMessageBox::message("Note","You need to select an ftp host"); | 185 | QMessageBox::message("Note","You need to select an ftp host"); |
180 | return false; | 186 | return false; |
181 | } | 187 | } |
182 | QString msg; | 188 | QString msg; |
183 | qDebug(ftp_host); | 189 | odebug << ftp_host << oendl; |
184 | qDebug("Opening ftp connection."); | 190 | odebug << "Opening ftp connection." << oendl; |
185 | warnLabel->setText("connecting to: "+ftp_host ); | 191 | warnLabel->setText("connecting to: "+ftp_host ); |
186 | qApp->processEvents(); | 192 | qApp->processEvents(); |
187 | /////////// Open FTP connection | 193 | /////////// Open FTP connection |
188 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 194 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
189 | i=0; | 195 | i=0; |
190 | successDownload=false; | 196 | successDownload=false; |
191 | QMessageBox::message("Note","Unable to connect to\n"+ftp_host); | 197 | QMessageBox::message("Note","Unable to connect to\n"+ftp_host); |
192 | return false; | 198 | return false; |
193 | } | 199 | } |
194 | TextLabel3->setText("Opening ftp connection."); | 200 | TextLabel3->setText("Opening ftp connection."); |
195 | qApp->processEvents(); | 201 | qApp->processEvents(); |
196 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 202 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
197 | FtpQuit(conn); | 203 | FtpQuit(conn); |
198 | successDownload=false; | 204 | successDownload=false; |
199 | msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); | 205 | msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); |
200 | QMessageBox::message("Note",msg); | 206 | QMessageBox::message("Note",msg); |
201 | return false; | 207 | return false; |
202 | } | 208 | } |
203 | qDebug("Changing directories."); | 209 | odebug << "Changing directories." << oendl; |
204 | TextLabel3->setText("Changing directories."); | 210 | TextLabel3->setText("Changing directories."); |
205 | qApp->processEvents(); | 211 | qApp->processEvents(); |
206 | if (!FtpChdir( dir.latin1(), conn )) { | 212 | if (!FtpChdir( dir.latin1(), conn )) { |
207 | successDownload=false; | 213 | successDownload=false; |
208 | msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); | 214 | msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); |
209 | QMessageBox::message("Note",msg); | 215 | QMessageBox::message("Note",msg); |
210 | FtpQuit(conn); | 216 | FtpQuit(conn); |
211 | return false; | 217 | return false; |
212 | } | 218 | } |
213 | // if (!FtpNlst( "./.guten_temp", dir, conn)) { | 219 | // if (!FtpNlst( "./.guten_temp", dir, conn)) { |
214 | // successDownload=false; | 220 | // successDownload=false; |
215 | // msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); | 221 | // msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); |
216 | // QMessageBox::message("Note",msg); | 222 | // QMessageBox::message("Note",msg); |
217 | // FtpQuit(conn); | 223 | // FtpQuit(conn); |
218 | // return false; | 224 | // return false; |
219 | // } | 225 | // } |
220 | qDebug("Requesting directory list."); | 226 | odebug << "Requesting directory list." << oendl; |
221 | TextLabel3->setText("Getting directory list."); | 227 | TextLabel3->setText("Getting directory list."); |
222 | qApp->processEvents(); | 228 | qApp->processEvents(); |
223 | if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) { | 229 | if (!FtpDir( "./.guten_temp", dir.latin1(), conn) ) { |
224 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn)); | 230 | msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn)); |
225 | QMessageBox::message("Note",msg); | 231 | QMessageBox::message("Note",msg); |
226 | successDownload=false; | 232 | successDownload=false; |
227 | FtpQuit(conn); | 233 | FtpQuit(conn); |
228 | return false; | 234 | return false; |
229 | } | 235 | } |
230 | QFile tmp("./.guten_temp"); | 236 | QFile tmp("./.guten_temp"); |
231 | QString s, File_Name; | 237 | QString s, File_Name; |
232 | 238 | ||
233 | if (tmp.open(IO_ReadOnly)) { | 239 | if (tmp.open(IO_ReadOnly)) { |
234 | QTextStream t( &tmp ); // use a text stream | 240 | QTextStream t( &tmp ); // use a text stream |
235 | qDebug("Finding partial filename "+s_partialFileName); | 241 | odebug << "Finding partial filename "+s_partialFileName << oendl; |
236 | while ( !t.eof()) { | 242 | while ( !t.eof()) { |
237 | s = t.readLine(); | 243 | s = t.readLine(); |
238 | 244 | ||
239 | if (s.contains(s_partialFileName, FALSE)) { | 245 | if (s.contains(s_partialFileName, FALSE)) { |
240 | QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) ); | 246 | QString str = s.right( (s.length()) - (s.find(s_partialFileName, FALSE)) ); |
241 | 247 | ||
242 | if (str.contains(".txt")) { | 248 | if (str.contains(".txt")) { |
243 | File_Name = str; | 249 | File_Name = str; |
244 | qDebug("Found file_name "+ File_Name); | 250 | odebug << "Found file_name "+ File_Name << oendl; |
245 | break; | 251 | break; |
246 | } | 252 | } |
247 | // if (str.contains(".zip")) { | 253 | // if (str.contains(".zip")) { |
248 | // File_Name = str; | 254 | // File_Name = str; |
249 | // qDebug("Found file_name "+ File_Name); | 255 | // odebug << "Found file_name "+ File_Name << oendl; |
250 | // break; | 256 | // break; |
251 | // } | 257 | // } |
252 | 258 | ||
253 | } | 259 | } |
254 | } //end of while loop | 260 | } //end of while loop |
255 | tmp.close(); | 261 | tmp.close(); |
256 | // tmp.remove(); ///TODO this is for release version Zaurus | 262 | // tmp.remove(); ///TODO this is for release version Zaurus |
257 | } | 263 | } |
258 | else | 264 | else |
259 | qDebug("Error opening temp file."); | 265 | odebug << "Error opening temp file." << oendl; |
260 | 266 | ||
261 | Config cfg("Gutenbrowser"); | 267 | Config cfg("Gutenbrowser"); |
262 | cfg.setGroup("General"); | 268 | cfg.setGroup("General"); |
263 | QString temp=cfg.readEntry("DownloadDirectory",local_library); | 269 | QString temp=cfg.readEntry("DownloadDirectory",local_library); |
264 | 270 | ||
265 | localFileName = temp+File_Name; | 271 | localFileName = temp+File_Name; |
266 | qDebug("Requesting file "+ File_Name); | 272 | odebug << "Requesting file "+ File_Name << oendl; |
267 | qDebug( "Saving as "+localFileName); | 273 | odebug << "Saving as "+localFileName << oendl; |
268 | msg="Requesting file "+ File_Name; | 274 | msg="Requesting file "+ File_Name; |
269 | TextLabel3->setText(msg); | 275 | TextLabel3->setText(msg); |
270 | qApp->processEvents(); | 276 | qApp->processEvents(); |
271 | if( File_Name.length()>3) { | 277 | if( File_Name.length()>3) { |
272 | if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn)) | 278 | if (!FtpSize( File_Name.latin1(), &fsz, FTPLIB_ASCII, conn)) |
273 | fsz = 0; | 279 | fsz = 0; |
274 | QString temp; | 280 | QString temp; |
275 | temp.sprintf( File_Name+" "+" %dkb", fsz); | 281 | temp.sprintf( File_Name+" "+" %dkb", fsz); |
276 | TextLabel3->setText(temp); | 282 | TextLabel3->setText(temp); |
277 | 283 | ||
278 | ProgressBar1->setTotalSteps(fsz); | 284 | ProgressBar1->setTotalSteps(fsz); |
279 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 285 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
280 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 286 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
281 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 287 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
282 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 288 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
283 | 289 | ||
284 | if (!FtpGet( localFileName.latin1(), File_Name.latin1(), FTPLIB_ASCII, conn)) { | 290 | if (!FtpGet( localFileName.latin1(), File_Name.latin1(), FTPLIB_ASCII, conn)) { |
285 | msg.sprintf("Could not download "+ File_Name+"\n%s",FtpLastResponse(conn)); | 291 | msg.sprintf("Could not download "+ File_Name+"\n%s",FtpLastResponse(conn)); |
286 | successDownload=false; | 292 | successDownload=false; |
287 | QMessageBox::message("Note",msg); | 293 | QMessageBox::message("Note",msg); |
288 | update(); | 294 | update(); |
289 | } | 295 | } |
290 | } else { | 296 | } else { |
291 | QMessageBox::message("Note","Could not download file "+ File_Name); | 297 | QMessageBox::message("Note","Could not download file "+ File_Name); |
292 | successDownload=false; | 298 | successDownload=false; |
293 | FtpQuit(conn); | 299 | FtpQuit(conn); |
294 | return false; | 300 | return false; |
295 | } | 301 | } |
296 | qDebug("Ftp session successful"); | 302 | odebug << "Ftp session successful" << oendl; |
297 | successDownload=TRUE; | 303 | successDownload=TRUE; |
298 | FtpQuit(conn); | 304 | FtpQuit(conn); |
299 | return true; | 305 | return true; |
300 | } //no network url | 306 | } //no network url |
301 | return false; | 307 | return false; |
302 | } | 308 | } |
303 | 309 | ||
304 | void NetworkDialog::doOk() { | 310 | void NetworkDialog::doOk() { |
305 | qWarning("Do OK"); | 311 | owarn << "Do OK" << oendl; |
306 | QString loginStr; | 312 | QString loginStr; |
307 | loginStr = "gutenbrowser"; | 313 | loginStr = "gutenbrowser"; |
308 | if ( !ftp_host.isEmpty() ) { | 314 | if ( !ftp_host.isEmpty() ) { |
309 | if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) { | 315 | if( ftp_host.find( "/", ftp_host.length() - 1,TRUE) != -1 && ftp_host.find("ftp://",0, TRUE) != -1) { |
310 | TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) ); | 316 | TextLabel3->setText( tr( "List remote dir:\n" + ftp_host) ); |
311 | // TextLabel2->setText( tr( "local file to download into: " +localFileName ) ); | 317 | // TextLabel2->setText( tr( "local file to download into: " +localFileName ) ); |
312 | 318 | ||
313 | if( downloadFile(ftp_host)) | 319 | if( downloadFile(ftp_host)) |
314 | successDownload = true; | 320 | successDownload = true; |
315 | else { | 321 | else { |
316 | successDownload = false; | 322 | successDownload = false; |
317 | reject(); | 323 | reject(); |
318 | } | 324 | } |
319 | } else { | 325 | } else { |
320 | if(downloadFile(ftp_host)) | 326 | if(downloadFile(ftp_host)) |
321 | successDownload = true; | 327 | successDownload = true; |
322 | else { | 328 | else { |
323 | successDownload = false; | 329 | successDownload = false; |
324 | reject(); | 330 | reject(); |
325 | } | 331 | } |
326 | } | 332 | } |
327 | } | 333 | } |
328 | accept(); | 334 | accept(); |
329 | } | 335 | } |