--- a/src/hbcore/inputfw/hbinputextrauserdictionary.cpp Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/inputfw/hbinputextrauserdictionary.cpp Fri Sep 17 08:32:10 2010 +0300
@@ -36,6 +36,10 @@
const int HbExtraDictMaxFrequency = 255;
+const QString RomanHundreds[10] = {"C","CC","CCC","CD","D","DC","DCC","DCCC","CM","M"};
+const QString RomanTens[9] = {"X","XX","XXX","XL","L","LX","LXX","LXXX","XC"};
+const QString RomanOnes[9] = {"I","II","III","IV","V","VI","VII","VIII","IX"};
+
/*!
@proto
@hbcore
@@ -99,9 +103,8 @@
QString HbExtraUserDictionaryPrivate::name() const
{
- QString num;
- num.setNum(id);
-
+
+ QString num(convertToRomanNumerals(id));
return QString(KExtraUserDictKeyBase) + num;
}
@@ -110,6 +113,40 @@
return HbInputSettingProxy::extraDictionaryPath() + QDir::separator() + name() + QString(KExtraFileExt);
}
+QString HbExtraUserDictionaryPrivate::convertToRomanNumerals(int id) const
+{
+ int numId = id;
+ QString retNum;
+
+ // Append Roman Thousand's to the string
+ int index = 10;
+ int count = numId/1000;
+ for (int i = 0; i < count; i++) {
+ retNum.append(RomanHundreds[index-1]);
+ }
+
+ // Append Roman Hundred's to the string
+ numId = numId % 1000;
+ index = numId / 100;
+ if (index) {
+ retNum.append(RomanHundreds[index - 1]);
+ }
+
+ // Append Roman Ten's to the string
+ numId = numId % 100;
+ index = numId / 10;
+ if (index) {
+ retNum.append(RomanTens[index - 1]);
+ }
+ // Append Roman single digit numerals to the string
+ numId = numId % 10;
+ index = numId / 1;
+ if (index) {
+ retNum.append(RomanOnes[index - 1]);
+ }
+ return retNum;
+}
+
bool HbExtraUserDictionaryPrivate::save(QString fileName)
{
QFile file(fileName);