summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-17 01:20:09 (UTC)
committer llornkcor <llornkcor>2002-03-17 01:20:09 (UTC)
commit2fe80a98551e89b45798369f1bf91f0368382ba6 (patch) (side-by-side diff)
treea09d8dd51306563faf3496a05cbaca987665b365
parent6fa31a92ee5ae6b4e9df2713b0ed7b8fb39fff49 (diff)
downloadopie-2fe80a98551e89b45798369f1bf91f0368382ba6.zip
opie-2fe80a98551e89b45798369f1bf91f0368382ba6.tar.gz
opie-2fe80a98551e89b45798369f1bf91f0368382ba6.tar.bz2
fixed problem with remote directory not being listed after an upload, and fixed
problem with temp file poop with strewn throughout the local filesystem.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp51
-rw-r--r--noncore/net/opieftp/opieftp.h0
2 files changed, 36 insertions, 15 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 042ed59..6a3a64d 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -246,9 +246,14 @@ void OpieFtp::cleanUp()
{
if(conn)
FtpQuit(conn);
- QFile f("./._temp");
- if(f.exists())
- f. remove();
+ QString sfile=QDir::homeDirPath();
+ if(sfile.right(1) != "/")
+ sfile+="/._temp";
+ else
+ sfile+="._temp";
+ QFile file( sfile);
+ if(file.exists())
+ file.remove();
}
void OpieFtp::tabChanged(QWidget *w)
@@ -295,7 +300,7 @@ void OpieFtp::localUpload()
QMessageBox::message("Note","Cannot upload directories");
}
TabWidget->setCurrentPage(1);
- populateRemoteView();
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
QCopEnvelope ( "QPE/System", "notBusy()" );
}
@@ -397,8 +402,14 @@ void OpieFtp::disConnector()
bool OpieFtp::remoteDirList(const QString &dir)
{
+ QString tmp = QDir::homeDirPath();
+ if(tmp.right(1) != "/")
+ tmp+="/._temp";
+ else
+ tmp+="._temp";
+// qDebug("Listing remote dir "+tmp);
QCopEnvelope ( "QPE/System", "busy()" );
- if (!FtpDir( "./._temp", dir.latin1(), conn) ) {
+ if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
QString msg;
msg.sprintf("Unable to list the directory\n"+dir+"\n%s",FtpLastResponse(conn) );
msg.replace(QRegExp(":"),"\n");
@@ -465,13 +476,19 @@ void OpieFtp::populateLocalView()
bool OpieFtp::populateRemoteView()
{
+// qDebug("populate remoteview");
+ QString sfile=QDir::homeDirPath();
+ if(sfile.right(1) != "/")
+ sfile+="/._temp";
+ else
+ sfile+="._temp";
+ QFile file( sfile);
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
+ if ( file.open(IO_ReadOnly)) {
+ QTextStream t( &file ); // use a text stream
while ( !t.eof()) {
s = t.readLine();
fileL = s.right(s.length()-55);
@@ -485,9 +502,12 @@ bool OpieFtp::populateRemoteView()
if(fileL.find("total",0,TRUE) == -1)
new QListViewItem( Remote_View, fileL, fileS, fileDate);
}
- tmp.close();
+ file.close();
+ if( file.exists())
+ file. remove();
} else
- qDebug("temp file not opened successfullly");
+ qDebug("temp file not opened successfullly "+sfile);
+
return true;
}
@@ -522,7 +542,6 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
if( !remoteChDir( (const QString &)strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
- populateRemoteView();
qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
}
} else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
@@ -532,7 +551,6 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
strItem="";
qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
- populateRemoteView();
} else {
currentRemoteDir = currentRemoteDir+strItem;
}
@@ -540,10 +558,10 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
qDebug("download "+strItem);
}
}
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
if(currentRemoteDir.right(1) !="/")
currentRemoteDir +="/";
currentPathEdit->setText( currentRemoteDir );
- remoteDirList( (const QString &)currentRemoteDir);
QCopEnvelope ( "QPE/System", "notBusy()" );
}
@@ -724,8 +742,8 @@ void OpieFtp::remoteMakDir()
QMessageBox::message("Note",msg);
}
QCopEnvelope ( "QPE/System", "notBusy()" );
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
- populateRemoteView();
}
void OpieFtp::remoteDelete()
@@ -744,6 +762,8 @@ void OpieFtp::remoteDelete()
msg.replace(QRegExp(":"),"\n");
QMessageBox::message("Note",msg);
}
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
+
}
break;
};
@@ -758,6 +778,7 @@ void OpieFtp::remoteDelete()
msg.replace(QRegExp(":"),"\n");
QMessageBox::message("Note",msg);
}
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
break;
};
@@ -783,8 +804,8 @@ void OpieFtp::remoteRename()
QMessageBox::message("Note",msg);
}
QCopEnvelope ( "QPE/System", "notBusy()" );
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
- populateRemoteView();
}
void OpieFtp::localRename()
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index e3ff334..1e5fffa 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h