-rw-r--r-- | core/launcher/desktop.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 4587ec6..da535d9 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -142,65 +142,69 @@ DesktopApplication::DesktopApplication( int& argc, char **argv, Type t ) | |||
142 | QTimer *t = new QTimer( this ); | 142 | QTimer *t = new QTimer( this ); |
143 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); | 143 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); |
144 | t->start( 10000 ); | 144 | t->start( 10000 ); |
145 | ps = new PowerStatus; | 145 | ps = new PowerStatus; |
146 | pa = new DesktopPowerAlerter( 0 ); | 146 | pa = new DesktopPowerAlerter( 0 ); |
147 | 147 | ||
148 | channel = new QCopChannel( "QPE/Desktop", this ); | 148 | channel = new QCopChannel( "QPE/Desktop", this ); |
149 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 149 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
150 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 150 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | DesktopApplication::~DesktopApplication() | 154 | DesktopApplication::~DesktopApplication() |
155 | { | 155 | { |
156 | delete ps; | 156 | delete ps; |
157 | delete pa; | 157 | delete pa; |
158 | } | 158 | } |
159 | 159 | ||
160 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | 160 | void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) |
161 | { | 161 | { |
162 | QDataStream stream( data, IO_ReadOnly ); | 162 | QDataStream stream( data, IO_ReadOnly ); |
163 | if (msg == "keyRegister(int key, QString channel, QString message)") | 163 | if (msg == "keyRegister(int key, QString channel, QString message)") |
164 | { | 164 | { |
165 | int k; | 165 | int k; |
166 | QString c, m; | 166 | QString c, m; |
167 | 167 | ||
168 | stream >> k; | 168 | stream >> k; |
169 | stream >> c; | 169 | stream >> c; |
170 | stream >> m; | 170 | stream >> m; |
171 | 171 | ||
172 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); | 172 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); |
173 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 173 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
174 | } | 174 | } |
175 | else if (msg == "suspend()"){ | ||
176 | emit power(); | ||
177 | } | ||
178 | |||
175 | } | 179 | } |
176 | 180 | ||
177 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; | 181 | enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; |
178 | 182 | ||
179 | #ifdef Q_WS_QWS | 183 | #ifdef Q_WS_QWS |
180 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 184 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
181 | { | 185 | { |
182 | qpedesktop->checkMemory(); | 186 | qpedesktop->checkMemory(); |
183 | 187 | ||
184 | if ( e->type == QWSEvent::Key ) { | 188 | if ( e->type == QWSEvent::Key ) { |
185 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 189 | QWSKeyEvent *ke = (QWSKeyEvent *)e; |
186 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) | 190 | if ( !loggedin && ke->simpleData.keycode != Key_F34 ) |
187 | return TRUE; | 191 | return TRUE; |
188 | bool press = ke->simpleData.is_press; | 192 | bool press = ke->simpleData.is_press; |
189 | 193 | ||
190 | if (!keyRegisterList.isEmpty()) | 194 | if (!keyRegisterList.isEmpty()) |
191 | { | 195 | { |
192 | KeyRegisterList::Iterator it; | 196 | KeyRegisterList::Iterator it; |
193 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) | 197 | for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) |
194 | { | 198 | { |
195 | if ((*it).getKeyCode() == ke->simpleData.keycode) | 199 | if ((*it).getKeyCode() == ke->simpleData.keycode) |
196 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); | 200 | QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8()); |
197 | } | 201 | } |
198 | } | 202 | } |
199 | 203 | ||
200 | if ( !keyboardGrabbed() ) { | 204 | if ( !keyboardGrabbed() ) { |
201 | if ( ke->simpleData.keycode == Key_F9 ) { | 205 | if ( ke->simpleData.keycode == Key_F9 ) { |
202 | if ( press ) emit datebook(); | 206 | if ( press ) emit datebook(); |
203 | return TRUE; | 207 | return TRUE; |
204 | } | 208 | } |
205 | if ( ke->simpleData.keycode == Key_F10 ) { | 209 | if ( ke->simpleData.keycode == Key_F10 ) { |
206 | if ( !press && cardSendTimer ) { | 210 | if ( !press && cardSendTimer ) { |