author | llornkcor <llornkcor> | 2002-03-17 01:20:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-17 01:20:09 (UTC) |
commit | 2fe80a98551e89b45798369f1bf91f0368382ba6 (patch) (side-by-side diff) | |
tree | a09d8dd51306563faf3496a05cbaca987665b365 | |
parent | 6fa31a92ee5ae6b4e9df2713b0ed7b8fb39fff49 (diff) | |
download | opie-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.
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 79 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 6 |
2 files changed, 53 insertions, 32 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 @@ -76,3 +76,3 @@ OpieFtp::OpieFtp( ) remoteMenu = new QPopupMenu( this ); - tabMenu = new QPopupMenu( this ); + tabMenu = new QPopupMenu( this ); @@ -85,3 +85,3 @@ OpieFtp::OpieFtp( ) - connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); + connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); @@ -107,3 +107,3 @@ OpieFtp::OpieFtp( ) - TabWidget = new QTabWidget( this, "TabWidget" ); + TabWidget = new QTabWidget( this, "TabWidget" ); layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); @@ -150,3 +150,3 @@ OpieFtp::OpieFtp( ) - connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), + connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), this,SLOT( remoteListClicked(QListViewItem *)) ); @@ -157,3 +157,3 @@ OpieFtp::OpieFtp( ) - TabWidget->insertTab( tab_2, tr( "Remote" ) ); + TabWidget->insertTab( tab_2, tr( "Remote" ) ); @@ -207,5 +207,5 @@ OpieFtp::OpieFtp( ) TextLabel4->setText( tr( "Port" ) ); - tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); + tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); - PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); + PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); @@ -214,3 +214,3 @@ OpieFtp::OpieFtp( ) // PortSpinBox->setValue( 21); - tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); + tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); @@ -219,3 +219,3 @@ OpieFtp::OpieFtp( ) - TabWidget->insertTab( tab_3, tr( "Config" ) ); + TabWidget->insertTab( tab_3, tr( "Config" ) ); @@ -230,3 +230,3 @@ OpieFtp::OpieFtp( ) - currentPathEdit->setText( currentDir.canonicalPath()); + currentPathEdit->setText( currentDir.canonicalPath()); connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); @@ -248,5 +248,10 @@ void OpieFtp::cleanUp() 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(); } @@ -258,6 +263,6 @@ void OpieFtp::tabChanged(QWidget *w) } - if (TabWidget->currentPageIndex() == 1) { + if (TabWidget->currentPageIndex() == 1) { currentPathEdit->setText( currentRemoteDir ); } - if (TabWidget->currentPageIndex() == 2) { + if (TabWidget->currentPageIndex() == 2) { } @@ -297,3 +302,3 @@ void OpieFtp::localUpload() TabWidget->setCurrentPage(1); - populateRemoteView(); + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate QCopEnvelope ( "QPE/System", "notBusy()" ); @@ -399,4 +404,10 @@ 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; @@ -408,3 +419,3 @@ bool OpieFtp::remoteDirList(const QString &dir) } - populateRemoteView(); + populateRemoteView() ; QCopEnvelope ( "QPE/System", "notBusy()" ); @@ -465,6 +476,12 @@ void OpieFtp::populateLocalView() -bool OpieFtp::populateRemoteView() +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; @@ -472,4 +489,4 @@ bool OpieFtp::populateRemoteView() 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()) { @@ -487,5 +504,8 @@ bool OpieFtp::populateRemoteView() } - 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; @@ -524,3 +544,2 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) strItem=""; - populateRemoteView(); qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); @@ -534,3 +553,2 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) - populateRemoteView(); } else { @@ -542,2 +560,3 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) } + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate if(currentRemoteDir.right(1) !="/") @@ -545,3 +564,2 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) currentPathEdit->setText( currentRemoteDir ); - remoteDirList( (const QString &)currentRemoteDir); QCopEnvelope ( "QPE/System", "notBusy()" ); @@ -726,4 +744,4 @@ void OpieFtp::remoteMakDir() QCopEnvelope ( "QPE/System", "notBusy()" ); + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } - populateRemoteView(); } @@ -746,2 +764,4 @@ void OpieFtp::remoteDelete() } + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate + } @@ -760,2 +780,3 @@ void OpieFtp::remoteDelete() } + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } @@ -785,4 +806,4 @@ void OpieFtp::remoteRename() QCopEnvelope ( "QPE/System", "notBusy()" ); + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } - populateRemoteView(); } 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 @@ -91,5 +91,5 @@ protected slots: void currentPathEditChanged(); - void switchToLocalTab(); - void switchToRemoteTab(); - void switchToConfigTab(); + void switchToLocalTab(); + void switchToRemoteTab(); + void switchToConfigTab(); protected: |