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