summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp166
-rw-r--r--noncore/net/opieftp/opieftp.h6
2 files changed, 136 insertions, 36 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 919649e..fb57193 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -79,2 +79,5 @@ OpieFtp::OpieFtp( )
QPEMenuBar *menuBar = new QPEMenuBar(this);
+// QPEToolBar *menuBar = new QPEToolBar(this);
+// menuBar->setHorizontalStretchable( TRUE );
+
connectionMenu = new QPopupMenu( this );
@@ -84,3 +87,3 @@ OpieFtp::OpieFtp( )
- layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 );
+ layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
@@ -115,4 +118,25 @@ OpieFtp::OpieFtp( )
+
+ cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
+ cdUpButton ->setFixedSize( QSize( 20, 20 ) );
+ connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
+ cdUpButton ->setFlat(TRUE);
+ layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
+ cdUpButton->hide();
+
+// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
+// docButton->setFixedSize( QSize( 20, 20 ) );
+// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
+// docButton->setFlat(TRUE);
+// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
+
+ homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
+ homeButton->setFixedSize( QSize( 20, 20 ) );
+ connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
+ homeButton->setFlat(TRUE);
+ layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
+ homeButton->hide();
+
TabWidget = new QTabWidget( this, "TabWidget" );
- layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 );
+ layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
@@ -250,3 +274,4 @@ OpieFtp::OpieFtp( )
currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
- layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 );
+ layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
+
currentPathCombo->setEditable(TRUE);
@@ -261,3 +286,3 @@ OpieFtp::OpieFtp( )
ProgressBar = new QProgressBar( this, "ProgressBar" );
- layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 );
+ layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
@@ -296,17 +321,28 @@ 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);
+ currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
+ tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
+ tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
+ tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
+ if(cdUpButton->isHidden())
+ cdUpButton->show();
+ if(homeButton->isHidden())
+ homeButton->show();
+
}
- 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() == 1) {
+ currentPathCombo->lineEdit()->setText( currentRemoteDir );
+ tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
+ tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
+ tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
+ if(cdUpButton->isHidden())
+ cdUpButton->show();
+ homeButton->hide();
+
}
- if (TabWidget->currentPageIndex() == 2) {
- tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
- tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
- tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
+ if (TabWidget->currentPageIndex() == 2) {
+ tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
+ tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
+ tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
+ cdUpButton->hide();
+ homeButton->hide();
}
@@ -344,3 +380,3 @@ void OpieFtp::connector()
{
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
@@ -387,3 +423,3 @@ void OpieFtp::connector()
connectServerBtn->setText( tr("Disconnect"));
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
}
@@ -404,3 +440,3 @@ void OpieFtp::localUpload()
int fsz;
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
// qApp->processEvents();
@@ -440,3 +476,4 @@ void OpieFtp::localUpload()
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
+
}
@@ -455,3 +492,3 @@ void OpieFtp::remoteDownload()
int fsz;
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
@@ -494,3 +531,4 @@ void OpieFtp::remoteDownload()
populateLocalView();
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
+
}
@@ -505,3 +543,3 @@ bool OpieFtp::remoteDirList(const QString &dir)
// qDebug("Listing remote dir "+tmp);
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
@@ -514,3 +552,3 @@ bool OpieFtp::remoteDirList(const QString &dir)
populateRemoteView() ;
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
return true;
@@ -520,3 +558,3 @@ bool OpieFtp::remoteChDir(const QString &dir)
{
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
if (!FtpChdir( dir.latin1(), conn )) {
@@ -527,6 +565,6 @@ bool OpieFtp::remoteChDir(const QString &dir)
// qDebug(msg);
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
return FALSE;
}
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
return TRUE;
@@ -601,2 +639,3 @@ void OpieFtp::populateLocalView()
fillCombo( (const QString &)currentDir);
+
}
@@ -701,3 +740,3 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
} else {
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
return;
@@ -753,2 +792,3 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem)
}
+
}
@@ -890,3 +930,3 @@ void OpieFtp::remoteMakDir()
QString tmp=currentRemoteDir+filename;
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
if(FtpMkdir( tmp.latin1(), conn) == 0) {
@@ -897,3 +937,3 @@ void OpieFtp::remoteMakDir()
}
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
@@ -905,3 +945,3 @@ void OpieFtp::remoteDelete()
QString f = Remote_View->currentItem()->text(0);
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
if( f.right(1) =="/") {
@@ -938,3 +978,3 @@ void OpieFtp::remoteDelete()
}
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
}
@@ -951,3 +991,3 @@ void OpieFtp::remoteRename()
QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
- QCopEnvelope ( "QPE/System", "busy()" );
+// QCopEnvelope ( "QPE/System", "busy()" );
if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
@@ -958,3 +998,3 @@ void OpieFtp::remoteRename()
}
- QCopEnvelope ( "QPE/System", "notBusy()" );
+// QCopEnvelope ( "QPE/System", "notBusy()" );
remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
@@ -1193 +1233,57 @@ void OpieFtp::deleteServer()
}
+
+void OpieFtp::upDir()
+{
+ if (TabWidget->currentPageIndex() == 0) {
+ QString current = currentDir.canonicalPath();
+ QDir dir(current);
+ dir.cdUp();
+ current = dir.canonicalPath();
+ chdir( current.latin1() );
+ currentDir.cd( current, TRUE);
+ populateLocalView();
+ update();
+ } else {
+ 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;
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
+ if(currentRemoteDir.right(1) !="/")
+ currentRemoteDir +="/";
+ currentPathCombo->lineEdit()->setText( currentRemoteDir);
+ fillRemoteCombo( (const QString &)currentRemoteDir);
+ populateRemoteView( );
+ }
+}
+
+void OpieFtp::docButtonPushed() {
+ QString current = QPEApplication::documentDir();
+ chdir( current.latin1() );
+ currentDir.cd( current, TRUE);
+ populateLocalView();
+ update();
+
+}
+
+void OpieFtp::homeButtonPushed() {
+ if (TabWidget->currentPageIndex() == 0) {
+ QString current = QDir::homeDirPath();
+ chdir( current.latin1() );
+ currentDir.cd( current, TRUE);
+ populateLocalView();
+ update();
+ }
+}
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index 32862c7..6852b1c 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -62,3 +62,3 @@ public:
QListViewItem * item;
- QPushButton *connectServerBtn;
+ QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton;
bool b;
@@ -66,2 +66,6 @@ public:
protected slots:
+ void upDir();
+ void homeButtonPushed();
+ void docButtonPushed();
+
void serverComboEdited(const QString & );