src/hbinput/inputwidgets/hbinputsettingwidget.cpp
author hgs
Mon, 18 Oct 2010 18:23:13 +0300
changeset 34 ed14f46c0e55
parent 7 923ff622b8b9
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/****************************************************************************
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
**
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
** All rights reserved.
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
** Contact: Nokia Corporation (developer.feedback@nokia.com)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
**
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
** This file is part of the HbInput module of the UI Extensions for Mobile.
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
**
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
** GNU Lesser General Public License Usage
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
** This file may be used under the terms of the GNU Lesser General Public
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
** License version 2.1 as published by the Free Software Foundation and
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
** appearing in the file LICENSE.LGPL included in the packaging of this file.
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
** Please review the following information to ensure the GNU Lesser General
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
** Public License version 2.1 requirements will be met:
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
**
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
** In addition, as a special exception, Nokia gives you certain additional
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
** rights.  These rights are described in the Nokia Qt LGPL Exception
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
**
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
** If you have questions regarding the use of this file, please contact
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
** Nokia at developer.feedback@nokia.com.
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
**
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
****************************************************************************/
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
    25
#include "hbinputsettingwidget.h"
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#include <hbdataform.h>
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include <hbdataformmodel.h>
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include <hbinpututils.h>
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include <hbinputsettingproxy.h>
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include <hbinputpredictionfactory.h>
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    32
#include <QInputContextPlugin>
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    33
#include <QLibrary>
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    34
#include <QPluginLoader>
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    35
#include <QDir>
5
627c4a0fd0e7 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    36
#include <QtAlgorithms>
34
hgs
parents: 7
diff changeset
    37
#include <hbinputcontextplugin.h>
hgs
parents: 7
diff changeset
    38
#include <hbinputmodeproperties.h>
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include "hbinputcheckboxlist_p.h"
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    41
#include "hbinputsettingproxy_p.h"
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    42
#include <hbinputmethoddescriptor.h>
34
hgs
parents: 7
diff changeset
    43
#include <hbinputmethod.h>
hgs
parents: 7
diff changeset
    44
#include <hbmainwindow.h>
hgs
parents: 7
diff changeset
    45
hgs
parents: 7
diff changeset
    46
/*!
hgs
parents: 7
diff changeset
    47
@stable
hgs
parents: 7
diff changeset
    48
@hbinput
hgs
parents: 7
diff changeset
    49
\class HbInputSettingWidget
hgs
parents: 7
diff changeset
    50
\brief Displays settings for Hb inputs.
hgs
parents: 7
diff changeset
    51
hgs
parents: 7
diff changeset
    52
This is a input settings widget to be embedded in e.g. control panel view or input settings popup.
hgs
parents: 7
diff changeset
    53
*/
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
const QString statusOff = QObject::tr("Off");
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
const QString statusOn = QObject::tr("On");
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
const QString bestPrediction = QObject::tr("Best prediction");
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
const QString exactTyping = QObject::tr("Exact typing");
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    60
/// @cond
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    61
// input modes name for chinese
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    62
const QString KPinyinName("Pinyin");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    63
const QString KStrokeName("Stroke");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    64
const QString KZhuyinName("Zhuyin");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    65
const QString KCangjieNormalName("CangjieNormal");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    66
const QString KCangjieEasyName("CangjieEasy");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    67
const QString KCangjieAdvancedName("CangjieAdvanced");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    68
const QString KHwrName("Handwriting");
34
hgs
parents: 7
diff changeset
    69
const QString KHwrVerySlowName("Very Slow");
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    70
const QString KHwrSlowName("Slow");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    71
const QString KHwrNormalName("Normal");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    72
const QString KHwrFastName("Fast");
34
hgs
parents: 7
diff changeset
    73
const QString KHwrVeryFastName("Very Fast");
hgs
parents: 7
diff changeset
    74
hgs
parents: 7
diff changeset
    75
// strings used for default language
hgs
parents: 7
diff changeset
    76
const QString KDefaultChineseName("Chinese");
hgs
parents: 7
diff changeset
    77
const QString KDefaultEnglishName("English");
hgs
parents: 7
diff changeset
    78
hgs
parents: 7
diff changeset
    79
// hwr speed index are exactly saming as enum HbHwrWritingSpeed
hgs
parents: 7
diff changeset
    80
const int KHwrSpeedCount = 5;
5
627c4a0fd0e7 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    81
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    82
// strings used for represent cangjie
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    83
const QString KCangjieGeneralName("Cangjie");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    84
const QString KEasy("Easy");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    85
const QString KNormal("Normal");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    86
const QString KAdvanced("Advanced");
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    87
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    88
// input modes value for chinese
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    89
const int KChineseInputModeNone = -1;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    90
const int KPinyinMode = 0;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    91
const int KStrokeMode = 1;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    92
const int KZhuyinMode = 2;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    93
const int KCangjieNormalMode = 3;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    94
const int KCangjieEasyMode = 4;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    95
const int KCangjieAdvancedMode = 5;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    96
const int KHwrMode = 6;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
    97
34
hgs
parents: 7
diff changeset
    98
class HbCnInputModeMap
hgs
parents: 7
diff changeset
    99
{
hgs
parents: 7
diff changeset
   100
public:
hgs
parents: 7
diff changeset
   101
    int mMode;
hgs
parents: 7
diff changeset
   102
    QString mModeName;
hgs
parents: 7
diff changeset
   103
};
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   104
34
hgs
parents: 7
diff changeset
   105
const HbCnInputModeMap modesMap[] = {
hgs
parents: 7
diff changeset
   106
    {KPinyinMode, KPinyinName},
hgs
parents: 7
diff changeset
   107
    {KStrokeMode, KStrokeName},
hgs
parents: 7
diff changeset
   108
    {KZhuyinMode, KZhuyinName},
hgs
parents: 7
diff changeset
   109
    {KCangjieNormalMode, KCangjieNormalName},
hgs
parents: 7
diff changeset
   110
    {KCangjieEasyMode, KCangjieEasyName},
hgs
parents: 7
diff changeset
   111
    {KCangjieAdvancedMode, KCangjieAdvancedName},
hgs
parents: 7
diff changeset
   112
    {KHwrMode, KHwrName}
hgs
parents: 7
diff changeset
   113
};
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
class HbInputSettingWidgetPrivate
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    Q_DECLARE_PUBLIC(HbInputSettingWidget)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
public:
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    HbInputSettingWidgetPrivate(HbDataForm *dataForm);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
    void initialize();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    void createSettingItems();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
    void fillLanguageList(QStringList &list, QList<HbInputLanguage> &languageList, const QString &replace = QString(" "));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    int languageToIndex(const HbInputLanguage &language, const QList<HbInputLanguage> &languageList);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
    HbInputLanguage indexToLanguage(int index, const QList<HbInputLanguage> &languageList);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
    void createSecondaryLanguageList();
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   128
    void updateContentWidgetData();
34
hgs
parents: 7
diff changeset
   129
    // following API used by chinese
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   130
    int inputModeToIndex(const int &inputMode, const QList<int> &inputModeList);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   131
    int indexToInputmode(int index, const QList<int> &inputModeList);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   132
    void createChineseSettingGroup(HbDataFormModel *model);
34
hgs
parents: 7
diff changeset
   133
    void createValidModesList(QStringList &imModeNames, QList<int> &imModeList);
hgs
parents: 7
diff changeset
   134
    QString inputModeName(int mode) const;
hgs
parents: 7
diff changeset
   135
    int inputModeByGivenName(const QString& imName) const;
hgs
parents: 7
diff changeset
   136
    int defaultModeByGivenLang(const HbInputLanguage &lang) const;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   137
34
hgs
parents: 7
diff changeset
   138
public:  
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
    HbDataForm *mForm;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
    HbDataFormModelItem *mPrimaryLanguageItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
    HbDataFormModelItem *mSecondaryLanguageItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
    HbDataFormModelItem *mKeypressTimeoutItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    HbDataFormModelItem *mCharacterPreviewItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
    HbDataFormModelItem *mPredictionItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    HbDataFormModelItem *mAutoCompletionItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
    HbDataFormModelItem *mCorrectionLevelItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    HbDataFormModelItem *mPrimaryCandidateItem;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
    HbInputLanguage mPrimaryInputLanguage;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
    HbInputLanguage mSecondaryInputLanguage;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
    QList<HbInputLanguage> mPrimaryLanguages;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
    QList<HbInputLanguage> mSecondaryLanguages;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
    bool mPredictionStatusForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    bool mPredictionStatusForQwerty;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    bool mCharacterPreviewEnabled;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
    int mKeypressTimeout;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    bool mAutocompletionForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
    bool mAutocompletionForQwerty;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
    HbTypingCorrectionLevel mTypingCorrectionLevel;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    HbPrimaryCandidateMode mPrimaryCandidateMode;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
    HbInputSettingWidget *q_ptr;
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   161
    HbDataFormModel *mModel;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   162
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   163
    // member variables for chinese
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   164
    HbDataFormModelItem *mLanguageGroup;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   165
    HbDataFormModelItem *mChineseInputGroup;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   166
    HbDataFormModelItem *mPortraitInputMethodItem;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   167
    HbDataFormModelItem *mLandscapeInputMethodItem;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   168
    HbDataFormModelItem *mHwrSpeedItem;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   169
    HbDataFormModelItem *mCangjieItem;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   170
    int mCnPortraitInputMode;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   171
    int mCnLandscapeInputMode;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   172
    int mCnCangjieInputMode;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   173
