summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-16 15:16:58 (UTC)
committer llornkcor <llornkcor>2002-03-16 15:16:58 (UTC)
commit1d20ca78752b9da597950087438daa9ff8cb7951 (patch) (unidiff)
tree5cce2048ba6cd8fd16e98bf9f4ab8c5ead4fe8b3
parent585373903040f7d283c8fef1841147739f0510d8 (diff)
downloadopie-1d20ca78752b9da597950087438daa9ff8cb7951.zip
opie-1d20ca78752b9da597950087438daa9ff8cb7951.tar.gz
opie-1d20ca78752b9da597950087438daa9ff8cb7951.tar.bz2
added cd to stylus hold, so user doesn't have to double click
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp37
-rw-r--r--noncore/net/opieftp/opieftp.h6
2 files changed, 32 insertions, 11 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 523a36c..ed7f4bb 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -170,601 +170,620 @@ OpieFtp::OpieFtp( )
170 TextLabel5->setGeometry( QRect( 10, 130, 95, 16 ) ); 170 TextLabel5->setGeometry( QRect( 10, 130, 95, 16 ) );
171 TextLabel5->setText( tr( "Remote path" ) ); 171 TextLabel5->setText( tr( "Remote path" ) );
172 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 172 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
173 remotePath->setGeometry( QRect( 10, 145, 195, 16 ) ); 173 remotePath->setGeometry( QRect( 10, 145, 195, 16 ) );
174 remotePath->setText( currentRemoteDir = "/"); 174 remotePath->setText( currentRemoteDir = "/");
175// remotePath->setText( currentRemoteDir = "/home/llornkcor/"); 175// remotePath->setText( currentRemoteDir = "/home/llornkcor/");
176 176
177 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 177 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
178 TextLabel4->setGeometry( QRect( 10, 170, 30, 21 ) ); 178 TextLabel4->setGeometry( QRect( 10, 170, 30, 21 ) );
179 TextLabel4->setText( tr( "Port" ) ); 179 TextLabel4->setText( tr( "Port" ) );
180 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 180 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
181 PortSpinBox->setGeometry( QRect( 40, 175, 75, 20 ) ); 181 PortSpinBox->setGeometry( QRect( 40, 175, 75, 20 ) );
182 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 182 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
183 PortSpinBox->setMaxValue(32786); 183 PortSpinBox->setMaxValue(32786);
184 PortSpinBox->setValue( 21); 184 PortSpinBox->setValue( 21);
185 185
186 TabWidget->insertTab( tab_3, tr( "Config" ) ); 186 TabWidget->insertTab( tab_3, tr( "Config" ) );
187 187
188 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 188 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
189 this,SLOT(tabChanged(QWidget*))); 189 this,SLOT(tabChanged(QWidget*)));
190 190
191 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 191 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
192 currentDir.setPath( QDir::currentDirPath()); 192 currentDir.setPath( QDir::currentDirPath());
193// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 193// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
194 currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); 194 currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" );
195 currentPathEdit->setGeometry( QRect( 5, 248, 220, 18 ) ); 195 currentPathEdit->setGeometry( QRect( 5, 248, 220, 18 ) );
196 currentPathEdit->setText( currentDir.canonicalPath()); 196 currentPathEdit->setText( currentDir.canonicalPath());
197 connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); 197 connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged()));
198 198
199 filterStr="*"; 199 filterStr="*";
200 populateLocalView(); 200 populateLocalView();
201} 201}
202 202
203OpieFtp::~OpieFtp() 203OpieFtp::~OpieFtp()
204{ 204{
205} 205}
206 206
207void OpieFtp::cleanUp() 207void OpieFtp::cleanUp()
208{ 208{
209 if(conn) 209 if(conn)
210 FtpQuit(conn); 210 FtpQuit(conn);
211 QFile f("./._temp"); 211 QFile f("./._temp");
212 if(f.exists()) 212 if(f.exists())
213 f. remove(); 213 f. remove();
214} 214}
215 215
216void OpieFtp::tabChanged(QWidget *w) 216void OpieFtp::tabChanged(QWidget *w)
217{ 217{
218 if (TabWidget->currentPageIndex() == 0) { 218 if (TabWidget->currentPageIndex() == 0) {
219 currentPathEdit->setText( currentDir.canonicalPath()); 219 currentPathEdit->setText( currentDir.canonicalPath());
220 } else if (TabWidget->currentPageIndex() == 1) { 220 } else if (TabWidget->currentPageIndex() == 1) {
221 currentPathEdit->setText( currentRemoteDir ); 221 currentPathEdit->setText( currentRemoteDir );
222 } 222 }
223} 223}
224 224
225void OpieFtp::localUpload() 225void OpieFtp::localUpload()
226{ 226{
227 int fsz; 227 int fsz;
228 QCopEnvelope ( "QPE/System", "busy()" ); 228 QCopEnvelope ( "QPE/System", "busy()" );
229 qApp->processEvents(); 229 qApp->processEvents();
230 QString strItem = Local_View->currentItem()->text(0); 230 QString strItem = Local_View->currentItem()->text(0);
231 QString localFile = currentDir.canonicalPath()+"/"+strItem; 231 QString localFile = currentDir.canonicalPath()+"/"+strItem;
232 QString remoteFile= currentRemoteDir+strItem; 232 QString remoteFile= currentRemoteDir+strItem;
233 QFileInfo fi(localFile); 233 QFileInfo fi(localFile);
234 if( !fi.isDir()) { 234 if( !fi.isDir()) {
235 fsz=fi.size(); 235 fsz=fi.size();
236 ProgressBar->setTotalSteps(fsz); 236 ProgressBar->setTotalSteps(fsz);
237 237
238 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 238 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
239 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 239 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
240 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 240 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
241 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 241 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
242 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 242 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
243 243
244 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 244 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
245 QString msg; 245 QString msg;
246 msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn)); 246 msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn));
247 msg.replace(QRegExp(":"),"\n"); 247 msg.replace(QRegExp(":"),"\n");
248 QMessageBox::message("Note",msg); 248 QMessageBox::message("Note",msg);
249// FtpQuit(conn); 249// FtpQuit(conn);
250 } 250 }
251 ProgressBar->reset(); 251 ProgressBar->reset();
252 nullifyCallBack(); 252 nullifyCallBack();
253 } else { 253 } else {
254 QMessageBox::message("Note","Cannot upload directories"); 254 QMessageBox::message("Note","Cannot upload directories");
255 } 255 }
256 TabWidget->setCurrentPage(1); 256 TabWidget->setCurrentPage(1);
257 populateRemoteView(); 257 populateRemoteView();
258 QCopEnvelope ( "QPE/System", "notBusy()" ); 258 QCopEnvelope ( "QPE/System", "notBusy()" );
259} 259}
260 260
261void OpieFtp::nullifyCallBack() { 261void OpieFtp::nullifyCallBack() {
262 FtpOptions(FTPLIB_CALLBACK, NULL, conn); 262 FtpOptions(FTPLIB_CALLBACK, NULL, conn);
263 FtpOptions(FTPLIB_IDLETIME, NULL, conn); 263 FtpOptions(FTPLIB_IDLETIME, NULL, conn);
264 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); 264 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
265 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); 265 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
266 266
267} 267}
268 268
269void OpieFtp::remoteDownload() 269void OpieFtp::remoteDownload()
270{ 270{
271 int fsz; 271 int fsz;
272 QCopEnvelope ( "QPE/System", "busy()" ); 272 QCopEnvelope ( "QPE/System", "busy()" );
273 qApp->processEvents(); 273 qApp->processEvents();
274 QString strItem = Remote_View->currentItem()->text(0); 274 QString strItem = Remote_View->currentItem()->text(0);
275 QString localFile = currentDir.canonicalPath()+"/"+strItem; 275 QString localFile = currentDir.canonicalPath()+"/"+strItem;
276 QString remoteFile= currentRemoteDir+strItem; 276 QString remoteFile= currentRemoteDir+strItem;
277 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) 277 if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
278 fsz = 0; 278 fsz = 0;
279 QString temp; 279 QString temp;
280 temp.sprintf( remoteFile+" "+" %dkb", fsz); 280 temp.sprintf( remoteFile+" "+" %dkb", fsz);
281 281
282 ProgressBar->setTotalSteps(fsz); 282 ProgressBar->setTotalSteps(fsz);
283 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 283 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
284 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 284 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
285 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 285 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
286 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 286 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
287 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 287 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
288 288
289 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 289 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
290 QString msg; 290 QString msg;
291 msg.sprintf("Unable to download \n%s",FtpLastResponse(conn)); 291 msg.sprintf("Unable to download \n%s",FtpLastResponse(conn));
292 msg.replace(QRegExp(":"),"\n"); 292 msg.replace(QRegExp(":"),"\n");
293 QMessageBox::message("Note",msg); 293 QMessageBox::message("Note",msg);
294// FtpQuit(conn); 294// FtpQuit(conn);
295 } 295 }
296 ProgressBar->reset(); 296 ProgressBar->reset();
297 nullifyCallBack(); 297 nullifyCallBack();
298 TabWidget->setCurrentPage(0); 298 TabWidget->setCurrentPage(0);
299 populateLocalView(); 299 populateLocalView();
300 QCopEnvelope ( "QPE/System", "notBusy()" ); 300 QCopEnvelope ( "QPE/System", "notBusy()" );
301} 301}
302 302
303 303
304void OpieFtp::newConnection() 304void OpieFtp::newConnection()
305{ 305{
306 TabWidget->setCurrentPage(2); 306 TabWidget->setCurrentPage(2);
307} 307}
308 308
309void OpieFtp::connector() 309void OpieFtp::connector()
310{ 310{
311 QCopEnvelope ( "QPE/System", "busy()" ); 311 QCopEnvelope ( "QPE/System", "busy()" );
312 qApp->processEvents(); 312 qApp->processEvents();
313 currentRemoteDir=remotePath->text(); 313 currentRemoteDir=remotePath->text();
314 if(ServerComboBox->currentText().isEmpty()) { 314 if(ServerComboBox->currentText().isEmpty()) {
315 QMessageBox::warning(this,"Ftp","Please set the server info","Ok",0,0); 315 QMessageBox::warning(this,"Ftp","Please set the server info","Ok",0,0);
316 TabWidget->setCurrentPage(2); 316 TabWidget->setCurrentPage(2);
317 ServerComboBox->setFocus(); 317 ServerComboBox->setFocus();
318 return; 318 return;
319 } 319 }
320 FtpInit(); 320 FtpInit();
321 TabWidget->setCurrentPage(1); 321 TabWidget->setCurrentPage(1);
322 QString ftp_host = ServerComboBox->currentText(); 322 QString ftp_host = ServerComboBox->currentText();
323 QString ftp_user = UsernameComboBox->currentText(); 323 QString ftp_user = UsernameComboBox->currentText();
324 QString ftp_pass = PasswordEdit->text(); 324 QString ftp_pass = PasswordEdit->text();
325 QString port=PortSpinBox->cleanText(); 325 QString port=PortSpinBox->cleanText();
326 port.stripWhiteSpace(); 326 port.stripWhiteSpace();
327 327
328 if(ftp_host.find("ftp://",0, TRUE) != -1 ) 328 if(ftp_host.find("ftp://",0, TRUE) != -1 )
329 ftp_host=ftp_host.right(ftp_host.length()-6); 329 ftp_host=ftp_host.right(ftp_host.length()-6);
330 ftp_host+=":"+port; 330 ftp_host+=":"+port;
331 if (!FtpConnect( ftp_host.latin1(), &conn)) { 331 if (!FtpConnect( ftp_host.latin1(), &conn)) {
332 QMessageBox::message("Note","Unable to connect to\n"+ftp_host); 332 QMessageBox::message("Note","Unable to connect to\n"+ftp_host);
333 return ; 333 return ;
334 } 334 }
335 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 335 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
336 QString msg; 336 QString msg;
337 msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); 337 msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn));
338 msg.replace(QRegExp(":"),"\n"); 338 msg.replace(QRegExp(":"),"\n");
339 QMessageBox::message("Note",msg); 339 QMessageBox::message("Note",msg);
340 FtpQuit(conn); 340 FtpQuit(conn);
341 return ; 341 return ;
342 } 342 }
343 remoteDirList("/") ; 343 remoteDirList("/") ;
344 setCaption(ftp_host); 344 setCaption(ftp_host);
345 QCopEnvelope ( "QPE/System", "notBusy()" ); 345 QCopEnvelope ( "QPE/System", "notBusy()" );
346} 346}
347 347
348void OpieFtp::disConnector() 348void OpieFtp::disConnector()
349{ 349{
350 FtpQuit(conn); 350 FtpQuit(conn);
351 setCaption("OpieFtp"); 351 setCaption("OpieFtp");
352 currentRemoteDir="/"; 352 currentRemoteDir="/";
353 Remote_View->clear(); 353 Remote_View->clear();
354} 354}
355 355
356bool OpieFtp::remoteDirList(const QString &dir) 356bool OpieFtp::remoteDirList(const QString &dir)
357{ 357{
358 QCopEnvelope ( "QPE/System", "busy()" ); 358 QCopEnvelope ( "QPE/System", "busy()" );
359 if (!FtpDir( "./._temp", dir.latin1(), conn) ) { 359 if (!FtpDir( "./._temp", dir.latin1(), conn) ) {
360 QString msg; 360 QString msg;
361 msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) ); 361 msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) );
362 msg.replace(QRegExp(":"),"\n"); 362 msg.replace(QRegExp(":"),"\n");
363 QMessageBox::message("Note",msg); 363 QMessageBox::message("Note",msg);
364// FtpQuit(conn); 364// FtpQuit(conn);
365 return false; 365 return false;
366 } 366 }
367 populateRemoteView(); 367 populateRemoteView();
368 QCopEnvelope ( "QPE/System", "notBusy()" ); 368 QCopEnvelope ( "QPE/System", "notBusy()" );
369 return true; 369 return true;
370} 370}
371 371
372bool OpieFtp::remoteChDir(const QString &dir) 372bool OpieFtp::remoteChDir(const QString &dir)
373{ 373{
374 QCopEnvelope ( "QPE/System", "busy()" ); 374 QCopEnvelope ( "QPE/System", "busy()" );
375 if (!FtpChdir( dir.latin1(), conn )) { 375 if (!FtpChdir( dir.latin1(), conn )) {
376 QString msg; 376 QString msg;
377 msg.sprintf("Unable to change directories\n"+dir+"\n%s",FtpLastResponse(conn)); 377 msg.sprintf("Unable to change directories\n"+dir+"\n%s",FtpLastResponse(conn));
378 msg.replace(QRegExp(":"),"\n"); 378 msg.replace(QRegExp(":"),"\n");
379 QMessageBox::message("Note",msg); 379 QMessageBox::message("Note",msg);
380 qDebug(msg); 380 qDebug(msg);
381// FtpQuit(conn); 381// FtpQuit(conn);
382 QCopEnvelope ( "QPE/System", "notBusy()" ); 382 QCopEnvelope ( "QPE/System", "notBusy()" );
383 return FALSE; 383 return FALSE;
384 } 384 }
385 QCopEnvelope ( "QPE/System", "notBusy()" ); 385 QCopEnvelope ( "QPE/System", "notBusy()" );
386 return TRUE; 386 return TRUE;
387} 387}
388 388
389void OpieFtp::populateLocalView() 389void OpieFtp::populateLocalView()
390{ 390{
391 Local_View->clear(); 391 Local_View->clear();
392 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 392 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
393 currentDir.setMatchAllDirs(TRUE); 393 currentDir.setMatchAllDirs(TRUE);
394 currentDir.setNameFilter(filterStr); 394 currentDir.setNameFilter(filterStr);
395 QString fileL, fileS, fileDate; 395 QString fileL, fileS, fileDate;
396 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 396 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
397 QFileInfoListIterator it(*list); 397 QFileInfoListIterator it(*list);
398 QFileInfo *fi; 398 QFileInfo *fi;
399 while ( (fi=it.current()) ) { 399 while ( (fi=it.current()) ) {
400 if (fi->isSymLink() ){ 400 if (fi->isSymLink() ){
401 QString symLink=fi->readLink(); 401 QString symLink=fi->readLink();
402// qDebug("Symlink detected "+symLink); 402// qDebug("Symlink detected "+symLink);
403 QFileInfo sym( symLink); 403 QFileInfo sym( symLink);
404 fileS.sprintf( "%10li", sym.size() ); 404 fileS.sprintf( "%10li", sym.size() );
405 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); 405 fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() );
406 fileDate = sym.lastModified().toString(); 406 fileDate = sym.lastModified().toString();
407 } else { 407 } else {
408// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 408// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
409 fileS.sprintf( "%10li", fi->size() ); 409 fileS.sprintf( "%10li", fi->size() );
410 fileL.sprintf( "%s",fi->fileName().data() ); 410 fileL.sprintf( "%s",fi->fileName().data() );
411 fileDate= fi->lastModified().toString(); 411 fileDate= fi->lastModified().toString();
412 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 412 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
413 fileL+="/"; 413 fileL+="/";
414// qDebug( fileL); 414// qDebug( fileL);
415 } 415 }
416 } 416 }
417 item= new QListViewItem( Local_View,fileL,fileS, fileDate); 417 item= new QListViewItem( Local_View,fileL,fileS, fileDate);
418 ++it; 418 ++it;
419 } 419 }
420 Local_View->setSorting( 3,FALSE); 420 Local_View->setSorting( 3,FALSE);
421 currentPathEdit->setText( currentDir.canonicalPath() ); 421 currentPathEdit->setText( currentDir.canonicalPath() );
422} 422}
423 423
424bool OpieFtp::populateRemoteView() 424bool OpieFtp::populateRemoteView()
425{ 425{
426 Remote_View->clear(); 426 Remote_View->clear();
427 QFile tmp("./._temp"); 427 QFile tmp("./._temp");
428 QString s, File_Name; 428 QString s, File_Name;
429 QString fileL, fileS, fileDate; 429 QString fileL, fileS, fileDate;
430 new QListViewItem( Remote_View, "../"); 430 new QListViewItem( Remote_View, "../");
431 if (tmp.open(IO_ReadOnly)) { 431 if (tmp.open(IO_ReadOnly)) {
432 QTextStream t( &tmp ); // use a text stream 432 QTextStream t( &tmp ); // use a text stream
433 while ( !t.eof()) { 433 while ( !t.eof()) {
434 s = t.readLine(); 434 s = t.readLine();
435 fileL = s.right(s.length()-55); 435 fileL = s.right(s.length()-55);
436 fileL = fileL.stripWhiteSpace(); 436 fileL = fileL.stripWhiteSpace();
437 if(s.left(1) == "d") 437 if(s.left(1) == "d")
438 fileL = fileL+"/"; 438 fileL = fileL+"/";
439 fileS = s.mid( 30, 42-30); 439 fileS = s.mid( 30, 42-30);
440 fileS = fileS.stripWhiteSpace(); 440 fileS = fileS.stripWhiteSpace();
441 fileDate = s.mid( 42, 55-42); 441 fileDate = s.mid( 42, 55-42);
442 fileDate = fileDate.stripWhiteSpace(); 442 fileDate = fileDate.stripWhiteSpace();
443 if(fileL.find("total",0,TRUE) == -1) 443 if(fileL.find("total",0,TRUE) == -1)
444 new QListViewItem( Remote_View, fileL, fileS, fileDate); 444 new QListViewItem( Remote_View, fileL, fileS, fileDate);
445 } 445 }
446 tmp.close(); 446 tmp.close();
447 } 447 } else
448 qDebug("temp file not opened successfullly");
448 return true; 449 return true;
449} 450}
450 451
451void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 452void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
452{ 453{
453 QCopEnvelope ( "QPE/System", "busy()" ); 454 QCopEnvelope ( "QPE/System", "busy()" );
454 QString oldRemoteCurrentDir = currentRemoteDir; 455 QString oldRemoteCurrentDir = currentRemoteDir;
455 QString strItem=selectedItem->text(0); 456 QString strItem=selectedItem->text(0);
456 strItem=strItem.simplifyWhiteSpace(); 457 strItem=strItem.simplifyWhiteSpace();
457 if(strItem == "../") { // the user wants to go ^ 458 if(strItem == "../") { // the user wants to go ^
458 if( FtpCDUp( conn) == 0) { 459 if( FtpCDUp( conn) == 0) {
459 QString msg; 460 QString msg;
460 msg.sprintf("Unable to cd up\n%s",FtpLastResponse(conn)); 461 msg.sprintf("Unable to cd up\n%s",FtpLastResponse(conn));
461 msg.replace(QRegExp(":"),"\n"); 462 msg.replace(QRegExp(":"),"\n");
462 QMessageBox::message("Note",msg); 463 QMessageBox::message("Note",msg);
463 qDebug(msg); 464 qDebug(msg);
464 } 465 }
465 char path[256]; 466 char path[256];
466 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 467 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
467 QString msg; 468 QString msg;
468 msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); 469 msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn));
469 msg.replace(QRegExp(":"),"\n"); 470 msg.replace(QRegExp(":"),"\n");
470 QMessageBox::message("Note",msg); 471 QMessageBox::message("Note",msg);
471 qDebug(msg); 472 qDebug(msg);
472 } 473 }
473 currentRemoteDir=path; 474 currentRemoteDir=path;
474 } else { 475 } else {
475 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 476 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
476 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 477 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
477 strItem = strItem.stripWhiteSpace(); 478 strItem = strItem.stripWhiteSpace();
478 currentRemoteDir = strItem; 479 currentRemoteDir = strItem;
479 if( !remoteChDir( (const QString &)strItem)) { 480 if( !remoteChDir( (const QString &)strItem)) {
480 currentRemoteDir = oldRemoteCurrentDir; 481 currentRemoteDir = oldRemoteCurrentDir;
481 strItem=""; 482 strItem="";
482 populateRemoteView(); 483 populateRemoteView();
483 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 484 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
484 } 485 }
485 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 486 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
486 qDebug("trying directory"); 487 qDebug("trying directory");
487 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 488 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
488 currentRemoteDir = oldRemoteCurrentDir; 489 currentRemoteDir = oldRemoteCurrentDir;
489 strItem=""; 490 strItem="";
490 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 491 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
491 492
492 populateRemoteView(); 493 populateRemoteView();
493 } else { 494 } else {
494 currentRemoteDir = currentRemoteDir+strItem; 495 currentRemoteDir = currentRemoteDir+strItem;
495 } 496 }
496 } else { 497 } else {
497 qDebug("download "+strItem); 498 qDebug("download "+strItem);
498 } 499 }
499 } 500 }
500 if(currentRemoteDir.right(1) !="/") 501 if(currentRemoteDir.right(1) !="/")
501 currentRemoteDir +="/"; 502 currentRemoteDir +="/";
502 currentPathEdit->setText( currentRemoteDir ); 503 currentPathEdit->setText( currentRemoteDir );
503 remoteDirList( (const QString &)currentRemoteDir); 504 remoteDirList( (const QString &)currentRemoteDir);
504 QCopEnvelope ( "QPE/System", "notBusy()" ); 505 QCopEnvelope ( "QPE/System", "notBusy()" );
505} 506}
506 507
507 void OpieFtp::localListClicked(QListViewItem *selectedItem) 508void OpieFtp::localListClicked(QListViewItem *selectedItem)
508{ 509{
509 QString strItem=selectedItem->text(0); 510 QString strItem=selectedItem->text(0);
510 QString strSize=selectedItem->text(1); 511 QString strSize=selectedItem->text(1);
511 strSize=strSize.stripWhiteSpace(); 512 strSize=strSize.stripWhiteSpace();
512 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 513 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
513 // is symlink 514 // is symlink
514 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 515 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
515 if(QDir(strItem2).exists() ) { 516 if(QDir(strItem2).exists() ) {
516 currentDir.cd(strItem2, TRUE); 517 currentDir.cd(strItem2, TRUE);
517 populateLocalView(); 518 populateLocalView();
518 } 519 }
519 } else { // not a symlink 520 } else { // not a symlink
520 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 521 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
521 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 522 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
522 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 523 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
523 currentDir.cd(strItem,FALSE); 524 currentDir.cd(strItem,FALSE);
524 populateLocalView(); 525 populateLocalView();
525 } else { 526 } else {
526 currentDir.cdUp(); 527 currentDir.cdUp();
527 populateLocalView(); 528 populateLocalView();
528 } 529 }
529 if(QDir(strItem).exists()){ 530 if(QDir(strItem).exists()){
530 currentDir.cd(strItem, TRUE); 531 currentDir.cd(strItem, TRUE);
531 populateLocalView(); 532 populateLocalView();
532 } 533 }
533 } else { 534 } else {
534 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 535 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
535 if( QFile::exists(strItem ) ) { 536 if( QFile::exists(strItem ) ) {
536 qDebug("upload "+strItem); 537 qDebug("upload "+strItem);
537 } 538 }
538 } //end not symlink 539 } //end not symlink
539 chdir(strItem.latin1()); 540 chdir(strItem.latin1());
540 } 541 }
541} 542}
542 543
544void OpieFtp::doLocalCd()
545{
546 localListClicked( Local_View->currentItem());
547}
548
549void OpieFtp:: doRemoteCd()
550{
551 remoteListClicked( Remote_View->currentItem());
552
553}
554
543void OpieFtp::showHidden() 555void OpieFtp::showHidden()
544{ 556{
545 if (!b) { 557 if (!b) {
546 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 558 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
547// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 559// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
548 b=TRUE; 560 b=TRUE;
549 561
550 } else { 562 } else {
551 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 563 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
552// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 564// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
553 b=FALSE; 565 b=FALSE;
554 } 566 }
555 populateLocalView(); 567 populateLocalView();
556} 568}
557 569
558void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 570void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
559{ 571{
560 switch (mouse) { 572 switch (mouse) {
561 case 1: 573 case 1:
562 break; 574 break;
563 case 2: 575 case 2:
564 showLocalMenu(); 576 showLocalMenu(item);
565 break; 577 break;
566 }; 578 };
567} 579}
568 580
569void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 581void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
570{ 582{
571 switch (mouse) { 583 switch (mouse) {
572 case 1: 584 case 1:
573 break; 585 break;
574 case 2: 586 case 2:
575 showRemoteMenu(); 587 showRemoteMenu(item);
576 break; 588 break;
577 }; 589 };
578} 590}
579 591
580void OpieFtp::showRemoteMenu() 592void OpieFtp::showRemoteMenu(QListViewItem * item)
581{ 593{
582 QPopupMenu m;// = new QPopupMenu( Local_View ); 594 QPopupMenu m;// = new QPopupMenu( Local_View );
595 if(item->text(0).right(1) == "/")
596 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
597 else
583 m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 598 m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
584 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 599 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
585 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 600 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
586 m.insertSeparator(); 601 m.insertSeparator();
587 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 602 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
588 m.exec( QCursor::pos() ); 603 m.exec( QCursor::pos() );
589} 604}
590 605
591void OpieFtp::showLocalMenu() 606void OpieFtp::showLocalMenu(QListViewItem * item)
592{ 607{
593 QPopupMenu m; 608 QPopupMenu m;
594 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 609 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
610 m.insertSeparator();
611 if(item->text(0).right(1) == "/")
612 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
613 else
595 m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 614 m.insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
596 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 615 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
597 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 616 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
598 m.insertSeparator(); 617 m.insertSeparator();
599 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 618 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
600 m.exec( QCursor::pos() ); 619 m.exec( QCursor::pos() );
601} 620}
602 621
603void OpieFtp::localMakDir() 622void OpieFtp::localMakDir()
604{ 623{
605 InputDialog *fileDlg; 624 InputDialog *fileDlg;
606 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); 625 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
607 fileDlg->exec(); 626 fileDlg->exec();
608 if( fileDlg->result() == 1 ) { 627 if( fileDlg->result() == 1 ) {
609 QString filename = fileDlg->LineEdit1->text(); 628 QString filename = fileDlg->LineEdit1->text();
610 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 629 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
611 } 630 }
612 populateLocalView(); 631 populateLocalView();
613} 632}
614 633
615void OpieFtp::localDelete() 634void OpieFtp::localDelete()
616{ 635{
617 QString f = Local_View->currentItem()->text(0); 636 QString f = Local_View->currentItem()->text(0);
618 if(QDir(f).exists() ) { 637 if(QDir(f).exists() ) {
619 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+ 638 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+
620 " ?\nIt must be empty","Yes","No",0,0,1) ) { 639 " ?\nIt must be empty","Yes","No",0,0,1) ) {
621 case 0: { 640 case 0: {
622 f=currentDir.canonicalPath()+"/"+f; 641 f=currentDir.canonicalPath()+"/"+f;
623 QString cmd="rmdir "+f; 642 QString cmd="rmdir "+f;
624 system( cmd.latin1()); 643 system( cmd.latin1());
625 populateLocalView(); 644 populateLocalView();
626 } 645 }
627 break; 646 break;
628 case 1: 647 case 1:
629 // exit 648 // exit
630 break; 649 break;
631 }; 650 };
632 651
633 } else { 652 } else {
634 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f 653 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f
635 +" ?","Yes","No",0,0,1) ) { 654 +" ?","Yes","No",0,0,1) ) {
636 case 0: { 655 case 0: {
637 f=currentDir.canonicalPath()+"/"+f; 656 f=currentDir.canonicalPath()+"/"+f;
638 QString cmd="rm "+f; 657 QString cmd="rm "+f;
639 system( cmd.latin1()); 658 system( cmd.latin1());
640 populateLocalView(); 659 populateLocalView();
641 } 660 }
642 break; 661 break;
643 case 1: 662 case 1:
644 // exit 663 // exit
645 break; 664 break;
646 }; 665 };
647 } 666 }
648} 667}
649 668
650void OpieFtp::remoteMakDir() 669void OpieFtp::remoteMakDir()
651{ 670{
652 InputDialog *fileDlg; 671 InputDialog *fileDlg;
653 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); 672 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
654 fileDlg->exec(); 673 fileDlg->exec();
655 if( fileDlg->result() == 1 ) { 674 if( fileDlg->result() == 1 ) {
656 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 675 QString filename = fileDlg->LineEdit1->text();//+".playlist";
657 QString tmp=currentRemoteDir+filename; 676 QString tmp=currentRemoteDir+filename;
658 QCopEnvelope ( "QPE/System", "busy()" ); 677 QCopEnvelope ( "QPE/System", "busy()" );
659 if(FtpMkdir( tmp.latin1(), conn) == 0) { 678 if(FtpMkdir( tmp.latin1(), conn) == 0) {
660 QString msg; 679 QString msg;
661 msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn)); 680 msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn));
662 msg.replace(QRegExp(":"),"\n"); 681 msg.replace(QRegExp(":"),"\n");
663 QMessageBox::message("Note",msg); 682 QMessageBox::message("Note",msg);
664 } 683 }
665 QCopEnvelope ( "QPE/System", "notBusy()" ); 684 QCopEnvelope ( "QPE/System", "notBusy()" );
666 } 685 }
667 populateRemoteView(); 686 populateRemoteView();
668} 687}
669 688
670void OpieFtp::remoteDelete() 689void OpieFtp::remoteDelete()
671{ 690{
672 QString f = Remote_View->currentItem()->text(0); 691 QString f = Remote_View->currentItem()->text(0);
673 QCopEnvelope ( "QPE/System", "busy()" ); 692 QCopEnvelope ( "QPE/System", "busy()" );
674 if( f.right(1) =="/") { 693 if( f.right(1) =="/") {
675 QString path= currentRemoteDir+f; 694 QString path= currentRemoteDir+f;
676 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" 695 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?"
677 ,"Yes","No",0,0,1) ) { 696 ,"Yes","No",0,0,1) ) {
678 case 0: { 697 case 0: {
679 f=currentDir.canonicalPath()+"/"+f; 698 f=currentDir.canonicalPath()+"/"+f;
680 if(FtpRmdir( path.latin1(), conn) ==0) { 699 if(FtpRmdir( path.latin1(), conn) ==0) {
681 QString msg; 700 QString msg;
682 msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn)); 701 msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn));
683 msg.replace(QRegExp(":"),"\n"); 702 msg.replace(QRegExp(":"),"\n");
684 QMessageBox::message("Note",msg); 703 QMessageBox::message("Note",msg);
685 } 704 }
686 } 705 }
687 break; 706 break;
688 }; 707 };
689 } else { 708 } else {
690 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?" 709 switch ( QMessageBox::warning(this,"Delete","Do you really want to delete\n"+f+"?"
691 ,"Yes","No",0,0,1) ) { 710 ,"Yes","No",0,0,1) ) {
692 case 0: { 711 case 0: {
693 QString path= currentRemoteDir+f; 712 QString path= currentRemoteDir+f;
694 if(FtpDelete( path.latin1(), conn)==0) { 713 if(FtpDelete( path.latin1(), conn)==0) {
695 QString msg; 714 QString msg;
696 msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn)); 715 msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn));
697 msg.replace(QRegExp(":"),"\n"); 716 msg.replace(QRegExp(":"),"\n");
698 QMessageBox::message("Note",msg); 717 QMessageBox::message("Note",msg);
699 } 718 }
700 } 719 }
701 break; 720 break;
702 }; 721 };
703 } 722 }
704 QCopEnvelope ( "QPE/System", "notBusy()" ); 723 QCopEnvelope ( "QPE/System", "notBusy()" );
705} 724}
706 725
707void OpieFtp::remoteRename() 726void OpieFtp::remoteRename()
708{ 727{
709 QString curFile = Remote_View->currentItem()->text(0); 728 QString curFile = Remote_View->currentItem()->text(0);
710 InputDialog *fileDlg; 729 InputDialog *fileDlg;
711 fileDlg = new InputDialog(this,"Rename",TRUE, 0); 730 fileDlg = new InputDialog(this,"Rename",TRUE, 0);
712 fileDlg->inputText = curFile; 731 fileDlg->inputText = curFile;
713 fileDlg->exec(); 732 fileDlg->exec();
714 if( fileDlg->result() == 1 ) { 733 if( fileDlg->result() == 1 ) {
715 QString oldName = currentRemoteDir +"/"+ curFile; 734 QString oldName = currentRemoteDir +"/"+ curFile;
716 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 735 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
717 QCopEnvelope ( "QPE/System", "busy()" ); 736 QCopEnvelope ( "QPE/System", "busy()" );
718 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 737 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
719 QString msg; 738 QString msg;
720 msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn)); 739 msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn));
721 msg.replace(QRegExp(":"),"\n"); 740 msg.replace(QRegExp(":"),"\n");
722 QMessageBox::message("Note",msg); 741 QMessageBox::message("Note",msg);
723 } 742 }
724 QCopEnvelope ( "QPE/System", "notBusy()" ); 743 QCopEnvelope ( "QPE/System", "notBusy()" );
725 } 744 }
726 populateRemoteView(); 745 populateRemoteView();
727} 746}
728 747
729void OpieFtp::localRename() 748void OpieFtp::localRename()
730{ 749{
731 QString curFile = Local_View->currentItem()->text(0); 750 QString curFile = Local_View->currentItem()->text(0);
732 InputDialog *fileDlg; 751 InputDialog *fileDlg;
733 fileDlg = new InputDialog(this,"Rename",TRUE, 0); 752 fileDlg = new InputDialog(this,"Rename",TRUE, 0);
734 fileDlg->inputText = curFile; 753 fileDlg->inputText = curFile;
735 fileDlg->exec(); 754 fileDlg->exec();
736 if( fileDlg->result() == 1 ) { 755 if( fileDlg->result() == 1 ) {
737 QString oldname = currentDir.canonicalPath() + "/" + curFile; 756 QString oldname = currentDir.canonicalPath() + "/" + curFile;
738 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 757 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
739 if( rename(oldname.latin1(), newName.latin1())== -1) 758 if( rename(oldname.latin1(), newName.latin1())== -1)
740 QMessageBox::message("Note","Could not rename"); 759 QMessageBox::message("Note","Could not rename");
741 } 760 }
742 populateLocalView(); 761 populateLocalView();
743} 762}
744 763
745void OpieFtp::currentPathEditChanged() 764void OpieFtp::currentPathEditChanged()
746{ 765{
747 QString oldRemoteCurrentDir = currentRemoteDir; 766 QString oldRemoteCurrentDir = currentRemoteDir;
748 qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 767 qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
749 if (TabWidget->currentPageIndex() == 0) { 768 if (TabWidget->currentPageIndex() == 0) {
750 if(QDir( currentPathEdit->text()).exists()) { 769 if(QDir( currentPathEdit->text()).exists()) {
751 currentDir.setPath( currentPathEdit->text() ); 770 currentDir.setPath( currentPathEdit->text() );
752 populateLocalView(); 771 populateLocalView();
753 } else { 772 } else {
754 QMessageBox::message("Note","That directory does not exist"); 773 QMessageBox::message("Note","That directory does not exist");
755 } 774 }
756 } 775 }
757 if (TabWidget->currentPageIndex() == 1) { 776 if (TabWidget->currentPageIndex() == 1) {
758 currentRemoteDir = currentPathEdit->text(); 777 currentRemoteDir = currentPathEdit->text();
759 if(currentRemoteDir.right(1) !="/") { 778 if(currentRemoteDir.right(1) !="/") {
760 currentRemoteDir = currentRemoteDir +"/"; 779 currentRemoteDir = currentRemoteDir +"/";
761 currentPathEdit->setText( currentRemoteDir ); 780 currentPathEdit->setText( currentRemoteDir );
762 } 781 }
763 if( !remoteChDir( (const QString &)currentRemoteDir) ) { 782 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
764 currentRemoteDir = oldRemoteCurrentDir; 783 currentRemoteDir = oldRemoteCurrentDir;
765 currentPathEdit->setText( currentRemoteDir ); 784 currentPathEdit->setText( currentRemoteDir );
766 } 785 }
767 786
768 remoteDirList( (const QString &)currentRemoteDir); 787 remoteDirList( (const QString &)currentRemoteDir);
769 } 788 }
770} 789}
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index e00a398..5d1c63d 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -1,95 +1,97 @@
1/*************************************************************************** 1/***************************************************************************
2 opieftp.h 2 opieftp.h
3 ------------------- 3 -------------------
4** Created: Sat Mar 9 23:33:09 2002 4** Created: Sat Mar 9 23:33:09 2002
5 copyright : (C) 2002 by ljp 5 copyright : (C) 2002 by ljp
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7 * This program is free software; you can redistribute it and/or modify * 7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by * 8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or * 9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. * 10 * (at your option) any later version. *
11 ***************************************************************************/ 11 ***************************************************************************/
12#ifndef OPIEFTP_H 12#ifndef OPIEFTP_H
13#define OPIEFTP_H 13#define OPIEFTP_H
14 14
15#include <qvariant.h> 15#include <qvariant.h>
16#include <qdialog.h> 16#include <qdialog.h>
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qdir.h> 18#include <qdir.h>
19#include <qstring.h> 19#include <qstring.h>
20#include <qpoint.h> 20#include <qpoint.h>
21 21
22class QVBoxLayout; 22class QVBoxLayout;
23class QHBoxLayout; 23class QHBoxLayout;
24class QGridLayout; 24class QGridLayout;
25class QComboBox; 25class QComboBox;
26class QListView; 26class QListView;
27class QListviewItem; 27class QListviewItem;
28class QLabel; 28class QLabel;
29class QProgressBar; 29class QProgressBar;
30class QSpinBox; 30class QSpinBox;
31class QTabWidget; 31class QTabWidget;
32class QWidget; 32class QWidget;
33class QPEToolBar; 33class QPEToolBar;
34class QPEMenuBar; 34class QPEMenuBar;
35class QPopupMenu; 35class QPopupMenu;
36class QFile; 36class QFile;
37class QListViewItem; 37class QListViewItem;
38class QLineEdit; 38class QLineEdit;
39 39
40class OpieFtp : public QMainWindow 40class OpieFtp : public QMainWindow
41{ 41{
42 Q_OBJECT 42 Q_OBJECT
43 43
44public: 44public:
45 OpieFtp( ); 45 OpieFtp( );
46 ~OpieFtp(); 46 ~OpieFtp();
47 47
48 QTabWidget *TabWidget; 48 QTabWidget *TabWidget;
49 QWidget *tab, *tab_2, *tab_3;; 49 QWidget *tab, *tab_2, *tab_3;;
50 QListView *Local_View, *Remote_View; 50 QListView *Local_View, *Remote_View;
51 51
52 QComboBox *UsernameComboBox, *ServerComboBox; 52 QComboBox *UsernameComboBox, *ServerComboBox;
53 QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; 53 QLineEdit *PasswordEdit, *remotePath, *currentPathEdit;
54 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; 54 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
55 QSpinBox* PortSpinBox; 55 QSpinBox* PortSpinBox;
56 QPopupMenu *connectionMenu, *localMenu, *remoteMenu; 56 QPopupMenu *connectionMenu, *localMenu, *remoteMenu;
57 QDir currentDir; 57 QDir currentDir;
58 QString currentRemoteDir; 58 QString currentRemoteDir;
59 QString filterStr; 59 QString filterStr;
60 QListViewItem * item; 60 QListViewItem * item;
61 bool b; 61 bool b;
62 62
63protected slots: 63protected slots:
64 void showLocalMenu( ); 64 void showLocalMenu( QListViewItem *);
65 void showRemoteMenu( ); 65 void showRemoteMenu( QListViewItem *);
66 void doLocalCd();
67 void doRemoteCd();
66 void localUpload(); 68 void localUpload();
67 void remoteDownload(); 69 void remoteDownload();
68 void newConnection(); 70 void newConnection();
69 void connector(); 71 void connector();
70 void disConnector(); 72 void disConnector();
71 void populateLocalView(); 73 void populateLocalView();
72 bool populateRemoteView(); 74 bool populateRemoteView();
73 void showHidden(); 75 void showHidden();
74 76
75 void localListClicked(QListViewItem *); 77 void localListClicked(QListViewItem *);
76 void remoteListClicked(QListViewItem *); 78 void remoteListClicked(QListViewItem *);
77 void ListPressed( int, QListViewItem *, const QPoint&, int); 79 void ListPressed( int, QListViewItem *, const QPoint&, int);
78 void RemoteListPressed( int, QListViewItem *, const QPoint&, int); 80 void RemoteListPressed( int, QListViewItem *, const QPoint&, int);
79 void localMakDir(); 81 void localMakDir();
80 void localDelete(); 82 void localDelete();
81 void remoteMakDir(); 83 void remoteMakDir();
82 void remoteDelete(); 84 void remoteDelete();
83 bool remoteDirList(const QString &); 85 bool remoteDirList(const QString &);
84 bool remoteChDir(const QString &); 86 bool remoteChDir(const QString &);
85 void tabChanged(QWidget*); 87 void tabChanged(QWidget*);
86 void cleanUp(); 88 void cleanUp();
87 void remoteRename(); 89 void remoteRename();
88 void localRename(); 90 void localRename();
89 void currentPathEditChanged(); 91 void currentPathEditChanged();
90protected: 92protected:
91 void nullifyCallBack(); 93 void nullifyCallBack();
92 94
93}; 95};
94 96
95#endif // OPIEFTP_H 97#endif // OPIEFTP_H