summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-30 12:13:14 (UTC)
committer llornkcor <llornkcor>2002-04-30 12:13:14 (UTC)
commit99ae08c3e872fb9dcbba8057ee98f9f1687d0af1 (patch) (unidiff)
tree48546f25bfd565839687cde043e5ab1079098ae6
parent713aa4385e859c9300ee2a5b0086fbaabf3b3a33 (diff)
downloadopie-99ae08c3e872fb9dcbba8057ee98f9f1687d0af1.zip
opie-99ae08c3e872fb9dcbba8057ee98f9f1687d0af1.tar.gz
opie-99ae08c3e872fb9dcbba8057ee98f9f1687d0af1.tar.bz2
took out QCop busy() because its too slow to respond, fixed titlebar after disconnect still showing ftp server info
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 6684abb..6d0be57 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -381,25 +381,25 @@ void OpieFtp::serverComboEdited(const QString & edit)
381void OpieFtp::connectorBtnToggled(bool On) 381void OpieFtp::connectorBtnToggled(bool On)
382{ 382{
383 if(On) { 383 if(On) {
384 connector(); 384 connector();
385 } else { 385 } else {
386 disConnector(); 386 disConnector();
387 } 387 }
388 388
389} 389}
390 390
391void OpieFtp::connector() 391void OpieFtp::connector()
392{ 392{
393 QCopEnvelope ( "QPE/System", "busy()" ); 393// QCopEnvelope ( "QPE/System", "busy()" );
394// qApp->processEvents(); 394// qApp->processEvents();
395 currentRemoteDir=remotePath->text(); 395 currentRemoteDir=remotePath->text();
396 if(ServerComboBox->currentText().isEmpty()) { 396 if(ServerComboBox->currentText().isEmpty()) {
397 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); 397 QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
398 TabWidget->setCurrentPage(2); 398 TabWidget->setCurrentPage(2);
399 ServerComboBox->setFocus(); 399 ServerComboBox->setFocus();
400 connectServerBtn->setOn(FALSE); 400 connectServerBtn->setOn(FALSE);
401 connectServerBtn->setText( tr("Connect")); 401 connectServerBtn->setText( tr("Connect"));
402 return; 402 return;
403 } 403 }
404 FtpInit(); 404 FtpInit();
405 TabWidget->setCurrentPage(1); 405 TabWidget->setCurrentPage(1);
@@ -424,36 +424,37 @@ void OpieFtp::connector()
424 msg.replace(QRegExp(":"),"\n"); 424 msg.replace(QRegExp(":"),"\n");
425 QMessageBox::message(tr("Note"),msg); 425 QMessageBox::message(tr("Note"),msg);
426 if(conn) 426 if(conn)
427 FtpQuit(conn); 427 FtpQuit(conn);
428 connectServerBtn->setOn(FALSE); 428 connectServerBtn->setOn(FALSE);
429 connectServerBtn->setText( tr("Connect")); 429 connectServerBtn->setText( tr("Connect"));
430 return ; 430 return ;
431 } 431 }
432 remoteDirList("/") ; 432 remoteDirList("/") ;
433 setCaption(ftp_host); 433 setCaption(ftp_host);
434 writeConfig(); 434 writeConfig();
435 connectServerBtn->setText( tr("Disconnect")); 435 connectServerBtn->setText( tr("Disconnect"));
436 QCopEnvelope ( "QPE/System", "notBusy()" ); 436// QCopEnvelope ( "QPE/System", "notBusy()" );
437} 437}
438 438
439void OpieFtp::disConnector() 439void OpieFtp::disConnector()
440{ 440{
441 if(conn) 441 if(conn)
442 FtpQuit(conn); 442 FtpQuit(conn);
443 setCaption("OpieFtp"); 443 setCaption("OpieFtp");
444 currentRemoteDir="/"; 444 currentRemoteDir="/";
445 Remote_View->clear(); 445 Remote_View->clear();
446 connectServerBtn->setText( tr("Connect")); 446 connectServerBtn->setText( tr("Connect"));
447 connectServerBtn->setOn(FALSE); 447 connectServerBtn->setOn(FALSE);
448 setCaption("OpieFtp");
448} 449}
449 450
450void OpieFtp::localUpload() 451void OpieFtp::localUpload()
451{ 452{
452 int fsz; 453 int fsz;
453// QCopEnvelope ( "QPE/System", "busy()" ); 454// QCopEnvelope ( "QPE/System", "busy()" );
454// qApp->processEvents(); 455// qApp->processEvents();
455 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 456 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
456 QListViewItemIterator it( Local_View ); 457 QListViewItemIterator it( Local_View );
457 for ( ; it.current(); ++it ) { 458 for ( ; it.current(); ++it ) {
458 if ( it.current()->isSelected() ) { 459 if ( it.current()->isSelected() ) {
459 QString strItem = it.current()->text(0); 460 QString strItem = it.current()->text(0);
@@ -481,40 +482,40 @@ void OpieFtp::localUpload()
481 } 482 }
482 ProgressBar->reset(); 483 ProgressBar->reset();
483 nullifyCallBack(); 484 nullifyCallBack();
484 it.current()->setSelected(FALSE); 485 it.current()->setSelected(FALSE);
485 } //end currentSelected 486 } //end currentSelected
486 } 487 }
487 for ( ; it.current(); ++it ) { 488 for ( ; it.current(); ++it ) {
488 Local_View->clearSelection(); 489 Local_View->clearSelection();
489 } 490 }
490 Local_View->clearFocus(); 491 Local_View->clearFocus();
491 TabWidget->setCurrentPage(1); 492 TabWidget->setCurrentPage(1);
492 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 493 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
493 QCopEnvelope ( "QPE/System", "notBusy()" ); 494// QCopEnvelope ( "QPE/System", "notBusy()" );
494} 495}
495 496
496void OpieFtp::nullifyCallBack() 497void OpieFtp::nullifyCallBack()
497{ 498{
498 FtpOptions(FTPLIB_CALLBACK, NULL, conn); 499 FtpOptions(FTPLIB_CALLBACK, NULL, conn);
499 FtpOptions(FTPLIB_IDLETIME, NULL, conn); 500 FtpOptions(FTPLIB_IDLETIME, NULL, conn);
500 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); 501 FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
501 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); 502 FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
502} 503}
503 504
504void OpieFtp::remoteDownload() 505void OpieFtp::remoteDownload()
505{ 506{
506// qApp->processEvents(); 507// qApp->processEvents();
507 int fsz; 508 int fsz;
508 QCopEnvelope ( "QPE/System", "busy()" ); 509// QCopEnvelope ( "QPE/System", "busy()" );
509 510
510 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 511 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
511 QListViewItemIterator it( Remote_View ); 512 QListViewItemIterator it( Remote_View );
512 for ( ; it.current(); ++it ) { 513 for ( ; it.current(); ++it ) {
513 if ( it.current()->isSelected() ) { 514 if ( it.current()->isSelected() ) {
514 QString strItem = it.current()->text(0); 515 QString strItem = it.current()->text(0);
515// strItem=strItem.right(strItem.length()-1); 516// strItem=strItem.right(strItem.length()-1);
516 QString localFile = currentDir.canonicalPath(); 517 QString localFile = currentDir.canonicalPath();
517 if(localFile.right(1).find("/",0,TRUE) == -1) 518 if(localFile.right(1).find("/",0,TRUE) == -1)
518 localFile += "/"; 519 localFile += "/";
519 localFile += strItem; 520 localFile += strItem;
520// QString localFile = currentDir.canonicalPath()+"/"+strItem; 521// QString localFile = currentDir.canonicalPath()+"/"+strItem;
@@ -539,61 +540,61 @@ void OpieFtp::remoteDownload()
539 } 540 }
540 ProgressBar->reset(); 541 ProgressBar->reset();
541 nullifyCallBack(); 542 nullifyCallBack();
542 it.current()->setSelected(FALSE); 543 it.current()->setSelected(FALSE);
543 } 544 }
544 } 545 }
545 for ( ; it.current(); ++it ) { 546 for ( ; it.current(); ++it ) {
546 Remote_View->clearSelection(); 547 Remote_View->clearSelection();
547 } 548 }
548 Remote_View->setFocus(); 549 Remote_View->setFocus();
549 TabWidget->setCurrentPage(0); 550 TabWidget->setCurrentPage(0);
550 populateLocalView(); 551 populateLocalView();
551 QCopEnvelope ( "QPE/System", "notBusy()" ); 552// QCopEnvelope ( "QPE/System", "notBusy()" );
552} 553}
553 554
554bool OpieFtp::remoteDirList(const QString &dir) 555bool OpieFtp::remoteDirList(const QString &dir)
555{ 556{
556 QString tmp = QDir::homeDirPath(); 557 QString tmp = QDir::homeDirPath();
557 if(tmp.right(1) != "/") 558 if(tmp.right(1) != "/")
558 tmp+="/._temp"; 559 tmp+="/._temp";
559 else 560 else
560 tmp+="._temp"; 561 tmp+="._temp";
561// qDebug("Listing remote dir "+tmp); 562// qDebug("Listing remote dir "+tmp);
562 QCopEnvelope ( "QPE/System", "busy()" ); 563// QCopEnvelope ( "QPE/System", "busy()" );
563 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 564 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
564 QString msg; 565 QString msg;
565 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 566 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
566 msg.replace(QRegExp(":"),"\n"); 567 msg.replace(QRegExp(":"),"\n");
567 QMessageBox::message(tr("Note"),msg); 568 QMessageBox::message(tr("Note"),msg);
568 return false; 569 return false;
569 } 570 }
570 populateRemoteView() ; 571 populateRemoteView() ;
571 QCopEnvelope ( "QPE/System", "notBusy()" ); 572// QCopEnvelope ( "QPE/System", "notBusy()" );
572 return true; 573 return true;
573} 574}
574 575
575bool OpieFtp::remoteChDir(const QString &dir) 576bool OpieFtp::remoteChDir(const QString &dir)
576{ 577{
577 QCopEnvelope ( "QPE/System", "busy()" ); 578// QCopEnvelope ( "QPE/System", "busy()" );
578 if (!FtpChdir( dir.latin1(), conn )) { 579 if (!FtpChdir( dir.latin1(), conn )) {
579 QString msg; 580 QString msg;
580 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 581 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
581 msg.replace(QRegExp(":"),"\n"); 582 msg.replace(QRegExp(":"),"\n");
582 QMessageBox::message(tr("Note"),msg); 583 QMessageBox::message(tr("Note"),msg);
583// qDebug(msg); 584// qDebug(msg);
584 QCopEnvelope ( "QPE/System", "notBusy()" ); 585// QCopEnvelope ( "QPE/System", "notBusy()" );
585 return FALSE; 586 return FALSE;
586 } 587 }
587 QCopEnvelope ( "QPE/System", "notBusy()" ); 588// QCopEnvelope ( "QPE/System", "notBusy()" );
588 return TRUE; 589 return TRUE;
589} 590}
590 591
591void OpieFtp::populateLocalView() 592void OpieFtp::populateLocalView()
592{ 593{
593 Local_View->clear(); 594 Local_View->clear();
594 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 595 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
595 currentDir.setMatchAllDirs(TRUE); 596 currentDir.setMatchAllDirs(TRUE);
596 currentDir.setNameFilter(filterStr); 597 currentDir.setNameFilter(filterStr);
597 QString fileL, fileS, fileDate; 598 QString fileL, fileS, fileDate;
598 bool isDir=FALSE; 599 bool isDir=FALSE;
599 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 600 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
@@ -746,25 +747,25 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
746// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 747// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
747 } 748 }
748 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 749 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
749 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 750 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
750 currentRemoteDir = oldRemoteCurrentDir; 751 currentRemoteDir = oldRemoteCurrentDir;
751 strItem=""; 752 strItem="";
752// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 753// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
753 754
754 } else { 755 } else {
755 currentRemoteDir = currentRemoteDir+strItem; 756 currentRemoteDir = currentRemoteDir+strItem;
756 } 757 }
757 } else { 758 } else {
758 QCopEnvelope ( "QPE/System", "notBusy()" ); 759// QCopEnvelope ( "QPE/System", "notBusy()" );
759 return; 760 return;
760 } 761 }
761 } 762 }
762 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 763 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
763 if(currentRemoteDir.right(1) !="/") 764 if(currentRemoteDir.right(1) !="/")
764 currentRemoteDir +="/"; 765 currentRemoteDir +="/";
765 currentPathCombo->lineEdit()->setText( currentRemoteDir); 766 currentPathCombo->lineEdit()->setText( currentRemoteDir);
766 fillRemoteCombo( (const QString &)currentRemoteDir); 767 fillRemoteCombo( (const QString &)currentRemoteDir);
767// QCopEnvelope ( "QPE/System", "notBusy()" ); 768// QCopEnvelope ( "QPE/System", "notBusy()" );
768 } 769 }
769} 770}
770 771
@@ -948,45 +949,45 @@ void OpieFtp::localDelete()
948 populateLocalView(); 949 populateLocalView();
949 950
950} 951}
951 952
952void OpieFtp::remoteMakDir() 953void OpieFtp::remoteMakDir()
953{ 954{
954 InputDialog *fileDlg; 955 InputDialog *fileDlg;
955 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 956 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
956 fileDlg->exec(); 957 fileDlg->exec();
957 if( fileDlg->result() == 1 ) { 958 if( fileDlg->result() == 1 ) {
958 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 959 QString filename = fileDlg->LineEdit1->text();//+".playlist";
959 QString tmp=currentRemoteDir+filename; 960 QString tmp=currentRemoteDir+filename;
960 QCopEnvelope ( "QPE/System", "busy()" ); 961// QCopEnvelope ( "QPE/System", "busy()" );
961 if(FtpMkdir( tmp.latin1(), conn) == 0) { 962 if(FtpMkdir( tmp.latin1(), conn) == 0) {
962 QString msg; 963 QString msg;
963 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); 964 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn));
964 msg.replace(QRegExp(":"),"\n"); 965 msg.replace(QRegExp(":"),"\n");
965 QMessageBox::message(tr("Note"),msg); 966 QMessageBox::message(tr("Note"),msg);
966 } 967 }
967 QCopEnvelope ( "QPE/System", "notBusy()" ); 968// QCopEnvelope ( "QPE/System", "notBusy()" );
968 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 969 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
969 } 970 }
970} 971}
971 972
972void OpieFtp::remoteDelete() 973void OpieFtp::remoteDelete()
973{ 974{
974 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 975 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
975 QListViewItemIterator it( Remote_View ); 976 QListViewItemIterator it( Remote_View );
976 for ( ; it.current(); ++it ) { 977 for ( ; it.current(); ++it ) {
977 if ( it.current()->isSelected() ) { 978 if ( it.current()->isSelected() ) {
978 QString f = it.current()->text(0); 979 QString f = it.current()->text(0);
979// QString f = Remote_View->currentItem()->text(0); 980// QString f = Remote_View->currentItem()->text(0);
980 QCopEnvelope ( "QPE/System", "busy()" ); 981// QCopEnvelope ( "QPE/System", "busy()" );
981 if( f.right(1) =="/") { 982 if( f.right(1) =="/") {
982 QString path= currentRemoteDir+f; 983 QString path= currentRemoteDir+f;
983 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" 984 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
984 ,tr("Yes"),tr("No"),0,0,1) ) { 985 ,tr("Yes"),tr("No"),0,0,1) ) {
985 case 0: { 986 case 0: {
986 f=currentDir.canonicalPath()+"/"+f; 987 f=currentDir.canonicalPath()+"/"+f;
987 if(FtpRmdir( path.latin1(), conn) ==0) { 988 if(FtpRmdir( path.latin1(), conn) ==0) {
988 QString msg; 989 QString msg;
989 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); 990 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn));
990 msg.replace(QRegExp(":"),"\n"); 991 msg.replace(QRegExp(":"),"\n");
991 QMessageBox::message(tr("Note"),msg); 992 QMessageBox::message(tr("Note"),msg);
992 } 993 }
@@ -1003,45 +1004,45 @@ void OpieFtp::remoteDelete()
1003 QString msg; 1004 QString msg;
1004 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); 1005 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn));
1005 msg.replace(QRegExp(":"),"\n"); 1006 msg.replace(QRegExp(":"),"\n");
1006 QMessageBox::message(tr("Note"),msg); 1007 QMessageBox::message(tr("Note"),msg);
1007 } 1008 }
1008 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1009 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1009 } 1010 }
1010 break; 1011 break;
1011 }; 1012 };
1012 } 1013 }
1013 } 1014 }
1014 } 1015 }
1015 QCopEnvelope ( "QPE/System", "notBusy()" ); 1016// QCopEnvelope ( "QPE/System", "notBusy()" );
1016} 1017}
1017 1018
1018void OpieFtp::remoteRename() 1019void OpieFtp::remoteRename()
1019{ 1020{
1020 QString curFile = Remote_View->currentItem()->text(0); 1021 QString curFile = Remote_View->currentItem()->text(0);
1021 InputDialog *fileDlg; 1022 InputDialog *fileDlg;
1022 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1023 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1023 fileDlg->setTextEdit((const QString &)curFile); 1024 fileDlg->setTextEdit((const QString &)curFile);
1024 fileDlg->exec(); 1025 fileDlg->exec();
1025 if( fileDlg->result() == 1 ) { 1026 if( fileDlg->result() == 1 ) {
1026 QString oldName = currentRemoteDir +"/"+ curFile; 1027 QString oldName = currentRemoteDir +"/"+ curFile;
1027 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 1028 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
1028 QCopEnvelope ( "QPE/System", "busy()" ); 1029// QCopEnvelope ( "QPE/System", "busy()" );
1029 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 1030 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
1030 QString msg; 1031 QString msg;
1031 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); 1032 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn));
1032 msg.replace(QRegExp(":"),"\n"); 1033 msg.replace(QRegExp(":"),"\n");
1033 QMessageBox::message(tr("Note"),msg); 1034 QMessageBox::message(tr("Note"),msg);
1034 } 1035 }
1035 QCopEnvelope ( "QPE/System", "notBusy()" ); 1036// QCopEnvelope ( "QPE/System", "notBusy()" );
1036 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1037 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1037 } 1038 }
1038} 1039}
1039 1040
1040void OpieFtp::localRename() 1041void OpieFtp::localRename()
1041{ 1042{
1042 QString curFile = Local_View->currentItem()->text(0); 1043 QString curFile = Local_View->currentItem()->text(0);
1043 InputDialog *fileDlg; 1044 InputDialog *fileDlg;
1044 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1045 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1045 fileDlg->setTextEdit((const QString &)curFile); 1046 fileDlg->setTextEdit((const QString &)curFile);
1046 fileDlg->exec(); 1047 fileDlg->exec();
1047 if( fileDlg->result() == 1 ) { 1048 if( fileDlg->result() == 1 ) {