|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include <QObject> |
|
18 #include <QLocale> |
|
19 #include <hbinputkeymapfactory.h> |
|
20 #include <hbinputkeymap.h> |
|
21 #include <hbinputsettingproxy.h> |
|
22 |
|
23 #include "logspredictivethai12keytranslator.h" |
|
24 #include "logslogger.h" |
|
25 |
|
26 const QChar IgnoreList[] = {'*', '#' }; |
|
27 const int IgnoreCount = 2; |
|
28 |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // LogsPredictiveThai12KeyTranslator::LogsPredictiveThai12KeyTranslator() |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 LogsPredictiveThai12KeyTranslator::LogsPredictiveThai12KeyTranslator() |
|
35 : LogsPredictive12KeyTranslator() |
|
36 { |
|
37 LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveThai12KeyTranslator::\ |
|
38 LogsPredictiveThai12KeyTranslator()" ) |
|
39 HbInputLanguage lang = |
|
40 HbInputSettingProxy::instance()->globalInputLanguage(); |
|
41 ASSERT( lang.language() == QLocale::Thai ); |
|
42 mKeyMap = HbKeymapFactory::instance()->keymap( lang.language(), |
|
43 lang.variant() ); |
|
44 |
|
45 |
|
46 LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveThai12KeyTranslator::\ |
|
47 LogsPredictiveThai12KeyTranslator()" ) |
|
48 } |
|
49 |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // LogsPredictiveThai12KeyTranslator::~LogsPredictiveThai12KeyTranslator() |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 LogsPredictiveThai12KeyTranslator::~LogsPredictiveThai12KeyTranslator() |
|
56 { |
|
57 LOGS_QDEBUG( "logs [FINDER] -> LogsPredictiveThai12KeyTranslator::\ |
|
58 ~LogsPredictiveThai12KeyTranslator()" ) |
|
59 LOGS_QDEBUG( "logs [FINDER] <- LogsPredictiveThai12KeyTranslator::\ |
|
60 ~LogsPredictiveThai12KeyTranslator()" ) |
|
61 |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // LogsPredictiveThai12KeyTranslator::translateChar() |
|
66 // ----------------------------------------------------------------------------- |
|
67 // |
|
68 const QChar LogsPredictiveThai12KeyTranslator::translateChar( |
|
69 const QChar character ) const |
|
70 { |
|
71 QChar keycode; |
|
72 if ( !isIgnored( character ) ) { |
|
73 keycode = LogsPredictive12KeyTranslator::translateChar( character ); |
|
74 keycode = !keycode.isNull() && !isIgnored( keycode ) ? |
|
75 keycode : QChar(); |
|
76 } |
|
77 return keycode; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // LogsPredictiveThai12KeyTranslator::nameTokens() |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 QStringList LogsPredictiveThai12KeyTranslator::nameTokens( |
|
85 const QString& name ) const |
|
86 { |
|
87 return QStringList( name ); |
|
88 } |
|
89 |
|
90 |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // LogsPredictiveThai12KeyTranslator::isIgnored() |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 bool LogsPredictiveThai12KeyTranslator::isIgnored( const QChar character ) const |
|
97 { |
|
98 bool found = false; |
|
99 int index = 0; |
|
100 while( index < IgnoreCount && !found ) { |
|
101 found = IgnoreList[ index++ ] == character; |
|
102 } |
|
103 return found; |
|
104 } |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |