|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbPlugins module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 #include <hbinputmodeproperties.h> |
|
26 #include <hbinputmethod.h> |
|
27 #include <hbinputkeymapfactory.h> |
|
28 |
|
29 #include "touchinputplugin.h" |
|
30 #include "virtual12key.h" |
|
31 #include "virtualqwerty.h" |
|
32 #include "hbinputmodeproperties.h" |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // HbTouchInputPlugin::HbTouchInputPlugin |
|
36 // |
|
37 // Constructs HbTouchInputPlugin |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 HbTouchInputPlugin::HbTouchInputPlugin(QObject *parent) |
|
41 : QInputContextPlugin(parent) |
|
42 { |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // HbTouchInputPlugin::~HbTouchInputPlugin |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 HbTouchInputPlugin::~HbTouchInputPlugin() |
|
51 { |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // Virtual12KeyImpl::create |
|
56 // |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 QInputContext* HbTouchInputPlugin::create(const QString& key) |
|
60 { |
|
61 if (key == QString("HbVirtual12Key")) { |
|
62 return new HbVirtual12Key(); |
|
63 } else if (key == QString("HbVirtualQwerty")) { |
|
64 return new HbVirtualQwerty(); |
|
65 } else { |
|
66 return 0; |
|
67 } |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // HbTouchInputPlugin::description |
|
72 // |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 QString HbTouchInputPlugin::description(const QString& key) |
|
76 { |
|
77 if (key == QString("HbVirtual12Key")) { |
|
78 return QString("Virtual phone keypad input"); |
|
79 } else if (key == QString("HbVirtualQwerty")) { |
|
80 return QString("Virtual qwerty keyboard input"); |
|
81 } else { |
|
82 return QString(""); |
|
83 } |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // HbTouchInputPlugin::displayName |
|
88 // |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 QString HbTouchInputPlugin::displayName(const QString& key) |
|
92 { |
|
93 if (key == QString("HbVirtual12Key")) { |
|
94 return QString("Virtual 12-key"); |
|
95 } else if (key == QString("HbVirtualQwerty")) { |
|
96 return QString("Virtual Qwerty"); |
|
97 } else { |
|
98 return QString(""); |
|
99 } |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // HbTouchInputPlugin::keys |
|
104 // |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 QStringList HbTouchInputPlugin::keys() const |
|
108 { |
|
109 QStringList keys; |
|
110 keys.append(QString("HbVirtual12Key")); |
|
111 keys.append(QString("HbVirtualQwerty")); |
|
112 return keys; |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // HbTouchInputPlugin::languages |
|
117 // |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 QStringList HbTouchInputPlugin::languages(const QString& key) |
|
121 { |
|
122 QStringList result; |
|
123 |
|
124 if (key == "HbVirtual12Key") { |
|
125 // Empty language means that any language that has key mappings matches. |
|
126 HbInputModeProperties properties(HbInputModeDefault, HbInputLanguage(), HbKeyboardVirtual12Key); |
|
127 result.append(properties.asString()); |
|
128 |
|
129 properties = HbInputModeProperties(HbInputModeNumeric, HbInputLanguage(), HbKeyboardVirtual12Key); |
|
130 result.append(properties.asString()); |
|
131 } else if (key == "HbVirtualQwerty") { |
|
132 HbInputModeProperties properties(HbInputModeDefault, HbInputLanguage(), HbKeyboardVirtualQwerty); |
|
133 result.append(properties.asString()); |
|
134 |
|
135 QList<HbInputLanguage> languages = HbKeymapFactory::availableLanguages(); |
|
136 foreach (HbInputLanguage language, languages) { |
|
137 properties = HbInputModeProperties(HbInputModeNumeric, language, HbKeyboardVirtualQwerty); |
|
138 result.append(properties.asString()); |
|
139 } |
|
140 } |
|
141 |
|
142 return QStringList(result); |
|
143 } |
|
144 |
|
145 // |
|
146 // Make plugin loadable. |
|
147 // |
|
148 Q_EXPORT_PLUGIN2(TouchInput, HbTouchInputPlugin) |
|
149 |
|
150 // End of file |