summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 1a33b36..6ee7132 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -278,155 +278,155 @@ public:
m_backlight_bright = config. readNumEntry ( "Brightness", 255 );
}
return m_backlight_bright;
}
void setBacklight ( int bright )
{
if ( bright == -3 ) {
// Forced on
m_backlight_forcedoff = false;
bright = -1;
}
if ( m_backlight_forcedoff && bright != -2 )
return ;
if ( bright == -2 ) {
// Toggle between off and on
bright = m_backlight_bright ? 0 : -1;
m_backlight_forcedoff = !bright;
}
m_backlight_bright = bright;
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 ) {
if ( on )
- dapp-> m_screensaver-> restore ( ); //setBacklight ( on ? -3 : -1 );
- else
- dapp-> m_screensaver-> save ( 1 );
-
- }
+ 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;
m_screensaver-> setInterval ( -1 );
QWSServer::setScreenSaver( m_screensaver );
}
DesktopApplication::~DesktopApplication()
{
delete ps;
delete pa;
}
void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data )
{
#ifdef Q_WS_QWS
QDataStream stream( data, IO_ReadOnly );
if ( msg == "keyRegister(int key, QString channel, QString message)" ) {
int k;
QString c, m;
stream >> k;
stream >> c;
stream >> m;
qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m );
keyRegisterList.append( QCopKeyRegister( k, c, m ) );
}
else if ( msg == "suspend()" ) {
emit power();
}
else if ( msg == "home()" ) {
- qpedesktop-> home ( );
+ qpedesktop-> home ( );
}
#endif
}
void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data )
{
#ifdef Q_WS_QWS
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "setScreenSaverInterval(int)" ) {
int time;
stream >> time;
m_screensaver-> setInterval( time );
}
else if ( msg == "setScreenSaverIntervals(int,int,int)" ) {
int t1, t2, t3;
stream >> t1 >> t2 >> t3;
m_screensaver-> setIntervals( t1, t2, t3 );
}
else if ( msg == "setBacklight(int)" ) {
int bright;
stream >> bright;
m_screensaver-> setBacklight( bright );
}
else if ( msg == "setScreenSaverMode(int)" ) {
int mode;
stream >> mode;
m_screensaver-> setMode ( mode );
}
#endif
}
enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown;
#ifdef Q_WS_QWS
bool DesktopApplication::qwsEventFilter( QWSEvent *e )
{
qpedesktop->checkMemory();
if ( e->type == QWSEvent::Key ) {
QWSKeyEvent * ke = ( QWSKeyEvent * ) e;
if ( !loggedin && ke->simpleData.keycode != Key_F34 )
return TRUE;
bool press = ke->simpleData.is_press;
bool autoRepeat = ke->simpleData.is_auto_repeat;
/*
@@ -630,151 +630,151 @@ Desktop::Desktop() :
qApp->installEventFilter( this );
}
void Desktop::show()
{
login( TRUE );
QWidget::show();
}
Desktop::~Desktop()
{
delete launcher;
delete tb;
delete qcopBridge;
delete transferServer;
}
bool Desktop::recoverMemory()
{
return tb->recoverMemory();
}
void Desktop::checkMemory()
{
#if defined(QPE_HAVE_MEMALERTER)
static bool ignoreNormal = FALSE;
static bool existingMessage = FALSE;
if ( existingMessage )
return ; // don't show a second message while still on first
existingMessage = TRUE;
switch ( memstate ) {
case Unknown:
break;
case Low:
memstate = Unknown;
if ( recoverMemory() )
ignoreNormal = TRUE;
else
QMessageBox::warning( 0 , "Memory Status",
"The memory smacks of shortage. \n"
"Please save data. " );
break;
case Normal:
memstate = Unknown;
if ( ignoreNormal )
ignoreNormal = FALSE;
- else
- QMessageBox::information ( 0 , "Memory Status",
- "There is enough memory again." );
+// else
+// QMessageBox::information ( 0 , "Memory Status",
+// "There is enough memory again." );
break;
case VeryLow:
memstate = Unknown;
QMessageBox::critical( 0 , "Memory Status",
"The memory is very low. \n"
"Please end this application \n"
"immediately." );
recoverMemory();
}
existingMessage = FALSE;
#endif
}
static bool isVisibleWindow( int wid )
{
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) {
if ( w->winId() == wid )
return !w->isFullyObscured();
}
return FALSE;
}
static bool hasVisibleWindow( const QString& clientname )
{
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) {
if ( w->client() ->identity() == clientname && !w->isFullyObscured() )
return TRUE;
}
return FALSE;
}
void Desktop::raiseLauncher()
{
Config cfg( "qpe" ); //F12 'Home'
cfg.setGroup( "AppsKey" );
QString tempItem;
tempItem = cfg.readEntry( "Middle", "Home" );
if ( tempItem == "Home" || tempItem.isEmpty() ) {
- home ( );
+ home ( );
}
else {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << tempItem;
}
}
void Desktop::home ( )
-{
+{
if ( isVisibleWindow( launcher->winId() ) )
launcher->nextView();
else
launcher->raise();
}
void Desktop::executeOrModify( const QString& appLnkFile )
{
AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile );
if ( lnk.isValid() ) {
QCString app = lnk.exec().utf8();
Global::terminateBuiltin( "calibrate" );
if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) {
// MRUList::addTask( &lnk );
if ( hasVisibleWindow( app ) )
QCopChannel::send( "QPE/Application/" + app, "nextView()" );
else
QCopChannel::send( "QPE/Application/" + app, "raise()" );
}
else {
lnk.execute();
}
}
}
void Desktop::raiseDatebook()
{
Config cfg( "qpe" ); //F9 'Activity'
cfg.setGroup( "AppsKey" );
QString tempItem;
tempItem = cfg.readEntry( "LeftEnd" , "Calendar" );
if ( tempItem == "Calendar" || tempItem.isEmpty() ) {
tempItem = "datebook";
}
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << tempItem;
}
void Desktop::raiseContacts()
{
Config cfg( "qpe" ); //F10, 'Contacts'
cfg.setGroup( "AppsKey" );
QString tempItem;
tempItem = cfg.readEntry( "Left2nd", "Address Book" );
if ( tempItem == "Address Book" || tempItem.isEmpty() ) {
tempItem = "addressbook";
}
QCopEnvelope e( "QPE/System", "execute(QString)" );