LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IMEController.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2010-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef IMECONTROLLER_H
23 #define IMECONTROLLER_H
24 
25 #include <QObject>
26 
27 #include <palmimedefines.h>
28 
29 class InputClient;
30 
31 class IMEController : public QObject
32 {
33  Q_OBJECT
34 
35 public:
36  static IMEController* instance();
37 
38  void setClient(InputClient* newClient);
40 
41  const InputClient* const client() const { return m_client; }
42 
43  bool isIMEOpened() const { return m_imeOpened; }
44  bool isIMEActive() const { return m_imeAllowed; }
45 
46  void setComposingText(const std::string& text);
47  void commitComposingText();
48 
49  void commitText(const std::string& text);
50 
51  void performEditorAction(PalmIME::FieldAction action);
52 
53  void hideIME();
54 
55  void notifyInputFocusChange(InputClient* client, bool focused);
56 
57  void notifyAutoCapChanged(InputClient* client, bool enabled);
58 
59  // explicit setting for whether the IME will show itself when
60  // an input field gains focus in the active client
61  void setIMEActive(bool active);
62 
63 Q_SIGNALS:
64  void signalHideIME();
65  void signalShowIME();
66  void signalRestartInput(const PalmIME::EditorState& state);
67  void signalAutoCapChanged(bool enabled);
68 
69 private Q_SLOTS:
70  void slotBluetoothKeyboardChanged(bool active);
71  void slotTouchesReleasedFromScreen();
72 
73 private:
74  void hideIMEInternal();
75  void showIMEInternal();
76 
77 private:
78  InputClient* m_client;
79  bool m_imeOpened;
80  bool m_imeAllowed;
81 
82  enum PendingVisibility {
83  PendingVisibilityNone = 0,
84  PendingVisibilityHide,
85  PendingVisibilityShow
86  };
87  PendingVisibility m_pendingVisibility;
88 
89 private:
90  IMEController();
91  Q_DISABLE_COPY(IMEController)
92 };
93 
94 #endif
95