Notification when changes in the keyboard language

On two physical keyboard devices and devices to contact user can change the language or the keyboard (i.e. the input language). Is there a way to the running application to detect when such a change happens?

Any help is greatly appreciated.

I don't think that BPS has this info anywhere, here how get it instead of the PPS.

Don't forget to add some LIBS +=-lbb to your pro file.

You can reuse the class PpsWatch for any other purpose PPS incidentally, my app "File System" allows you to navigate to the folder MAP to discover the various objects available PPS, or you can also use your BlackBerry browser and copy - paste this url:

file:///PPS/

// applicationui.cpp

#include "applicationui.hpp"

#include 
#include 
#include 
#include 

#include 

using namespace bb::cascades;

ApplicationUI::ApplicationUI() :
        QObject()
{
    // Don't forget to add LIBS += -lbb to your pro file
    m_ppsWatch = new PpsWatch("/pps/services/input/options", this);
    connect(m_ppsWatch, SIGNAL(logMessage(const QString&)), this, SLOT(onLogMessage(const QString&)));
    connect(m_ppsWatch, SIGNAL(ppsFileReady(const QVariantMap&)), this, SLOT(onPpsFileReady(const QVariantMap&)));

    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()));
    // This is only available in Debug builds
    Q_ASSERT(res);
    // Since the variable is not used in the app, this is added to avoid a
    // compiler warning
    Q_UNUSED(res);

    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject();

    // Set created root object as the application scene
    Application::instance()->setScene(root);
}

void ApplicationUI::onLogMessage(const QString& message) {
    qDebug() << message;
}

void ApplicationUI::onPpsFileReady(const QVariantMap& ppsMap) {
    if (ppsMap.contains("languages.active_lang_layouts")) {
        QVariantMap active_lang_layouts = ppsMap["languages.active_lang_layouts"].toMap();
        QStringList locales = active_lang_layouts["locales"].toStringList();

        qDebug() << "Language list used right now:" << locales;
    }
}

void ApplicationUI::onSystemLanguageChanged()
{
    QCoreApplication::instance()->removeTranslator(m_pTranslator);
    // Initiate, load and install the application translation files.
    QString locale_string = QLocale().name();
    QString file_name = QString("KeyboardLanguage_%1").arg(locale_string);
    if (m_pTranslator->load(file_name, "app/native/qm")) {
        QCoreApplication::instance()->installTranslator(m_pTranslator);
    }
}
// applicationui.hpp

#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_

#include 

#include 

namespace bb
{
    namespace cascades
    {
        class LocaleHandler;
    }
}

class QTranslator;

/*!
 * @brief Application UI object
 *
 * Use this object to create and init app UI, to create context objects, to register the new meta types etc.
 */
class ApplicationUI : public QObject
{
    Q_OBJECT
public:
    ApplicationUI();
    virtual ~ApplicationUI() {}

private slots:
    void onLogMessage(const QString& message);
    void onPpsFileReady(const QVariantMap& ppsMap);
    void onSystemLanguageChanged();

private:
    QTranslator* m_pTranslator;
    bb::cascades::LocaleHandler* m_pLocaleHandler;

    PpsWatch* m_ppsWatch;
};

#endif /* ApplicationUI_HPP_ */
/*
 * PpsWatch.cpp
 *
 *  Created on: 2015-06-05
 *      Author: Roger
 */

#include 
#include 

PpsWatch::PpsWatch(const QString& path, QObject *_parent) {
    emit logMessage("PpsWatch::PpsWatch()");

    if (_parent)
        this->setParent(_parent);

    m_path = path;
    m_mapTitle = "@" + path.split("/").last();

    m_ppsObject = new bb::PpsObject(path + "?wait,delta", this);
    connect(m_ppsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));

    if(!m_ppsObject->open(bb::PpsOpenMode::Subscribe)) {
        emit logMessage("Could not connect to " + path + " object: " + m_ppsObject->errorString());
    }
}

PpsWatch::~PpsWatch()
{
    emit logMessage("PpsWatch::~PpsWatch()");
    delete m_ppsObject;
    m_ppsObject = NULL;
}

