~thomas-moenicke/ubuntu-keyboard/ubuntu-keyboard-language-menu-2

« back to all changes in this revision

Viewing changes to src/plugin/inputmethod.cpp

  • Committer: Thomas Moenicke
  • Date: 2013-10-24 12:55:54 UTC
  • Revision ID: thomas.moenicke@canonical.com-20131024125554-kkjolk5a7vn0h527
fixed reading locale
reading locale at show() to detect changes in system

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
    d->registerWordEngineSetting();
109
109
    d->registerEnabledLanguages();
110
110
 
111
 
    setActiveSubView("en_us");
112
 
 
113
111
    // Setting layout orientation depends on word engine and hide word ribbon
114
112
    // settings to be initialized first:
115
113
    d->setLayoutOrientation(d->appsCurrentOrientation);
122
120
{
123
121
    Q_D(InputMethod);
124
122
 
 
123
    QString locale = QString(getenv("LANGUAGE"));
 
124
    locale.truncate(2);
 
125
 
 
126
    d->activeLanguage = locale;
 
127
    d->setActiveKeyboardId(locale);
 
128
 
125
129
    d->view->setVisible(true);
126
130
 
127
131
    inputMethodHost()->setScreenRegion(QRegion(d->keyboardVisibleRect));
191
195
                                   Maliit::HandlerState state)
192
196
{
193
197
    Q_UNUSED(state)
194
 
    Q_D(InputMethod);
195
 
 
196
 
    // store language id, so we can switch back to current active view
197
 
    // after showing special layouts as e.g. URL or Num layouts
198
 
    d->activeLayoutId = id;
199
 
    d->setActiveKeyboardId(id);
 
198
    Q_UNUSED(id);
200
199
}
201
200
 
202
201
QString InputMethod::activeSubView(Maliit::HandlerState state) const
434
433
    // TODO when refactoring, forward the enum to QML
435
434
 
436
435
    if (contentType == Maliit::FreeTextContentType)
437
 
        d->setActiveKeyboardId( d->activeLayoutId );
 
436
        d->setActiveKeyboardId( d->activeLanguage );
438
437
 
439
438
    if (contentType == Maliit::NumberContentType)
440
439
        d->setActiveKeyboardId( "number" );