author | llornkcor <llornkcor> | 2004-07-07 21:11:13 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-07 21:11:13 (UTC) |
commit | debb74bbf33b42d1ad38f4437cf9ad054978d71b (patch) (unidiff) | |
tree | cc34b697970b78c5573700057088b18c53e3c781 | |
parent | 8ff360bd5e136aba5a9c1b340040ecaf0fc6e0d4 (diff) | |
download | opie-debb74bbf33b42d1ad38f4437cf9ad054978d71b.zip opie-debb74bbf33b42d1ad38f4437cf9ad054978d71b.tar.gz opie-debb74bbf33b42d1ad38f4437cf9ad054978d71b.tar.bz2 |
hide path combo if on config tab
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 58ffe3a..b703217 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -274,210 +274,213 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
274 | PortSpinBox->setMaxValue(32786); | 274 | PortSpinBox->setMaxValue(32786); |
275 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 275 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
276 | 276 | ||
277 | serverListView = new QListBox( tab_3, "ServerListView" ); | 277 | serverListView = new QListBox( tab_3, "ServerListView" ); |
278 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); | 278 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
279 | 279 | ||
280 | connect( serverListView, SIGNAL( highlighted(const QString&)), | 280 | connect( serverListView, SIGNAL( highlighted(const QString&)), |
281 | this,SLOT( serverListClicked(const QString&) ) ); | 281 | this,SLOT( serverListClicked(const QString&) ) ); |
282 | 282 | ||
283 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); | 283 | connectServerBtn = new QPushButton( tr("Connect"), tab_3 , "ConnectButton" ); |
284 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); | 284 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
285 | connectServerBtn->setToggleButton(TRUE); | 285 | connectServerBtn->setToggleButton(TRUE); |
286 | connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); | 286 | connect(connectServerBtn,SIGNAL( toggled(bool)),SLOT( connectorBtnToggled(bool) )); |
287 | 287 | ||
288 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); | 288 | newServerButton= new QPushButton( tr("Add"), tab_3 , "NewServerButton" ); |
289 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | 289 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); |
290 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | 290 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); |
291 | 291 | ||
292 | QPushButton *deleteServerBtn; | 292 | QPushButton *deleteServerBtn; |
293 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); | 293 | deleteServerBtn = new QPushButton( tr("Delete"), tab_3 , "OpenButton" ); |
294 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | 294 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); |
295 | 295 | ||
296 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 296 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
297 | 297 | ||
298 | 298 | ||
299 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 299 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
300 | tabLayout_3->addItem( spacer, 5, 0 ); | 300 | tabLayout_3->addItem( spacer, 5, 0 ); |
301 | 301 | ||
302 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 302 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
303 | 303 | ||
304 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)), | 304 | connect(TabWidget,SIGNAL(currentChanged(QWidget*)), |
305 | this,SLOT(tabChanged(QWidget*))); | 305 | this,SLOT(tabChanged(QWidget*))); |
306 | 306 | ||
307 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 307 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
308 | currentDir.setPath( QDir::currentDirPath()); | 308 | currentDir.setPath( QDir::currentDirPath()); |
309 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 309 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
310 | 310 | ||
311 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); | 311 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); |
312 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 312 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
313 | currentPathCombo ->setFixedWidth(220); | 313 | currentPathCombo ->setFixedWidth(220); |
314 | currentPathCombo->setEditable(TRUE); | 314 | currentPathCombo->setEditable(TRUE); |
315 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 315 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
316 | 316 | ||
317 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 317 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
318 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 318 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
319 | 319 | ||
320 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 320 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
321 | this,SLOT(currentPathComboChanged())); | 321 | this,SLOT(currentPathComboChanged())); |
322 | ProgressBar = new QProgressBar( view, "ProgressBar" ); | 322 | ProgressBar = new QProgressBar( view, "ProgressBar" ); |
323 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 323 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
324 | ProgressBar->setMaximumHeight(10); | 324 | ProgressBar->setMaximumHeight(10); |
325 | filterStr="*"; | 325 | filterStr="*"; |
326 | b=FALSE; | 326 | b=FALSE; |
327 | populateLocalView(); | 327 | populateLocalView(); |
328 | readConfig(); | 328 | readConfig(); |
329 | 329 | ||
330 | // ServerComboBox->setCurrentItem(currentServerConfig); | 330 | // ServerComboBox->setCurrentItem(currentServerConfig); |
331 | 331 | ||
332 | TabWidget->setCurrentPage(2); | 332 | TabWidget->setCurrentPage(2); |
333 | odebug << "Constructor done" << oendl; | 333 | odebug << "Constructor done" << oendl; |
334 | } | 334 | } |
335 | 335 | ||
336 | OpieFtp::~OpieFtp() | 336 | OpieFtp::~OpieFtp() |
337 | { | 337 | { |
338 | } | 338 | } |
339 | 339 | ||
340 | void OpieFtp::cleanUp() | 340 | void OpieFtp::cleanUp() |
341 | { | 341 | { |
342 | if(conn) | 342 | if(conn) |
343 | FtpQuit(conn); | 343 | FtpQuit(conn); |
344 | QString sfile=QDir::homeDirPath(); | 344 | QString sfile=QDir::homeDirPath(); |
345 | if(sfile.right(1) != "/") | 345 | if(sfile.right(1) != "/") |
346 | sfile+="/._temp"; | 346 | sfile+="/._temp"; |
347 | else | 347 | else |
348 | sfile+="._temp"; | 348 | sfile+="._temp"; |
349 | QFile file( sfile); | 349 | QFile file( sfile); |
350 | if(file.exists()) | 350 | if(file.exists()) |
351 | file.remove(); | 351 | file.remove(); |
352 | Config cfg("opieftp"); | 352 | Config cfg("opieftp"); |
353 | cfg.setGroup("Server"); | 353 | cfg.setGroup("Server"); |
354 | cfg.writeEntry("currentServer", currentServerConfig); | 354 | cfg.writeEntry("currentServer", currentServerConfig); |
355 | 355 | ||
356 | exit(0); | 356 | exit(0); |
357 | } | 357 | } |
358 | 358 | ||
359 | void OpieFtp::tabChanged(QWidget *) | 359 | void OpieFtp::tabChanged(QWidget *) |
360 | { | 360 | { |
361 | if (TabWidget->currentPageIndex() == 0) { | 361 | if (TabWidget->currentPageIndex() == 0) { |
362 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 362 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
363 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 363 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
364 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 364 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
365 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 365 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
366 | if(cdUpButton->isHidden()) | 366 | if(cdUpButton->isHidden()) |
367 | cdUpButton->show(); | 367 | cdUpButton->show(); |
368 | if(homeButton->isHidden()) | 368 | if(homeButton->isHidden()) |
369 | homeButton->show(); | 369 | homeButton->show(); |
370 | if(currentPathCombo->isHidden()) currentPathCombo->show(); | ||
370 | 371 | ||
371 | } | 372 | } |
372 | if (TabWidget->currentPageIndex() == 1) { | 373 | if (TabWidget->currentPageIndex() == 1) { |
373 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); | 374 | currentPathCombo->lineEdit()->setText( currentRemoteDir ); |
374 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 375 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
375 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 376 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
376 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 377 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
377 | if(cdUpButton->isHidden()) | 378 | if(cdUpButton->isHidden()) |
378 | cdUpButton->show(); | 379 | cdUpButton->show(); |
379 | homeButton->hide(); | 380 | homeButton->hide(); |
381 | if(currentPathCombo->isHidden()) currentPathCombo->show(); | ||
380 | 382 | ||
381 | } | 383 | } |
382 | if (TabWidget->currentPageIndex() == 2) { | 384 | if (TabWidget->currentPageIndex() == 2) { |
383 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 385 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
384 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 386 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
385 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 387 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
386 | cdUpButton->hide(); | 388 | cdUpButton->hide(); |
387 | homeButton->hide(); | 389 | homeButton->hide(); |
390 | if(!currentPathCombo->isHidden()) currentPathCombo->hide(); | ||
388 | } | 391 | } |
389 | } | 392 | } |
390 | 393 | ||
391 | void OpieFtp::newConnection() | 394 | void OpieFtp::newConnection() |
392 | { | 395 | { |
393 | UsernameComboBox->lineEdit()->setText(""); | 396 | UsernameComboBox->lineEdit()->setText(""); |
394 | PasswordEdit->setText( "" ); | 397 | PasswordEdit->setText( "" ); |
395 | ServerComboBox->lineEdit()->setText( ""); | 398 | ServerComboBox->lineEdit()->setText( ""); |
396 | remotePath->setText( currentRemoteDir = "/"); | 399 | remotePath->setText( currentRemoteDir = "/"); |
397 | PortSpinBox->setValue( 21); | 400 | PortSpinBox->setValue( 21); |
398 | TabWidget->setCurrentPage(2); | 401 | TabWidget->setCurrentPage(2); |
399 | } | 402 | } |
400 | 403 | ||
401 | void OpieFtp::serverComboEdited(const QString & ) | 404 | void OpieFtp::serverComboEdited(const QString & ) |
402 | { | 405 | { |
403 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 406 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
404 | // odebug << "ServerComboEdited" << oendl; | 407 | // odebug << "ServerComboEdited" << oendl; |
405 | // // currentServerConfig = -1; | 408 | // // currentServerConfig = -1; |
406 | // } | 409 | // } |
407 | } | 410 | } |
408 | 411 | ||
409 | void OpieFtp::UsernameComboBoxEdited(const QString &) { | 412 | void OpieFtp::UsernameComboBoxEdited(const QString &) { |
410 | // currentServerConfig = -1; | 413 | // currentServerConfig = -1; |
411 | } | 414 | } |
412 | 415 | ||
413 | void OpieFtp::PasswordEditEdited(const QString & ) { | 416 | void OpieFtp::PasswordEditEdited(const QString & ) { |
414 | // currentServerConfig = -1; | 417 | // currentServerConfig = -1; |
415 | } | 418 | } |
416 | 419 | ||
417 | void OpieFtp::connectorBtnToggled(bool On) | 420 | void OpieFtp::connectorBtnToggled(bool On) |
418 | { | 421 | { |
419 | if(On) { | 422 | if(On) { |
420 | connector(); | 423 | connector(); |
421 | } else { | 424 | } else { |
422 | disConnector(); | 425 | disConnector(); |
423 | } | 426 | } |
424 | 427 | ||
425 | } | 428 | } |
426 | 429 | ||
427 | void OpieFtp::connector() | 430 | void OpieFtp::connector() |
428 | { | 431 | { |
429 | // QCopEnvelope ( "QPE/System", "busy()" ); | 432 | // QCopEnvelope ( "QPE/System", "busy()" ); |
430 | // qApp->processEvents(); | 433 | // qApp->processEvents(); |
431 | currentRemoteDir=remotePath->text(); | 434 | currentRemoteDir=remotePath->text(); |
432 | 435 | ||
433 | if( ServerComboBox->currentText().isEmpty()) { | 436 | if( ServerComboBox->currentText().isEmpty()) { |
434 | 437 | ||
435 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 438 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
436 | TabWidget->setCurrentPage(2); | 439 | TabWidget->setCurrentPage(2); |
437 | ServerComboBox->setFocus(); | 440 | ServerComboBox->setFocus(); |
438 | connectServerBtn->setOn(FALSE); | 441 | connectServerBtn->setOn(FALSE); |
439 | connectServerBtn->setText( tr("Connect")); | 442 | connectServerBtn->setText( tr("Connect")); |
440 | return; | 443 | return; |
441 | } | 444 | } |
442 | 445 | ||
443 | FtpInit(); | 446 | FtpInit(); |
444 | 447 | ||
445 | TabWidget->setCurrentPage(1); | 448 | TabWidget->setCurrentPage(1); |
446 | QString ftp_host = ServerComboBox->currentText(); | 449 | QString ftp_host = ServerComboBox->currentText(); |
447 | QString ftp_user = UsernameComboBox->currentText(); | 450 | QString ftp_user = UsernameComboBox->currentText(); |
448 | QString ftp_pass = PasswordEdit->text(); | 451 | QString ftp_pass = PasswordEdit->text(); |
449 | QString port=PortSpinBox->cleanText(); | 452 | QString port=PortSpinBox->cleanText(); |
450 | port.stripWhiteSpace(); | 453 | port.stripWhiteSpace(); |
451 | 454 | ||
452 | Config cfg("opieftp"); | 455 | Config cfg("opieftp"); |
453 | cfg.setGroup("Server"); | 456 | cfg.setGroup("Server"); |
454 | // int current=cfg.readNumEntry("currentServer", 1); | 457 | // int current=cfg.readNumEntry("currentServer", 1); |
455 | 458 | ||
456 | // if(ftp_host!= cfg.readEntry(QString::number( current))) | 459 | // if(ftp_host!= cfg.readEntry(QString::number( current))) |
457 | // currentServerConfig=-1; | 460 | // currentServerConfig=-1; |
458 | // cfg.setGroup(QString::number(current)); | 461 | // cfg.setGroup(QString::number(current)); |
459 | // if( ftp_user != cfg.readEntry("Username")) | 462 | // if( ftp_user != cfg.readEntry("Username")) |
460 | // currentServerConfig=-1; | 463 | // currentServerConfig=-1; |
461 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) | 464 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) |
462 | // currentServerConfig=-1; | 465 | // currentServerConfig=-1; |
463 | 466 | ||
464 | 467 | ||
465 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 468 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
466 | ftp_host=ftp_host.right(ftp_host.length()-6); | 469 | ftp_host=ftp_host.right(ftp_host.length()-6); |
467 | ftp_host+=":"+port; | 470 | ftp_host+=":"+port; |
468 | 471 | ||
469 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 472 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
470 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | 473 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); |
471 | connectServerBtn->setOn(FALSE); | 474 | connectServerBtn->setOn(FALSE); |
472 | connectServerBtn->setText( tr("Connect")); | 475 | connectServerBtn->setText( tr("Connect")); |
473 | return ; | 476 | return ; |
474 | } | 477 | } |
475 | 478 | ||
476 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 479 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
477 | QString msg; | 480 | QString msg; |
478 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 481 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
479 | msg.replace(QRegExp(":"),"\n"); | 482 | msg.replace(QRegExp(":"),"\n"); |
480 | QMessageBox::message(tr("Note"),msg); | 483 | QMessageBox::message(tr("Note"),msg); |
481 | if(conn) | 484 | if(conn) |
482 | FtpQuit(conn); | 485 | FtpQuit(conn); |
483 | connectServerBtn->setOn(FALSE); | 486 | connectServerBtn->setOn(FALSE); |