-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 36de842..6be28d6 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -298,49 +298,50 @@ void OpieFtp::tabChanged(QWidget *w) | |||
298 | if (TabWidget->currentPageIndex() == 1) { | 298 | if (TabWidget->currentPageIndex() == 1) { |
299 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 299 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
300 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 300 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
301 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 301 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
302 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 302 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
303 | } | 303 | } |
304 | if (TabWidget->currentPageIndex() == 2) { | 304 | if (TabWidget->currentPageIndex() == 2) { |
305 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 305 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
306 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 306 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
307 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 307 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
311 | void OpieFtp::newConnection() | 311 | void OpieFtp::newConnection() |
312 | { | 312 | { |
313 | UsernameComboBox->lineEdit()->setText(""); | 313 | UsernameComboBox->lineEdit()->setText(""); |
314 | PasswordEdit->setText( "" ); | 314 | PasswordEdit->setText( "" ); |
315 | ServerComboBox->lineEdit()->setText( ""); | 315 | ServerComboBox->lineEdit()->setText( ""); |
316 | remotePath->setText( currentRemoteDir = "/"); | 316 | remotePath->setText( currentRemoteDir = "/"); |
317 | PortSpinBox->setValue( 21); | 317 | PortSpinBox->setValue( 21); |
318 | TabWidget->setCurrentPage(2); | 318 | TabWidget->setCurrentPage(2); |
319 | currentServerConfig = -1; | 319 | currentServerConfig = -1; |
320 | } | 320 | } |
321 | 321 | ||
322 | void OpieFtp::serverComboEdited(const QString & edit) { | 322 | void OpieFtp::serverComboEdited(const QString & edit) |
323 | { | ||
323 | if( !edit.isEmpty() ) { | 324 | if( !edit.isEmpty() ) { |
324 | currentServerConfig = -1; | 325 | currentServerConfig = -1; |
325 | // qDebug("comboedited"); | 326 | // qDebug("comboedited"); |
326 | } | 327 | } |
327 | } | 328 | } |
328 | 329 | ||
329 | void OpieFtp::connectorBtnToggled(bool On) | 330 | void OpieFtp::connectorBtnToggled(bool On) |
330 | { | 331 | { |
331 | if(On) { | 332 | if(On) { |
332 | connector(); | 333 | connector(); |
333 | } else { | 334 | } else { |
334 | disConnector(); | 335 | disConnector(); |
335 | } | 336 | } |
336 | 337 | ||
337 | } | 338 | } |
338 | 339 | ||
339 | void OpieFtp::connector() | 340 | void OpieFtp::connector() |
340 | { | 341 | { |
341 | QCopEnvelope ( "QPE/System", "busy()" ); | 342 | QCopEnvelope ( "QPE/System", "busy()" ); |
342 | // qApp->processEvents(); | 343 | // qApp->processEvents(); |
343 | currentRemoteDir=remotePath->text(); | 344 | currentRemoteDir=remotePath->text(); |
344 | if(ServerComboBox->currentText().isEmpty()) { | 345 | if(ServerComboBox->currentText().isEmpty()) { |
345 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 346 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
346 | TabWidget->setCurrentPage(2); | 347 | TabWidget->setCurrentPage(2); |
@@ -633,49 +634,49 @@ bool OpieFtp::populateRemoteView( ) | |||
633 | itemDir=item; | 634 | itemDir=item; |
634 | } else { | 635 | } else { |
635 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"f"); | 636 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"f"); |
636 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 637 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
637 | // if(itemFile) | 638 | // if(itemFile) |
638 | item->moveItem(itemDir); | 639 | item->moveItem(itemDir); |
639 | item->moveItem(itemFile); | 640 | item->moveItem(itemFile); |
640 | itemFile=item; | 641 | itemFile=item; |
641 | } | 642 | } |
642 | } | 643 | } |
643 | } | 644 | } |
644 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 645 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
645 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 646 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
646 | file.close(); | 647 | file.close(); |
647 | if( file.exists()) | 648 | if( file.exists()) |
648 | file. remove(); | 649 | file. remove(); |
649 | } else | 650 | } else |
650 | qDebug("temp file not opened successfullly "+sfile); | 651 | qDebug("temp file not opened successfullly "+sfile); |
651 | Remote_View->setSorting( 4,TRUE); | 652 | Remote_View->setSorting( 4,TRUE); |
652 | return true; | 653 | return true; |
653 | } | 654 | } |
654 | 655 | ||
655 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 656 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
656 | { | 657 | { |
657 | if(item) { | 658 | if( selectedItem) { |
658 | QCopEnvelope ( "QPE/System", "busy()" ); | 659 | QCopEnvelope ( "QPE/System", "busy()" ); |
659 | QString oldRemoteCurrentDir = currentRemoteDir; | 660 | QString oldRemoteCurrentDir = currentRemoteDir; |
660 | QString strItem=selectedItem->text(0); | 661 | QString strItem=selectedItem->text(0); |
661 | strItem=strItem.simplifyWhiteSpace(); | 662 | strItem=strItem.simplifyWhiteSpace(); |
662 | if(strItem == "../") { // the user wants to go ^ | 663 | if(strItem == "../") { // the user wants to go ^ |
663 | if( FtpCDUp( conn) == 0) { | 664 | if( FtpCDUp( conn) == 0) { |
664 | QString msg; | 665 | QString msg; |
665 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 666 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
666 | msg.replace(QRegExp(":"),"\n"); | 667 | msg.replace(QRegExp(":"),"\n"); |
667 | QMessageBox::message(tr("Note"),msg); | 668 | QMessageBox::message(tr("Note"),msg); |
668 | qDebug(msg); | 669 | qDebug(msg); |
669 | } | 670 | } |
670 | char path[256]; | 671 | char path[256]; |
671 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 672 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
672 | QString msg; | 673 | QString msg; |
673 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 674 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
674 | msg.replace(QRegExp(":"),"\n"); | 675 | msg.replace(QRegExp(":"),"\n"); |
675 | QMessageBox::message(tr("Note"),msg); | 676 | QMessageBox::message(tr("Note"),msg); |
676 | qDebug(msg); | 677 | qDebug(msg); |
677 | } | 678 | } |
678 | currentRemoteDir=path; | 679 | currentRemoteDir=path; |
679 | } else { | 680 | } else { |
680 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 681 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
681 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 682 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
@@ -690,50 +691,49 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
690 | qDebug("trying directory"); | 691 | qDebug("trying directory"); |
691 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 692 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
692 | currentRemoteDir = oldRemoteCurrentDir; | 693 | currentRemoteDir = oldRemoteCurrentDir; |
693 | strItem=""; | 694 | strItem=""; |
694 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 695 | qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
695 | 696 | ||
696 | } else { | 697 | } else { |
697 | currentRemoteDir = currentRemoteDir+strItem; | 698 | currentRemoteDir = currentRemoteDir+strItem; |
698 | } | 699 | } |
699 | } else { | 700 | } else { |
700 | qDebug("download "+strItem); | 701 | qDebug("download "+strItem); |
701 | } | 702 | } |
702 | } | 703 | } |
703 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 704 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
704 | if(currentRemoteDir.right(1) !="/") | 705 | if(currentRemoteDir.right(1) !="/") |
705 | currentRemoteDir +="/"; | 706 | currentRemoteDir +="/"; |
706 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 707 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
707 | fillRemoteCombo( (const QString &)currentDir); | 708 | fillRemoteCombo( (const QString &)currentDir); |
708 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 709 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
709 | } | 710 | } |
710 | } | 711 | } |
711 | 712 | ||
712 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 713 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
713 | { | 714 | { |
714 | // qDebug(selectedItem->text(0)); | 715 | if(selectedItem!= NULL) { |
715 | if(item!= NULL) { | ||
716 | 716 | ||
717 | QString strItem=selectedItem->text(0); | 717 | QString strItem=selectedItem->text(0); |
718 | QString strSize=selectedItem->text(1); | 718 | QString strSize=selectedItem->text(1); |
719 | strSize=strSize.stripWhiteSpace(); | 719 | strSize=strSize.stripWhiteSpace(); |
720 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 720 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
721 | // is symlink | 721 | // is symlink |
722 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 722 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
723 | if(QDir(strItem2).exists() ) { | 723 | if(QDir(strItem2).exists() ) { |
724 | currentDir.cd(strItem2, TRUE); | 724 | currentDir.cd(strItem2, TRUE); |
725 | populateLocalView(); | 725 | populateLocalView(); |
726 | } | 726 | } |
727 | } else { // not a symlink | 727 | } else { // not a symlink |
728 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 728 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
729 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 729 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
730 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 730 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
731 | currentDir.cd(strItem,FALSE); | 731 | currentDir.cd(strItem,FALSE); |
732 | populateLocalView(); | 732 | populateLocalView(); |
733 | } else { | 733 | } else { |
734 | currentDir.cdUp(); | 734 | currentDir.cdUp(); |
735 | populateLocalView(); | 735 | populateLocalView(); |
736 | } | 736 | } |
737 | if(QDir(strItem).exists()){ | 737 | if(QDir(strItem).exists()){ |
738 | currentDir.cd(strItem, TRUE); | 738 | currentDir.cd(strItem, TRUE); |
739 | populateLocalView(); | 739 | populateLocalView(); |