-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 151be84..e1dd582 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -400,97 +400,106 @@ void OpieFtp::populateLocalView() } bool OpieFtp::populateRemoteView() { Remote_View->clear(); QFile tmp("./._temp"); QString s, File_Name; QString fileL, fileS, fileDate; new QListViewItem( Remote_View, "../"); if (tmp.open(IO_ReadOnly)) { QTextStream t( &tmp ); // use a text stream while ( !t.eof()) { s = t.readLine(); fileL = s.right(s.length()-55); fileL = fileL.stripWhiteSpace(); if(s.left(1) == "d") fileL = fileL+"/"; fileS = s.mid( 30, 42-30); fileS = fileS.stripWhiteSpace(); fileDate = s.mid( 42, 55-42); fileDate = fileDate.stripWhiteSpace(); if(fileL.find("total",0,TRUE) == -1) new QListViewItem( Remote_View, fileL, fileS, fileDate); } tmp.close(); } return true; } void OpieFtp::remoteListClicked(QListViewItem *selectedItem) { QCopEnvelope ( "QPE/System", "busy()" ); QString strItem=selectedItem->text(0); strItem=strItem.simplifyWhiteSpace(); if(strItem == "../") { if( FtpCDUp( conn) == 0) { QString msg; msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); QMessageBox::message("Note",msg); } char path[256]; if( FtpPwd( path,sizeof(path),conn) == 0) { QString msg; msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); QMessageBox::message("Note",msg); } currentRemoteDir=path; } else { - if(strItem.find("/",0,TRUE) != -1) { + if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers + strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE)-3 ); + strItem = strItem.stripWhiteSpace(); + currentRemoteDir = strItem; + if( remoteChDir( (const QString &)strItem) ==0) { + QString msg; + msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); + QMessageBox::message("Note",msg); + } + } else if(strItem.find("/",0,TRUE) != -1) { if( remoteChDir( (const QString &)currentRemoteDir+strItem) ==0) { QString msg; msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); QMessageBox::message("Note",msg); } currentRemoteDir = currentRemoteDir+strItem; } else { qDebug("download "+strItem); } } if(currentRemoteDir.right(1) !="/") currentRemoteDir +="/"; currentPathEdit->setText( currentRemoteDir ); remoteDirList( (const QString &)currentRemoteDir); QCopEnvelope ( "QPE/System", "notBusy()" ); } void OpieFtp::localListClicked(QListViewItem *selectedItem) { QString strItem=selectedItem->text(0); QString strSize=selectedItem->text(1); strSize=strSize.stripWhiteSpace(); if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink // is symlink QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); if(QDir(strItem2).exists() ) { currentDir.cd(strItem2, TRUE); populateLocalView(); } } else { // not a symlink if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); currentDir.cd(strItem,FALSE); populateLocalView(); } else { currentDir.cdUp(); populateLocalView(); } if(QDir(strItem).exists()){ currentDir.cd(strItem, TRUE); populateLocalView(); } } else { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); if( QFile::exists(strItem ) ) { qDebug("upload "+strItem); } |