summaryrefslogtreecommitdiff
authorhash <hash>2002-10-17 18:03:39 (UTC)
committer hash <hash>2002-10-17 18:03:39 (UTC)
commit43aecbd7095da335158b461a9ce293d236cd32ab (patch) (unidiff)
tree43fbfa93d33ae3308f3aec8f5bb5c00d2505f64a
parent08e9fcbbaf57383fd65fe4eb197d97a51abe0f26 (diff)
downloadopie-43aecbd7095da335158b461a9ce293d236cd32ab.zip
opie-43aecbd7095da335158b461a9ce293d236cd32ab.tar.gz
opie-43aecbd7095da335158b461a9ce293d236cd32ab.tar.bz2
function keyboard should work now. here is a sample opie-console-keys.conf file
[keys] r0c0 = F1|4144|0 r0c1 = F2|4145|0 r0c2 = F3|4146|0 r0c3 = F4|4147|0 r0c4 = F5|4148|0 r0c5 = F6|4149|0 r0c6 = ESC|4096|0 r0c7 = A|65|65 r0c8 = a|65|97 r0c9 = PgUp|4118|0 r0c10 = PgDn|4119|0
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index fdb0452..f0130e1 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -348,140 +348,146 @@ void MainWindow::slotConfigure() {
348 * and set the currentSession() 348 * and set the currentSession()
349 */ 349 */
350void MainWindow::slotClose() { 350void MainWindow::slotClose() {
351 if (!currentSession() ) 351 if (!currentSession() )
352 return; 352 return;
353 353
354 Session* ses = currentSession(); 354 Session* ses = currentSession();
355 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 355 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
356 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 356 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
357 m_curSession = NULL; 357 m_curSession = NULL;
358 tabWidget()->remove( /*currentSession()*/ses ); 358 tabWidget()->remove( /*currentSession()*/ses );
359 /*it's autodelete */ 359 /*it's autodelete */
360 m_sessions.remove( ses ); 360 m_sessions.remove( ses );
361 qWarning("after remove!!"); 361 qWarning("after remove!!");
362 362
363 if (!currentSession() ) { 363 if (!currentSession() ) {
364 m_connect->setEnabled( false ); 364 m_connect->setEnabled( false );
365 m_disconnect->setEnabled( false ); 365 m_disconnect->setEnabled( false );
366 m_terminate->setEnabled( false ); 366 m_terminate->setEnabled( false );
367 m_transfer->setEnabled( false ); 367 m_transfer->setEnabled( false );
368 m_recordScript->setEnabled( false ); 368 m_recordScript->setEnabled( false );
369 m_saveScript->setEnabled( false ); 369 m_saveScript->setEnabled( false );
370 m_runScript->setEnabled( false ); 370 m_runScript->setEnabled( false );
371 m_fullscreen->setEnabled( false ); 371 m_fullscreen->setEnabled( false );
372 m_closewindow->setEnabled( false ); 372 m_closewindow->setEnabled( false );
373 } 373 }
374} 374}
375 375
376/* 376/*
377 * We will get the name 377 * We will get the name
378 * Then the profile 378 * Then the profile
379 * and then we will make a profile 379 * and then we will make a profile
380 */ 380 */
381void MainWindow::slotProfile( int id) { 381void MainWindow::slotProfile( int id) {
382 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 382 Profile prof = manager()->profile( m_sessionsPop->text( id) );
383 create( prof ); 383 create( prof );
384} 384}
385void MainWindow::create( const Profile& prof ) { 385void MainWindow::create( const Profile& prof ) {
386 Session *ses = manager()->fromProfile( prof, tabWidget() ); 386 Session *ses = manager()->fromProfile( prof, tabWidget() );
387 387
388 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 388 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
389 { 389 {
390 QMessageBox::warning(this, 390 QMessageBox::warning(this,
391 QObject::tr("Session failed"), 391 QObject::tr("Session failed"),
392 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 392 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
393 //if(ses) delete ses; 393 //if(ses) delete ses;
394 return; 394 return;
395 } 395 }
396 396
397 m_sessions.append( ses ); 397 m_sessions.append( ses );
398 tabWidget()->add( ses ); 398 tabWidget()->add( ses );
399 m_curSession = ses; 399 m_curSession = ses;
400 400
401 // is io_layer wants direct connection, then autoconnect 401 // is io_layer wants direct connection, then autoconnect
402 if ( ( m_curSession->layer() )->supports()[0] = 1 ) { 402 if ( ( m_curSession->layer() )->supports()[0] = 1 ) {
403 slotConnect(); 403 slotConnect();
404 } 404 }
405 405
406 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 406 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
407 m_connect->setEnabled( true ); 407 m_connect->setEnabled( true );
408 m_disconnect->setEnabled( false ); 408 m_disconnect->setEnabled( false );
409 m_terminate->setEnabled( true ); 409 m_terminate->setEnabled( true );
410 m_transfer->setEnabled( true ); 410 m_transfer->setEnabled( true );
411 m_recordScript->setEnabled( true ); 411 m_recordScript->setEnabled( true );
412 m_saveScript->setEnabled( true ); 412 m_saveScript->setEnabled( true );
413 m_runScript->setEnabled( true ); 413 m_runScript->setEnabled( true );
414 m_fullscreen->setEnabled( true ); 414 m_fullscreen->setEnabled( true );
415 m_closewindow->setEnabled( true ); 415 m_closewindow->setEnabled( true );
416} 416}
417 417
418void MainWindow::slotTransfer() 418void MainWindow::slotTransfer()
419{ 419{
420 if ( currentSession() ) { 420 if ( currentSession() ) {
421 TransferDialog dlg(this); 421 TransferDialog dlg(this);
422 dlg.showMaximized(); 422 dlg.showMaximized();
423 dlg.exec(); 423 dlg.exec();
424 } 424 }
425} 425}
426 426
427 427
428void MainWindow::slotOpenKeb(bool state) { 428void MainWindow::slotOpenKeb(bool state) {
429 429
430 if (state) m_keyBar->show(); 430 if (state) m_keyBar->show();
431 else m_keyBar->hide(); 431 else m_keyBar->hide();
432 432
433} 433}
434void MainWindow::slotSessionChanged( Session* ses ) { 434void MainWindow::slotSessionChanged( Session* ses ) {
435 qWarning("changed!"); 435 qWarning("changed!");
436 if ( ses ) { 436 if ( ses ) {
437 m_curSession = ses; 437 m_curSession = ses;
438 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 438 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
439 if ( m_curSession->layer()->isConnected() ) { 439 if ( m_curSession->layer()->isConnected() ) {
440 m_connect->setEnabled( false ); 440 m_connect->setEnabled( false );
441 m_disconnect->setEnabled( true ); 441 m_disconnect->setEnabled( true );
442 } else { 442 } else {
443 m_connect->setEnabled( true ); 443 m_connect->setEnabled( true );
444 m_disconnect->setEnabled( false ); 444 m_disconnect->setEnabled( false );
445 } 445 }
446 } 446 }
447} 447}
448 448
449void MainWindow::slotFullscreen() { 449void MainWindow::slotFullscreen() {
450 450
451 if ( m_isFullscreen ) { 451 if ( m_isFullscreen ) {
452 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); 452 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false );
453 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 453 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
454 setCentralWidget( m_consoleWindow ); 454 setCentralWidget( m_consoleWindow );
455 ( m_curSession->widgetStack() )->show(); 455 ( m_curSession->widgetStack() )->show();
456 ( m_curSession->emulationHandler() )->cornerButton()->hide(); 456 ( m_curSession->emulationHandler() )->cornerButton()->hide();
457 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 457 disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
458 458
459 } else { 459 } else {
460 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 460 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
461 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop 461 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
462 , QPoint(0,0), false ); 462 , QPoint(0,0), false );
463 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 463 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
464 ( m_curSession->widgetStack() )->setFocus(); 464 ( m_curSession->widgetStack() )->setFocus();
465 ( m_curSession->widgetStack() )->show(); 465 ( m_curSession->widgetStack() )->show();
466 466
467 ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); 467 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
468 468
469 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 469 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
470 } 470 }
471 471
472 m_isFullscreen = !m_isFullscreen; 472 m_isFullscreen = !m_isFullscreen;
473} 473}
474 474
475 475
476void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) { 476void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool) {
477 477
478 qWarning("received key event! relay to TE widget"); 478 qWarning("unicode: %x, qkey: %x, %s", u, q, pressed ? "pressed" : "released");
479 479
480 if ( m_curSession ) { 480 if ( m_curSession ) {
481 QKeyEvent ke(QEvent::KeyPress, q, u, 0);
482 481
483 ke.ignore(); 482 QEvent::Type state;
483
484 if (pressed) state = QEvent::KeyPress;
485 else state = QEvent::KeyRelease;
486
487 QKeyEvent ke(state, q, u, 0, QString(QChar(u)));
488
484 // where should i send this event? doesnt work sending it here 489 // where should i send this event? doesnt work sending it here
485 QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke); 490 QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
491 ke.ignore();
486 } 492 }
487} 493}