author | llornkcor <llornkcor> | 2002-04-23 23:55:30 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-23 23:55:30 (UTC) |
commit | 23f73a3a483a4daf3a26d0e83fd947d4f4118013 (patch) (unidiff) | |
tree | 863595f54ae6ac8a9865da9912dfeec7cda561ca | |
parent | f90935204b16126b40d4c562b26e37148ca03536 (diff) | |
download | opie-23f73a3a483a4daf3a26d0e83fd947d4f4118013.zip opie-23f73a3a483a4daf3a26d0e83fd947d4f4118013.tar.gz opie-23f73a3a483a4daf3a26d0e83fd947d4f4118013.tar.bz2 |
symlink icon fix
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index d78b7d1..6684abb 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -549,193 +549,193 @@ void OpieFtp::remoteDownload() | |||
549 | TabWidget->setCurrentPage(0); | 549 | TabWidget->setCurrentPage(0); |
550 | populateLocalView(); | 550 | populateLocalView(); |
551 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 551 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
552 | } | 552 | } |
553 | 553 | ||
554 | bool OpieFtp::remoteDirList(const QString &dir) | 554 | bool OpieFtp::remoteDirList(const QString &dir) |
555 | { | 555 | { |
556 | QString tmp = QDir::homeDirPath(); | 556 | QString tmp = QDir::homeDirPath(); |
557 | if(tmp.right(1) != "/") | 557 | if(tmp.right(1) != "/") |
558 | tmp+="/._temp"; | 558 | tmp+="/._temp"; |
559 | else | 559 | else |
560 | tmp+="._temp"; | 560 | tmp+="._temp"; |
561 | // qDebug("Listing remote dir "+tmp); | 561 | // qDebug("Listing remote dir "+tmp); |
562 | QCopEnvelope ( "QPE/System", "busy()" ); | 562 | QCopEnvelope ( "QPE/System", "busy()" ); |
563 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 563 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
564 | QString msg; | 564 | QString msg; |
565 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 565 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
566 | msg.replace(QRegExp(":"),"\n"); | 566 | msg.replace(QRegExp(":"),"\n"); |
567 | QMessageBox::message(tr("Note"),msg); | 567 | QMessageBox::message(tr("Note"),msg); |
568 | return false; | 568 | return false; |
569 | } | 569 | } |
570 | populateRemoteView() ; | 570 | populateRemoteView() ; |
571 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 571 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
572 | return true; | 572 | return true; |
573 | } | 573 | } |
574 | 574 | ||
575 | bool OpieFtp::remoteChDir(const QString &dir) | 575 | bool OpieFtp::remoteChDir(const QString &dir) |
576 | { | 576 | { |
577 | QCopEnvelope ( "QPE/System", "busy()" ); | 577 | QCopEnvelope ( "QPE/System", "busy()" ); |
578 | if (!FtpChdir( dir.latin1(), conn )) { | 578 | if (!FtpChdir( dir.latin1(), conn )) { |
579 | QString msg; | 579 | QString msg; |
580 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 580 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
581 | msg.replace(QRegExp(":"),"\n"); | 581 | msg.replace(QRegExp(":"),"\n"); |
582 | QMessageBox::message(tr("Note"),msg); | 582 | QMessageBox::message(tr("Note"),msg); |
583 | // qDebug(msg); | 583 | // qDebug(msg); |
584 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 584 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
585 | return FALSE; | 585 | return FALSE; |
586 | } | 586 | } |
587 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 587 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
588 | return TRUE; | 588 | return TRUE; |
589 | } | 589 | } |
590 | 590 | ||
591 | void OpieFtp::populateLocalView() | 591 | void OpieFtp::populateLocalView() |
592 | { | 592 | { |
593 | Local_View->clear(); | 593 | Local_View->clear(); |
594 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 594 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
595 | currentDir.setMatchAllDirs(TRUE); | 595 | currentDir.setMatchAllDirs(TRUE); |
596 | currentDir.setNameFilter(filterStr); | 596 | currentDir.setNameFilter(filterStr); |
597 | QString fileL, fileS, fileDate; | 597 | QString fileL, fileS, fileDate; |
598 | bool isDir=FALSE; | 598 | bool isDir=FALSE; |
599 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 599 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
600 | QFileInfoListIterator it(*list); | 600 | QFileInfoListIterator it(*list); |
601 | QFileInfo *fi; | 601 | QFileInfo *fi; |
602 | while ( (fi=it.current()) ) { | 602 | while ( (fi=it.current()) ) { |
603 | if (fi->isSymLink() ){ | 603 | if (fi->isSymLink() ){ |
604 | QString symLink=fi->readLink(); | 604 | QString symLink=fi->readLink(); |
605 | // qDebug("Symlink detected "+symLink); | 605 | // qDebug("Symlink detected "+symLink); |
606 | QFileInfo sym( symLink); | 606 | QFileInfo sym( symLink); |
607 | fileS.sprintf( "%10li", sym.size() ); | 607 | fileS.sprintf( "%10li", sym.size() ); |
608 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 608 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
609 | fileDate = sym.lastModified().toString(); | 609 | fileDate = sym.lastModified().toString(); |
610 | } else { | 610 | } else { |
611 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 611 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
612 | fileS.sprintf( "%10li", fi->size() ); | 612 | fileS.sprintf( "%10li", fi->size() ); |
613 | fileL.sprintf( "%s",fi->fileName().data() ); | 613 | fileL.sprintf( "%s",fi->fileName().data() ); |
614 | fileDate= fi->lastModified().toString(); | 614 | fileDate= fi->lastModified().toString(); |
615 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 615 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
616 | fileL+="/"; | 616 | fileL+="/"; |
617 | isDir=TRUE; | 617 | isDir=TRUE; |
618 | // qDebug( fileL); | 618 | // qDebug( fileL); |
619 | } | 619 | } |
620 | } | 620 | } |
621 | if(fileL !="./" && fi->exists()) { | 621 | if(fileL !="./" && fi->exists()) { |
622 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); | 622 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); |
623 | QPixmap pm; | 623 | QPixmap pm; |
624 | 624 | ||
625 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 625 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
626 | if( !QDir( fi->filePath() ).isReadable()) | 626 | if( !QDir( fi->filePath() ).isReadable()) |
627 | pm = Resource::loadPixmap( "lockedfolder" ); | 627 | pm = Resource::loadPixmap( "lockedfolder" ); |
628 | else | 628 | else |
629 | pm= Resource::loadPixmap( "folder" ); | 629 | pm= Resource::loadPixmap( "folder" ); |
630 | item->setPixmap( 0,pm ); | 630 | item->setPixmap( 0,pm ); |
631 | } else { | 631 | } else { |
632 | if( !fi->isReadable() ) | 632 | if( !fi->isReadable() ) |
633 | pm = Resource::loadPixmap( "locked" ); | 633 | pm = Resource::loadPixmap( "locked" ); |
634 | else { | 634 | else { |
635 | MimeType mt(fi->filePath()); | 635 | MimeType mt(fi->filePath()); |
636 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 636 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
637 | if(pm.isNull()) | 637 | if(pm.isNull()) |
638 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 638 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
639 | item->setPixmap( 0,pm); | 639 | item->setPixmap( 0,pm); |
640 | } | 640 | } |
641 | } | 641 | } |
642 | if( fileL.find("->",0,TRUE) != -1) { | 642 | if( fileL.find("->",0,TRUE) != -1) { |
643 | // overlay link image | 643 | // overlay link image |
644 | pm= Resource::loadPixmap( "folder" ); | 644 | pm= Resource::loadPixmap( "folder" ); |
645 | QPixmap lnk = Resource::loadPixmap( "symlink" ); | 645 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
646 | QPainter painter( &pm ); | 646 | QPainter painter( &pm ); |
647 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 647 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
648 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 648 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
649 | item->setPixmap( 0, pm); | 649 | item->setPixmap( 0, pm); |
650 | } | 650 | } |
651 | } | 651 | } |
652 | isDir=FALSE; | 652 | isDir=FALSE; |
653 | ++it; | 653 | ++it; |
654 | } | 654 | } |
655 | Local_View->setSorting( 3,FALSE); | 655 | Local_View->setSorting( 3,FALSE); |
656 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 656 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
657 | fillCombo( (const QString &)currentDir); | 657 | fillCombo( (const QString &)currentDir); |
658 | } | 658 | } |
659 | 659 | ||
660 | bool OpieFtp::populateRemoteView( ) | 660 | bool OpieFtp::populateRemoteView( ) |
661 | { | 661 | { |
662 | // qDebug("populate remoteview"); | 662 | // qDebug("populate remoteview"); |
663 | QString sfile=QDir::homeDirPath(); | 663 | QString sfile=QDir::homeDirPath(); |
664 | if(sfile.right(1) != "/") | 664 | if(sfile.right(1) != "/") |
665 | sfile+="/._temp"; | 665 | sfile+="/._temp"; |
666 | else | 666 | else |
667 | sfile+="._temp"; | 667 | sfile+="._temp"; |
668 | QFile file( sfile); | 668 | QFile file( sfile); |
669 | Remote_View->clear(); | 669 | Remote_View->clear(); |
670 | QString s, File_Name; | 670 | QString s, File_Name; |
671 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 671 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
672 | QString fileL, fileS, fileDate; | 672 | QString fileL, fileS, fileDate; |
673 | if ( file.open(IO_ReadOnly)) { | 673 | if ( file.open(IO_ReadOnly)) { |
674 | QTextStream t( &file ); // use a text stream | 674 | QTextStream t( &file ); // use a text stream |
675 | while ( !t.eof()) { | 675 | while ( !t.eof()) { |
676 | s = t.readLine(); | 676 | s = t.readLine(); |
677 | fileL = s.right(s.length()-55); | 677 | fileL = s.right(s.length()-55); |
678 | fileL = fileL.stripWhiteSpace(); | 678 | fileL = fileL.stripWhiteSpace(); |
679 | if(s.left(1) == "d") | 679 | if(s.left(1) == "d") |
680 | fileL = fileL+"/"; | 680 | fileL = fileL+"/"; |
681 | // fileL = "/"+fileL+"/"; | 681 | // fileL = "/"+fileL+"/"; |
682 | fileS = s.mid( 30, 42-30); | 682 | fileS = s.mid( 30, 42-30); |
683 | fileS = fileS.stripWhiteSpace(); | 683 | fileS = fileS.stripWhiteSpace(); |
684 | fileDate = s.mid( 42, 55-42); | 684 | fileDate = s.mid( 42, 55-42); |
685 | fileDate = fileDate.stripWhiteSpace(); | 685 | fileDate = fileDate.stripWhiteSpace(); |
686 | if(fileL.find("total",0,TRUE) == -1) { | 686 | if(fileL.find("total",0,TRUE) == -1) { |
687 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 687 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
688 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | 688 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
689 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 689 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
690 | // if(itemDir) | 690 | // if(itemDir) |
691 | item->moveItem(itemDir); | 691 | item->moveItem(itemDir); |
692 | itemDir=item; | 692 | itemDir=item; |
693 | } else { | 693 | } else { |
694 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); | 694 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
695 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 695 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
696 | // if(itemFile) | 696 | // if(itemFile) |
697 | item->moveItem(itemDir); | 697 | item->moveItem(itemDir); |
698 | item->moveItem(itemFile); | 698 | item->moveItem(itemFile); |
699 | itemFile=item; | 699 | itemFile=item; |
700 | } | 700 | } |
701 | } | 701 | } |
702 | } | 702 | } |
703 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 703 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
704 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 704 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
705 | file.close(); | 705 | file.close(); |
706 | if( file.exists()) | 706 | if( file.exists()) |
707 | file. remove(); | 707 | file. remove(); |
708 | } else | 708 | } else |
709 | qDebug("temp file not opened successfullly "+sfile); | 709 | qDebug("temp file not opened successfullly "+sfile); |
710 | Remote_View->setSorting( 4,TRUE); | 710 | Remote_View->setSorting( 4,TRUE); |
711 | return true; | 711 | return true; |
712 | } | 712 | } |
713 | 713 | ||
714 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 714 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
715 | { | 715 | { |
716 | if( selectedItem) { | 716 | if( selectedItem) { |
717 | // QCopEnvelope ( "QPE/System", "busy()" ); | 717 | // QCopEnvelope ( "QPE/System", "busy()" ); |
718 | QString oldRemoteCurrentDir = currentRemoteDir; | 718 | QString oldRemoteCurrentDir = currentRemoteDir; |
719 | QString strItem=selectedItem->text(0); | 719 | QString strItem=selectedItem->text(0); |
720 | strItem=strItem.simplifyWhiteSpace(); | 720 | strItem=strItem.simplifyWhiteSpace(); |
721 | if(strItem == "../") { // the user wants to go ^ | 721 | if(strItem == "../") { // the user wants to go ^ |
722 | if( FtpCDUp( conn) == 0) { | 722 | if( FtpCDUp( conn) == 0) { |
723 | QString msg; | 723 | QString msg; |
724 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 724 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
725 | msg.replace(QRegExp(":"),"\n"); | 725 | msg.replace(QRegExp(":"),"\n"); |
726 | QMessageBox::message(tr("Note"),msg); | 726 | QMessageBox::message(tr("Note"),msg); |
727 | // qDebug(msg); | 727 | // qDebug(msg); |
728 | } | 728 | } |
729 | char path[256]; | 729 | char path[256]; |
730 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 730 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
731 | QString msg; | 731 | QString msg; |
732 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 732 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
733 | msg.replace(QRegExp(":"),"\n"); | 733 | msg.replace(QRegExp(":"),"\n"); |
734 | QMessageBox::message(tr("Note"),msg); | 734 | QMessageBox::message(tr("Note"),msg); |
735 | // qDebug(msg); | 735 | // qDebug(msg); |
736 | } | 736 | } |
737 | currentRemoteDir=path; | 737 | currentRemoteDir=path; |
738 | } else { | 738 | } else { |
739 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers | 739 | if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers |
740 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); | 740 | strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); |
741 | strItem = strItem.stripWhiteSpace(); | 741 | strItem = strItem.stripWhiteSpace(); |