summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp/opieftp.cpp
authorllornkcor <llornkcor>2002-03-13 02:45:30 (UTC)
committer llornkcor <llornkcor>2002-03-13 02:45:30 (UTC)
commitfac27f0d83dd361e27bacdf552932c9ea60e66e8 (patch) (unidiff)
tree3910ee937e9bc2b018b30f9b521b7f38cdcf2124 /noncore/net/opieftp/opieftp.cpp
parentfc49c34cfd2ce2adad2920daa368b25f42b8bad7 (diff)
downloadopie-fac27f0d83dd361e27bacdf552932c9ea60e66e8.zip
opie-fac27f0d83dd361e27bacdf552932c9ea60e66e8.tar.gz
opie-fac27f0d83dd361e27bacdf552932c9ea60e66e8.tar.bz2
fixed crash bug when remote directory doesn't exist. Fixed progess bar indicator
continuing on dir listings after an upload/download.
Diffstat (limited to 'noncore/net/opieftp/opieftp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp114
1 files changed, 76 insertions, 38 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index e1dd582..0cdac79 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -37,12 +37,13 @@
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qimage.h> 39#include <qimage.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qmessagebox.h> 41#include <qmessagebox.h>
42#include <qlineedit.h> 42#include <qlineedit.h>
43#include <qregexp.h>
43 44
44#include <unistd.h> 45#include <unistd.h>
45#include <stdlib.h> 46#include <stdlib.h>
46 47
47QProgressBar *ProgressBar; 48QProgressBar *ProgressBar;
48static netbuf *conn=NULL; 49static netbuf *conn=NULL;
@@ -142,13 +143,13 @@ OpieFtp::OpieFtp( )
142 TextLabel1 = new QLabel( tab_3, "TextLabel1" ); 143 TextLabel1 = new QLabel( tab_3, "TextLabel1" );
143 TextLabel1->setGeometry( QRect( 10, 10, 60, 16 ) ); 144 TextLabel1->setGeometry( QRect( 10, 10, 60, 16 ) );
144 TextLabel1->setText( tr( "Username" ) ); 145 TextLabel1->setText( tr( "Username" ) );
145 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); 146 UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
146 UsernameComboBox->setGeometry( QRect( 10, 25, 196, 21 ) ); 147 UsernameComboBox->setGeometry( QRect( 10, 25, 196, 21 ) );
147 UsernameComboBox->setEditable(TRUE); 148 UsernameComboBox->setEditable(TRUE);
148 UsernameComboBox->lineEdit()->setText("root"); 149 UsernameComboBox->lineEdit()->setText("llornkcor");
149 150
150 TextLabel2 = new QLabel( tab_3, "TextLabel2" ); 151 TextLabel2 = new QLabel( tab_3, "TextLabel2" );
151 TextLabel2->setGeometry( QRect( 10, 50, 65, 16 ) ); 152 TextLabel2->setGeometry( QRect( 10, 50, 65, 16 ) );
152 TextLabel2->setText( tr( "Password" ) ); 153 TextLabel2->setText( tr( "Password" ) );
153 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); 154 PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
154 PasswordEdit->setGeometry( QRect( 10, 65, 195, 16 ) ); 155 PasswordEdit->setGeometry( QRect( 10, 65, 195, 16 ) );
@@ -157,29 +158,30 @@ OpieFtp::OpieFtp( )
157 TextLabel3 = new QLabel( tab_3, "TextLabel3" ); 158 TextLabel3 = new QLabel( tab_3, "TextLabel3" );
158 TextLabel3->setGeometry( QRect( 10, 90, 95, 16 ) ); 159 TextLabel3->setGeometry( QRect( 10, 90, 95, 16 ) );
159 TextLabel3->setText( tr( "Remote server" ) ); 160 TextLabel3->setText( tr( "Remote server" ) );
160 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); 161 ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
161 ServerComboBox->setGeometry( QRect( 10, 105, 195, 21 ) ); 162 ServerComboBox->setGeometry( QRect( 10, 105, 195, 21 ) );
162 ServerComboBox->setEditable(TRUE); 163 ServerComboBox->setEditable(TRUE);
163 ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); 164 ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) );
164 165
165 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); 166 QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
166 TextLabel5->setGeometry( QRect( 10, 130, 95, 16 ) ); 167 TextLabel5->setGeometry( QRect( 10, 130, 95, 16 ) );
167 TextLabel5->setText( tr( "Remote path" ) ); 168 TextLabel5->setText( tr( "Remote path" ) );
168 remotePath = new QLineEdit( "/", tab_3, "remotePath" ); 169 remotePath = new QLineEdit( "/", tab_3, "remotePath" );
169 remotePath->setGeometry( QRect( 10, 145, 195, 16 ) ); 170 remotePath->setGeometry( QRect( 10, 145, 195, 16 ) );
170 remotePath->setText( currentRemoteDir = "/"); 171 remotePath->setText( currentRemoteDir = "/home/llornkcor/");
171 172
172 TextLabel4 = new QLabel( tab_3, "TextLabel4" ); 173 TextLabel4 = new QLabel( tab_3, "TextLabel4" );
173 TextLabel4->setGeometry( QRect( 10, 170, 30, 21 ) ); 174 TextLabel4->setGeometry( QRect( 10, 170, 30, 21 ) );
174 TextLabel4->setText( tr( "Port" ) ); 175 TextLabel4->setText( tr( "Port" ) );
175 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); 176 PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
176 PortSpinBox->setGeometry( QRect( 40, 175, 75, 20 ) ); 177 PortSpinBox->setGeometry( QRect( 40, 175, 75, 20 ) );
177 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); 178 PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
178 PortSpinBox->setMaxValue(32786); 179 PortSpinBox->setMaxValue(32786);
179 PortSpinBox->setValue( 4242 ); 180 PortSpinBox->setValue( 21);
181
180 TabWidget->insertTab( tab_3, tr( "Config" ) ); 182 TabWidget->insertTab( tab_3, tr( "Config" ) );
181 183
182 connect(TabWidget,SIGNAL(currentChanged(QWidget *)), 184 connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
183 this,SLOT(tabChanged(QWidget*))); 185 this,SLOT(tabChanged(QWidget*)));
184 186
185 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 187 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -223,36 +225,46 @@ void OpieFtp::localUpload()
223 qApp->processEvents(); 225 qApp->processEvents();
224 QString strItem = Local_View->currentItem()->text(0); 226 QString strItem = Local_View->currentItem()->text(0);
225 QString localFile = currentDir.canonicalPath()+"/"+strItem; 227 QString localFile = currentDir.canonicalPath()+"/"+strItem;
226 QString remoteFile= currentRemoteDir+strItem; 228 QString remoteFile= currentRemoteDir+strItem;
227 QFileInfo fi(localFile); 229 QFileInfo fi(localFile);
228 if( !fi.isDir()) { 230 if( !fi.isDir()) {
229 fsz=fi.size(); 231 fsz=fi.size();
230 ProgressBar->setTotalSteps(fsz); 232 ProgressBar->setTotalSteps(fsz);
231 233
232 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); 234 FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
233 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); 235 FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
234 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); 236 FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
235 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 237 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
236 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); 238 qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
237 239
238 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 240 if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
239 QString msg; 241 QString msg;
240 msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn)); 242 msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn));
241 QMessageBox::message("Note",msg); 243 msg.replace(QRegExp(":"),"\n");
242 FtpQuit(conn); 244 QMessageBox::message("Note",msg);
243 } 245// FtpQuit(conn);
244 ProgressBar->reset(); 246 }
247 ProgressBar->reset();
248 nullifyCallBack();
245 } else { 249 } else {
246 QMessageBox::message("Note","Cannot upload directories"); 250 QMessageBox::message("Note","Cannot upload directories");
247 } 251 }
248 TabWidget->setCurrentPage(1); 252 TabWidget->setCurrentPage(1);
249 populateRemoteView(); 253 populateRemoteView();
250 QCopEnvelope ( "QPE/System", "notBusy()" ); 254 QCopEnvelope ( "QPE/System", "notBusy()" );
251} 255}
252 256
257void OpieFtp::nullifyCallBack() {
258 FtpOptions(FTPLIB_CALLBACK, NULL, conn);
259 FtpOptions(FTPLIB_IDLETIME, NULL, conn);
260 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
261 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
262
263}
264
253void OpieFtp::remoteDownload() 265void OpieFtp::remoteDownload()
254{ 266{
255 int fsz; 267 int fsz;
256 QCopEnvelope ( "QPE/System", "busy()" ); 268 QCopEnvelope ( "QPE/System", "busy()" );
257 qApp->processEvents(); 269 qApp->processEvents();
258 QString strItem = Remote_View->currentItem()->text(0); 270 QString strItem = Remote_View->currentItem()->text(0);
@@ -270,16 +282,18 @@ void OpieFtp::remoteDownload()
270 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); 282 FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
271 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); 283 qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
272 284
273 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { 285 if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
274 QString msg; 286 QString msg;
275 msg.sprintf("Unable to download \n%s",FtpLastResponse(conn)); 287 msg.sprintf("Unable to download \n%s",FtpLastResponse(conn));
288 msg.replace(QRegExp(":"),"\n");
276 QMessageBox::message("Note",msg); 289 QMessageBox::message("Note",msg);
277 FtpQuit(conn); 290// FtpQuit(conn);
278 } 291 }
279 ProgressBar->reset(); 292 ProgressBar->reset();
293 nullifyCallBack();
280 TabWidget->setCurrentPage(0); 294 TabWidget->setCurrentPage(0);
281 populateLocalView(); 295 populateLocalView();
282 QCopEnvelope ( "QPE/System", "notBusy()" ); 296 QCopEnvelope ( "QPE/System", "notBusy()" );
283} 297}
284 298
285 299
@@ -314,12 +328,13 @@ void OpieFtp::connector()
314 QMessageBox::message("Note","Unable to connect to\n"+ftp_host); 328 QMessageBox::message("Note","Unable to connect to\n"+ftp_host);
315 return ; 329 return ;
316 } 330 }
317 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { 331 if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
318 QString msg; 332 QString msg;
319 msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn)); 333 msg.sprintf("Unable to log in\n%s",FtpLastResponse(conn));
334 msg.replace(QRegExp(":"),"\n");
320 QMessageBox::message("Note",msg); 335 QMessageBox::message("Note",msg);
321 FtpQuit(conn); 336 FtpQuit(conn);
322 return ; 337 return ;
323 } 338 }
324 remoteDirList("/") ; 339 remoteDirList("/") ;
325 setCaption(ftp_host); 340 setCaption(ftp_host);
@@ -337,29 +352,32 @@ void OpieFtp::disConnector()
337bool OpieFtp::remoteDirList(const QString &dir) 352bool OpieFtp::remoteDirList(const QString &dir)
338{ 353{
339 QCopEnvelope ( "QPE/System", "busy()" ); 354 QCopEnvelope ( "QPE/System", "busy()" );
340 if (!FtpDir( "./._temp", dir.latin1(), conn) ) { 355 if (!FtpDir( "./._temp", dir.latin1(), conn) ) {
341 QString msg; 356 QString msg;
342 msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) ); 357 msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) );
358 msg.replace(QRegExp(":"),"\n");
343 QMessageBox::message("Note",msg); 359 QMessageBox::message("Note",msg);
344 FtpQuit(conn); 360// FtpQuit(conn);
345 return false; 361 return false;
346 } 362 }
347 populateRemoteView(); 363 populateRemoteView();
348 QCopEnvelope ( "QPE/System", "notBusy()" ); 364 QCopEnvelope ( "QPE/System", "notBusy()" );
349 return true; 365 return true;
350} 366}
351 367
352bool OpieFtp::remoteChDir(const QString &dir) 368bool OpieFtp::remoteChDir(const QString &dir)
353{ 369{
354 QCopEnvelope ( "QPE/System", "busy()" ); 370 QCopEnvelope ( "QPE/System", "busy()" );
355 if (!FtpChdir( dir.latin1(), conn )) { 371 if (!FtpChdir( dir.latin1(), conn )) {
356 QString msg; 372 QString msg;
357 msg.sprintf("Unable to change directories "+dir+"\n%s",FtpLastResponse(conn)); 373 msg.sprintf("Unable to change directories\n"+dir+"\n%s",FtpLastResponse(conn));
374 msg.replace(QRegExp(":"),"\n");
358 QMessageBox::message("Note",msg); 375 QMessageBox::message("Note",msg);
359 FtpQuit(conn); 376 qDebug(msg);
377// FtpQuit(conn);
360 QCopEnvelope ( "QPE/System", "notBusy()" ); 378 QCopEnvelope ( "QPE/System", "notBusy()" );
361 return FALSE; 379 return FALSE;
362 } 380 }
363 QCopEnvelope ( "QPE/System", "notBusy()" ); 381 QCopEnvelope ( "QPE/System", "notBusy()" );
364 return TRUE; 382 return TRUE;
365} 383}
@@ -426,44 +444,54 @@ bool OpieFtp::populateRemoteView()
426 return true; 444 return true;
427} 445}
428 446
429void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 447void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
430{ 448{
431 QCopEnvelope ( "QPE/System", "busy()" ); 449 QCopEnvelope ( "QPE/System", "busy()" );
450 QString oldRemoteCurrentDir = currentRemoteDir;
432 QString strItem=selectedItem->text(0); 451 QString strItem=selectedItem->text(0);
433 strItem=strItem.simplifyWhiteSpace(); 452 strItem=strItem.simplifyWhiteSpace();
434 if(strItem == "../") { 453 if(strItem == "../") { // the user wants to go ^
435 if( FtpCDUp( conn) == 0) { 454 if( FtpCDUp( conn) == 0) {
436 QString msg; 455 QString msg;
437 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); 456 msg.sprintf("Unable to cd up\n%s",FtpLastResponse(conn));
457 msg.replace(QRegExp(":"),"\n");
438 QMessageBox::message("Note",msg); 458 QMessageBox::message("Note",msg);
459 qDebug(msg);
439 } 460 }
440 char path[256]; 461 char path[256];
441 if( FtpPwd( path,sizeof(path),conn) == 0) { 462 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
442 QString msg; 463 QString msg;
443 msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); 464 msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn));
465 msg.replace(QRegExp(":"),"\n");
444 QMessageBox::message("Note",msg); 466 QMessageBox::message("Note",msg);
467 qDebug(msg);
445 } 468 }
446 currentRemoteDir=path; 469 currentRemoteDir=path;
447 } else { 470 } else {
448 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 471 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
449 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE)-3 ); 472 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
450 strItem = strItem.stripWhiteSpace(); 473 strItem = strItem.stripWhiteSpace();
451 currentRemoteDir = strItem; 474 currentRemoteDir = strItem;
452 if( remoteChDir( (const QString &)strItem) ==0) { 475 if( !remoteChDir( (const QString &)strItem)) {
453 QString msg; 476 currentRemoteDir = oldRemoteCurrentDir;
454 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); 477 strItem="";
455 QMessageBox::message("Note",msg); 478 populateRemoteView();
456 } 479 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
457 } else if(strItem.find("/",0,TRUE) != -1) {
458 if( remoteChDir( (const QString &)currentRemoteDir+strItem) ==0) {
459 QString msg;
460 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn));
461 QMessageBox::message("Note",msg);
462 } 480 }
481 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
482 qDebug("trying directory");
483 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
484 currentRemoteDir = oldRemoteCurrentDir;
485 strItem="";
486 qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
487
488 populateRemoteView();
489 } else {
463 currentRemoteDir = currentRemoteDir+strItem; 490 currentRemoteDir = currentRemoteDir+strItem;
491 }
464 } else { 492 } else {
465 qDebug("download "+strItem); 493 qDebug("download "+strItem);
466 } 494 }
467 } 495 }
468 if(currentRemoteDir.right(1) !="/") 496 if(currentRemoteDir.right(1) !="/")
469 currentRemoteDir +="/"; 497 currentRemoteDir +="/";
@@ -476,13 +504,13 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
476{ 504{
477 QString strItem=selectedItem->text(0); 505 QString strItem=selectedItem->text(0);
478 QString strSize=selectedItem->text(1); 506 QString strSize=selectedItem->text(1);
479 strSize=strSize.stripWhiteSpace(); 507 strSize=strSize.stripWhiteSpace();
480 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 508 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
481 // is symlink 509 // is symlink
482 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); 510 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
483 if(QDir(strItem2).exists() ) { 511 if(QDir(strItem2).exists() ) {
484 currentDir.cd(strItem2, TRUE); 512 currentDir.cd(strItem2, TRUE);
485 populateLocalView(); 513 populateLocalView();
486 } 514 }
487 } else { // not a symlink 515 } else { // not a symlink
488 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 516 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
@@ -624,12 +652,13 @@ void OpieFtp::remoteMakDir()
624 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 652 QString filename = fileDlg->LineEdit1->text();//+".playlist";
625 QString tmp=currentRemoteDir+filename; 653 QString tmp=currentRemoteDir+filename;
626 QCopEnvelope ( "QPE/System", "busy()" ); 654 QCopEnvelope ( "QPE/System", "busy()" );
627 if(FtpMkdir( tmp.latin1(), conn) == 0) { 655 if(FtpMkdir( tmp.latin1(), conn) == 0) {
628 QString msg; 656 QString msg;
629 msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn)); 657 msg.sprintf("Unable to make directory\n%s",FtpLastResponse(conn));
658 msg.replace(QRegExp(":"),"\n");
630 QMessageBox::message("Note",msg); 659 QMessageBox::message("Note",msg);
631 } 660 }
632 QCopEnvelope ( "QPE/System", "notBusy()" ); 661 QCopEnvelope ( "QPE/System", "notBusy()" );
633 } 662 }
634 populateRemoteView(); 663 populateRemoteView();
635} 664}
@@ -644,12 +673,13 @@ void OpieFtp::remoteDelete()
644 ,"Yes","No",0,0,1) ) { 673 ,"Yes","No",0,0,1) ) {
645 case 0: { 674 case 0: {
646 f=currentDir.canonicalPath()+"/"+f; 675 f=currentDir.canonicalPath()+"/"+f;
647 if(FtpRmdir( path.latin1(), conn) ==0) { 676 if(FtpRmdir( path.latin1(), conn) ==0) {
648 QString msg; 677 QString msg;
649 msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn)); 678 msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn));
679 msg.replace(QRegExp(":"),"\n");
650 QMessageBox::message("Note",msg); 680 QMessageBox::message("Note",msg);
651 } 681 }
652 } 682 }
653 break; 683 break;
654 }; 684 };
655 } else { 685 } else {
@@ -657,12 +687,13 @@ void OpieFtp::remoteDelete()
657 ,"Yes","No",0,0,1) ) { 687 ,"Yes","No",0,0,1) ) {
658 case 0: { 688 case 0: {
659 QString path= currentRemoteDir+f; 689 QString path= currentRemoteDir+f;
660 if(FtpDelete( path.latin1(), conn)==0) { 690 if(FtpDelete( path.latin1(), conn)==0) {
661 QString msg; 691 QString msg;
662 msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn)); 692 msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn));
693 msg.replace(QRegExp(":"),"\n");
663 QMessageBox::message("Note",msg); 694 QMessageBox::message("Note",msg);
664 } 695 }
665 } 696 }
666 break; 697 break;
667 }; 698 };
668 } 699 }
@@ -680,12 +711,13 @@ void OpieFtp::remoteRename()
680 QString oldName = currentRemoteDir +"/"+ curFile; 711 QString oldName = currentRemoteDir +"/"+ curFile;
681 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 712 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
682 QCopEnvelope ( "QPE/System", "busy()" ); 713 QCopEnvelope ( "QPE/System", "busy()" );
683 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 714 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
684 QString msg; 715 QString msg;
685 msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn)); 716 msg.sprintf("Unable to rename file\n%s",FtpLastResponse(conn));
717 msg.replace(QRegExp(":"),"\n");
686 QMessageBox::message("Note",msg); 718 QMessageBox::message("Note",msg);
687 } 719 }
688 QCopEnvelope ( "QPE/System", "notBusy()" ); 720 QCopEnvelope ( "QPE/System", "notBusy()" );
689 } 721 }
690 populateRemoteView(); 722 populateRemoteView();
691} 723}
@@ -705,12 +737,14 @@ void OpieFtp::localRename()
705 } 737 }
706 populateLocalView(); 738 populateLocalView();
707} 739}
708 740
709void OpieFtp::currentPathEditChanged() 741void OpieFtp::currentPathEditChanged()
710{ 742{
743 QString oldRemoteCurrentDir = currentRemoteDir;
744 qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
711 if (TabWidget->currentPageIndex() == 0) { 745 if (TabWidget->currentPageIndex() == 0) {
712 if(QDir( currentPathEdit->text()).exists()) { 746 if(QDir( currentPathEdit->text()).exists()) {
713 currentDir.setPath( currentPathEdit->text() ); 747 currentDir.setPath( currentPathEdit->text() );
714 populateLocalView(); 748 populateLocalView();
715 } else { 749 } else {
716 QMessageBox::message("Note","That directory does not exist"); 750 QMessageBox::message("Note","That directory does not exist");
@@ -719,10 +753,14 @@ void OpieFtp::currentPathEditChanged()
719 if (TabWidget->currentPageIndex() == 1) { 753 if (TabWidget->currentPageIndex() == 1) {
720 currentRemoteDir = currentPathEdit->text(); 754 currentRemoteDir = currentPathEdit->text();
721 if(currentRemoteDir.right(1) !="/") { 755 if(currentRemoteDir.right(1) !="/") {
722 currentRemoteDir = currentRemoteDir +"/"; 756 currentRemoteDir = currentRemoteDir +"/";
723 currentPathEdit->setText( currentRemoteDir ); 757 currentPathEdit->setText( currentRemoteDir );
724 } 758 }
725 remoteChDir( (const QString &)currentRemoteDir); 759 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
760 currentRemoteDir = oldRemoteCurrentDir;
761 currentPathEdit->setText( currentRemoteDir );
762 }
763
726 remoteDirList( (const QString &)currentRemoteDir); 764 remoteDirList( (const QString &)currentRemoteDir);
727 } 765 }
728} 766}