47 #include <QSocketNotifier> 48 #include <QtCore/private/qcore_unix_p.h> 49 #include <QtGui/QApplication> 50 #include <QtGui/QPlatformScreen> 51 #include <QtGui/QPlatformWindow> 57 #include <sys/iomsg.h> 60 #include <sys/types.h> 70 #define KEYBOARD_SHADOW_HEIGHT 8 88 #ifdef QBBVIRTUALKEYBOARD_DEBUG 89 qDebug() <<
"QBB: starting keyboard event processing";
135 pps_encoder_initialize(
mEncoder,
false);
136 pps_decoder_initialize(
mDecoder, NULL);
141 qCritical(
"QBBVirtualKeyboard: Unable to open \"%s\" for keyboard: %s (%d).",
149 qCritical(
"QBBVirtualKeyboard: Unable to allocate buffer of %d bytes. Size is unavailable.",
sBufferSize);
165 pps_encoder_add_string(
mEncoder,
"msg",
"info");
166 pps_encoder_add_string(
mEncoder,
"id",
"libWebView");
182 #ifdef QBBVIRTUALKEYBOARD_DEBUG 183 qDebug() <<
"QBB: keyboardMessage size: " << nread;
196 if (static_cast<size_t>(nread) >
sBufferSize - 1) {
197 qCritical(
"QBBVirtualKeyboard: Keyboard buffer size too short; need %u.", nread + 1);
205 #ifdef QBBVIRTUALKEYBOARD_DEBUG 206 pps_decoder_dump_tree(
mDecoder, stderr);
210 if (pps_decoder_get_string(
mDecoder,
"error", &value) == PPS_DECODER_OK) {
211 qCritical(
"QBBVirtualKeyboard: Keyboard PPS decoder error: %s", value ? value :
"[null]");
215 if (pps_decoder_get_string(
mDecoder,
"msg", &value) == PPS_DECODER_OK) {
216 if (strcmp(value,
"show") == 0)
218 else if (strcmp(value,
"hide") == 0)
220 else if (strcmp(value,
"info") == 0)
222 else if (strcmp(value,
"connect") == 0) { }
224 qCritical(
"QBBVirtualKeyboard: Unexpected keyboard PPS msg value: %s", value ? value :
"[null]");
225 }
else if (pps_decoder_get_string(
mDecoder,
"res", &value) == PPS_DECODER_OK) {
226 if (strcmp(value,
"info") == 0)
229 qCritical(
"QBBVirtualKeyboard: Unexpected keyboard PPS res value: %s", value ? value :
"[null]");
231 qCritical(
"QBBVirtualKeyboard: Unexpected keyboard PPS message type");
240 if (pps_decoder_push(
mDecoder,
"dat") != PPS_DECODER_OK) {
241 qCritical(
"QBBVirtualKeyboard: Keyboard PPS dat object not found");
244 if (pps_decoder_get_int(
mDecoder,
"size", &newHeight) != PPS_DECODER_OK) {
245 qCritical(
"QBBVirtualKeyboard: Keyboard PPS size field not found");
248 if (pps_decoder_push(
mDecoder,
"locale") != PPS_DECODER_OK) {
249 qCritical(
"QBBVirtualKeyboard: Keyboard PPS locale object not found");
252 if (pps_decoder_get_string(
mDecoder,
"languageId", &value) != PPS_DECODER_OK) {
253 qCritical(
"QBBVirtualKeyboard: Keyboard PPS languageId field not found");
258 if (pps_decoder_get_string(
mDecoder,
"countryId", &value) != PPS_DECODER_OK) {
259 qCritical(
"QBBVirtualKeyboard: Keyboard PPS size countryId not found");
268 #ifdef QBBVIRTUALKEYBOARD_DEBUG 275 #ifdef QBBVIRTUALKEYBOARD_DEBUG 276 qDebug() <<
"QBB: showKeyboard()";
290 pps_encoder_add_string(
mEncoder,
"msg",
"show");
306 #ifdef QBBVIRTUALKEYBOARD_DEBUG 307 qDebug() <<
"QBB: hideKeyboard()";
313 pps_encoder_add_string(
mEncoder,
"msg",
"hide");
343 pps_encoder_add_string(
mEncoder,
"msg",
"options");
345 pps_encoder_start_object(
mEncoder,
"dat");
384 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
385 pps_encoder_add_string(
mEncoder,
"type",
"default");
390 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
391 pps_encoder_add_string(
mEncoder,
"type",
"url");
396 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
397 pps_encoder_add_string(
mEncoder,
"type",
"email");
402 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
403 pps_encoder_add_string(
mEncoder,
"type",
"web");
408 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
409 pps_encoder_add_string(
mEncoder,
"type",
"numPunc");
414 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
415 pps_encoder_add_string(
mEncoder,
"type",
"phone");
420 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
421 pps_encoder_add_string(
mEncoder,
"type",
"pin");
426 pps_encoder_add_string(
mEncoder,
"enter",
"enter.default");
427 pps_encoder_add_string(
mEncoder,
"type",
"symbol");
void setLanguage(const QString &language)
void addPhoneModeOptions()
void addNumPuncModeOptions()
#define QT_END_NAMESPACE
This macro expands to.
void applyKeyboardMode(KeyboardMode mode)
void setCountry(const QString &country)
void handleKeyboardInfoMessage()
QSocketNotifier * mReadNotifier
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString countryId() const
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void addSymbolModeOptions()
void addEmailModeOptions()
void addDefaultModeOptions()
void setHeight(int height)
void applyKeyboardModeOptions(KeyboardMode mode)
KeyboardMode keyboardMode() const
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
static const char * sPPSPath
void setVisible(bool visible)
static const size_t sBufferSize
#define KEYBOARD_SHADOW_HEIGHT
Q_CORE_EXPORT void qCritical(const char *,...)
int open(const char *, int,...)
static qint64 qt_safe_read(int fd, void *data, qint64 maxlen)
QString languageId() const