summaryrefslogtreecommitdiffabout
path: root/korganizer/koprefs.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koprefs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koprefs.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index f3231ff..042046e 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -374,106 +374,111 @@ void KOPrefs::setCategoryDefaults()
QStringList KOPrefs::getDefaultList()
{
QStringList retval ;
retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
<< i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
<< i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
<< i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
<< i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
<< i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
<< i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
<< i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
retval.sort();
return retval;
}
void KOPrefs::usrReadConfig()
{
mLocaleDict = 0;
// pending LR fix translation
// qDebug("KOPrefs::usrReadConfig() fix translation ");
if ( mPreferredLanguage == 1 ) {
mLocaleDict = new QDict<QString>;
int i = 0;
QString fw ( germanwords[i] [0]);
while ( !fw.isEmpty() ) {
mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
++i;
fw = germanwords[i] [0];
}
setLocaleDict( mLocaleDict );
- }
- if ( mPreferredLanguage == 3 ) {
- QString fileName = MainWindow::resourcePath()+"usertranslation.txt";
+ } else {
+ QString fileName ;
+ if ( mPreferredLanguage == 3 )
+ fileName = MainWindow::resourcePath()+"usertranslation.txt";
+ else if ( mPreferredLanguage == 2 )
+ fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
+ else return;
QFile file( fileName );
if (file.open( IO_ReadOnly ) ) {
QTextStream ts( &file );
ts.setCodec( QTextCodec::codecForLocale() );
QString text = ts.read();
file.close();
-
+ text.replace( QRegExp("\\\\n"), "\n" );
QString line;
QString we;
QString wt;
int br = 0;
int nbr;
nbr = text.find ( "},", br );
line = text.mid( br, nbr - br );
br = nbr+1;
int se, ee, st, et;
mLocaleDict = new QDict<QString>;
QString end = "{ \"\",\"\" }";
while ( (line != end) && (br > 1) ) {
//qDebug("%d *%s* ", br, line.latin1());
se = line.find("\"")+1;
et = line.findRev("\"",-1);
ee = line.find("\",\"");
st = ee+3;
we = line.mid( se, ee-se );
wt = line.mid( st, et-st );
//qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
mLocaleDict->insert( we, new QString (wt) );
nbr = text.find ( "}", br );
line = text.mid( br, nbr - br );
br = nbr+1;
}
//qDebug("end *%s* ", end.latin1());
setLocaleDict( mLocaleDict );
} else {
- qDebug("KO: Cannot find translation file usertranslation.txt");
+ qDebug("KO: Cannot find translation file %s",fileName.latin1() );
}
- }
+
+}
config()->setGroup("General");
mCustomCategories = config()->readListEntry("Custom Categories");
if ( KOPrefs::instance()->mLanguageChanged ) {
mLocationDefaults.clear();
mEventSummaryUser.clear();
mTodoSummaryUser.clear();
}
if (mLocationDefaults.isEmpty()) {
mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Libary") << i18n("School") << i18n("Doctor") << i18n("Beach")
<< i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarden")
<< i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
// << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
mLocationDefaults.sort();
}
if (mEventSummaryUser.isEmpty()) {
mEventSummaryUser = getDefaultList() ;
}
if (mTodoSummaryUser.isEmpty()) {
mTodoSummaryUser = getDefaultList() ;
}
if (mCustomCategories.isEmpty()) setCategoryDefaults();
config()->setGroup("Personal Settings");
mName = config()->readEntry("user_name","");
mEmail = config()->readEntry("user_email","");
fillMailDefaults();
config()->setGroup("Category Colors");
QStringList::Iterator it;