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) (show whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp86
1 files changed, 62 insertions, 24 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
@@ -42,2 +42,3 @@
42#include <qlineedit.h> 42#include <qlineedit.h>
43#include <qregexp.h>
43 44
@@ -147,3 +148,3 @@ OpieFtp::OpieFtp( )
147 UsernameComboBox->setEditable(TRUE); 148 UsernameComboBox->setEditable(TRUE);
148 UsernameComboBox->lineEdit()->setText("root"); 149 UsernameComboBox->lineEdit()->setText("llornkcor");
149 150
@@ -162,3 +163,3 @@ OpieFtp::OpieFtp( )
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
@@ -169,3 +170,3 @@ OpieFtp::OpieFtp( )
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
@@ -178,3 +179,4 @@ OpieFtp::OpieFtp( )
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" ) );
@@ -240,6 +242,8 @@ void OpieFtp::localUpload()
240 msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn)); 242 msg.sprintf("Unable to upload\n%s",FtpLastResponse(conn));
243 msg.replace(QRegExp(":"),"\n");
241 QMessageBox::message("Note",msg); 244 QMessageBox::message("Note",msg);
242 FtpQuit(conn); 245// FtpQuit(conn);
243 } 246 }
244 ProgressBar->reset(); 247 ProgressBar->reset();
248 nullifyCallBack();
245 } else { 249 } else {
@@ -252,2 +256,10 @@ void OpieFtp::localUpload()
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()
@@ -275,6 +287,8 @@ void OpieFtp::remoteDownload()
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);
@@ -319,2 +333,3 @@ void OpieFtp::connector()
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);
@@ -342,4 +357,5 @@ bool OpieFtp::remoteDirList(const QString &dir)
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;
@@ -356,5 +372,7 @@ bool OpieFtp::remoteChDir(const QString &dir)
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()" );
@@ -431,15 +449,20 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
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 }
@@ -448,17 +471,22 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
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 {
@@ -629,2 +657,3 @@ void OpieFtp::remoteMakDir()
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);
@@ -649,2 +678,3 @@ void OpieFtp::remoteDelete()
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);
@@ -662,2 +692,3 @@ void OpieFtp::remoteDelete()
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);
@@ -685,2 +716,3 @@ void OpieFtp::remoteRename()
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);
@@ -710,2 +742,4 @@ void OpieFtp::currentPathEditChanged()
710{ 742{
743 QString oldRemoteCurrentDir = currentRemoteDir;
744 qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
711 if (TabWidget->currentPageIndex() == 0) { 745 if (TabWidget->currentPageIndex() == 0) {
@@ -724,3 +758,7 @@ void OpieFtp::currentPathEditChanged()
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);