-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 166 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 6 |
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 | |||
@@ -68,30 +68,33 @@ static int log_progress(netbuf *ctl, int xfered, void *arg) | |||
68 | OpieFtp::OpieFtp( ) | 68 | OpieFtp::OpieFtp( ) |
69 | : QMainWindow( ) | 69 | : QMainWindow( ) |
70 | { | 70 | { |
71 | setCaption( tr( "OpieFtp" ) ); | 71 | setCaption( tr( "OpieFtp" ) ); |
72 | 72 | ||
73 | QGridLayout *layout = new QGridLayout( this ); | 73 | QGridLayout *layout = new QGridLayout( this ); |
74 | layout->setSpacing( 2); | 74 | layout->setSpacing( 2); |
75 | layout->setMargin( 2); | 75 | layout->setMargin( 2); |
76 | 76 | ||
77 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 77 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
78 | 78 | ||
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 ); |
81 | localMenu = new QPopupMenu( this ); | 84 | localMenu = new QPopupMenu( this ); |
82 | remoteMenu = new QPopupMenu( this ); | 85 | remoteMenu = new QPopupMenu( this ); |
83 | tabMenu = new QPopupMenu( this ); | 86 | tabMenu = new QPopupMenu( this ); |
84 | 87 | ||
85 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 3 ); | 88 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
86 | 89 | ||
87 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 90 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
88 | menuBar->insertItem( tr( "Local" ), localMenu); | 91 | menuBar->insertItem( tr( "Local" ), localMenu); |
89 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 92 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
90 | menuBar->insertItem( tr( "View" ), tabMenu); | 93 | menuBar->insertItem( tr( "View" ), tabMenu); |
91 | 94 | ||
92 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 95 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
93 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 96 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
94 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 97 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
95 | 98 | ||
96 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 99 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
97 | localMenu->insertSeparator(); | 100 | localMenu->insertSeparator(); |
@@ -104,26 +107,47 @@ OpieFtp::OpieFtp( ) | |||
104 | 107 | ||
105 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 108 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
106 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 109 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
107 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 110 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
108 | remoteMenu->insertSeparator(); | 111 | remoteMenu->insertSeparator(); |
109 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 112 | remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
110 | 113 | ||
111 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); | 114 | tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); |
112 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); | 115 | tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); |
113 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); | 116 | tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); |
114 | tabMenu->setCheckable(TRUE); | 117 | tabMenu->setCheckable(TRUE); |
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 | ||
119 | // TabWidget->setTabShape(QTabWidget::Triangular); | 143 | // TabWidget->setTabShape(QTabWidget::Triangular); |
120 | 144 | ||
121 | tab = new QWidget( TabWidget, "tab" ); | 145 | tab = new QWidget( TabWidget, "tab" ); |
122 | tabLayout = new QGridLayout( tab ); | 146 | tabLayout = new QGridLayout( tab ); |
123 | tabLayout->setSpacing( 2); | 147 | tabLayout->setSpacing( 2); |
124 | tabLayout->setMargin( 2); | 148 | tabLayout->setMargin( 2); |
125 | 149 | ||
126 | Local_View = new QListView( tab, "Local_View" ); | 150 | Local_View = new QListView( tab, "Local_View" ); |
127 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 151 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
128 | Local_View->addColumn( tr("File"),150); | 152 | Local_View->addColumn( tr("File"),150); |
129 | Local_View->addColumn( tr("Size"),-1); | 153 | Local_View->addColumn( tr("Size"),-1); |
@@ -239,36 +263,37 @@ OpieFtp::OpieFtp( ) | |||
239 | tabLayout_3->addItem( spacer, 5, 0 ); | 263 | tabLayout_3->addItem( spacer, 5, 0 ); |
240 | 264 | ||
241 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 265 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
242 | 266 | ||
243 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 267 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
244 | this,SLOT(tabChanged(QWidget*))); | 268 | this,SLOT(tabChanged(QWidget*))); |
245 | 269 | ||
246 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 270 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
247 | currentDir.setPath( QDir::currentDirPath()); | 271 | currentDir.setPath( QDir::currentDirPath()); |
248 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 272 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
249 | 273 | ||
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); |
253 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 278 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
254 | 279 | ||
255 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), | 280 | connect( currentPathCombo, SIGNAL( activated( const QString & ) ), |
256 | this, SLOT( currentPathComboActivated( const QString & ) ) ); | 281 | this, SLOT( currentPathComboActivated( const QString & ) ) ); |
257 | 282 | ||
258 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 283 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
259 | this,SLOT(currentPathComboChanged())); | 284 | this,SLOT(currentPathComboChanged())); |
260 | 285 | ||
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 | ||
264 | // fillCombos(); | 289 | // fillCombos(); |
265 | 290 | ||
266 | filterStr="*"; | 291 | filterStr="*"; |
267 | b=FALSE; | 292 | b=FALSE; |
268 | populateLocalView(); | 293 | populateLocalView(); |
269 | readConfig(); | 294 | readConfig(); |
270 | ServerComboBox->setCurrentItem(currentServerConfig); | 295 | ServerComboBox->setCurrentItem(currentServerConfig); |
271 | 296 | ||
272 | TabWidget->setCurrentPage(2); | 297 | TabWidget->setCurrentPage(2); |
273 | } | 298 | } |
274 | 299 | ||
@@ -285,39 +310,50 @@ void OpieFtp::cleanUp() | |||
285 | sfile+="/._temp"; | 310 | sfile+="/._temp"; |
286 | else | 311 | else |
287 | sfile+="._temp"; | 312 | sfile+="._temp"; |
288 | QFile file( sfile); | 313 | QFile file( sfile); |
289 | if(file.exists()) | 314 | if(file.exists()) |
290 | file.remove(); | 315 | file.remove(); |
291 | exit(0); | 316 | exit(0); |
292 | } | 317 | } |
293 | 318 | ||
294 | void OpieFtp::tabChanged(QWidget *w) | 319 | void OpieFtp::tabChanged(QWidget *w) |
295 | { | 320 | { |
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 | } |
313 | } | 349 | } |
314 | 350 | ||
315 | void OpieFtp::newConnection() | 351 | void OpieFtp::newConnection() |
316 | { | 352 | { |
317 | UsernameComboBox->lineEdit()->setText(""); | 353 | UsernameComboBox->lineEdit()->setText(""); |
318 | PasswordEdit->setText( "" ); | 354 | PasswordEdit->setText( "" ); |
319 | ServerComboBox->lineEdit()->setText( ""); | 355 | ServerComboBox->lineEdit()->setText( ""); |
320 | remotePath->setText( currentRemoteDir = "/"); | 356 | remotePath->setText( currentRemoteDir = "/"); |
321 | PortSpinBox->setValue( 21); | 357 | PortSpinBox->setValue( 21); |
322 | TabWidget->setCurrentPage(2); | 358 | TabWidget->setCurrentPage(2); |
323 | } | 359 | } |
@@ -333,25 +369,25 @@ void OpieFtp::serverComboEdited(const QString & edit) | |||
333 | void OpieFtp::connectorBtnToggled(bool On) | 369 | void OpieFtp::connectorBtnToggled(bool On) |
334 | { | 370 | { |
335 | if(On) { | 371 | if(On) { |
336 | connector(); | 372 | connector(); |
337 | } else { | 373 | } else { |
338 | disConnector(); | 374 | disConnector(); |
339 | } | 375 | } |
340 | 376 | ||
341 | } | 377 | } |
342 | 378 | ||
343 | void OpieFtp::connector() | 379 | void OpieFtp::connector() |
344 | { | 380 | { |
345 | QCopEnvelope ( "QPE/System", "busy()" ); | 381 | // QCopEnvelope ( "QPE/System", "busy()" ); |
346 | // qApp->processEvents(); | 382 | // qApp->processEvents(); |
347 | currentRemoteDir=remotePath->text(); | 383 | currentRemoteDir=remotePath->text(); |
348 | if(ServerComboBox->currentText().isEmpty()) { | 384 | if(ServerComboBox->currentText().isEmpty()) { |
349 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 385 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
350 | TabWidget->setCurrentPage(2); | 386 | TabWidget->setCurrentPage(2); |
351 | ServerComboBox->setFocus(); | 387 | ServerComboBox->setFocus(); |
352 | connectServerBtn->setOn(FALSE); | 388 | connectServerBtn->setOn(FALSE); |
353 | connectServerBtn->setText( tr("Connect")); | 389 | connectServerBtn->setText( tr("Connect")); |
354 | return; | 390 | return; |
355 | } | 391 | } |
356 | FtpInit(); | 392 | FtpInit(); |
357 | TabWidget->setCurrentPage(1); | 393 | TabWidget->setCurrentPage(1); |
@@ -376,42 +412,42 @@ void OpieFtp::connector() | |||
376 | msg.replace(QRegExp(":"),"\n"); | 412 | msg.replace(QRegExp(":"),"\n"); |
377 | QMessageBox::message(tr("Note"),msg); | 413 | QMessageBox::message(tr("Note"),msg); |
378 | if(conn) | 414 | if(conn) |
379 | FtpQuit(conn); | 415 | FtpQuit(conn); |
380 | connectServerBtn->setOn(FALSE); | 416 | connectServerBtn->setOn(FALSE); |
381 | connectServerBtn->setText( tr("Connect")); | 417 | connectServerBtn->setText( tr("Connect")); |
382 | return ; | 418 | return ; |
383 | } | 419 | } |
384 | remoteDirList("/") ; | 420 | remoteDirList("/") ; |
385 | setCaption(ftp_host); | 421 | setCaption(ftp_host); |
386 | writeConfig(); | 422 | writeConfig(); |
387 | connectServerBtn->setText( tr("Disconnect")); | 423 | connectServerBtn->setText( tr("Disconnect")); |
388 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 424 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
389 | } | 425 | } |
390 | 426 | ||
391 | void OpieFtp::disConnector() | 427 | void OpieFtp::disConnector() |
392 | { | 428 | { |
393 | if(conn) | 429 | if(conn) |
394 | FtpQuit(conn); | 430 | FtpQuit(conn); |
395 | setCaption("OpieFtp"); | 431 | setCaption("OpieFtp"); |
396 | currentRemoteDir="/"; | 432 | currentRemoteDir="/"; |
397 | Remote_View->clear(); | 433 | Remote_View->clear(); |
398 | connectServerBtn->setText( tr("Connect")); | 434 | connectServerBtn->setText( tr("Connect")); |
399 | connectServerBtn->setOn(FALSE); | 435 | connectServerBtn->setOn(FALSE); |
400 | } | 436 | } |
401 | 437 | ||
402 | void OpieFtp::localUpload() | 438 | void OpieFtp::localUpload() |
403 | { | 439 | { |
404 | int fsz; | 440 | int fsz; |
405 | QCopEnvelope ( "QPE/System", "busy()" ); | 441 | // QCopEnvelope ( "QPE/System", "busy()" ); |
406 | // qApp->processEvents(); | 442 | // qApp->processEvents(); |
407 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 443 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
408 | QListViewItemIterator it( Local_View ); | 444 | QListViewItemIterator it( Local_View ); |
409 | for ( ; it.current(); ++it ) { | 445 | for ( ; it.current(); ++it ) { |
410 | if ( it.current()->isSelected() ) { | 446 | if ( it.current()->isSelected() ) { |
411 | QString strItem = it.current()->text(0); | 447 | QString strItem = it.current()->text(0); |
412 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 448 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
413 | QString remoteFile= currentRemoteDir+strItem; | 449 | QString remoteFile= currentRemoteDir+strItem; |
414 | QFileInfo fi(localFile); | 450 | QFileInfo fi(localFile); |
415 | if( !fi.isDir()) { | 451 | if( !fi.isDir()) { |
416 | fsz=fi.size(); | 452 | fsz=fi.size(); |
417 | ProgressBar->setTotalSteps(fsz); | 453 | ProgressBar->setTotalSteps(fsz); |
@@ -429,40 +465,41 @@ void OpieFtp::localUpload() | |||
429 | QMessageBox::message(tr("Note"),msg); | 465 | QMessageBox::message(tr("Note"),msg); |
430 | } | 466 | } |
431 | } else { | 467 | } else { |
432 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 468 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
433 | } | 469 | } |
434 | ProgressBar->reset(); | 470 | ProgressBar->reset(); |
435 | nullifyCallBack(); | 471 | nullifyCallBack(); |
436 | } //end currentSelected | 472 | } //end currentSelected |
437 | it.current()->setSelected(FALSE); | 473 | it.current()->setSelected(FALSE); |
438 | } | 474 | } |
439 | TabWidget->setCurrentPage(1); | 475 | TabWidget->setCurrentPage(1); |
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 | } |
443 | 480 | ||
444 | void OpieFtp::nullifyCallBack() | 481 | void OpieFtp::nullifyCallBack() |
445 | { | 482 | { |
446 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 483 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); |
447 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 484 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
448 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 485 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); |
449 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 486 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
450 | } | 487 | } |
451 | 488 | ||
452 | void OpieFtp::remoteDownload() | 489 | void OpieFtp::remoteDownload() |
453 | { | 490 | { |
454 | // qApp->processEvents(); | 491 | // qApp->processEvents(); |
455 | int fsz; | 492 | int fsz; |
456 | QCopEnvelope ( "QPE/System", "busy()" ); | 493 | // QCopEnvelope ( "QPE/System", "busy()" ); |
457 | 494 | ||
458 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 495 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
459 | QListViewItemIterator it( Remote_View ); | 496 | QListViewItemIterator it( Remote_View ); |
460 | for ( ; it.current(); ++it ) { | 497 | for ( ; it.current(); ++it ) { |
461 | if ( it.current()->isSelected() ) { | 498 | if ( it.current()->isSelected() ) { |
462 | QString strItem = it.current()->text(0); | 499 | QString strItem = it.current()->text(0); |
463 | // strItem=strItem.right(strItem.length()-1); | 500 | // strItem=strItem.right(strItem.length()-1); |
464 | QString localFile = currentDir.canonicalPath(); | 501 | QString localFile = currentDir.canonicalPath(); |
465 | if(localFile.right(1).find("/",0,TRUE) == -1) | 502 | if(localFile.right(1).find("/",0,TRUE) == -1) |
466 | localFile += "/"; | 503 | localFile += "/"; |
467 | localFile += strItem; | 504 | localFile += strItem; |
468 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 505 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
@@ -483,61 +520,62 @@ void OpieFtp::remoteDownload() | |||
483 | QString msg; | 520 | QString msg; |
484 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 521 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
485 | msg.replace(QRegExp(":"),"\n"); | 522 | msg.replace(QRegExp(":"),"\n"); |
486 | QMessageBox::message(tr("Note"),msg); | 523 | QMessageBox::message(tr("Note"),msg); |
487 | } | 524 | } |
488 | ProgressBar->reset(); | 525 | ProgressBar->reset(); |
489 | nullifyCallBack(); | 526 | nullifyCallBack(); |
490 | } | 527 | } |
491 | it.current()->setSelected(FALSE); | 528 | it.current()->setSelected(FALSE); |
492 | } | 529 | } |
493 | TabWidget->setCurrentPage(0); | 530 | TabWidget->setCurrentPage(0); |
494 | populateLocalView(); | 531 | populateLocalView(); |
495 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 532 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
533 | |||
496 | } | 534 | } |
497 | 535 | ||
498 | bool OpieFtp::remoteDirList(const QString &dir) | 536 | bool OpieFtp::remoteDirList(const QString &dir) |
499 | { | 537 | { |
500 | QString tmp = QDir::homeDirPath(); | 538 | QString tmp = QDir::homeDirPath(); |
501 | if(tmp.right(1) != "/") | 539 | if(tmp.right(1) != "/") |
502 | tmp+="/._temp"; | 540 | tmp+="/._temp"; |
503 | else | 541 | else |
504 | tmp+="._temp"; | 542 | tmp+="._temp"; |
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) ) { |
508 | QString msg; | 546 | QString msg; |
509 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 547 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
510 | msg.replace(QRegExp(":"),"\n"); | 548 | msg.replace(QRegExp(":"),"\n"); |
511 | QMessageBox::message(tr("Note"),msg); | 549 | QMessageBox::message(tr("Note"),msg); |
512 | return false; | 550 | return false; |
513 | } | 551 | } |
514 | populateRemoteView() ; | 552 | populateRemoteView() ; |
515 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 553 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
516 | return true; | 554 | return true; |
517 | } | 555 | } |
518 | 556 | ||
519 | bool OpieFtp::remoteChDir(const QString &dir) | 557 | 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 )) { |
523 | QString msg; | 561 | QString msg; |
524 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 562 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
525 | msg.replace(QRegExp(":"),"\n"); | 563 | msg.replace(QRegExp(":"),"\n"); |
526 | QMessageBox::message(tr("Note"),msg); | 564 | QMessageBox::message(tr("Note"),msg); |
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; |
533 | } | 571 | } |
534 | 572 | ||
535 | void OpieFtp::populateLocalView() | 573 | void OpieFtp::populateLocalView() |
536 | { | 574 | { |
537 | Local_View->clear(); | 575 | Local_View->clear(); |
538 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 576 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
539 | currentDir.setMatchAllDirs(TRUE); | 577 | currentDir.setMatchAllDirs(TRUE); |
540 | currentDir.setNameFilter(filterStr); | 578 | currentDir.setNameFilter(filterStr); |
541 | QString fileL, fileS, fileDate; | 579 | QString fileL, fileS, fileDate; |
542 | bool isDir=FALSE; | 580 | bool isDir=FALSE; |
543 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 581 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
@@ -590,24 +628,25 @@ void OpieFtp::populateLocalView() | |||
590 | QPainter painter( &pm ); | 628 | QPainter painter( &pm ); |
591 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 629 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
592 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 630 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
593 | item->setPixmap( 0, pm); | 631 | item->setPixmap( 0, pm); |
594 | } | 632 | } |
595 | } | 633 | } |
596 | isDir=FALSE; | 634 | isDir=FALSE; |
597 | ++it; | 635 | ++it; |
598 | } | 636 | } |
599 | Local_View->setSorting( 3,FALSE); | 637 | Local_View->setSorting( 3,FALSE); |
600 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 638 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
601 | fillCombo( (const QString &)currentDir); | 639 | fillCombo( (const QString &)currentDir); |
640 | |||
602 | } | 641 | } |
603 | 642 | ||
604 | bool OpieFtp::populateRemoteView( ) | 643 | bool OpieFtp::populateRemoteView( ) |
605 | { | 644 | { |
606 | // qDebug("populate remoteview"); | 645 | // qDebug("populate remoteview"); |
607 | QString sfile=QDir::homeDirPath(); | 646 | QString sfile=QDir::homeDirPath(); |
608 | if(sfile.right(1) != "/") | 647 | if(sfile.right(1) != "/") |
609 | sfile+="/._temp"; | 648 | sfile+="/._temp"; |
610 | else | 649 | else |
611 | sfile+="._temp"; | 650 | sfile+="._temp"; |
612 | QFile file( sfile); | 651 | QFile file( sfile); |
613 | Remote_View->clear(); | 652 | Remote_View->clear(); |
@@ -690,25 +729,25 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
690 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 729 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
691 | } | 730 | } |
692 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory | 731 | } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory |
693 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { | 732 | if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { |
694 | currentRemoteDir = oldRemoteCurrentDir; | 733 | currentRemoteDir = oldRemoteCurrentDir; |
695 | strItem=""; | 734 | strItem=""; |
696 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); | 735 | // qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); |
697 | 736 | ||
698 | } else { | 737 | } else { |
699 | currentRemoteDir = currentRemoteDir+strItem; | 738 | currentRemoteDir = currentRemoteDir+strItem; |
700 | } | 739 | } |
701 | } else { | 740 | } else { |
702 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 741 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
703 | return; | 742 | return; |
704 | } | 743 | } |
705 | } | 744 | } |
706 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 745 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
707 | if(currentRemoteDir.right(1) !="/") | 746 | if(currentRemoteDir.right(1) !="/") |
708 | currentRemoteDir +="/"; | 747 | currentRemoteDir +="/"; |
709 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 748 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
710 | fillRemoteCombo( (const QString &)currentRemoteDir); | 749 | fillRemoteCombo( (const QString &)currentRemoteDir); |
711 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 750 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
712 | } | 751 | } |
713 | } | 752 | } |
714 | 753 | ||
@@ -742,24 +781,25 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) | |||
742 | populateLocalView(); | 781 | populateLocalView(); |
743 | } | 782 | } |
744 | } else { | 783 | } else { |
745 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 784 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
746 | if( QFile::exists(strItem ) ) { | 785 | if( QFile::exists(strItem ) ) { |
747 | // qDebug("upload "+strItem); | 786 | // qDebug("upload "+strItem); |
748 | return; | 787 | return; |
749 | } | 788 | } |
750 | } //end not symlink | 789 | } //end not symlink |
751 | chdir(strItem.latin1()); | 790 | chdir(strItem.latin1()); |
752 | } | 791 | } |
753 | } | 792 | } |
793 | |||
754 | } | 794 | } |
755 | 795 | ||
756 | void OpieFtp::doLocalCd() | 796 | void OpieFtp::doLocalCd() |
757 | { | 797 | { |
758 | localListClicked( Local_View->currentItem()); | 798 | localListClicked( Local_View->currentItem()); |
759 | } | 799 | } |
760 | 800 | ||
761 | void OpieFtp:: doRemoteCd() | 801 | void OpieFtp:: doRemoteCd() |
762 | { | 802 | { |
763 | remoteListClicked( Remote_View->currentItem()); | 803 | remoteListClicked( Remote_View->currentItem()); |
764 | 804 | ||
765 | } | 805 | } |
@@ -879,40 +919,40 @@ void OpieFtp::localDelete() | |||
879 | }; | 919 | }; |
880 | } | 920 | } |
881 | } | 921 | } |
882 | 922 | ||
883 | void OpieFtp::remoteMakDir() | 923 | void OpieFtp::remoteMakDir() |
884 | { | 924 | { |
885 | InputDialog *fileDlg; | 925 | InputDialog *fileDlg; |
886 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 926 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
887 | fileDlg->exec(); | 927 | fileDlg->exec(); |
888 | if( fileDlg->result() == 1 ) { | 928 | if( fileDlg->result() == 1 ) { |
889 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; | 929 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; |
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) { |
893 | QString msg; | 933 | QString msg; |
894 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); | 934 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); |
895 | msg.replace(QRegExp(":"),"\n"); | 935 | msg.replace(QRegExp(":"),"\n"); |
896 | QMessageBox::message(tr("Note"),msg); | 936 | QMessageBox::message(tr("Note"),msg); |
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 |
900 | } | 940 | } |
901 | } | 941 | } |
902 | 942 | ||
903 | void OpieFtp::remoteDelete() | 943 | void OpieFtp::remoteDelete() |
904 | { | 944 | { |
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) =="/") { |
908 | QString path= currentRemoteDir+f; | 948 | QString path= currentRemoteDir+f; |
909 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" | 949 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" |
910 | ,tr("Yes"),tr("No"),0,0,1) ) { | 950 | ,tr("Yes"),tr("No"),0,0,1) ) { |
911 | case 0: { | 951 | case 0: { |
912 | f=currentDir.canonicalPath()+"/"+f; | 952 | f=currentDir.canonicalPath()+"/"+f; |
913 | if(FtpRmdir( path.latin1(), conn) ==0) { | 953 | if(FtpRmdir( path.latin1(), conn) ==0) { |
914 | QString msg; | 954 | QString msg; |
915 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); | 955 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); |
916 | msg.replace(QRegExp(":"),"\n"); | 956 | msg.replace(QRegExp(":"),"\n"); |
917 | QMessageBox::message(tr("Note"),msg); | 957 | QMessageBox::message(tr("Note"),msg); |
918 | } | 958 | } |
@@ -927,45 +967,45 @@ void OpieFtp::remoteDelete() | |||
927 | QString path= currentRemoteDir+f; | 967 | QString path= currentRemoteDir+f; |
928 | if(FtpDelete( path.latin1(), conn)==0) { | 968 | if(FtpDelete( path.latin1(), conn)==0) { |
929 | QString msg; | 969 | QString msg; |
930 | msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); | 970 | msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); |
931 | msg.replace(QRegExp(":"),"\n"); | 971 | msg.replace(QRegExp(":"),"\n"); |
932 | QMessageBox::message(tr("Note"),msg); | 972 | QMessageBox::message(tr("Note"),msg); |
933 | } | 973 | } |
934 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 974 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
935 | } | 975 | } |
936 | break; | 976 | break; |
937 | }; | 977 | }; |
938 | } | 978 | } |
939 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 979 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
940 | } | 980 | } |
941 | 981 | ||
942 | void OpieFtp::remoteRename() | 982 | void OpieFtp::remoteRename() |
943 | { | 983 | { |
944 | QString curFile = Remote_View->currentItem()->text(0); | 984 | QString curFile = Remote_View->currentItem()->text(0); |
945 | InputDialog *fileDlg; | 985 | InputDialog *fileDlg; |
946 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 986 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
947 | fileDlg->setTextEdit((const QString &)curFile); | 987 | fileDlg->setTextEdit((const QString &)curFile); |
948 | fileDlg->exec(); | 988 | fileDlg->exec(); |
949 | if( fileDlg->result() == 1 ) { | 989 | if( fileDlg->result() == 1 ) { |
950 | QString oldName = currentRemoteDir +"/"+ curFile; | 990 | QString oldName = currentRemoteDir +"/"+ curFile; |
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) { |
954 | QString msg; | 994 | QString msg; |
955 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); | 995 | msg.sprintf(tr("Unable to rename file\n")+"%s",FtpLastResponse(conn)); |
956 | msg.replace(QRegExp(":"),"\n"); | 996 | msg.replace(QRegExp(":"),"\n"); |
957 | QMessageBox::message(tr("Note"),msg); | 997 | QMessageBox::message(tr("Note"),msg); |
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 |
961 | } | 1001 | } |
962 | } | 1002 | } |
963 | 1003 | ||
964 | void OpieFtp::localRename() | 1004 | void OpieFtp::localRename() |
965 | { | 1005 | { |
966 | QString curFile = Local_View->currentItem()->text(0); | 1006 | QString curFile = Local_View->currentItem()->text(0); |
967 | InputDialog *fileDlg; | 1007 | InputDialog *fileDlg; |
968 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 1008 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
969 | fileDlg->setTextEdit((const QString &)curFile); | 1009 | fileDlg->setTextEdit((const QString &)curFile); |
970 | fileDlg->exec(); | 1010 | fileDlg->exec(); |
971 | if( fileDlg->result() == 1 ) { | 1011 | if( fileDlg->result() == 1 ) { |
@@ -1182,12 +1222,68 @@ void OpieFtp::deleteServer() | |||
1182 | cfg.setGroup("Server"); | 1222 | cfg.setGroup("Server"); |
1183 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1223 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1184 | for (int i = 0; i <= numberOfEntries; i++) { | 1224 | for (int i = 0; i <= numberOfEntries; i++) { |
1185 | temp.setNum(i+1); | 1225 | temp.setNum(i+1); |
1186 | cfg.setGroup("Server"); | 1226 | cfg.setGroup("Server"); |
1187 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 | 1227 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 |
1188 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 | 1228 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 |
1189 | && !remoteServerStr.isEmpty()) { | 1229 | && !remoteServerStr.isEmpty()) { |
1190 | qDebug(temp); | 1230 | qDebug(temp); |
1191 | } | 1231 | } |
1192 | } | 1232 | } |
1193 | } | 1233 | } |
1234 | |||
1235 | void 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 | |||
1272 | void OpieFtp::docButtonPushed() { | ||
1273 | QString current = QPEApplication::documentDir(); | ||
1274 | chdir( current.latin1() ); | ||
1275 | currentDir.cd( current, TRUE); | ||
1276 | populateLocalView(); | ||
1277 | update(); | ||
1278 | |||
1279 | } | ||
1280 | |||
1281 | void 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 | |||
@@ -51,28 +51,32 @@ public: | |||
51 | QWidget *tab, *tab_2, *tab_3; | 51 | QWidget *tab, *tab_2, *tab_3; |
52 | QListView *Local_View, *Remote_View; | 52 | QListView *Local_View, *Remote_View; |
53 | 53 | ||
54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; | 54 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
55 | QLineEdit *PasswordEdit, *remotePath; | 55 | QLineEdit *PasswordEdit, *remotePath; |
56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 56 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
57 | QSpinBox* PortSpinBox; | 57 | QSpinBox* PortSpinBox; |
58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; | 58 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu; |
59 | QDir currentDir; | 59 | QDir currentDir; |
60 | QString currentRemoteDir; | 60 | QString currentRemoteDir; |
61 | QString filterStr; | 61 | QString filterStr; |
62 | QListViewItem * item; | 62 | QListViewItem * item; |
63 | QPushButton *connectServerBtn; | 63 | QPushButton *connectServerBtn, *cdUpButton, *homeButton, *docButton; |
64 | bool b; | 64 | bool b; |
65 | int currentServerConfig; | 65 | int currentServerConfig; |
66 | protected slots: | 66 | protected slots: |
67 | void upDir(); | ||
68 | void homeButtonPushed(); | ||
69 | void docButtonPushed(); | ||
70 | |||
67 | void serverComboEdited(const QString & ); | 71 | void serverComboEdited(const QString & ); |
68 | void showLocalMenu( QListViewItem *); | 72 | void showLocalMenu( QListViewItem *); |
69 | void showRemoteMenu( QListViewItem *); | 73 | void showRemoteMenu( QListViewItem *); |
70 | void doLocalCd(); | 74 | void doLocalCd(); |
71 | void doRemoteCd(); | 75 | void doRemoteCd(); |
72 | void localUpload(); | 76 | void localUpload(); |
73 | void remoteDownload(); | 77 | void remoteDownload(); |
74 | void newConnection(); | 78 | void newConnection(); |
75 | void connector(); | 79 | void connector(); |
76 | void disConnector(); | 80 | void disConnector(); |
77 | void populateLocalView(); | 81 | void populateLocalView(); |
78 | bool populateRemoteView(); | 82 | bool populateRemoteView(); |