-rw-r--r-- | korganizer/kodialogmanager.cpp | 5 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 88 | ||||
-rw-r--r-- | korganizer/koprefs.h | 16 | ||||
-rw-r--r-- | korganizer/ktimeedit.cpp | 5 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 3 |
5 files changed, 14 insertions, 103 deletions
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index 58198a2..db7c3f2 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp | |||
@@ -88,9 +88,9 @@ void KODialogManager::createOutgoingDialog() | |||
88 | } | 88 | } |
89 | 89 | ||
90 | void KODialogManager::showOptionsDialog( bool showSync ) | 90 | void KODialogManager::showOptionsDialog( bool showSync ) |
91 | { | 91 | { |
92 | int curLanguage = KOPrefs::instance()->mPreferredLanguage; | 92 | |
93 | if (!mOptionsDialog) { | 93 | if (!mOptionsDialog) { |
94 | mOptionsDialog = new KOPrefsDialog(mMainView); | 94 | mOptionsDialog = new KOPrefsDialog(mMainView); |
95 | //mOptionsDialog->readConfig(); | 95 | //mOptionsDialog->readConfig(); |
96 | connect(mOptionsDialog,SIGNAL(configChanged()), | 96 | connect(mOptionsDialog,SIGNAL(configChanged()), |
@@ -107,10 +107,9 @@ void KODialogManager::showOptionsDialog( bool showSync ) | |||
107 | #endif | 107 | #endif |
108 | if ( showSync ) | 108 | if ( showSync ) |
109 | mOptionsDialog->showSyncPage(); | 109 | mOptionsDialog->showSyncPage(); |
110 | mOptionsDialog->exec(); | 110 | mOptionsDialog->exec(); |
111 | if ( curLanguage != KOPrefs::instance()->mPreferredLanguage ) | 111 | |
112 | KOPrefs::instance()->mLanguageChanged = true; | ||
113 | } | 112 | } |
114 | void KODialogManager::showSyncOptions() | 113 | void KODialogManager::showSyncOptions() |
115 | { | 114 | { |
116 | showOptionsDialog( true ); | 115 | showOptionsDialog( true ); |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index ba1c6d1..f44debc 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -45,21 +45,15 @@ | |||
45 | 45 | ||
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "mainwindow.h" | 47 | #include "mainwindow.h" |
48 | 48 | ||
49 | const char *germanwords[][2] = { | ||
50 | #include "wordsgerman.h" | ||
51 | "", "" | ||
52 | }; | ||
53 | |||
54 | KOPrefs *KOPrefs::mInstance = 0; | 49 | KOPrefs *KOPrefs::mInstance = 0; |
55 | static KStaticDeleter<KOPrefs> insd; | 50 | static KStaticDeleter<KOPrefs> insd; |
56 | 51 | ||
57 | KOPrefs::KOPrefs() : | 52 | KOPrefs::KOPrefs() : |
58 | KPimPrefs("korganizerrc") | 53 | KPimPrefs("korganizerrc") |
59 | { | 54 | { |
60 | mCategoryColors.setAutoDelete(true); | 55 | mCategoryColors.setAutoDelete(true); |
61 | mLocaleDict = 0; | ||
62 | fillMailDefaults(); | 56 | fillMailDefaults(); |
63 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
64 | QColor defaultHolidayColor = QColor(255,0,0); | 58 | QColor defaultHolidayColor = QColor(255,0,0); |
65 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
@@ -99,9 +93,9 @@ KOPrefs::KOPrefs() : | |||
99 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
100 | addItemBool("ShowIconNext",&mShowIconNext,true); | 94 | addItemBool("ShowIconNext",&mShowIconNext,true); |
101 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
102 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
103 | addItemBool("LanguageChanged",&mLanguageChanged,false); | 97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
104 | 98 | ||
105 | addItemBool("AskForQuit",&mAskForQuit,false); | 99 | addItemBool("AskForQuit",&mAskForQuit,false); |
106 | 100 | ||
107 | #ifndef DESKTOP_VERSION | 101 | #ifndef DESKTOP_VERSION |
@@ -203,15 +197,9 @@ KOPrefs::KOPrefs() : | |||
203 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 197 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
204 | 198 | ||
205 | 199 | ||
206 | KPrefs::setCurrentGroup("Locale"); | 200 | KPrefs::setCurrentGroup("Locale"); |
207 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | ||
208 | addItemInt("PreferredTime",&mPreferredTime,0); | ||
209 | addItemInt("PreferredDate",&mPreferredDate,0); | ||
210 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | ||
211 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 201 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
212 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | ||
213 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | ||
214 | 202 | ||
215 | 203 | ||
216 | KPrefs::setCurrentGroup("Colors"); | 204 | KPrefs::setCurrentGroup("Colors"); |
217 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 205 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
@@ -315,11 +303,9 @@ KOPrefs::KOPrefs() : | |||
315 | KOPrefs::~KOPrefs() | 303 | KOPrefs::~KOPrefs() |
316 | { | 304 | { |
317 | if (mInstance == this) | 305 | if (mInstance == this) |
318 | mInstance = insd.setObject(0); | 306 | mInstance = insd.setObject(0); |
319 | setLocaleDict( 0 ); | 307 | |
320 | if ( mLocaleDict ) | ||
321 | delete mLocaleDict; | ||
322 | //qDebug("KOPrefs::~KOPrefs() "); | 308 | //qDebug("KOPrefs::~KOPrefs() "); |
323 | } | 309 | } |
324 | 310 | ||
325 | 311 | ||
@@ -376,82 +362,18 @@ QStringList KOPrefs::getDefaultList() | |||
376 | } | 362 | } |
377 | 363 | ||
378 | void KOPrefs::usrReadConfig() | 364 | void KOPrefs::usrReadConfig() |
379 | { | 365 | { |
380 | mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | ||
381 | mLocaleDict = 0; | ||
382 | // pending LR fix translation | ||
383 | // qDebug("KOPrefs::usrReadConfig() fix translation "); | ||
384 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | ||
385 | if ( mPreferredLanguage == 1 ) { | ||
386 | mLocaleDict = new QDict<QString>; | ||
387 | int i = 0; | ||
388 | QString fw ( germanwords[i] [0]); | ||
389 | while ( !fw.isEmpty() ) { | ||
390 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); | ||
391 | ++i; | ||
392 | fw = germanwords[i] [0]; | ||
393 | } | ||
394 | |||
395 | setLocaleDict( mLocaleDict ); | ||
396 | } else { | ||
397 | QString fileName ; | ||
398 | if ( mPreferredLanguage == 4 ) | ||
399 | fileName = MainWindow::resourcePath()+"usertranslation.txt"; | ||
400 | else if ( mPreferredLanguage == 2 ) | ||
401 | fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; | ||
402 | else if ( mPreferredLanguage == 3 ) | ||
403 | fileName = MainWindow::resourcePath()+"italiantranslation.txt"; | ||
404 | QFile file( fileName ); | ||
405 | if (file.open( IO_ReadOnly ) ) { | ||
406 | QTextStream ts( &file ); | ||
407 | ts.setEncoding( QTextStream::Latin1 ); | ||
408 | //ts.setCodec( QTextCodec::latin1 ); | ||
409 | QString text = ts.read(); | ||
410 | file.close(); | ||
411 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
412 | QString line; | ||
413 | QString we; | ||
414 | QString wt; | ||
415 | int br = 0; | ||
416 | int nbr; | ||
417 | nbr = text.find ( "},", br ); | ||
418 | line = text.mid( br, nbr - br ); | ||
419 | br = nbr+1; | ||
420 | int se, ee, st, et; | ||
421 | mLocaleDict = new QDict<QString>; | ||
422 | QString end = "{ \"\",\"\" }"; | ||
423 | while ( (line != end) && (br > 1) ) { | ||
424 | //qDebug("%d *%s* ", br, line.latin1()); | ||
425 | se = line.find("\"")+1; | ||
426 | et = line.findRev("\"",-1); | ||
427 | ee = line.find("\",\""); | ||
428 | st = ee+3; | ||
429 | we = line.mid( se, ee-se ); | ||
430 | wt = line.mid( st, et-st ); | ||
431 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
432 | mLocaleDict->insert( we, new QString (wt) ); | ||
433 | nbr = text.find ( "}", br ); | ||
434 | line = text.mid( br, nbr - br ); | ||
435 | br = nbr+1; | ||
436 | } | ||
437 | //qDebug("end *%s* ", end.latin1()); | ||
438 | |||
439 | setLocaleDict( mLocaleDict ); | ||
440 | } else { | ||
441 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
442 | } | ||
443 | |||
444 | } | ||
445 | } | ||
446 | config()->setGroup("General"); | 366 | config()->setGroup("General"); |
447 | 367 | ||
448 | mCustomCategories = config()->readListEntry("Custom Categories"); | 368 | mCustomCategories = config()->readListEntry("Custom Categories"); |
449 | if ( KOPrefs::instance()->mLanguageChanged ) { | 369 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { |
450 | mLocationDefaults.clear(); | 370 | mLocationDefaults.clear(); |
451 | mEventSummaryUser.clear(); | 371 | mEventSummaryUser.clear(); |
452 | mTodoSummaryUser.clear(); | 372 | mTodoSummaryUser.clear(); |
453 | } | 373 | } |
374 | mOldLoadedLanguage = mOldLanguage ; | ||
375 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | ||
454 | if (mLocationDefaults.isEmpty()) { | 376 | if (mLocationDefaults.isEmpty()) { |
455 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 377 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
456 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 378 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
457 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 379 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index c74b0ef..0656644 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -22,11 +22,11 @@ | |||
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | #include <qdict.h> | ||
27 | 26 | ||
28 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | ||
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
@@ -69,9 +69,8 @@ class KOPrefs : public KPimPrefs | |||
69 | object. */ | 69 | object. */ |
70 | KOPrefs(); | 70 | KOPrefs(); |
71 | 71 | ||
72 | static KOPrefs *mInstance; | 72 | static KOPrefs *mInstance; |
73 | QDict<QString> *mLocaleDict; | ||
74 | QStringList getDefaultList(); | 73 | QStringList getDefaultList(); |
75 | public: | 74 | public: |
76 | // preferences data | 75 | // preferences data |
77 | KConfig* getConfig(); | 76 | KConfig* getConfig(); |
@@ -157,9 +156,8 @@ class KOPrefs : public KPimPrefs | |||
157 | int mNextXDays; | 156 | int mNextXDays; |
158 | int mWhatsNextDays; | 157 | int mWhatsNextDays; |
159 | int mWhatsNextPrios; | 158 | int mWhatsNextPrios; |
160 | bool mEnableQuickTodo; | 159 | bool mEnableQuickTodo; |
161 | bool mLanguageChanged; | ||
162 | 160 | ||
163 | bool mCompactDialogs; | 161 | bool mCompactDialogs; |
164 | bool mVerticalScreen; | 162 | bool mVerticalScreen; |
165 | 163 | ||
@@ -252,23 +250,15 @@ class KOPrefs : public KPimPrefs | |||
252 | int mAlarmPlayBeeps; | 250 | int mAlarmPlayBeeps; |
253 | int mAlarmSuspendTime; | 251 | int mAlarmSuspendTime; |
254 | int mAlarmSuspendCount; | 252 | int mAlarmSuspendCount; |
255 | int mAlarmBeepInterval; | 253 | int mAlarmBeepInterval; |
254 | int mOldLanguage; | ||
255 | int mOldLoadedLanguage; | ||
256 | 256 | ||
257 | 257 | ||
258 | QString mActiveSyncPort; | 258 | QString mActiveSyncPort; |
259 | QString mActiveSyncIP; | 259 | QString mActiveSyncIP; |
260 | 260 | ||
261 | |||
262 | //US I copied the following settings into KPimGlobalPrefs | ||
263 | // that allows us later to easily remove the settings from here. | ||
264 | int mPreferredDate; | ||
265 | QString mUserDateFormatLong; | ||
266 | QString mUserDateFormatShort; | ||
267 | int mPreferredLanguage; | ||
268 | int mPreferredTime; | ||
269 | bool mWeekStartsOnSunday; | ||
270 | |||
271 | private: | 261 | private: |
272 | QDict<QColor> mCategoryColors; | 262 | QDict<QColor> mCategoryColors; |
273 | QColor mDefaultCategoryColor; | 263 | QColor mDefaultCategoryColor; |
274 | 264 | ||
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp index cf07a1a..f5a1c50 100644 --- a/korganizer/ktimeedit.cpp +++ b/korganizer/ktimeedit.cpp | |||
@@ -30,8 +30,9 @@ | |||
30 | #include <kmessagebox.h> | 30 | #include <kmessagebox.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kpimglobalprefs.h> | ||
34 | 35 | ||
35 | #include "ktimeedit.h" | 36 | #include "ktimeedit.h" |
36 | #include "koprefs.h" | 37 | #include "koprefs.h" |
37 | #include <qvalidator.h> | 38 | #include <qvalidator.h> |
@@ -110,9 +111,9 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) | |||
110 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); | 111 | connect(this, SIGNAL(highlighted(int)), this, SLOT(hilit(int))); |
111 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); | 112 | connect(this,SIGNAL(textChanged(const QString&)),this,SLOT(changedText())); |
112 | QFontMetrics fm ( font() ); | 113 | QFontMetrics fm ( font() ); |
113 | QString timeString = "24:00"; | 114 | QString timeString = "24:00"; |
114 | if ( KOPrefs::instance()->mPreferredTime == 1 ) | 115 | if ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ) |
115 | timeString = "02:00pm"; | 116 | timeString = "02:00pm"; |
116 | int addSpace = 32; | 117 | int addSpace = 32; |
117 | if ( QApplication::desktop()->width() > 320 ) | 118 | if ( QApplication::desktop()->width() > 320 ) |
118 | timeString += ":00"; | 119 | timeString += ":00"; |
@@ -237,9 +238,9 @@ void KOTimeEdit::setSelect( int from, int to ) | |||
237 | void KOTimeEdit::keyPressEvent(QKeyEvent *e) | 238 | void KOTimeEdit::keyPressEvent(QKeyEvent *e) |
238 | { | 239 | { |
239 | 240 | ||
240 | qApp->processEvents(); | 241 | qApp->processEvents(); |
241 | bool hour12Format = ( KOPrefs::instance()->mPreferredTime == 1 ); | 242 | bool hour12Format = ( KPimGlobalPrefs::instance()->mPreferredTime == 1 ); |
242 | int maxpos = hour12Format?7:5; | 243 | int maxpos = hour12Format?7:5; |
243 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 244 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
244 | e->ignore(); | 245 | e->ignore(); |
245 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 246 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index fbfcd20..dc2026b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -224,12 +224,11 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
224 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
227 | 227 | ||
228 | if ( KOPrefs::instance()->mLanguageChanged ) { | 228 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
229 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
230 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
231 | KOPrefs::instance()->mLanguageChanged = false; | ||
232 | } | 231 | } |
233 | processIncidenceSelection( 0 ); | 232 | processIncidenceSelection( 0 ); |
234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 233 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
235 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 234 | SLOT( processIncidenceSelection( Incidence * ) ) ); |