summaryrefslogtreecommitdiff
authorskyhusker <skyhusker>2005-04-10 21:19:22 (UTC)
committer skyhusker <skyhusker>2005-04-10 21:19:22 (UTC)
commitd133e1f4c2b820ca428438cb17f5477190d268b1 (patch) (unidiff)
treeaa078c18de7bef76f37af9133f413f8bff478a1e
parenta6670730bf0b36b243303e581c4a80d29851c12b (diff)
downloadopie-d133e1f4c2b820ca428438cb17f5477190d268b1.zip
opie-d133e1f4c2b820ca428438cb17f5477190d268b1.tar.gz
opie-d133e1f4c2b820ca428438cb17f5477190d268b1.tar.bz2
Move to home directory on startup. Fixes bug #1614.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp5
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
@@ -419,192 +419,197 @@ void MainWindow::slotConnect() {
419 419
420void MainWindow::slotDisconnect() { 420void MainWindow::slotDisconnect() {
421 if ( currentSession() ) { 421 if ( currentSession() ) {
422 currentSession()->layer()->close(); 422 currentSession()->layer()->close();
423 m_connect->setEnabled( true ); 423 m_connect->setEnabled( true );
424 m_disconnect->setEnabled( false ); 424 m_disconnect->setEnabled( false );
425 m_transfer->setEnabled( false ); 425 m_transfer->setEnabled( false );
426 m_recordScript->setEnabled( false); 426 m_recordScript->setEnabled( false);
427 m_saveScript->setEnabled( false ); 427 m_saveScript->setEnabled( false );
428 m_scripts->setItemEnabled(m_runScript_id, false); 428 m_scripts->setItemEnabled(m_runScript_id, false);
429 } 429 }
430} 430}
431 431
432void MainWindow::slotTerminate() { 432void MainWindow::slotTerminate() {
433 if ( currentSession() ) 433 if ( currentSession() )
434 currentSession()->layer()->close(); 434 currentSession()->layer()->close();
435 435
436 slotClose(); 436 slotClose();
437 /* FIXME move to the next session */ 437 /* FIXME move to the next session */
438} 438}
439 439
440 440
441 441
442void MainWindow::slotQuickLaunch() { 442void MainWindow::slotQuickLaunch() {
443 443
444 Profile prof = manager()->profile( "default" ); 444 Profile prof = manager()->profile( "default" );
445 if ( prof.name() == "default" ) { 445 if ( prof.name() == "default" ) {
446 create( prof ); 446 create( prof );
447 } else { 447 } else {
448 #ifndef EAST 448 #ifndef EAST
449 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); 449 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 );
450 newProf.setAutoConnect( true ); 450 newProf.setAutoConnect( true );
451 create( newProf ); 451 create( newProf );
452 slotSaveSession(); 452 slotSaveSession();
453 #endif 453 #endif
454 } 454 }
455} 455}
456 456
457void MainWindow::slotConfigure() { 457void 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 */
475void MainWindow::slotClose() { 475void 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 */
507void MainWindow::slotProfile( int id) { 507void 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
514void MainWindow::create( const Profile& prof ) { 514void 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
564void MainWindow::slotTransfer() 569void 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}
579 584
580 585
581void MainWindow::slotOpenKeb(bool state) { 586void MainWindow::slotOpenKeb(bool state) {
582 587
583 if (state) m_keyBar->show(); 588 if (state) m_keyBar->show();
584 else m_keyBar->hide(); 589 else m_keyBar->hide();
585 590
586} 591}
587 592
588 593
589void MainWindow::slotOpenButtons( bool state ) { 594void MainWindow::slotOpenButtons( bool state ) {
590 595
591 if ( state ) { 596 if ( state ) {
592 m_buttonBar->show(); 597 m_buttonBar->show();
593 } else { 598 } else {
594 m_buttonBar->hide(); 599 m_buttonBar->hide();
595 } 600 }
596} 601}
597 602
598 603
599 604
600void MainWindow::slotSessionChanged( Session* ses ) { 605void MainWindow::slotSessionChanged( Session* ses ) {
601 if(m_curSession) 606 if(m_curSession)
602 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); 607 if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide();
603 if(ses) 608 if(ses)
604 if(ses->transferDialog()) ses->transferDialog()->show(); 609 if(ses->transferDialog()) ses->transferDialog()->show();
605 610
606 if ( ses ) { 611 if ( ses ) {
607 m_curSession = ses; 612 m_curSession = ses;
608 if ( m_curSession->layer()->isConnected() ) { 613 if ( m_curSession->layer()->isConnected() ) {
609 m_connect->setEnabled( false ); 614 m_connect->setEnabled( false );
610 m_disconnect->setEnabled( true ); 615 m_disconnect->setEnabled( true );