void PpsWatch::changePath(const QString& path) {
    emit logMessage("PpsWatch::changePath() " + path);

    if (m_path == path) {
        emit logMessage("Same path as before, return");
        return;
    }

    m_path = path;
    m_mapTitle = "@" + path.split("/").last();

    if(!m_ppsObject->close()) {
        emit logMessage("Could not disconnect from " + m_ppsObject->objectName() + " object: " + m_ppsObject->errorString());
    }
    else {
        disconnect(m_ppsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));
    }

    m_ppsObject = new bb::PpsObject(path + "?wait,delta", this);
    connect(m_ppsObject, SIGNAL(readyRead()), this, SLOT(onPpsReadyRead()));

    if(!m_ppsObject->open(bb::PpsOpenMode::Subscribe)) {
        emit logMessage("Could not connect to " + path + " object: " + m_ppsObject->errorString());
    }
}

void PpsWatch::onPpsReadyRead() {
    emit logMessage("PpsWatch::onPpsReadyRead()");

    bool readOk;
    QByteArray data = m_ppsObject->read(&readOk);
    if(!readOk) { return; }

    bool decodeOk;
    const QVariantMap map = bb::PpsObject::decode(data, &decodeOk);
    if(!decodeOk) { return; }

    const QVariantMap ppsFile = map[m_mapTitle].toMap();
    if (ppsFile.isEmpty()) { return; }

    emit ppsFileReady(ppsFile);
}
/*
 * PpsWatch.h
 *
 *  Created on: 2015-06-05
 *      Author: Roger
 */

#ifndef PPSWATCH_H_
#define PPSWATCH_H_

#include 
#include 

class PpsWatch : public QObject
{
    Q_OBJECT

public:
    PpsWatch(const QString& path, QObject *_parent = 0);
    virtual ~PpsWatch();

    void changePath(const QString& path);

private slots:
    void onPpsReadyRead();

private:
    bb::PpsObject* m_ppsObject;

    QString m_path;
    QString m_mapTitle;

signals:
    void logMessage(const QString&);
    void ppsFileReady(const QVariantMap&);
};

#endif /* PPSWATCH_H_ */

Tags: BlackBerry Developers

