-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 | |||
@@ -323,384 +323,389 @@ void MainWindow::populateScripts() { | |||
323 | MainWindow::~MainWindow() { | 323 | MainWindow::~MainWindow() { |
324 | delete m_factory; | 324 | delete m_factory; |
325 | manager()->save(); | 325 | manager()->save(); |
326 | #ifdef FSCKED_DISTRI | 326 | #ifdef FSCKED_DISTRI |
327 | FixIt fix; | 327 | FixIt fix; |
328 | fix.breakIt(); | 328 | fix.breakIt(); |
329 | #endif | 329 | #endif |
330 | } | 330 | } |
331 | 331 | ||
332 | MetaFactory* MainWindow::factory() { | 332 | MetaFactory* MainWindow::factory() { |
333 | return m_factory; | 333 | return m_factory; |
334 | } | 334 | } |
335 | 335 | ||
336 | Session* MainWindow::currentSession() { | 336 | Session* MainWindow::currentSession() { |
337 | return m_curSession; | 337 | return m_curSession; |
338 | } | 338 | } |
339 | 339 | ||
340 | QList<Session> MainWindow::sessions() { | 340 | QList<Session> MainWindow::sessions() { |
341 | return m_sessions; | 341 | return m_sessions; |
342 | } | 342 | } |
343 | 343 | ||
344 | void MainWindow::slotNew() { | 344 | void MainWindow::slotNew() { |
345 | ProfileEditorDialog dlg(factory() ); | 345 | ProfileEditorDialog dlg(factory() ); |
346 | dlg.setCaption( tr("New Connection") ); | 346 | dlg.setCaption( tr("New Connection") ); |
347 | int ret = QPEApplication::execDialog( &dlg ); | 347 | int ret = QPEApplication::execDialog( &dlg ); |
348 | 348 | ||
349 | if ( ret == QDialog::Accepted ) { | 349 | if ( ret == QDialog::Accepted ) { |
350 | create( dlg.profile() ); | 350 | create( dlg.profile() ); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
354 | void MainWindow::slotRecordScript() { | 354 | void MainWindow::slotRecordScript() { |
355 | if (currentSession()) { | 355 | if (currentSession()) { |
356 | currentSession()->emulationHandler()->startRecording(); | 356 | currentSession()->emulationHandler()->startRecording(); |
357 | m_saveScript->setEnabled(true); | 357 | m_saveScript->setEnabled(true); |
358 | m_recordScript->setEnabled(false); | 358 | m_recordScript->setEnabled(false); |
359 | } | 359 | } |
360 | } | 360 | } |
361 | 361 | ||
362 | void MainWindow::slotSaveScript() { | 362 | void MainWindow::slotSaveScript() { |
363 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 363 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
364 | QMap<QString, QStringList> map; | 364 | QMap<QString, QStringList> map; |
365 | QStringList text; | 365 | QStringList text; |
366 | text << "text/plain"; | 366 | text << "text/plain"; |
367 | map.insert(tr("Script"), text ); | 367 | map.insert(tr("Script"), text ); |
368 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 368 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
369 | if (!filename.isEmpty()) { | 369 | if (!filename.isEmpty()) { |
370 | QFileInfo info(filename); | 370 | QFileInfo info(filename); |
371 | if (info.extension(FALSE) != "script") | 371 | if (info.extension(FALSE) != "script") |
372 | filename += ".script"; | 372 | filename += ".script"; |
373 | DocLnk nf; | 373 | DocLnk nf; |
374 | nf.setType("text/plain"); | 374 | nf.setType("text/plain"); |
375 | nf.setFile(filename); | 375 | nf.setFile(filename); |
376 | nf.setName(info.fileName()); | 376 | nf.setName(info.fileName()); |
377 | FileManager fm; | 377 | FileManager fm; |
378 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 378 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
379 | currentSession()->emulationHandler()->clearScript(); | 379 | currentSession()->emulationHandler()->clearScript(); |
380 | m_saveScript->setEnabled(false); | 380 | m_saveScript->setEnabled(false); |
381 | m_recordScript->setEnabled(true); | 381 | m_recordScript->setEnabled(true); |
382 | populateScripts(); | 382 | populateScripts(); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | void MainWindow::slotRunScript(int id) { | 387 | void MainWindow::slotRunScript(int id) { |
388 | if (currentSession()) { | 388 | if (currentSession()) { |
389 | int index = m_scriptsPop->indexOf(id); | 389 | int index = m_scriptsPop->indexOf(id); |
390 | DocLnk *lnk = m_scriptsData.at(index); | 390 | DocLnk *lnk = m_scriptsData.at(index); |
391 | QString filePath = lnk->file(); | 391 | QString filePath = lnk->file(); |
392 | Script script(filePath); | 392 | Script script(filePath); |
393 | currentSession()->emulationHandler()->runScript(&script); | 393 | currentSession()->emulationHandler()->runScript(&script); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | void MainWindow::slotConnect() { | 397 | void MainWindow::slotConnect() { |
398 | if ( currentSession() ) { | 398 | if ( currentSession() ) { |
399 | bool ret = currentSession()->layer()->open(); | 399 | bool ret = currentSession()->layer()->open(); |
400 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 400 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
401 | QObject::tr("Failed"), | 401 | QObject::tr("Failed"), |
402 | QObject::tr("Connecting failed for this session.")); | 402 | QObject::tr("Connecting failed for this session.")); |
403 | else { | 403 | else { |
404 | m_connect->setEnabled( false ); | 404 | m_connect->setEnabled( false ); |
405 | m_disconnect->setEnabled( true ); | 405 | m_disconnect->setEnabled( true ); |
406 | 406 | ||
407 | // if it does not support file transfer, disable the menu entry | 407 | // if it does not support file transfer, disable the menu entry |
408 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 408 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
409 | m_transfer->setEnabled( false ); | 409 | m_transfer->setEnabled( false ); |
410 | } else { | 410 | } else { |
411 | m_transfer->setEnabled( true ); | 411 | m_transfer->setEnabled( true ); |
412 | } | 412 | } |
413 | 413 | ||
414 | m_recordScript->setEnabled( true ); | 414 | m_recordScript->setEnabled( true ); |
415 | m_scripts->setItemEnabled(m_runScript_id, true); | 415 | m_scripts->setItemEnabled(m_runScript_id, true); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
420 | void MainWindow::slotDisconnect() { | 420 | void 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 | ||
432 | void MainWindow::slotTerminate() { | 432 | void 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 | ||
442 | void MainWindow::slotQuickLaunch() { | 442 | void 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 | ||
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 | } |
579 | 584 | ||
580 | 585 | ||
581 | void MainWindow::slotOpenKeb(bool state) { | 586 | void 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 | ||
589 | void MainWindow::slotOpenButtons( bool state ) { | 594 | void 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 | ||
600 | void MainWindow::slotSessionChanged( Session* ses ) { | 605 | void 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 ); |
611 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); | 616 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); |
612 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); | 617 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); |
613 | m_scripts->setItemEnabled(m_runScript_id, true); | 618 | m_scripts->setItemEnabled(m_runScript_id, true); |
614 | } else { | 619 | } else { |
615 | m_connect->setEnabled( true ); | 620 | m_connect->setEnabled( true ); |
616 | m_disconnect->setEnabled( false ); | 621 | m_disconnect->setEnabled( false ); |
617 | m_recordScript->setEnabled( false ); | 622 | m_recordScript->setEnabled( false ); |
618 | m_saveScript->setEnabled( false ); | 623 | m_saveScript->setEnabled( false ); |
619 | m_scripts->setItemEnabled(m_runScript_id, false); | 624 | m_scripts->setItemEnabled(m_runScript_id, false); |
620 | } | 625 | } |
621 | 626 | ||
622 | if ( ( currentSession()->emulationHandler()->isLogging() ) ) { | 627 | if ( ( currentSession()->emulationHandler()->isLogging() ) ) { |
623 | m_recordLog->setText( tr("Stop log") ); | 628 | m_recordLog->setText( tr("Stop log") ); |
624 | } else { | 629 | } else { |
625 | m_recordLog->setText( tr("Start log") ); | 630 | m_recordLog->setText( tr("Start log") ); |
626 | } | 631 | } |
627 | 632 | ||
628 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 633 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
629 | m_transfer->setEnabled( false ); | 634 | m_transfer->setEnabled( false ); |
630 | } else { | 635 | } else { |
631 | m_transfer->setEnabled( true ); | 636 | m_transfer->setEnabled( true ); |
632 | } | 637 | } |
633 | 638 | ||
634 | QWidget *w = m_curSession->widget(); | 639 | QWidget *w = m_curSession->widget(); |
635 | if(w) w->setFocus(); | 640 | if(w) w->setFocus(); |
636 | 641 | ||
637 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 642 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
638 | m_isWrapped = true; | 643 | m_isWrapped = true; |
639 | } else { | 644 | } else { |
640 | m_isWrapped = false; | 645 | m_isWrapped = false; |
641 | } | 646 | } |
642 | 647 | ||
643 | m_kb->load(currentSession()->profile()); | 648 | m_kb->load(currentSession()->profile()); |
644 | } | 649 | } |
645 | } | 650 | } |
646 | 651 | ||
647 | void MainWindow::slotWrap() | 652 | void MainWindow::slotWrap() |
648 | { | 653 | { |
649 | if(m_curSession) | 654 | if(m_curSession) |
650 | { | 655 | { |
651 | EmulationHandler *e = m_curSession->emulationHandler(); | 656 | EmulationHandler *e = m_curSession->emulationHandler(); |
652 | if(e) | 657 | if(e) |
653 | { | 658 | { |
654 | e->setWrap( m_isWrapped ? 80:0 ); | 659 | e->setWrap( m_isWrapped ? 80:0 ); |
655 | m_isWrapped = !m_isWrapped; | 660 | m_isWrapped = !m_isWrapped; |
656 | } | 661 | } |
657 | } | 662 | } |
658 | } | 663 | } |
659 | 664 | ||
660 | void MainWindow::slotFullscreen() { | 665 | void MainWindow::slotFullscreen() { |
661 | 666 | ||
662 | 667 | ||
663 | 668 | ||
664 | if ( m_isFullscreen ) { | 669 | if ( m_isFullscreen ) { |
665 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 670 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
666 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 671 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
667 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 672 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
668 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 673 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
669 | 674 | ||
670 | } else { | 675 | } else { |
671 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 676 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
672 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 677 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
673 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 678 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
674 | , QPoint(0,0), false ); | 679 | , QPoint(0,0), false ); |
675 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 680 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
676 | ( m_curSession->widgetStack() )->setFocus(); | 681 | ( m_curSession->widgetStack() )->setFocus(); |
677 | ( m_curSession->widgetStack() )->show(); | 682 | ( m_curSession->widgetStack() )->show(); |
678 | 683 | ||
679 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 684 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
680 | 685 | ||
681 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 686 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
682 | } | 687 | } |
683 | 688 | ||
684 | m_isFullscreen = !m_isFullscreen; | 689 | m_isFullscreen = !m_isFullscreen; |
685 | } | 690 | } |
686 | 691 | ||
687 | 692 | ||
688 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | 693 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { |
689 | 694 | ||
690 | if ( m_curSession ) { | 695 | if ( m_curSession ) { |
691 | 696 | ||
692 | QEvent::Type state; | 697 | QEvent::Type state; |
693 | 698 | ||
694 | if (pressed) state = QEvent::KeyPress; | 699 | if (pressed) state = QEvent::KeyPress; |
695 | else state = QEvent::KeyRelease; | 700 | else state = QEvent::KeyRelease; |
696 | 701 | ||
697 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 702 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
698 | 703 | ||
699 | // is this the best way to do this? cant figure out any other way to work | 704 | // is this the best way to do this? cant figure out any other way to work |
700 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 705 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
701 | ke.ignore(); | 706 | ke.ignore(); |
702 | } | 707 | } |
703 | } | 708 | } |
704 | void MainWindow::slotCopy() { | 709 | void MainWindow::slotCopy() { |
705 | if (!currentSession() ) return; | 710 | if (!currentSession() ) return; |
706 | currentSession()->emulationHandler()->copy(); | 711 | currentSession()->emulationHandler()->copy(); |