summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp58
1 files changed, 32 insertions, 26 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 7662e48..24dce73 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -1,784 +1,790 @@
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/timeconversion.h> 38#include <qpe/timeconversion.h>
39#include <qpe/qcopenvelope_qws.h> 39#include <qpe/qcopenvelope_qws.h>
40#include <qpe/global.h> 40#include <qpe/global.h>
41 41
42#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ ) 42#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
43#include <qpe/custom.h> 43#include <qpe/custom.h>
44#endif 44#endif
45 45
46#include <opie/odevice.h> 46#include <opie/odevice.h>
47 47
48#include <qgfx_qws.h> 48#include <qgfx_qws.h>
49#include <qmainwindow.h> 49#include <qmainwindow.h>
50#include <qmessagebox.h> 50#include <qmessagebox.h>
51#include <qtimer.h> 51#include <qtimer.h>
52#include <qwindowsystem_qws.h> 52#include <qwindowsystem_qws.h>
53 53
54#include <qvaluelist.h> 54#include <qvaluelist.h>
55 55
56#include <stdlib.h> 56#include <stdlib.h>
57#include <unistd.h> 57#include <unistd.h>
58 58
59class QCopKeyRegister 59class QCopKeyRegister
60{ 60{
61public: 61public:
62 QCopKeyRegister() : keyCode(0) { } 62 QCopKeyRegister() : keyCode(0) { }
63 QCopKeyRegister(int k, const QString &c, const QString &m) 63 QCopKeyRegister(int k, const QString &c, const QString &m)
64 : keyCode(k), channel(c), message(m) { } 64 : keyCode(k), channel(c), message(m) { }
65 65
66 int getKeyCode() const { return keyCode; } 66 int getKeyCode() const { return keyCode; }
67 QString getChannel() const { return channel; } 67 QString getChannel() const { return channel; }
68 QString getMessage() const { return message; } 68 QString getMessage() const { return message; }
69 69
70private: 70private:
71 int keyCode; 71 int keyCode;
72 QString channel, message; 72 QString channel, message;
73}; 73};
74 74
75typedef QValueList<QCopKeyRegister> KeyRegisterList; 75typedef QValueList<QCopKeyRegister> KeyRegisterList;
76KeyRegisterList keyRegisterList; 76KeyRegisterList keyRegisterList;
77 77
78static Desktop* qpedesktop = 0; 78static Desktop* qpedesktop = 0;
79static int loggedin=0; 79static int loggedin=0;
80static void login(bool at_poweron) 80static void login(bool at_poweron)
81{ 81{
82 if ( !loggedin ) { 82 if ( !loggedin ) {
83 Global::terminateBuiltin("calibrate"); 83 Global::terminateBuiltin("calibrate");
84 Password::authenticate(at_poweron); 84 Password::authenticate(at_poweron);
85 loggedin=1; 85 loggedin=1;
86 QCopEnvelope e( "QPE/Desktop", "unlocked()" ); 86 QCopEnvelope e( "QPE/Desktop", "unlocked()" );
87 } 87 }
88} 88}
89 89
90bool Desktop::screenLocked() 90bool Desktop::screenLocked()
91{ 91{
92 return loggedin == 0; 92 return loggedin == 0;
93} 93}
94 94
95/* 95/*
96 Priority is number of alerts that are needed to pop up 96 Priority is number of alerts that are needed to pop up
97 alert. 97 alert.
98 */ 98 */
99class DesktopPowerAlerter : public QMessageBox 99class DesktopPowerAlerter : public QMessageBox
100{ 100{
101public: 101public:
102 DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) 102 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
103 : QMessageBox( tr("Battery Status"), "Low Battery", 103 : QMessageBox( tr("Battery Status"), "Low Battery",
104 QMessageBox::Critical, 104 QMessageBox::Critical,
105 QMessageBox::Ok | QMessageBox::Default, 105 QMessageBox::Ok | QMessageBox::Default,
106 QMessageBox::NoButton, QMessageBox::NoButton, 106 QMessageBox::NoButton, QMessageBox::NoButton,
107 parent, name, FALSE ) 107 parent, name, FALSE )
108 { 108 {
109 currentPriority = INT_MAX; 109 currentPriority = INT_MAX;
110 alertCount = 0; 110 alertCount = 0;
111 } 111 }
112 112
113 void alert( const QString &text, int priority ); 113 void alert( const QString &text, int priority );
114 void hideEvent( QHideEvent * ); 114 void hideEvent( QHideEvent * );
115private: 115private:
116 int currentPriority; 116 int currentPriority;
117 int alertCount; 117 int alertCount;
118}; 118};
119 119
120void DesktopPowerAlerter::alert( const QString &text, int priority ) 120void DesktopPowerAlerter::alert( const QString &text, int priority )
121{ 121{
122 alertCount++; 122 alertCount++;
123 if ( alertCount < priority ) 123 if ( alertCount < priority )
124 return; 124 return;
125 if ( priority > currentPriority ) 125 if ( priority > currentPriority )
126 return; 126 return;
127 currentPriority = priority; 127 currentPriority = priority;
128 setText( text ); 128 setText( text );
129 show(); 129 show();
130} 130}
131 131
132 132
133void DesktopPowerAlerter::hideEvent( QHideEvent *e ) 133void DesktopPowerAlerter::hideEvent( QHideEvent *e )
134{ 134{
135 QMessageBox::hideEvent( e ); 135 QMessageBox::hideEvent( e );
136 alertCount = 0; 136 alertCount = 0;
137 currentPriority = INT_MAX; 137 currentPriority = INT_MAX;
138} 138}
139 139
140 140
141 141
142DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 142DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
143 : QPEApplication( argc, argv, appType ) 143 : QPEApplication( argc, argv, appType )
144{ 144{
145 145
146 QTimer *t = new QTimer( this ); 146 QTimer *t = new QTimer( this );
147 connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) ); 147 connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) );
148 t->start( 10000 ); 148 t->start( 10000 );
149 ps = new PowerStatus; 149 ps = new PowerStatus;
150 pa = new DesktopPowerAlerter( 0 ); 150 pa = new DesktopPowerAlerter( 0 );
151 151
152 channel = new QCopChannel( "QPE/Desktop", this ); 152 channel = new QCopChannel( "QPE/Desktop", this );
153 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 153 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
154 this, SLOT(receive(const QCString&, const QByteArray&)) ); 154 this, SLOT(receive(const QCString&, const QByteArray&)) );
155} 155}
156 156
157 157
158DesktopApplication::~DesktopApplication() 158DesktopApplication::~DesktopApplication()
159{ 159{
160 delete ps; 160 delete ps;
161 delete pa; 161 delete pa;
162} 162}
163 163
164void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) 164void DesktopApplication::receive( const QCString &msg, const QByteArray &data )
165{ 165{
166 QDataStream stream( data, IO_ReadOnly ); 166 QDataStream stream( data, IO_ReadOnly );
167 if (msg == "keyRegister(int key, QString channel, QString message)") 167 if (msg == "keyRegister(int key, QString channel, QString message)")
168 { 168 {
169 int k; 169 int k;
170 QString c, m; 170 QString c, m;
171 stream >> k; 171 stream >> k;
172 stream >> c; 172 stream >> c;
173 stream >> m; 173 stream >> m;
174 174
175 qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m ); 175 qWarning("KeyRegisterReceived: %i, %s, %s", k, (const char*)c, (const char *)m );
176 keyRegisterList.append(QCopKeyRegister(k,c,m)); 176 keyRegisterList.append(QCopKeyRegister(k,c,m));
177 } 177 }
178 else if (msg == "suspend()"){ 178 else if (msg == "suspend()"){
179 emit power(); 179 emit power();
180 } 180 }
181 181
182} 182}
183 183
184enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; 184enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown;
185 185
186#ifdef Q_WS_QWS 186#ifdef Q_WS_QWS
187bool DesktopApplication::qwsEventFilter( QWSEvent *e ) 187bool DesktopApplication::qwsEventFilter( QWSEvent *e )
188{ 188{
189 qpedesktop->checkMemory(); 189 qpedesktop->checkMemory();
190 190
191 if ( e->type == QWSEvent::Key ) { 191 if ( e->type == QWSEvent::Key ) {
192 QWSKeyEvent *ke = (QWSKeyEvent *)e; 192 QWSKeyEvent *ke = (QWSKeyEvent *)e;
193 if ( !loggedin && ke->simpleData.keycode != Key_F34 ) 193 if ( !loggedin && ke->simpleData.keycode != Key_F34 )
194 return TRUE; 194 return TRUE;
195 bool press = ke->simpleData.is_press; 195 bool press = ke->simpleData.is_press;
196 bool autoRepeat= ke->simpleData.is_auto_repeat; 196 bool autoRepeat= ke->simpleData.is_auto_repeat;
197 if (!keyRegisterList.isEmpty()) 197
198 { 198 /*
199 app that registers key/message to be sent back to the app, when it doesn't have focus,
200 when user presses key, unless keyboard has been requested from app.
201 will not send multiple repeats if user holds key
202 i.e. one shot
203
204 */
205 if (!keyRegisterList.isEmpty()) {
199 KeyRegisterList::Iterator it; 206 KeyRegisterList::Iterator it;
200 for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) 207 for( it = keyRegisterList.begin(); it != keyRegisterList.end(); ++it ) {
201 { 208 if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat && !keyboardGrabbed()) {
202 if ((*it).getKeyCode() == ke->simpleData.keycode && !autoRepeat) { 209 if(press) qDebug("press"); else qDebug("release");
203 if(press) qDebug("press"); else qDebug("release"); 210 QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8());
204 QCopEnvelope((*it).getChannel().utf8(), (*it).getMessage().utf8());
205 } 211 }
206 } 212 }
207 } 213 }
208 214
209 if ( !keyboardGrabbed() ) { 215 if ( !keyboardGrabbed() ) {
210 if ( ke->simpleData.keycode == Key_F9 ) { 216 if ( ke->simpleData.keycode == Key_F9 ) {
211 if ( press ) emit datebook(); 217 if ( press ) emit datebook();
212 return TRUE; 218 return TRUE;
213 } 219 }
214 if ( ke->simpleData.keycode == Key_F10 ) { 220 if ( ke->simpleData.keycode == Key_F10 ) {
215 if ( !press && cardSendTimer ) { 221 if ( !press && cardSendTimer ) {
216 emit contacts(); 222 emit contacts();
217 delete cardSendTimer; 223 delete cardSendTimer;
218 } else if ( press ) { 224 } else if ( press ) {
219 cardSendTimer = new QTimer(); 225 cardSendTimer = new QTimer();
220 cardSendTimer->start( 2000, TRUE ); 226 cardSendTimer->start( 2000, TRUE );
221 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) ); 227 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) );
222 } 228 }
223 return TRUE; 229 return TRUE;
224 } 230 }
225 /* menu key now opens application menu/toolbar 231 /* menu key now opens application menu/toolbar
226 if ( ke->simpleData.keycode == Key_F11 ) { 232 if ( ke->simpleData.keycode == Key_F11 ) {
227 if ( press ) emit menu(); 233 if ( press ) emit menu();
228 return TRUE; 234 return TRUE;
229 } 235 }
230 */ 236 */
231 if ( ke->simpleData.keycode == Key_F12 ) { 237 if ( ke->simpleData.keycode == Key_F12 ) {
232 while( activePopupWidget() ) 238 while( activePopupWidget() )
233 activePopupWidget()->close(); 239 activePopupWidget()->close();
234 if ( press ) emit launch(); 240 if ( press ) emit launch();
235 return TRUE; 241 return TRUE;
236 } 242 }
237 if ( ke->simpleData.keycode == Key_F13 ) { 243 if ( ke->simpleData.keycode == Key_F13 ) {
238 if ( press ) emit email(); 244 if ( press ) emit email();
239 return TRUE; 245 return TRUE;
240 } 246 }
241 } 247 }
242 248
243 if ( ke->simpleData.keycode == Key_F34 ) { 249 if ( ke->simpleData.keycode == Key_F34 ) {
244 if ( press ) emit power(); 250 if ( press ) emit power();
245 return TRUE; 251 return TRUE;
246 } 252 }
247// This was used for the iPAQ PowerButton 253// This was used for the iPAQ PowerButton
248// See main.cpp for new KeyboardFilter 254// See main.cpp for new KeyboardFilter
249// 255//
250// if ( ke->simpleData.keycode == Key_SysReq ) { 256// if ( ke->simpleData.keycode == Key_SysReq ) {
251// if ( press ) emit power(); 257// if ( press ) emit power();
252// return TRUE; 258// return TRUE;
253// } 259// }
254 if ( ke->simpleData.keycode == Key_F35 ) { 260 if ( ke->simpleData.keycode == Key_F35 ) {
255 if ( press ) emit backlight(); 261 if ( press ) emit backlight();
256 return TRUE; 262 return TRUE;
257 } 263 }
258 if ( ke->simpleData.keycode == Key_F32 ) { 264 if ( ke->simpleData.keycode == Key_F32 ) {
259 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" ); 265 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" );
260 return TRUE; 266 return TRUE;
261 } 267 }
262 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) { 268 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) {
263 if ( press ) emit symbol(); 269 if ( press ) emit symbol();
264 return TRUE; 270 return TRUE;
265 } 271 }
266 if ( ke->simpleData.keycode == Key_NumLock ) { 272 if ( ke->simpleData.keycode == Key_NumLock ) {
267 if ( press ) emit numLockStateToggle(); 273 if ( press ) emit numLockStateToggle();
268 } 274 }
269 if ( ke->simpleData.keycode == Key_CapsLock ) { 275 if ( ke->simpleData.keycode == Key_CapsLock ) {
270 if ( press ) emit capsLockStateToggle(); 276 if ( press ) emit capsLockStateToggle();
271 } 277 }
272 if (( press && !autoRepeat ) || ( !press && autoRepeat )) 278 if (( press && !autoRepeat ) || ( !press && autoRepeat ))
273 qpedesktop->keyClick(); 279 qpedesktop->keyClick();
274 } else { 280 } else {
275 if ( e->type == QWSEvent::Mouse ) { 281 if ( e->type == QWSEvent::Mouse ) {
276 QWSMouseEvent *me = (QWSMouseEvent *)e; 282 QWSMouseEvent *me = (QWSMouseEvent *)e;
277 static bool up = TRUE; 283 static bool up = TRUE;
278 if ( me->simpleData.state&LeftButton ) { 284 if ( me->simpleData.state&LeftButton ) {
279 if ( up ) { 285 if ( up ) {
280 up = FALSE; 286 up = FALSE;
281 qpedesktop->screenClick(); 287 qpedesktop->screenClick();
282 } 288 }
283 } else { 289 } else {
284 up = TRUE; 290 up = TRUE;
285 } 291 }
286 } 292 }
287 } 293 }
288 294
289 return QPEApplication::qwsEventFilter( e ); 295 return QPEApplication::qwsEventFilter( e );
290} 296}
291#endif 297#endif
292 298
293void DesktopApplication::psTimeout() 299void DesktopApplication::psTimeout()
294{ 300{
295 qpedesktop->checkMemory(); // in case no events are being generated 301 qpedesktop->checkMemory(); // in case no events are being generated
296 302
297 *ps = PowerStatusManager::readStatus(); 303 *ps = PowerStatusManager::readStatus();
298 304
299 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) { 305 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) {
300 pa->alert( tr( "Battery is running very low." ), 6 ); 306 pa->alert( tr( "Battery is running very low." ), 6 );
301 } 307 }
302 308
303 if ( ps->batteryStatus() == PowerStatus::Critical ) { 309 if ( ps->batteryStatus() == PowerStatus::Critical ) {
304 pa->alert( tr( "Battery level is critical!\n" 310 pa->alert( tr( "Battery level is critical!\n"
305 "Keep power off until power restored!" ), 1 ); 311 "Keep power off until power restored!" ), 1 );
306 } 312 }
307 313
308 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { 314 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) {
309 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); 315 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 );
310 } 316 }
311} 317}
312 318
313 319
314void DesktopApplication::sendCard() 320void DesktopApplication::sendCard()
315{ 321{
316 delete cardSendTimer; 322 delete cardSendTimer;
317 cardSendTimer = 0; 323 cardSendTimer = 0;
318 QString card = getenv("HOME"); 324 QString card = getenv("HOME");
319 card += "/Applications/addressbook/businesscard.vcf"; 325 card += "/Applications/addressbook/businesscard.vcf";
320 326
321 if ( QFile::exists( card ) ) { 327 if ( QFile::exists( card ) ) {
322 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); 328 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
323 QString mimetype = "text/x-vCard"; 329 QString mimetype = "text/x-vCard";
324 e << tr("business card") << card << mimetype; 330 e << tr("business card") << card << mimetype;
325 } 331 }
326} 332}
327 333
328#if defined(QPE_HAVE_MEMALERTER) 334#if defined(QPE_HAVE_MEMALERTER)
329QPE_MEMALERTER_IMPL 335QPE_MEMALERTER_IMPL
330#endif 336#endif
331 337
332//=========================================================================== 338//===========================================================================
333 339
334Desktop::Desktop() : 340Desktop::Desktop() :
335 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ), 341 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
336 qcopBridge( 0 ), 342 qcopBridge( 0 ),
337 transferServer( 0 ), 343 transferServer( 0 ),
338 packageSlave( 0 ) 344 packageSlave( 0 )
339{ 345{
340 qpedesktop = this; 346 qpedesktop = this;
341 347
342// bg = new Info( this ); 348// bg = new Info( this );
343 tb = new TaskBar; 349 tb = new TaskBar;
344 350
345 launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader ); 351 launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader );
346 352
347 connect(launcher, SIGNAL(busy()), tb, SLOT(startWait())); 353 connect(launcher, SIGNAL(busy()), tb, SLOT(startWait()));
348 connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&))); 354 connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&)));
349 355
350 int displayw = qApp->desktop()->width(); 356 int displayw = qApp->desktop()->width();
351 int displayh = qApp->desktop()->height(); 357 int displayh = qApp->desktop()->height();
352 358
353 359
354 QSize sz = tb->sizeHint(); 360 QSize sz = tb->sizeHint();
355 361
356 setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); 362 setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
357 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); 363 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
358 364
359 tb->show(); 365 tb->show();
360 launcher->showMaximized(); 366 launcher->showMaximized();
361 launcher->show(); 367 launcher->show();
362 launcher->raise(); 368 launcher->raise();
363#if defined(QPE_HAVE_MEMALERTER) 369#if defined(QPE_HAVE_MEMALERTER)
364 initMemalerter(); 370 initMemalerter();
365#endif 371#endif
366 // start services 372 // start services
367 startTransferServer(); 373 startTransferServer();
368 (void) new IrServer( this ); 374 (void) new IrServer( this );
369 rereadVolumes(); 375 rereadVolumes();
370 376
371 packageSlave = new PackageSlave( this ); 377 packageSlave = new PackageSlave( this );
372 connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes())); 378 connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes()));
373 379
374 qApp->installEventFilter( this ); 380 qApp->installEventFilter( this );
375} 381}
376 382
377void Desktop::show() 383void Desktop::show()
378{ 384{
379 login(TRUE); 385 login(TRUE);
380 QWidget::show(); 386 QWidget::show();
381} 387}
382 388
383Desktop::~Desktop() 389Desktop::~Desktop()
384{ 390{
385 delete launcher; 391 delete launcher;
386 delete tb; 392 delete tb;
387 delete qcopBridge; 393 delete qcopBridge;
388 delete transferServer; 394 delete transferServer;
389} 395}
390 396
391bool Desktop::recoverMemory() 397bool Desktop::recoverMemory()
392{ 398{
393 return tb->recoverMemory(); 399 return tb->recoverMemory();
394} 400}
395 401
396void Desktop::checkMemory() 402void Desktop::checkMemory()
397{ 403{
398#if defined(QPE_HAVE_MEMALERTER) 404#if defined(QPE_HAVE_MEMALERTER)
399 static bool ignoreNormal=FALSE; 405 static bool ignoreNormal=FALSE;
400 static bool existingMessage=FALSE; 406 static bool existingMessage=FALSE;
401 407
402 if(existingMessage) 408 if(existingMessage)
403 return; // don't show a second message while still on first 409 return; // don't show a second message while still on first
404 410
405 existingMessage = TRUE; 411 existingMessage = TRUE;
406 switch ( memstate ) { 412 switch ( memstate ) {
407 case Unknown: 413 case Unknown:
408 break; 414 break;
409 case Low: 415 case Low:
410 memstate = Unknown; 416 memstate = Unknown;
411 if ( recoverMemory() ) 417 if ( recoverMemory() )
412 ignoreNormal = TRUE; 418 ignoreNormal = TRUE;
413 else 419 else
414 QMessageBox::warning( 0 , "Memory Status", 420 QMessageBox::warning( 0 , "Memory Status",
415 "The memory smacks of shortage. \n" 421 "The memory smacks of shortage. \n"
416 "Please save data. " ); 422 "Please save data. " );
417 break; 423 break;
418 case Normal: 424 case Normal:
419 memstate = Unknown; 425 memstate = Unknown;
420 if ( ignoreNormal ) 426 if ( ignoreNormal )
421 ignoreNormal = FALSE; 427 ignoreNormal = FALSE;
422 else 428 else
423 QMessageBox::information ( 0 , "Memory Status", 429 QMessageBox::information ( 0 , "Memory Status",
424 "There is enough memory again." ); 430 "There is enough memory again." );
425 break; 431 break;
426 case VeryLow: 432 case VeryLow:
427 memstate = Unknown; 433 memstate = Unknown;
428 QMessageBox::critical( 0 , "Memory Status", 434 QMessageBox::critical( 0 , "Memory Status",
429 "The memory is very low. \n" 435 "The memory is very low. \n"
430 "Please end this application \n" 436 "Please end this application \n"
431 "immediately." ); 437 "immediately." );
432 recoverMemory(); 438 recoverMemory();
433 } 439 }
434 existingMessage = FALSE; 440 existingMessage = FALSE;
435#endif 441#endif
436} 442}
437 443
438static bool isVisibleWindow(int wid) 444static bool isVisibleWindow(int wid)
439{ 445{
440 const QList<QWSWindow> &list = qwsServer->clientWindows(); 446 const QList<QWSWindow> &list = qwsServer->clientWindows();
441 QWSWindow* w; 447 QWSWindow* w;
442 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 448 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
443 if ( w->winId() == wid ) 449 if ( w->winId() == wid )
444 return !w->isFullyObscured(); 450 return !w->isFullyObscured();
445 } 451 }
446 return FALSE; 452 return FALSE;
447} 453}
448 454
449static bool hasVisibleWindow(const QString& clientname) 455static bool hasVisibleWindow(const QString& clientname)
450{ 456{
451 const QList<QWSWindow> &list = qwsServer->clientWindows(); 457 const QList<QWSWindow> &list = qwsServer->clientWindows();
452 QWSWindow* w; 458 QWSWindow* w;
453 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 459 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
454 if ( w->client()->identity() == clientname && !w->isFullyObscured() ) 460 if ( w->client()->identity() == clientname && !w->isFullyObscured() )
455 return TRUE; 461 return TRUE;
456 } 462 }
457 return FALSE; 463 return FALSE;
458} 464}
459 465
460void Desktop::raiseLauncher() 466void Desktop::raiseLauncher()
461{ 467{
462 Config cfg("qpe"); //F12 'Home' 468 Config cfg("qpe"); //F12 'Home'
463 cfg.setGroup("AppsKey"); 469 cfg.setGroup("AppsKey");
464 QString tempItem; 470 QString tempItem;
465 tempItem = cfg.readEntry("Middle","Home"); 471 tempItem = cfg.readEntry("Middle","Home");
466 if(tempItem == "Home" || tempItem.isEmpty()) { 472 if(tempItem == "Home" || tempItem.isEmpty()) {
467 if ( isVisibleWindow(launcher->winId()) ) 473 if ( isVisibleWindow(launcher->winId()) )
468 launcher->nextView(); 474 launcher->nextView();
469 else 475 else
470 launcher->raise(); 476 launcher->raise();
471 } else { 477 } else {
472 QCopEnvelope e("QPE/System","execute(QString)"); 478 QCopEnvelope e("QPE/System","execute(QString)");
473 e << tempItem; 479 e << tempItem;
474 } 480 }
475} 481}
476 482
477void Desktop::executeOrModify(const QString& appLnkFile) 483void Desktop::executeOrModify(const QString& appLnkFile)
478{ 484{
479 AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile); 485 AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile);
480 if ( lnk.isValid() ) { 486 if ( lnk.isValid() ) {
481 QCString app = lnk.exec().utf8(); 487 QCString app = lnk.exec().utf8();
482 Global::terminateBuiltin("calibrate"); 488 Global::terminateBuiltin("calibrate");
483 if ( QCopChannel::isRegistered("QPE/Application/" + app) ) { 489 if ( QCopChannel::isRegistered("QPE/Application/" + app) ) {
484 MRUList::addTask(&lnk); 490 MRUList::addTask(&lnk);
485 if ( hasVisibleWindow(app) ) 491 if ( hasVisibleWindow(app) )
486 QCopChannel::send("QPE/Application/" + app, "nextView()"); 492 QCopChannel::send("QPE/Application/" + app, "nextView()");
487 else 493 else
488 QCopChannel::send("QPE/Application/" + app, "raise()"); 494 QCopChannel::send("QPE/Application/" + app, "raise()");
489 } else { 495 } else {
490 lnk.execute(); 496 lnk.execute();
491 } 497 }
492 } 498 }
493} 499}
494 500
495void Desktop::raiseDatebook() 501void Desktop::raiseDatebook()
496{ 502{
497 Config cfg("qpe"); //F9 'Activity' 503 Config cfg("qpe"); //F9 'Activity'
498 cfg.setGroup("AppsKey"); 504 cfg.setGroup("AppsKey");
499 QString tempItem; 505 QString tempItem;
500 tempItem = cfg.readEntry("LeftEnd","Calender"); 506 tempItem = cfg.readEntry("LeftEnd","Calender");
501 if(tempItem == "Calender" || tempItem.isEmpty()) executeOrModify("Applications/datebook.desktop"); 507 if(tempItem == "Calender" || tempItem.isEmpty()) executeOrModify("Applications/datebook.desktop");
502 else { 508 else {
503 QCopEnvelope e("QPE/System","execute(QString)"); 509 QCopEnvelope e("QPE/System","execute(QString)");
504 e << tempItem; 510 e << tempItem;
505 } 511 }
506} 512}
507 513
508void Desktop::raiseContacts() 514void Desktop::raiseContacts()
509{ 515{
510 Config cfg("qpe"); //F10, 'Contacts' 516 Config cfg("qpe"); //F10, 'Contacts'
511 cfg.setGroup("AppsKey"); 517 cfg.setGroup("AppsKey");
512 QString tempItem; 518 QString tempItem;
513 tempItem = cfg.readEntry("Left2nd","Address Book"); 519 tempItem = cfg.readEntry("Left2nd","Address Book");
514 if(tempItem == "Address Book" || tempItem.isEmpty()) executeOrModify("Applications/addressbook.desktop"); 520 if(tempItem == "Address Book" || tempItem.isEmpty()) executeOrModify("Applications/addressbook.desktop");
515 else { 521 else {
516 QCopEnvelope e("QPE/System","execute(QString)"); 522 QCopEnvelope e("QPE/System","execute(QString)");
517 e << tempItem; 523 e << tempItem;
518 } 524 }
519} 525}
520 526
521void Desktop::raiseMenu() 527void Desktop::raiseMenu()
522{ 528{
523 Config cfg("qpe"); //F11, 'Menu' 529 Config cfg("qpe"); //F11, 'Menu'
524 cfg.setGroup("AppsKey"); 530 cfg.setGroup("AppsKey");
525 QString tempItem; 531 QString tempItem;
526 tempItem = cfg.readEntry("Right2nd","Popup Menu"); 532 tempItem = cfg.readEntry("Right2nd","Popup Menu");
527 if(tempItem == "Popup Menu" || tempItem.isEmpty()) { 533 if(tempItem == "Popup Menu" || tempItem.isEmpty()) {
528 Global::terminateBuiltin("calibrate"); 534 Global::terminateBuiltin("calibrate");
529 tb->startMenu()->launch(); 535 tb->startMenu()->launch();
530 } else { 536 } else {
531 QCopEnvelope e("QPE/System","execute(QString)"); 537 QCopEnvelope e("QPE/System","execute(QString)");
532 e << tempItem; 538 e << tempItem;
533 } 539 }
534} 540}
535 541
536void Desktop::raiseEmail() 542void Desktop::raiseEmail()
537{ 543{
538 Config cfg("qpe"); //F13, 'Mail' 544 Config cfg("qpe"); //F13, 'Mail'
539 cfg.setGroup("AppsKey"); 545 cfg.setGroup("AppsKey");
540 QString tempItem; 546 QString tempItem;
541 tempItem = cfg.readEntry("RightEnd","Mail"); 547 tempItem = cfg.readEntry("RightEnd","Mail");
542 if(tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty()) executeOrModify("Applications/qtmail.desktop"); 548 if(tempItem == "Mail" || tempItem == "qtmail" || tempItem.isEmpty()) executeOrModify("Applications/qtmail.desktop");
543 else { 549 else {
544 QCopEnvelope e("QPE/System","execute(QString)"); 550 QCopEnvelope e("QPE/System","execute(QString)");
545 e << tempItem; 551 e << tempItem;
546 } 552 }
547} 553}
548 554
549// autoStarts apps on resume and start 555// autoStarts apps on resume and start
550void Desktop::execAutoStart() { 556void Desktop::execAutoStart() {
551 QString appName; 557 QString appName;
552 int delay; 558 int delay;
553 QDateTime now = QDateTime::currentDateTime(); 559 QDateTime now = QDateTime::currentDateTime();
554 Config cfg( "autostart" ); 560 Config cfg( "autostart" );
555 cfg.setGroup( "AutoStart" ); 561 cfg.setGroup( "AutoStart" );
556 appName = cfg.readEntry("Apps", ""); 562 appName = cfg.readEntry("Apps", "");
557 delay = (cfg.readEntry("Delay", "0" )).toInt(); 563 delay = (cfg.readEntry("Delay", "0" )).toInt();
558 // If the time between suspend and resume was longer then the 564 // If the time between suspend and resume was longer then the
559 // value saved as delay, start the app 565 // value saved as delay, start the app
560 if ( suspendTime.secsTo(now) >= (delay*60) ) { 566 if ( suspendTime.secsTo(now) >= (delay*60) ) {
561 QCopEnvelope e("QPE/System", "execute(QString)"); 567 QCopEnvelope e("QPE/System", "execute(QString)");
562 e << QString(appName); 568 e << QString(appName);
563 } else { 569 } else {
564 } 570 }
565} 571}
566 572
567#if defined(QPE_HAVE_TOGGLELIGHT) 573#if defined(QPE_HAVE_TOGGLELIGHT)
568#include <qpe/config.h> 574#include <qpe/config.h>
569 575
570#include <sys/ioctl.h> 576#include <sys/ioctl.h>
571#include <sys/types.h> 577#include <sys/types.h>
572#include <fcntl.h> 578#include <fcntl.h>
573#include <unistd.h> 579#include <unistd.h>
574#include <errno.h> 580#include <errno.h>
575#include <linux/ioctl.h> 581#include <linux/ioctl.h>
576#include <time.h> 582#include <time.h>
577#endif 583#endif
578 584
579static bool blanked=FALSE; 585static bool blanked=FALSE;
580 586
581static void blankScreen() 587static void blankScreen()
582{ 588{
583 if ( !qt_screen ) return; 589 if ( !qt_screen ) return;
584 /* Should use a big black window instead. 590 /* Should use a big black window instead.
585 QGfx* g = qt_screen->screenGfx(); 591 QGfx* g = qt_screen->screenGfx();
586 g->fillRect(0,0,qt_screen->width(),qt_screen->height()); 592 g->fillRect(0,0,qt_screen->width(),qt_screen->height());
587 delete g; 593 delete g;
588 */ 594 */
589 blanked = TRUE; 595 blanked = TRUE;
590} 596}
591 597
592static void darkScreen() 598static void darkScreen()
593{ 599{
594 extern void qpe_setBacklight(int); 600 extern void qpe_setBacklight(int);
595 qpe_setBacklight(0); // force off 601 qpe_setBacklight(0); // force off
596} 602}
597 603
598 604
599void Desktop::togglePower() 605void Desktop::togglePower()
600{ 606{
601 bool wasloggedin = loggedin; 607 bool wasloggedin = loggedin;
602 loggedin=0; 608 loggedin=0;
603 suspendTime = QDateTime::currentDateTime(); 609 suspendTime = QDateTime::currentDateTime();
604 darkScreen(); 610 darkScreen();
605 if ( wasloggedin ) 611 if ( wasloggedin )
606 blankScreen(); 612 blankScreen();
607 613
608 system("apm --suspend"); 614 system("apm --suspend");
609 615
610 616
611 617
612 QWSServer::screenSaverActivate( FALSE ); 618 QWSServer::screenSaverActivate( FALSE );
613 { 619 {
614 QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep 620 QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep
615 QCopEnvelope e("QPE/System", "setBacklight(int)"); 621 QCopEnvelope e("QPE/System", "setBacklight(int)");
616 e << -3; // Force on 622 e << -3; // Force on
617 } 623 }
618 if ( wasloggedin ) { 624 if ( wasloggedin ) {
619 login(TRUE); 625 login(TRUE);
620 } 626 }
621 sleep(1); 627 sleep(1);
622 execAutoStart(); 628 execAutoStart();
623 //qcopBridge->closeOpenConnections(); 629 //qcopBridge->closeOpenConnections();
624 //qDebug("called togglePower()!!!!!!"); 630 //qDebug("called togglePower()!!!!!!");
625} 631}
626 632
627void Desktop::toggleLight() 633void Desktop::toggleLight()
628{ 634{
629 QCopEnvelope e("QPE/System", "setBacklight(int)"); 635 QCopEnvelope e("QPE/System", "setBacklight(int)");
630 e << -2; // toggle 636 e << -2; // toggle
631} 637}
632 638
633void Desktop::toggleSymbolInput() 639void Desktop::toggleSymbolInput()
634{ 640{
635 tb->toggleSymbolInput(); 641 tb->toggleSymbolInput();
636} 642}
637 643
638void Desktop::toggleNumLockState() 644void Desktop::toggleNumLockState()
639{ 645{
640 tb->toggleNumLockState(); 646 tb->toggleNumLockState();
641} 647}
642 648
643void Desktop::toggleCapsLockState() 649void Desktop::toggleCapsLockState()
644{ 650{
645 tb->toggleCapsLockState(); 651 tb->toggleCapsLockState();
646} 652}
647 653
648void Desktop::styleChange( QStyle &s ) 654void Desktop::styleChange( QStyle &s )
649{ 655{
650 QWidget::styleChange( s ); 656 QWidget::styleChange( s );
651 int displayw = qApp->desktop()->width(); 657 int displayw = qApp->desktop()->width();
652 int displayh = qApp->desktop()->height(); 658 int displayh = qApp->desktop()->height();
653 659
654 QSize sz = tb->sizeHint(); 660 QSize sz = tb->sizeHint();
655 661
656 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() ); 662 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
657} 663}
658 664
659void DesktopApplication::shutdown() 665void DesktopApplication::shutdown()
660{ 666{
661 if ( type() != GuiServer ) 667 if ( type() != GuiServer )
662 return; 668 return;
663 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); 669 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
664 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), 670 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)),
665 this, SLOT(shutdown(ShutdownImpl::Type)) ); 671 this, SLOT(shutdown(ShutdownImpl::Type)) );
666 sd->showMaximized(); 672 sd->showMaximized();
667} 673}
668 674
669void DesktopApplication::shutdown( ShutdownImpl::Type t ) 675void DesktopApplication::shutdown( ShutdownImpl::Type t )
670{ 676{
671 switch ( t ) { 677 switch ( t ) {
672 case ShutdownImpl::ShutdownSystem: 678 case ShutdownImpl::ShutdownSystem:
673 execlp("shutdown", "shutdown", "-h", "now", (void*)0); 679 execlp("shutdown", "shutdown", "-h", "now", (void*)0);
674 break; 680 break;
675 case ShutdownImpl::RebootSystem: 681 case ShutdownImpl::RebootSystem:
676 execlp("shutdown", "shutdown", "-r", "now", (void*)0); 682 execlp("shutdown", "shutdown", "-r", "now", (void*)0);
677 break; 683 break;
678 case ShutdownImpl::RestartDesktop: 684 case ShutdownImpl::RestartDesktop:
679 restart(); 685 restart();
680 break; 686 break;
681 case ShutdownImpl::TerminateDesktop: 687 case ShutdownImpl::TerminateDesktop:
682 prepareForTermination(FALSE); 688 prepareForTermination(FALSE);
683 quit(); 689 quit();
684 break; 690 break;
685 } 691 }
686} 692}
687 693
688void DesktopApplication::restart() 694void DesktopApplication::restart()
689{ 695{
690 prepareForTermination(TRUE); 696 prepareForTermination(TRUE);
691 697
692#ifdef Q_WS_QWS 698#ifdef Q_WS_QWS
693 for ( int fd = 3; fd < 100; fd++ ) 699 for ( int fd = 3; fd < 100; fd++ )
694 close( fd ); 700 close( fd );
695#if defined(QT_DEMO_SINGLE_FLOPPY) 701#if defined(QT_DEMO_SINGLE_FLOPPY)
696 execl( "/sbin/init", "qpe", 0 ); 702 execl( "/sbin/init", "qpe", 0 );
697#elif defined(QT_QWS_CASSIOPEIA) 703#elif defined(QT_QWS_CASSIOPEIA)
698 execl( "/bin/sh", "sh", 0 ); 704 execl( "/bin/sh", "sh", 0 );
699#else 705#else
700 execl( (qpeDir()+"/bin/qpe").latin1(), "qpe", 0 ); 706 execl( (qpeDir()+"/bin/qpe").latin1(), "qpe", 0 );
701#endif 707#endif
702 exit(1); 708 exit(1);
703#endif 709#endif
704} 710}
705 711
706void Desktop::startTransferServer() 712void Desktop::startTransferServer()
707{ 713{
708 // start qcop bridge server 714 // start qcop bridge server
709 qcopBridge = new QCopBridge( 4243 ); 715 qcopBridge = new QCopBridge( 4243 );
710 if ( !qcopBridge->ok() ) { 716 if ( !qcopBridge->ok() ) {
711 delete qcopBridge; 717 delete qcopBridge;
712 qcopBridge = 0; 718 qcopBridge = 0;
713 } 719 }
714 // start transfer server 720 // start transfer server
715 transferServer = new TransferServer( 4242 ); 721 transferServer = new TransferServer( 4242 );
716 if ( !transferServer->ok() ) { 722 if ( !transferServer->ok() ) {
717 delete transferServer; 723 delete transferServer;
718 transferServer = 0; 724 transferServer = 0;
719 } 725 }
720 if ( !transferServer || !qcopBridge ) 726 if ( !transferServer || !qcopBridge )
721 startTimer( 2000 ); 727 startTimer( 2000 );
722} 728}
723 729
724void Desktop::timerEvent( QTimerEvent *e ) 730void Desktop::timerEvent( QTimerEvent *e )
725{ 731{
726 killTimer( e->timerId() ); 732 killTimer( e->timerId() );
727 startTransferServer(); 733 startTransferServer();
728} 734}
729 735
730void Desktop::terminateServers() 736void Desktop::terminateServers()
731{ 737{
732 delete transferServer; 738 delete transferServer;
733 delete qcopBridge; 739 delete qcopBridge;
734 transferServer = 0; 740 transferServer = 0;
735 qcopBridge = 0; 741 qcopBridge = 0;
736} 742}
737 743
738void Desktop::rereadVolumes() 744void Desktop::rereadVolumes()
739{ 745{
740 Config cfg("qpe"); 746 Config cfg("qpe");
741 cfg.setGroup("Volume"); 747 cfg.setGroup("Volume");
742 touchclick = cfg.readBoolEntry("TouchSound"); 748 touchclick = cfg.readBoolEntry("TouchSound");
743 keyclick = cfg.readBoolEntry("KeySound"); 749 keyclick = cfg.readBoolEntry("KeySound");
744 alarmsound = cfg.readBoolEntry("AlarmSound"); 750 alarmsound = cfg.readBoolEntry("AlarmSound");
745// Config cfg("Sound"); 751// Config cfg("Sound");
746// cfg.setGroup("System"); 752// cfg.setGroup("System");
747// touchclick = cfg.readBoolEntry("Touch"); 753// touchclick = cfg.readBoolEntry("Touch");
748// keyclick = cfg.readBoolEntry("Key"); 754// keyclick = cfg.readBoolEntry("Key");
749} 755}
750 756
751void Desktop::keyClick() 757void Desktop::keyClick()
752{ 758{
753 if ( keyclick ) 759 if ( keyclick )
754 ODevice::inst ( )-> keySound ( ); 760 ODevice::inst ( )-> keySound ( );
755} 761}
756 762
757void Desktop::screenClick() 763void Desktop::screenClick()
758{ 764{
759 if ( touchclick ) 765 if ( touchclick )
760 ODevice::inst ( )-> touchSound ( ); 766 ODevice::inst ( )-> touchSound ( );
761} 767}
762 768
763void Desktop::soundAlarm() 769void Desktop::soundAlarm()
764{ 770{
765 if ( qpedesktop-> alarmsound ) 771 if ( qpedesktop-> alarmsound )
766 ODevice::inst ( )-> alarmSound ( ); 772 ODevice::inst ( )-> alarmSound ( );
767} 773}
768 774
769bool Desktop::eventFilter( QObject *, QEvent *ev ) 775bool Desktop::eventFilter( QObject *, QEvent *ev )
770{ 776{
771 if ( ev-> type ( ) == QEvent::KeyPress ) { 777 if ( ev-> type ( ) == QEvent::KeyPress ) {
772 QKeyEvent *ke = (QKeyEvent *) ev; 778 QKeyEvent *ke = (QKeyEvent *) ev;
773 if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key 779 if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key
774 QWidget *active = qApp-> activeWindow ( ); 780 QWidget *active = qApp-> activeWindow ( );
775 781
776 if ( active && active-> isPopup ( )) 782 if ( active && active-> isPopup ( ))
777 active->close(); 783 active->close();
778 784
779 raiseMenu ( ); 785 raiseMenu ( );
780 return true; 786 return true;
781 } 787 }
782 } 788 }
783 return false; 789 return false;
784} 790}