-rw-r--r-- | core/launcher/desktop.cpp | 132 | ||||
-rw-r--r-- | core/launcher/desktop.h | 4 | ||||
-rw-r--r-- | core/launcher/opie-taskbar.control | 4 |
3 files changed, 100 insertions, 40 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index d39af25..ce99bad 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -49,2 +49,4 @@ +#include <qvaluelist.h> + #include <stdlib.h> @@ -52,2 +54,22 @@ + +class QCopKeyRegister +{ +public: + QCopKeyRegister() : keyCode(0) { } + QCopKeyRegister(int k, const QString &c, const QString &m) + : keyCode(k), channel(c), message(m) { } + + int getKeyCode() const { return keyCode; } + QString getChannel() const { return channel; } + QString getMessage() const { return message; } + +private: + int keyCode; + QString channel, message; +}; + +typedef QValueList<QCopKeyRegister> KeyRegisterList; +KeyRegisterList keyRegisterList; + static Desktop* qpedesktop = 0; @@ -125,2 +147,6 @@ DesktopApplication::DesktopApplication( int& argc, char **argv, Type t ) pa = new DesktopPowerAlerter( 0 ); + + channel = new QCopChannel( "QPE/Desktop", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT(receive(const QCString&, const QByteArray&)) ); } @@ -134,2 +160,18 @@ DesktopApplication::~DesktopApplication() +void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) +{ + QDataStream stream( data, IO_ReadOnly ); + if (msg == "keyRegister(int key, QString channel, QString message)") + { + int k; + QString c, m; + + stream >> k; + stream >> c; + stream >> m; + + qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); + keyRegisterList.append(QCopKeyRegister(k,c,m)); + } +} @@ -143,10 +185,18 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) if ( e->type == QWSEvent::Key ) { - QWSKeyEvent *ke = (QWSKeyEvent *)e; - if ( !loggedin && ke->simpleData.keycode != Key_F34 ) + QWSKeyEvent *ke = (QWSKeyEvent *)e; + if ( !loggedin && ke->simpleData.keycode != Key_F34 ) return TRUE; - bool press = ke->simpleData.is_press; - if ( !keyboardGrabbed() ) { + bool press = ke->simpleData.is_press; + + KeyRegisterList::Iterator it; + for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) + { + if ((*it).getKeyCode() == ke->simpleData.keycode) + QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); + } + + if ( !keyboardGrabbed() ) { if ( ke->simpleData.keycode == Key_F9 ) { - if ( press ) emit datebook(); - return TRUE; + if ( press ) emit datebook(); + return TRUE; } @@ -156,3 +206,3 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) delete cardSendTimer; - } else if ( press ) { + } else if ( press ) { cardSendTimer = new QTimer(); @@ -160,48 +210,54 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); - } - return TRUE; + } + return TRUE; } /* menu key now opens application menu/toolbar - if ( ke->simpleData.keycode == Key_F11 ) { - if ( press ) emit menu(); - return TRUE; - } + if ( ke->simpleData.keycode == Key_F11 ) { + if ( press ) emit menu(); + return TRUE; + } */ if ( ke->simpleData.keycode == Key_F12 ) { - while( activePopupWidget() ) + while( activePopupWidget() ) activePopupWidget()->close(); - if ( press ) emit launch(); - return TRUE; + if ( press ) emit launch(); + return TRUE; } if ( ke->simpleData.keycode == Key_F13 ) { - if ( press ) emit email(); - return TRUE; + if ( press ) emit email(); + return TRUE; } - } - if ( ke->simpleData.keycode == Key_F34 ) { + } + /* + if ( ke->simpleData.keycode == 4096 ) { + QCopEnvelope e("QPE/VMemo", "toggleRecord()"); + return TRUE; + } + */ + if ( ke->simpleData.keycode == Key_F34 ) { if ( press ) emit power(); return TRUE; - } - if ( ke->simpleData.keycode == Key_F35 ) { + } + if ( ke->simpleData.keycode == Key_F35 ) { if ( press ) emit backlight(); return TRUE; - } - if ( ke->simpleData.keycode == Key_F32 ) { + } + if ( ke->simpleData.keycode == Key_F32 ) { if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); return TRUE; - } - if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { + } + if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { if ( press ) emit symbol(); return TRUE; - } - if ( ke->simpleData.keycode == Key_NumLock ) { + } + if ( ke->simpleData.keycode == Key_NumLock ) { if ( press ) emit numLockStateToggle(); - } - if ( ke->simpleData.keycode == Key_CapsLock ) { + } + if ( ke->simpleData.keycode == Key_CapsLock ) { if ( press ) emit capsLockStateToggle(); - } - if ( press ) + } + if ( press ) qpedesktop->keyClick(); } else { - if ( e->type == QWSEvent::Mouse ) { + if ( e->type == QWSEvent::Mouse ) { QWSMouseEvent *me = (QWSMouseEvent *)e; @@ -209,12 +265,12 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) if ( me->simpleData.state&LeftButton ) { - if ( up ) { + if ( up ) { up = FALSE; qpedesktop->screenClick(); - } + } } else { - up = TRUE; + up = TRUE; } - } + } } - + return QPEApplication::qwsEventFilter( e ); diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index dfdbeab..f0a7cba 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h @@ -65,2 +65,5 @@ protected: +public slots: + void receive( const QCString &msg, const QByteArray &data ); + protected slots: @@ -73,2 +76,3 @@ private: QTimer *cardSendTimer; + QCopChannel *channel; }; diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control index 53daa82..3db0480 100644 --- a/core/launcher/opie-taskbar.control +++ b/core/launcher/opie-taskbar.control @@ -5,5 +5,5 @@ Maintainer: Warwick Allison <warwick@trolltech.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION +Version: $QPE_VERSION-$SUB_VERSION.1 Depends: qt-embedded (>=$QTE_VERSION) Description: Launcher for Opie - The "finder" or "explorer", or whatever you want to call it. + The "finder" or "explorer", or whatever you want to call it.
\ No newline at end of file |