-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 | |||
@@ -1,411 +1,467 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "desktop.h" | 21 | #include "desktop.h" |
22 | #include "info.h" | 22 | #include "info.h" |
23 | #include "launcher.h" | 23 | #include "launcher.h" |
24 | #include "mrulist.h" | 24 | #include "mrulist.h" |
25 | #include "qcopbridge.h" | 25 | #include "qcopbridge.h" |
26 | #include "shutdownimpl.h" | 26 | #include "shutdownimpl.h" |
27 | #include "startmenu.h" | 27 | #include "startmenu.h" |
28 | #include "taskbar.h" | 28 | #include "taskbar.h" |
29 | #include "transferserver.h" | 29 | #include "transferserver.h" |
30 | #include "irserver.h" | 30 | #include "irserver.h" |
31 | #include "packageslave.h" | 31 | #include "packageslave.h" |
32 | 32 | ||
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/mimetype.h> | 34 | #include <qpe/mimetype.h> |
35 | #include <qpe/password.h> | 35 | #include <qpe/password.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
40 | #ifdef QT_QWS_CUSTOM | 40 | #ifdef QT_QWS_CUSTOM |
41 | #include "qpe/custom.h" | 41 | #include "qpe/custom.h" |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #include <qgfx_qws.h> | 44 | #include <qgfx_qws.h> |
45 | #include <qmainwindow.h> | 45 | #include <qmainwindow.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
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) |
56 | { | 78 | { |
57 | if ( !loggedin ) { | 79 | if ( !loggedin ) { |
58 | Global::terminateBuiltin("calibrate"); | 80 | Global::terminateBuiltin("calibrate"); |
59 | Password::authenticate(at_poweron); | 81 | Password::authenticate(at_poweron); |
60 | loggedin=1; | 82 | loggedin=1; |
61 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); | 83 | QCopEnvelope e( "QPE/Desktop", "unlocked()" ); |
62 | } | 84 | } |
63 | } | 85 | } |
64 | 86 | ||
65 | bool Desktop::screenLocked() | 87 | bool Desktop::screenLocked() |
66 | { | 88 | { |
67 | return loggedin == 0; | 89 | return loggedin == 0; |
68 | } | 90 | } |
69 | 91 | ||
70 | /* | 92 | /* |
71 | Priority is number of alerts that are needed to pop up | 93 | Priority is number of alerts that are needed to pop up |
72 | alert. | 94 | alert. |
73 | */ | 95 | */ |
74 | class DesktopPowerAlerter : public QMessageBox | 96 | class DesktopPowerAlerter : public QMessageBox |
75 | { | 97 | { |
76 | public: | 98 | public: |
77 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) | 99 | DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) |
78 | : QMessageBox( tr("Battery Status"), "Low Battery", | 100 | : QMessageBox( tr("Battery Status"), "Low Battery", |
79 | QMessageBox::Critical, | 101 | QMessageBox::Critical, |
80 | QMessageBox::Ok | QMessageBox::Default, | 102 | QMessageBox::Ok | QMessageBox::Default, |
81 | QMessageBox::NoButton, QMessageBox::NoButton, | 103 | QMessageBox::NoButton, QMessageBox::NoButton, |
82 | parent, name, FALSE ) | 104 | parent, name, FALSE ) |
83 | { | 105 | { |
84 | currentPriority = INT_MAX; | 106 | currentPriority = INT_MAX; |
85 | alertCount = 0; | 107 | alertCount = 0; |
86 | } | 108 | } |
87 | 109 | ||
88 | void alert( const QString &text, int priority ); | 110 | void alert( const QString &text, int priority ); |
89 | void hideEvent( QHideEvent * ); | 111 | void hideEvent( QHideEvent * ); |
90 | private: | 112 | private: |
91 | int currentPriority; | 113 | int currentPriority; |
92 | int alertCount; | 114 | int alertCount; |
93 | }; | 115 | }; |
94 | 116 | ||
95 | void DesktopPowerAlerter::alert( const QString &text, int priority ) | 117 | void DesktopPowerAlerter::alert( const QString &text, int priority ) |
96 | { | 118 | { |
97 | alertCount++; | 119 | alertCount++; |
98 | if ( alertCount < priority ) | 120 | if ( alertCount < priority ) |
99 | return; | 121 | return; |
100 | if ( priority > currentPriority ) | 122 | if ( priority > currentPriority ) |
101 | return; | 123 | return; |
102 | currentPriority = priority; | 124 | currentPriority = priority; |
103 | setText( text ); | 125 | setText( text ); |
104 | show(); | 126 | show(); |
105 | } | 127 | } |
106 | 128 | ||
107 | 129 | ||
108 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) | 130 | void DesktopPowerAlerter::hideEvent( QHideEvent *e ) |
109 | { | 131 | { |
110 | QMessageBox::hideEvent( e ); | 132 | QMessageBox::hideEvent( e ); |
111 | alertCount = 0; | 133 | alertCount = 0; |
112 | currentPriority = INT_MAX; | 134 | currentPriority = INT_MAX; |
113 | } | 135 | } |
114 | 136 | ||
115 | 137 | ||
116 | 138 | ||
117 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type t ) | 139 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type t ) |
118 | : QPEApplication( argc, argv, t ) | 140 | : QPEApplication( argc, argv, t ) |
119 | { | 141 | { |
120 | 142 | ||
121 | QTimer *t = new QTimer( this ); | 143 | QTimer *t = new QTimer( this ); |
122 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); | 144 | connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); |
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 | ||
129 | DesktopApplication::~DesktopApplication() | 155 | DesktopApplication::~DesktopApplication() |
130 | { | 156 | { |
131 | delete ps; | 157 | delete ps; |
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 | ||
138 | #ifdef Q_WS_QWS | 180 | #ifdef Q_WS_QWS |
139 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 181 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
140 | { | 182 | { |
141 | qpedesktop->checkMemory(); | 183 | qpedesktop->checkMemory(); |
142 | 184 | ||
143 | if ( e->type == QWSEvent::Key ) { | 185 | if ( e->type == QWSEvent::Key ) { |
144 | QWSKeyEvent *ke = (QWSKeyEvent *)e; | 186 | QWSKeyEvent *ke = (QWSKeyEvent *)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; |
148 | if ( !keyboardGrabbed() ) { | 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 | |||
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(); |
151 | return TRUE; | 201 | return TRUE; |
152 | } | 202 | } |
153 | if ( ke->simpleData.keycode == Key_F10 ) { | 203 | if ( ke->simpleData.keycode == Key_F10 ) { |
154 | if ( !press && cardSendTimer ) { | 204 | if ( !press && cardSendTimer ) { |
155 | emit contacts(); | 205 | emit contacts(); |
156 | delete cardSendTimer; | 206 | delete cardSendTimer; |
157 | } else if ( press ) { | 207 | } else if ( press ) { |
158 | cardSendTimer = new QTimer(); | 208 | cardSendTimer = new QTimer(); |
159 | cardSendTimer->start( 2000, TRUE ); | 209 | cardSendTimer->start( 2000, TRUE ); |
160 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); | 210 | connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); |
161 | } | 211 | } |
162 | return TRUE; | 212 | return TRUE; |
163 | } | 213 | } |
164 | /* menu key now opens application menu/toolbar | 214 | /* menu key now opens application menu/toolbar |
165 | if ( ke->simpleData.keycode == Key_F11 ) { | 215 | if ( ke->simpleData.keycode == Key_F11 ) { |
166 | if ( press ) emit menu(); | 216 | if ( press ) emit menu(); |
167 | return TRUE; | 217 | return TRUE; |
168 | } | 218 | } |
169 | */ | 219 | */ |
170 | if ( ke->simpleData.keycode == Key_F12 ) { | 220 | if ( ke->simpleData.keycode == Key_F12 ) { |
171 | while( activePopupWidget() ) | 221 | while( activePopupWidget() ) |
172 | activePopupWidget()->close(); | 222 | activePopupWidget()->close(); |
173 | if ( press ) emit launch(); | 223 | if ( press ) emit launch(); |
174 | return TRUE; | 224 | return TRUE; |
175 | } | 225 | } |
176 | if ( ke->simpleData.keycode == Key_F13 ) { | 226 | if ( ke->simpleData.keycode == Key_F13 ) { |
177 | if ( press ) emit email(); | 227 | if ( press ) emit email(); |
178 | return TRUE; | 228 | return TRUE; |
179 | } | 229 | } |
180 | } | 230 | } |
181 | if ( ke->simpleData.keycode == Key_F34 ) { | 231 | /* |
232 | if ( ke->simpleData.keycode == 4096 ) { | ||
233 | QCopEnvelope e("QPE/VMemo", "toggleRecord()"); | ||
234 | return TRUE; | ||
235 | } | ||
236 | */ | ||
237 | if ( ke->simpleData.keycode == Key_F34 ) { | ||
182 | if ( press ) emit power(); | 238 | if ( press ) emit power(); |
183 | return TRUE; | 239 | return TRUE; |
184 | } | 240 | } |
185 | if ( ke->simpleData.keycode == Key_F35 ) { | 241 | if ( ke->simpleData.keycode == Key_F35 ) { |
186 | if ( press ) emit backlight(); | 242 | if ( press ) emit backlight(); |
187 | return TRUE; | 243 | return TRUE; |
188 | } | 244 | } |
189 | if ( ke->simpleData.keycode == Key_F32 ) { | 245 | if ( ke->simpleData.keycode == Key_F32 ) { |
190 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); | 246 | if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); |
191 | return TRUE; | 247 | return TRUE; |
192 | } | 248 | } |
193 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { | 249 | if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { |
194 | if ( press ) emit symbol(); | 250 | if ( press ) emit symbol(); |
195 | return TRUE; | 251 | return TRUE; |
196 | } | 252 | } |
197 | if ( ke->simpleData.keycode == Key_NumLock ) { | 253 | if ( ke->simpleData.keycode == Key_NumLock ) { |
198 | if ( press ) emit numLockStateToggle(); | 254 | if ( press ) emit numLockStateToggle(); |
199 | } | 255 | } |
200 | if ( ke->simpleData.keycode == Key_CapsLock ) { | 256 | if ( ke->simpleData.keycode == Key_CapsLock ) { |
201 | if ( press ) emit capsLockStateToggle(); | 257 | if ( press ) emit capsLockStateToggle(); |
202 | } | 258 | } |
203 | if ( press ) | 259 | if ( press ) |
204 | qpedesktop->keyClick(); | 260 | qpedesktop->keyClick(); |
205 | } else { | 261 | } else { |
206 | if ( e->type == QWSEvent::Mouse ) { | 262 | if ( e->type == QWSEvent::Mouse ) { |
207 | QWSMouseEvent *me = (QWSMouseEvent *)e; | 263 | QWSMouseEvent *me = (QWSMouseEvent *)e; |
208 | static bool up = TRUE; | 264 | static bool up = TRUE; |
209 | if ( me->simpleData.state&LeftButton ) { | 265 | if ( me->simpleData.state&LeftButton ) { |
210 | if ( up ) { | 266 | if ( up ) { |
211 | up = FALSE; | 267 | up = FALSE; |
212 | qpedesktop->screenClick(); | 268 | qpedesktop->screenClick(); |
213 | } | 269 | } |
214 | } else { | 270 | } else { |
215 | up = TRUE; | 271 | up = TRUE; |
216 | } | 272 | } |
217 | } | 273 | } |
218 | } | 274 | } |
219 | 275 | ||
220 | return QPEApplication::qwsEventFilter( e ); | 276 | return QPEApplication::qwsEventFilter( e ); |
221 | } | 277 | } |
222 | #endif | 278 | #endif |
223 | 279 | ||
224 | void DesktopApplication::psTimeout() | 280 | void DesktopApplication::psTimeout() |
225 | { | 281 | { |
226 | qpedesktop->checkMemory(); // in case no events are being generated | 282 | qpedesktop->checkMemory(); // in case no events are being generated |
227 | 283 | ||
228 | *ps = PowerStatusManager::readStatus(); | 284 | *ps = PowerStatusManager::readStatus(); |
229 | 285 | ||
230 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { | 286 | if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { |
231 | pa->alert( tr( "Battery is running very low." ), 6 ); | 287 | pa->alert( tr( "Battery is running very low." ), 6 ); |
232 | } | 288 | } |
233 | 289 | ||
234 | if ( ps->batteryStatus() == PowerStatus::Critical ) { | 290 | if ( ps->batteryStatus() == PowerStatus::Critical ) { |
235 | pa->alert( tr( "Battery level is critical!\n" | 291 | pa->alert( tr( "Battery level is critical!\n" |
236 | "Keep power off until power restored!" ), 1 ); | 292 | "Keep power off until power restored!" ), 1 ); |
237 | } | 293 | } |
238 | 294 | ||
239 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { | 295 | if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { |
240 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); | 296 | pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); |
241 | } | 297 | } |
242 | } | 298 | } |
243 | 299 | ||
244 | 300 | ||
245 | void DesktopApplication::sendCard() | 301 | void DesktopApplication::sendCard() |
246 | { | 302 | { |
247 | delete cardSendTimer; | 303 | delete cardSendTimer; |
248 | cardSendTimer = 0; | 304 | cardSendTimer = 0; |
249 | QString card = getenv("HOME"); | 305 | QString card = getenv("HOME"); |
250 | card += "/Applications/addressbook/businesscard.vcf"; | 306 | card += "/Applications/addressbook/businesscard.vcf"; |
251 | 307 | ||
252 | if ( QFile::exists( card ) ) { | 308 | if ( QFile::exists( card ) ) { |
253 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); | 309 | QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); |
254 | QString mimetype = "text/x-vCard"; | 310 | QString mimetype = "text/x-vCard"; |
255 | e << tr("business card") << card << mimetype; | 311 | e << tr("business card") << card << mimetype; |
256 | } | 312 | } |
257 | } | 313 | } |
258 | 314 | ||
259 | #if defined(QPE_HAVE_MEMALERTER) | 315 | #if defined(QPE_HAVE_MEMALERTER) |
260 | QPE_MEMALERTER_IMPL | 316 | QPE_MEMALERTER_IMPL |
261 | #endif | 317 | #endif |
262 | 318 | ||
263 | #if defined(CUSTOM_SOUND_IMPL) | 319 | #if defined(CUSTOM_SOUND_IMPL) |
264 | CUSTOM_SOUND_IMPL | 320 | CUSTOM_SOUND_IMPL |
265 | #endif | 321 | #endif |
266 | 322 | ||
267 | //=========================================================================== | 323 | //=========================================================================== |
268 | 324 | ||
269 | Desktop::Desktop() : | 325 | Desktop::Desktop() : |
270 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), | 326 | QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), |
271 | qcopBridge( 0 ), | 327 | qcopBridge( 0 ), |
272 | transferServer( 0 ), | 328 | transferServer( 0 ), |
273 | packageSlave( 0 ) | 329 | packageSlave( 0 ) |
274 | { | 330 | { |
275 | #ifdef CUSTOM_SOUND_INIT | 331 | #ifdef CUSTOM_SOUND_INIT |
276 | CUSTOM_SOUND_INIT; | 332 | CUSTOM_SOUND_INIT; |
277 | #endif | 333 | #endif |
278 | 334 | ||
279 | qpedesktop = this; | 335 | qpedesktop = this; |
280 | 336 | ||
281 | // bg = new Info( this ); | 337 | // bg = new Info( this ); |
282 | tb = new TaskBar; | 338 | tb = new TaskBar; |
283 | 339 | ||
284 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); | 340 | launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); |
285 | 341 | ||
286 | connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); | 342 | connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); |
287 | connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); | 343 | connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); |
288 | 344 | ||
289 | int displayw = qApp->desktop()->width(); | 345 | int displayw = qApp->desktop()->width(); |
290 | int displayh = qApp->desktop()->height(); | 346 | int displayh = qApp->desktop()->height(); |
291 | 347 | ||
292 | 348 | ||
293 | QSize sz = tb->sizeHint(); | 349 | QSize sz = tb->sizeHint(); |
294 | 350 | ||
295 | setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 351 | setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
296 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); | 352 | tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); |
297 | 353 | ||
298 | tb->show(); | 354 | tb->show(); |
299 | launcher->showMaximized(); | 355 | launcher->showMaximized(); |
300 | launcher->show(); | 356 | launcher->show(); |
301 | launcher->raise(); | 357 | launcher->raise(); |
302 | #if defined(QPE_HAVE_MEMALERTER) | 358 | #if defined(QPE_HAVE_MEMALERTER) |
303 | initMemalerter(); | 359 | initMemalerter(); |
304 | #endif | 360 | #endif |
305 | // start services | 361 | // start services |
306 | startTransferServer(); | 362 | startTransferServer(); |
307 | (void) new IrServer( this ); | 363 | (void) new IrServer( this ); |
308 | rereadVolumes(); | 364 | rereadVolumes(); |
309 | 365 | ||
310 | packageSlave = new PackageSlave( this ); | 366 | packageSlave = new PackageSlave( this ); |
311 | connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes())); | 367 | connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes())); |
312 | 368 | ||
313 | qApp->installEventFilter( this ); | 369 | qApp->installEventFilter( this ); |
314 | } | 370 | } |
315 | 371 | ||
316 | void Desktop::show() | 372 | void Desktop::show() |
317 | { | 373 | { |
318 | login(TRUE); | 374 | login(TRUE); |
319 | QWidget::show(); | 375 | QWidget::show(); |
320 | } | 376 | } |
321 | 377 | ||
322 | Desktop::~Desktop() | 378 | Desktop::~Desktop() |
323 | { | 379 | { |
324 | delete launcher; | 380 | delete launcher; |
325 | delete tb; | 381 | delete tb; |
326 | delete qcopBridge; | 382 | delete qcopBridge; |
327 | delete transferServer; | 383 | delete transferServer; |
328 | } | 384 | } |
329 | 385 | ||
330 | bool Desktop::recoverMemory() | 386 | bool Desktop::recoverMemory() |
331 | { | 387 | { |
332 | return tb->recoverMemory(); | 388 | return tb->recoverMemory(); |
333 | } | 389 | } |
334 | 390 | ||
335 | void Desktop::checkMemory() | 391 | void Desktop::checkMemory() |
336 | { | 392 | { |
337 | #if defined(QPE_HAVE_MEMALERTER) | 393 | #if defined(QPE_HAVE_MEMALERTER) |
338 | static bool ignoreNormal=FALSE; | 394 | static bool ignoreNormal=FALSE; |
339 | static bool existingMessage=FALSE; | 395 | static bool existingMessage=FALSE; |
340 | 396 | ||
341 | if(existingMessage) | 397 | if(existingMessage) |
342 | return; // don't show a second message while still on first | 398 | return; // don't show a second message while still on first |
343 | 399 | ||
344 | existingMessage = TRUE; | 400 | existingMessage = TRUE; |
345 | switch ( memstate ) { | 401 | switch ( memstate ) { |
346 | case Unknown: | 402 | case Unknown: |
347 | break; | 403 | break; |
348 | case Low: | 404 | case Low: |
349 | memstate = Unknown; | 405 | memstate = Unknown; |
350 | if ( recoverMemory() ) | 406 | if ( recoverMemory() ) |
351 | ignoreNormal = TRUE; | 407 | ignoreNormal = TRUE; |
352 | else | 408 | else |
353 | QMessageBox::warning( 0 , "Memory Status", | 409 | QMessageBox::warning( 0 , "Memory Status", |
354 | "The memory smacks of shortage. \n" | 410 | "The memory smacks of shortage. \n" |
355 | "Please save data. " ); | 411 | "Please save data. " ); |
356 | break; | 412 | break; |
357 | case Normal: | 413 | case Normal: |
358 | memstate = Unknown; | 414 | memstate = Unknown; |
359 | if ( ignoreNormal ) | 415 | if ( ignoreNormal ) |
360 | ignoreNormal = FALSE; | 416 | ignoreNormal = FALSE; |
361 | else | 417 | else |
362 | QMessageBox::information ( 0 , "Memory Status", | 418 | QMessageBox::information ( 0 , "Memory Status", |
363 | "There is enough memory again." ); | 419 | "There is enough memory again." ); |
364 | break; | 420 | break; |
365 | case VeryLow: | 421 | case VeryLow: |
366 | memstate = Unknown; | 422 | memstate = Unknown; |
367 | QMessageBox::critical( 0 , "Memory Status", | 423 | QMessageBox::critical( 0 , "Memory Status", |
368 | "The memory is very low. \n" | 424 | "The memory is very low. \n" |
369 | "Please end this application \n" | 425 | "Please end this application \n" |
370 | "immediately." ); | 426 | "immediately." ); |
371 | recoverMemory(); | 427 | recoverMemory(); |
372 | } | 428 | } |
373 | existingMessage = FALSE; | 429 | existingMessage = FALSE; |
374 | #endif | 430 | #endif |
375 | } | 431 | } |
376 | 432 | ||
377 | static bool isVisibleWindow(int wid) | 433 | static bool isVisibleWindow(int wid) |
378 | { | 434 | { |
379 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 435 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
380 | QWSWindow* w; | 436 | QWSWindow* w; |
381 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 437 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
382 | if ( w->winId() == wid ) | 438 | if ( w->winId() == wid ) |
383 | return !w->isFullyObscured(); | 439 | return !w->isFullyObscured(); |
384 | } | 440 | } |
385 | return FALSE; | 441 | return FALSE; |
386 | } | 442 | } |
387 | 443 | ||
388 | static bool hasVisibleWindow(const QString& clientname) | 444 | static bool hasVisibleWindow(const QString& clientname) |
389 | { | 445 | { |
390 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 446 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
391 | QWSWindow* w; | 447 | QWSWindow* w; |
392 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 448 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
393 | if ( w->client()->identity() == clientname && !w->isFullyObscured() ) | 449 | if ( w->client()->identity() == clientname && !w->isFullyObscured() ) |
394 | return TRUE; | 450 | return TRUE; |
395 | } | 451 | } |
396 | return FALSE; | 452 | return FALSE; |
397 | } | 453 | } |
398 | 454 | ||
399 | void Desktop::raiseLauncher() | 455 | void Desktop::raiseLauncher() |
400 | { | 456 | { |
401 | if ( isVisibleWindow(launcher->winId()) ) | 457 | if ( isVisibleWindow(launcher->winId()) ) |
402 | launcher->nextView(); | 458 | launcher->nextView(); |
403 | else | 459 | else |
404 | launcher->raise(); | 460 | launcher->raise(); |
405 | } | 461 | } |
406 | 462 | ||
407 | void Desktop::executeOrModify(const QString& appLnkFile) | 463 | void Desktop::executeOrModify(const QString& appLnkFile) |
408 | { | 464 | { |
409 | AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile); | 465 | AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile); |
410 | if ( lnk.isValid() ) { | 466 | if ( lnk.isValid() ) { |
411 | QCString app = lnk.exec().utf8(); | 467 | QCString app = lnk.exec().utf8(); |
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 | |||
@@ -1,129 +1,133 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef __DESKTOP_H__ | 21 | #ifndef __DESKTOP_H__ |
22 | #define __DESKTOP_H__ | 22 | #define __DESKTOP_H__ |
23 | 23 | ||
24 | 24 | ||
25 | #include "shutdownimpl.h" | 25 | #include "shutdownimpl.h" |
26 | 26 | ||
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | 30 | ||
31 | class Background; | 31 | class Background; |
32 | class Launcher; | 32 | class Launcher; |
33 | class TaskBar; | 33 | class TaskBar; |
34 | class PowerStatus; | 34 | class PowerStatus; |
35 | class QCopBridge; | 35 | class QCopBridge; |
36 | class TransferServer; | 36 | class TransferServer; |
37 | class DesktopPowerAlerter; | 37 | class DesktopPowerAlerter; |
38 | class PackageSlave; | 38 | class PackageSlave; |
39 | 39 | ||
40 | class DesktopApplication : public QPEApplication | 40 | class DesktopApplication : public QPEApplication |
41 | { | 41 | { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | DesktopApplication( int& argc, char **argv, Type t ); | 44 | DesktopApplication( int& argc, char **argv, Type t ); |
45 | ~DesktopApplication(); | 45 | ~DesktopApplication(); |
46 | signals: | 46 | signals: |
47 | void home(); | 47 | void home(); |
48 | void datebook(); | 48 | void datebook(); |
49 | void contacts(); | 49 | void contacts(); |
50 | void launch(); | 50 | void launch(); |
51 | void email(); | 51 | void email(); |
52 | void backlight(); | 52 | void backlight(); |
53 | void power(); | 53 | void power(); |
54 | void symbol(); | 54 | void symbol(); |
55 | void numLockStateToggle(); | 55 | void numLockStateToggle(); |
56 | void capsLockStateToggle(); | 56 | void capsLockStateToggle(); |
57 | void prepareForRestart(); | 57 | void prepareForRestart(); |
58 | 58 | ||
59 | protected: | 59 | protected: |
60 | #ifdef Q_WS_QWS | 60 | #ifdef Q_WS_QWS |
61 | bool qwsEventFilter( QWSEvent * ); | 61 | bool qwsEventFilter( QWSEvent * ); |
62 | #endif | 62 | #endif |
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(); |
69 | void sendCard(); | 72 | void sendCard(); |
70 | private: | 73 | 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 | ||
77 | class Desktop : public QWidget { | 81 | class Desktop : public QWidget { |
78 | Q_OBJECT | 82 | Q_OBJECT |
79 | public: | 83 | public: |
80 | Desktop(); | 84 | Desktop(); |
81 | ~Desktop(); | 85 | ~Desktop(); |
82 | 86 | ||
83 | static bool screenLocked(); | 87 | static bool screenLocked(); |
84 | 88 | ||
85 | void show(); | 89 | void show(); |
86 | void checkMemory(); | 90 | void checkMemory(); |
87 | 91 | ||
88 | void keyClick(); | 92 | void keyClick(); |
89 | void screenClick(); | 93 | void screenClick(); |
90 | static void soundAlarm(); | 94 | static void soundAlarm(); |
91 | 95 | ||
92 | public slots: | 96 | public slots: |
93 | void raiseDatebook(); | 97 | void raiseDatebook(); |
94 | void raiseContacts(); | 98 | void raiseContacts(); |
95 | void raiseMenu(); | 99 | void raiseMenu(); |
96 | void raiseLauncher(); | 100 | void raiseLauncher(); |
97 | void raiseEmail(); | 101 | void raiseEmail(); |
98 | void togglePower(); | 102 | void togglePower(); |
99 | void toggleLight(); | 103 | void toggleLight(); |
100 | void toggleNumLockState(); | 104 | void toggleNumLockState(); |
101 | void toggleCapsLockState(); | 105 | void toggleCapsLockState(); |
102 | void toggleSymbolInput(); | 106 | void toggleSymbolInput(); |
103 | void terminateServers(); | 107 | void terminateServers(); |
104 | void rereadVolumes(); | 108 | void rereadVolumes(); |
105 | 109 | ||
106 | protected: | 110 | protected: |
107 | void executeOrModify(const QString& appLnkFile); | 111 | void executeOrModify(const QString& appLnkFile); |
108 | void styleChange( QStyle & ); | 112 | void styleChange( QStyle & ); |
109 | void timerEvent( QTimerEvent *e ); | 113 | void timerEvent( QTimerEvent *e ); |
110 | bool eventFilter( QObject *, QEvent * ); | 114 | bool eventFilter( QObject *, QEvent * ); |
111 | 115 | ||
112 | QWidget *bg; | 116 | QWidget *bg; |
113 | Launcher *launcher; | 117 | Launcher *launcher; |
114 | TaskBar *tb; | 118 | TaskBar *tb; |
115 | 119 | ||
116 | private: | 120 | private: |
117 | void startTransferServer(); | 121 | void startTransferServer(); |
118 | bool recoverMemory(); | 122 | bool recoverMemory(); |
119 | 123 | ||
120 | QCopBridge *qcopBridge; | 124 | QCopBridge *qcopBridge; |
121 | TransferServer *transferServer; | 125 | TransferServer *transferServer; |
122 | PackageSlave *packageSlave; | 126 | PackageSlave *packageSlave; |
123 | 127 | ||
124 | bool keyclick,touchclick; | 128 | bool keyclick,touchclick; |
125 | }; | 129 | }; |
126 | 130 | ||
127 | 131 | ||
128 | #endif // __DESKTOP_H__ | 132 | #endif // __DESKTOP_H__ |
129 | 133 | ||
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 | |||
@@ -1,9 +1,9 @@ | |||
1 | Files: bin/qpe apps/Settings/Calibrate.desktop | 1 | Files: bin/qpe apps/Settings/Calibrate.desktop |
2 | Priority: required | 2 | 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. \ No newline at end of file |