author | zecke <zecke> | 2004-10-17 18:34:36 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-17 18:34:36 (UTC) |
commit | ca65f8eba5cd7e3a2e3096b545527ced8b76e5cd (patch) (side-by-side diff) | |
tree | 96b742d6b8f1322158cdc66a8b3f8357d73ac571 | |
parent | 8eaae40a6b9db12813be60ec7c8afe21afd4478d (diff) | |
download | opie-ca65f8eba5cd7e3a2e3096b545527ced8b76e5cd.zip opie-ca65f8eba5cd7e3a2e3096b545527ced8b76e5cd.tar.gz opie-ca65f8eba5cd7e3a2e3096b545527ced8b76e5cd.tar.bz2 |
-Use local8Bit instead of latin1
-rw-r--r-- | core/launcher/serverapp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index e541d10..be6b972 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp @@ -369,483 +369,483 @@ ServerApplication::ServerApplication( int& argc, char **argv, Type t ) ServerApplication::~ServerApplication() { ungrabKeyboard(); delete pa; delete m_ps; delete m_ps_last; } void ServerApplication::apmTimeout() { serverApp-> checkMemory( ); // in case no events are generated *m_ps_last = *m_ps; *m_ps = PowerStatusManager::readStatus(); if ( m_ps->acStatus() != m_ps_last-> acStatus() ) m_screensaver-> powerStatusChanged( *m_ps ); if ( m_ps->acStatus() == PowerStatus::Online ) { return; } int bat = m_ps-> batteryPercentRemaining(); if ( bat < m_ps_last-> batteryPercentRemaining() ) { if ( bat <= m_powerCritical ) { QMessageBox battlow( tr("WARNING"), tr("<p>The battery level is critical!" "<p>Keep power off until AC is restored"), QMessageBox::Warning, QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 0, QString::null, TRUE, WStyle_StaysOnTop); battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); battlow.exec(); } else if ( bat <= m_powerVeryLow ) pa->alert( tr( "The battery is running very low. "), 2 ); } if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) { QMessageBox battlow( tr("WARNING"), tr("<p>The Back-up battery is very low" "<p>Please charge the back-up battery"), QMessageBox::Warning, QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 0, QString::null, TRUE, WStyle_StaysOnTop); battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); battlow.exec(); } } void ServerApplication::systemMessage( const QCString& msg, const QByteArray& data ) { 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 ); } else if ( msg == "reloadPowerWarnSettings()" ) { reloadPowerWarnSettings(); } else if ( msg == "setDisplayState(int)" ) { int state; stream >> state; m_screensaver-> setDisplayState ( state != 0 ); } else if ( msg == "suspend()" ) { emit power(); } else if ( msg == "sendBusinessCard()" ) { QString card = ::getenv ( "HOME" ); card += "/Applications/addressbook/businesscard.vcf"; if ( QFile::exists( card ) ) { QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); QString mimetype = "text/x-vCard"; e << tr( "business card" ) << card << mimetype; } } } void ServerApplication::reloadPowerWarnSettings ( ) { Config cfg ( "apm" ); cfg. setGroup ( "Warnings" ); int iv = cfg. readNumEntry ( "checkinterval", 10000 ); m_apm_timer-> stop ( ); if ( iv ) m_apm_timer-> start ( iv ); m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); } void ServerApplication::launcherMessage( const QCString & msg, const QByteArray & data ) { QDataStream stream ( data, IO_ReadOnly ); if ( msg == "deviceButton(int,int,int)" ) { int keycode, press, autoRepeat; stream >> keycode >> press >> autoRepeat; kf->checkButtonAction ( true, keycode, press, autoRepeat ); } else if ( msg == "keyRegister(int,QCString,QCString)" ) { int k; QCString c, m; stream >> k >> c >> m; kf -> registerKey( QCopKeyRegister(k, c, m) ); } } bool ServerApplication::screenLocked() { return loggedin == 0; } void ServerApplication::login(bool at_poweron) { if ( !loggedin ) { Global::terminateBuiltin("calibrate"); // No tr int lockMode = at_poweron ? Opie::Security::IfPowerOn : Opie::Security::IfResume; Opie::Security::MultiauthPassword::authenticate(lockMode); loggedin=1; #ifndef QT_NO_COP QCopEnvelope e( "QPE/Desktop", "unlocked()" ); #endif } } #if defined(QPE_HAVE_TOGGLELIGHT) #include <qtopia/config.h> #include <sys/ioctl.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <linux/ioctl.h> #include <time.h> #endif namespace { void execAutoStart(const QDateTime& suspendTime ) { QString appName; int delay; QDateTime now = QDateTime::currentDateTime(); Config cfg( "autostart" ); cfg.setGroup( "AutoStart" ); appName = cfg.readEntry( "Apps", "" ); delay = cfg.readNumEntry( "Delay", 0 ); // If the time between suspend and resume was longer then the // value saved as delay, start the app if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( appName ); } } } void ServerApplication::togglePower() { static bool excllock = false; if ( excllock ) return ; excllock = true; bool wasloggedin = loggedin; loggedin = 0; m_suspendTime = QDateTime::currentDateTime(); #ifdef QWS if ( Opie::Security::MultiauthPassword::needToAuthenticate ( true ) && qt_screen ) { // Should use a big black window instead. // But this would not show up fast enough QGfx *g = qt_screen-> screenGfx ( ); g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( )); delete g; } #endif ODevice::inst ( )-> suspend ( ); ServerApplication::switchLCD ( true ); // force LCD on without slow qcop call QWSServer::screenSaverActivate ( false ); { QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep } if ( wasloggedin ) login ( true ); execAutoStart(m_suspendTime); //qcopBridge->closeOpenConnections(); excllock = false; } void ServerApplication::toggleLight() { #ifndef QT_NO_COP QCopEnvelope e("QPE/System", "setBacklight(int)"); e << -2; // toggle #endif } /* * We still listen to key events but handle them in * a special class */ bool ServerApplication::eventFilter( QObject *o, QEvent *e) { if ( e->type() != QEvent::KeyPress && e->type() != QEvent::KeyRelease ) return QPEApplication::eventFilter( o, e ); QKeyEvent *ke = static_cast<QKeyEvent*>( e ); if ( kf->checkButtonAction( true, ke->key(), e->type() == QEvent::KeyPress, ke-> isAutoRepeat() )) return true; return QPEApplication::eventFilter( o, e ); } #ifdef Q_WS_QWS bool ServerApplication::qwsEventFilter( QWSEvent *e ) { checkMemory(); if ( e->type == QWSEvent::Mouse ) { QWSMouseEvent *me = (QWSMouseEvent *)e; static bool up = TRUE; if ( me->simpleData.state&LeftButton ) { if ( up ) { up = FALSE; screenClick(TRUE); } } else if ( !up ) { up = TRUE; screenClick(FALSE); } } else if ( e->type == QWSEvent::Key ) { QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e ); if ( kf->checkButtonAction( false, ke-> simpleData.keycode, ke-> simpleData.is_press, ke-> simpleData.is_auto_repeat ) ) return true; } return QPEApplication::qwsEventFilter( e ); } #endif /* ### FIXME libqtopia Plugin Safe Mode */ void ServerApplication::showSafeMode() { #if 0 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, " "and the system is now in Safe Mode. " "Plugins are not loaded in Safe Mode. " "You can use the Plugin Manager to " "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) { Global::execute( "pluginmanager" ); } #endif } void ServerApplication::clearSafeMode() { #if 0 // If we've been running OK for a while then we won't bother going into // safe mode immediately on the next crash. Config cfg( "PluginLoader" ); cfg.setGroup( "Global" ); QString mode = cfg.readEntry( "Mode", "Normal" ); if ( mode == "MaybeSafe" ) { cfg.writeEntry( "Mode", "Normal" ); } #endif } void ServerApplication::shutdown() { if ( type() != GuiServer ) return; ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose ); connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)), this, SLOT(shutdown(ShutdownImpl::Type)) ); QPEApplication::showWidget( sd ); } void ServerApplication::shutdown( ShutdownImpl::Type t ) { char *opt = 0; switch ( t ) { case ShutdownImpl::ShutdownSystem: opt = "-h"; // fall through case ShutdownImpl::RebootSystem: if ( opt == 0 ) opt = "-r"; if ( execl( "/sbin/shutdown", "shutdown", opt, "now", ( void* ) 0) < 0 ) perror("shutdown"); // ::syslog ( LOG_ERR, "Erroring execing shutdown\n" ); break; case ShutdownImpl::RestartDesktop: restart(); break; case ShutdownImpl::TerminateDesktop: prepareForTermination( FALSE ); // This is a workaround for a Qt bug // clipboard applet has to stop its poll timer, or Qt/E // will hang on quit() right before it emits aboutToQuit() emit aboutToQuit ( ); quit(); break; } } void ServerApplication::restart() { if ( allowRestart ) { /* * Applets and restart is a problem. Some applets delete * their widgets even if ownership gets transfered to the * parent (Systray ) but deleting the applet may be unsafe * as well ( double deletion ). Some have topLevel widgets * and when we dlclose and then delete the widget we will * crash and an crash during restart is not nice */ #ifdef ALL_APPLETS_ON_THIS_WORLD_ARE_FIXED /* same as above */ emit aboutToQuit(); prepareForTermination(TRUE); doRestart = TRUE; quit(); #else prepareForTermination( true ); for ( int fd = 3; fd < 100; fd++ ) close( fd ); - execl( ( qpeDir() + "/bin/qpe" ).latin1(), "qpe", 0 ); + execl( ( qpeDir() + "/bin/qpe" ).local8Bit(), "qpe", NULL ); exit( 1 ); #endif } } void ServerApplication::rereadVolumes() { Config cfg( "qpe" ); cfg. setGroup ( "Volume" ); m_screentap_sound = cfg. readBoolEntry ( "TouchSound" ); m_keyclick_sound = cfg. readBoolEntry ( "KeySound" ); m_alarm_sound = cfg. readBoolEntry ( "AlarmSound" ); } void ServerApplication::checkMemory() { #if defined(QPE_HAVE_MEMALERTER) static bool ignoreNormal=TRUE; static bool existingMessage=FALSE; if(existingMessage) return; // don't show a second message while still on first existingMessage = TRUE; switch ( memstate ) { case MemUnknown: break; case MemLow: memstate = MemUnknown; if ( !recoverMemory() ) { QMessageBox::warning( 0 , tr("Memory Status"), tr("Memory Low\nPlease save data.") ); ignoreNormal = FALSE; } break; case MemNormal: memstate = MemUnknown; if ( !ignoreNormal ) { ignoreNormal = TRUE; QMessageBox::information ( 0 , tr("Memory Status"), "Memory OK" ); } break; case MemVeryLow: memstate = MemUnknown; QMessageBox::critical( 0 , tr("Memory Status"), tr("Critical Memory Shortage\n" "Please end this application\n" "immediately.") ); recoverMemory(); } existingMessage = FALSE; #endif } bool ServerApplication::recoverMemory() { return FALSE; } void ServerApplication::keyClick(int , bool press, bool ) { if ( press && m_keyclick_sound ) ODevice::inst() -> playKeySound(); } void ServerApplication::screenClick(bool press) { if ( press && m_screentap_sound ) ODevice::inst() -> playTouchSound(); } void ServerApplication::soundAlarm() { if ( me ()->m_alarm_sound ) ODevice::inst()->playAlarmSound(); } ServerApplication *ServerApplication::me ( ) { return static_cast<ServerApplication*>( qApp ); } bool ServerApplication::isStarting() { return ms_is_starting; } int ServerApplication::exec() { ms_is_starting = true; odebug << "Serverapp - exec" << oendl; return QPEApplication::exec(); } #include "serverapp.moc" |