Similar Questions

  • How to change the order of the keyboard languages

    Yesterday I updated the OS X 10.11.4. Today, I noticed that the order of the keyboard languages has changed, it is not any longer in alphabetical order. In my case, it used to be Canadian English, then Romanian, then Romanian - Standard. Now it is Romanian, then Romanian - Standard, so that English-speaking Canadians. I would go back to the previous command (which was true for OS X Leopard) because he is Canadian English that I use the most and I want him to be at the top. However, I can't be able to change the order. How this could be achieved? Thank you.

    Help! Anyone, please?

  • Satellite M60: Express Media Player change the keyboard language

    Hi, I have a Sattelite M60 & ran the Express Media Player before fully reading the manual. After reading the manual, I notice that I put the keyboard language for eng1 Express Media Player, now which is US format (rather than UK eng2). However, the options for change that are grayed out in the page options. Is it possible to activate these or change the setting of any other way?

    Is it really a problem to the Express Media Player for US instead of the language of the UK keyboard? Using the restore CD is not an option, because I've completely implemented my system now.

    Thank you
    Paul

    Hello

    I put t have a lot of experience in the Media Express drive but I guess that this setting, you can change at the beginning.
    Unfortunately, in this case you need to reinstall the EMP.
    I don t think that there is another possibility.

  • Satellite L300D: changing in Vista keyboard language settings

    Hello!

    I bought a cell phone in Spain (Satellite L300D series) and I added to the 'language bar' option 'Portuguese' (my language).
    Usually I write texts in both languages - this is why I have not removed the "Spanish" option in the "language bar".
    However, the Windows Vista changing by "chance", the language of my keyboard. Let me explain:

    I opened the "language bar". Then, I opened the "Configuration" > "High Key Configuration.
    There is the option "access keys for input languages". It is possible to select the 'ALT', 'CAPS LOCK' and 'SHIFT' keys to change the keyboard language. But it is also possible to only select "key" - so, theoretically, any key should you press: the language of the keyboard will not change.

    That's what I did - but Windows Vista is not "obey" me...
    What should I do to stop this type of change?

    Thank you!

    Hello

    OK, you use two for keyboard input languages, but you should know that when you set once there are no fix. If you use several applications at the same time for each running application, you must set the input language.

    I always use a single switch to choose between languages with left Alt + shift. The other two parameters are set to NONE. So when I use some application I can always check what language is set and change it quickly using left Alt + Shift key combination.

    That's all. Test it on your laptop.

  • Satellite U920T - the screen goes black when you drag the keyboard

    This morning, I turned on my U920T-10 days but the screen remained black.

    At first, I thought the screen was broken, but in mode 'Tablet', the screen became. Now when I slide the keyboard the screen goes black again.

    How can this problem be solved?

    Hello

    For me, it looks like a bad connection somewhere between the screen and the motherboard.
    This could be possible reason for failure to display while sliding in and out.

    I guess this can be resolved easily and I think that it is a job for a technician (authorized service provider). I recommend you contact the service technician in your country to get the laptop fixed. I hope that the warranty is still valid in order to repair for free.

    I hope that this can be corrected. I keep fingers crossed.

  • Satellite A660-133 - Vibrations when I use the keyboard or a touchpad

    Hello
    I have a Satellite A660-133, when I use the keyboard or the touchpad I can hear a lot of vibration from the stop of the laptop. I think that this is not normal, but actually the same model showed in the shop does the same thing. What do you think about this?

    Is there anyone who has this model and who is able to tell me what is its experience in this respect?

    Thank you!

    Hi davmat,

    I m not Satellite A660 owner, but a friend told a. He never spoke to me such a problem expect that s a great notebook with powerful hardware and he likes the design. I agree with him that s a great notebook from Toshiba!

    Anyway, if you think that it of not normal, you need to contact a service provider authorized in your country. Guys can check this problem and maybe you need a new keyboard, but this can be exchanged under warranty.

    You can find a list of aspic here:
    http://EU.computers.Toshiba-Europe.com > support & downloads > find an authorized service provider

    Good luck! :)

  • 6 s iPhone crashes when you use the keyboard

    Hi guys

    My iPhone (iOS 9.2.1) 6s freezes when I use the keyboard, doesn´t question in what program. After about 10-15 seconds to stop the gel, but only until I have started typing again. The only why to solve the problem is to "quick restart" operating the phone down the sleep and home button and release the home button when the screen goes back to the home screen. I ve already searched the net and tried several solutions, without any effect:

    Full reset

    Reset

    Disable iCloud for documents

    Disable third party including the emoji keyboard keyboards

    My best guess is that the problem has something to do with the timing of RAM or iCloud phones somehow...

    All the ideas!

    Best regards

    Mads

    Hi Samzonite,

    I understand that you are having problems with the keyboard on your iPhone. Let's see if we can get that worked.

    Based on the diagnosis that you have done so far, it seems you need to restore your iPhone and set it up like new. This will allow you to isolate the problem to sync your content back plus one. Take a look at the article below for more details on this subject.

    How to clear your iOS device and then set up as a new device or restore from backups
    https://support.Apple.com/en-us/HT204686

    Nice day

  • Z500 touchpad work not when you use the keyboard. Please help me please!

    Hello

    I recently bought a lenovo z500 and it's great, but I have a little problem. When I use the keyboard to play games (I use the WASD keys) the touchpad does not, which means I can't play. Help, please!

    I got it finally started working by removing the pilot of the momentum. I don't think that I will reinstall it. Thanks for your help

  • Reclassification of Viata W7 HP HP; Viata in Spanish 7 in English, incompatibility in the transfer of WindowsEasy. Incredible also, in its regional, my country Venezuela is not so I now have problems in the keyboard language and the motto puntuation.

    Reclassification of Viata W7 HP HP; Viata in Spanish 7 in English, incompatibility in the transfer of WindowsEasy. Incredible also, in its regional, my country Venezuela is not so I now have problems in the keyboard language and the motto puntuation.

    Thanks for your reply but I've solved the upgrade Viata HP to W7 HP Viata in Spanish. Took a lot of effort but is workig now. My major concern is on the regional setting: my country is Venezuela and this is probably the only country that is missing from the long long list so I now have problems in the keyboard language and the motto puntuation. This has nothing to do with the Home Premium edition or full, I think it's just an incredible mistake. How can this be repaired? MS will have remedies this problem and probably to publish an update to fix this problem. Thank you again and hope that this question goes to MS. looks.

  • Key keyboard X200s erupted when put back the keyboard

    I have was withdrawal keyboard on my X200s to clean it up a little, because it seemed that something had got stuck in one of the mouse buttons. When I put the keyboard back, I noticed the right ctrl key become loose, and I tried to reattach it. Then I noticed the small metal clips that holds the part of the key had folded, so I could return the key.

    A picture to show what I mean: http://i40.tinypic.com/21oq1j7.jpg

    Note the upper metal clips on the right key.

    Is - fixable? Try to bend the clips at the back is the obvious thing to try first, but I hesitate because they might break or I might damage something on the keyboard while trying to do so. Or should I buy a new keyboard or without right ctrl key?

    I encourage you to give Lenovo a call to replace the keyboard (if under warranty). They must be able to redeem 1 free 1.

  • How to prevent changing the keyboard language?

    When you use Windows 7, I have a problem where my keyboard language changes the United States to french Canada. This causes things like a '? ' to type rather like an 'E '. It seems to happen more often after the copy and paste. However, it is difficult to determine exactly when it happens, because only the punctuation seems to be different.

    What is the origin language switch? How can it be disabled or modified?
    Thank you

    Hi GrahamBleaney,

    The shortcut to switch languages is left Alt + SHIFT. It of easy to break down and can cause problems for multi users of the language. It is recommended that disable you this feature or replace it with a combination that is harder to come by chance using the available options.

    I would be grateful, if you could answer the following question.

    Do you use several languages? If you do not use the French Canadians, delete in the language mentioned below following information list.

    http://Windows.Microsoft.com/en-us/Windows7/add-or-change-an-input-language

    If you see some French Canadians, click it and click on Remove and then apply. Click on Ok.

            

    If you want to use more than one language, you can change the settings according to the following suggestions.

    Click Start > Control Panel > regional and Language Options > keyboards & languages > change keyboard > Advanced key settings > between input languages > change Key sequence.

    Change the settings accordingly.

    If you want to disable the option of language switch you can turn it off by choosing not under switch input language.

    You can also see the link below.

    http://support.Microsoft.com/kb/306560

    I hope this helps.

  • How can I change the length of note by default when you use the keyboard as input in piano roll?

    Note the length of the input to the midi keyboard

    Use the keyboard to input stage (Menu bar > window > entry step keyboard) choose the length of the notes you wish to enter the Piano Roll in conjunction with your Midi keyboard...

    Turn on the input Midi in the Piano Roll, if you do not have...

    Now you play notes on your midi keyboard notes will be length whatever you selected in the step of keyboard input interface...

    Note: If you do not find the keyboard under the window input stage... All the features of Logic work... so make sure you that you have enabled ALL the advanced tools in logic preferences and available for you.

  • How to disable the keyboard language?

    When you type, the mini keyboard iPad uses the language that was selected. Because I'm using three languages, and I mixed them sometimes, this feature makes it very awkward and embarrassing. I tried to turn this feature off in the settings, but it doesn't have a feature to disable. Does anyone know how to disable?

    Are you talking about disabling automatic/corrector spellchecking functionality?

  • SOA email notification when Chief rejects the task request.

    Hi all

    We have E-mail SOA trip when the manager approves / denies the request he received notifications ask an end user or a subordinate.

    We use composite Manager recipient OOTB SOA for it. We have configured Notifications in the ApprovalTask.task in the Jdeveloper. We have models of email as when manager approves the request, it will trigger a notification email (say notification1). When the Manager rejectes the demand it will trigger tell (tell notificaiton2) email notification. But in the ApprovalTask.task-> Notifications tab we only "Completed" as the task status. How we can configure model e-mail when Chief rejects the request.

    Please help me

    KK

    If she isn't here OOTB, you may need to add a task Notification by e-mail in the workflow of unzip and opening it with JDeveloper.  From there, you can capture a response in the payload of "REJECTED" and have an e-mail sent to the Manager of beneficiary, or that you want.

    -Kevin

  • How to change / chose the installation language

    I have install creative cloud dreamweaver and it's french, maybe because my computer is ' t in french but I prefert work in English how to change that

    You can choose the language of products by selecting the language of preference in Adobe Application Manager - drop the menu down located next to your name and choose 'Préférences', then select the desired language.  In your case, I would need to uninstall Dreamweaver before proceeding to install a different language.

    -Todd

Maybe you are looking for