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) (show 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
@@ -80,45 +80,44 @@ OutgoingDialog *KODialogManager::outgoingDialog()
80void KODialogManager::createOutgoingDialog() 80void KODialogManager::createOutgoingDialog()
81{ 81{
82 if (!mOutgoingDialog) { 82 if (!mOutgoingDialog) {
83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); 83 mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView);
84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); 84 if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog);
85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), 85 connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)),
86 mMainView,SIGNAL(numOutgoingChanged(int))); 86 mMainView,SIGNAL(numOutgoingChanged(int)));
87 } 87 }
88} 88}
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();
96 connect(mOptionsDialog,SIGNAL(configChanged()), 96 connect(mOptionsDialog,SIGNAL(configChanged()),
97 mMainView,SLOT(updateConfig())); 97 mMainView,SLOT(updateConfig()));
98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), 98 //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()),
99 // mOptionsDialog,SLOT(updateCategories())); 99 // mOptionsDialog,SLOT(updateCategories()));
100 100
101 } 101 }
102 mOptionsDialog->readConfig(); 102 mOptionsDialog->readConfig();
103#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
104 mOptionsDialog->showMaximized(); 104 mOptionsDialog->showMaximized();
105#else 105#else
106 mOptionsDialog->show(); 106 mOptionsDialog->show();
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}
114void KODialogManager::showSyncOptions() 113void KODialogManager::showSyncOptions()
115{ 114{
116 showOptionsDialog( true ); 115 showOptionsDialog( true );
117 116
118} 117}
119void KODialogManager::showOutgoingDialog() 118void KODialogManager::showOutgoingDialog()
120{ 119{
121 createOutgoingDialog(); 120 createOutgoingDialog();
122 mOutgoingDialog->show(); 121 mOutgoingDialog->show();
123 mOutgoingDialog->raise(); 122 mOutgoingDialog->raise();
124} 123}
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index ba1c6d1..f44debc 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -37,37 +37,31 @@
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
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
57KOPrefs::KOPrefs() : 52KOPrefs::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);
66 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 60 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
67 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 61 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
68 QColor defaultTodoDueTodayColor = QColor(255,220,100); 62 QColor defaultTodoDueTodayColor = QColor(255,220,100);
69 QColor defaultTodoOverdueColor = QColor(255,153,125); 63 QColor defaultTodoOverdueColor = QColor(255,153,125);
70 64
71 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); 65 mTimeBarFont = QFont("helvetica",10);//,QFont::Bold);
72 mDefaultViewFont = QFont("helvetica",10); 66 mDefaultViewFont = QFont("helvetica",10);
73 mDefaultMonthViewFont = QFont("helvetica",8); 67 mDefaultMonthViewFont = QFont("helvetica",8);
@@ -91,25 +85,25 @@ KOPrefs::KOPrefs() :
91 addItemBool("ShowIconMonth",&mShowIconMonth,true); 85 addItemBool("ShowIconMonth",&mShowIconMonth,true);
92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 86 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 87 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
94 addItemBool("ShowIconBack",&mShowIconBack,true); 88 addItemBool("ShowIconBack",&mShowIconBack,true);
95 addItemBool("ShowIconToday",&mShowIconToday,true); 89 addItemBool("ShowIconToday",&mShowIconToday,true);
96 addItemBool("ShowIconForward",&mShowIconForward,true); 90 addItemBool("ShowIconForward",&mShowIconForward,true);
97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 91 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 92 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
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
108 addItemBool("ShowFullMenu",&mShowFullMenu,false); 102 addItemBool("ShowFullMenu",&mShowFullMenu,false);
109#else 103#else
110 addItemBool("ShowFullMenu",&mShowFullMenu,true); 104 addItemBool("ShowFullMenu",&mShowFullMenu,true);
111#endif 105#endif
112 addItemBool("ToolBarHor",&mToolBarHor, true ); 106 addItemBool("ToolBarHor",&mToolBarHor, true );
113 addItemBool("ToolBarUp",&mToolBarUp, false ); 107 addItemBool("ToolBarUp",&mToolBarUp, false );
114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 108 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
115 addItemInt("Whats Next Days",&mWhatsNextDays,3); 109 addItemInt("Whats Next Days",&mWhatsNextDays,3);
@@ -195,31 +189,25 @@ KOPrefs::KOPrefs() :
195 QString hdp= locateLocal("data","korganizer")+"/"; 189 QString hdp= locateLocal("data","korganizer")+"/";
196#endif 190#endif
197 191
198 KPrefs::setCurrentGroup("LoadSaveFileNames"); 192 KPrefs::setCurrentGroup("LoadSaveFileNames");
199 193
200 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 194 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
201 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 195 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
202 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 196 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
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);
218 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 206 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
219 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 207 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
220 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 208 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
221 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 209 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
222 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 210 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
223 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 211 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
224 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 212 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
225 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 213 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
@@ -307,27 +295,25 @@ KOPrefs::KOPrefs() :
307 295
308 addItemInt("DestinationPolicy",&mDestination,standardDestination); 296 addItemInt("DestinationPolicy",&mDestination,standardDestination);
309 297
310 298
311 299
312} 300}
313 301
314 302
315KOPrefs::~KOPrefs() 303KOPrefs::~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
326KOPrefs *KOPrefs::instance() 312KOPrefs *KOPrefs::instance()
327{ 313{
328 if (!mInstance) { 314 if (!mInstance) {
329 mInstance = insd.setObject(new KOPrefs()); 315 mInstance = insd.setObject(new KOPrefs());
330 mInstance->readConfig(); 316 mInstance->readConfig();
331 } 317 }
332 318
333 return mInstance; 319 return mInstance;
@@ -368,98 +354,34 @@ QStringList KOPrefs::getDefaultList()
368 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 354 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
369 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 355 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
370 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 356 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
371 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 357 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
372 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 358 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
373 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 359 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
374 retval.sort(); 360 retval.sort();
375 return retval; 361 return retval;
376} 362}
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")
457 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 379 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
458 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 380 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
459 mLocationDefaults.sort(); 381 mLocationDefaults.sort();
460 } 382 }
461 383
462 if (mEventSummaryUser.isEmpty()) { 384 if (mEventSummaryUser.isEmpty()) {
463 mEventSummaryUser = getDefaultList() ; 385 mEventSummaryUser = getDefaultList() ;
464 } 386 }
465 if (mTodoSummaryUser.isEmpty()) { 387 if (mTodoSummaryUser.isEmpty()) {
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index c74b0ef..0656644 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -14,27 +14,27 @@
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
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
30class KConfig; 30class KConfig;
31class QFont; 31class QFont;
32class QColor; 32class QColor;
33class QStringList; 33class QStringList;
34 34
35class KOPrefs : public KPimPrefs 35class KOPrefs : public KPimPrefs
36{ 36{
37 public: 37 public:
38 enum { FormatVCalendar, FormatICalendar }; 38 enum { FormatVCalendar, FormatICalendar };
39 enum { MailClientKMail, MailClientSendmail }; 39 enum { MailClientKMail, MailClientSendmail };
40 enum { IMIPDummy, IMIPKMail }; 40 enum { IMIPDummy, IMIPKMail };
@@ -61,25 +61,24 @@ class KOPrefs : public KPimPrefs
61 protected: 61 protected:
62 void setTimeZoneIdDefault(); 62 void setTimeZoneIdDefault();
63 63
64 /** Fill empty mail fields with default values. */ 64 /** Fill empty mail fields with default values. */
65 void fillMailDefaults(); 65 void fillMailDefaults();
66 66
67 private: 67 private:
68 /** Constructor disabled for public. Use instance() to create a KOPrefs 68 /** Constructor disabled for public. Use instance() to create a KOPrefs
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();
78 void setFullName(const QString &); 77 void setFullName(const QString &);
79 QString fullName(); 78 QString fullName();
80 void setEmail(const QString &); 79 void setEmail(const QString &);
81 QString email(); 80 QString email();
82 81
83 QString mAdditional; 82 QString mAdditional;
84 83
85 bool mEmailControlCenter; 84 bool mEmailControlCenter;
@@ -149,25 +148,24 @@ class KOPrefs : public KPimPrefs
149 bool mMonthShowShort; 148 bool mMonthShowShort;
150 bool mEnableToolTips; 149 bool mEnableToolTips;
151 bool mEnableMonthScroll; 150 bool mEnableMonthScroll;
152 bool mFullViewMonth; 151 bool mFullViewMonth;
153 bool mMonthViewUsesCategoryColor; 152 bool mMonthViewUsesCategoryColor;
154 bool mFullViewTodo; 153 bool mFullViewTodo;
155 bool mShowCompletedTodo; 154 bool mShowCompletedTodo;
156 bool mMarcusBainsEnabled; 155 bool mMarcusBainsEnabled;
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
166 bool mShowIconNewTodo; 164 bool mShowIconNewTodo;
167 bool mShowIconNewEvent; 165 bool mShowIconNewEvent;
168 bool mShowIconSearch; 166 bool mShowIconSearch;
169 bool mShowIconList; 167 bool mShowIconList;
170 bool mShowIconDay1; 168 bool mShowIconDay1;
171 bool mShowIconDay5; 169 bool mShowIconDay5;
172 bool mShowIconDay7; 170 bool mShowIconDay7;
173 bool mShowIconMonth; 171 bool mShowIconMonth;
@@ -244,39 +242,31 @@ class KOPrefs : public KPimPrefs
244 bool mHightlightDateTimeEdit; 242 bool mHightlightDateTimeEdit;
245 bool mShortDateInViewer; 243 bool mShortDateInViewer;
246 244
247 QStringList mLocationDefaults; 245 QStringList mLocationDefaults;
248 QStringList mEventSummaryUser; 246 QStringList mEventSummaryUser;
249 QStringList mTodoSummaryUser; 247 QStringList mTodoSummaryUser;
250 248
251 bool mUseInternalAlarmNotification; 249 bool mUseInternalAlarmNotification;
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
275 QFont mDefaultTimeBarFont; 265 QFont mDefaultTimeBarFont;
276 QFont mDefaultViewFont; 266 QFont mDefaultViewFont;
277 QFont mDefaultMonthViewFont; 267 QFont mDefaultMonthViewFont;
278 268
279 QString mName; 269 QString mName;
280 QString mEmail; 270 QString mEmail;
281}; 271};
282 272
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index cf07a1a..f5a1c50 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -22,24 +22,25 @@
22*/ 22*/
23 23
24#include <qkeycode.h> 24#include <qkeycode.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qapplication.h> 28#include <qapplication.h>
29 29
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>
38 39
39// Validator for a time value with only hours and minutes (no seconds) 40// Validator for a time value with only hours and minutes (no seconds)
40// Mostly locale aware. Author: David Faure <faure@kde.org> 41// Mostly locale aware. Author: David Faure <faure@kde.org>
41class KOTimeValidator : public QValidator 42class KOTimeValidator : public QValidator
42{ 43{
43public: 44public:
44 KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} 45 KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {}
45 46
@@ -102,25 +103,25 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
102 } while (!timeEntry.isNull()); 103 } while (!timeEntry.isNull());
103 // Add end of day. 104 // Add end of day.
104 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) ); 105 insertItem( KGlobal::locale()->formatTime( QTime( 23, 59, 59 ) ) );
105 106
106 updateText(); 107 updateText();
107 setFocusPolicy(QWidget::StrongFocus); 108 setFocusPolicy(QWidget::StrongFocus);
108 109
109 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int))); 110 connect(this, SIGNAL(activated(int)), this, SLOT(activ(int)));
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";
119 setFixedWidth(fm.width( timeString ) + 32 ); 120 setFixedWidth(fm.width( timeString ) + 32 );
120 121
121 // Highlight Background and Textcolor change from default 122 // Highlight Background and Textcolor change from default
122 QPalette palette = QWidget::palette(); 123 QPalette palette = QWidget::palette();
123 unsigned char red, green, blue; 124 unsigned char red, green, blue;
124 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; 125 red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10;
125 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; 126 green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10;
126 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; 127 blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10;
@@ -229,25 +230,25 @@ void KOTimeEdit::keyReleaseEvent(QKeyEvent *e)
229} 230}
230void KOTimeEdit::setSelect( int from, int to ) 231void KOTimeEdit::setSelect( int from, int to )
231{ 232{
232 if ( KOPrefs::instance()->mHightlightDateTimeEdit) 233 if ( KOPrefs::instance()->mHightlightDateTimeEdit)
233 lineEdit()->setSelection( from , to ); 234 lineEdit()->setSelection( from , to );
234} 235}
235 236
236 237
237void KOTimeEdit::keyPressEvent(QKeyEvent *e) 238void 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() );
246 return; 247 return;
247 } 248 }
248 if (! e->isAutoRepeat() ) { 249 if (! e->isAutoRepeat() ) {
249 mFlagKeyPressed = true; 250 mFlagKeyPressed = true;
250 } 251 }
251 // Tap -> Focus Next Widget 252 // Tap -> Focus Next Widget
252 if ( e->key() == Key_Tab ) { 253 if ( e->key() == Key_Tab ) {
253 QComboBox::keyPressEvent(e); 254 QComboBox::keyPressEvent(e);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fbfcd20..dc2026b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -216,28 +216,27 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
216 qApp->processEvents(); 216 qApp->processEvents();
217 } 217 }
218 } 218 }
219 mView->saveCalendar( defaultFileName() ); 219 mView->saveCalendar( defaultFileName() );
220 newFile = true; 220 newFile = true;
221 } 221 }
222 222
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 223 QTime neededSaveTime = QDateTime::currentDateTime().time();
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 * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 235 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 236 SLOT( slotModifiedChanged( bool ) ) );
238 237
239 238
240 connect( mView, SIGNAL( tempDisableBR(bool) ), 239 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) ); 240 SLOT( disableBR(bool) ) );
242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 241 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
243 mView->setModified( false ); 242 mView->setModified( false );