|
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 |
|
26 #include "hbim.h" |
|
27 |
|
28 #include <private/hbmainwindow_p.h> |
|
29 #include <hbinputmethod.h> |
|
30 #include <hbinputmethod_p.h> |
|
31 |
|
32 bool HbInputInitializer::mRecursive = false; |
|
33 // --------------------------------------------------------------------------- |
|
34 // HbInputInitializer::HbInputInitializer |
|
35 // |
|
36 // Constructs HbInputInitializer |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 HbInputInitializer::HbInputInitializer(QObject *parent) |
|
40 : QInputContextPlugin(parent) |
|
41 { |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // HbInputInitializer::~HbInputInitializer |
|
46 // |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 HbInputInitializer::~HbInputInitializer() |
|
50 { |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // Virtual12KeyImpl::create |
|
55 // |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 QInputContext* HbInputInitializer::create(const QString& key) |
|
59 { |
|
60 if (key == QString("hbim")) { |
|
61 // this function is called from Qt framework's QApplication::inputContext() |
|
62 // now if inside this function or any function which is called from this function. |
|
63 // calls QApplication::inputContext() it will result in infinite recursion. |
|
64 // to guard this we are using this with mRecursive. |
|
65 // also setting HbMainWindowPrivate::initializeInputs to false will avoid |
|
66 // re-initialization of inputfw when HbMainWindow is launched. |
|
67 if (!mRecursive) { |
|
68 HbMainWindowPrivate::initializeInputs = false; |
|
69 mRecursive = true; |
|
70 HbInputMethod::initializeFramework(*qApp); |
|
71 QInputContext *ic = qApp->inputContext(); |
|
72 mRecursive = false; |
|
73 return ic; |
|
74 } else { |
|
75 // it was a recursive call, so for clarity return 0 from here. |
|
76 // this function is called only when QApplicaion's inputContext is null. |
|
77 // so returning a null for a recursive call. |
|
78 return 0; |
|
79 } |
|
80 } |
|
81 return 0; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // HbInputInitializer::description |
|
86 // |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 QString HbInputInitializer::description(const QString& key) |
|
90 { |
|
91 if (key == QString("hbim")) { |
|
92 return QString("Hb Input Initialization"); |
|
93 } else { |
|
94 return QString(""); |
|
95 } |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // HbInputInitializer::displayName |
|
100 // |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 QString HbInputInitializer::displayName(const QString& key) |
|
104 { |
|
105 if (key == QString("hbim")) { |
|
106 return QString("Hb Input Initialization"); |
|
107 } else { |
|
108 return QString(""); |
|
109 } |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // HbInputInitializer::keys |
|
114 // |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 QStringList HbInputInitializer::keys() const |
|
118 { |
|
119 QStringList keys; |
|
120 keys.append(QString("hbim")); |
|
121 return keys; |
|
122 } |
|
123 |
|
124 // --------------------------------------------------------------------------- |
|
125 // HbInputInitializer::languages |
|
126 // |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 QStringList HbInputInitializer::languages(const QString& /*key*/) |
|
130 { |
|
131 return QStringList(); |
|
132 } |
|
133 |
|
134 // |
|
135 // Make plugin loadable. |
|
136 // |
|
137 Q_EXPORT_PLUGIN2(OrbitInputInit, HbInputInitializer) |
|
138 |
|
139 // End of file |