summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp
authorllornkcor <llornkcor>2002-03-28 13:46:22 (UTC)
committer llornkcor <llornkcor>2002-03-28 13:46:22 (UTC)
commit262def2f8e13de60344f3118078328d5e37a6054 (patch) (side-by-side diff)
tree0e4769627f6a10c33682312f9cc0219f7af8e59b /noncore/net/opieftp
parentcd6f89bfab7e609705e8013d50413e1cae929d8a (diff)
downloadopie-262def2f8e13de60344f3118078328d5e37a6054.zip
opie-262def2f8e13de60344f3118078328d5e37a6054.tar.gz
opie-262def2f8e13de60344f3118078328d5e37a6054.tar.bz2
fixed clicking on empty space.. dambit
Diffstat (limited to 'noncore/net/opieftp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 36de842..6be28d6 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -274,97 +274,98 @@ OpieFtp::~OpieFtp()
}
void OpieFtp::cleanUp()
{
if(conn)
FtpQuit(conn);
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)
{
if (TabWidget->currentPageIndex() == 0) {
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
}
if (TabWidget->currentPageIndex() == 1) {
currentPathCombo->lineEdit()->setText( currentRemoteDir );
tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
}
if (TabWidget->currentPageIndex() == 2) {
tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
}
}
void OpieFtp::newConnection()
{
UsernameComboBox->lineEdit()->setText("");
PasswordEdit->setText( "" );
ServerComboBox->lineEdit()->setText( "");
remotePath->setText( currentRemoteDir = "/");
PortSpinBox->setValue( 21);
TabWidget->setCurrentPage(2);
currentServerConfig = -1;
}
-void OpieFtp::serverComboEdited(const QString & edit) {
+void OpieFtp::serverComboEdited(const QString & edit)
+{
if( !edit.isEmpty() ) {
currentServerConfig = -1;
// qDebug("comboedited");
}
}
void OpieFtp::connectorBtnToggled(bool On)
{
if(On) {
connector();
} else {
disConnector();
}
}
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();
connectServerBtn->setOn(FALSE);
connectServerBtn->setText( tr("Connect"));
return;
}
FtpInit();
TabWidget->setCurrentPage(1);
QString ftp_host = ServerComboBox->currentText();
QString ftp_user = UsernameComboBox->currentText();
QString ftp_pass = PasswordEdit->text();
QString port=PortSpinBox->cleanText();
port.stripWhiteSpace();
if(ftp_host.find("ftp://",0, TRUE) != -1 )
ftp_host=ftp_host.right(ftp_host.length()-6);
ftp_host+=":"+port;
if (!FtpConnect( ftp_host.latin1(), &conn)) {
QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host);
connectServerBtn->setOn(FALSE);
connectServerBtn->setText( tr("Connect"));
return ;
}
if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) {
QString msg;
@@ -609,155 +610,154 @@ bool OpieFtp::populateRemoteView( )
QFile file( sfile);
Remote_View->clear();
QString s, File_Name;
QListViewItem *itemDir=NULL, *itemFile=NULL;
QString fileL, fileS, fileDate;
if ( file.open(IO_ReadOnly)) {
QTextStream t( &file ); // 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+"/";
// 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) {
if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"d");
item->setPixmap( 0, Resource::loadPixmap( "folder" ));
// if(itemDir)
item->moveItem(itemDir);
itemDir=item;
} else {
QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"f");
item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
// if(itemFile)
item->moveItem(itemDir);
item->moveItem(itemFile);
itemFile=item;
}
}
}
QListViewItem * item1 = new QListViewItem( Remote_View, "../");
item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
file.close();
if( file.exists())
file. remove();
} else
qDebug("temp file not opened successfullly "+sfile);
Remote_View->setSorting( 4,TRUE);
return true;
}
void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
{
- if(item) {
+ if( selectedItem) {
QCopEnvelope ( "QPE/System", "busy()" );
QString oldRemoteCurrentDir = currentRemoteDir;
QString strItem=selectedItem->text(0);
strItem=strItem.simplifyWhiteSpace();
if(strItem == "../") { // the user wants to go ^
if( FtpCDUp( conn) == 0) {
QString msg;
msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
qDebug(msg);
}
char path[256];
if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
QString msg;
msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message(tr("Note"),msg);
qDebug(msg);
}
currentRemoteDir=path;
} else {
if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
strItem = strItem.stripWhiteSpace();
currentRemoteDir = strItem;
if( !remoteChDir( (const QString &)strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
}
} else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
qDebug("trying directory");
if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
} else {
currentRemoteDir = currentRemoteDir+strItem;
}
} else {
qDebug("download "+strItem);
}
}
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
if(currentRemoteDir.right(1) !="/")
currentRemoteDir +="/";
currentPathCombo->lineEdit()->setText( currentRemoteDir );
fillRemoteCombo( (const QString &)currentDir);
QCopEnvelope ( "QPE/System", "notBusy()" );
}
}
void OpieFtp::localListClicked(QListViewItem *selectedItem)
{
-// qDebug(selectedItem->text(0));
- if(item!= NULL) {
+ if(selectedItem!= NULL) {
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);
}
} //end not symlink
chdir(strItem.latin1());
}
}
}
void OpieFtp::doLocalCd()
{
localListClicked( Local_View->currentItem());
}
void OpieFtp:: doRemoteCd()
{
remoteListClicked( Remote_View->currentItem());
}
void OpieFtp::showHidden()