summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-30 22:48:46 (UTC)
committer sandman <sandman>2002-09-30 22:48:46 (UTC)
commit6fdaab436d4fa72b3de06a1a9cf9be0bd964677a (patch) (unidiff)
tree7e7fb0fdbc5d4c4e2b2da9be790a764b8f45e0a5
parent21cacdafcef980a5ef712de6432750128a61ccdb (diff)
downloadopie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.zip
opie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.tar.gz
opie-6fdaab436d4fa72b3de06a1a9cf9be0bd964677a.tar.bz2
Changes to use the new ODevice API
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/main.cpp107
-rw-r--r--core/launcher/taskbar.cpp10
2 files changed, 16 insertions, 101 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 490af39..073e19a 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -46,4 +46,5 @@
46#endif 46#endif
47 47
48using namespace Opie;
48 49
49void initEnvironment() 50void initEnvironment()
@@ -66,104 +67,7 @@ void initEnvironment()
66} 67}
67 68
68static void initBacklight()
69{
70 QCopEnvelope e("QPE/System", "setBacklight(int)" );
71 e << -3; // Forced on
72}
73
74
75class ModelKeyFilter : public QObject, public QWSServer::KeyboardFilter
76{
77public:
78 ModelKeyFilter ( ) : QObject ( 0, "MODEL_KEY_FILTER" )
79 {
80 bool doinst = false;
81
82 m_model = ODevice::inst ( )-> model ( );
83 m_power_timer = 0;
84
85 switch ( m_model ) {
86 case OMODEL_iPAQ_H31xx:
87 case OMODEL_iPAQ_H36xx:
88 case OMODEL_iPAQ_H37xx:
89 case OMODEL_iPAQ_H38xx: doinst = true;
90 break;
91 default : break;
92 }
93 if ( doinst )
94 QWSServer::setKeyboardFilter ( this );
95 }
96
97 virtual bool filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
98 {
99 bool kill = false;
100
101 // Rotate cursor keys 180°
102 switch ( m_model ) {
103 case OMODEL_iPAQ_H31xx:
104 case OMODEL_iPAQ_H38xx: {
105 int newkeycode = keycode;
106
107 switch ( keycode ) {
108 case Key_Left : newkeycode = Key_Right; break;
109 case Key_Right: newkeycode = Key_Left; break;
110 case Key_Up : newkeycode = Key_Down; break;
111 case Key_Down : newkeycode = Key_Up; break;
112 }
113 if ( newkeycode != keycode ) {
114 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
115 kill = true;
116 }
117 break;
118 }
119 default: break;
120 }
121
122 // map Power Button short/long press to F34/F35
123 switch ( m_model ) {
124 case OMODEL_iPAQ_H31xx:
125 case OMODEL_iPAQ_H36xx:
126 case OMODEL_iPAQ_H37xx:
127 case OMODEL_iPAQ_H38xx: {
128 if ( keycode == Key_SysReq ) {
129 if ( isPress ) {
130 if ( m_power_timer )
131 killTimer ( m_power_timer );
132 m_power_timer = startTimer ( 500 );
133 }
134 else if ( m_power_timer ) {
135 killTimer ( m_power_timer );
136 m_power_timer = 0;
137 QWSServer::sendKeyEvent ( -1, Key_F34, 0, true, false );
138 QWSServer::sendKeyEvent ( -1, Key_F34, 0, false, false );
139 }
140 kill = true;
141 }
142 break;
143 }
144 default: break;
145 }
146 return kill;
147 }
148
149 virtual void timerEvent ( QTimerEvent * )
150 {
151 killTimer ( m_power_timer );
152 m_power_timer = 0;
153 QWSServer::sendKeyEvent ( -1, Key_F35, 0, true, false );
154 QWSServer::sendKeyEvent ( -1, Key_F35, 0, false, false );
155 }
156
157private:
158 OModel m_model;
159 int m_power_timer;
160};
161
162
163 69
164int initApplication( int argc, char ** argv ) 70int initApplication( int argc, char ** argv )
165{ 71{
166 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::OPIE );
167
168 initEnvironment(); 72 initEnvironment();
169 73
@@ -176,7 +80,10 @@ int initApplication( int argc, char ** argv )
176 DesktopApplication a( argc, argv, QApplication::GuiServer ); 80 DesktopApplication a( argc, argv, QApplication::GuiServer );
177 81
178 (void) new ModelKeyFilter ( ); 82 ODevice::inst ( )-> setSoftSuspend ( true );
179 83
180 initBacklight(); 84 { // init backlight
85 QCopEnvelope e("QPE/System", "setBacklight(int)" );
86 e << -3; // Forced on
87 }
181 88
182 AlarmServer::initialize(); 89 AlarmServer::initialize();
@@ -213,5 +120,5 @@ int initApplication( int argc, char ** argv )
213 delete d; 120 delete d;
214 121
215 ODevice::inst ( )-> setPowerButtonHandler ( ODevice::KERNEL ); 122 ODevice::inst ( )-> setSoftSuspend ( false );
216 123
217 return rv; 124 return rv;
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 1feae4a..46bcdb3 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -52,4 +52,6 @@
52 52
53 53
54using namespace Opie;
55
54#define FACTORY(T) \ 56#define FACTORY(T) \
55 static QWidget *new##T( bool maximized ) { \ 57 static QWidget *new##T( bool maximized ) { \
@@ -282,5 +284,11 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data )
282 stream >> led >> status; 284 stream >> led >> status;
283 285
284 ODevice::inst ( )-> setLed ( led, status ? OLED_BlinkSlow : OLED_Off ); 286 QValueList <OLed> ll = ODevice::inst ( )-> ledList ( );
287 if ( ll. count ( )){
288 OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0];
289 bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow );
290
291 ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off );
292 }
285 } 293 }
286} 294}