author | llornkcor <llornkcor> | 2002-04-10 19:17:31 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-10 19:17:31 (UTC) |
commit | 5cf7797af9fb965916f5017f84898516157c4620 (patch) (unidiff) | |
tree | 032bda2f3ccfb8ebb7d930ba49f959ea504ce205 /noncore/net | |
parent | 9237a75548f9b932fbb1900d8ea28dbee9da81ac (diff) | |
download | opie-5cf7797af9fb965916f5017f84898516157c4620.zip opie-5cf7797af9fb965916f5017f84898516157c4620.tar.gz opie-5cf7797af9fb965916f5017f84898516157c4620.tar.bz2 |
bug fix and added icons the previous commit here, and forgot in the log.. heheheh
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 130 |
1 files changed, 78 insertions, 52 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index fb57193..7f5d71c 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -152,14 +152,16 @@ OpieFtp::OpieFtp( ) | |||
152 | Local_View->addColumn( tr("File"),150); | 152 | Local_View->addColumn( tr("File"),150); |
153 | Local_View->addColumn( tr("Size"),-1); | 153 | Local_View->addColumn( tr("Size"),-1); |
154 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 154 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
155 | Local_View->addColumn( tr("Date"),-1); | 155 | Local_View->addColumn( tr("Date"),-1); |
156 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 156 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
157 | Local_View->setAllColumnsShowFocus(TRUE); | 157 | Local_View->setAllColumnsShowFocus(TRUE); |
158 | |||
158 | Local_View->setMultiSelection( TRUE ); | 159 | Local_View->setMultiSelection( TRUE ); |
159 | Local_View->setSelectionMode(QListView::Extended); | 160 | Local_View->setSelectionMode(QListView::Extended); |
161 | Local_View->setFocusPolicy(QWidget::ClickFocus); | ||
160 | 162 | ||
161 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 163 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
162 | 164 | ||
163 | tabLayout->addWidget( Local_View, 0, 0 ); | 165 | tabLayout->addWidget( Local_View, 0, 0 ); |
164 | 166 | ||
165 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 167 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
@@ -182,14 +184,16 @@ OpieFtp::OpieFtp( ) | |||
182 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 184 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
183 | Remote_View->addColumn( tr("Date"),-1); | 185 | Remote_View->addColumn( tr("Date"),-1); |
184 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 186 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
185 | Remote_View->addColumn( tr("Dir"),-1); | 187 | Remote_View->addColumn( tr("Dir"),-1); |
186 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 188 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
187 | Remote_View->setAllColumnsShowFocus(TRUE); | 189 | Remote_View->setAllColumnsShowFocus(TRUE); |
188 | Remote_View->setMultiSelection( TRUE ); | 190 | |
191 | Remote_View->setMultiSelection( FALSE); | ||
189 | Remote_View->setSelectionMode(QListView::Extended); | 192 | Remote_View->setSelectionMode(QListView::Extended); |
193 | Remote_View->setFocusPolicy(QWidget::ClickFocus); | ||
190 | 194 | ||
191 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 195 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
192 | 196 | ||
193 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 197 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
194 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 198 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
195 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 199 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
@@ -375,13 +379,13 @@ void OpieFtp::connectorBtnToggled(bool On) | |||
375 | } | 379 | } |
376 | 380 | ||
377 | } | 381 | } |
378 | 382 | ||
379 | void OpieFtp::connector() | 383 | void OpieFtp::connector() |
380 | { | 384 | { |
381 | // QCopEnvelope ( "QPE/System", "busy()" ); | 385 | QCopEnvelope ( "QPE/System", "busy()" ); |
382 | // qApp->processEvents(); | 386 | // qApp->processEvents(); |
383 | currentRemoteDir=remotePath->text(); | 387 | currentRemoteDir=remotePath->text(); |
384 | if(ServerComboBox->currentText().isEmpty()) { | 388 | if(ServerComboBox->currentText().isEmpty()) { |
385 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 389 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
386 | TabWidget->setCurrentPage(2); | 390 | TabWidget->setCurrentPage(2); |
387 | ServerComboBox->setFocus(); | 391 | ServerComboBox->setFocus(); |
@@ -418,13 +422,13 @@ void OpieFtp::connector() | |||
418 | return ; | 422 | return ; |
419 | } | 423 | } |
420 | remoteDirList("/") ; | 424 | remoteDirList("/") ; |
421 | setCaption(ftp_host); | 425 | setCaption(ftp_host); |
422 | writeConfig(); | 426 | writeConfig(); |
423 | connectServerBtn->setText( tr("Disconnect")); | 427 | connectServerBtn->setText( tr("Disconnect")); |
424 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 428 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
425 | } | 429 | } |
426 | 430 | ||
427 | void OpieFtp::disConnector() | 431 | void OpieFtp::disConnector() |
428 | { | 432 | { |
429 | if(conn) | 433 | if(conn) |
430 | FtpQuit(conn); | 434 | FtpQuit(conn); |
@@ -466,19 +470,22 @@ void OpieFtp::localUpload() | |||
466 | } | 470 | } |
467 | } else { | 471 | } else { |
468 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 472 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
469 | } | 473 | } |
470 | ProgressBar->reset(); | 474 | ProgressBar->reset(); |
471 | nullifyCallBack(); | 475 | nullifyCallBack(); |
472 | } //end currentSelected | ||
473 | it.current()->setSelected(FALSE); | 476 | it.current()->setSelected(FALSE); |
477 | } //end currentSelected | ||
478 | } | ||
479 | for ( ; it.current(); ++it ) { | ||
480 | Local_View->clearSelection(); | ||
474 | } | 481 | } |
482 | Local_View->clearFocus(); | ||
475 | TabWidget->setCurrentPage(1); | 483 | TabWidget->setCurrentPage(1); |
476 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 484 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
477 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 485 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
478 | |||
479 | } | 486 | } |
480 | 487 | ||
481 | void OpieFtp::nullifyCallBack() | 488 | void OpieFtp::nullifyCallBack() |
482 | { | 489 | { |
483 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 490 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); |
484 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 491 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
@@ -487,13 +494,13 @@ void OpieFtp::nullifyCallBack() | |||
487 | } | 494 | } |
488 | 495 | ||
489 | void OpieFtp::remoteDownload() | 496 | void OpieFtp::remoteDownload() |
490 | { | 497 | { |
491 | // qApp->processEvents(); | 498 | // qApp->processEvents(); |
492 | int fsz; | 499 | int fsz; |
493 | // QCopEnvelope ( "QPE/System", "busy()" ); | 500 | QCopEnvelope ( "QPE/System", "busy()" ); |
494 | 501 | ||
495 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 502 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
496 | QListViewItemIterator it( Remote_View ); | 503 | QListViewItemIterator it( Remote_View ); |
497 | for ( ; it.current(); ++it ) { | 504 | for ( ; it.current(); ++it ) { |
498 | if ( it.current()->isSelected() ) { | 505 | if ( it.current()->isSelected() ) { |
499 | QString strItem = it.current()->text(0); | 506 | QString strItem = it.current()->text(0); |
@@ -521,55 +528,58 @@ void OpieFtp::remoteDownload() | |||
521 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 528 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
522 | msg.replace(QRegExp(":"),"\n"); | 529 | msg.replace(QRegExp(":"),"\n"); |
523 | QMessageBox::message(tr("Note"),msg); | 530 | QMessageBox::message(tr("Note"),msg); |
524 | } | 531 | } |
525 | ProgressBar->reset(); | 532 | ProgressBar->reset(); |
526 | nullifyCallBack(); | 533 | nullifyCallBack(); |
527 | } | ||
528 | it.current()->setSelected(FALSE); | 534 | it.current()->setSelected(FALSE); |
529 | } | 535 | } |
536 | } | ||
537 | for ( ; it.current(); ++it ) { | ||
538 | Remote_View->clearSelection(); | ||
539 | } | ||
540 | Remote_View->setFocus(); | ||
530 | TabWidget->setCurrentPage(0); | 541 | TabWidget->setCurrentPage(0); |
531 | populateLocalView(); | 542 | populateLocalView(); |
532 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 543 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
533 | |||
534 | } | 544 | } |
535 | 545 | ||
536 | bool OpieFtp::remoteDirList(const QString &dir) | 546 | bool OpieFtp::remoteDirList(const QString &dir) |
537 | { | 547 | { |
538 | QString tmp = QDir::homeDirPath(); | 548 | QString tmp = QDir::homeDirPath(); |
539 | if(tmp.right(1) != "/") | 549 | if(tmp.right(1) != "/") |
540 | tmp+="/._temp"; | 550 | tmp+="/._temp"; |
541 | else | 551 | else |
542 | tmp+="._temp"; | 552 | tmp+="._temp"; |
543 | // qDebug("Listing remote dir "+tmp); | 553 | // qDebug("Listing remote dir "+tmp); |
544 | // QCopEnvelope ( "QPE/System", "busy()" ); | 554 | QCopEnvelope ( "QPE/System", "busy()" ); |
545 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 555 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
546 | QString msg; | 556 | QString msg; |
547 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 557 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
548 | msg.replace(QRegExp(":"),"\n"); | 558 | msg.replace(QRegExp(":"),"\n"); |
549 | QMessageBox::message(tr("Note"),msg); | 559 | QMessageBox::message(tr("Note"),msg); |
550 | return false; | 560 | return false; |
551 | } | 561 | } |
552 | populateRemoteView() ; | 562 | populateRemoteView() ; |
553 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 563 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
554 | return true; | 564 | return true; |
555 | } | 565 | } |
556 | 566 | ||
557 | bool OpieFtp::remoteChDir(const QString &dir) | 567 | bool OpieFtp::remoteChDir(const QString &dir) |
558 | { | 568 | { |
559 | // QCopEnvelope ( "QPE/System", "busy()" ); | 569 | QCopEnvelope ( "QPE/System", "busy()" ); |
560 | if (!FtpChdir( dir.latin1(), conn )) { | 570 | if (!FtpChdir( dir.latin1(), conn )) { |
561 | QString msg; | 571 | QString msg; |
562 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 572 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
563 | msg.replace(QRegExp(":"),"\n"); | 573 | msg.replace(QRegExp(":"),"\n"); |
564 | QMessageBox::message(tr("Note"),msg); | 574 | QMessageBox::message(tr("Note"),msg); |
565 | // qDebug(msg); | 575 | // qDebug(msg); |
566 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 576 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
567 | return FALSE; | 577 | return FALSE; |
568 | } | 578 | } |
569 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 579 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
570 | return TRUE; | 580 | return TRUE; |
571 | } | 581 | } |
572 | 582 | ||
573 | void OpieFtp::populateLocalView() | 583 | void OpieFtp::populateLocalView() |
574 | { | 584 | { |
575 | Local_View->clear(); | 585 | Local_View->clear(); |
@@ -634,13 +644,12 @@ void OpieFtp::populateLocalView() | |||
634 | isDir=FALSE; | 644 | isDir=FALSE; |
635 | ++it; | 645 | ++it; |
636 | } | 646 | } |
637 | Local_View->setSorting( 3,FALSE); | 647 | Local_View->setSorting( 3,FALSE); |
638 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 648 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
639 | fillCombo( (const QString &)currentDir); | 649 | fillCombo( (const QString &)currentDir); |
640 | |||
641 | } | 650 | } |
642 | 651 | ||
643 | bool OpieFtp::populateRemoteView( ) | 652 | bool OpieFtp::populateRemoteView( ) |
644 | { | 653 | { |
645 | // qDebug("populate remoteview"); | 654 | // qDebug("populate remoteview"); |
646 | QString sfile=QDir::homeDirPath(); | 655 | QString sfile=QDir::homeDirPath(); |
@@ -735,13 +744,13 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
735 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 744 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
736 | 745 | ||
737 | } else { | 746 | } else { |
738 | currentRemoteDir = currentRemoteDir+strItem; | 747 | currentRemoteDir = currentRemoteDir+strItem; |
739 | } | 748 | } |
740 | } else { | 749 | } else { |
741 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 750 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
742 | return; | 751 | return; |
743 | } | 752 | } |
744 | } | 753 | } |
745 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 754 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
746 | if(currentRemoteDir.right(1) !="/") | 755 | if(currentRemoteDir.right(1) !="/") |
747 | currentRemoteDir +="/"; | 756 | currentRemoteDir +="/"; |
@@ -787,13 +796,12 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) | |||
787 | return; | 796 | return; |
788 | } | 797 | } |
789 | } //end not symlink | 798 | } //end not symlink |
790 | chdir(strItem.latin1()); | 799 | chdir(strItem.latin1()); |
791 | } | 800 | } |
792 | } | 801 | } |
793 | |||
794 | } | 802 | } |
795 | 803 | ||
796 | void OpieFtp::doLocalCd() | 804 | void OpieFtp::doLocalCd() |
797 | { | 805 | { |
798 | localListClicked( Local_View->currentItem()); | 806 | localListClicked( Local_View->currentItem()); |
799 | } | 807 | } |
@@ -835,45 +843,49 @@ void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &p | |||
835 | showRemoteMenu(item); | 843 | showRemoteMenu(item); |
836 | } | 844 | } |
837 | } | 845 | } |
838 | 846 | ||
839 | void OpieFtp::showRemoteMenu(QListViewItem * item) | 847 | void OpieFtp::showRemoteMenu(QListViewItem * item) |
840 | { | 848 | { |
841 | QPopupMenu m;// = new QPopupMenu( Local_View ); | 849 | QPopupMenu * m;// = new QPopupMenu( Local_View ); |
850 | m = new QPopupMenu(this); | ||
842 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) | 851 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) |
843 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 852 | m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
844 | else | 853 | else |
845 | m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 854 | m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
846 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 855 | m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
847 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 856 | m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
848 | m.insertSeparator(); | 857 | m->insertSeparator(); |
849 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 858 | m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
850 | m.exec( QCursor::pos() ); | 859 | m->exec( QCursor::pos() ); |
860 | delete m; | ||
851 | } | 861 | } |
852 | 862 | ||
853 | void OpieFtp::showLocalMenu(QListViewItem * item) | 863 | void OpieFtp::showLocalMenu(QListViewItem * item) |
854 | { | 864 | { |
855 | 865 | ||
856 | QPopupMenu m; | 866 | QPopupMenu *m; |
857 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 867 | m = new QPopupMenu( this); |
858 | m.insertSeparator(); | 868 | m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
869 | m->insertSeparator(); | ||
859 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 870 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
860 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 871 | m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
861 | else | 872 | else |
862 | m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 873 | m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
863 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 874 | m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
864 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 875 | m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
865 | m.insertSeparator(); | 876 | m->insertSeparator(); |
866 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 877 | m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
867 | m.setCheckable(TRUE); | 878 | m->setCheckable(TRUE); |
868 | if (b) | 879 | if (b) |
869 | m.setItemChecked(m.idAt(0),TRUE); | 880 | m->setItemChecked(m->idAt(0),TRUE); |
870 | else | 881 | else |
871 | m.setItemChecked(m.idAt(0),FALSE); | 882 | m->setItemChecked(m->idAt(0),FALSE); |
872 | 883 | ||
873 | m.exec( QCursor::pos() ); | 884 | m->exec( QCursor::pos() ); |
885 | delete m; | ||
874 | } | 886 | } |
875 | 887 | ||
876 | void OpieFtp::localMakDir() | 888 | void OpieFtp::localMakDir() |
877 | { | 889 | { |
878 | InputDialog *fileDlg; | 890 | InputDialog *fileDlg; |
879 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 891 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
@@ -884,21 +896,27 @@ void OpieFtp::localMakDir() | |||
884 | } | 896 | } |
885 | populateLocalView(); | 897 | populateLocalView(); |
886 | } | 898 | } |
887 | 899 | ||
888 | void OpieFtp::localDelete() | 900 | void OpieFtp::localDelete() |
889 | { | 901 | { |
890 | QString f = Local_View->currentItem()->text(0); | 902 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
903 | QListViewItemIterator it( Local_View ); | ||
904 | for ( ; it.current(); ++it ) { | ||
905 | if ( it.current()->isSelected() ) { | ||
906 | QString f = it.current()->text(0); | ||
907 | it.current()->setSelected(FALSE); | ||
908 | |||
909 | // QString f = Local_View->currentItem()->text(0); | ||
891 | if(QDir(f).exists() ) { | 910 | if(QDir(f).exists() ) { |
892 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 911 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
893 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { | 912 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { |
894 | case 0: { | 913 | case 0: { |
895 | f=currentDir.canonicalPath()+"/"+f; | 914 | f=currentDir.canonicalPath()+"/"+f; |
896 | QString cmd="rmdir "+f; | 915 | QString cmd="rmdir "+f; |
897 | system( cmd.latin1()); | 916 | system( cmd.latin1()); |
898 | populateLocalView(); | ||
899 | } | 917 | } |
900 | break; | 918 | break; |
901 | case 1: | 919 | case 1: |
902 | // exit | 920 | // exit |
903 | break; | 921 | break; |
904 | }; | 922 | }; |
@@ -907,46 +925,54 @@ void OpieFtp::localDelete() | |||
907 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 925 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
908 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 926 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
909 | case 0: { | 927 | case 0: { |
910 | f=currentDir.canonicalPath()+"/"+f; | 928 | f=currentDir.canonicalPath()+"/"+f; |
911 | QString cmd="rm "+f; | 929 | QString cmd="rm "+f; |
912 | system( cmd.latin1()); | 930 | system( cmd.latin1()); |
913 | populateLocalView(); | ||
914 | } | 931 | } |
915 | break; | 932 | break; |
916 | case 1: | 933 | case 1: |
917 | // exit | 934 | // exit |
918 | break; | 935 | break; |
919 | }; | 936 | }; |
920 | } | 937 | } |
921 | } | 938 | } |
939 | } | ||
940 | populateLocalView(); | ||
941 | |||
942 | } | ||
922 | 943 | ||
923 | void OpieFtp::remoteMakDir() | 944 | void OpieFtp::remoteMakDir() |
924 | { | 945 | { |
925 | InputDialog *fileDlg; | 946 | InputDialog *fileDlg; |
926 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 947 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
927 | fileDlg->exec(); | 948 | fileDlg->exec(); |
928 | if( fileDlg->result() == 1 ) { | 949 | if( fileDlg->result() == 1 ) { |
929 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; | 950 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; |
930 | QString tmp=currentRemoteDir+filename; | 951 | QString tmp=currentRemoteDir+filename; |
931 | // QCopEnvelope ( "QPE/System", "busy()" ); | 952 | QCopEnvelope ( "QPE/System", "busy()" ); |
932 | if(FtpMkdir( tmp.latin1(), conn) == 0) { | 953 | if(FtpMkdir( tmp.latin1(), conn) == 0) { |
933 | QString msg; | 954 | QString msg; |
934 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); | 955 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); |
935 | msg.replace(QRegExp(":"),"\n"); | 956 | msg.replace(QRegExp(":"),"\n"); |
936 | QMessageBox::message(tr("Note"),msg); | 957 | QMessageBox::message(tr("Note"),msg); |
937 | } | 958 | } |
938 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 959 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
939 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 960 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
940 | } | 961 | } |
941 | } | 962 | } |
942 | 963 | ||
943 | void OpieFtp::remoteDelete() | 964 | void OpieFtp::remoteDelete() |
944 | { | 965 | { |
945 | QString f = Remote_View->currentItem()->text(0); | 966 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
946 | // QCopEnvelope ( "QPE/System", "busy()" ); | 967 | QListViewItemIterator it( Remote_View ); |
968 | for ( ; it.current(); ++it ) { | ||
969 | if ( it.current()->isSelected() ) { | ||
970 | QString f = it.current()->text(0); | ||
971 | // QString f = Remote_View->currentItem()->text(0); | ||
972 | QCopEnvelope ( "QPE/System", "busy()" ); | ||
947 | if( f.right(1) =="/") { | 973 | if( f.right(1) =="/") { |
948 | QString path= currentRemoteDir+f; | 974 | QString path= currentRemoteDir+f; |
949 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" | 975 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" |
950 | ,tr("Yes"),tr("No"),0,0,1) ) { | 976 | ,tr("Yes"),tr("No"),0,0,1) ) { |
951 | case 0: { | 977 | case 0: { |
952 | f=currentDir.canonicalPath()+"/"+f; | 978 | f=currentDir.canonicalPath()+"/"+f; |
@@ -973,33 +999,35 @@ void OpieFtp::remoteDelete() | |||
973 | } | 999 | } |
974 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1000 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
975 | } | 1001 | } |
976 | break; | 1002 | break; |
977 | }; | 1003 | }; |
978 | } | 1004 | } |
979 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 1005 | } |
1006 | } | ||
1007 | QCopEnvelope ( "QPE/System", "notBusy()" ); | ||
980 | } | 1008 | } |
981 | 1009 | ||
982 | void OpieFtp::remoteRename() | 1010 | void OpieFtp::remoteRename() |
983 | { | 1011 | { |
984 | QString curFile = Remote_View->currentItem()->text(0); | 1012 | QString curFile = Remote_View->currentItem()->text(0); |
985 | InputDialog *fileDlg; | 1013 | InputDialog *fileDlg; |
986 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 1014 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
987 | fileDlg->setTextEdit((const QString &)curFile); | 1015 | fileDlg->setTextEdit((const QString &)curFile); |
988 | fileDlg->exec(); | 1016 | fileDlg->exec(); |
989 | if( fileDlg->result() == 1 ) { | 1017 | if( fileDlg->result() == 1 ) { |
990 | QString oldName = currentRemoteDir +"/"+ curFile; | 1018 | QString oldName = currentRemoteDir +"/"+ curFile; |
991 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; | 1019 | QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; |
992 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1020 | QCopEnvelope ( "QPE/System", "busy()" ); |
993 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { | 1021 | if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { |
994 | QString msg; | 1022 | QString msg; |
995 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); | 1023 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); |
996 | msg.replace(QRegExp(":"),"\n"); | 1024 | msg.replace(QRegExp(":"),"\n"); |
997 | QMessageBox::message(tr("Note"),msg); | 1025 | QMessageBox::message(tr("Note"),msg); |
998 | } | 1026 | } |
999 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 1027 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
1000 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1028 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1001 | } | 1029 | } |
1002 | } | 1030 | } |
1003 | 1031 | ||
1004 | void OpieFtp::localRename() | 1032 | void OpieFtp::localRename() |
1005 | { | 1033 | { |
@@ -1262,13 +1290,13 @@ void OpieFtp::upDir() | |||
1262 | currentRemoteDir=path; | 1290 | currentRemoteDir=path; |
1263 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1291 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1264 | if(currentRemoteDir.right(1) !="/") | 1292 | if(currentRemoteDir.right(1) !="/") |
1265 | currentRemoteDir +="/"; | 1293 | currentRemoteDir +="/"; |
1266 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 1294 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
1267 | fillRemoteCombo( (const QString &)currentRemoteDir); | 1295 | fillRemoteCombo( (const QString &)currentRemoteDir); |
1268 | populateRemoteView( ); | 1296 | |
1269 | } | 1297 | } |
1270 | } | 1298 | } |
1271 | 1299 | ||
1272 | void OpieFtp::docButtonPushed() { | 1300 | void OpieFtp::docButtonPushed() { |
1273 | QString current = QPEApplication::documentDir(); | 1301 | QString current = QPEApplication::documentDir(); |
1274 | chdir( current.latin1() ); | 1302 | chdir( current.latin1() ); |
@@ -1276,14 +1304,12 @@ void OpieFtp::docButtonPushed() { | |||
1276 | populateLocalView(); | 1304 | populateLocalView(); |
1277 | update(); | 1305 | update(); |
1278 | 1306 | ||
1279 | } | 1307 | } |
1280 | 1308 | ||
1281 | void OpieFtp::homeButtonPushed() { | 1309 | void OpieFtp::homeButtonPushed() { |
1282 | if (TabWidget->currentPageIndex() == 0) { | ||
1283 | QString current = QDir::homeDirPath(); | 1310 | QString current = QDir::homeDirPath(); |
1284 | chdir( current.latin1() ); | 1311 | chdir( current.latin1() ); |
1285 | currentDir.cd( current, TRUE); | 1312 | currentDir.cd( current, TRUE); |
1286 | populateLocalView(); | 1313 | populateLocalView(); |
1287 | update(); | 1314 | update(); |
1288 | } | 1315 | } |
1289 | } | ||