-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 21de5c0..eaa78c8 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -451,128 +451,133 @@ void MainWindow::slotQuickLaunch() { | |||
451 | create( newProf ); | 451 | create( newProf ); |
452 | slotSaveSession(); | 452 | slotSaveSession(); |
453 | #endif | 453 | #endif |
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | void MainWindow::slotConfigure() { | 457 | void MainWindow::slotConfigure() { |
458 | ConfigDialog conf( manager()->all(), factory() ); | 458 | ConfigDialog conf( manager()->all(), factory() ); |
459 | 459 | ||
460 | int ret = QPEApplication::execDialog( &conf ); | 460 | int ret = QPEApplication::execDialog( &conf ); |
461 | 461 | ||
462 | if ( QDialog::Accepted == ret ) { | 462 | if ( QDialog::Accepted == ret ) { |
463 | manager()->setProfiles( conf.list() ); | 463 | manager()->setProfiles( conf.list() ); |
464 | manager()->save(); | 464 | manager()->save(); |
465 | populateProfiles(); | 465 | populateProfiles(); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | /* | 468 | /* |
469 | * we will remove | 469 | * we will remove |
470 | * this window from the tabwidget | 470 | * this window from the tabwidget |
471 | * remove it from the list | 471 | * remove it from the list |
472 | * delete it | 472 | * delete it |
473 | * and set the currentSession() | 473 | * and set the currentSession() |
474 | */ | 474 | */ |
475 | void MainWindow::slotClose() { | 475 | void MainWindow::slotClose() { |
476 | if (!currentSession() ) | 476 | if (!currentSession() ) |
477 | return; | 477 | return; |
478 | 478 | ||
479 | Session* ses = currentSession(); | 479 | Session* ses = currentSession(); |
480 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 480 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
481 | m_curSession = NULL; | 481 | m_curSession = NULL; |
482 | tabWidget()->remove( /*currentSession()*/ses ); | 482 | tabWidget()->remove( /*currentSession()*/ses ); |
483 | /*it's autodelete */ | 483 | /*it's autodelete */ |
484 | m_sessions.remove( ses ); | 484 | m_sessions.remove( ses ); |
485 | 485 | ||
486 | if (!currentSession() ) { | 486 | if (!currentSession() ) { |
487 | m_connect->setEnabled( false ); | 487 | m_connect->setEnabled( false ); |
488 | m_disconnect->setEnabled( false ); | 488 | m_disconnect->setEnabled( false ); |
489 | m_terminate->setEnabled( false ); | 489 | m_terminate->setEnabled( false ); |
490 | m_transfer->setEnabled( false ); | 490 | m_transfer->setEnabled( false ); |
491 | m_recordScript->setEnabled( false ); | 491 | m_recordScript->setEnabled( false ); |
492 | m_saveScript->setEnabled( false ); | 492 | m_saveScript->setEnabled( false ); |
493 | m_scripts->setItemEnabled(m_runScript_id, false); | 493 | m_scripts->setItemEnabled(m_runScript_id, false); |
494 | m_fullscreen->setEnabled( false ); | 494 | m_fullscreen->setEnabled( false ); |
495 | m_wrap->setEnabled( false ); | 495 | m_wrap->setEnabled( false ); |
496 | m_closewindow->setEnabled( false ); | 496 | m_closewindow->setEnabled( false ); |
497 | } | 497 | } |
498 | 498 | ||
499 | m_kb->loadDefaults(); | 499 | m_kb->loadDefaults(); |
500 | } | 500 | } |
501 | 501 | ||
502 | /* | 502 | /* |
503 | * We will get the name | 503 | * We will get the name |
504 | * Then the profile | 504 | * Then the profile |
505 | * and then we will make a profile | 505 | * and then we will make a profile |
506 | */ | 506 | */ |
507 | void MainWindow::slotProfile( int id) { | 507 | void MainWindow::slotProfile( int id) { |
508 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 508 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
509 | create( prof ); | 509 | create( prof ); |
510 | } | 510 | } |
511 | 511 | ||
512 | 512 | ||
513 | 513 | ||
514 | void MainWindow::create( const Profile& prof ) { | 514 | void MainWindow::create( const Profile& prof ) { |
515 | char *homeDir = getenv("HOME"); | ||
516 | |||
517 | if ( homeDir ) | ||
518 | ::chdir( homeDir ); | ||
519 | |||
515 | if(m_curSession) | 520 | if(m_curSession) |
516 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 521 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
517 | 522 | ||
518 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 523 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
519 | 524 | ||
520 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 525 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
521 | { | 526 | { |
522 | QMessageBox::warning(this, | 527 | QMessageBox::warning(this, |
523 | QObject::tr("Session failed"), | 528 | QObject::tr("Session failed"), |
524 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 529 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
525 | //if(ses) delete ses; | 530 | //if(ses) delete ses; |
526 | return; | 531 | return; |
527 | } | 532 | } |
528 | 533 | ||
529 | m_sessions.append( ses ); | 534 | m_sessions.append( ses ); |
530 | tabWidget()->add( ses ); | 535 | tabWidget()->add( ses ); |
531 | tabWidget()->repaint(); | 536 | tabWidget()->repaint(); |
532 | m_curSession = ses; | 537 | m_curSession = ses; |
533 | 538 | ||
534 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 539 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
535 | m_connect->setEnabled( true ); | 540 | m_connect->setEnabled( true ); |
536 | m_disconnect->setEnabled( false ); | 541 | m_disconnect->setEnabled( false ); |
537 | m_terminate->setEnabled( true ); | 542 | m_terminate->setEnabled( true ); |
538 | m_fullscreen->setEnabled( true ); | 543 | m_fullscreen->setEnabled( true ); |
539 | m_wrap->setEnabled( true ); | 544 | m_wrap->setEnabled( true ); |
540 | m_closewindow->setEnabled( true ); | 545 | m_closewindow->setEnabled( true ); |
541 | m_transfer->setEnabled( false ); | 546 | m_transfer->setEnabled( false ); |
542 | m_recordScript->setEnabled( false ); | 547 | m_recordScript->setEnabled( false ); |
543 | m_saveScript->setEnabled( false ); | 548 | m_saveScript->setEnabled( false ); |
544 | m_scripts->setItemEnabled(m_runScript_id, false); | 549 | m_scripts->setItemEnabled(m_runScript_id, false); |
545 | 550 | ||
546 | // is io_layer wants direct connection, then autoconnect | 551 | // is io_layer wants direct connection, then autoconnect |
547 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 552 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
548 | if (prof.autoConnect()) { | 553 | if (prof.autoConnect()) { |
549 | slotConnect(); | 554 | slotConnect(); |
550 | } | 555 | } |
551 | 556 | ||
552 | QWidget *w = currentSession()->widget(); | 557 | QWidget *w = currentSession()->widget(); |
553 | if(w) w->setFocus(); | 558 | if(w) w->setFocus(); |
554 | 559 | ||
555 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 560 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
556 | m_isWrapped = true; | 561 | m_isWrapped = true; |
557 | } else { | 562 | } else { |
558 | m_isWrapped = false; | 563 | m_isWrapped = false; |
559 | } | 564 | } |
560 | 565 | ||
561 | m_kb->load(currentSession()->profile()); | 566 | m_kb->load(currentSession()->profile()); |
562 | } | 567 | } |
563 | 568 | ||
564 | void MainWindow::slotTransfer() | 569 | void MainWindow::slotTransfer() |
565 | { | 570 | { |
566 | if ( currentSession() ) { | 571 | if ( currentSession() ) { |
567 | Session *mysession = currentSession(); | 572 | Session *mysession = currentSession(); |
568 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); | 573 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); |
569 | mysession->setTransferDialog(&dlg); | 574 | mysession->setTransferDialog(&dlg); |
570 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); | 575 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); |
571 | //dlg.showMaximized(); | 576 | //dlg.showMaximized(); |
572 | currentSession()->widgetStack()->addWidget(&dlg, -1); | 577 | currentSession()->widgetStack()->addWidget(&dlg, -1); |
573 | dlg.show(); | 578 | dlg.show(); |
574 | //dlg.exec(); | 579 | //dlg.exec(); |
575 | while(dlg.isRunning()) qApp->processEvents(); | 580 | while(dlg.isRunning()) qApp->processEvents(); |
576 | mysession->setTransferDialog(0l); | 581 | mysession->setTransferDialog(0l); |
577 | } | 582 | } |
578 | } | 583 | } |