summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-10 11:42:53 (UTC)
committer zecke <zecke>2004-09-10 11:42:53 (UTC)
commit6adde94c6ee292de5bc87a0c651fef69e8847d7e (patch) (unidiff)
tree56ae2a840932bd50e16b59232a185e62d17c0843
parent854e3af27ee7208bbb3620733a24f0214c0b118a (diff)
downloadopie-6adde94c6ee292de5bc87a0c651fef69e8847d7e.zip
opie-6adde94c6ee292de5bc87a0c651fef69e8847d7e.tar.gz
opie-6adde94c6ee292de5bc87a0c651fef69e8847d7e.tar.bz2
Remove unused code and mark parameter as Q_UNUSED
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp2
-rw-r--r--core/launcher/server.cpp26
-rw-r--r--core/launcher/serverapp.cpp4
3 files changed, 6 insertions, 26 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 0d0f2cb..cd9c14b 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -400,96 +400,98 @@ void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg )
400 LauncherIconView* liv = (LauncherIconView*)iconView(); 400 LauncherIconView* liv = (LauncherIconView*)iconView();
401 QBrush oldBrush( liv->itemTextBackground() ); 401 QBrush oldBrush( liv->itemTextBackground() );
402 QColorGroup mycg( cg ); 402 QColorGroup mycg( cg );
403 if ( liv->currentItem() == this ) { 403 if ( liv->currentItem() == this ) {
404 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); 404 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
405 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); 405 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
406 } 406 }
407 407
408 QIconViewItem::paintItem(p,mycg); 408 QIconViewItem::paintItem(p,mycg);
409 409
410 // Paint animation overlay 410 // Paint animation overlay
411 if ( liv->busyItem() == this ) 411 if ( liv->busyItem() == this )
412 paintAnimatedIcon(p); 412 paintAnimatedIcon(p);
413 413
414 if ( liv->currentItem() == this ) 414 if ( liv->currentItem() == this )
415 liv->setItemTextBackground( oldBrush ); 415 liv->setItemTextBackground( oldBrush );
416} 416}
417 417
418 418
419 419
420void LauncherItem::paintAnimatedIcon( QPainter *p ) 420void LauncherItem::paintAnimatedIcon( QPainter *p )
421{ 421{
422 LauncherIconView* liv = (LauncherIconView*)iconView(); 422 LauncherIconView* liv = (LauncherIconView*)iconView();
423 int pic = iteration % 16; 423 int pic = iteration % 16;
424 int w = pixmap()->width(), h = pixmap()->height(); 424 int w = pixmap()->width(), h = pixmap()->height();
425 QPixmap dblBuf( w, h + 4 ); 425 QPixmap dblBuf( w, h + 4 );
426 QPainter p2( &dblBuf ); 426 QPainter p2( &dblBuf );
427 int x1, y1; 427 int x1, y1;
428 if ( liv->itemTextPos() == QIconView::Bottom ) { 428 if ( liv->itemTextPos() == QIconView::Bottom ) {
429 x1 = x() + (width() - w) / 2 - liv->contentsX(); 429 x1 = x() + (width() - w) / 2 - liv->contentsX();
430 y1 = y() - liv->contentsY(); 430 y1 = y() - liv->contentsY();
431 } else { 431 } else {
432 x1 = x() - liv->contentsX(); 432 x1 = x() - liv->contentsX();
433 y1 = y() + (height() - h) / 2 - liv->contentsY(); 433 y1 = y() + (height() - h) / 2 - liv->contentsY();
434 } 434 }
435 y1 -= 2; 435 y1 -= 2;
436 p2.translate(-x1,-y1); 436 p2.translate(-x1,-y1);
437 liv->drawBackground( &p2, QRect(x1,y1,w,h+4) ); 437 liv->drawBackground( &p2, QRect(x1,y1,w,h+4) );
438 int bounceY = 2; 438 int bounceY = 2;
439#ifdef BOUNCE_BUSY_ICON 439#ifdef BOUNCE_BUSY_ICON
440 if ( busyType == BIT_Animated ) { 440 if ( busyType == BIT_Animated ) {
441 bounceY = 4 - ((iteration+2)%8); 441 bounceY = 4 - ((iteration+2)%8);
442 bounceY = bounceY < 0 ? -bounceY : bounceY; 442 bounceY = bounceY < 0 ? -bounceY : bounceY;
443 } 443 }
444#endif 444#endif
445 p2.drawPixmap( x1, y1 + bounceY, *pixmap() ); 445 p2.drawPixmap( x1, y1 + bounceY, *pixmap() );
446#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 446#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
447 p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h ); 447 p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h );
448#else
449 Q_UNUSED( pic )
448#endif 450#endif
449 p->drawPixmap( x1, y1, dblBuf ); 451 p->drawPixmap( x1, y1, dblBuf );
450} 452}
451 453
452void LauncherItem::animateIcon() 454void LauncherItem::animateIcon()
453{ 455{
454 LauncherIconView* liv = (LauncherIconView*)iconView(); 456 LauncherIconView* liv = (LauncherIconView*)iconView();
455 457
456 if ( liv->busyItem() != this || !app ) 458 if ( liv->busyItem() != this || !app )
457 return; 459 return;
458 460
459 // Highlight the icon 461 // Highlight the icon
460 if ( iteration == 0 ) { 462 if ( iteration == 0 ) {
461 QPixmap src = isBigIcon ? app->bigPixmap() : app->pixmap(); 463 QPixmap src = isBigIcon ? app->bigPixmap() : app->pixmap();
462 QImage img = src.convertToImage(); 464 QImage img = src.convertToImage();
463 QRgb *rgb; 465 QRgb *rgb;
464 int count; 466 int count;
465 if ( img.depth() == 32 ) { 467 if ( img.depth() == 32 ) {
466 rgb = (QRgb*)img.bits(); 468 rgb = (QRgb*)img.bits();
467 count = img.bytesPerLine()/sizeof(QRgb)*img.height(); 469 count = img.bytesPerLine()/sizeof(QRgb)*img.height();
468 } else { 470 } else {
469 rgb = img.colorTable(); 471 rgb = img.colorTable();
470 count = img.numColors(); 472 count = img.numColors();
471 } 473 }
472 for ( int r = 0; r < count; r++, rgb++ ) { 474 for ( int r = 0; r < count; r++, rgb++ ) {
473#if defined(BRIGHTEN_BUSY_ICON) 475#if defined(BRIGHTEN_BUSY_ICON)
474 QColor c(*rgb); 476 QColor c(*rgb);
475 int h, s, v; 477 int h, s, v;
476 c.hsv(&h,&s,&v); 478 c.hsv(&h,&s,&v);
477 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255)); 479 c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255));
478 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb)); 480 *rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb));
479#elif defined(ALPHA_FADE_BUSY_ICON) 481#elif defined(ALPHA_FADE_BUSY_ICON)
480 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2); 482 *rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2);
481#endif 483#endif
482 } 484 }
483 src.convertFromImage( img ); 485 src.convertFromImage( img );
484 setPixmap( src ); 486 setPixmap( src );
485 } 487 }
486 488
487 iteration++; 489 iteration++;
488 490
489 // Paint animation overlay 491 // Paint animation overlay
490 QPainter p( liv->viewport() ); 492 QPainter p( liv->viewport() );
491 paintAnimatedIcon( &p ); 493 paintAnimatedIcon( &p );
492} 494}
493 495
494void LauncherItem::resetIcon() 496void LauncherItem::resetIcon()
495{ 497{
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 950032d..5ae517b 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -151,120 +151,96 @@ Server::Server() :
151 connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) ); 151 connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) );
152 connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) ); 152 connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) );
153 153
154 storage = new StorageInfo( this ); 154 storage = new StorageInfo( this );
155 connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) ); 155 connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) );
156 156
157 // start services 157 // start services
158 startTransferServer(); 158 startTransferServer();
159 (void) new IrServer( this ); 159 (void) new IrServer( this );
160 160
161 packageHandler = new PackageHandler( this ); 161 packageHandler = new PackageHandler( this );
162 connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), 162 connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)),
163 this,SLOT(activate(const Opie::Core::ODeviceButton*,bool))); 163 this,SLOT(activate(const Opie::Core::ODeviceButton*,bool)));
164 164
165 setGeometry( -10, -10, 9, 9 ); 165 setGeometry( -10, -10, 9, 9 );
166 166
167 QCopChannel *channel = new QCopChannel("QPE/System", this); 167 QCopChannel *channel = new QCopChannel("QPE/System", this);
168 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)), 168 connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
169 this, SLOT(systemMsg(const QCString&,const QByteArray&)) ); 169 this, SLOT(systemMsg(const QCString&,const QByteArray&)) );
170 170
171 QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this ); 171 QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this );
172 connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)), 172 connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)),
173 this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) ); 173 this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) );
174 174
175 connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) ); 175 connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) );
176 connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) ); 176 connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) );
177 177
178 preloadApps(); 178 preloadApps();
179} 179}
180 180
181void Server::show() 181void Server::show()
182{ 182{
183 ServerApplication::login(TRUE); 183 ServerApplication::login(TRUE);
184 QWidget::show(); 184 QWidget::show();
185} 185}
186 186
187Server::~Server() 187Server::~Server()
188{ 188{
189 serverGui->destroyGUI(); 189 serverGui->destroyGUI();
190 delete docList; 190 delete docList;
191 delete qcopBridge; 191 delete qcopBridge;
192 delete transferServer; 192 delete transferServer;
193 delete serverGui; 193 delete serverGui;
194#if 0 194#if 0
195 delete tsmMonitor; 195 delete tsmMonitor;
196#endif 196#endif
197} 197}
198 198
199static bool hasVisibleWindow(const QString& clientname, bool partial)
200{
201#ifdef QWS
202 const QList<QWSWindow> &list = qwsServer->clientWindows();
203 QWSWindow* w;
204 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
205 if ( w->client()->identity() == clientname ) {
206 if ( partial && !w->isFullyObscured() )
207 return TRUE;
208 if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
209# if QT_VERSION < 0x030000
210 QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
211 QSize(qt_screen->width(),qt_screen->height()) );
212# else
213 QRect mwr = qt_maxWindowRect;
214# endif
215 if ( mwr.contains(w->requested().boundingRect()) )
216 return TRUE;
217 }
218 }
219 }
220#endif
221 return FALSE;
222}
223 199
224void Server::activate(const ODeviceButton* button, bool held) 200void Server::activate(const ODeviceButton* button, bool held)
225{ 201{
226 Global::terminateBuiltin("calibrate"); // No tr 202 Global::terminateBuiltin("calibrate"); // No tr
227 OQCopMessage om; 203 OQCopMessage om;
228 if ( held ) { 204 if ( held ) {
229 om = button->heldAction(); 205 om = button->heldAction();
230 } else { 206 } else {
231 om = button->pressedAction(); 207 om = button->pressedAction();
232 } 208 }
233 209
234 if ( om.channel() != "ignore" ) 210 if ( om.channel() != "ignore" )
235 om.send(); 211 om.send();
236 212
237 // A button with no action defined, will return a null ServiceRequest. Don't attempt 213 // A button with no action defined, will return a null ServiceRequest. Don't attempt
238 // to send/do anything with this as it will crash 214 // to send/do anything with this as it will crash
239 /* ### FIXME */ 215 /* ### FIXME */
240#if 0 216#if 0
241 if ( !sr.isNull() ) { 217 if ( !sr.isNull() ) {
242 QString app = sr.app(); 218 QString app = sr.app();
243 bool vis = hasVisibleWindow(app, app != "qpe"); 219 bool vis = hasVisibleWindow(app, app != "qpe");
244 if ( sr.message() == "raise()" && vis ) { 220 if ( sr.message() == "raise()" && vis ) {
245 sr.setMessage("nextView()"); 221 sr.setMessage("nextView()");
246 } else { 222 } else {
247 // "back door" 223 // "back door"
248 sr << (int)vis; 224 sr << (int)vis;
249 } 225 }
250 226
251 sr.send(); 227 sr.send();
252 } 228 }
253#endif 229#endif
254} 230}
255 231
256 232
257#ifdef Q_WS_QWS 233#ifdef Q_WS_QWS
258 234
259 235
260typedef struct KeyOverride { 236typedef struct KeyOverride {
261 ushort scan_code; 237 ushort scan_code;
262 QWSServer::KeyMap map; 238 QWSServer::KeyMap map;
263}; 239};
264 240
265 241
266static const KeyOverride jp109keys[] = { 242static const KeyOverride jp109keys[] = {
267 { 0x03, { Qt::Key_2, '2' , 0x22 , 0xffff } }, 243 { 0x03, { Qt::Key_2, '2' , 0x22 , 0xffff } },
268 { 0x07, { Qt::Key_6, '6' , '&' , 0xffff } }, 244 { 0x07, { Qt::Key_6, '6' , '&' , 0xffff } },
269 { 0x08, { Qt::Key_7, '7' , '\'' , 0xffff } }, 245 { 0x08, { Qt::Key_7, '7' , '\'' , 0xffff } },
270 { 0x09, { Qt::Key_8, '8' , '(' , 0xffff } }, 246 { 0x09, { Qt::Key_8, '8' , '(' , 0xffff } },
@@ -653,77 +629,79 @@ void Server::timerEvent( QTimerEvent *e )
653#define QPE_DEFAULT_TODAY_MODE "Never" 629#define QPE_DEFAULT_TODAY_MODE "Never"
654#endif 630#endif
655 if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) { 631 if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) {
656 QCopEnvelope env(Service::channel("today"),"raise()"); 632 QCopEnvelope env(Service::channel("today"),"raise()");
657 } 633 }
658 } 634 }
659 } 635 }
660#endif 636#endif
661} 637}
662 638
663void Server::terminateServers() 639void Server::terminateServers()
664{ 640{
665 delete transferServer; 641 delete transferServer;
666 delete qcopBridge; 642 delete qcopBridge;
667 transferServer = 0; 643 transferServer = 0;
668 qcopBridge = 0; 644 qcopBridge = 0;
669} 645}
670 646
671void Server::syncConnectionClosed( const QHostAddress & ) 647void Server::syncConnectionClosed( const QHostAddress & )
672{ 648{
673 odebug << "Lost sync connection" << oendl; 649 odebug << "Lost sync connection" << oendl;
674 delete syncDialog; 650 delete syncDialog;
675 syncDialog = 0; 651 syncDialog = 0;
676} 652}
677 653
678void Server::pokeTimeMonitors() 654void Server::pokeTimeMonitors()
679{ 655{
680#if 0 656#if 0
681 // inform all TimeMonitors 657 // inform all TimeMonitors
682 QStrList tms = Service::channels("TimeMonitor"); 658 QStrList tms = Service::channels("TimeMonitor");
683 for (const char* ch = tms.first(); ch; ch=tms.next()) { 659 for (const char* ch = tms.first(); ch; ch=tms.next()) {
684 QString t = getenv("TZ"); 660 QString t = getenv("TZ");
685 QCopEnvelope e(ch, "timeChange(QString)"); 661 QCopEnvelope e(ch, "timeChange(QString)");
686 e << t; 662 e << t;
687 } 663 }
688#endif 664#endif
689} 665}
690 666
691void Server::applicationLaunched(int, const QString &app) 667void Server::applicationLaunched(int, const QString &app)
692{ 668{
693 serverGui->applicationStateChanged( app, ServerInterface::Launching ); 669 serverGui->applicationStateChanged( app, ServerInterface::Launching );
694} 670}
695 671
696void Server::applicationTerminated(int pid, const QString &app) 672void Server::applicationTerminated(int pid, const QString &app)
697{ 673{
698 serverGui->applicationStateChanged( app, ServerInterface::Terminated ); 674 serverGui->applicationStateChanged( app, ServerInterface::Terminated );
699#if 0 675#if 0
700 tsmMonitor->applicationTerminated( pid ); 676 tsmMonitor->applicationTerminated( pid );
677#else
678 Q_UNUSED( pid )
701#endif 679#endif
702} 680}
703 681
704void Server::applicationConnected(const QString &app) 682void Server::applicationConnected(const QString &app)
705{ 683{
706 serverGui->applicationStateChanged( app, ServerInterface::Running ); 684 serverGui->applicationStateChanged( app, ServerInterface::Running );
707} 685}
708 686
709void Server::storageChanged() 687void Server::storageChanged()
710{ 688{
711 system( "opie-update-symlinks" ); 689 system( "opie-update-symlinks" );
712 serverGui->storageChanged( storage->fileSystems() ); 690 serverGui->storageChanged( storage->fileSystems() );
713 docList->storageChanged(); 691 docList->storageChanged();
714} 692}
715 693
716 694
717 695
718void Server::preloadApps() 696void Server::preloadApps()
719{ 697{
720 Config cfg("Launcher"); 698 Config cfg("Launcher");
721 cfg.setGroup("Preload"); 699 cfg.setGroup("Preload");
722 QStringList apps = cfg.readListEntry("Apps",','); 700 QStringList apps = cfg.readListEntry("Apps",',');
723 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { 701 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
724#ifndef QT_NO_COP 702#ifndef QT_NO_COP
725 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); 703 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
726#endif 704#endif
727 } 705 }
728} 706}
729 707
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index a2302d8..66cc788 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -312,98 +312,98 @@ ServerApplication::ServerApplication( int& argc, char **argv, Type t )
312 312
313 QCopChannel *channel = new QCopChannel( "QPE/System", this ); 313 QCopChannel *channel = new QCopChannel( "QPE/System", this );
314 connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), 314 connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ),
315 this, SLOT(systemMessage(const QCString&,const QByteArray&) ) ); 315 this, SLOT(systemMessage(const QCString&,const QByteArray&) ) );
316 316
317 channel = new QCopChannel("QPE/Launcher", this ); 317 channel = new QCopChannel("QPE/Launcher", this );
318 connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ), 318 connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ),
319 this, SLOT(launcherMessage(const QCString&,const QByteArray&) ) ); 319 this, SLOT(launcherMessage(const QCString&,const QByteArray&) ) );
320 320
321 m_screensaver = new OpieScreenSaver(); 321 m_screensaver = new OpieScreenSaver();
322 m_screensaver->setInterval( -1 ); 322 m_screensaver->setInterval( -1 );
323 QWSServer::setScreenSaver( m_screensaver ); 323 QWSServer::setScreenSaver( m_screensaver );
324 324
325 connect( qApp, SIGNAL( volumeChanged(bool) ), 325 connect( qApp, SIGNAL( volumeChanged(bool) ),
326 this, SLOT( rereadVolumes() ) ); 326 this, SLOT( rereadVolumes() ) );
327 327
328 328
329 /* ### PluginLoader libqtopia SafeMode */ 329 /* ### PluginLoader libqtopia SafeMode */
330#if 0 330#if 0
331 if ( PluginLoader::inSafeMode() ) 331 if ( PluginLoader::inSafeMode() )
332 QTimer::singleShot(500, this, SLOT(showSafeMode()) ); 332 QTimer::singleShot(500, this, SLOT(showSafeMode()) );
333 QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) ); 333 QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) );
334#endif 334#endif
335 335
336 kf = new KeyFilter(this); 336 kf = new KeyFilter(this);
337 337
338 connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) ); 338 connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) );
339 connect( kf, SIGNAL(power()), this, SIGNAL(power()) ); 339 connect( kf, SIGNAL(power()), this, SIGNAL(power()) );
340 connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) ); 340 connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) );
341 connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol())); 341 connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol()));
342 connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle())); 342 connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle()));
343 connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle())); 343 connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle()));
344 connect( kf, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)), 344 connect( kf, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)),
345 this,SIGNAL(activate(const Opie::Core::ODeviceButton*,bool))); 345 this,SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)));
346 346
347 347
348 connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) ); 348 connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) );
349 349
350 connect( this, SIGNAL(power() ), 350 connect( this, SIGNAL(power() ),
351 SLOT(togglePower() ) ); 351 SLOT(togglePower() ) );
352 352
353 rereadVolumes(); 353 rereadVolumes();
354 354
355 serverApp = this; 355 serverApp = this;
356 356
357 apmTimeout(); 357 apmTimeout();
358 grabKeyboard(); 358 grabKeyboard();
359 359
360 /* make sure the event filter is installed */ 360 /* make sure the event filter is installed */ /* std::limits<short>::max() when you've stdc++ */
361 const ODeviceButton* but = ODevice::inst()->buttonForKeycode( -1 ); 361 const ODeviceButton* but = ODevice::inst()->buttonForKeycode( SHRT_MAX );
362 Q_CONST_UNUSED( but ) 362 Q_CONST_UNUSED( but )
363} 363}
364 364
365 365
366ServerApplication::~ServerApplication() 366ServerApplication::~ServerApplication()
367{ 367{
368 ungrabKeyboard(); 368 ungrabKeyboard();
369 369
370 delete pa; 370 delete pa;
371 delete m_ps; 371 delete m_ps;
372 delete m_ps_last; 372 delete m_ps_last;
373} 373}
374 374
375void ServerApplication::apmTimeout() 375void ServerApplication::apmTimeout()
376{ 376{
377 serverApp-> checkMemory( ); // in case no events are generated 377 serverApp-> checkMemory( ); // in case no events are generated
378 *m_ps_last = *m_ps; 378 *m_ps_last = *m_ps;
379 *m_ps = PowerStatusManager::readStatus(); 379 *m_ps = PowerStatusManager::readStatus();
380 380
381 if ( m_ps->acStatus() != m_ps_last-> acStatus() ) 381 if ( m_ps->acStatus() != m_ps_last-> acStatus() )
382 m_screensaver-> powerStatusChanged( *m_ps ); 382 m_screensaver-> powerStatusChanged( *m_ps );
383 383
384 if ( m_ps->acStatus() == PowerStatus::Online ) { 384 if ( m_ps->acStatus() == PowerStatus::Online ) {
385 return; 385 return;
386 } 386 }
387 387
388 int bat = m_ps-> batteryPercentRemaining(); 388 int bat = m_ps-> batteryPercentRemaining();
389 389
390 if ( bat < m_ps_last-> batteryPercentRemaining() ) { 390 if ( bat < m_ps_last-> batteryPercentRemaining() ) {
391 if ( bat <= m_powerCritical ) { 391 if ( bat <= m_powerCritical ) {
392 QMessageBox battlow( 392 QMessageBox battlow(
393 tr("WARNING"), 393 tr("WARNING"),
394 tr("<p>The battery level is critical!" 394 tr("<p>The battery level is critical!"
395 "<p>Keep power off until AC is restored"), 395 "<p>Keep power off until AC is restored"),
396 QMessageBox::Warning, 396 QMessageBox::Warning,
397 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 397 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
398 0, QString::null, TRUE, WStyle_StaysOnTop); 398 0, QString::null, TRUE, WStyle_StaysOnTop);
399 battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); 399 battlow.setButtonText(QMessageBox::Cancel, tr("Ok"));
400 battlow.exec(); 400 battlow.exec();
401 } else if ( bat <= m_powerVeryLow ) 401 } else if ( bat <= m_powerVeryLow )
402 pa->alert( tr( "The battery is running very low. "), 2 ); 402 pa->alert( tr( "The battery is running very low. "), 2 );
403 } 403 }
404 404
405 if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) { 405 if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) {
406 QMessageBox battlow( 406 QMessageBox battlow(
407 tr("WARNING"), 407 tr("WARNING"),
408 tr("<p>The Back-up battery is very low" 408 tr("<p>The Back-up battery is very low"
409 "<p>Please charge the back-up battery"), 409 "<p>Please charge the back-up battery"),