summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp40
-rw-r--r--core/launcher/desktop.h1
2 files changed, 10 insertions, 31 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 4640a12..68949e6 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -37,48 +37,50 @@
#include <qpe/power.h>
#include <qpe/timeconversion.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/network.h>
#include <qpe/global.h>
#if defined( QT_QWS_CUSTOM ) || defined( QT_QWS_IPAQ )
#include <qpe/custom.h>
#endif
#include <opie/odevice.h>
#include <qgfx_qws.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qwindowsystem_qws.h>
#include <qvaluelist.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
+using namespace Opie;
+
class QCopKeyRegister
{
public:
QCopKeyRegister() : keyCode( 0 )
{ }
QCopKeyRegister( int k, const QString &c, const QString &m )
: keyCode( k ), channel( c ), message( m )
{ }
int getKeyCode() const
{
return keyCode;
}
QString getChannel() const
{
return channel;
}
QString getMessage() const
{
return message;
}
private:
int keyCode;
@@ -156,49 +158,49 @@ class QPEScreenSaver : public QWSScreenSaver
private:
int LcdOn;
public:
QPEScreenSaver()
{
m_disable_suspend = 100;
m_enable_dim = false;
m_enable_lightoff = false;
m_enable_onlylcdoff = false;
m_lcd_status = true;
m_backlight_bright = -1;
m_backlight_forcedoff = false;
// Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off)
ODevice::inst ( ) -> setDisplayStatus ( true );
}
void restore()
{
if ( !m_lcd_status ) // We must have turned it off
ODevice::inst ( ) -> setDisplayStatus ( true );
- setBacklight ( -1 );
+ setBacklight ( -3 );
}
bool save( int level )
{
switch ( level ) {
case 0:
if ( m_disable_suspend > 0 && m_enable_dim ) {
if ( backlight() > 1 )
setBacklight( 1 ); // lowest non-off
}
return true;
break;
case 1:
if ( m_disable_suspend > 1 && m_enable_lightoff ) {
setBacklight( 0 ); // off
}
return true;
break;
case 2:
if ( m_enable_onlylcdoff ) {
ODevice::inst ( ) -> setDisplayStatus ( false );
m_lcd_status = false;
return true;
}
else // We're going to suspend the whole machine
@@ -298,50 +300,55 @@ public:
bright = backlight ( );
ODevice::inst ( ) -> setDisplayBrightness ( bright );
m_backlight_bright = bright;
}
private:
int m_disable_suspend;
bool m_enable_dim;
bool m_enable_lightoff;
bool m_enable_onlylcdoff;
bool m_lcd_status;
int m_backlight_bright;
bool m_backlight_forcedoff;
};
void DesktopApplication::switchLCD ( bool on )
{
if ( qApp ) {
DesktopApplication *dapp = (DesktopApplication *) qApp;
- if ( dapp-> m_screensaver )
- dapp-> m_screensaver-> setBacklight ( on ? -3 : -1 );
+ if ( dapp-> m_screensaver ) {
+ if ( on )
+ dapp-> m_screensaver-> restore ( ); //setBacklight ( on ? -3 : -1 );
+ else
+ dapp-> m_screensaver-> save ( 1 );
+
+ }
}
}
DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
: QPEApplication( argc, argv, appType )
{
QTimer * t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) );
t->start( 10000 );
ps = new PowerStatus;
pa = new DesktopPowerAlerter( 0 );
channel = new QCopChannel( "QPE/Desktop", this );
connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ),
this, SLOT( desktopMessage( const QCString&, const QByteArray& ) ) );
channel = new QCopChannel( "QPE/System", this );
connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ),
this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) );
m_screensaver = new QPEScreenSaver;
@@ -985,51 +992,24 @@ void Desktop::rereadVolumes()
cfg.setGroup( "Volume" );
touchclick = cfg.readBoolEntry( "TouchSound" );
keyclick = cfg.readBoolEntry( "KeySound" );
alarmsound = cfg.readBoolEntry( "AlarmSound" );
}
void Desktop::keyClick()
{
if ( keyclick )
ODevice::inst ( ) -> keySound ( );
}
void Desktop::screenClick()
{
if ( touchclick )
ODevice::inst ( ) -> touchSound ( );
}
void Desktop::soundAlarm()
{
if ( qpedesktop-> alarmsound )
ODevice::inst ( ) -> alarmSound ( );
}
-bool Desktop::eventFilter( QObject *, QEvent *ev )
-{
- if ( ev-> type ( ) == QEvent::KeyPress ) {
- QKeyEvent * ke = ( QKeyEvent * ) ev;
- if ( ke-> key ( ) == Qt::Key_F11 ) { // menu key
- QWidget * active = qApp-> activeWindow ( );
-
- if ( active && active-> isPopup ( ) )
- active->close();
-
- /*
- * On iPAQ 38xx that key is not the "menu key" but the mail key
- * To not confuse the users, make it launch the mail app on 38xx
- */
- if ( ODevice::inst() ->model() == OMODEL_iPAQ_H38xx ) {
- QCopEnvelope e( "QPE/System", "execute(QString)" );
- e << QString( "mail" );
- return true;
- }
- else {
- raiseMenu ( );
- return true;
- }
- }
- }
- return false;
-}
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index b9ff39f..f7c3e3f 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -101,45 +101,44 @@ public:
void keyClick();
void screenClick();
static void soundAlarm();
public slots:
void raiseDatebook();
void raiseContacts();
void raiseMenu();
void raiseLauncher();
void raiseEmail();
void execAutoStart();
void togglePower();
void toggleLight();
void toggleNumLockState();
void toggleCapsLockState();
void toggleSymbolInput();
void terminateServers();
void rereadVolumes();
protected:
void executeOrModify( const QString& appLnkFile );
void styleChange( QStyle & );
void timerEvent( QTimerEvent *e );
- bool eventFilter( QObject *, QEvent * );
QWidget *bg;
Launcher *launcher;
TaskBar *tb;
private:
void startTransferServer();
bool recoverMemory();
QCopBridge *qcopBridge;
TransferServer *transferServer;
PackageSlave *packageSlave;
QDateTime suspendTime;
bool keyclick, touchclick, alarmsound;
};
#endif // __DESKTOP_H__