summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodialogmanager.cpp5
-rw-r--r--korganizer/koprefs.cpp88
-rw-r--r--korganizer/koprefs.h16
-rw-r--r--korganizer/ktimeedit.cpp5
-rw-r--r--korganizer/mainwindow.cpp3
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
@@ -90,5 +90,5 @@ void KODialogManager::createOutgoingDialog()
90void KODialogManager::showOptionsDialog( bool showSync ) 90void 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);
@@ -109,6 +109,5 @@ void KODialogManager::showOptionsDialog( bool 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}
114void KODialogManager::showSyncOptions() 113void KODialogManager::showSyncOptions()
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index ba1c6d1..f44debc 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -47,9 +47,4 @@
47#include "mainwindow.h" 47#include "mainwindow.h"
48 48
49const char *germanwords[][2] = {
50#include "wordsgerman.h"
51 "", ""
52};
53
54KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
55static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
@@ -59,5 +54,4 @@ KOPrefs::KOPrefs() :
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);
@@ -101,5 +95,5 @@ KOPrefs::KOPrefs() :
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);
@@ -205,11 +199,5 @@ KOPrefs::KOPrefs() :
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
@@ -317,7 +305,5 @@ KOPrefs::~KOPrefs()
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}
@@ -378,78 +364,14 @@ QStringList KOPrefs::getDefaultList()
378void KOPrefs::usrReadConfig() 364void 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")
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index c74b0ef..0656644 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -24,7 +24,7 @@
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
30class KConfig; 30class KConfig;
@@ -71,5 +71,4 @@ class KOPrefs : public KPimPrefs
71 71
72 static KOPrefs *mInstance; 72 static KOPrefs *mInstance;
73 QDict<QString> *mLocaleDict;
74 QStringList getDefaultList(); 73 QStringList getDefaultList();
75 public: 74 public:
@@ -159,5 +158,4 @@ class KOPrefs : public KPimPrefs
159 int mWhatsNextPrios; 158 int mWhatsNextPrios;
160 bool mEnableQuickTodo; 159 bool mEnableQuickTodo;
161 bool mLanguageChanged;
162 160
163 bool mCompactDialogs; 161 bool mCompactDialogs;
@@ -254,4 +252,6 @@ class KOPrefs : public KPimPrefs
254 int mAlarmSuspendCount; 252 int mAlarmSuspendCount;
255 int mAlarmBeepInterval; 253 int mAlarmBeepInterval;
254 int mOldLanguage;
255 int mOldLoadedLanguage;
256 256
257 257
@@ -259,14 +259,4 @@ class KOPrefs : public KPimPrefs
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;
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index cf07a1a..f5a1c50 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -32,4 +32,5 @@
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"
@@ -112,5 +113,5 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
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;
@@ -239,5 +240,5 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
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 ) {
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fbfcd20..dc2026b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -226,8 +226,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 );