summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-20 23:58:17 (UTC)
committer llornkcor <llornkcor>2002-03-20 23:58:17 (UTC)
commite8f15a98c611b0c6030e8210672b249b42107526 (patch) (side-by-side diff)
treeb36e786dedd13a959cbae0cf6ee934a7fd373047
parenta766295804d76f06a7e47b1d5e02dd5a59676c7d (diff)
downloadopie-e8f15a98c611b0c6030e8210672b249b42107526.zip
opie-e8f15a98c611b0c6030e8210672b249b42107526.tar.gz
opie-e8f15a98c611b0c6030e8210672b249b42107526.tar.bz2
fixed problem with remote download
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index f1b159c..6e9dc67 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -289,97 +289,100 @@ void OpieFtp::localUpload()
QString strItem = Local_View->currentItem()->text(0);
QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
QFileInfo fi(localFile);
if( !fi.isDir()) {
fsz=fi.size();
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1());
if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// FtpQuit(conn);
}
ProgressBar->reset();
nullifyCallBack();
} else {
QMessageBox::message(tr("Note"),tr("Cannot upload directories"));
}
TabWidget->setCurrentPage(1);
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::nullifyCallBack()
{
FtpOptions(FTPLIB_CALLBACK, NULL, conn);
FtpOptions(FTPLIB_IDLETIME, NULL, conn);
FtpOptions(FTPLIB_CALLBACKARG, NULL, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn);
}
void OpieFtp::remoteDownload()
{
int fsz;
QCopEnvelope ( "QPE/System", "busy()" );
qApp->processEvents();
QString strItem = Remote_View->currentItem()->text(0);
// strItem=strItem.right(strItem.length()-1);
- QString localFile = currentDir.canonicalPath()+strItem;
+ QString localFile = currentDir.canonicalPath();
+ if(localFile.right(1).find("/",0,TRUE) == -1)
+ localFile += "/";
+ localFile += strItem;
// QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
fsz = 0;
QString temp;
temp.sprintf( remoteFile+" "+" %dkb", fsz);
ProgressBar->setTotalSteps(fsz);
FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn);
FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn);
FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn);
FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn);
qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1());
if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) {
QString msg;
msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
// FtpQuit(conn);
}
ProgressBar->reset();
nullifyCallBack();
TabWidget->setCurrentPage(0);
populateLocalView();
QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::newConnection()
{
TabWidget->setCurrentPage(2);
}
void OpieFtp::connector()
{
QCopEnvelope ( "QPE/System", "busy()" );
qApp->processEvents();
currentRemoteDir=remotePath->text();
if(ServerComboBox->currentText().isEmpty()) {
QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0);
TabWidget->setCurrentPage(2);
ServerComboBox->setFocus();
return;
}
FtpInit();
TabWidget->setCurrentPage(1);
QString ftp_host = ServerComboBox->currentText();