summaryrefslogtreecommitdiff
authorsimon <simon>2002-11-08 15:16:56 (UTC)
committer simon <simon>2002-11-08 15:16:56 (UTC)
commitc2d39953b626147400114dbde85d87bdf5081576 (patch) (unidiff)
tree137fdab93cbf9786d35a8060d0c1aebdfa552570
parent0850f627522ed8765ffd37dfa47dc3c40fd543be (diff)
downloadopie-c2d39953b626147400114dbde85d87bdf5081576.zip
opie-c2d39953b626147400114dbde85d87bdf5081576.tar.gz
opie-c2d39953b626147400114dbde85d87bdf5081576.tar.bz2
- for ( i; i <= numberOfEntries; i++) {
+ for ( ; i <= numberOfEntries; i++) {
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 3d97ecb..292cc9d 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -615,898 +615,898 @@ bool OpieFtp::remoteDirList(const QString &dir)
615// QCopEnvelope ( "QPE/System", "busy()" ); 615// QCopEnvelope ( "QPE/System", "busy()" );
616 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 616 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
617 QString msg; 617 QString msg;
618 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); 618 msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) );
619 msg.replace(QRegExp(":"),"\n"); 619 msg.replace(QRegExp(":"),"\n");
620 QMessageBox::message(tr("Note"),msg); 620 QMessageBox::message(tr("Note"),msg);
621 return false; 621 return false;
622 } 622 }
623 populateRemoteView() ; 623 populateRemoteView() ;
624// QCopEnvelope ( "QPE/System", "notBusy()" ); 624// QCopEnvelope ( "QPE/System", "notBusy()" );
625 return true; 625 return true;
626} 626}
627 627
628bool OpieFtp::remoteChDir(const QString &dir) 628bool OpieFtp::remoteChDir(const QString &dir)
629{ 629{
630// QCopEnvelope ( "QPE/System", "busy()" ); 630// QCopEnvelope ( "QPE/System", "busy()" );
631 if (!FtpChdir( dir.latin1(), conn )) { 631 if (!FtpChdir( dir.latin1(), conn )) {
632 QString msg; 632 QString msg;
633 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); 633 msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn));
634 msg.replace(QRegExp(":"),"\n"); 634 msg.replace(QRegExp(":"),"\n");
635 QMessageBox::message(tr("Note"),msg); 635 QMessageBox::message(tr("Note"),msg);
636// qDebug(msg); 636// qDebug(msg);
637// QCopEnvelope ( "QPE/System", "notBusy()" ); 637// QCopEnvelope ( "QPE/System", "notBusy()" );
638 return FALSE; 638 return FALSE;
639 } 639 }
640// QCopEnvelope ( "QPE/System", "notBusy()" ); 640// QCopEnvelope ( "QPE/System", "notBusy()" );
641 return TRUE; 641 return TRUE;
642} 642}
643 643
644void OpieFtp::populateLocalView() 644void OpieFtp::populateLocalView()
645{ 645{
646 Local_View->clear(); 646 Local_View->clear();
647 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 647 currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
648 currentDir.setMatchAllDirs(TRUE); 648 currentDir.setMatchAllDirs(TRUE);
649 currentDir.setNameFilter(filterStr); 649 currentDir.setNameFilter(filterStr);
650 QString fileL, fileS, fileDate; 650 QString fileL, fileS, fileDate;
651 bool isDir=FALSE; 651 bool isDir=FALSE;
652 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 652 const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
653 QFileInfoListIterator it(*list); 653 QFileInfoListIterator it(*list);
654 QFileInfo *fi; 654 QFileInfo *fi;
655 while ( (fi=it.current()) ) { 655 while ( (fi=it.current()) ) {
656 if (fi->isSymLink() ){ 656 if (fi->isSymLink() ){
657 QString symLink=fi->readLink(); 657 QString symLink=fi->readLink();
658// qDebug("Symlink detected "+symLink); 658// qDebug("Symlink detected "+symLink);
659 QFileInfo sym( symLink); 659 QFileInfo sym( symLink);
660 fileS.sprintf( "%10i", sym.size() ); 660 fileS.sprintf( "%10i", sym.size() );
661 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 661 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
662 fileDate = sym.lastModified().toString(); 662 fileDate = sym.lastModified().toString();
663 } else { 663 } else {
664// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 664// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
665 fileS.sprintf( "%10i", fi->size() ); 665 fileS.sprintf( "%10i", fi->size() );
666 fileL.sprintf( "%s",fi->fileName().data() ); 666 fileL.sprintf( "%s",fi->fileName().data() );
667 fileDate= fi->lastModified().toString(); 667 fileDate= fi->lastModified().toString();
668 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { 668 if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
669 fileL+="/"; 669 fileL+="/";
670 isDir=TRUE; 670 isDir=TRUE;
671// qDebug( fileL); 671// qDebug( fileL);
672 } 672 }
673 } 673 }
674 if(fileL !="./" && fi->exists()) { 674 if(fileL !="./" && fi->exists()) {
675 item = new QListViewItem( Local_View,fileL, fileDate, fileS ); 675 item = new QListViewItem( Local_View,fileL, fileDate, fileS );
676 QPixmap pm; 676 QPixmap pm;
677 677
678 if(isDir || fileL.find("/",0,TRUE) != -1) { 678 if(isDir || fileL.find("/",0,TRUE) != -1) {
679 if( !QDir( fi->filePath() ).isReadable()) 679 if( !QDir( fi->filePath() ).isReadable())
680 pm = Resource::loadPixmap( "lockedfolder" ); 680 pm = Resource::loadPixmap( "lockedfolder" );
681 else 681 else
682 pm= Resource::loadPixmap( "folder" ); 682 pm= Resource::loadPixmap( "folder" );
683 item->setPixmap( 0,pm ); 683 item->setPixmap( 0,pm );
684 } else { 684 } else {
685 if( !fi->isReadable() ) 685 if( !fi->isReadable() )
686 pm = Resource::loadPixmap( "locked" ); 686 pm = Resource::loadPixmap( "locked" );
687 else { 687 else {
688 MimeType mt(fi->filePath()); 688 MimeType mt(fi->filePath());
689 pm=mt.pixmap(); //sets the correct pixmap for mimetype 689 pm=mt.pixmap(); //sets the correct pixmap for mimetype
690 if(pm.isNull()) 690 if(pm.isNull())
691 pm = Resource::loadPixmap( "UnknownDocument-14" ); 691 pm = Resource::loadPixmap( "UnknownDocument-14" );
692 item->setPixmap( 0,pm); 692 item->setPixmap( 0,pm);
693 } 693 }
694 } 694 }
695 if( fileL.find("->",0,TRUE) != -1) { 695 if( fileL.find("->",0,TRUE) != -1) {
696 // overlay link image 696 // overlay link image
697 pm= Resource::loadPixmap( "folder" ); 697 pm= Resource::loadPixmap( "folder" );
698 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 698 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
699 QPainter painter( &pm ); 699 QPainter painter( &pm );
700 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 700 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
701 pm.setMask( pm.createHeuristicMask( FALSE ) ); 701 pm.setMask( pm.createHeuristicMask( FALSE ) );
702 item->setPixmap( 0, pm); 702 item->setPixmap( 0, pm);
703 } 703 }
704 } 704 }
705 isDir=FALSE; 705 isDir=FALSE;
706 ++it; 706 ++it;
707 } 707 }
708 Local_View->setSorting( 3,FALSE); 708 Local_View->setSorting( 3,FALSE);
709 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); 709 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() );
710 fillCombo( (const QString &)currentDir); 710 fillCombo( (const QString &)currentDir);
711} 711}
712 712
713bool OpieFtp::populateRemoteView( ) 713bool OpieFtp::populateRemoteView( )
714{ 714{
715// qDebug("populate remoteview"); 715// qDebug("populate remoteview");
716 QString sfile=QDir::homeDirPath(); 716 QString sfile=QDir::homeDirPath();
717 if(sfile.right(1) != "/") 717 if(sfile.right(1) != "/")
718 sfile+="/._temp"; 718 sfile+="/._temp";
719 else 719 else
720 sfile+="._temp"; 720 sfile+="._temp";
721 QFile file( sfile); 721 QFile file( sfile);
722 Remote_View->clear(); 722 Remote_View->clear();
723 QString s, File_Name; 723 QString s, File_Name;
724 QListViewItem *itemDir=NULL, *itemFile=NULL; 724 QListViewItem *itemDir=NULL, *itemFile=NULL;
725 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); 725 QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] ");
726 QString fileL, fileS, fileDate; 726 QString fileL, fileS, fileDate;
727 if ( file.open(IO_ReadOnly)) { 727 if ( file.open(IO_ReadOnly)) {
728 QTextStream t( &file ); // use a text stream 728 QTextStream t( &file ); // use a text stream
729 while ( !t.eof()) { 729 while ( !t.eof()) {
730 s = t.readLine(); 730 s = t.readLine();
731 731
732 if(s.find("total",0,TRUE) == 0) 732 if(s.find("total",0,TRUE) == 0)
733 continue; 733 continue;
734 734
735 int len, month = monthRe.match(s, 0, &len); 735 int len, month = monthRe.match(s, 0, &len);
736 fileDate = s.mid(month + 1, len - 2); // minus spaces 736 fileDate = s.mid(month + 1, len - 2); // minus spaces
737 fileL = s.right(s.length() - month - len); 737 fileL = s.right(s.length() - month - len);
738 if(s.left(1) == "d") 738 if(s.left(1) == "d")
739 fileL = fileL+"/"; 739 fileL = fileL+"/";
740 fileS = s.mid(month - 8, 8); // FIXME 740 fileS = s.mid(month - 8, 8); // FIXME
741 fileS = fileS.stripWhiteSpace(); 741 fileS = fileS.stripWhiteSpace();
742 742
743 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { 743 if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); 744 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d");
745 item->setPixmap( 0, Resource::loadPixmap( "folder" )); 745 item->setPixmap( 0, Resource::loadPixmap( "folder" ));
746// if(itemDir) 746// if(itemDir)
747 item->moveItem(itemDir); 747 item->moveItem(itemDir);
748 itemDir=item; 748 itemDir=item;
749 } else { 749 } else {
750 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); 750 QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f");
751 item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); 751 item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
752// if(itemFile) 752// if(itemFile)
753 item->moveItem(itemDir); 753 item->moveItem(itemDir);
754 item->moveItem(itemFile); 754 item->moveItem(itemFile);
755 itemFile=item; 755 itemFile=item;
756 } 756 }
757 } 757 }
758 QListViewItem * item1 = new QListViewItem( Remote_View, "../"); 758 QListViewItem * item1 = new QListViewItem( Remote_View, "../");
759 item1->setPixmap( 0, Resource::loadPixmap( "folder" )); 759 item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
760 file.close(); 760 file.close();
761 if( file.exists()) 761 if( file.exists())
762 file. remove(); 762 file. remove();
763 } else 763 } else
764 qDebug("temp file not opened successfullly "+sfile); 764 qDebug("temp file not opened successfullly "+sfile);
765 Remote_View->setSorting( 4,TRUE); 765 Remote_View->setSorting( 4,TRUE);
766 return true; 766 return true;
767} 767}
768 768
769void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 769void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
770{ 770{
771 if( selectedItem) { 771 if( selectedItem) {
772// QCopEnvelope ( "QPE/System", "busy()" ); 772// QCopEnvelope ( "QPE/System", "busy()" );
773 QString oldRemoteCurrentDir = currentRemoteDir; 773 QString oldRemoteCurrentDir = currentRemoteDir;
774 QString strItem=selectedItem->text(0); 774 QString strItem=selectedItem->text(0);
775 strItem=strItem.simplifyWhiteSpace(); 775 strItem=strItem.simplifyWhiteSpace();
776 if(strItem == "../") { // the user wants to go ^ 776 if(strItem == "../") { // the user wants to go ^
777 if( FtpCDUp( conn) == 0) { 777 if( FtpCDUp( conn) == 0) {
778 QString msg; 778 QString msg;
779 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 779 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
780 msg.replace(QRegExp(":"),"\n"); 780 msg.replace(QRegExp(":"),"\n");
781 QMessageBox::message(tr("Note"),msg); 781 QMessageBox::message(tr("Note"),msg);
782// qDebug(msg); 782// qDebug(msg);
783 } 783 }
784 char path[256]; 784 char path[256];
785 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 785 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
786 QString msg; 786 QString msg;
787 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 787 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
788 msg.replace(QRegExp(":"),"\n"); 788 msg.replace(QRegExp(":"),"\n");
789 QMessageBox::message(tr("Note"),msg); 789 QMessageBox::message(tr("Note"),msg);
790// qDebug(msg); 790// qDebug(msg);
791 } 791 }
792 currentRemoteDir=path; 792 currentRemoteDir=path;
793 } else { 793 } else {
794 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers 794 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
795 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); 795 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
796 strItem = strItem.stripWhiteSpace(); 796 strItem = strItem.stripWhiteSpace();
797 currentRemoteDir = strItem; 797 currentRemoteDir = strItem;
798 if( !remoteChDir( (const QString &)strItem)) { 798 if( !remoteChDir( (const QString &)strItem)) {
799 currentRemoteDir = oldRemoteCurrentDir; 799 currentRemoteDir = oldRemoteCurrentDir;
800 strItem=""; 800 strItem="";
801// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 801// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
802 } 802 }
803 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory 803 } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
804 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { 804 if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
805 currentRemoteDir = oldRemoteCurrentDir; 805 currentRemoteDir = oldRemoteCurrentDir;
806 strItem=""; 806 strItem="";
807// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); 807// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
808 808
809 } else { 809 } else {
810 currentRemoteDir = currentRemoteDir+strItem; 810 currentRemoteDir = currentRemoteDir+strItem;
811 } 811 }
812 } else { 812 } else {
813// QCopEnvelope ( "QPE/System", "notBusy()" ); 813// QCopEnvelope ( "QPE/System", "notBusy()" );
814 return; 814 return;
815 } 815 }
816 } 816 }
817 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 817 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
818 if(currentRemoteDir.right(1) !="/") 818 if(currentRemoteDir.right(1) !="/")
819 currentRemoteDir +="/"; 819 currentRemoteDir +="/";
820 currentPathCombo->lineEdit()->setText( currentRemoteDir); 820 currentPathCombo->lineEdit()->setText( currentRemoteDir);
821 fillRemoteCombo( (const QString &)currentRemoteDir); 821 fillRemoteCombo( (const QString &)currentRemoteDir);
822// QCopEnvelope ( "QPE/System", "notBusy()" ); 822// QCopEnvelope ( "QPE/System", "notBusy()" );
823 Remote_View->ensureItemVisible(Remote_View->firstChild()); 823 Remote_View->ensureItemVisible(Remote_View->firstChild());
824 824
825 } 825 }
826} 826}
827 827
828void OpieFtp::localListClicked(QListViewItem *selectedItem) 828void OpieFtp::localListClicked(QListViewItem *selectedItem)
829{ 829{
830 if(selectedItem!= NULL) { 830 if(selectedItem!= NULL) {
831 831
832 QString strItem=selectedItem->text(0); 832 QString strItem=selectedItem->text(0);
833 QString strSize=selectedItem->text(1); 833 QString strSize=selectedItem->text(1);
834 strSize=strSize.stripWhiteSpace(); 834 strSize=strSize.stripWhiteSpace();
835 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 835 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
836 // is symlink 836 // is symlink
837 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 837 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
838 if(QDir(strItem2).exists() ) { 838 if(QDir(strItem2).exists() ) {
839 currentDir.cd(strItem2, TRUE); 839 currentDir.cd(strItem2, TRUE);
840 populateLocalView(); 840 populateLocalView();
841 } 841 }
842 } else { // not a symlink 842 } else { // not a symlink
843 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 843 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
844 844
845 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 845 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
846 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 846 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
847 currentDir.cd(strItem,FALSE); 847 currentDir.cd(strItem,FALSE);
848 populateLocalView(); 848 populateLocalView();
849 } else { 849 } else {
850 currentDir.cdUp(); 850 currentDir.cdUp();
851 populateLocalView(); 851 populateLocalView();
852 } 852 }
853 if(QDir(strItem).exists()){ 853 if(QDir(strItem).exists()){
854 currentDir.cd(strItem, TRUE); 854 currentDir.cd(strItem, TRUE);
855 populateLocalView(); 855 populateLocalView();
856 } 856 }
857 } else { 857 } else {
858 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 858 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
859 if( QFile::exists(strItem ) ) { 859 if( QFile::exists(strItem ) ) {
860 // qDebug("upload "+strItem); 860 // qDebug("upload "+strItem);
861 return; 861 return;
862 } 862 }
863 } //end not symlink 863 } //end not symlink
864 chdir(strItem.latin1()); 864 chdir(strItem.latin1());
865 } 865 }
866 Local_View->ensureItemVisible(Local_View->firstChild()); 866 Local_View->ensureItemVisible(Local_View->firstChild());
867 } 867 }
868} 868}
869 869
870void OpieFtp::doLocalCd() 870void OpieFtp::doLocalCd()
871{ 871{
872 localListClicked( Local_View->currentItem()); 872 localListClicked( Local_View->currentItem());
873} 873}
874 874
875void OpieFtp:: doRemoteCd() 875void OpieFtp:: doRemoteCd()
876{ 876{
877 remoteListClicked( Remote_View->currentItem()); 877 remoteListClicked( Remote_View->currentItem());
878 878
879} 879}
880 880
881void OpieFtp::showHidden() 881void OpieFtp::showHidden()
882{ 882{
883 if (!b) { 883 if (!b) {
884 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 884 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
885 localMenu->setItemChecked(localMenu->idAt(0),TRUE); 885 localMenu->setItemChecked(localMenu->idAt(0),TRUE);
886// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 886// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
887 b=TRUE; 887 b=TRUE;
888 888
889 } else { 889 } else {
890 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 890 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
891 localMenu->setItemChecked(localMenu->idAt(0),FALSE); 891 localMenu->setItemChecked(localMenu->idAt(0),FALSE);
892// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 892// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
893 b=FALSE; 893 b=FALSE;
894 } 894 }
895 populateLocalView(); 895 populateLocalView();
896} 896}
897 897
898void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int) 898void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &, int)
899{ 899{
900// if(item) 900// if(item)
901 if (mouse == 2) { 901 if (mouse == 2) {
902 showLocalMenu(item); 902 showLocalMenu(item);
903 } 903 }
904} 904}
905 905
906void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int ) 906void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &, int )
907{ 907{
908 if(mouse == 2) { 908 if(mouse == 2) {
909 showRemoteMenu(item); 909 showRemoteMenu(item);
910 } 910 }
911} 911}
912 912
913void OpieFtp::showRemoteMenu(QListViewItem * item) 913void OpieFtp::showRemoteMenu(QListViewItem * item)
914{ 914{
915 QPopupMenu * m;// = new QPopupMenu( Local_View ); 915 QPopupMenu * m;// = new QPopupMenu( Local_View );
916 m = new QPopupMenu(this); 916 m = new QPopupMenu(this);
917 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) 917 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1)
918 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); 918 m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
919 else 919 else
920 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 920 m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
921 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 921 m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
922 m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() )); 922 m->insertItem( tr("Rescan"), this, SLOT( populateLocalView() ));
923 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 923 m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
924 m->insertSeparator(); 924 m->insertSeparator();
925 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 925 m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
926 m->exec( QCursor::pos() ); 926 m->exec( QCursor::pos() );
927 delete m; 927 delete m;
928} 928}
929 929
930void OpieFtp::showLocalMenu(QListViewItem * item) 930void OpieFtp::showLocalMenu(QListViewItem * item)
931{ 931{
932 932
933 QPopupMenu *m; 933 QPopupMenu *m;
934 m = new QPopupMenu( this); 934 m = new QPopupMenu( this);
935 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 935 m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
936 m->insertSeparator(); 936 m->insertSeparator();
937 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) 937 if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1)
938 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); 938 m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
939 else 939 else
940 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 940 m->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
941 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 941 m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
942 m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() )); 942 m->insertItem( tr("Rescan"), this, SLOT( populateRemoteView() ));
943 m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); 943 m->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
944 m->insertSeparator(); 944 m->insertSeparator();
945 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 945 m->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
946 m->setCheckable(TRUE); 946 m->setCheckable(TRUE);
947 if (b) 947 if (b)
948 m->setItemChecked(m->idAt(0),TRUE); 948 m->setItemChecked(m->idAt(0),TRUE);
949 else 949 else
950 m->setItemChecked(m->idAt(0),FALSE); 950 m->setItemChecked(m->idAt(0),FALSE);
951 951
952 m->exec( QCursor::pos() ); 952 m->exec( QCursor::pos() );
953 delete m; 953 delete m;
954} 954}
955 955
956void OpieFtp::localMakDir() 956void OpieFtp::localMakDir()
957{ 957{
958 InputDialog *fileDlg; 958 InputDialog *fileDlg;
959 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 959 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
960 fileDlg->exec(); 960 fileDlg->exec();
961 if( fileDlg->result() == 1 ) { 961 if( fileDlg->result() == 1 ) {
962 QString filename = fileDlg->LineEdit1->text(); 962 QString filename = fileDlg->LineEdit1->text();
963 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); 963 currentDir.mkdir( currentDir.canonicalPath()+"/"+filename);
964 } 964 }
965 populateLocalView(); 965 populateLocalView();
966} 966}
967 967
968void OpieFtp::localDelete() 968void OpieFtp::localDelete()
969{ 969{
970 QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 970 QList<QListViewItem> * getSelectedItems( QListView * Local_View );
971 QListViewItemIterator it( Local_View ); 971 QListViewItemIterator it( Local_View );
972 for ( ; it.current(); ++it ) { 972 for ( ; it.current(); ++it ) {
973 if ( it.current()->isSelected() ) { 973 if ( it.current()->isSelected() ) {
974 QString f = it.current()->text(0); 974 QString f = it.current()->text(0);
975 it.current()->setSelected(FALSE); 975 it.current()->setSelected(FALSE);
976 976
977// QString f = Local_View->currentItem()->text(0); 977// QString f = Local_View->currentItem()->text(0);
978 if(QDir(f).exists() ) { 978 if(QDir(f).exists() ) {
979 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ 979 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+
980 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { 980 tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) {
981 case 0: { 981 case 0: {
982 f=currentDir.canonicalPath()+"/"+f; 982 f=currentDir.canonicalPath()+"/"+f;
983 QString cmd="rmdir "+f; 983 QString cmd="rmdir "+f;
984 system( cmd.latin1()); 984 system( cmd.latin1());
985 } 985 }
986 break; 986 break;
987 case 1: 987 case 1:
988 // exit 988 // exit
989 break; 989 break;
990 }; 990 };
991 991
992 } else { 992 } else {
993 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f 993 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
994 +" ?",tr("Yes"),tr("No"),0,0,1) ) { 994 +" ?",tr("Yes"),tr("No"),0,0,1) ) {
995 case 0: { 995 case 0: {
996 f=currentDir.canonicalPath()+"/"+f; 996 f=currentDir.canonicalPath()+"/"+f;
997 QString cmd="rm "+f; 997 QString cmd="rm "+f;
998 system( cmd.latin1()); 998 system( cmd.latin1());
999 } 999 }
1000 break; 1000 break;
1001 case 1: 1001 case 1:
1002 // exit 1002 // exit
1003 break; 1003 break;
1004 }; 1004 };
1005 } 1005 }
1006 } 1006 }
1007 } 1007 }
1008 populateLocalView(); 1008 populateLocalView();
1009 1009
1010} 1010}
1011 1011
1012void OpieFtp::remoteMakDir() 1012void OpieFtp::remoteMakDir()
1013{ 1013{
1014 InputDialog *fileDlg; 1014 InputDialog *fileDlg;
1015 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); 1015 fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
1016 fileDlg->exec(); 1016 fileDlg->exec();
1017 if( fileDlg->result() == 1 ) { 1017 if( fileDlg->result() == 1 ) {
1018 QString filename = fileDlg->LineEdit1->text();//+".playlist"; 1018 QString filename = fileDlg->LineEdit1->text();//+".playlist";
1019 QString tmp=currentRemoteDir+filename; 1019 QString tmp=currentRemoteDir+filename;
1020// QCopEnvelope ( "QPE/System", "busy()" ); 1020// QCopEnvelope ( "QPE/System", "busy()" );
1021 if(FtpMkdir( tmp.latin1(), conn) == 0) { 1021 if(FtpMkdir( tmp.latin1(), conn) == 0) {
1022 QString msg; 1022 QString msg;
1023 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); 1023 msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn));
1024 msg.replace(QRegExp(":"),"\n"); 1024 msg.replace(QRegExp(":"),"\n");
1025 QMessageBox::message(tr("Note"),msg); 1025 QMessageBox::message(tr("Note"),msg);
1026 } 1026 }
1027// QCopEnvelope ( "QPE/System", "notBusy()" ); 1027// QCopEnvelope ( "QPE/System", "notBusy()" );
1028 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1028 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1029 } 1029 }
1030} 1030}
1031 1031
1032void OpieFtp::remoteDelete() 1032void OpieFtp::remoteDelete()
1033{ 1033{
1034 QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); 1034 QList<QListViewItem> * getSelectedItems( QListView * Remote_View );
1035 QListViewItemIterator it( Remote_View ); 1035 QListViewItemIterator it( Remote_View );
1036 for ( ; it.current(); ++it ) { 1036 for ( ; it.current(); ++it ) {
1037 if ( it.current()->isSelected() ) { 1037 if ( it.current()->isSelected() ) {
1038 QString f = it.current()->text(0); 1038 QString f = it.current()->text(0);
1039// QString f = Remote_View->currentItem()->text(0); 1039// QString f = Remote_View->currentItem()->text(0);
1040// QCopEnvelope ( "QPE/System", "busy()" ); 1040// QCopEnvelope ( "QPE/System", "busy()" );
1041 if( f.right(1) =="/") { 1041 if( f.right(1) =="/") {
1042 QString path= currentRemoteDir+f; 1042 QString path= currentRemoteDir+f;
1043 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" 1043 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
1044 ,tr("Yes"),tr("No"),0,0,1) ) { 1044 ,tr("Yes"),tr("No"),0,0,1) ) {
1045 case 0: { 1045 case 0: {
1046 f=currentDir.canonicalPath()+"/"+f; 1046 f=currentDir.canonicalPath()+"/"+f;
1047 if(FtpRmdir( path.latin1(), conn) ==0) { 1047 if(FtpRmdir( path.latin1(), conn) ==0) {
1048 QString msg; 1048 QString msg;
1049 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); 1049 msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn));
1050 msg.replace(QRegExp(":"),"\n"); 1050 msg.replace(QRegExp(":"),"\n");
1051 QMessageBox::message(tr("Note"),msg); 1051 QMessageBox::message(tr("Note"),msg);
1052 } 1052 }
1053 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1053 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1054 } 1054 }
1055 break; 1055 break;
1056 }; 1056 };
1057 } else { 1057 } else {
1058 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" 1058 switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?"
1059 ,tr("Yes"),tr("No"),0,0,1) ) { 1059 ,tr("Yes"),tr("No"),0,0,1) ) {
1060 case 0: { 1060 case 0: {
1061 QString path= currentRemoteDir+f; 1061 QString path= currentRemoteDir+f;
1062 if(FtpDelete( path.latin1(), conn)==0) { 1062 if(FtpDelete( path.latin1(), conn)==0) {
1063 QString msg; 1063 QString msg;
1064 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); 1064 msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn));
1065 msg.replace(QRegExp(":"),"\n"); 1065 msg.replace(QRegExp(":"),"\n");
1066 QMessageBox::message(tr("Note"),msg); 1066 QMessageBox::message(tr("Note"),msg);
1067 } 1067 }
1068 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1068 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1069 } 1069 }
1070 break; 1070 break;
1071 }; 1071 };
1072 } 1072 }
1073 } 1073 }
1074 } 1074 }
1075// QCopEnvelope ( "QPE/System", "notBusy()" ); 1075// QCopEnvelope ( "QPE/System", "notBusy()" );
1076} 1076}
1077 1077
1078void OpieFtp::remoteRename() 1078void OpieFtp::remoteRename()
1079{ 1079{
1080 QString curFile = Remote_View->currentItem()->text(0); 1080 QString curFile = Remote_View->currentItem()->text(0);
1081 InputDialog *fileDlg; 1081 InputDialog *fileDlg;
1082 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1082 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1083 fileDlg->setTextEdit((const QString &)curFile); 1083 fileDlg->setTextEdit((const QString &)curFile);
1084 fileDlg->exec(); 1084 fileDlg->exec();
1085 if( fileDlg->result() == 1 ) { 1085 if( fileDlg->result() == 1 ) {
1086 QString oldName = currentRemoteDir +"/"+ curFile; 1086 QString oldName = currentRemoteDir +"/"+ curFile;
1087 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 1087 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
1088// QCopEnvelope ( "QPE/System", "busy()" ); 1088// QCopEnvelope ( "QPE/System", "busy()" );
1089 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 1089 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
1090 QString msg; 1090 QString msg;
1091 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); 1091 msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn));
1092 msg.replace(QRegExp(":"),"\n"); 1092 msg.replace(QRegExp(":"),"\n");
1093 QMessageBox::message(tr("Note"),msg); 1093 QMessageBox::message(tr("Note"),msg);
1094 } 1094 }
1095// QCopEnvelope ( "QPE/System", "notBusy()" ); 1095// QCopEnvelope ( "QPE/System", "notBusy()" );
1096 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1096 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1097 } 1097 }
1098} 1098}
1099 1099
1100void OpieFtp::localRename() 1100void OpieFtp::localRename()
1101{ 1101{
1102 QString curFile = Local_View->currentItem()->text(0); 1102 QString curFile = Local_View->currentItem()->text(0);
1103 InputDialog *fileDlg; 1103 InputDialog *fileDlg;
1104 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 1104 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
1105 fileDlg->setTextEdit((const QString &)curFile); 1105 fileDlg->setTextEdit((const QString &)curFile);
1106 fileDlg->exec(); 1106 fileDlg->exec();
1107 if( fileDlg->result() == 1 ) { 1107 if( fileDlg->result() == 1 ) {
1108 QString oldname = currentDir.canonicalPath() + "/" + curFile; 1108 QString oldname = currentDir.canonicalPath() + "/" + curFile;
1109 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 1109 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
1110 if( rename(oldname.latin1(), newName.latin1())== -1) 1110 if( rename(oldname.latin1(), newName.latin1())== -1)
1111 QMessageBox::message(tr("Note"),tr("Could not rename")); 1111 QMessageBox::message(tr("Note"),tr("Could not rename"));
1112 } 1112 }
1113 populateLocalView(); 1113 populateLocalView();
1114} 1114}
1115 1115
1116void OpieFtp::currentPathComboActivated(const QString & currentPath) { 1116void OpieFtp::currentPathComboActivated(const QString & currentPath) {
1117 if (TabWidget->currentPageIndex() == 0) { 1117 if (TabWidget->currentPageIndex() == 0) {
1118 chdir( currentPath.latin1() ); 1118 chdir( currentPath.latin1() );
1119 currentDir.cd( currentPath, TRUE); 1119 currentDir.cd( currentPath, TRUE);
1120 populateLocalView(); 1120 populateLocalView();
1121 update(); 1121 update();
1122 } else { 1122 } else {
1123// chdir( currentPath.latin1() ); 1123// chdir( currentPath.latin1() );
1124// currentDir.cd( currentPath, TRUE); 1124// currentDir.cd( currentPath, TRUE);
1125// populateList(); 1125// populateList();
1126// update(); 1126// update();
1127 1127
1128 } 1128 }
1129} 1129}
1130 1130
1131void OpieFtp::fillCombo(const QString &currentPath) { 1131void OpieFtp::fillCombo(const QString &currentPath) {
1132 1132
1133 currentPathCombo->lineEdit()->setText(currentPath); 1133 currentPathCombo->lineEdit()->setText(currentPath);
1134 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1134 if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1135 currentPathCombo->clear(); 1135 currentPathCombo->clear();
1136 localDirPathStringList.prepend(currentPath ); 1136 localDirPathStringList.prepend(currentPath );
1137 currentPathCombo->insertStringList( localDirPathStringList,-1); 1137 currentPathCombo->insertStringList( localDirPathStringList,-1);
1138 } 1138 }
1139 currentPathCombo->lineEdit()->setText(currentPath); 1139 currentPathCombo->lineEdit()->setText(currentPath);
1140 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1140 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1141 currentPathCombo->clear(); 1141 currentPathCombo->clear();
1142 remoteDirPathStringList.prepend(currentPath ); 1142 remoteDirPathStringList.prepend(currentPath );
1143 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1143 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1144 } 1144 }
1145} 1145}
1146 1146
1147void OpieFtp::fillRemoteCombo(const QString &currentPath) { 1147void OpieFtp::fillRemoteCombo(const QString &currentPath) {
1148 1148
1149 currentPathCombo->lineEdit()->setText(currentPath); 1149 currentPathCombo->lineEdit()->setText(currentPath);
1150 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { 1150 if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
1151 currentPathCombo->clear(); 1151 currentPathCombo->clear();
1152 remoteDirPathStringList.prepend(currentPath ); 1152 remoteDirPathStringList.prepend(currentPath );
1153 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 1153 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
1154 } 1154 }
1155} 1155}
1156 1156
1157void OpieFtp::currentPathComboChanged() 1157void OpieFtp::currentPathComboChanged()
1158{ 1158{
1159 QString oldRemoteCurrentDir = currentRemoteDir; 1159 QString oldRemoteCurrentDir = currentRemoteDir;
1160// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); 1160// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
1161 if (TabWidget->currentPageIndex() == 0) { 1161 if (TabWidget->currentPageIndex() == 0) {
1162 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 1162 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
1163 currentDir.setPath( currentPathCombo->lineEdit()->text() ); 1163 currentDir.setPath( currentPathCombo->lineEdit()->text() );
1164 populateLocalView(); 1164 populateLocalView();
1165 } else { 1165 } else {
1166 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 1166 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
1167 } 1167 }
1168 } 1168 }
1169 if (TabWidget->currentPageIndex() == 1) { 1169 if (TabWidget->currentPageIndex() == 1) {
1170 currentRemoteDir = currentPathCombo->lineEdit()->text(); 1170 currentRemoteDir = currentPathCombo->lineEdit()->text();
1171 if(currentRemoteDir.right(1) !="/") { 1171 if(currentRemoteDir.right(1) !="/") {
1172 currentRemoteDir = currentRemoteDir +"/"; 1172 currentRemoteDir = currentRemoteDir +"/";
1173 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1173 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1174 } 1174 }
1175 if( !remoteChDir( (const QString &)currentRemoteDir) ) { 1175 if( !remoteChDir( (const QString &)currentRemoteDir) ) {
1176 currentRemoteDir = oldRemoteCurrentDir; 1176 currentRemoteDir = oldRemoteCurrentDir;
1177 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 1177 currentPathCombo->lineEdit()->setText( currentRemoteDir );
1178 } 1178 }
1179 1179
1180 remoteDirList( (const QString &)currentRemoteDir); 1180 remoteDirList( (const QString &)currentRemoteDir);
1181 } 1181 }
1182} 1182}
1183 1183
1184void OpieFtp::switchToLocalTab() 1184void OpieFtp::switchToLocalTab()
1185{ 1185{
1186 TabWidget->setCurrentPage(0); 1186 TabWidget->setCurrentPage(0);
1187} 1187}
1188 1188
1189void OpieFtp::switchToRemoteTab() 1189void OpieFtp::switchToRemoteTab()
1190{ 1190{
1191 TabWidget->setCurrentPage(1); 1191 TabWidget->setCurrentPage(1);
1192} 1192}
1193 1193
1194void OpieFtp::switchToConfigTab() 1194void OpieFtp::switchToConfigTab()
1195{ 1195{
1196 TabWidget->setCurrentPage(2); 1196 TabWidget->setCurrentPage(2);
1197} 1197}
1198 1198
1199void OpieFtp::readConfig() 1199void OpieFtp::readConfig()
1200{ 1200{
1201 fillCombos(); 1201 fillCombos();
1202 Config cfg("opieftp"); 1202 Config cfg("opieftp");
1203 cfg.setGroup("Server"); 1203 cfg.setGroup("Server");
1204 currentServerConfig = cfg.readNumEntry("currentServer", -1); 1204 currentServerConfig = cfg.readNumEntry("currentServer", -1);
1205 1205
1206// qDebug("Reading %d", currentServerConfig); 1206// qDebug("Reading %d", currentServerConfig);
1207 serverComboSelected( currentServerConfig-1); 1207 serverComboSelected( currentServerConfig-1);
1208 1208
1209} 1209}
1210 1210
1211void OpieFtp::writeConfig() 1211void OpieFtp::writeConfig()
1212{ 1212{
1213 qDebug("write config"); 1213 qDebug("write config");
1214 Config cfg("opieftp"); 1214 Config cfg("opieftp");
1215 cfg.setGroup("Server"); 1215 cfg.setGroup("Server");
1216 1216
1217 QString username, remoteServerStr, remotePathStr, password, port, temp; 1217 QString username, remoteServerStr, remotePathStr, password, port, temp;
1218 1218
1219 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1219 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1220 1220
1221 if( currentServerConfig == -1) { 1221 if( currentServerConfig == -1) {
1222 1222
1223 for (int i = 1; i <= numberOfEntries; i++) { 1223 for (int i = 1; i <= numberOfEntries; i++) {
1224 temp.setNum(i); 1224 temp.setNum(i);
1225 cfg.setGroup("Server"); 1225 cfg.setGroup("Server");
1226 QString tempStr = cfg.readEntry( temp,""); 1226 QString tempStr = cfg.readEntry( temp,"");
1227 } 1227 }
1228 1228
1229 temp.setNum( numberOfEntries + 1); 1229 temp.setNum( numberOfEntries + 1);
1230 cfg.setGroup("Server"); 1230 cfg.setGroup("Server");
1231 1231
1232 remoteServerStr = cfg.readEntry( temp,""); 1232 remoteServerStr = cfg.readEntry( temp,"");
1233 1233
1234 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1234 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1235 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1235 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1236 1236
1237 temp.setNum(numberOfEntries+1); 1237 temp.setNum(numberOfEntries+1);
1238 cfg.setGroup("Server"); 1238 cfg.setGroup("Server");
1239 1239
1240 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); 1240 cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() );
1241 cfg.writeEntry("currentServer", numberOfEntries+1); 1241 cfg.writeEntry("currentServer", numberOfEntries+1);
1242 1242
1243 currentServerConfig = numberOfEntries+1; 1243 currentServerConfig = numberOfEntries+1;
1244 qDebug("setting currentserverconfig to %d", currentServerConfig); 1244 qDebug("setting currentserverconfig to %d", currentServerConfig);
1245 1245
1246 cfg.setGroup(temp); 1246 cfg.setGroup(temp);
1247 if(!newServerName.isEmpty()) 1247 if(!newServerName.isEmpty())
1248 cfg.writeEntry("ServerName", newServerName); 1248 cfg.writeEntry("ServerName", newServerName);
1249 1249
1250 cfg.writeEntry("RemotePath", remotePath->text()); 1250 cfg.writeEntry("RemotePath", remotePath->text());
1251 1251
1252 cfg.writeEntry("Username", UsernameComboBox->currentText()); 1252 cfg.writeEntry("Username", UsernameComboBox->currentText());
1253 1253
1254 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); 1254 cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text());
1255 cfg.setGroup("Server"); 1255 cfg.setGroup("Server");
1256 1256
1257 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); 1257 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 ));
1258 1258
1259 } 1259 }
1260} 1260}
1261 1261
1262void OpieFtp::clearCombos() { 1262void OpieFtp::clearCombos() {
1263 qDebug("clearing"); 1263 qDebug("clearing");
1264 ServerComboBox->clear(); 1264 ServerComboBox->clear();
1265 UsernameComboBox->clear(); 1265 UsernameComboBox->clear();
1266 PasswordEdit->clear(); 1266 PasswordEdit->clear();
1267 serverListView->clear(); 1267 serverListView->clear();
1268} 1268}
1269 1269
1270 1270
1271void OpieFtp::fillCombos() 1271void OpieFtp::fillCombos()
1272{ 1272{
1273 clearCombos(); 1273 clearCombos();
1274 1274
1275 Config cfg("opieftp"); 1275 Config cfg("opieftp");
1276 cfg.setGroup("Server"); 1276 cfg.setGroup("Server");
1277 QString username, remoteServerStr, remotePathStr, password, port, temp; 1277 QString username, remoteServerStr, remotePathStr, password, port, temp;
1278 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1278 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1279 1279
1280 for (int i = 1; i <= numberOfEntries; i++) { 1280 for (int i = 1; i <= numberOfEntries; i++) {
1281 temp.setNum(i); 1281 temp.setNum(i);
1282 qDebug(temp); 1282 qDebug(temp);
1283 cfg.setGroup("Server"); 1283 cfg.setGroup("Server");
1284 remoteServerStr = cfg.readEntry( temp,""); 1284 remoteServerStr = cfg.readEntry( temp,"");
1285 qDebug( remoteServerStr); 1285 qDebug( remoteServerStr);
1286 1286
1287 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1287 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1288 port = remoteServerStr.right( divider - 1); 1288 port = remoteServerStr.right( divider - 1);
1289 bool ok; 1289 bool ok;
1290 PortSpinBox->setValue( port.toInt(&ok,10)); 1290 PortSpinBox->setValue( port.toInt(&ok,10));
1291 1291
1292 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); 1292 remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
1293 qDebug( "remote server string "+remoteServerStr); 1293 qDebug( "remote server string "+remoteServerStr);
1294 ServerComboBox->insertItem( remoteServerStr ); 1294 ServerComboBox->insertItem( remoteServerStr );
1295 1295
1296 cfg.setGroup(temp); 1296 cfg.setGroup(temp);
1297 1297
1298 username = cfg.readEntry(temp); 1298 username = cfg.readEntry(temp);
1299 UsernameComboBox->insertItem(username); 1299 UsernameComboBox->insertItem(username);
1300 password = cfg.readEntryCrypt(username,""); 1300 password = cfg.readEntryCrypt(username,"");
1301 PasswordEdit->setText(password); 1301 PasswordEdit->setText(password);
1302 1302
1303 serverListView->insertItem( cfg.readEntry("ServerName")); 1303 serverListView->insertItem( cfg.readEntry("ServerName"));
1304 } 1304 }
1305} 1305}
1306 1306
1307 1307
1308void OpieFtp::serverComboSelected(int index) 1308void OpieFtp::serverComboSelected(int index)
1309{ 1309{
1310 currentServerConfig = index+1; 1310 currentServerConfig = index+1;
1311 qDebug("server combo selected %d", index+1); 1311 qDebug("server combo selected %d", index+1);
1312 QString username, remoteServerStr, remotePathStr, password, port, temp; 1312 QString username, remoteServerStr, remotePathStr, password, port, temp;
1313// remoteServerStr = ServerComboBox->text(index); 1313// remoteServerStr = ServerComboBox->text(index);
1314 1314
1315 Config cfg("opieftp"); 1315 Config cfg("opieftp");
1316 cfg.setGroup("Server"); 1316 cfg.setGroup("Server");
1317// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1317// int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1318 1318
1319 temp.setNum(index+1); 1319 temp.setNum(index+1);
1320 remoteServerStr = cfg.readEntry( temp,""); 1320 remoteServerStr = cfg.readEntry( temp,"");
1321 1321
1322 qDebug("Group" +temp); 1322 qDebug("Group" +temp);
1323 cfg.setGroup(temp); 1323 cfg.setGroup(temp);
1324// qDebug(temp); 1324// qDebug(temp);
1325 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); 1325 int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
1326 port = remoteServerStr.right( divider - 1); 1326 port = remoteServerStr.right( divider - 1);
1327 bool ok; 1327 bool ok;
1328 int portInt = port.toInt(&ok,10); 1328 int portInt = port.toInt(&ok,10);
1329 if( portInt == 0) portInt = 21; 1329 if( portInt == 0) portInt = 21;
1330 1330
1331 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); 1331 ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE)));
1332 1332
1333 PortSpinBox->setValue( portInt); 1333 PortSpinBox->setValue( portInt);
1334 1334
1335 remotePath->setText(cfg.readEntry("RemotePath", "/")); 1335 remotePath->setText(cfg.readEntry("RemotePath", "/"));
1336 1336
1337 username = cfg.readEntry("Username", "anonymous"); 1337 username = cfg.readEntry("Username", "anonymous");
1338 UsernameComboBox->lineEdit()->setText(username); 1338 UsernameComboBox->lineEdit()->setText(username);
1339 qDebug(username); 1339 qDebug(username);
1340// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); 1340// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
1341 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); 1341 PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
1342// UsernameComboBox 1342// UsernameComboBox
1343// PasswordEdit 1343// PasswordEdit
1344 1344
1345 cfg.setGroup("Server"); 1345 cfg.setGroup("Server");
1346 temp.sprintf("%d",currentServerConfig); 1346 temp.sprintf("%d",currentServerConfig);
1347 cfg.writeEntry("currentServer", temp); 1347 cfg.writeEntry("currentServer", temp);
1348 1348
1349 fuckeduphack = TRUE; 1349 fuckeduphack = TRUE;
1350 serverListView->setCurrentItem( index); 1350 serverListView->setCurrentItem( index);
1351 fuckeduphack=FALSE; 1351 fuckeduphack=FALSE;
1352 qDebug("server list set selected %d",index); 1352 qDebug("server list set selected %d",index);
1353 update(); 1353 update();
1354} 1354}
1355 1355
1356void OpieFtp::deleteServer() 1356void OpieFtp::deleteServer()
1357{ 1357{
1358 QString username, remoteServerStr, remotePathStr, password, port, temp, servername; 1358 QString username, remoteServerStr, remotePathStr, password, port, temp, servername;
1359 remoteServerStr = ServerComboBox->currentText( ); 1359 remoteServerStr = ServerComboBox->currentText( );
1360 username = UsernameComboBox->currentText(); 1360 username = UsernameComboBox->currentText();
1361 servername=serverListView->currentText(); 1361 servername=serverListView->currentText();
1362 1362
1363 Config cfg("opieftp"); 1363 Config cfg("opieftp");
1364 cfg.setGroup("Server"); 1364 cfg.setGroup("Server");
1365 QString tempname; 1365 QString tempname;
1366 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1366 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1367 1367
1368 for (int i = 1; i <= numberOfEntries; i++) { 1368 for (int i = 1; i <= numberOfEntries; i++) {
1369 temp.setNum(i); 1369 temp.setNum(i);
1370// cfg.setGroup("Server"); 1370// cfg.setGroup("Server");
1371 cfg.setGroup(QString::number(i)); 1371 cfg.setGroup(QString::number(i));
1372 tempname=cfg.readEntry( "ServerName",""); 1372 tempname=cfg.readEntry( "ServerName","");
1373 1373
1374 if( tempname.find( servername,0,TRUE) != -1 ) { 1374 if( tempname.find( servername,0,TRUE) != -1 ) {
1375// servername.find( cfg.readEntry("ServerName")) != -1 && 1375// servername.find( cfg.readEntry("ServerName")) != -1 &&
1376// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && 1376// remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 &&
1377// username.find( cfg.readEntry("Username")) != -1) { 1377// username.find( cfg.readEntry("Username")) != -1) {
1378 1378
1379 serverListView->removeItem(i); 1379 serverListView->removeItem(i);
1380 1380
1381 qDebug("OK DELETE "+tempname); 1381 qDebug("OK DELETE "+tempname);
1382 cfg.removeEntry(QString::number(i)); 1382 cfg.removeEntry(QString::number(i));
1383 for ( i; i <= numberOfEntries; i++) { 1383 for ( ; i <= numberOfEntries; i++) {
1384 cfg.setGroup("Server"); 1384 cfg.setGroup("Server");
1385 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); 1385 cfg.writeEntry("Server", QString::number(numberOfEntries + 1 ));
1386 1386
1387 cfg.setGroup(QString::number(i+1)); //get next server config 1387 cfg.setGroup(QString::number(i+1)); //get next server config
1388 servername=cfg.readEntry("ServerName"); 1388 servername=cfg.readEntry("ServerName");
1389 remoteServerStr=cfg.readEntry("RemotePath"); 1389 remoteServerStr=cfg.readEntry("RemotePath");
1390 username=cfg.readEntry("Username"); 1390 username=cfg.readEntry("Username");
1391 password=cfg.readEntryCrypt( username); 1391 password=cfg.readEntryCrypt( username);
1392 1392
1393 cfg.setGroup(QString::number(i)); 1393 cfg.setGroup(QString::number(i));
1394 1394
1395 cfg.writeEntry("RemotePath", remoteServerStr); 1395 cfg.writeEntry("RemotePath", remoteServerStr);
1396 cfg.writeEntry("ServerName", servername); 1396 cfg.writeEntry("ServerName", servername);
1397 cfg.writeEntry("Username", username); 1397 cfg.writeEntry("Username", username);
1398 cfg.writeEntryCrypt( username, password); 1398 cfg.writeEntryCrypt( username, password);
1399 1399
1400 } 1400 }
1401 cfg.setGroup("Server"); 1401 cfg.setGroup("Server");
1402 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 )); 1402 cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 ));
1403 } 1403 }
1404 } 1404 }
1405 cfg.setGroup(QString::number(numberOfEntries)); 1405 cfg.setGroup(QString::number(numberOfEntries));
1406 cfg.removeEntry("Server"); 1406 cfg.removeEntry("Server");
1407 cfg.removeEntry("RemotePath"); 1407 cfg.removeEntry("RemotePath");
1408 cfg.removeEntry("ServerName"); 1408 cfg.removeEntry("ServerName");
1409 username=cfg.readEntry("Username"); 1409 username=cfg.readEntry("Username");
1410 cfg.removeEntry("Username"); 1410 cfg.removeEntry("Username");
1411 cfg.removeEntry(username); 1411 cfg.removeEntry(username);
1412 1412
1413 currentServerConfig=currentServerConfig-1; 1413 currentServerConfig=currentServerConfig-1;
1414 1414
1415 fillCombos(); 1415 fillCombos();
1416 update(); 1416 update();
1417} 1417}
1418 1418
1419void OpieFtp::upDir() 1419void OpieFtp::upDir()
1420{ 1420{
1421 if (TabWidget->currentPageIndex() == 0) { 1421 if (TabWidget->currentPageIndex() == 0) {
1422 QString current = currentDir.canonicalPath(); 1422 QString current = currentDir.canonicalPath();
1423 QDir dir(current); 1423 QDir dir(current);
1424 dir.cdUp(); 1424 dir.cdUp();
1425 current = dir.canonicalPath(); 1425 current = dir.canonicalPath();
1426 chdir( current.latin1() ); 1426 chdir( current.latin1() );
1427 currentDir.cd( current, TRUE); 1427 currentDir.cd( current, TRUE);
1428 populateLocalView(); 1428 populateLocalView();
1429 update(); 1429 update();
1430 } else { 1430 } else {
1431 if( FtpCDUp( conn) == 0) { 1431 if( FtpCDUp( conn) == 0) {
1432 QString msg; 1432 QString msg;
1433 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); 1433 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
1434 msg.replace(QRegExp(":"),"\n"); 1434 msg.replace(QRegExp(":"),"\n");
1435 QMessageBox::message(tr("Note"),msg); 1435 QMessageBox::message(tr("Note"),msg);
1436// qDebug(msg); 1436// qDebug(msg);
1437 } 1437 }
1438 char path[256]; 1438 char path[256];
1439 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string 1439 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
1440 QString msg; 1440 QString msg;
1441 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); 1441 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
1442 msg.replace(QRegExp(":"),"\n"); 1442 msg.replace(QRegExp(":"),"\n");
1443 QMessageBox::message(tr("Note"),msg); 1443 QMessageBox::message(tr("Note"),msg);
1444// qDebug(msg); 1444// qDebug(msg);
1445 } 1445 }
1446 currentRemoteDir=path; 1446 currentRemoteDir=path;
1447 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1447 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1448 if(currentRemoteDir.right(1) !="/") 1448 if(currentRemoteDir.right(1) !="/")
1449 currentRemoteDir +="/"; 1449 currentRemoteDir +="/";
1450 currentPathCombo->lineEdit()->setText( currentRemoteDir); 1450 currentPathCombo->lineEdit()->setText( currentRemoteDir);
1451 fillRemoteCombo( (const QString &)currentRemoteDir); 1451 fillRemoteCombo( (const QString &)currentRemoteDir);
1452 1452
1453 } 1453 }
1454} 1454}
1455 1455
1456void OpieFtp::docButtonPushed() { 1456void OpieFtp::docButtonPushed() {
1457 QString current = QPEApplication::documentDir(); 1457 QString current = QPEApplication::documentDir();
1458 chdir( current.latin1() ); 1458 chdir( current.latin1() );
1459 currentDir.cd( current, TRUE); 1459 currentDir.cd( current, TRUE);
1460 populateLocalView(); 1460 populateLocalView();
1461 update(); 1461 update();
1462 1462
1463} 1463}
1464 1464
1465void OpieFtp::homeButtonPushed() { 1465void OpieFtp::homeButtonPushed() {
1466 QString current = QDir::homeDirPath(); 1466 QString current = QDir::homeDirPath();
1467 chdir( current.latin1() ); 1467 chdir( current.latin1() );
1468 currentDir.cd( current, TRUE); 1468 currentDir.cd( current, TRUE);
1469 populateLocalView(); 1469 populateLocalView();
1470 update(); 1470 update();
1471} 1471}
1472 1472
1473void OpieFtp::doAbout() { 1473void OpieFtp::doAbout() {
1474 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" 1474 QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n"
1475 "L.J.Potter<llornkcor@handhelds.org>\n" 1475 "L.J.Potter<llornkcor@handhelds.org>\n"
1476 "and uses ftplib copyright 1996-2000\n" 1476 "and uses ftplib copyright 1996-2000\n"
1477 "by Thomas Pfau, pfau@cnj.digex.net\n\n" 1477 "by Thomas Pfau, pfau@cnj.digex.net\n\n"
1478 "and is licensed by the GPL"); 1478 "and is licensed by the GPL");
1479} 1479}
1480 1480
1481void OpieFtp::NewServer() { 1481void OpieFtp::NewServer() {
1482 InputDialog *fileDlg; 1482 InputDialog *fileDlg;
1483 fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0); 1483 fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0);
1484 fileDlg->exec(); 1484 fileDlg->exec();
1485 Config cfg("opieftp"); 1485 Config cfg("opieftp");
1486 if( fileDlg->result() == 1 ) { 1486 if( fileDlg->result() == 1 ) {
1487 newServerName = fileDlg->LineEdit1->text(); 1487 newServerName = fileDlg->LineEdit1->text();
1488 for(int i=1;i<serverListView->count();i++) { 1488 for(int i=1;i<serverListView->count();i++) {
1489 cfg.setGroup( QString::number(i)); 1489 cfg.setGroup( QString::number(i));
1490 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) { 1490 if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) {
1491 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken")); 1491 QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken"));
1492 return; 1492 return;
1493 } 1493 }
1494 } 1494 }
1495 currentServerConfig =-1; 1495 currentServerConfig =-1;
1496 writeConfig(); 1496 writeConfig();
1497 serverListView->insertItem( newServerName ); 1497 serverListView->insertItem( newServerName );
1498 serverListView->setCurrentItem( serverListView->count()); 1498 serverListView->setCurrentItem( serverListView->count());
1499 } 1499 }
1500} 1500}
1501 1501
1502void OpieFtp::serverListClicked( const QString &item) { 1502void OpieFtp::serverListClicked( const QString &item) {
1503 if(item.isEmpty()) return; 1503 if(item.isEmpty()) return;
1504 Config cfg("opieftp"); 1504 Config cfg("opieftp");
1505 qDebug("highltined "+item); 1505 qDebug("highltined "+item);
1506 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); 1506 int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
1507 for (int i = 1; i <= numberOfEntries; i++) { 1507 for (int i = 1; i <= numberOfEntries; i++) {
1508 cfg.setGroup(QString::number(i)); 1508 cfg.setGroup(QString::number(i));
1509 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) 1509 if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack)
1510 serverComboSelected(i-1); 1510 serverComboSelected(i-1);
1511 } 1511 }
1512} 1512}