equal
deleted
inserted
replaced
34 |
34 |
35 #include "hbinputsettingproxy.h" |
35 #include "hbinputsettingproxy.h" |
36 |
36 |
37 const int HbExtraDictMaxFrequency = 255; |
37 const int HbExtraDictMaxFrequency = 255; |
38 |
38 |
39 /*! |
39 const QString RomanHundreds[10] = {"C","CC","CCC","CD","D","DC","DCC","DCCC","CM","M"}; |
40 @proto |
40 const QString RomanTens[9] = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"}; |
|
41 const QString RomanOnes[9] = {"I","II","III","IV","V","VI","VII","VIII","IX"}; |
|
42 |
|
43 /*! |
|
44 @stable |
41 @hbcore |
45 @hbcore |
42 \class HbExtraUserDictionary |
46 \class HbExtraUserDictionary |
43 \brief A generic implementation of HbUserDictionary class. |
47 \brief A generic implementation of HbUserDictionary class. |
44 |
48 |
45 This class provides generic all-purpose implementation of HbUserDictionary class. |
49 This class provides generic all-purpose implementation of HbUserDictionary class. |
97 return true; |
101 return true; |
98 } |
102 } |
99 |
103 |
100 QString HbExtraUserDictionaryPrivate::name() const |
104 QString HbExtraUserDictionaryPrivate::name() const |
101 { |
105 { |
102 QString num; |
106 |
103 num.setNum(id); |
107 QString num(convertToRomanNumerals(id)); |
104 |
|
105 return QString(KExtraUserDictKeyBase) + num; |
108 return QString(KExtraUserDictKeyBase) + num; |
106 } |
109 } |
107 |
110 |
108 QString HbExtraUserDictionaryPrivate::fileName() const |
111 QString HbExtraUserDictionaryPrivate::fileName() const |
109 { |
112 { |
110 return HbInputSettingProxy::extraDictionaryPath() + QDir::separator() + name() + QString(KExtraFileExt); |
113 return HbInputSettingProxy::extraDictionaryPath() + QDir::separator() + name() + QString(KExtraFileExt); |
|
114 } |
|
115 |
|
116 QString HbExtraUserDictionaryPrivate::convertToRomanNumerals(int id) const |
|
117 { |
|
118 int numId = id; |
|
119 QString retNum; |
|
120 |
|
121 // Append Roman Thousand's to the string |
|
122 int index = 10; |
|
123 int count = numId/1000; |
|
124 for (int i = 0; i < count; i++) { |
|
125 retNum.append(RomanHundreds[index-1]); |
|
126 } |
|
127 |
|
128 // Append Roman Hundred's to the string |
|
129 numId = numId % 1000; |
|
130 index = numId / 100; |
|
131 if (index) { |
|
132 retNum.append(RomanHundreds[index - 1]); |
|
133 } |
|
134 |
|
135 // Append Roman Ten's to the string |
|
136 numId = numId % 100; |
|
137 index = numId / 10; |
|
138 if (index) { |
|
139 retNum.append(RomanTens[index - 1]); |
|
140 } |
|
141 // Append Roman single digit numerals to the string |
|
142 numId = numId % 10; |
|
143 index = numId / 1; |
|
144 if (index) { |
|
145 retNum.append(RomanOnes[index - 1]); |
|
146 } |
|
147 return retNum; |
111 } |
148 } |
112 |
149 |
113 bool HbExtraUserDictionaryPrivate::save(QString fileName) |
150 bool HbExtraUserDictionaryPrivate::save(QString fileName) |
114 { |
151 { |
115 QFile file(fileName); |
152 QFile file(fileName); |