summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp79
-rw-r--r--noncore/net/opieftp/opieftp.h6
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
@@ -73,18 +73,18 @@ OpieFtp::OpieFtp( )
QPEMenuBar *menuBar = new QPEMenuBar(this);
connectionMenu = new QPopupMenu( this );
localMenu = new QPopupMenu( this );
remoteMenu = new QPopupMenu( this );
- tabMenu = new QPopupMenu( this );
+ tabMenu = new QPopupMenu( this );
layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 );
menuBar->insertItem( tr( "Connection" ), connectionMenu);
menuBar->insertItem( tr( "Local" ), localMenu);
menuBar->insertItem( tr( "Remote" ), remoteMenu);
menuBar->insertItem( tr( "View" ), tabMenu);
- connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
+ connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
@@ -104,9 +104,9 @@ OpieFtp::OpieFtp( )
tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
- TabWidget = new QTabWidget( this, "TabWidget" );
+ TabWidget = new QTabWidget( this, "TabWidget" );
layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 );
TabWidget->setTabShape(QTabWidget::Triangular);
@@ -147,16 +147,16 @@ OpieFtp::OpieFtp( )
Remote_View->setColumnAlignment(2,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
- connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)),
+ connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)),
this,SLOT( remoteListClicked(QListViewItem *)) );
connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
tabLayout_2->addWidget( Remote_View, 0, 0 );
- TabWidget->insertTab( tab_2, tr( "Remote" ) );
+ TabWidget->insertTab( tab_2, tr( "Remote" ) );
tab_3 = new QWidget( TabWidget, "tab_3" );
tabLayout_3 = new QGridLayout( tab_3 );
tabLayout_3->setSpacing( 2);
@@ -204,21 +204,21 @@ OpieFtp::OpieFtp( )
// remotePath->setText( currentRemoteDir = "/home/llornkcor/");
TextLabel4 = new QLabel( tab_3, "TextLabel4" );
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 );
PortSpinBox->setMaxValue(32786);
PortSpinBox->setValue( 4242);
// PortSpinBox->setValue( 21);
- tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
+ tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1);
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
tabLayout_3->addItem( spacer, 5, 0 );
- TabWidget->insertTab( tab_3, tr( "Config" ) );
+ TabWidget->insertTab( tab_3, tr( "Config" ) );
connect(TabWidget,SIGNAL(currentChanged(QWidget *)),
this,SLOT(tabChanged(QWidget*)));
@@ -227,9 +227,9 @@ OpieFtp::OpieFtp( )
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" );
layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 );
- currentPathEdit->setText( currentDir.canonicalPath());
+ currentPathEdit->setText( currentDir.canonicalPath());
connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged()));
ProgressBar = new QProgressBar( this, "ProgressBar" );
layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 );
@@ -245,22 +245,27 @@ OpieFtp::~OpieFtp()
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)
{
if (TabWidget->currentPageIndex() == 0) {
currentPathEdit->setText( currentDir.canonicalPath());
}
- if (TabWidget->currentPageIndex() == 1) {
+ if (TabWidget->currentPageIndex() == 1) {
currentPathEdit->setText( currentRemoteDir );
}
- if (TabWidget->currentPageIndex() == 2) {
+ if (TabWidget->currentPageIndex() == 2) {
}
}
void OpieFtp::localUpload()
@@ -294,9 +299,9 @@ void OpieFtp::localUpload()
} else {
QMessageBox::message("Note","Cannot upload directories");
}
TabWidget->setCurrentPage(1);
- populateRemoteView();
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::nullifyCallBack()
@@ -396,18 +401,24 @@ 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");
QMessageBox::message("Note",msg);
// FtpQuit(conn);
return false;
}
- populateRemoteView();
+ populateRemoteView() ;
QCopEnvelope ( "QPE/System", "notBusy()" );
return true;
}
@@ -462,17 +473,23 @@ void OpieFtp::populateLocalView()
Local_View->setSorting( 3,FALSE);
currentPathEdit->setText( currentDir.canonicalPath() );
}
-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;
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);
fileL = fileL.stripWhiteSpace();
@@ -484,11 +501,14 @@ bool OpieFtp::populateRemoteView()
fileDate = fileDate.stripWhiteSpace();
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;
}
void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
@@ -521,9 +541,8 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
currentRemoteDir = strItem;
if( !remoteChDir( (const QString &)strItem)) {
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
- populateRemoteView();
qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
}
} else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
qDebug("trying directory");
@@ -531,20 +550,19 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
currentRemoteDir = oldRemoteCurrentDir;
strItem="";
qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
- populateRemoteView();
} else {
currentRemoteDir = currentRemoteDir+strItem;
}
} else {
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()" );
}
void OpieFtp::localListClicked(QListViewItem *selectedItem)
@@ -723,10 +741,10 @@ void OpieFtp::remoteMakDir()
msg.replace(QRegExp(":"),"\n");
QMessageBox::message("Note",msg);
}
QCopEnvelope ( "QPE/System", "notBusy()" );
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
- populateRemoteView();
}
void OpieFtp::remoteDelete()
{
@@ -743,8 +761,10 @@ void OpieFtp::remoteDelete()
msg.sprintf("Unable to remove directory\n%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message("Note",msg);
}
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
+
}
break;
};
} else {
@@ -757,8 +777,9 @@ void OpieFtp::remoteDelete()
msg.sprintf("Unable to delete file\n%s",FtpLastResponse(conn));
msg.replace(QRegExp(":"),"\n");
QMessageBox::message("Note",msg);
}
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
}
break;
};
}
@@ -782,10 +803,10 @@ void OpieFtp::remoteRename()
msg.replace(QRegExp(":"),"\n");
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
@@ -88,11 +88,11 @@ protected slots:
void cleanUp();
void remoteRename();
void localRename();
void currentPathEditChanged();
- void switchToLocalTab();
- void switchToRemoteTab();
- void switchToConfigTab();
+ void switchToLocalTab();
+ void switchToRemoteTab();
+ void switchToConfigTab();
protected:
void nullifyCallBack();
QGridLayout* tabLayout;
QGridLayout* tabLayout_2;