summaryrefslogtreecommitdiff
authorhash <hash>2002-10-17 18:03:39 (UTC)
committer hash <hash>2002-10-17 18:03:39 (UTC)
commit43aecbd7095da335158b461a9ce293d236cd32ab (patch) (side-by-side diff)
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
@@ -380,108 +380,114 @@ void MainWindow::slotClose() {
*/
void MainWindow::slotProfile( int id) {
Profile prof = manager()->profile( m_sessionsPop->text( id) );
create( prof );
}
void MainWindow::create( const Profile& prof ) {
Session *ses = manager()->fromProfile( prof, tabWidget() );
if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
{
QMessageBox::warning(this,
QObject::tr("Session failed"),
QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
//if(ses) delete ses;
return;
}
m_sessions.append( ses );
tabWidget()->add( ses );
m_curSession = ses;
// is io_layer wants direct connection, then autoconnect
if ( ( m_curSession->layer() )->supports()[0] = 1 ) {
slotConnect();
}
// dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( true );
m_transfer->setEnabled( true );
m_recordScript->setEnabled( true );
m_saveScript->setEnabled( true );
m_runScript->setEnabled( true );
m_fullscreen->setEnabled( true );
m_closewindow->setEnabled( true );
}
void MainWindow::slotTransfer()
{
if ( currentSession() ) {
TransferDialog dlg(this);
dlg.showMaximized();
dlg.exec();
}
}
void MainWindow::slotOpenKeb(bool state) {
if (state) m_keyBar->show();
else m_keyBar->hide();
}
void MainWindow::slotSessionChanged( Session* ses ) {
qWarning("changed!");
if ( ses ) {
m_curSession = ses;
qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
if ( m_curSession->layer()->isConnected() ) {
m_connect->setEnabled( false );
m_disconnect->setEnabled( true );
} else {
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
}
}
}
void MainWindow::slotFullscreen() {
if ( m_isFullscreen ) {
( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false );
( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
setCentralWidget( m_consoleWindow );
( m_curSession->widgetStack() )->show();
( m_curSession->emulationHandler() )->cornerButton()->hide();
disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
} else {
( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
, QPoint(0,0), false );
( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
( m_curSession->widgetStack() )->setFocus();
( m_curSession->widgetStack() )->show();
( ( m_curSession->emulationHandler() )->cornerButton() )->show();
connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
}
m_isFullscreen = !m_isFullscreen;
}
-void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) {
+void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool) {
- qWarning("received key event! relay to TE widget");
+ qWarning("unicode: %x, qkey: %x, %s", u, q, pressed ? "pressed" : "released");
if ( m_curSession ) {
- QKeyEvent ke(QEvent::KeyPress, q, u, 0);
- ke.ignore();
+ QEvent::Type state;
+
+ if (pressed) state = QEvent::KeyPress;
+ else state = QEvent::KeyRelease;
+
+ QKeyEvent ke(state, q, u, 0, QString(QChar(u)));
+
// where should i send this event? doesnt work sending it here
- QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke);
+ QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
+ ke.ignore();
}
}