34
hgs
parents: 7
diff changeset
   174
    HbHwrWritingSpeed  mHwrSpeed;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   175
    QList<int> mCnPortraitInputModeList;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   176
    QList<int> mCnLandscapeInputModeList;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   177
    QList<int> mCangjieInputModeList;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   178
    QStringList mCnPortraitInputModeNames;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   179
    QStringList mCnLandscapeInputModeNames;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   180
    QStringList mCnCangjieInputModeNames;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   181
    QStringList mHwrSpeedNames;
34
hgs
parents: 7
diff changeset
   182
    QStringList mCnDefaultLanguageNames;
hgs
parents: 7
diff changeset
   183
    HbDataFormModelItem *mCnDefaultLanguageItem;
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
};
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
Constructs setting widget
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
HbInputSettingWidgetPrivate::HbInputSettingWidgetPrivate(HbDataForm *dataForm)
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   190
    : mForm(dataForm),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   191
      mPrimaryLanguageItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   192
      mSecondaryLanguageItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   193
      mKeypressTimeoutItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   194
      mCharacterPreviewItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   195
      mPredictionItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   196
      mAutoCompletionItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   197
      mCorrectionLevelItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   198
      mPrimaryCandidateItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   199
      q_ptr(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   200
      mModel(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   201
      mLanguageGroup(0),
34
hgs
parents: 7
diff changeset
   202
      mChineseInputGroup(0),      
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   203
      mPortraitInputMethodItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   204
      mLandscapeInputMethodItem(0),
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   205
      mHwrSpeedItem(0),
34
hgs
parents: 7
diff changeset
   206
      mCangjieItem(0),      
hgs
parents: 7
diff changeset
   207
      mCnCangjieInputMode(KCangjieNormalMode),
hgs
parents: 7
diff changeset
   208
      mCnDefaultLanguageItem(0)
hgs
parents: 7
diff changeset
   209
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
Initializes setting widget
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
void HbInputSettingWidgetPrivate::initialize()
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
    HbInputSettingProxy *settings = HbInputSettingProxy::instance();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
    mPrimaryInputLanguage = settings->globalInputLanguage();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
    mSecondaryInputLanguage = settings->globalSecondaryInputLanguage();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
    mPredictionStatusForITUT = settings->predictiveInputStatus(HbKeyboardSetting12key);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    mPredictionStatusForQwerty = settings->predictiveInputStatus(HbKeyboardSettingQwerty);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
    mCharacterPreviewEnabled = settings->isCharacterPreviewForQwertyEnabled();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
    mKeypressTimeout = settings->keypressTimeout();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
    mAutocompletionForITUT = settings->isAutocompletionEnabled(HbKeyboardSetting12key);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
    mAutocompletionForQwerty = settings->isAutocompletionEnabled(HbKeyboardSettingQwerty);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
    mPrimaryCandidateMode = settings->primaryCandidateMode();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
    mTypingCorrectionLevel = settings->typingCorrectionLevel();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
    HbInputUtils::listSupportedInputLanguages(mPrimaryLanguages);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
    createSecondaryLanguageList();
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   232
    // if the model is already constructed we do not need to recreate the setting items
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   233
    if (!mModel) {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   234
        createSettingItems();
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   235
    } else {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   236
        // simply update the settings dependant content widget data of all the items
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   237
        updateContentWidgetData();
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   238
        //make sure that the items are not expanded
34
hgs
parents: 7
diff changeset
   239
        QModelIndex index = mModel->indexFromItem(mSecondaryLanguageItem ? mSecondaryLanguageItem->parent(): mPrimaryLanguageItem->parent());
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   240
        mForm->setExpanded(index, false);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   241
        index = mModel->indexFromItem(mKeypressTimeoutItem->parent());
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   242
        mForm->setExpanded(index, false);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   243
        index = mModel->indexFromItem(mPredictionItem->parent());
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   244
        mForm->setExpanded(index, false);        
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   245
    }
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   246
}
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
34
hgs
parents: 7
diff changeset
   248
void HbInputSettingWidgetPrivate::createValidModesList(QStringList &imModeNames, QList<int> &imModeList)
hgs
parents: 7
diff changeset
   249
{    
hgs
parents: 7
diff changeset
   250
    Qt::Orientation orientation = Qt::Horizontal;
hgs
parents: 7
diff changeset
   251
    if (mForm) {
hgs
parents: 7
diff changeset
   252
       orientation = mForm->mainWindow()->orientation();
hgs
parents: 7
diff changeset
   253
    }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   254
34
hgs
parents: 7
diff changeset
   255
    QList<HbInputMethodDescriptor> methodList = HbInputMethod::listCustomInputMethods(orientation,
hgs
parents: 7
diff changeset
   256
        HbInputSettingProxy::instance()->globalInputLanguage());
hgs
parents: 7
diff changeset
   257
    methodList.insert(0, HbInputMethod::defaultInputMethod(orientation));
hgs
parents: 7
diff changeset
   258
hgs
parents: 7
diff changeset
   259
    foreach(const HbInputMethodDescriptor &des, methodList) {
hgs
parents: 7
diff changeset
   260
        QStringList displayNames = des.displayNames();
hgs
parents: 7
diff changeset
   261
        if (!displayNames.isEmpty()) {
hgs
parents: 7
diff changeset
   262
            imModeNames += displayNames;
hgs
parents: 7
diff changeset
   263
        } else {
hgs
parents: 7
diff changeset
   264
            QString displayName = des.displayName();
hgs
parents: 7
diff changeset
   265
            imModeNames.append(displayName);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   266
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   267
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   268
34
hgs
parents: 7
diff changeset
   269
    imModeNames.removeDuplicates();
hgs
parents: 7
diff changeset
   270
    // filter out the input mode that not valid to current screen orientation
hgs
parents: 7
diff changeset
   271
    if (imModeNames.contains(KCangjieGeneralName)) {
hgs
parents: 7
diff changeset
   272
        imModeNames.removeOne(KCangjieGeneralName);
hgs
parents: 7
diff changeset
   273
    }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   274
34
hgs
parents: 7
diff changeset
   275
    for (int i = 0; i < imModeNames.count(); ++i) {
hgs
parents: 7
diff changeset
   276
        imModeList.append(inputModeByGivenName(imModeNames.at(i)));
hgs
parents: 7
diff changeset
   277
    }
hgs
parents: 7
diff changeset
   278
}
hgs
parents: 7
diff changeset
   279
hgs
parents: 7
diff changeset
   280
QString HbInputSettingWidgetPrivate::inputModeName(int mode) const
hgs
parents: 7
diff changeset
   281
{
hgs
parents: 7
diff changeset
   282
    int cnImCnts = sizeof(modesMap) / sizeof(modesMap[0]);
hgs
parents: 7
diff changeset
   283
    if (mode >= 0 && mode < cnImCnts) {
hgs
parents: 7
diff changeset
   284
        return modesMap[mode].mModeName;
hgs
parents: 7
diff changeset
   285
    }
hgs
parents: 7
diff changeset
   286
hgs
parents: 7
diff changeset
   287
    return QString();
hgs
parents: 7
diff changeset
   288
}
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   289
34
hgs
parents: 7
diff changeset
   290
int HbInputSettingWidgetPrivate::inputModeByGivenName(const QString& imName) const
hgs
parents: 7
diff changeset
   291
{
hgs
parents: 7
diff changeset
   292
    int cnMode = KChineseInputModeNone;
hgs
parents: 7
diff changeset
   293
hgs
parents: 7
diff changeset
   294
    if (imName == KCangjieGeneralName) {
hgs
parents: 7
diff changeset
   295
        HbCangjieDetailMode cjDetail = HbInputSettingProxy::instance()->detailedCangjieMode();
hgs
parents: 7
diff changeset
   296
        switch (cjDetail) {
hgs
parents: 7
diff changeset
   297
        case HbCangjieEasy: {
hgs
parents: 7
diff changeset
   298
            cnMode = KCangjieEasyMode;
hgs
parents: 7
diff changeset
   299
        }
hgs
parents: 7
diff changeset
   300
            break;
hgs
parents: 7
diff changeset
   301
        case HbCangjieAdvanced: {
hgs
parents: 7
diff changeset
   302
            cnMode = KCangjieAdvancedMode;
hgs
parents: 7
diff changeset
   303
        }
hgs
parents: 7
diff changeset
   304
            break;
hgs
parents: 7
diff changeset
   305
        case HbCangjieNormal: 
hgs
parents: 7
diff changeset
   306
        default: {
hgs
parents: 7
diff changeset
   307
            cnMode = KCangjieNormalMode;
hgs
parents: 7
diff changeset
   308
        }
hgs
parents: 7
diff changeset
   309
            break;
hgs
parents: 7
diff changeset
   310
        }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   311
    } else {
34
hgs
parents: 7
diff changeset
   312
        int cnImCnts = sizeof(modesMap) / sizeof(modesMap[0]);
hgs
parents: 7
diff changeset
   313
        for (int i = 0; i < cnImCnts; ++i) {
hgs
parents: 7
diff changeset
   314
            if (modesMap[i].mModeName == imName) {
hgs
parents: 7
diff changeset
   315
                cnMode = modesMap[i].mMode;
hgs
parents: 7
diff changeset
   316
            }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   317
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   318
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   319
34
hgs
parents: 7
diff changeset
   320
    if (KChineseInputModeNone == cnMode) {
hgs
parents: 7
diff changeset
   321
        HbInputLanguage lang = HbInputSettingProxy::instance()->globalInputLanguage();
hgs
parents: 7
diff changeset
   322
        cnMode = defaultModeByGivenLang(lang);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   323
    }
34
hgs
parents: 7
diff changeset
   324
    
hgs
parents: 7
diff changeset
   325
    return cnMode;
hgs
parents: 7
diff changeset
   326
}
hgs
parents: 7
diff changeset
   327
hgs
parents: 7
diff changeset
   328
int HbInputSettingWidgetPrivate::defaultModeByGivenLang(const HbInputLanguage &lang) const
hgs
parents: 7
diff changeset
   329
{
hgs
parents: 7
diff changeset
   330
    int imMode = KChineseInputModeNone;
hgs
parents: 7
diff changeset
   331
    if (lang.variant() == QLocale::China) {
hgs
parents: 7
diff changeset
   332
        imMode = KPinyinMode;
hgs
parents: 7
diff changeset
   333
    } else if (lang.variant() == QLocale::HongKong) {
hgs
parents: 7
diff changeset
   334
        imMode = KStrokeMode;
hgs
parents: 7
diff changeset
   335
    } else if (lang.variant() == QLocale::Taiwan) {
hgs
parents: 7
diff changeset
   336
        imMode = KZhuyinMode;
hgs
parents: 7
diff changeset
   337
    }
hgs
parents: 7
diff changeset
   338
hgs
parents: 7
diff changeset
   339
    return imMode;
hgs
parents: 7
diff changeset
   340
}
hgs
parents: 7
diff changeset
   341
hgs
parents: 7
diff changeset
   342
void HbInputSettingWidgetPrivate::createChineseSettingGroup(HbDataFormModel *model)
hgs
parents: 7
diff changeset
   343
{
hgs
parents: 7
diff changeset
   344
    Q_Q(HbInputSettingWidget);
hgs
parents: 7
diff changeset
   345
    QByteArray ba = HbInputSettingProxy::instance()->preferredInputMethodCustomData(Qt::Vertical);
hgs
parents: 7
diff changeset
   346
    QString imName(ba);
hgs
parents: 7
diff changeset
   347
    HbInputLanguage lang = HbInputSettingProxy::instance()->globalInputLanguage();
hgs
parents: 7
diff changeset
   348
    mCnPortraitInputMode = inputModeByGivenName(imName);
hgs
parents: 7
diff changeset
   349
hgs
parents: 7
diff changeset
   350
    ba = HbInputSettingProxy::instance()->preferredInputMethodCustomData(Qt::Horizontal);
hgs
parents: 7
diff changeset
   351
    imName = QString(ba);
hgs
parents: 7
diff changeset
   352
    mCnLandscapeInputMode = inputModeByGivenName(imName);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   353
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   354
    mHwrSpeedNames.clear();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   355
    mCnPortraitInputModeList.clear();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   356
    mCnLandscapeInputModeList.clear();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   357
    mCnPortraitInputModeNames.clear();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   358
    mCnLandscapeInputModeNames.clear();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   359
    mCnCangjieInputModeNames.clear();
34
hgs
parents: 7
diff changeset
   360
    mCnDefaultLanguageNames.clear();
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   361
34
hgs
parents: 7
diff changeset
   362
    createValidModesList(mCnPortraitInputModeNames, mCnPortraitInputModeList);
hgs
parents: 7
diff changeset
   363
    mCnLandscapeInputModeNames = mCnPortraitInputModeNames;
hgs
parents: 7
diff changeset
   364
    mCnLandscapeInputModeList = mCnPortraitInputModeList;
hgs
parents: 7
diff changeset
   365
hgs
parents: 7
diff changeset
   366
    // append cangjie to landscape related list if need
hgs
parents: 7
diff changeset
   367
    if (mPrimaryInputLanguage == HbInputLanguage(QLocale::Chinese, QLocale::HongKong) && 
hgs
parents: 7
diff changeset
   368
        !mCnLandscapeInputModeNames.contains(KCangjieGeneralName)) {
hgs
parents: 7
diff changeset
   369
hgs
parents: 7
diff changeset
   370
        int index = HbInputSettingProxy::instance()->detailedCangjieMode();
hgs
parents: 7
diff changeset
   371
        switch(index) {
hgs
parents: 7
diff changeset
   372
        case 0:
hgs
parents: 7
diff changeset
   373
            mCnCangjieInputMode = KCangjieEasyMode;
hgs
parents: 7
diff changeset
   374
            break;
hgs
parents: 7
diff changeset
   375
        case 1: 
hgs
parents: 7
diff changeset
   376
            mCnCangjieInputMode = KCangjieNormalMode;
hgs
parents: 7
diff changeset
   377
            break;
hgs
parents: 7
diff changeset
   378
        case 2:
hgs
parents: 7
diff changeset
   379
            mCnCangjieInputMode = KCangjieAdvancedMode;
hgs
parents: 7
diff changeset
   380
            break;
hgs
parents: 7
diff changeset
   381
        default:
hgs
parents: 7
diff changeset
   382
            break;
hgs
parents: 7
diff changeset
   383
        }
hgs
parents: 7
diff changeset
   384
hgs
parents: 7
diff changeset
   385
        QStringList tmpInputmodeNames;
hgs
parents: 7
diff changeset
   386
        QList<int> tmpInputmode;
hgs
parents: 7
diff changeset
   387
        tmpInputmodeNames << mCnLandscapeInputModeNames.at(0) << KCangjieGeneralName << mCnLandscapeInputModeNames.at(1);
hgs
parents: 7
diff changeset
   388
        tmpInputmode << mCnLandscapeInputModeList.at(0) << mCnCangjieInputMode << mCnLandscapeInputModeList.at(1);
hgs
parents: 7
diff changeset
   389
        mCnLandscapeInputModeList.clear();
hgs
parents: 7
diff changeset
   390
        mCnLandscapeInputModeNames.clear();
hgs
parents: 7
diff changeset
   391
        mCnLandscapeInputModeList = tmpInputmode;
hgs
parents: 7
diff changeset
   392
        mCnLandscapeInputModeNames = tmpInputmodeNames;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   393
        mCangjieInputModeList << KCangjieEasyMode << KCangjieNormalMode << KCangjieAdvancedMode;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   394
        mCnCangjieInputModeNames << KEasy << KNormal << KAdvanced;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   395
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   396
34
hgs
parents: 7
diff changeset
   397
    mHwrSpeed = HbInputSettingProxy::instance()->hwrWritingSpeed();
hgs
parents: 7
diff changeset
   398
    mHwrSpeedNames << KHwrVerySlowName << KHwrSlowName << KHwrNormalName << KHwrFastName << KHwrVeryFastName;
hgs
parents: 7
diff changeset
   399
    mCnDefaultLanguageNames << KDefaultChineseName << KDefaultEnglishName;
hgs
parents: 7
diff changeset
   400
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   401
    if (!mChineseInputGroup) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   402
        mChineseInputGroup = model->appendDataFormGroup(QObject::tr("Chinese Input"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   403
        mPortraitInputMethodItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Portrait mode input method"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   404
        mChineseInputGroup->appendChild(mPortraitInputMethodItem);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   405
        mPortraitInputMethodItem->setContentWidgetData(QString("items"), mCnPortraitInputModeNames);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   406
        int imIdx = inputModeToIndex(mCnPortraitInputMode, mCnPortraitInputModeList);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   407
        QVariant varPor;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   408
        varPor.setValue(imIdx);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   409
        mPortraitInputMethodItem->setContentWidgetData(QString("currentIndex"), varPor);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   410
        mPortraitInputMethodItem->setContentWidgetData(QString("objectName"), QString("portrait_input_method"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   411
        mForm->addConnection(mPortraitInputMethodItem, SIGNAL(currentIndexChanged(int)), q, SLOT(setPortraitInputMethod(int)));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   412
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   413
        mLandscapeInputMethodItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Landscape mode input method"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   414
        mChineseInputGroup->appendChild(mLandscapeInputMethodItem);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   415
        mLandscapeInputMethodItem->setContentWidgetData(QString("items"), mCnLandscapeInputModeNames);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   416
        int imIdx_lan = inputModeToIndex(mCnLandscapeInputMode, mCnLandscapeInputModeList);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   417
        QVariant varLan;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   418
        varLan.setValue(imIdx_lan);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   419
        mLandscapeInputMethodItem->setContentWidgetData(QString("currentIndex"), varLan);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   420
        mLandscapeInputMethodItem->setContentWidgetData(QString("objectName"), QString("landscape_input_method"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   421
        mForm->addConnection(mLandscapeInputMethodItem, SIGNAL(currentIndexChanged(int)), q, SLOT(setLandscapeInputMethod(int)));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   422
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   423
        mHwrSpeedItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Handwriting speed"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   424
        mChineseInputGroup->appendChild(mHwrSpeedItem);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   425
        mHwrSpeedItem->setContentWidgetData(QString("items"), mHwrSpeedNames);
34
hgs
parents: 7
diff changeset
   426
        mHwrSpeedItem->setContentWidgetData(QString("currentIndex"), mHwrSpeed);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   427
        mHwrSpeedItem->setContentWidgetData(QString("objectName"), QString("handwriting_speed"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   428
        mForm->addConnection(mHwrSpeedItem, SIGNAL(currentIndexChanged(int)), q, SLOT(setHwrSpeed(int)));
34
hgs
parents: 7
diff changeset
   429
hgs
parents: 7
diff changeset
   430
        mCnDefaultLanguageItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Default language for keyboard input"));
hgs
parents: 7
diff changeset
   431
        mChineseInputGroup->appendChild(mCnDefaultLanguageItem);
hgs
parents: 7
diff changeset
   432
        int defaultLanguageIndex = HbInputSettingProxy::instance()->useWesternDefaultKeypadForChinese() ? 1 : 0;
hgs
parents: 7
diff changeset
   433
        mCnDefaultLanguageItem->setContentWidgetData(QString("items"), mCnDefaultLanguageNames);
hgs
parents: 7
diff changeset
   434
        mCnDefaultLanguageItem->setContentWidgetData(QString("currentIndex"), defaultLanguageIndex);
hgs
parents: 7
diff changeset
   435
        mCnDefaultLanguageItem->setContentWidgetData(QString("objectName"), QString("default_language_for_keyboard_input"));
hgs
parents: 7
diff changeset
   436
        mForm->addConnection(mCnDefaultLanguageItem, SIGNAL(currentIndexChanged(int)), q, SLOT(setDefaultLanguageForKeyboardInput(int)));
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   437
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   438
34
hgs
parents: 7
diff changeset
   439
    int cangjieIdx = HbInputSettingProxy::instance()->detailedCangjieMode();
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   440
    if (mPrimaryInputLanguage == HbInputLanguage(QLocale::Chinese, QLocale::HongKong)) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   441
        mCangjieItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Cangjie mode"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   442
        mChineseInputGroup->appendChild(mCangjieItem);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   443
        mCangjieItem->setContentWidgetData(QString("items"), mCnCangjieInputModeNames);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   444
        QVariant varCang;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   445
        varCang.setValue(cangjieIdx);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   446
        mCangjieItem->setContentWidgetData(QString("currentIndex"), varCang);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   447
        mCangjieItem->setContentWidgetData(QString("objectName"), QString("cangjie_mode"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   448
        mForm->addConnection(mCangjieItem, SIGNAL(currentIndexChanged(int)), q, SLOT(setCangjieMode(int)));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   449
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   450
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   451
34
hgs
parents: 7
diff changeset
   452
void HbInputSettingWidgetPrivate::updateContentWidgetData() 
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   453
{
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   454
    // current primary language
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   455
    mPrimaryLanguageItem->setContentWidgetData(QString("currentIndex"), languageToIndex(mPrimaryInputLanguage, mPrimaryLanguages));
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   456
34
hgs
parents: 7
diff changeset
   457
    if (mSecondaryLanguageItem) {
hgs
parents: 7
diff changeset
   458
        mSecondaryLanguageItem->setContentWidgetData(QString("currentIndex"), languageToIndex(mSecondaryInputLanguage, mSecondaryLanguages));
hgs
parents: 7
diff changeset
   459
    }
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   460
    // key press timeout
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   461
    mKeypressTimeoutItem->setContentWidgetData(QString("sliderPosition"), mKeypressTimeout);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   462
    if (mCharacterPreviewEnabled) {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   463
        mCharacterPreviewItem->setContentWidgetData(QString("text"), statusOn);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   464
        mCharacterPreviewItem->setContentWidgetData(QString("additionalText"), statusOff);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   465
    } else {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   466
        mCharacterPreviewItem->setContentWidgetData(QString("text"), statusOff);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   467
        mCharacterPreviewItem->setContentWidgetData(QString("additionalText"), statusOn);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   468
    }
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   469
    QList<QVariant> predictionEnabled;
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   470
    predictionEnabled << mPredictionStatusForQwerty << mPredictionStatusForITUT;
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   471
    mPredictionItem->setContentWidgetData(QString("selectedItems"), predictionEnabled);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   472
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   473
    QList<QVariant> autocompletionEnabled;
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   474
    autocompletionEnabled << mAutocompletionForQwerty << mAutocompletionForITUT;
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   475
    mAutoCompletionItem->setContentWidgetData(QString("selectedItems"), autocompletionEnabled);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   476
    
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   477
    mCorrectionLevelItem->setContentWidgetData(QString("selected"), mTypingCorrectionLevel);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   478
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   479
    if (mPrimaryCandidateMode == HbPrimaryCandidateModeBestPrediction) {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   480
        mPrimaryCandidateItem->setContentWidgetData(QString("text"), bestPrediction);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   481
        mPrimaryCandidateItem->setContentWidgetData(QString("additionalText"), exactTyping);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   482
    } else {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   483
        mPrimaryCandidateItem->setContentWidgetData(QString("text"), exactTyping);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   484
        mPrimaryCandidateItem->setContentWidgetData(QString("additionalText"), bestPrediction);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   485
    }
34
hgs
parents: 7
diff changeset
   486
hgs
parents: 7
diff changeset
   487
    if(mChineseInputGroup && mCnDefaultLanguageItem) {
hgs
parents: 7
diff changeset
   488
        int defaultLanguageIndex = HbInputSettingProxy::instance()->useWesternDefaultKeypadForChinese() ? 1 : 0;
hgs
parents: 7
diff changeset
   489
        mCnDefaultLanguageItem->setContentWidgetData(QString("currentIndex"), defaultLanguageIndex);
hgs
parents: 7
diff changeset
   490
    }
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
Creates setting items to this widget
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
void HbInputSettingWidgetPrivate::createSettingItems()
34
hgs
parents: 7
diff changeset
   497
{   
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
    Q_Q(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   500
    mModel = new HbDataFormModel();
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
    HbInputCheckBoxList *customPrototype = new HbInputCheckBoxList(mForm);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   503
    QList<HbAbstractViewItem *> prototypes = mForm->itemPrototypes();
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
    prototypes.append(customPrototype);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
    mForm->setItemPrototypes(prototypes);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   507
    mLanguageGroup = mModel->appendDataFormGroup(QObject::tr("Language"));
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
    mPrimaryLanguageItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Primary Writing language"));
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   510
    mLanguageGroup->appendChild(mPrimaryLanguageItem);
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
    QStringList writingLanguageItems;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   512
    fillLanguageList(writingLanguageItems, mPrimaryLanguages);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   513
    mPrimaryLanguageItem->setContentWidgetData(QString("items"), writingLanguageItems);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   514
    mPrimaryLanguageItem->setContentWidgetData(QString("currentIndex"), languageToIndex(mPrimaryInputLanguage, mPrimaryLanguages));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   515
    mPrimaryLanguageItem->setContentWidgetData(QString("objectName"), QString("primary_writing_language"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   516
    mForm->addConnection(mPrimaryLanguageItem, SIGNAL(currentIndexChanged(int)), q, SLOT(setPrimaryLanguage(int)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   518
    if (mPrimaryInputLanguage.language() != QLocale::Chinese) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   519
        mSecondaryLanguageItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Secondary Writing language"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   520
        mLanguageGroup->appendChild(mSecondaryLanguageItem);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   521
        QStringList secondaryLanguageItems;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   522
        fillLanguageList(secondaryLanguageItems, mSecondaryLanguages, QObject::tr("None"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   523
        mSecondaryLanguageItem->setContentWidgetData(QString("items"), secondaryLanguageItems);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   524
        mSecondaryLanguageItem->setContentWidgetData(QString("currentIndex"), languageToIndex(mSecondaryInputLanguage, mSecondaryLanguages));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   525
        mSecondaryLanguageItem->setContentWidgetData(QString("objectName"), QString("secondary_writing_language"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   526
        mForm->addConnection(mSecondaryLanguageItem, SIGNAL(currentIndexChanged(int)), q, SLOT(setSecondaryLanguage(int)));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   527
    }
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   528
    HbDataFormModelItem *keyboardGroup = mModel->appendDataFormGroup(QObject::tr("Keyboard"));
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
    mKeypressTimeoutItem = new HbDataFormModelItem(HbDataFormModelItem::SliderItem, QObject::tr("Keypress Timeout"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
    keyboardGroup->appendChild(mKeypressTimeoutItem);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   532
    mKeypressTimeoutItem->setContentWidgetData(QString("minimum"), HbInputMinKeypressTimeout);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
    mKeypressTimeoutItem->setContentWidgetData(QString("maximum"), HbInputMaxKeypressTimeout);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
    mKeypressTimeoutItem->setContentWidgetData(QString("sliderPosition"), mKeypressTimeout);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
    mKeypressTimeoutItem->setContentWidgetData(QString("objectName"), QString("keypress_timeout"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
    mForm->addConnection(mKeypressTimeoutItem, SIGNAL(valueChanged(int)), q, SLOT(setKeypressTimeoutValue(int)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   537
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
    mCharacterPreviewItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem, QObject::tr("Character bubble"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
    keyboardGroup->appendChild(mCharacterPreviewItem);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
    if (mCharacterPreviewEnabled) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
        mCharacterPreviewItem->setContentWidgetData(QString("text"), statusOn);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   542
        mCharacterPreviewItem->setContentWidgetData(QString("additionalText"), statusOff);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   543
    } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   544
        mCharacterPreviewItem->setContentWidgetData(QString("text"), statusOff);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   545
        mCharacterPreviewItem->setContentWidgetData(QString("additionalText"), statusOn);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   546
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
    mCharacterPreviewItem->setContentWidgetData(QString("objectName"), QString("character_bubble"));
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   548
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   549
    HbDataFormModelItem *textInputGroup = mModel->appendDataFormGroup(QObject::tr("Intelligent Text Input"));
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
    HbDataFormModelItem::DataItemType checkboxList =
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
        static_cast<HbDataFormModelItem::DataItemType>(HbDataFormModelItem::CustomItemBase);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   554
    mPredictionItem = new HbDataFormModelItem(checkboxList, QObject::tr("Prediction"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
    textInputGroup->appendChild(mPredictionItem);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   556
    QStringList predictionValues;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   557
    predictionValues << QObject::tr("Qwerty") << QObject::tr("Virtual ITU-T");
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
    mPredictionItem->setContentWidgetData(QString("items"), predictionValues);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
    QList<QVariant> predictionEnabled;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
    predictionEnabled << mPredictionStatusForQwerty << mPredictionStatusForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
    mPredictionItem->setContentWidgetData(QString("selectedItems"), predictionEnabled);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
    mPredictionItem->setContentWidgetData(QString("objectName"), QString("prediction"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
    mForm->addConnection(mPredictionItem, SIGNAL(activated(const QModelIndex &)), q, SLOT(setPredictionState(const QModelIndex &)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
    mAutoCompletionItem = new HbDataFormModelItem(checkboxList, QObject::tr("Autocompletion"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
    textInputGroup->appendChild(mAutoCompletionItem);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   567
    QStringList autoCompletionValues;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   568
    autoCompletionValues << QObject::tr("Qwerty") << QObject::tr("Virtual ITU-T");
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   569
    mAutoCompletionItem->setContentWidgetData(QString("items"), autoCompletionValues);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
    QList<QVariant> autocompletionEnabled;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   571
    autocompletionEnabled << mAutocompletionForQwerty << mAutocompletionForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   572
    mAutoCompletionItem->setContentWidgetData(QString("selectedItems"), autocompletionEnabled);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   573
    mAutoCompletionItem->setContentWidgetData(QString("objectName"), QString("autocompletion"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   574
    mForm->addConnection(mAutoCompletionItem, SIGNAL(activated(const QModelIndex &)), q, SLOT(setAutocompletionState(const QModelIndex &)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   575
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   576
    mCorrectionLevelItem = new HbDataFormModelItem(HbDataFormModelItem::RadioButtonListItem, QObject::tr("Typing Correction"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
    textInputGroup->appendChild(mCorrectionLevelItem);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
    QStringList correctionLevels;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   579
    correctionLevels << QObject::tr("Off") << QObject::tr("Medium") << QObject::tr("High");
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   580
    mCorrectionLevelItem->setContentWidgetData(QString("items"), correctionLevels);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
    mCorrectionLevelItem->setContentWidgetData(QString("selected"), mTypingCorrectionLevel);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
    mCorrectionLevelItem->setContentWidgetData(QString("objectName"), QString("typing_correction"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
    mForm->addConnection(mCorrectionLevelItem, SIGNAL(itemSelected(int)), q, SLOT(setCorrectionLevel(int)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
    mPrimaryCandidateItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem, QObject::tr("Primary Candidate"));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   586
    textInputGroup->appendChild(mPrimaryCandidateItem);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
    if (mPrimaryCandidateMode == HbPrimaryCandidateModeBestPrediction) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   588
        mPrimaryCandidateItem->setContentWidgetData(QString("text"), bestPrediction);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
        mPrimaryCandidateItem->setContentWidgetData(QString("additionalText"), exactTyping);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
    } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
        mPrimaryCandidateItem->setContentWidgetData(QString("text"), exactTyping);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   592
        mPrimaryCandidateItem->setContentWidgetData(QString("additionalText"), bestPrediction);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
    mPrimaryCandidateItem->setContentWidgetData(QString("objectName"), QString("primary_candidate"));
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   595
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   596
    if (mPrimaryInputLanguage.language() == QLocale::Chinese) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   597
        createChineseSettingGroup(mModel);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   598
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   599
    mForm->setModel(mModel);
34
hgs
parents: 7
diff changeset
   600
hgs
parents: 7
diff changeset
   601
    // expand language selection
hgs
parents: 7
diff changeset
   602
    QModelIndex index = mModel->indexFromItem(mLanguageGroup);
hgs
parents: 7
diff changeset
   603
    mForm->setExpanded(index, true);
hgs
parents: 7
diff changeset
   604
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
   605
    QObject::connect(mModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), q, SLOT(dataChange(QModelIndex, QModelIndex)));
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   607
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   608
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
Fills given list with language names in the language list
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
void HbInputSettingWidgetPrivate::fillLanguageList(QStringList &list, QList<HbInputLanguage> &languageList, const QString &replace)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
{
5
627c4a0fd0e7 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   613
    foreach(HbInputLanguage language, languageList)  {
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
        QString langName = language.localisedName();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
        if (langName.length() == 0) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
            langName = replace;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
        }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   618
        list << langName;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   620
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   621
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   623
Returns index of the given language at the language list
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   624
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   625
int HbInputSettingWidgetPrivate::languageToIndex(const HbInputLanguage &language, const QList<HbInputLanguage> &languageList)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   626
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   627
    for (int i = 0; i < languageList.count(); ++i) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   628
        if (languageList.at(i) == language) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   629
            return i;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   630
        }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   631
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   632
    return -1;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   633
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   634
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   635
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   636
Returns language in the given index at the language list
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   637
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   638
HbInputLanguage HbInputSettingWidgetPrivate::indexToLanguage(int index, const QList<HbInputLanguage> &languageList)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   639
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   640
    if (index >= 0 && index < languageList.count()) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   641
        return languageList.at(index);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   642
    } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   643
        return HbInputLanguage();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   644
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   645
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   646
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   647
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   648
Creates list of secondary languages
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   649
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   650
void HbInputSettingWidgetPrivate::createSecondaryLanguageList()
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
    mSecondaryLanguages.clear();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   653
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
    mSecondaryLanguages.append(HbInputLanguage());
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   656
    if (mPrimaryInputLanguage.language() != QLocale::Chinese) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
        foreach(HbInputLanguage language, mPrimaryLanguages) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
            if (language != mPrimaryInputLanguage &&
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
                language != QLocale::Chinese) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   660
                mSecondaryLanguages.append(language);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   661
            }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   662
        }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   666
/*!
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   667
Returns index of the given inputmode at the inputmode list
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   668
*/
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   669
int HbInputSettingWidgetPrivate::inputModeToIndex(const int &inputMode, const QList<int> &inputModeList)
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   670
{
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   671
    for (int i = 0; i < inputModeList.count(); ++i) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   672
        if (inputModeList.at(i) == inputMode) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   673
            return i;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   674
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   675
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   676
    return -1;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   677
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   678
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   679
/*!
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   680
Returns inputmode in the given index at the inputmode list
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   681
*/
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   682
int HbInputSettingWidgetPrivate::indexToInputmode(int index, const QList<int> &inputModeList)
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   683
{
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   684
    if (index >= 0 && index < inputModeList.count()) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   685
        return inputModeList.at(index);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   686
    } else {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   687
        return KChineseInputModeNone;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   688
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   689
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   690
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   691
/// @endcond
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   692
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   693
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   694
Constructs input setting widget
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   695
*/
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   696
HbInputSettingWidget::HbInputSettingWidget(HbDataForm *dataForm, QGraphicsWidget *parent)
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   697
    : QObject(parent), d_ptr(new HbInputSettingWidgetPrivate(dataForm))
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   698
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   699
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   700
    d->q_ptr = this;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   701
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   702
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   703
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   704
Destructs the object
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   705
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   706
HbInputSettingWidget::~HbInputSettingWidget()
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   707
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   708
    delete d_ptr;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   709
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   710
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   711
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
Initializes the data form object with input settings
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   714
void HbInputSettingWidget::initializeWidget()
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   715
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   716
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   717
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   718
    d->initialize();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   719
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   720
    HbInputSettingProxy *settings = HbInputSettingProxy::instance();
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   721
    connect(settings, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), this, SLOT(updateGlobalInputLanguage(const HbInputLanguage &)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   722
    connect(settings, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), this, SLOT(updateGlobalSecondaryInputLanguage(const HbInputLanguage &)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   723
    connect(settings, SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)), this, SLOT(updatePredictiveInputState(HbKeyboardSettingFlags, bool)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   724
    connect(settings, SIGNAL(characterPreviewStateForQwertyChanged(bool)), this, SLOT(updateCharacterPreviewStateForQwerty(bool)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   725
    connect(settings, SIGNAL(keypressTimeoutChanged(int)), this, SLOT(updateKeypressTimeout(int)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   726
    connect(settings, SIGNAL(autocompletionStateChanged(HbKeyboardSettingFlags, bool)), this, SLOT(updateAutocompletionState(HbKeyboardSettingFlags, bool)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   727
    connect(settings, SIGNAL(typingCorrectionLevelChanged(HbTypingCorrectionLevel)), this, SLOT(updateTypingCorrectionLevel(HbTypingCorrectionLevel)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   728
    connect(settings, SIGNAL(primaryCandidateModeChanged(HbPrimaryCandidateMode)), this, SLOT(updatePrimaryCandidateMode(HbPrimaryCandidateMode)));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   729
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   730
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   731
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   732
Called by framework when primary language is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   733
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   734
void HbInputSettingWidget::updateGlobalInputLanguage(const HbInputLanguage &newLanguage)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   735
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   736
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   737
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   738
    if (d->mPrimaryInputLanguage != newLanguage) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   739
        setPrimaryLanguage(d->languageToIndex(newLanguage, d->mPrimaryLanguages));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   740
        d->mPrimaryLanguageItem->setContentWidgetData(QString("currentIndex"), d->languageToIndex(d->mPrimaryInputLanguage, d->mPrimaryLanguages));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   741
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   742
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   743
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   744
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   745
Called by framework when secondary language is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   746
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   747
void HbInputSettingWidget::updateGlobalSecondaryInputLanguage(const HbInputLanguage &newLanguage)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   748
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   749
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   750
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   751
    if (d->mSecondaryInputLanguage != newLanguage) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   752
        setSecondaryLanguage(d->languageToIndex(newLanguage, d->mSecondaryLanguages));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   753
        d->mSecondaryLanguageItem->setContentWidgetData(QString("currentIndex"), d->languageToIndex(d->mSecondaryInputLanguage, d->mSecondaryLanguages));
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   754
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   755
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   756
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   757
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   758
Called by framework when prediction status is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   759
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   760
void HbInputSettingWidget::updatePredictiveInputState(HbKeyboardSettingFlags keyboardType, bool newState)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   761
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   762
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   763
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   764
    bool changed = false;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   765
    if (keyboardType & HbKeyboardSetting12key &&
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   766
        d->mPredictionStatusForITUT != newState) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   767
        d->mPredictionStatusForITUT = newState;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   768
        changed = true;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   769
    } else if (keyboardType & HbKeyboardSettingQwerty &&
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   770
               d->mPredictionStatusForQwerty != newState) {
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   771
        d->mPredictionStatusForQwerty = newState;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   772
        changed = true;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   773
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   774
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   775
    if (changed) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
        QList<QVariant> predictionEnabled;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   777
        predictionEnabled << d->mPredictionStatusForQwerty << d->mPredictionStatusForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
        d->mPredictionItem->setContentWidgetData(QString("selectedItems"), predictionEnabled);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   780
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   782
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
Called by framework when character preview state is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
void HbInputSettingWidget::updateCharacterPreviewStateForQwerty(bool newState)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   787
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   788
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   789
    if (d->mCharacterPreviewEnabled != newState) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   790
        d->mCharacterPreviewEnabled = newState;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   791
        if (d->mCharacterPreviewEnabled) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   792
            d->mCharacterPreviewItem->setContentWidgetData(QString("text"), statusOn);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   793
            d->mCharacterPreviewItem->setContentWidgetData(QString("additionalText"), statusOff);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   794
        } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   795
            d->mCharacterPreviewItem->setContentWidgetData(QString("text"), statusOff);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   796
            d->mCharacterPreviewItem->setContentWidgetData(QString("additionalText"), statusOn);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   797
        }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   798
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   799
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   800
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   801
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   802
Called by framework when keypress timeout is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   803
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   804
void HbInputSettingWidget::updateKeypressTimeout(int newTimeout)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   805
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   806
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   807
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   808
    if (d->mKeypressTimeout != newTimeout) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   809
        d->mKeypressTimeout = newTimeout;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   810
        d->mKeypressTimeoutItem->setContentWidgetData(QString("sliderPosition"), d->mKeypressTimeout);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   811
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   812
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   813
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   814
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   815
Called by framework when autocompletion state is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   816
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   817
void HbInputSettingWidget::updateAutocompletionState(HbKeyboardSettingFlags keyboardType, bool newState)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   818
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   819
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   820
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   821
    bool changed = false;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   822
    if (keyboardType & HbKeyboardSetting12key &&
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   823
        d->mAutocompletionForITUT != newState) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   824
        d->mAutocompletionForITUT = newState;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   825
        changed = true;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   826
    } else if (keyboardType & HbKeyboardSettingQwerty &&
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   827
               d->mAutocompletionForQwerty != newState) {
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   828
        d->mAutocompletionForQwerty = newState;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   829
        changed = true;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   830
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   831
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   832
    if (changed) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
        QList<QVariant> autocompletionEnabled;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   834
        autocompletionEnabled << d->mAutocompletionForQwerty << d->mAutocompletionForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   835
        d->mAutoCompletionItem->setContentWidgetData(QString("selectedItems"), autocompletionEnabled);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   836
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   837
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   838
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   839
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   840
Called by framework when typing correction level is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   841
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   842
void HbInputSettingWidget::updateTypingCorrectionLevel(HbTypingCorrectionLevel newLevel)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   843
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   844
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   845
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   846
    if (d->mTypingCorrectionLevel != newLevel) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   847
        d->mTypingCorrectionLevel = newLevel;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   848
        d->mCorrectionLevelItem->setContentWidgetData(QString("selected"), d->mTypingCorrectionLevel);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   849
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   850
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   851
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   852
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   853
Called by framework when primary candidate mode is changed
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   854
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   855
void HbInputSettingWidget::updatePrimaryCandidateMode(HbPrimaryCandidateMode newMode)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   856
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   857
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   858
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   859
    if (d->mPrimaryCandidateMode != newMode) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   860
        d->mPrimaryCandidateMode = newMode;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   861
        if (d->mPrimaryCandidateMode == HbPrimaryCandidateModeBestPrediction) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   862
            d->mPrimaryCandidateItem->setContentWidgetData(QString("text"), bestPrediction);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
            d->mPrimaryCandidateItem->setContentWidgetData(QString("additionalText"), exactTyping);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   864
        } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   865
            d->mPrimaryCandidateItem->setContentWidgetData(QString("text"), exactTyping);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   866
            d->mPrimaryCandidateItem->setContentWidgetData(QString("additionalText"), bestPrediction);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   867
        }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   868
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   869
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   870
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   871
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   872
Saves the new primary language and modifies the secondary language list if necessary
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   873
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   874
void HbInputSettingWidget::setPrimaryLanguage(int index)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   875
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   876
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   877
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   878
    HbInputSettingProxy *settings = HbInputSettingProxy::instance();
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   879
    HbPredictionFactory *predFactory = HbPredictionFactory::instance();
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   880
    bool oldPLangSupportsPrediction = (predFactory->predictionEngineForLanguage(d->mPrimaryInputLanguage) != NULL);
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   881
    d->mPrimaryInputLanguage = d->indexToLanguage(index, d->mPrimaryLanguages);
34
hgs
parents: 7
diff changeset
   882
    if (d->mPrimaryInputLanguage.language() == QLocale::Chinese) {
hgs
parents: 7
diff changeset
   883
        HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Horizontal, HbInputMethodDescriptor());
hgs
parents: 7
diff changeset
   884
        HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Vertical, HbInputMethodDescriptor());        
hgs
parents: 7
diff changeset
   885
    }
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   886
    HbInputSettingProxy::instance()->setGlobalInputLanguage(d->mPrimaryInputLanguage);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   887
    bool langSupportsPrediction = (predFactory->predictionEngineForLanguage(d->mPrimaryInputLanguage) != NULL);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   888
    if (oldPLangSupportsPrediction != langSupportsPrediction) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   889
        if (settings->predictiveInputStatus(HbKeyboardSetting12key) != langSupportsPrediction) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   890
            settings->setPredictiveInputStatus(HbKeyboardSetting12key, langSupportsPrediction);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   891
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   892
        if (settings->predictiveInputStatus(HbKeyboardSettingQwerty) != langSupportsPrediction) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   893
            settings->setPredictiveInputStatus(HbKeyboardSettingQwerty, langSupportsPrediction);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   894
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   895
    }
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   896
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   897
    if (d->mPrimaryInputLanguage.language() != QLocale::Chinese) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   898
        HbInputLanguage secondaryLanguage = d->mSecondaryInputLanguage;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   899
        // Update secondary language list
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   900
        d->createSecondaryLanguageList();
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   901
        QStringList secondaryLanguageItems;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   902
        d->fillLanguageList(secondaryLanguageItems, d->mSecondaryLanguages, tr("None"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   903
        if (d->mSecondaryLanguageItem) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   904
            d->mSecondaryLanguageItem->setContentWidgetData(QString("items"), secondaryLanguageItems);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   905
            if (d->mPrimaryInputLanguage != secondaryLanguage) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   906
                d->mSecondaryLanguageItem->setContentWidgetData(QString("currentIndex"), d->languageToIndex(secondaryLanguage, d->mSecondaryLanguages));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   907
            }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   908
        } else {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   909
            d->mSecondaryLanguageItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, QObject::tr("Secondary Writing language"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   910
            d->mLanguageGroup->appendChild(d->mSecondaryLanguageItem);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   911
            d->mSecondaryLanguageItem->setContentWidgetData(QString("items"), secondaryLanguageItems);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   912
            d->mSecondaryLanguageItem->setContentWidgetData(QString("currentIndex"), d->languageToIndex(secondaryLanguage, d->mSecondaryLanguages));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   913
            d->mSecondaryLanguageItem->setContentWidgetData(QString("objectName"), QString("secondary_writing_language"));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   914
            d->mForm->addConnection(d->mSecondaryLanguageItem, SIGNAL(currentIndexChanged(int)), this, SLOT(setSecondaryLanguage(int)));
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   915
        }
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   916
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   917
        HbDataFormModel *model = qobject_cast<HbDataFormModel *>(d->mForm->model());
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   918
        if (d->mChineseInputGroup) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   919
            model->removeItem(d->mChineseInputGroup);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   920
            d->mChineseInputGroup = NULL;
34
hgs
parents: 7
diff changeset
   921
            HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Horizontal, HbInputMethodDescriptor());
hgs
parents: 7
diff changeset
   922
            HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Vertical, HbInputMethodDescriptor());
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   923
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   924
    } else {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   925
        HbDataFormModel *model = qobject_cast<HbDataFormModel *>(d->mForm->model());
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   926
        if (d->mChineseInputGroup) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   927
            model->removeItem(d->mChineseInputGroup);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   928
            d->mChineseInputGroup = NULL;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   929
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   930
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   931
        if (d->mSecondaryLanguageItem) {
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   932
            model->removeItem(d->mSecondaryLanguageItem);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   933
            d->mSecondaryLanguageItem = NULL;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   934
        }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   935
34
hgs
parents: 7
diff changeset
   936
        resetChineseInputMode(d->mPrimaryInputLanguage);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   937
        d->createChineseSettingGroup(model);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
   938
        d->mForm->setModel(model);
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   939
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   940
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   941
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   942
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   943
Saves the new secondary language
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   944
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   945
void HbInputSettingWidget::setSecondaryLanguage(int index)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   946
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   947
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   948
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   949
    d->mSecondaryInputLanguage = d->indexToLanguage(index, d->mSecondaryLanguages);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   950
    HbInputSettingProxy::instance()->setGlobalSecondaryInputLanguage(d->mSecondaryInputLanguage);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   951
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   952
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   953
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   954
Saves the keypress timeout value
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   955
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   956
void HbInputSettingWidget::setKeypressTimeoutValue(int value)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   957
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   958
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   959
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   960
    d->mKeypressTimeout = value;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   961
    HbInputSettingProxy::instance()->setKeypressTimeout(d->mKeypressTimeout);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   962
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   963
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   964
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   965
Saves the new character preview state
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   966
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   967
void HbInputSettingWidget::setCharacterPreviewState()
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   968
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   969
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   970
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   971
    d->mCharacterPreviewEnabled = !d->mCharacterPreviewEnabled;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   972
    HbInputSettingProxy::instance()->setCharacterPreviewForQwerty(d->mCharacterPreviewEnabled);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   973
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   974
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   975
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   976
Saves the new prediction state for selected keyboard
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   977
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   978
void HbInputSettingWidget::setPredictionState(const QModelIndex &index)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   979
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   980
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   981
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   982
    if (index.row() == 0) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   983
        d->mPredictionStatusForQwerty = !d->mPredictionStatusForQwerty;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   984
        HbInputSettingProxy::instance()->setPredictiveInputStatus(HbKeyboardSettingQwerty, d->mPredictionStatusForQwerty);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   985
    } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   986
        d->mPredictionStatusForITUT = !d->mPredictionStatusForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   987
        HbInputSettingProxy::instance()->setPredictiveInputStatus(HbKeyboardSetting12key, d->mPredictionStatusForITUT);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   988
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   989
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   990
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   991
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   992
Saves the new autocompletion state for selected keyboard
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   993
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   994
void HbInputSettingWidget::setAutocompletionState(const QModelIndex &index)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   995
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   996
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   997
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   998
    if (index.row() == 0) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   999
        d->mAutocompletionForQwerty = !d->mAutocompletionForQwerty;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1000
        HbInputSettingProxy::instance()->setAutocompletionStatus(HbKeyboardSettingQwerty, d->mAutocompletionForQwerty);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1001
    } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1002
        d->mAutocompletionForITUT = !d->mAutocompletionForITUT;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1003
        HbInputSettingProxy::instance()->setAutocompletionStatus(HbKeyboardSetting12key, d->mAutocompletionForITUT);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1004
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1005
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1006
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1007
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1008
Saves the new typing correction level
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1009
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1010
void HbInputSettingWidget::setCorrectionLevel(int index)
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1011
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1012
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1013
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1014
    d->mTypingCorrectionLevel = static_cast<HbTypingCorrectionLevel>(index);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1015
    HbInputSettingProxy::instance()->setTypingCorrectionLevel(d->mTypingCorrectionLevel);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1016
}
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1017
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1018
/*!
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1019
Saves the new primary candidate mode
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1020
*/
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1021
void HbInputSettingWidget::setPrimaryCandidateMode()
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1022
{
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1023
    Q_D(HbInputSettingWidget);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1024
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1025
    if (d->mPrimaryCandidateMode == HbPrimaryCandidateModeBestPrediction) {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1026
        d->mPrimaryCandidateMode = HbPrimaryCandidateModeExactTyping;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1027
    } else {
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1028
        d->mPrimaryCandidateMode = HbPrimaryCandidateModeBestPrediction;
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1029
    }
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1030
    HbInputSettingProxy::instance()->setPrimaryCandidateMode(d->mPrimaryCandidateMode);
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1031
}
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1032
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1033
/*!
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1034
Saves the portrait input method
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1035
*/
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1036
void HbInputSettingWidget::setPortraitInputMethod(int index)
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1037
{
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1038
    Q_D(HbInputSettingWidget);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1039
    d->mCnPortraitInputMode = d->indexToInputmode(index, d->mCnPortraitInputModeList);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1040
    QByteArray customData;
34
hgs
parents: 7
diff changeset
  1041
    HbInputMethodDescriptor descriptor;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1042
34
hgs
parents: 7
diff changeset
  1043
    if (d->mCnPortraitInputMode != KHwrMode) {
hgs
parents: 7
diff changeset
  1044
        QString imName = d->inputModeName(d->mCnPortraitInputMode);
hgs
parents: 7
diff changeset
  1045
        customData.append(imName.toLatin1().data());
hgs
parents: 7
diff changeset
  1046
        customData.append((char)0);
hgs
parents: 7
diff changeset
  1047
        descriptor = HbInputMethod::defaultInputMethod(Qt::Vertical);
hgs
parents: 7
diff changeset
  1048
    } else {
hgs
parents: 7
diff changeset
  1049
        customData.append(KHwrName.toLatin1().data());
hgs
parents: 7
diff changeset
  1050
        customData.append((char)0);
hgs
parents: 7
diff changeset
  1051
        QList<HbInputMethodDescriptor> methodList = HbInputMethod::listCustomInputMethods(Qt::Vertical, HbInputSettingProxy::instance()->globalInputLanguage());
hgs
parents: 7
diff changeset
  1052
        foreach(const HbInputMethodDescriptor &des, methodList) {
hgs
parents: 7
diff changeset
  1053
            if (des.displayName() == "Chinese Hand Writing Recognition") {
hgs
parents: 7
diff changeset
  1054
                descriptor = des;
hgs
parents: 7
diff changeset
  1055
                break;
hgs
parents: 7
diff changeset
  1056
            }
hgs
parents: 7
diff changeset
  1057
        }
hgs
parents: 7
diff changeset
  1058
    }
hgs
parents: 7
diff changeset
  1059
hgs
parents: 7
diff changeset
  1060
    Qt::Orientation orientation = Qt::Vertical;
hgs
parents: 7
diff changeset
  1061
    if (d->mForm) {
hgs
parents: 7
diff changeset
  1062
        orientation = d->mForm->mainWindow()->orientation();
hgs
parents: 7
diff changeset
  1063
    }
hgs
parents: 7
diff changeset
  1064
hgs
parents: 7
diff changeset
  1065
    HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Vertical, descriptor, customData);
hgs
parents: 7
diff changeset
  1066
    if (orientation == Qt::Vertical) {
hgs
parents: 7
diff changeset
  1067
        HbInputMethod::activeInputMethod()->activateInputMethod(descriptor);
hgs
parents: 7
diff changeset
  1068
    }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1069
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1070
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1071
/*!
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1072
Saves the landscape input method
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1073
*/
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1074
void HbInputSettingWidget::setLandscapeInputMethod(int index)
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1075
{
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1076
    Q_D(HbInputSettingWidget);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1077
    d->mCnLandscapeInputMode = d->indexToInputmode(index, d->mCnLandscapeInputModeList);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1078
    QByteArray customData;
34
hgs
parents: 7
diff changeset
  1079
    HbInputMethodDescriptor descriptor;
hgs
parents: 7
diff changeset
  1080
hgs
parents: 7
diff changeset
  1081
    if (d->mCnLandscapeInputMode != KHwrMode) {
hgs
parents: 7
diff changeset
  1082
        QString imName;
hgs
parents: 7
diff changeset
  1083
        if (d->mCnLandscapeInputMode == KCangjieNormalMode || 
hgs
parents: 7
diff changeset
  1084
            d->mCnLandscapeInputMode == KCangjieEasyMode  || 
hgs
parents: 7
diff changeset
  1085
            d->mCnLandscapeInputMode == KCangjieAdvancedMode) {
hgs
parents: 7
diff changeset
  1086
            imName = KCangjieGeneralName;
hgs
parents: 7
diff changeset
  1087
        } else {
hgs
parents: 7
diff changeset
  1088
            imName = d->inputModeName(d->mCnLandscapeInputMode);
hgs
parents: 7
diff changeset
  1089
        }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1090
34
hgs
parents: 7
diff changeset
  1091
        customData.append(imName.toLatin1().data());
hgs
parents: 7
diff changeset
  1092
        customData.append((char)0);
hgs
parents: 7
diff changeset
  1093
        descriptor = HbInputMethod::defaultInputMethod(Qt::Horizontal);
hgs
parents: 7
diff changeset
  1094
    } else {
hgs
parents: 7
diff changeset
  1095
        customData.append(KHwrName.toLatin1().data());
hgs
parents: 7
diff changeset
  1096
        customData.append((char)0);
hgs
parents: 7
diff changeset
  1097
        QList<HbInputMethodDescriptor> methodList = HbInputMethod::listCustomInputMethods(Qt::Horizontal, HbInputSettingProxy::instance()->globalInputLanguage());
hgs
parents: 7
diff changeset
  1098
        foreach(const HbInputMethodDescriptor &des, methodList) {
hgs
parents: 7
diff changeset
  1099
            if (des.displayName() == "Chinese Hand Writing Recognition") {
hgs
parents: 7
diff changeset
  1100
                descriptor = des;
hgs
parents: 7
diff changeset
  1101
                break;
hgs
parents: 7
diff changeset
  1102
            }
hgs
parents: 7
diff changeset
  1103
        }
hgs
parents: 7
diff changeset
  1104
    }
hgs
parents: 7
diff changeset
  1105
hgs
parents: 7
diff changeset
  1106
    Qt::Orientation orientation = Qt::Horizontal;
hgs
parents: 7
diff changeset
  1107
    if (d->mForm) {
hgs
parents: 7
diff changeset
  1108
        orientation = d->mForm->mainWindow()->orientation();
hgs
parents: 7
diff changeset
  1109
    }
hgs
parents: 7
diff changeset
  1110
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1111
    HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Horizontal, descriptor, customData);
34
hgs
parents: 7
diff changeset
  1112
    if (orientation == Qt::Horizontal) {
hgs
parents: 7
diff changeset
  1113
        HbInputMethod::activeInputMethod()->activateInputMethod(descriptor);
hgs
parents: 7
diff changeset
  1114
    }
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1115
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1116
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1117
/*!
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1118
Saves the cangjie input mode
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1119
*/
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1120
void HbInputSettingWidget::setCangjieMode(int index)
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1121
{
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1122
    Q_D(HbInputSettingWidget);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1123
    d->mCnCangjieInputMode = d->indexToInputmode(index, d->mCangjieInputModeList);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1124
    d->mCnLandscapeInputMode = d->mCnCangjieInputMode;
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1125
34
hgs
parents: 7
diff changeset
  1126
    QString imName = KCangjieGeneralName;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1127
    QByteArray customData;
34
hgs
parents: 7
diff changeset
  1128
    customData.append(imName.toLatin1().data());
hgs
parents: 7
diff changeset
  1129
    customData.append((char)0);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1130
34
hgs
parents: 7
diff changeset
  1131
    HbInputMethodDescriptor descriptor;
hgs
parents: 7
diff changeset
  1132
    descriptor = HbInputMethod::defaultInputMethod(Qt::Horizontal);
hgs
parents: 7
diff changeset
  1133
     
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1134
    HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Horizontal, descriptor, customData);
34
hgs
parents: 7
diff changeset
  1135
    HbInputSettingProxy::instance()->setDetailedCangjieMode(HbCangjieDetailMode(index));
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1136
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1137
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1138
/*!
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1139
Saves the handwriting speed
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1140
*/
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1141
void HbInputSettingWidget::setHwrSpeed(int index)
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1142
{
34
hgs
parents: 7
diff changeset
  1143
    // hwr speed index in setting widget are exactly same as enum HbHwrWritingSpeed of setting proxy
hgs
parents: 7
diff changeset
  1144
    if (index >= 0 && index < KHwrSpeedCount) {
hgs
parents: 7
diff changeset
  1145
        HbInputSettingProxy::instance()->setHwrWritingSpeed(HbHwrWritingSpeed(index));
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1146
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1147
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1148
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1149
/*!
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1150
Saves the portrait input method
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1151
*/
34
hgs
parents: 7
diff changeset
  1152
void HbInputSettingWidget::resetChineseInputMode(HbInputLanguage lang)
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1153
{
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1154
    Q_D(HbInputSettingWidget);
34
hgs
parents: 7
diff changeset
  1155
    d->mCnPortraitInputMode = d->defaultModeByGivenLang(lang);
hgs
parents: 7
diff changeset
  1156
    d->mCnLandscapeInputMode = d->defaultModeByGivenLang(lang);
hgs
parents: 7
diff changeset
  1157
    HbInputSettingProxy::instance()->setDetailedCangjieMode(HbCangjieNormal);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1158
34
hgs
parents: 7
diff changeset
  1159
    QByteArray portraitCustomData;
hgs
parents: 7
diff changeset
  1160
    QByteArray landscapeCustomData;
hgs
parents: 7
diff changeset
  1161
    QString imName = d->inputModeName(d->mCnPortraitInputMode);
hgs
parents: 7
diff changeset
  1162
    portraitCustomData.append(imName.toLatin1().data());
hgs
parents: 7
diff changeset
  1163
    portraitCustomData.append((char)0);
hgs
parents: 7
diff changeset
  1164
    HbInputMethodDescriptor portraitDescriptor = HbInputMethod::defaultInputMethod(Qt::Vertical);
hgs
parents: 7
diff changeset
  1165
hgs
parents: 7
diff changeset
  1166
    if (d->mCnLandscapeInputMode == KCangjieNormalMode || 
hgs
parents: 7
diff changeset
  1167
        d->mCnLandscapeInputMode == KCangjieEasyMode || 
hgs
parents: 7
diff changeset
  1168
        d->mCnLandscapeInputMode == KCangjieAdvancedMode) {
hgs
parents: 7
diff changeset
  1169
        imName = KCangjieGeneralName;
hgs
parents: 7
diff changeset
  1170
    } else {
hgs
parents: 7
diff changeset
  1171
        imName = d->inputModeName(d->mCnLandscapeInputMode);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1172
    }
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1173
34
hgs
parents: 7
diff changeset
  1174
    landscapeCustomData.append(imName.toLatin1().data());
hgs
parents: 7
diff changeset
  1175
    landscapeCustomData.append((char)0);
hgs
parents: 7
diff changeset
  1176
    HbInputMethodDescriptor landscapeDescriptor = HbInputMethod::defaultInputMethod(Qt::Horizontal);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1177
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1178
    HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Vertical, (const HbInputMethodDescriptor &)portraitDescriptor, portraitCustomData);
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1179
    HbInputSettingProxy::instance()->setPreferredInputMethod(Qt::Horizontal, (const HbInputMethodDescriptor &)landscapeDescriptor, landscapeCustomData);
34
hgs
parents: 7
diff changeset
  1180
hgs
parents: 7
diff changeset
  1181
    return;
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1182
}
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1183
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1184
/*
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1185
    This slot is called when ever data in the form model is changed
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1186
*/
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1187
void HbInputSettingWidget::dataChange(const QModelIndex &startIn, const QModelIndex &endIn)
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1188
{
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1189
    Q_D(HbInputSettingWidget);
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1190
    Q_UNUSED(endIn);
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1191
    HbDataFormModelItem *item = d->mModel->itemFromIndex(startIn);
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1192
    if(item == d->mPrimaryCandidateItem) {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1193
        setPrimaryCandidateMode();
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1194
    } else if(item == d->mCharacterPreviewItem) {
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1195
        setCharacterPreviewState();
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1196
    } 
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1197
}
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1198
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1199
/*
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1200
 Resets the widget and disconnects the signals connected to the settings proxy
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1201
*/
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1202
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1203
void HbInputSettingWidget::resetWidget()
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1204
{
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1205
    HbInputSettingProxy *settings = HbInputSettingProxy::instance();
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1206
    disconnect(settings, SIGNAL(globalInputLanguageChanged(const HbInputLanguage &)), this, SLOT(updateGlobalInputLanguage(const HbInputLanguage &)));
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1207
    disconnect(settings, SIGNAL(globalSecondaryInputLanguageChanged(const HbInputLanguage &)), this, SLOT(updateGlobalSecondaryInputLanguage(const HbInputLanguage &)));
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1208
    disconnect(settings, SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags, bool)), this, SLOT(updatePredictiveInputState(HbKeyboardSettingFlags, bool)));
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1209
    disconnect(settings, SIGNAL(characterPreviewStateForQwertyChanged(bool)), this, SLOT(updateCharacterPreviewStateForQwerty(bool)));
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1210
    disconnect(settings, SIGNAL(keypressTimeoutChanged(int)), this, SLOT(updateKeypressTimeout(int)));
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1211
    disconnect(settings, SIGNAL(autocompletionStateChanged(HbKeyboardSettingFlags, bool)), this, SLOT(updateAutocompletionState(HbKeyboardSettingFlags, bool)));
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1212
    disconnect(settings, SIGNAL(typingCorrectionLevelChanged(HbTypingCorrectionLevel)), this, SLOT(updateTypingCorrectionLevel(HbTypingCorrectionLevel)));
7
923ff622b8b9 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 6
diff changeset
  1213
    disconnect(settings, SIGNAL(primaryCandidateModeChanged(HbPrimaryCandidateMode)), this, SLOT(updatePrimaryCandidateMode(HbPrimaryCandidateMode)));
6
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1214
}
c3690ec91ef8 Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 5
diff changeset
  1215
34
hgs
parents: 7
diff changeset
  1216
/*!
hgs
parents: 7
diff changeset
  1217
Set default language for keyboard input
hgs
parents: 7
diff changeset
  1218
*/
hgs
parents: 7
diff changeset
  1219
void HbInputSettingWidget::setDefaultLanguageForKeyboardInput(int index)
hgs
parents: 7
diff changeset
  1220
{
hgs
parents: 7
diff changeset
  1221
    if(index == 1) {
hgs
parents: 7
diff changeset
  1222
        HbInputSettingProxy::instance()->setWesternDefaultKeypadForChinese(true);
hgs
parents: 7
diff changeset
  1223
    } else {
hgs
parents: 7
diff changeset
  1224
        HbInputSettingProxy::instance()->setWesternDefaultKeypadForChinese(false);
hgs
parents: 7
diff changeset
  1225
    }
hgs
parents: 7
diff changeset
  1226
}
hgs
parents: 7
diff changeset
  1227
1
f7ac710697a9 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1228
// End of file