~sil/ubuntu-keyboard/numbers-on-top-row

« back to all changes in this revision

Viewing changes to src/plugin/keyboardsettings.cpp

  • Committer: Tarmac
  • Author(s): Guenter Schwann
  • Date: 2013-11-08 08:01:33 UTC
  • mfrom: (96.1.9 keyboard-size-in-mir)
  • Revision ID: tarmac-20131108080133-j08xha13k1kw2evl
Set the keyboard geometry from QML to C++, not the other way around. Fixes: https://bugs.launchpad.net/bugs/1245481.

Approved by Thomas Moenicke, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 *
28
28
 */
29
29
 
30
 
#include "keyboadsettings.h"
 
30
#include "keyboardsettings.h"
31
31
 
32
32
#include <QDebug>
33
33
#include <QGSettings/QGSettings>
41
41
const QLatin1String KEY_PRESS_FEEDBACK_KEY = QLatin1String("keyPressFeedback");
42
42
 
43
43
/*!
44
 
 * \brief KeyboadSettings::KeyboadSettings class to load the settings, and
 
44
 * \brief KeyboardSettings::KeyboardSettings class to load the settings, and
45
45
 * listens on runtime to changes of them
46
46
 * \param parent
47
47
 */
48
 
KeyboadSettings::KeyboadSettings(QObject *parent) :
 
48
KeyboardSettings::KeyboardSettings(QObject *parent) :
49
49
    QObject(parent)
50
50
  , m_settings(new QGSettings("com.canonical.keyboard.maliit",
51
51
                              "/com/canonical/keyboard/maliit/", this))
55
55
}
56
56
 
57
57
/*!
58
 
 * \brief KeyboadSettings::enabledLanguages returns a list of languages that are
 
58
 * \brief KeyboardSettings::enabledLanguages returns a list of languages that are
59
59
 * active
60
60
 * \return
61
61
 */
62
 
QStringList KeyboadSettings::enabledLanguages() const
 
62
QStringList KeyboardSettings::enabledLanguages() const
63
63
{
64
64
    return m_settings->get(ENABLED_LANGUAGES_KEY).toStringList();
65
65
}
66
66
 
67
67
/*!
68
 
 * \brief KeyboadSettings::autoCapitalization returns true id the first letter
 
68
 * \brief KeyboardSettings::autoCapitalization returns true id the first letter
69
69
 * of each sentence should be capitalized
70
70
 * \return
71
71
 */
72
 
bool KeyboadSettings::autoCapitalization() const
 
72
bool KeyboardSettings::autoCapitalization() const
73
73
{
74
74
    return m_settings->get(AUTO_CAPITALIZATION_KEY).toBool();
75
75
}
76
76
 
77
77
/*!
78
 
 * \brief KeyboadSettings::autoCompletion returns true if the current word should
 
78
 * \brief KeyboardSettings::autoCompletion returns true if the current word should
79
79
 * be completed with first suggestion when hitting space
80
80
 * \return
81
81
 */
82
 
bool KeyboadSettings::autoCompletion() const
 
82
bool KeyboardSettings::autoCompletion() const
83
83
{
84
84
    return m_settings->get(AUTO_COMPLETION_KEY).toBool();
85
85
}
86
86
 
87
87
/*!
88
 
 * \brief KeyboadSettings::predictiveText returns true, if potential words in the
 
88
 * \brief KeyboardSettings::predictiveText returns true, if potential words in the
89
89
 * word ribbon should be suggested
90
90
 * \return
91
91
 */
92
 
bool KeyboadSettings::predictiveText() const
 
92
bool KeyboardSettings::predictiveText() const
93
93
{
94
94
    return m_settings->get(PREDICTIVE_TEXT_KEY).toBool();
95
95
}
96
96
 
97
97
/*!
98
 
 * \brief KeyboadSettings::keyPressFeedback returns true if feedback is enabled
 
98
 * \brief KeyboardSettings::keyPressFeedback returns true if feedback is enabled
99
99
 * when the user presses a keyboad key
100
100
 * \return
101
101
 */
102
 
bool KeyboadSettings::keyPressFeedback() const
 
102
bool KeyboardSettings::keyPressFeedback() const
103
103
{
104
104
    return m_settings->get(KEY_PRESS_FEEDBACK_KEY).toBool();
105
105
}
106
106
 
107
107
/*!
108
 
 * \brief KeyboadSettings::settingUpdated slot to handle changes in the settings backend
 
108
 * \brief KeyboardSettings::settingUpdated slot to handle changes in the settings backend
109
109
 * A specialized signal is emitted for the affected setting
110
110
 * \param key
111
111
 */
112
 
void KeyboadSettings::settingUpdated(const QString &key)
 
112
void KeyboardSettings::settingUpdated(const QString &key)
113
113
{
114
114
    if (key == ENABLED_LANGUAGES_KEY) {
115
115
        Q_EMIT enabledLanguagesChanged();