source: trunk/src/gui/kernel/qkeymapper_s60.cpp@ 798

Last change on this file since 798 was 769, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 7.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "private/qkeymapper_p.h"
43#include <e32keys.h>
44
45QT_BEGIN_NAMESPACE
46
47QKeyMapperPrivate::QKeyMapperPrivate()
48{
49}
50
51QKeyMapperPrivate::~QKeyMapperPrivate()
52{
53}
54
55QList<int> QKeyMapperPrivate::possibleKeys(QKeyEvent * /* e */)
56{
57 QList<int> result;
58 return result;
59}
60
61void QKeyMapperPrivate::clearMappings()
62{
63 // stub
64}
65
66QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers /* modifiers */)
67{
68 if (keySym >= Qt::Key_Escape)
69 return QString();
70
71 // Symbian doesn't actually use modifiers, but gives us the character code directly.
72
73 return QString(QChar(keySym));
74}
75
76#include <e32keys.h>
77struct KeyMapping{
78 TKeyCode s60KeyCode;
79 TStdScanCode s60ScanCode;
80 Qt::Key qtKey;
81};
82
83using namespace Qt;
84
85static const KeyMapping keyMapping[] = {
86 {EKeyBackspace, EStdKeyBackspace, Key_Backspace},
87 {EKeyTab, EStdKeyTab, Key_Tab},
88 {EKeyEnter, EStdKeyEnter, Key_Enter},
89 {EKeyEscape, EStdKeyEscape, Key_Escape},
90 {EKeySpace, EStdKeySpace, Key_Space},
91 {EKeyDelete, EStdKeyDelete, Key_Delete},
92 {EKeyPrintScreen, EStdKeyPrintScreen, Key_SysReq},
93 {EKeyPause, EStdKeyPause, Key_Pause},
94 {EKeyHome, EStdKeyHome, Key_Home},
95 {EKeyEnd, EStdKeyEnd, Key_End},
96 {EKeyPageUp, EStdKeyPageUp, Key_PageUp},
97 {EKeyPageDown, EStdKeyPageDown, Key_PageDown},
98 {EKeyInsert, EStdKeyInsert, Key_Insert},
99 {EKeyLeftArrow, EStdKeyLeftArrow, Key_Left},
100 {EKeyRightArrow, EStdKeyRightArrow, Key_Right},
101 {EKeyUpArrow, EStdKeyUpArrow, Key_Up},
102 {EKeyDownArrow, EStdKeyDownArrow, Key_Down},
103 {EKeyLeftShift, EStdKeyLeftShift, Key_Shift},
104 {EKeyRightShift, EStdKeyRightShift, Key_Shift},
105 {EKeyLeftAlt, EStdKeyLeftAlt, Key_Alt},
106 {EKeyRightAlt, EStdKeyRightAlt, Key_AltGr},
107 {EKeyLeftCtrl, EStdKeyLeftCtrl, Key_Control},
108 {EKeyRightCtrl, EStdKeyRightCtrl, Key_Control},
109 {EKeyLeftFunc, EStdKeyLeftFunc, Key_Super_L},
110 {EKeyRightFunc, EStdKeyRightFunc, Key_Super_R},
111 {EKeyCapsLock, EStdKeyCapsLock, Key_CapsLock},
112 {EKeyNumLock, EStdKeyNumLock, Key_NumLock},
113 {EKeyScrollLock, EStdKeyScrollLock, Key_ScrollLock},
114 {EKeyF1, EStdKeyF1, Key_F1},
115 {EKeyF2, EStdKeyF2, Key_F2},
116 {EKeyF3, EStdKeyF3, Key_F3},
117 {EKeyF4, EStdKeyF4, Key_F4},
118 {EKeyF5, EStdKeyF5, Key_F5},
119 {EKeyF6, EStdKeyF6, Key_F6},
120 {EKeyF7, EStdKeyF7, Key_F7},
121 {EKeyF8, EStdKeyF8, Key_F8},
122 {EKeyF9, EStdKeyF9, Key_F9},
123 {EKeyF10, EStdKeyF10, Key_F10},
124 {EKeyF11, EStdKeyF11, Key_F11},
125 {EKeyF12, EStdKeyF12, Key_F12},
126 {EKeyF13, EStdKeyF13, Key_F13},
127 {EKeyF14, EStdKeyF14, Key_F14},
128 {EKeyF15, EStdKeyF15, Key_F15},
129 {EKeyF16, EStdKeyF16, Key_F16},
130 {EKeyF17, EStdKeyF17, Key_F17},
131 {EKeyF18, EStdKeyF18, Key_F18},
132 {EKeyF19, EStdKeyF19, Key_F19},
133 {EKeyF20, EStdKeyF20, Key_F20},
134 {EKeyF21, EStdKeyF21, Key_F21},
135 {EKeyF22, EStdKeyF22, Key_F22},
136 {EKeyF23, EStdKeyF23, Key_F23},
137 {EKeyF24, EStdKeyF24, Key_F24},
138 {EKeyOff, EStdKeyOff, Key_PowerOff},
139// {EKeyMenu, EStdKeyMenu, Key_Menu}, // Menu is EKeyApplication0
140 {EKeyHelp, EStdKeyHelp, Key_Help},
141 {EKeyDial, EStdKeyDial, Key_Call},
142 {EKeyIncVolume, EStdKeyIncVolume, Key_VolumeUp},
143 {EKeyDecVolume, EStdKeyDecVolume, Key_VolumeDown},
144 {EKeyDevice0, EStdKeyDevice0, Key_Context1}, // Found by manual testing.
145 {EKeyDevice1, EStdKeyDevice1, Key_Context2}, // Found by manual testing.
146 {EKeyDevice3, EStdKeyDevice3, Key_Select},
147// {EKeyDevice7, EStdKeyDevice7, Key_Camera}, //not supported by qt yet
148 {EKeyApplication0, EStdKeyApplication0, Key_Menu}, // Found by manual testing.
149 {EKeyApplication1, EStdKeyApplication1, Key_Launch1}, // Found by manual testing.
150 {EKeyApplication2, EStdKeyApplication2, Key_MediaPlay}, // Found by manual testing.
151 {EKeyApplication3, EStdKeyApplication3, Key_MediaStop}, // Found by manual testing.
152 {EKeyApplication4, EStdKeyApplication4, Key_MediaNext}, // Found by manual testing.
153 {EKeyApplication5, EStdKeyApplication5, Key_MediaPrevious}, // Found by manual testing.
154 {EKeyApplication6, EStdKeyApplication6, Key_Launch6},
155 {EKeyApplication7, EStdKeyApplication7, Key_Launch7},
156 {EKeyApplication8, EStdKeyApplication8, Key_Launch8},
157 {EKeyApplication9, EStdKeyApplication9, Key_Launch9},
158 {EKeyApplicationA, EStdKeyApplicationA, Key_LaunchA},
159 {EKeyApplicationB, EStdKeyApplicationB, Key_LaunchB},
160 {EKeyApplicationC, EStdKeyApplicationC, Key_LaunchC},
161 {EKeyApplicationD, EStdKeyApplicationD, Key_LaunchD},
162 {EKeyApplicationE, EStdKeyApplicationE, Key_LaunchE},