author | jeremy <jeremy> | 2002-02-15 21:12:53 (UTC) |
---|---|---|
committer | jeremy <jeremy> | 2002-02-15 21:12:53 (UTC) |
commit | b0768575b7bc1e4fe477d37a49cccc7e3d92bf85 (patch) (unidiff) | |
tree | 4c66c26f74ec710204f3f2e4303a6d6d8968c6a7 | |
parent | b15950bcf97b5590d37373ec2beedab80e40ded6 (diff) | |
download | opie-b0768575b7bc1e4fe477d37a49cccc7e3d92bf85.zip opie-b0768575b7bc1e4fe477d37a49cccc7e3d92bf85.tar.gz opie-b0768575b7bc1e4fe477d37a49cccc7e3d92bf85.tar.bz2 |
Added new QCop support. Desktop now listens on channel QPE/Desktop to the
keyRegister(int key, QString channel, QString message) message. What this
will do is allow an app to reiceve keyboard input for a particular key
no matter if they have focus or not.
-rw-r--r-- | core/launcher/desktop.cpp | 56 | ||||
-rw-r--r-- | core/launcher/desktop.h | 4 | ||||
-rw-r--r-- | core/launcher/opie-taskbar.control | 2 |
3 files changed, 61 insertions, 1 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 | |||
@@ -47,9 +47,31 @@ | |||
47 | #include <qtimer.h> | 47 | #include <qtimer.h> |
48 | #include <qwindowsystem_qws.h> | 48 | #include <qwindowsystem_qws.h> |
49 | 49 | ||
50 | #include <qvaluelist.h> | ||
51 | |||
50 | #include <stdlib.h> | 52 | #include <stdlib.h> |
51 | #include <unistd.h> | 53 | #include <unistd.h> |
52 | 54 | ||
55 | |||
56 | class QCopKeyRegister | ||
57 | { | ||
58 | public: | ||
59 | QCopKeyRegister() : keyCode(0) { } | ||
60 | QCopKeyRegister(int k, const QString &c, const QString &m) | ||
61 | : keyCode(k), channel(c), message(m) { } | ||
62 | |||
63 | int getKeyCode() const { return keyCode; } | ||
64 | QString getChannel() const { return channel; } | ||
65 | QString getMessage() const { return message; } | ||
66 | |||
67 | private: | ||
68 | int keyCode; | ||
69 | QString channel, message; | ||
70 | }; | ||
71 | |||
72 | typedef QValueList<QCopKeyRegister> KeyRegisterList; | ||
73 | KeyRegisterList keyRegisterList; | ||
74 | |||
53 | static Desktop* qpedesktop = 0; | 75 | static Desktop* qpedesktop = 0; |
54 | static int loggedin=0; | 76 | static int loggedin=0; |
55 | static void login(bool at_poweron) | 77 | static void login(bool at_poweron) |
@@ -123,6 +145,10 @@ DesktopApplication::DesktopApplication( int& argc, char **argv, Type t ) | |||
123 | t->start( 10000 ); | 145 | t->start( 10000 ); |
124 | ps = new PowerStatus; | 146 | ps = new PowerStatus; |
125 | pa = new DesktopPowerAlerter( 0 ); | 147 | pa = new DesktopPowerAlerter( 0 ); |
148 | |||
149 | channel = new QCopChannel( "QPE/Desktop", this ); | ||
150 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
151 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | ||
126 | } | 152 | } |
127 | 153 | ||
128 | 154 | ||
@@ -132,6 +158,22 @@ DesktopApplication::~DesktopApplication() | |||
132 | delete pa; | 158 | delete pa; |
133 | } | 159 | } |
134 | 160 | ||
161 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | ||
162 | { | ||
163 | QDataStream stream( data, IO_ReadOnly ); | ||
164 | if (msg == "keyRegister(int key, QString channel, QString message)") | ||
165 | { | ||
166 | int k; | ||
167 | QString c, m; | ||
168 | |||
169 | stream >> k; | ||
170 | stream >> c; | ||
171 | stream >> m; | ||
172 | |||
173 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); | ||
174 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | ||
175 | } | ||
176 | } | ||
135 | 177 | ||
136 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; | 178 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; |
137 | 179 | ||
@@ -145,6 +187,14 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | |||
145 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 187 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
146 | return TRUE; | 188 | return TRUE; |
147 | bool press = ke->simpleData.is_press; | 189 | bool press = ke->simpleData.is_press; |
190 | |||
191 | KeyRegisterList::Iterator it; | ||
192 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) | ||
193 | { | ||
194 | if ((*it).getKeyCode() == ke->simpleData.keycode) | ||
195 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | ||
196 | } | ||
197 | |||
148 | if ( !keyboardGrabbed() ) { | 198 | if ( !keyboardGrabbed() ) { |
149 | if ( ke->simpleData.keycode == Key_F9 ) { | 199 | if ( ke->simpleData.keycode == Key_F9 ) { |
150 | if ( press ) emit datebook(); | 200 | if ( press ) emit datebook(); |
@@ -178,6 +228,12 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | |||
178 | return TRUE; | 228 | return TRUE; |
179 | } | 229 | } |
180 | } | 230 | } |
231 | /* | ||
232 | if ( ke->simpleData.keycode == 4096 ) { | ||
233 | QCopEnvelope e("QPE/VMemo", "toggleRecord()"); | ||
234 | return TRUE; | ||
235 | } | ||
236 | */ | ||
181 | if ( ke->simpleData.keycode == Key_F34 ) { | 237 | if ( ke->simpleData.keycode == Key_F34 ) { |
182 | if ( press ) emit power(); | 238 | if ( press ) emit power(); |
183 | return TRUE; | 239 | return TRUE; |
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 | |||
@@ -63,6 +63,9 @@ protected: | |||
63 | void shutdown(); | 63 | void shutdown(); |
64 | void restart(); | 64 | void restart(); |
65 | 65 | ||
66 | public slots: | ||
67 | void receive( const QCString &msg, const QByteArray &data ); | ||
68 | |||
66 | protected slots: | 69 | protected slots: |
67 | void shutdown(ShutdownImpl::Type); | 70 | void shutdown(ShutdownImpl::Type); |
68 | void psTimeout(); | 71 | void psTimeout(); |
@@ -71,6 +74,7 @@ private: | |||
71 | DesktopPowerAlerter *pa; | 74 | DesktopPowerAlerter *pa; |
72 | PowerStatus *ps; | 75 | PowerStatus *ps; |
73 | QTimer *cardSendTimer; | 76 | QTimer *cardSendTimer; |
77 | QCopChannel *channel; | ||
74 | }; | 78 | }; |
75 | 79 | ||
76 | 80 | ||
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 | |||
@@ -3,7 +3,7 @@ Priority: required | |||
3 | Section: opie/system | 3 | Section: opie/system |
4 | Maintainer: Warwick Allison <warwick@trolltech.com> | 4 | Maintainer: Warwick Allison <warwick@trolltech.com> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION.1 |
7 | Depends: qt-embedded (>=$QTE_VERSION) | 7 | Depends: qt-embedded (>=$QTE_VERSION) |
8 | Description: Launcher for Opie | 8 | Description: Launcher for Opie |
9 | The "finder" or "explorer", or whatever you want to call it. | 9 | The "finder" or "explorer", or whatever you want to call it. |