summaryrefslogtreecommitdiffabout
path: root/libkdepim/kpimglobalprefs.cpp
Unidiff
Diffstat (limited to 'libkdepim/kpimglobalprefs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kpimglobalprefs.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 3771569..0fdc3e4 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -135,24 +135,25 @@ void KPimGlobalPrefs::setGlobalConfig()
135 file.close(); 135 file.close();
136 text.replace( QRegExp("\\\\n"), "\n" ); 136 text.replace( QRegExp("\\\\n"), "\n" );
137 QString line; 137 QString line;
138 QString we; 138 QString we;
139 QString wt; 139 QString wt;
140 int br = 0; 140 int br = 0;
141 int nbr; 141 int nbr;
142 nbr = text.find ( "},", br ); 142 nbr = text.find ( "},", br );
143 line = text.mid( br, nbr - br ); 143 line = text.mid( br, nbr - br );
144 br = nbr+1; 144 br = nbr+1;
145 int se, ee, st, et; 145 int se, ee, st, et;
146 mLocaleDict = new QDict<QString>; 146 mLocaleDict = new QDict<QString>;
147 mLocaleDict->setAutoDelete( true );
147 QString end = "{ \"\",\"\" }"; 148 QString end = "{ \"\",\"\" }";
148 while ( (line != end) && (br > 1) ) { 149 while ( (line != end) && (br > 1) ) {
149 //qDebug("%d *%s* ", br, line.latin1()); 150 //qDebug("%d *%s* ", br, line.latin1());
150 se = line.find("\"")+1; 151 se = line.find("\"")+1;
151 et = line.findRev("\"",-1); 152 et = line.findRev("\"",-1);
152 ee = line.find("\",\""); 153 ee = line.find("\",\"");
153 st = ee+3; 154 st = ee+3;
154 we = line.mid( se, ee-se ); 155 we = line.mid( se, ee-se );
155 wt = line.mid( st, et-st ); 156 wt = line.mid( st, et-st );
156 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 157 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
157 mLocaleDict->insert( we, new QString (wt) ); 158 mLocaleDict->insert( we, new QString (wt) );
158 nbr = text.find ( "}", br ); 159 nbr = text.find ( "}", br );
@@ -179,26 +180,24 @@ void KPimGlobalPrefs::setGlobalConfig()
179 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 180 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
180 mDaylightsavingStart, 181 mDaylightsavingStart,
181 mDaylightsavingEnd ); 182 mDaylightsavingEnd );
182 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 183 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
183 184
184} 185}
185KPimGlobalPrefs::~KPimGlobalPrefs() 186KPimGlobalPrefs::~KPimGlobalPrefs()
186{ 187{
187 if (sInstance == this) 188 if (sInstance == this)
188 sInstance = staticDeleterGP.setObject(0); 189 sInstance = staticDeleterGP.setObject(0);
189 else 190 else
190 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); 191 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
191 //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() ");
192 writeConfig();
193 if ( mLocaleDict ) 192 if ( mLocaleDict )
194 delete mLocaleDict; 193 delete mLocaleDict;
195} 194}
196 195
197KPimGlobalPrefs *KPimGlobalPrefs::instance() 196KPimGlobalPrefs *KPimGlobalPrefs::instance()
198{ 197{
199 if ( !sInstance ) { 198 if ( !sInstance ) {
200 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); 199 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
201 sInstance->readConfig(); 200 sInstance->readConfig();
202 } 201 }
203 202
204 return sInstance; 203 return sInstance;