summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-10-23 15:37:38 (UTC)
committer zautrix <zautrix>2004-10-23 15:37:38 (UTC)
commit5415db4a06862b57539de051e2e82c8d8f3a5b48 (patch) (unidiff)
treea0a5719246aba7d2a5e36b8d8601193ba9e907b3 /libkdepim
parent54c77b2331f9afe90643c6d1343a7f5543577b71 (diff)
downloadkdepimpi-5415db4a06862b57539de051e2e82c8d8f3a5b48.zip
kdepimpi-5415db4a06862b57539de051e2e82c8d8f3a5b48.tar.gz
kdepimpi-5415db4a06862b57539de051e2e82c8d8f3a5b48.tar.bz2
compile fixes
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kpimglobalprefs.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 0fdc3e4..e8fd2d1 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -7,64 +7,65 @@
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 <qregexp.h> 37#include <qregexp.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <stdlib.h>
39#include <qtextstream.h> 40#include <qtextstream.h>
40#include <qapplication.h> 41#include <qapplication.h>
41#include "kpimglobalprefs.h" 42#include "kpimglobalprefs.h"
42 43
43KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 44KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
44static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; 45static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP;
45 46
46 47
47KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 48KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
48 : KPrefs("microkdeglobalrc") 49 : KPrefs("microkdeglobalrc")
49{ 50{
50 mLocaleDict = 0; 51 mLocaleDict = 0;
51 KPrefs::setCurrentGroup("Locale"); 52 KPrefs::setCurrentGroup("Locale");
52 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 53 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
53 addItemInt("PreferredTime",&mPreferredTime,0); 54 addItemInt("PreferredTime",&mPreferredTime,0);
54 addItemInt("PreferredDate",&mPreferredDate,0); 55 addItemInt("PreferredDate",&mPreferredDate,0);
55 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 56 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
56 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 57 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
57 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 58 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
58 59
59 KPrefs::setCurrentGroup("Time & Date"); 60 KPrefs::setCurrentGroup("Time & Date");
60 61
61 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); 62 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") );
62 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 63 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
63 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); 64 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false);
64 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 65 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
65 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 66 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
66 67
67 KPrefs::setCurrentGroup( "ExternalApplications" ); 68 KPrefs::setCurrentGroup( "ExternalApplications" );
68 69
69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
70 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 71 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
@@ -82,67 +83,67 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
82 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 83 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
85 86
86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
87 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 88 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
90 91
91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
92 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 93 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
95 96
96 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); 97 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
97 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 98 addItemString( "SIPChannel", &mSipOtherChannel, "" );
98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
100 101
101 KPrefs::setCurrentGroup( "PhoneAccess" ); 102 KPrefs::setCurrentGroup( "PhoneAccess" );
102 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); 103 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
103 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); 104 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
104 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); 105 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
105 106
106} 107}
107 108
108void KPimGlobalPrefs::setGlobalConfig() 109void KPimGlobalPrefs::setGlobalConfig()
109{ 110{
110 if ( mLocaleDict == 0 ) { 111 if ( mLocaleDict == 0 ) {
111 QString fileName ; 112 QString fileName ;
112 QString name = KGlobal::getAppName() +"/"; 113 QString name = KGlobal::getAppName() +"/";
113#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
114 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name 115 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name;
115#else 116#else
116 fileName = qApp->applicationDirPath () + "/kdepim/"+ name; 117 fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
117#endif 118#endif
118 mLocaleDict = 0; 119 mLocaleDict = 0;
119 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { 120 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
120 121
121 if ( mPreferredLanguage == 1 ) 122 if ( mPreferredLanguage == 1 )
122 fileName = fileName+"germantranslation.txt"; 123 fileName = fileName+"germantranslation.txt";
123 else if ( mPreferredLanguage == 4 ) 124 else if ( mPreferredLanguage == 4 )
124 fileName = fileName+"usertranslation.txt"; 125 fileName = fileName+"usertranslation.txt";
125 else if ( mPreferredLanguage == 2 ) 126 else if ( mPreferredLanguage == 2 )
126 fileName = fileName+"frenchtranslation.txt"; 127 fileName = fileName+"frenchtranslation.txt";
127 else if ( mPreferredLanguage == 3 ) 128 else if ( mPreferredLanguage == 3 )
128 fileName = fileName+"italiantranslation.txt"; 129 fileName = fileName+"italiantranslation.txt";
129 QFile file( fileName ); 130 QFile file( fileName );
130 if (file.open( IO_ReadOnly ) ) { 131 if (file.open( IO_ReadOnly ) ) {
131 QTextStream ts( &file ); 132 QTextStream ts( &file );
132 ts.setEncoding( QTextStream::Latin1 ); 133 ts.setEncoding( QTextStream::Latin1 );
133 //ts.setCodec( QTextCodec::latin1 ); 134 //ts.setCodec( QTextCodec::latin1 );
134 QString text = ts.read(); 135 QString text = ts.read();
135 file.close(); 136 file.close();
136 text.replace( QRegExp("\\\\n"), "\n" ); 137 text.replace( QRegExp("\\\\n"), "\n" );
137 QString line; 138 QString line;
138 QString we; 139 QString we;
139 QString wt; 140 QString wt;
140 int br = 0; 141 int br = 0;
141 int nbr; 142 int nbr;
142 nbr = text.find ( "},", br ); 143 nbr = text.find ( "},", br );
143 line = text.mid( br, nbr - br ); 144 line = text.mid( br, nbr - br );
144 br = nbr+1; 145 br = nbr+1;
145 int se, ee, st, et; 146 int se, ee, st, et;
146 mLocaleDict = new QDict<QString>; 147 mLocaleDict = new QDict<QString>;
147 mLocaleDict->setAutoDelete( true ); 148 mLocaleDict->setAutoDelete( true );
148 QString end = "{ \"\",\"\" }"; 149 QString end = "{ \"\",\"\" }";