1 /***************************************************************************
2 **
3 ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QQNXABSTRACTVIRTUALKEYBOARD_H
41 #define QQNXABSTRACTVIRTUALKEYBOARD_H
42 
43 #include <QLocale>
44 #include <QObject>
45 
46 QT_BEGIN_NAMESPACE
47 
48 class QQnxAbstractVirtualKeyboard : public QObject
49 {
50     Q_OBJECT
51 public:
52     // Keyboard Types currently supported.
53     // Default - Regular Keyboard
54     // Url/Email - Enhanced keys for each types.
55     // Web - Regular keyboard with two blank keys, currently unused.
56     // NumPunc - Numbers & Punctionation, alternate to Symbol
57     // Number - Number pad
58     // Symbol - All symbols, alternate to NumPunc, currently unused.
59     // Phone - Phone enhanced keyboard
60     // Pin - Keyboard for entering Pins (Hex values).
61     // Password - Keyboard with lots of extra characters for password input.
62     // Alphanumeric - Similar to password without any of the security implications.
63     //
64     enum KeyboardMode { Default, Url, Email, Web, NumPunc, Number, Symbol, Phone, Pin, Password, Alphanumeric };
65     enum EnterKeyType { DefaultReturn, Connect, Done, Go, Join, Next, Search, Send, Submit };
66 
67     explicit QQnxAbstractVirtualKeyboard(QObject *parent = 0);
68 
69     virtual bool showKeyboard() = 0;
70     virtual bool hideKeyboard() = 0;
71 
height()72     int  height() { return m_visible ? m_height : 0; }
isVisible()73     bool isVisible() const { return m_visible; }
locale()74     QLocale locale() const { return m_locale; }
75 
76     void setKeyboardMode(KeyboardMode mode);
77     void setEnterKeyType(EnterKeyType type);
78 
79     void setInputHints(int inputHints);
keyboardMode()80     KeyboardMode keyboardMode() const { return m_keyboardMode; }
enterKeyType()81     EnterKeyType enterKeyType() const { return m_enterKeyType; }
82 
83     static EnterKeyType qtEnterKeyTypeToQnx(Qt::EnterKeyType type);
84 
85 Q_SIGNALS:
86     void heightChanged(int height);
87     void visibilityChanged(bool visible);
88     void localeChanged(const QLocale &locale);
89 
90 protected:
91     virtual void applyKeyboardOptions() = 0;
92 
93     void setHeight(int height);
94     void setVisible(bool visible);
95     void setLocale(const QLocale &locale);
96 
97 private:
98     int m_height;
99     bool m_visible;
100     QLocale m_locale;
101     KeyboardMode m_keyboardMode;
102     EnterKeyType m_enterKeyType;
103 };
104 
105 QT_END_NAMESPACE
106 
107 #endif // QQNXABSTRACTVIRTUALKEYBOARD_H
108