Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 3fe9040..0a475d8 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qtoolbar.h> | 5 | #include <qtoolbar.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qwhatsthis.h> | 7 | #include <qwhatsthis.h> |
8 | #include <qfileinfo.h> | 8 | #include <qfileinfo.h> |
9 | 9 | ||
10 | #include <qpe/filemanager.h> | 10 | #include <qpe/filemanager.h> |
11 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
12 | 12 | ||
13 | #include <opie/ofiledialog.h> | 13 | #include <opie2/ofiledialog.h> |
14 | 14 | ||
15 | #include "TEmulation.h" | 15 | #include "TEmulation.h" |
16 | #include "profileeditordialog.h" | 16 | #include "profileeditordialog.h" |
17 | #include "configdialog.h" | 17 | #include "configdialog.h" |
18 | #include "default.h" | 18 | #include "default.h" |
19 | #include "profilemanager.h" | 19 | #include "profilemanager.h" |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | #include "tabwidget.h" | 21 | #include "tabwidget.h" |
22 | #include "transferdialog.h" | 22 | #include "transferdialog.h" |
23 | #include "function_keyboard.h" | 23 | #include "function_keyboard.h" |
24 | #include "emulation_handler.h" | 24 | #include "emulation_handler.h" |
25 | #include "script.h" | 25 | #include "script.h" |
@@ -324,25 +324,25 @@ void MainWindow::slotRecordScript() { | |||
324 | currentSession()->emulationHandler()->startRecording(); | 324 | currentSession()->emulationHandler()->startRecording(); |
325 | m_saveScript->setEnabled(true); | 325 | m_saveScript->setEnabled(true); |
326 | m_recordScript->setEnabled(false); | 326 | m_recordScript->setEnabled(false); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | void MainWindow::slotSaveScript() { | 330 | void MainWindow::slotSaveScript() { |
331 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 331 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
332 | QMap<QString, QStringList> map; | 332 | QMap<QString, QStringList> map; |
333 | QStringList text; | 333 | QStringList text; |
334 | text << "text/plain"; | 334 | text << "text/plain"; |
335 | map.insert(tr("Script"), text ); | 335 | map.insert(tr("Script"), text ); |
336 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 336 | QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
337 | if (!filename.isEmpty()) { | 337 | if (!filename.isEmpty()) { |
338 | QFileInfo info(filename); | 338 | QFileInfo info(filename); |
339 | if (info.extension(FALSE) != "script") | 339 | if (info.extension(FALSE) != "script") |
340 | filename += ".script"; | 340 | filename += ".script"; |
341 | DocLnk nf; | 341 | DocLnk nf; |
342 | nf.setType("text/plain"); | 342 | nf.setType("text/plain"); |
343 | nf.setFile(filename); | 343 | nf.setFile(filename); |
344 | nf.setName(info.fileName()); | 344 | nf.setName(info.fileName()); |
345 | FileManager fm; | 345 | FileManager fm; |
346 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 346 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
347 | currentSession()->emulationHandler()->clearScript(); | 347 | currentSession()->emulationHandler()->clearScript(); |
348 | m_saveScript->setEnabled(false); | 348 | m_saveScript->setEnabled(false); |
@@ -438,26 +438,26 @@ void MainWindow::slotConfigure() { | |||
438 | * we will remove | 438 | * we will remove |
439 | * this window from the tabwidget | 439 | * this window from the tabwidget |
440 | * remove it from the list | 440 | * remove it from the list |
441 | * delete it | 441 | * delete it |
442 | * and set the currentSession() | 442 | * and set the currentSession() |
443 | */ | 443 | */ |
444 | void MainWindow::slotClose() { | 444 | void MainWindow::slotClose() { |
445 | if (!currentSession() ) | 445 | if (!currentSession() ) |
446 | return; | 446 | return; |
447 | 447 | ||
448 | Session* ses = currentSession(); | 448 | Session* ses = currentSession(); |
449 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 449 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
450 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 450 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
451 | m_curSession = NULL; | 451 | m_curSession = NULL; |
452 | tabWidget()->remove( /*currentSession()*/ses ); | 452 | tabWidget()->remove( /*currentSession()*/ses ); |
453 | /*it's autodelete */ | 453 | /*it's autodelete */ |
454 | m_sessions.remove( ses ); | 454 | m_sessions.remove( ses ); |
455 | qWarning("after remove!!"); | 455 | qWarning("after remove!!"); |
456 | 456 | ||
457 | if (!currentSession() ) { | 457 | if (!currentSession() ) { |
458 | m_connect->setEnabled( false ); | 458 | m_connect->setEnabled( false ); |
459 | m_disconnect->setEnabled( false ); | 459 | m_disconnect->setEnabled( false ); |
460 | m_terminate->setEnabled( false ); | 460 | m_terminate->setEnabled( false ); |
461 | m_transfer->setEnabled( false ); | 461 | m_transfer->setEnabled( false ); |
462 | m_recordScript->setEnabled( false ); | 462 | m_recordScript->setEnabled( false ); |
463 | m_saveScript->setEnabled( false ); | 463 | m_saveScript->setEnabled( false ); |
@@ -474,37 +474,37 @@ void MainWindow::slotClose() { | |||
474 | * We will get the name | 474 | * We will get the name |
475 | * Then the profile | 475 | * Then the profile |
476 | * and then we will make a profile | 476 | * and then we will make a profile |
477 | */ | 477 | */ |
478 | void MainWindow::slotProfile( int id) { | 478 | void MainWindow::slotProfile( int id) { |
479 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 479 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
480 | create( prof ); | 480 | create( prof ); |
481 | } | 481 | } |
482 | 482 | ||
483 | 483 | ||
484 | 484 | ||
485 | void MainWindow::create( const Profile& prof ) { | 485 | void MainWindow::create( const Profile& prof ) { |
486 | if(m_curSession) | 486 | if(m_curSession) |
487 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 487 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
488 | 488 | ||
489 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 489 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
490 | 490 | ||
491 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 491 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
492 | { | 492 | { |
493 | QMessageBox::warning(this, | 493 | QMessageBox::warning(this, |
494 | QObject::tr("Session failed"), | 494 | QObject::tr("Session failed"), |
495 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 495 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
496 | //if(ses) delete ses; | 496 | //if(ses) delete ses; |
497 | return; | 497 | return; |
498 | } | 498 | } |
499 | 499 | ||
500 | m_sessions.append( ses ); | 500 | m_sessions.append( ses ); |
501 | tabWidget()->add( ses ); | 501 | tabWidget()->add( ses ); |
502 | tabWidget()->repaint(); | 502 | tabWidget()->repaint(); |
503 | m_curSession = ses; | 503 | m_curSession = ses; |
504 | 504 | ||
505 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 505 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
506 | m_connect->setEnabled( true ); | 506 | m_connect->setEnabled( true ); |
507 | m_disconnect->setEnabled( false ); | 507 | m_disconnect->setEnabled( false ); |
508 | m_terminate->setEnabled( true ); | 508 | m_terminate->setEnabled( true ); |
509 | m_fullscreen->setEnabled( true ); | 509 | m_fullscreen->setEnabled( true ); |
510 | m_wrap->setEnabled( true ); | 510 | m_wrap->setEnabled( true ); |
@@ -527,34 +527,34 @@ void MainWindow::create( const Profile& prof ) { | |||
527 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 527 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
528 | m_isWrapped = true; | 528 | m_isWrapped = true; |
529 | } else { | 529 | } else { |
530 | m_isWrapped = false; | 530 | m_isWrapped = false; |
531 | } | 531 | } |
532 | 532 | ||
533 | m_kb->load(currentSession()->profile()); | 533 | m_kb->load(currentSession()->profile()); |
534 | } | 534 | } |
535 | 535 | ||
536 | void MainWindow::slotTransfer() | 536 | void MainWindow::slotTransfer() |
537 | { | 537 | { |
538 | if ( currentSession() ) { | 538 | if ( currentSession() ) { |
539 | Session *mysession = currentSession(); | 539 | Session *mysession = currentSession(); |
540 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); | 540 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); |
541 | mysession->setTransferDialog(&dlg); | 541 | mysession->setTransferDialog(&dlg); |
542 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); | 542 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); |
543 | //dlg.showMaximized(); | 543 | //dlg.showMaximized(); |
544 | currentSession()->widgetStack()->addWidget(&dlg, -1); | 544 | currentSession()->widgetStack()->addWidget(&dlg, -1); |
545 | dlg.show(); | 545 | dlg.show(); |
546 | //dlg.exec(); | 546 | //dlg.exec(); |
547 | while(dlg.isRunning()) qApp->processEvents(); | 547 | while(dlg.isRunning()) qApp->processEvents(); |
548 | mysession->setTransferDialog(0l); | 548 | mysession->setTransferDialog(0l); |
549 | } | 549 | } |
550 | } | 550 | } |
551 | 551 | ||
552 | 552 | ||
553 | void MainWindow::slotOpenKeb(bool state) { | 553 | void MainWindow::slotOpenKeb(bool state) { |
554 | 554 | ||
555 | if (state) m_keyBar->show(); | 555 | if (state) m_keyBar->show(); |
556 | else m_keyBar->hide(); | 556 | else m_keyBar->hide(); |
557 | 557 | ||
558 | } | 558 | } |
559 | 559 | ||
560 | 560 | ||
@@ -563,28 +563,28 @@ void MainWindow::slotOpenButtons( bool state ) { | |||
563 | if ( state ) { | 563 | if ( state ) { |
564 | m_buttonBar->show(); | 564 | m_buttonBar->show(); |
565 | } else { | 565 | } else { |
566 | m_buttonBar->hide(); | 566 | m_buttonBar->hide(); |
567 | } | 567 | } |
568 | } | 568 | } |
569 | 569 | ||
570 | 570 | ||
571 | 571 | ||
572 | void MainWindow::slotSessionChanged( Session* ses ) { | 572 | void MainWindow::slotSessionChanged( Session* ses ) { |
573 | qWarning("changed!"); | 573 | qWarning("changed!"); |
574 | 574 | ||
575 | if(m_curSession) | 575 | if(m_curSession) |
576 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 576 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
577 | if(ses) | 577 | if(ses) |
578 | if(ses->transferDialog()) ses->transferDialog()->show(); | 578 | if(ses->transferDialog()) ses->transferDialog()->show(); |
579 | 579 | ||
580 | if ( ses ) { | 580 | if ( ses ) { |
581 | m_curSession = ses; | 581 | m_curSession = ses; |
582 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 582 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
583 | if ( m_curSession->layer()->isConnected() ) { | 583 | if ( m_curSession->layer()->isConnected() ) { |
584 | m_connect->setEnabled( false ); | 584 | m_connect->setEnabled( false ); |
585 | m_disconnect->setEnabled( true ); | 585 | m_disconnect->setEnabled( true ); |
586 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); | 586 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); |
587 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); | 587 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); |
588 | m_scripts->setItemEnabled(m_runScript_id, true); | 588 | m_scripts->setItemEnabled(m_runScript_id, true); |
589 | } else { | 589 | } else { |
590 | m_connect->setEnabled( true ); | 590 | m_connect->setEnabled( true ); |
@@ -612,33 +612,33 @@ void MainWindow::slotSessionChanged( Session* ses ) { | |||
612 | m_kb->load(currentSession()->profile()); | 612 | m_kb->load(currentSession()->profile()); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | void MainWindow::slotWrap() | 616 | void MainWindow::slotWrap() |
617 | { | 617 | { |
618 | if(m_curSession) | 618 | if(m_curSession) |
619 | { | 619 | { |
620 | EmulationHandler *e = m_curSession->emulationHandler(); | 620 | EmulationHandler *e = m_curSession->emulationHandler(); |
621 | if(e) | 621 | if(e) |
622 | { | 622 | { |
623 | if(m_isWrapped) | 623 | if(m_isWrapped) |
624 | { | 624 | { |
625 | e->setWrap(80); | 625 | e->setWrap(80); |
626 | m_isWrapped = false; | 626 | m_isWrapped = false; |
627 | } | 627 | } |
628 | else | 628 | else |
629 | { | 629 | { |
630 | e->setWrap(0); | 630 | e->setWrap(0); |
631 | m_isWrapped = true; | 631 | m_isWrapped = true; |
632 | } | 632 | } |
633 | } | 633 | } |
634 | } | 634 | } |
635 | } | 635 | } |
636 | 636 | ||
637 | void MainWindow::slotFullscreen() { | 637 | void MainWindow::slotFullscreen() { |
638 | 638 | ||
639 | 639 | ||
640 | 640 | ||
641 | if ( m_isFullscreen ) { | 641 | if ( m_isFullscreen ) { |
642 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 642 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
643 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 643 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
644 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 644 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
@@ -697,25 +697,25 @@ void MainWindow::slotSaveSession() { | |||
697 | tr("<qt>There is no Connection.</qt>"), 1 ); | 697 | tr("<qt>There is no Connection.</qt>"), 1 ); |
698 | return; | 698 | return; |
699 | } | 699 | } |
700 | manager()->add( currentSession()->profile() ); | 700 | manager()->add( currentSession()->profile() ); |
701 | manager()->save(); | 701 | manager()->save(); |
702 | populateProfiles(); | 702 | populateProfiles(); |
703 | } | 703 | } |
704 | void MainWindow::slotSaveHistory() { | 704 | void MainWindow::slotSaveHistory() { |
705 | QMap<QString, QStringList> map; | 705 | QMap<QString, QStringList> map; |
706 | QStringList text; | 706 | QStringList text; |
707 | text << "text/plain"; | 707 | text << "text/plain"; |
708 | map.insert(tr("History"), text ); | 708 | map.insert(tr("History"), text ); |
709 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 709 | QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
710 | if (filename.isEmpty() ) return; | 710 | if (filename.isEmpty() ) return; |
711 | 711 | ||
712 | QFileInfo info(filename); | 712 | QFileInfo info(filename); |
713 | 713 | ||
714 | DocLnk nf; | 714 | DocLnk nf; |
715 | nf.setType("text/plain"); | 715 | nf.setType("text/plain"); |
716 | nf.setFile(filename); | 716 | nf.setFile(filename); |
717 | nf.setName(info.fileName()); | 717 | nf.setName(info.fileName()); |
718 | 718 | ||
719 | 719 | ||
720 | QFile file(filename); | 720 | QFile file(filename); |
721 | file.open(IO_WriteOnly ); | 721 | file.open(IO_WriteOnly ); |