summaryrefslogtreecommitdiff
Unidiff
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( )
79 QPEMenuBar *menuBar = new QPEMenuBar(this); 79 QPEMenuBar *menuBar = new QPEMenuBar(this);
80// QPEToolBar *menuBar = new QPEToolBar(this);
81// menuBar->setHorizontalStretchable( TRUE );
82
80 connectionMenu = new QPopupMenu( this ); 83 connectionMenu = new QPopupMenu( this );
@@ -84,3 +87,3 @@ OpieFtp::OpieFtp( )
84 87
85 layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); 88 layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
86 89
@@ -115,4 +118,25 @@ OpieFtp::OpieFtp( )
115 118
119
120 cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
121 cdUpButton ->setFixedSize( QSize( 20, 20 ) );
122 connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
123 cdUpButton ->setFlat(TRUE);
124 layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
125 cdUpButton->hide();
126
127// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
128// docButton->setFixedSize( QSize( 20, 20 ) );
129// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
130// docButton->setFlat(TRUE);
131// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
132
133 homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
134 homeButton->setFixedSize( QSize( 20, 20 ) );
135 connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
136 homeButton->setFlat(TRUE);
137 layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
138 homeButton->hide();
139
116 TabWidget = new QTabWidget( this, "TabWidget" ); 140 TabWidget = new QTabWidget( this, "TabWidget" );
117 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); 141 layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
118 142
@@ -250,3 +274,4 @@ OpieFtp::OpieFtp( )
250 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 274 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
251 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 ); 275 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4);
276
252 currentPathCombo->setEditable(TRUE); 277 currentPathCombo->setEditable(TRUE);
@@ -261,3 +286,3 @@ OpieFtp::OpieFtp( )
261 ProgressBar = new QProgressBar( this, "ProgressBar" ); 286 ProgressBar = new QProgressBar( this, "ProgressBar" );
262 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); 287 layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
263 288
@@ -296,17 +321,28 @@ void OpieFtp::tabChanged(QWidget *w)
296 if (TabWidget->currentPageIndex() == 0) { 321 if (TabWidget->currentPageIndex() == 0) {
297 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 322 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
298 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); 323 tabMenu->setItemChecked(tabMenu->idAt(0),TRUE);
299 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 324 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
300 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 325 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
326 if(cdUpButton->isHidden())
327 cdUpButton->show();
328 if(homeButton->isHidden())
329 homeButton->show();
330
301 } 331 }
302 if (TabWidget->currentPageIndex() == 1) { 332 if (TabWidget->currentPageIndex() == 1) {
303 currentPathCombo->lineEdit()->setText( currentRemoteDir ); 333 currentPathCombo->lineEdit()->setText( currentRemoteDir );
304 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); 334 tabMenu->setItemChecked(tabMenu->idAt(1),TRUE);
305 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 335 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
306 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); 336 tabMenu->setItemChecked(tabMenu->idAt(2),FALSE);
337 if(cdUpButton->isHidden())
338 cdUpButton->show();
339 homeButton->hide();
340
307 } 341 }
308 if (TabWidget->currentPageIndex() == 2) { 342 if (TabWidget->currentPageIndex() == 2) {
309 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); 343 tabMenu->setItemChecked(tabMenu->idAt(2),TRUE);
310 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); 344 tabMenu->setItemChecked(tabMenu->idAt(0),FALSE);
311 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); 345 tabMenu->setItemChecked(tabMenu->idAt(1),FALSE);
346 cdUpButton->hide();
347 homeButton->hide();
312 } 348 }
@@ -344,3 +380,3 @@ void OpieFtp::connector()
344{ 380{
345 QCopEnvelope ( "QPE/System", "busy()" ); 381// QCopEnvelope ( "QPE/System", "busy()" );
346// qApp->processEvents(); 382// qApp->processEvents();
@@ -387,3 +423,3 @@ void OpieFtp::connector()
387 connectServerBtn->setText( tr("Disconnect")); 423 connectServerBtn->setText( tr("Disconnect"));
388 QCopEnvelope ( "QPE/System", "notBusy()" ); 424// QCopEnvelope ( "QPE/System", "notBusy()" );
389} 425}
@@ -404,3 +440,3 @@ void OpieFtp::localUpload()
404 int fsz; 440 int fsz;
405 QCopEnvelope ( "QPE/System", "busy()" ); 441// QCopEnvelope ( "QPE/System", "busy()" );
406// qApp->processEvents(); 442// qApp->processEvents();
@@ -440,3 +476,4 @@ void OpieFtp::localUpload()
440 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 476 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
441 QCopEnvelope ( "QPE/System", "notBusy()" ); 477// QCopEnvelope ( "QPE/System", "notBusy()" );
478
442} 479}
@@ -455,3 +492,3 @@ void OpieFtp::remoteDownload()
455 int fsz; 492 int fsz;
456 QCopEnvelope ( "QPE/System", "busy()" ); 493// QCopEnvelope ( "QPE/System", "busy()" );
457 494
@@ -494,3 +531,4 @@ void OpieFtp::remoteDownload()
494 populateLocalView(); 531 populateLocalView();
495 QCopEnvelope ( "QPE/System", "notBusy()" ); 532// QCopEnvelope ( "QPE/System", "notBusy()" );
533
496} 534}
@@ -505,3 +543,3 @@ bool OpieFtp::remoteDirList(const QString &dir)
505// qDebug("Listing remote dir "+tmp); 543// qDebug("Listing remote dir "+tmp);
506 QCopEnvelope ( "QPE/System", "busy()" ); 544// QCopEnvelope ( "QPE/System", "busy()" );
507 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { 545 if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) {
@@ -514,3 +552,3 @@ bool OpieFtp::remoteDirList(const QString &dir)
514 populateRemoteView() ; 552 populateRemoteView() ;
515 QCopEnvelope ( "QPE/System", "notBusy()" ); 553// QCopEnvelope ( "QPE/System", "notBusy()" );
516 return true; 554 return true;
@@ -520,3 +558,3 @@ bool OpieFtp::remoteChDir(const QString &dir)
520{ 558{
521 QCopEnvelope ( "QPE/System", "busy()" ); 559// QCopEnvelope ( "QPE/System", "busy()" );
522 if (!FtpChdir( dir.latin1(), conn )) { 560 if (!FtpChdir( dir.latin1(), conn )) {
@@ -527,6 +565,6 @@ bool OpieFtp::remoteChDir(const QString &dir)
527// qDebug(msg); 565// qDebug(msg);
528 QCopEnvelope ( "QPE/System", "notBusy()" ); 566// QCopEnvelope ( "QPE/System", "notBusy()" );
529 return FALSE; 567 return FALSE;
530 } 568 }
531 QCopEnvelope ( "QPE/System", "notBusy()" ); 569// QCopEnvelope ( "QPE/System", "notBusy()" );
532 return TRUE; 570 return TRUE;
@@ -601,2 +639,3 @@ void OpieFtp::populateLocalView()
601 fillCombo( (const QString &)currentDir); 639 fillCombo( (const QString &)currentDir);
640
602} 641}
@@ -701,3 +740,3 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
701 } else { 740 } else {
702 QCopEnvelope ( "QPE/System", "notBusy()" ); 741// QCopEnvelope ( "QPE/System", "notBusy()" );
703 return; 742 return;
@@ -753,2 +792,3 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem)
753 } 792 }
793
754} 794}
@@ -890,3 +930,3 @@ void OpieFtp::remoteMakDir()
890 QString tmp=currentRemoteDir+filename; 930 QString tmp=currentRemoteDir+filename;
891 QCopEnvelope ( "QPE/System", "busy()" ); 931// QCopEnvelope ( "QPE/System", "busy()" );
892 if(FtpMkdir( tmp.latin1(), conn) == 0) { 932 if(FtpMkdir( tmp.latin1(), conn) == 0) {
@@ -897,3 +937,3 @@ void OpieFtp::remoteMakDir()
897 } 937 }
898 QCopEnvelope ( "QPE/System", "notBusy()" ); 938// QCopEnvelope ( "QPE/System", "notBusy()" );
899 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 939 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
@@ -905,3 +945,3 @@ void OpieFtp::remoteDelete()
905 QString f = Remote_View->currentItem()->text(0); 945 QString f = Remote_View->currentItem()->text(0);
906 QCopEnvelope ( "QPE/System", "busy()" ); 946// QCopEnvelope ( "QPE/System", "busy()" );
907 if( f.right(1) =="/") { 947 if( f.right(1) =="/") {
@@ -938,3 +978,3 @@ void OpieFtp::remoteDelete()
938 } 978 }
939 QCopEnvelope ( "QPE/System", "notBusy()" ); 979// QCopEnvelope ( "QPE/System", "notBusy()" );
940} 980}
@@ -951,3 +991,3 @@ void OpieFtp::remoteRename()
951 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; 991 QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist";
952 QCopEnvelope ( "QPE/System", "busy()" ); 992// QCopEnvelope ( "QPE/System", "busy()" );
953 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { 993 if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) {
@@ -958,3 +998,3 @@ void OpieFtp::remoteRename()
958 } 998 }
959 QCopEnvelope ( "QPE/System", "notBusy()" ); 999// QCopEnvelope ( "QPE/System", "notBusy()" );
960 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate 1000 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
@@ -1193 +1233,57 @@ void OpieFtp::deleteServer()
1193} 1233}
1234
1235void OpieFtp::upDir()
1236{
1237 if (TabWidget->currentPageIndex() == 0) {
1238 QString current = currentDir.canonicalPath();
1239 QDir dir(current);
1240 dir.cdUp();
1241 current = dir.canonicalPath();
1242 chdir( current.latin1() );
1243 currentDir.cd( current, TRUE);
1244 populateLocalView();
1245 update();
1246 } else {
1247 if( FtpCDUp( conn) == 0) {
1248 QString msg;
1249 msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
1250 msg.replace(QRegExp(":"),"\n");
1251 QMessageBox::message(tr("Note"),msg);
1252// qDebug(msg);
1253 }
1254 char path[256];
1255 if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
1256 QString msg;
1257 msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
1258 msg.replace(QRegExp(":"),"\n");
1259 QMessageBox::message(tr("Note"),msg);
1260// qDebug(msg);
1261 }
1262 currentRemoteDir=path;
1263 remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
1264 if(currentRemoteDir.right(1) !="/")
1265 currentRemoteDir +="/";
1266 currentPathCombo->lineEdit()->setText( currentRemoteDir);
1267 fillRemoteCombo( (const QString &)currentRemoteDir);
1268 populateRemoteView( );
1269 }
1270}
1271
1272void OpieFtp::docButtonPushed() {
1273 QString current = QPEApplication::documentDir();
1274 chdir( current.latin1() );
1275 currentDir.cd( current, TRUE);
1276 populateLocalView();
1277 update();
1278
1279}
1280
1281void OpieFtp::homeButtonPushed() {
1282 if (TabWidget->currentPageIndex() == 0) {
1283 QString current = QDir::homeDirPath();
1284 chdir( current.latin1() );
1285 currentDir.cd( current, TRUE);
1286 populateLocalView();
1287 update();
1288 }
1289}
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:
62 QListViewItem * item; 62 QListViewItem * item;
63 QPushButton *connectServerBtn; 63 QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton;
64 bool b; 64 bool b;
@@ -66,2 +66,6 @@ public:
66protected slots: 66protected slots:
67 void upDir();
68 void homeButtonPushed();
69 void docButtonPushed();
70
67 void serverComboEdited(const QString & ); 71 void serverComboEdited(const QString & );