summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-10-23 11:40:59 (UTC)
committer zautrix <zautrix>2004-10-23 11:40:59 (UTC)
commit25b0233d54a6d4bea457fd843073e57183d8bea0 (patch) (unidiff)
tree4d85c3cec59e8b085738be7111c7e2bb0ee7219e /korganizer
parentba2583db0431059cd7368be23c9653e81af16d29 (diff)
downloadkdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.zip
kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.gz
kdepimpi-25b0233d54a6d4bea457fd843073e57183d8bea0.tar.bz2
global settings bugfixes
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
@@ -89,7 +89,7 @@ void KODialogManager::createOutgoingDialog()
89 89
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);
95 //mOptionsDialog->readConfig(); 95 //mOptionsDialog->readConfig();
@@ -108,8 +108,7 @@ void KODialogManager::showOptionsDialog( bool showSync )
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}
114void KODialogManager::showSyncOptions() 113void KODialogManager::showSyncOptions()
115{ 114{
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index ba1c6d1..f44debc 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -46,11 +46,6 @@
46#include "koprefs.h" 46#include "koprefs.h"
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;
56 51
@@ -58,7 +53,6 @@ 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);
@@ -100,7 +94,7 @@ KOPrefs::KOPrefs() :
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
@@ -204,13 +198,7 @@ KOPrefs::KOPrefs() :
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");
@@ -316,9 +304,7 @@ 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
@@ -377,80 +363,16 @@ QStringList KOPrefs::getDefaultList()
377 363
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")
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")
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index c74b0ef..0656644 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -23,9 +23,9 @@
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
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
@@ -70,7 +70,6 @@ class KOPrefs : public KPimPrefs
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
@@ -158,7 +157,6 @@ class KOPrefs : public KPimPrefs
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;
@@ -253,21 +251,13 @@ class KOPrefs : public KPimPrefs
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;
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index cf07a1a..f5a1c50 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -31,6 +31,7 @@
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"
@@ -111,7 +112,7 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
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 )
@@ -238,7 +239,7 @@ 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();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fbfcd20..dc2026b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -225,10 +225,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 * ) ),