author | kergoth <kergoth> | 2003-04-19 20:47:28 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-04-19 20:47:28 (UTC) |
commit | c502394063598e63591e06072802f1c5a9e0c266 (patch) (unidiff) | |
tree | 66b5e6c888f2370437a399aa8bea7659a04cdb95 | |
parent | eb276a6663540849ef98819eeaa8f935a7e1b945 (diff) | |
download | opie-c502394063598e63591e06072802f1c5a9e0c266.zip opie-c502394063598e63591e06072802f1c5a9e0c266.tar.gz opie-c502394063598e63591e06072802f1c5a9e0c266.tar.bz2 |
Add SL-C700 button handling, so we can handle the keycode for the physical screen rotation.
-rw-r--r-- | libopie/odevice.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 713cc90..cb7dd74 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -39,6 +39,9 @@ | |||
39 | 39 | ||
40 | #include <qwindowsystem_qws.h> | 40 | #include <qwindowsystem_qws.h> |
41 | 41 | ||
42 | #ifndef ARRAY_SIZE | ||
43 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | ||
44 | #endif | ||
42 | 45 | ||
43 | // _IO and friends are only defined in kernel headers ... | 46 | // _IO and friends are only defined in kernel headers ... |
44 | 47 | ||
@@ -205,6 +208,29 @@ struct z_button { | |||
205 | "mail", "newMail()" }, | 208 | "mail", "newMail()" }, |
206 | }; | 209 | }; |
207 | 210 | ||
211 | struct z_button z_buttons_c700 [] = { | ||
212 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | ||
213 | "devicebuttons/z_calendar", | ||
214 | "datebook", "nextView()", | ||
215 | "today", "raise()" }, | ||
216 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | ||
217 | "devicebuttons/z_contact", | ||
218 | "addressbook", "raise()", | ||
219 | "addressbook", "beamBusinessCard()" }, | ||
220 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | ||
221 | "devicebuttons/z_home", | ||
222 | "QPE/Launcher", "home()", | ||
223 | "buttonsettings", "raise()" }, | ||
224 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | ||
225 | "devicebuttons/z_menu", | ||
226 | "QPE/TaskBar", "toggleMenu()", | ||
227 | "QPE/TaskBar", "toggleStartMenu()" }, | ||
228 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | ||
229 | "", | ||
230 | "QPE/Rotation", "flip()", | ||
231 | "QPE/Rotation", "flip()" }, | ||
232 | }; | ||
233 | |||
208 | static QCString makeChannel ( const char *str ) | 234 | static QCString makeChannel ( const char *str ) |
209 | { | 235 | { |
210 | if ( str && !::strchr ( str, '/' )) | 236 | if ( str && !::strchr ( str, '/' )) |
@@ -1141,12 +1167,12 @@ void Zaurus::init ( ) | |||
1141 | d-> m_modelstr = "Zaurus (model unknown)"; | 1167 | d-> m_modelstr = "Zaurus (model unknown)"; |
1142 | } | 1168 | } |
1143 | 1169 | ||
1170 | bool flipstate = false; | ||
1144 | switch ( d-> m_model ) { | 1171 | switch ( d-> m_model ) { |
1145 | case Model_Zaurus_SLA300: | 1172 | case Model_Zaurus_SLA300: |
1146 | d-> m_rotation = Rot0; | 1173 | d-> m_rotation = Rot0; |
1147 | break; | 1174 | break; |
1148 | case Model_Zaurus_SLC700: | 1175 | case Model_Zaurus_SLC700: |
1149 | bool flipstate = false; | ||
1150 | // Note: need to 1) set flipstate based on physical screen orientation | 1176 | // Note: need to 1) set flipstate based on physical screen orientation |
1151 | // and 2) check to see if the user overrode the rotation direction | 1177 | // and 2) check to see if the user overrode the rotation direction |
1152 | // using appearance, and if so, remove that item from the Config to | 1178 | // using appearance, and if so, remove that item from the Config to |
@@ -1180,8 +1206,21 @@ void Zaurus::initButtons ( ) | |||
1180 | 1206 | ||
1181 | d-> m_buttons = new QValueList <ODeviceButton>; | 1207 | d-> m_buttons = new QValueList <ODeviceButton>; |
1182 | 1208 | ||
1183 | for ( uint i = 0; i < ( sizeof( z_buttons ) / sizeof( z_button )); i++ ) { | 1209 | struct z_button * pz_buttons; |
1184 | z_button *zb = z_buttons + i; | 1210 | int buttoncount; |
1211 | switch ( d-> m_model ) { | ||
1212 | case Model_Zaurus_SLC700: | ||
1213 | pz_buttons = z_buttons_c700; | ||
1214 | buttoncount = ARRAY_SIZE(z_buttons_c700); | ||
1215 | break; | ||
1216 | default: | ||
1217 | pz_buttons = z_buttons; | ||
1218 | buttoncount = ARRAY_SIZE(z_buttons); | ||
1219 | break; | ||
1220 | } | ||
1221 | |||
1222 | for ( int i = 0; i < buttoncount; i++ ) { | ||
1223 | struct z_button *zb = pz_buttons + i; | ||
1185 | ODeviceButton b; | 1224 | ODeviceButton b; |
1186 | 1225 | ||
1187 | b. setKeycode ( zb-> code ); | 1226 | b. setKeycode ( zb-> code ); |