-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 30 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.h | 2 |
2 files changed, 23 insertions, 9 deletions
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 4ae3c4f..ebf0cbb 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp @@ -29,16 +29,17 @@ #include "odevice_simpad.h" /* QT */ #include <qapplication.h> #include <qfile.h> #include <qtextstream.h> #include <qwindowsystem_qws.h> +#include <qwidgetlist.h> /* OPIE */ #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> #include <opie2/okeyfilter.h> @@ -310,33 +311,27 @@ void SIMpad::playAlarmSound() changeMixerForAlarm( 0, "/dev/sound/mixer" , &snd); snd. play(); #endif } bool SIMpad::suspend() // Must override because SIMpad does NOT have apm { - qDebug( "ODevice for SIMpad: suspend()" ); if ( !isQWS( ) ) // only qwsserver is allowed to suspend return false; - /* - * we need to save the screen content - * then go to suspend using ODevice::suspend - * and finally restore the screen content - */ - (void)::system( "cat /dev/fb/0 > /tmp/.buffer" ); bool res = ODevice::suspend(); /* - * restore + * restore the screen content if we really + * supended the device */ if ( res ) - ::system( "cat /tmp/.buffer > /dev/fb/0" ); + updateAllWidgets(); return res; } bool SIMpad::setDisplayStatus ( bool on ) { qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); @@ -364,8 +359,25 @@ bool SIMpad::setDisplayBrightness ( int bright ) } int SIMpad::displayBrightnessResolution() const { return 255; // All SIMpad models share the same display } + +/* + * The MQ200 DRAM content is lost during suspend + * so we will just repaint every widget on resume + */ +void SIMpad::updateAllWidgets() { + QWidgetList *list = QApplication::allWidgets(); + QWidgetListIt it( *list ); + QWidget *wid; + + while ((wid=it.current()) != 0 ) { + wid->update(); + ++it; + } + + delete list; +} diff --git a/libopie2/opiecore/device/odevice_simpad.h b/libopie2/opiecore/device/odevice_simpad.h index dbcbbb4..c25b911 100644 --- a/libopie2/opiecore/device/odevice_simpad.h +++ b/libopie2/opiecore/device/odevice_simpad.h @@ -60,16 +60,18 @@ class SIMpad : public ODevice virtual bool setLedState( OLed led, OLedState st ); protected: virtual void timerEvent( QTimerEvent *te ); int m_power_timer; OLedState m_leds [2]; +private: + static void updateAllWidgets(); }; struct s_button { uint model; Qt::Key code; char *utext; char *pix; char *fpressedservice; |