-rw-r--r-- | core/launcher/serverapp.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index fac52a6..64c97d4 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp @@ -15,103 +15,103 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "serverapp.h" #include "screensaver.h" /* OPIE */ #include <opie2/odebug.h> #include <opie2/odevice.h> #include <opie2/multiauthpassword.h> #include <qtopia/config.h> #include <qtopia/power.h> #ifdef Q_WS_QWS #include <qtopia/qcopenvelope_qws.h> #endif #include <qtopia/global.h> using namespace Opie::Core; /* QT */ #ifdef Q_WS_QWS #include <qgfx_qws.h> #endif #include <qmessagebox.h> #include <qtimer.h> #include <qpainter.h> #include <qfile.h> #include <qpixmapcache.h> /* STD */ #ifdef Q_OS_WIN32 #include <io.h> #include <process.h> #else #include <unistd.h> #endif #include <stdlib.h> static ServerApplication *serverApp = 0; static int loggedin=0; QCopKeyRegister::QCopKeyRegister() : m_keyCode( 0 ) { -odebug << "KeyRegister1 " << m_keyCode << oendl; + } QCopKeyRegister::QCopKeyRegister( int k, const QCString& c, const QCString& m ) :m_keyCode( k ), m_channel( c ), m_message( m ) { -odebug << "keyRegister2 " << m_keyCode << c << m << oendl; + } int QCopKeyRegister::keyCode() const { return m_keyCode; } QCString QCopKeyRegister::channel() const { return m_channel; } QCString QCopKeyRegister::message() const { return m_message; } bool QCopKeyRegister::send() { if (m_channel.isNull() ) return false; qDebug("Send Message: "+m_channel+" "+m_message); QCopEnvelope e( m_channel, m_message ); return true; } //--------------------------------------------------------------------------- /* Priority is number of alerts that are needed to pop up alert. */ class DesktopPowerAlerter : public QMessageBox { Q_OBJECT public: DesktopPowerAlerter( QWidget *parent, const char *name = 0 ) : QMessageBox( tr("Battery Status"), tr("Low Battery"), QMessageBox::Critical, QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton, QMessageBox::NoButton, parent, name, FALSE ) { currentPriority = INT_MAX; alertCount = 0; } @@ -122,97 +122,97 @@ private: int alertCount; }; void DesktopPowerAlerter::alert( const QString &text, int priority ) { alertCount++; if ( alertCount < priority ) return; if ( priority > currentPriority ) return; currentPriority = priority; setText( text ); show(); } void DesktopPowerAlerter::hideEvent( QHideEvent *e ) { QMessageBox::hideEvent( e ); alertCount = 0; currentPriority = INT_MAX; } //--------------------------------------------------------------------------- KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0) { /* We don't do this cause it would interfere with ODevice */ #if 0 qwsServer->setKeyboardFilter(this); #endif } void KeyFilter::timerEvent(QTimerEvent* e) { if ( e->timerId() == held_tid ) { killTimer(held_tid); // button held if ( heldButton ) { emit activate(heldButton, TRUE); heldButton = 0; } held_tid = 0; } } void KeyFilter::registerKey( const QCopKeyRegister& key ) { -odebug << "KeyFilter::registerKey " << key.keyCode() << key.channel() << key.message() << oendl; + m_keys.insert( key.keyCode(), key ); } void KeyFilter::unregisterKey( const QCopKeyRegister& key ) { m_keys.remove( key.keyCode() ); } bool KeyFilter::keyRegistered( int key ) { /* * Check if we've a key registered */ if ( !m_keys[key].send()) return false; else return true; } bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepeat) { if ( !loggedin // Permitted keys && keycode != Key_F34 // power && keycode != Key_F30 // select && keycode != Key_Enter && keycode != Key_Return && keycode != Key_Space && keycode != Key_Left && keycode != Key_Right && keycode != Key_Up && keycode != Key_Down ) return TRUE; /* check if it was registered */ if (!db ) { if (keycode != 0 &&press && !autoRepeat && keyRegistered(keycode) ) return true; } else { // First check to see if DeviceButtonManager knows something about this button: const ODeviceButton* button = ODevice::inst()->buttonForKeycode(keycode); if (button && !autoRepeat) { if ( held_tid ) { killTimer(held_tid); held_tid = 0; } if ( button->heldAction().isNull() ) { |