-rw-r--r-- | libopie/odevice.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 78eb416..9e97c56 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -190,129 +190,129 @@ struct z_button { | |||
190 | "addressbook", "beamBusinessCard()" }, | 190 | "addressbook", "beamBusinessCard()" }, |
191 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 191 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
192 | "devicebuttons/z_home", | 192 | "devicebuttons/z_home", |
193 | "QPE/Launcher", "home()", | 193 | "QPE/Launcher", "home()", |
194 | "buttonsettings", "raise()" }, | 194 | "buttonsettings", "raise()" }, |
195 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 195 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
196 | "devicebuttons/z_menu", | 196 | "devicebuttons/z_menu", |
197 | "QPE/TaskBar", "toggleMenu()", | 197 | "QPE/TaskBar", "toggleMenu()", |
198 | "QPE/TaskBar", "toggleStartMenu()" }, | 198 | "QPE/TaskBar", "toggleStartMenu()" }, |
199 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 199 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
200 | "devicebuttons/z_mail", | 200 | "devicebuttons/z_mail", |
201 | "mail", "raise()", | 201 | "mail", "raise()", |
202 | "mail", "newMail()" }, | 202 | "mail", "newMail()" }, |
203 | }; | 203 | }; |
204 | 204 | ||
205 | static QCString makeChannel ( const char *str ) | 205 | static QCString makeChannel ( const char *str ) |
206 | { | 206 | { |
207 | if ( str && !::strchr ( str, '/' )) | 207 | if ( str && !::strchr ( str, '/' )) |
208 | return QCString ( "QPE/Application/" ) + str; | 208 | return QCString ( "QPE/Application/" ) + str; |
209 | else | 209 | else |
210 | return str; | 210 | return str; |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
214 | 214 | ||
215 | 215 | ||
216 | ODevice *ODevice::inst ( ) | 216 | ODevice *ODevice::inst ( ) |
217 | { | 217 | { |
218 | static ODevice *dev = 0; | 218 | static ODevice *dev = 0; |
219 | 219 | ||
220 | if ( !dev ) { | 220 | if ( !dev ) { |
221 | if ( QFile::exists ( "/proc/hal/model" )) | 221 | if ( QFile::exists ( "/proc/hal/model" )) |
222 | dev = new iPAQ ( ); | 222 | dev = new iPAQ ( ); |
223 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 223 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
224 | dev = new Zaurus ( ); | 224 | dev = new Zaurus ( ); |
225 | else | 225 | else |
226 | dev = new ODevice ( ); | 226 | dev = new ODevice ( ); |
227 | 227 | ||
228 | dev-> init ( ); | 228 | dev-> init ( ); |
229 | } | 229 | } |
230 | return dev; | 230 | return dev; |
231 | } | 231 | } |
232 | 232 | ||
233 | 233 | ||
234 | /************************************************** | 234 | /************************************************** |
235 | * | 235 | * |
236 | * common | 236 | * common |
237 | * | 237 | * |
238 | **************************************************/ | 238 | **************************************************/ |
239 | 239 | ||
240 | 240 | ||
241 | ODevice::ODevice ( ) | 241 | ODevice::ODevice ( ) |
242 | { | 242 | { |
243 | d = new ODeviceData; | 243 | d = new ODeviceData; |
244 | 244 | ||
245 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 245 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
246 | 246 | ||
247 | d-> m_modelstr = "Unknown"; | 247 | d-> m_modelstr = "Unknown"; |
248 | d-> m_model = Model_Unknown; | 248 | d-> m_model = Model_Unknown; |
249 | d-> m_vendorstr = "Unknown"; | 249 | d-> m_vendorstr = "Unknown"; |
250 | d-> m_vendor = Vendor_Unknown; | 250 | d-> m_vendor = Vendor_Unknown; |
251 | d-> m_systemstr = "Unknown"; | 251 | d-> m_systemstr = "Unknown"; |
252 | d-> m_system = System_Unknown; | 252 | d-> m_system = System_Unknown; |
253 | d-> m_sysverstr = "0.0"; | 253 | d-> m_sysverstr = "0.0"; |
254 | d-> m_rotation = None; | 254 | d-> m_rotation = Rot0; |
255 | 255 | ||
256 | d-> m_holdtime = 1000; // 1000ms | 256 | d-> m_holdtime = 1000; // 1000ms |
257 | 257 | ||
258 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 258 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
259 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 259 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 262 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
263 | { | 263 | { |
264 | if ( msg == "deviceButtonMappingChanged()" ) { | 264 | if ( msg == "deviceButtonMappingChanged()" ) { |
265 | reloadButtonMapping ( ); | 265 | reloadButtonMapping ( ); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | void ODevice::init ( ) | 269 | void ODevice::init ( ) |
270 | { | 270 | { |
271 | // Simulation uses iPAQ 3660 device buttons | 271 | // Simulation uses iPAQ 3660 device buttons |
272 | 272 | ||
273 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 273 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
274 | i_button *ib = ipaq_buttons + i; | 274 | i_button *ib = ipaq_buttons + i; |
275 | ODeviceButton b; | 275 | ODeviceButton b; |
276 | 276 | ||
277 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 277 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
278 | b. setKeycode ( ib-> code ); | 278 | b. setKeycode ( ib-> code ); |
279 | b. setUserText ( qApp-> translate ( "Button", ib-> utext )); | 279 | b. setUserText ( qApp-> translate ( "Button", ib-> utext )); |
280 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 280 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
281 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 281 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
282 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 282 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
283 | 283 | ||
284 | d-> m_buttons. append ( b ); | 284 | d-> m_buttons. append ( b ); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | reloadButtonMapping ( ); | 287 | reloadButtonMapping ( ); |
288 | } | 288 | } |
289 | 289 | ||
290 | ODevice::~ODevice ( ) | 290 | ODevice::~ODevice ( ) |
291 | { | 291 | { |
292 | delete d; | 292 | delete d; |
293 | } | 293 | } |
294 | 294 | ||
295 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 295 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
296 | { | 296 | { |
297 | return false; | 297 | return false; |
298 | } | 298 | } |
299 | 299 | ||
300 | //#include <linux/apm_bios.h> | 300 | //#include <linux/apm_bios.h> |
301 | 301 | ||
302 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 302 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
303 | 303 | ||
304 | 304 | ||
305 | bool ODevice::suspend ( ) | 305 | bool ODevice::suspend ( ) |
306 | { | 306 | { |
307 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend | 307 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend |
308 | return false; | 308 | return false; |
309 | 309 | ||
310 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 310 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
311 | return false; | 311 | return false; |
312 | 312 | ||
313 | bool res = false; | 313 | bool res = false; |
314 | 314 | ||
315 | struct timeval tvs, tvn; | 315 | struct timeval tvs, tvn; |
316 | ::gettimeofday ( &tvs, 0 ); | 316 | ::gettimeofday ( &tvs, 0 ); |
317 | 317 | ||
318 | ::sync ( ); // flush fs caches | 318 | ::sync ( ); // flush fs caches |