summaryrefslogtreecommitdiffabout
path: root/libkdepim/kpimglobalprefs.cpp
authorzautrix <zautrix>2004-09-22 03:08:05 (UTC)
committer zautrix <zautrix>2004-09-22 03:08:05 (UTC)
commitd63eac7a612a9724705bc58ad98c65c6ac052d07 (patch) (unidiff)
treedc584a0ddcbd5f828ea36b86b6af640e46e137f2 /libkdepim/kpimglobalprefs.cpp
parent633522024e48efc423155a04b71083a03696211d (diff)
downloadkdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.zip
kdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.tar.gz
kdepimpi-d63eac7a612a9724705bc58ad98c65c6ac052d07.tar.bz2
connected global config
Diffstat (limited to 'libkdepim/kpimglobalprefs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kpimglobalprefs.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 12a503d..a896a0f 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,115 +1,132 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
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 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kstaticdeleter.h> 35#include <kstaticdeleter.h>
36 36
37#include "kpimglobalprefs.h" 37#include "kpimglobalprefs.h"
38 38
39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 39KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
40static KStaticDeleter<KPimGlobalPrefs> staticDeleter; 40static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
41 41
42 42
43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 43KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
44 : KPrefs("microkdeglobalrc") 44 : KPrefs("microkdeglobalrc")
45{ 45{
46 46
47 KPrefs::setCurrentGroup("Locale"); 47 KPrefs::setCurrentGroup("Locale");
48 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 48 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
49 addItemInt("PreferredTime",&mPreferredTime,0); 49 addItemInt("PreferredTime",&mPreferredTime,0);
50 addItemInt("PreferredDate",&mPreferredDate,0); 50 addItemInt("PreferredDate",&mPreferredDate,0);
51 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 51 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
52 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 52 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
53 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 53 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
54 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 54 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
55 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 55 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
56 56
57 KPrefs::setCurrentGroup("Time & Date"); 57 KPrefs::setCurrentGroup("Time & Date");
58 58
59 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 59 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
60 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 60 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
61 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 61 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
62 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 62 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
63 63
64 64
65 65
66 66
67 KPrefs::setCurrentGroup( "ExternalApplications" ); 67 KPrefs::setCurrentGroup( "ExternalApplications" );
68 68
69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
70 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 70 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
75 75
76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
80 80
81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
82 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 82 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
85 85
86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
87 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 87 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
90 90
91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
92 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 92 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
95 95
96 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC ); 96 addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
97 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 97 addItemString( "SIPChannel", &mSipOtherChannel, "" );
98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
100 100
101} 101}
102 102
103void KPimGlobalPrefs::setGlobalConfig()
104{
105
106 KGlobal::locale()->setHore24Format( !mPreferredTime );
107 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
108 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
109 KGlobal::locale()->setLanguage( mPreferredLanguage );
110 QString dummy = mUserDateFormatLong;
111 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
112 dummy = mUserDateFormatShort;
113 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
114 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
115 mDaylightsavingStart,
116 mDaylightsavingEnd );
117 KGlobal::locale()->setTimezone( mTimeZoneId );
118
119}
103KPimGlobalPrefs::~KPimGlobalPrefs() 120KPimGlobalPrefs::~KPimGlobalPrefs()
104{ 121{
105} 122}
106 123
107KPimGlobalPrefs *KPimGlobalPrefs::instance() 124KPimGlobalPrefs *KPimGlobalPrefs::instance()
108{ 125{
109 if ( !sInstance ) { 126 if ( !sInstance ) {
110 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() ); 127 sInstance = staticDeleter.setObject( new KPimGlobalPrefs() );
111 sInstance->readConfig(); 128 sInstance->readConfig();
112 } 129 }
113 130
114 return sInstance; 131 return sInstance;
115} 132}