summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/contactlistview.cpp4
-rw-r--r--kmicromail/koprefs.cpp12
-rw-r--r--kmicromail/koprefs.h2
-rw-r--r--korganizer/calendarview.cpp12
-rw-r--r--korganizer/kolistview.cpp5
-rw-r--r--korganizer/koprefs.cpp15
-rw-r--r--korganizer/koprefs.h9
-rw-r--r--libkdepim/kpimglobalprefs.cpp2
-rw-r--r--microkde/kdecore/klocale.cpp50
9 files changed, 42 insertions, 69 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index 5fb4163..ad43970 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -111,146 +111,146 @@ void DynamicTip::maybeTip( const QPoint &pos )
111 while ( i < int(notes.length()) ) { 111 while ( i < int(notes.length()) ) {
112 doBreak = FALSE; 112 doBreak = FALSE;
113 if ( notes[i] != '\n' ) 113 if ( notes[i] != '\n' )
114 linew += fm.width( notes[i] ); 114 linew += fm.width( notes[i] );
115 115
116 if ( lastSpace >= a && notes[i] != '\n' ) 116 if ( lastSpace >= a && notes[i] != '\n' )
117 if (linew >= parentWidget()->width()) { 117 if (linew >= parentWidget()->width()) {
118 doBreak = TRUE; 118 doBreak = TRUE;
119 if ( lastSpace > a ) { 119 if ( lastSpace > a ) {
120 i = lastSpace; 120 i = lastSpace;
121 linew = lastw; 121 linew = lastw;
122 } 122 }
123 else 123 else
124 i = QMAX( a, i-1 ); 124 i = QMAX( a, i-1 );
125 } 125 }
126 126
127 if ( notes[i] == '\n' || doBreak ) { 127 if ( notes[i] == '\n' || doBreak ) {
128 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; 128 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n";
129 129
130 a = i + 1; 130 a = i + 1;
131 lastSpace = a; 131 lastSpace = a;
132 linew = 0; 132 linew = 0;
133 } 133 }
134 134
135 if ( notes[i].isSpace() ) { 135 if ( notes[i].isSpace() ) {
136 lastSpace = i; 136 lastSpace = i;
137 lastw = linew; 137 lastw = linew;
138 } 138 }
139 139
140 if ( lastSpace <= a ) { 140 if ( lastSpace <= a ) {
141 lastw = linew; 141 lastw = linew;
142 } 142 }
143 143
144 ++i; 144 ++i;
145 } 145 }
146 } 146 }
147 147
148 tip( r, s ); 148 tip( r, s );
149 } 149 }
150 else 150 else
151 hide(); 151 hide();
152 ishidden = !ishidden; 152 ishidden = !ishidden;
153 153
154} 154}
155 155
156/////////////////////////// 156///////////////////////////
157// ContactListViewItem Methods 157// ContactListViewItem Methods
158 158
159ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, 159ContactListViewItem::ContactListViewItem(const KABC::Addressee &a,
160 ContactListView *parent, 160 ContactListView *parent,
161 KABC::AddressBook *doc, 161 KABC::AddressBook *doc,
162 const KABC::Field::List &fields ) 162 const KABC::Field::List &fields )
163 : KListViewItem(parent), mAddressee(a), mFields( fields ), 163 : KListViewItem(parent), mAddressee(a), mFields( fields ),
164 parentListView( parent ), mDocument(doc) 164 parentListView( parent ), mDocument(doc)
165{ 165{
166 refresh(); 166 refresh();
167} 167}
168 168
169QString ContactListViewItem::key(int column, bool ascending) const 169QString ContactListViewItem::key(int column, bool ascending) const
170{ 170{
171#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
172 int lan = KGlobal::locale()->language(); 172 int lan = KGlobal::locale()->language();
173 //qDebug("language %d ", lan); 173 //qDebug("language %d ", lan);
174 if ( lan == 1 ) { //GERMAN 174 if ( lan == 1 ) { //GERMAN
175 QString ret = QListViewItem::key(column, ascending).utf8(); 175 QString ret = QListViewItem::key(column, ascending).lower().utf8();
176 int start = -1; 176 int start = -1;
177 while ( (start = ret.find( 'ä', start+1)) > 0 ) { 177 while ( (start = ret.find( 'ä', start+1)) > 0 ) {
178 ret.at(start-1) = 'a'; 178 ret.at(start-1) = 'a';
179 } 179 }
180 start = -1; 180 start = -1;
181 while ( (start = ret.find( 'ö', start+1)) > 0 ) { 181 while ( (start = ret.find( 'ö', start+1)) > 0 ) {
182 ret.at(start-1) = 'o'; 182 ret.at(start-1) = 'o';
183 } 183 }
184 start = -1; 184 start = -1;
185 while ( (start = ret.find( 'ü', start+1)) > 0 ) { 185 while ( (start = ret.find( 'ü', start+1)) > 0 ) {
186 ret.at(start-1) = 'o'; 186 ret.at(start-1) = 'o';
187 } 187 }
188 start = -1; 188 start = -1;
189 while ( (start = ret.find( 'ß', start+1)) > 0 ) { 189 while ( (start = ret.find( 'ß', start+1)) > 0 ) {
190 ret.at(start-1) = 's'; 190 ret.at(start-1) = 's';
191 } 191 }
192 //qDebug("conv string %s ", ret.latin1()); 192 qDebug("conv string %s ", ret.latin1());
193 193
194 return ret; 194 return ret;
195 195
196 } 196 }
197 else 197 else
198#endif 198#endif
199 return QListViewItem::key(column, ascending).lower(); 199 return QListViewItem::key(column, ascending).lower();
200} 200}
201 201
202void ContactListViewItem::paintCell(QPainter * p, 202void ContactListViewItem::paintCell(QPainter * p,
203 const QColorGroup & cg, 203 const QColorGroup & cg,
204 int column, 204 int column,
205 int width, 205 int width,
206 int align) 206 int align)
207{ 207{
208 KListViewItem::paintCell(p, cg, column, width, align); 208 KListViewItem::paintCell(p, cg, column, width, align);
209 209
210 if ( !p ) 210 if ( !p )
211 return; 211 return;
212 212
213 if (parentListView->singleLine()) { 213 if (parentListView->singleLine()) {
214 p->setPen( parentListView->alternateColor() ); 214 p->setPen( parentListView->alternateColor() );
215 p->drawLine( 0, height() - 1, width, height() - 1 ); 215 p->drawLine( 0, height() - 1, width, height() - 1 );
216 } 216 }
217} 217}
218 218
219 219
220ContactListView *ContactListViewItem::parent() 220ContactListView *ContactListViewItem::parent()
221{ 221{
222 return parentListView; 222 return parentListView;
223} 223}
224 224
225 225
226void ContactListViewItem::refresh() 226void ContactListViewItem::refresh()
227{ 227{
228 // Update our addressee, since it may have changed else were 228 // Update our addressee, since it may have changed else were
229 mAddressee = mDocument->findByUid(mAddressee.uid()); 229 mAddressee = mDocument->findByUid(mAddressee.uid());
230 if (mAddressee.isEmpty()) 230 if (mAddressee.isEmpty())
231 return; 231 return;
232 232
233 int i = 0; 233 int i = 0;
234 KABC::Field::List::ConstIterator it; 234 KABC::Field::List::ConstIterator it;
235 for( it = mFields.begin(); it != mFields.end(); ++it ) { 235 for( it = mFields.begin(); it != mFields.end(); ++it ) {
236 setText( i++, (*it)->value( mAddressee ) ); 236 setText( i++, (*it)->value( mAddressee ) );
237 } 237 }
238} 238}
239 239
240/////////////////////////////// 240///////////////////////////////
241// ContactListView 241// ContactListView
242 242
243ContactListView::ContactListView(KAddressBookTableView *view, 243ContactListView::ContactListView(KAddressBookTableView *view,
244 KABC::AddressBook* /* doc */, 244 KABC::AddressBook* /* doc */,
245 QWidget *parent, 245 QWidget *parent,
246 const char *name ) 246 const char *name )
247 : KListView( parent, name ), 247 : KListView( parent, name ),
248 pabWidget( view ), 248 pabWidget( view ),
249 oldColumn( 0 ) 249 oldColumn( 0 )
250{ 250{
251 mABackground = true; 251 mABackground = true;
252 mSingleLine = false; 252 mSingleLine = false;
253 mToolTips = true; 253 mToolTips = true;
254#ifndef KAB_EMBEDDED 254#ifndef KAB_EMBEDDED
255 mAlternateColor = KGlobalSettings::alternateBackgroundColor(); 255 mAlternateColor = KGlobalSettings::alternateBackgroundColor();
256#else //KAB_EMBEDDED 256#else //KAB_EMBEDDED
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index c0200ff..8143b6f 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -6,123 +6,117 @@
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#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
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 44
45#include "koprefs.h" 45#include "koprefs.h"
46#include "mainwindow.h" 46#include "mainwindow.h"
47 47
48 48
49KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
50static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
51 51
52KOPrefs::KOPrefs() : 52KOPrefs::KOPrefs() :
53 KPimPrefs("kopiemailrc") 53 KPimPrefs("kopiemailrc")
54{ 54{
55 mAppFont = QFont("helvetica",12); 55 mAppFont = QFont("helvetica",12);
56 mComposeFont = QFont("helvetica",12); 56 mComposeFont = QFont("helvetica",12);
57 mReadFont = QFont("helvetica",12); 57 mReadFont = QFont("helvetica",12);
58 58
59 KPrefs::setCurrentGroup("General"); 59 KPrefs::setCurrentGroup("General");
60 addItemString("SenderName",&mName,i18n ("Please set at") ); 60 addItemString("SenderName",&mName,i18n ("Please set at") );
61 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); 61 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") );
62 addItemBool("ViewMailAsHtml",&mViewAsHtml,false); 62 addItemBool("ViewMailAsHtml",&mViewAsHtml,false);
63 addItemBool("SendMailLater",&mSendLater,true); 63 addItemBool("SendMailLater",&mSendLater,true);
64 addItemBool("UseKapi",&mUseKapi,false); 64 addItemBool("UseKapi",&mUseKapi,false);
65 65
66 KPrefs::setCurrentGroup("Fonts"); 66 KPrefs::setCurrentGroup("Fonts");
67 addItemFont("Application Font",&mAppFont); 67 addItemFont("Application Font",&mAppFont);
68 addItemFont("Compose Font",&mComposeFont); 68 addItemFont("Compose Font",&mComposeFont);
69 addItemFont("Read Font",&mReadFont); 69 addItemFont("Read Font",&mReadFont);
70 70 fillMailDefaults();
71 71
72} 72}
73 73
74 74
75KOPrefs::~KOPrefs() 75KOPrefs::~KOPrefs()
76{ 76{
77 if (mInstance == this) 77 if (mInstance == this)
78 mInstance = insd.setObject(0); 78 mInstance = insd.setObject(0);
79 79
80} 80}
81 81
82 82
83KOPrefs *KOPrefs::instance() 83KOPrefs *KOPrefs::instance()
84{ 84{
85 if (!mInstance) { 85 if (!mInstance) {
86 mInstance = insd.setObject(new KOPrefs()); 86 mInstance = insd.setObject(new KOPrefs());
87 mInstance->readConfig(); 87 mInstance->readConfig();
88 } 88 }
89 89
90 return mInstance; 90 return mInstance;
91} 91}
92 92
93void KOPrefs::usrSetDefaults() 93void KOPrefs::usrSetDefaults()
94{ 94{
95 95
96} 96}
97 97
98void KOPrefs::fillMailDefaults() 98void KOPrefs::fillMailDefaults()
99{ 99{
100 if (mName.isEmpty()) mName = i18n("Anonymous"); 100 if (mName.isEmpty()) mName = i18n ("Please set at");
101 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 101 if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB");
102} 102}
103 103
104void KOPrefs::setTimeZoneIdDefault()
105{
106 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)");
107}
108
109
110void KOPrefs::usrReadConfig() 104void KOPrefs::usrReadConfig()
111{ 105{
112 106
113 KPimPrefs::usrReadConfig(); 107 KPimPrefs::usrReadConfig();
114} 108}
115 109
116 110
117void KOPrefs::usrWriteConfig() 111void KOPrefs::usrWriteConfig()
118{ 112{
119 113
120 KPimPrefs::usrWriteConfig(); 114 KPimPrefs::usrWriteConfig();
121} 115}
122 116
123 117
124 118
125KConfig* KOPrefs::getConfig() 119KConfig* KOPrefs::getConfig()
126{ 120{
127 return config(); 121 return config();
128} 122}
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h
index c42d787..a47642b 100644
--- a/kmicromail/koprefs.h
+++ b/kmicromail/koprefs.h
@@ -1,81 +1,79 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 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#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26#include <qdict.h> 26#include <qdict.h>
27 27
28#include <libkdepim/kpimprefs.h> 28#include <libkdepim/kpimprefs.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 virtual ~KOPrefs(); 38 virtual ~KOPrefs();
39 39
40 /** Get instance of KOPrefs. It is made sure that there is only one 40 /** Get instance of KOPrefs. It is made sure that there is only one
41 instance. */ 41 instance. */
42 static KOPrefs *instance(); 42 static KOPrefs *instance();
43 43
44 /** Set preferences to default values */ 44 /** Set preferences to default values */
45 void usrSetDefaults(); 45 void usrSetDefaults();
46 46
47 /** Read preferences from config file */ 47 /** Read preferences from config file */
48 void usrReadConfig(); 48 void usrReadConfig();
49 49
50 /** Write preferences to config file */ 50 /** Write preferences to config file */
51 void usrWriteConfig(); 51 void usrWriteConfig();
52 void setCategoryDefaults(){;}; 52 void setCategoryDefaults(){;};
53 53
54 protected: 54 protected:
55 void setTimeZoneIdDefault();
56 55
57 /** Fill empty mail fields with default values. */ 56 /** Fill empty mail fields with default values. */
58 void fillMailDefaults(); 57 void fillMailDefaults();
59 58
60 private: 59 private:
61 /** Constructor disabled for public. Use instance() to create a KOPrefs 60 /** Constructor disabled for public. Use instance() to create a KOPrefs
62 object. */ 61 object. */
63 KOPrefs(); 62 KOPrefs();
64 63
65 static KOPrefs *mInstance; 64 static KOPrefs *mInstance;
66 QDict<QString> *mLocaleDict; 65 QDict<QString> *mLocaleDict;
67 public: 66 public:
68 // preferences data 67 // preferences data
69 KConfig* getConfig(); 68 KConfig* getConfig();
70 QFont mAppFont; 69 QFont mAppFont;
71 QFont mComposeFont; 70 QFont mComposeFont;
72 QFont mReadFont; 71 QFont mReadFont;
73 QFont mTimeZoneId;
74 QString mName; 72 QString mName;
75 QString mEmail; 73 QString mEmail;
76 bool mSendLater, mViewAsHtml, mUseKapi; 74 bool mSendLater, mViewAsHtml, mUseKapi;
77 private: 75 private:
78 76
79}; 77};
80 78
81#endif 79#endif
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 0306e07..e64d83a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1138,160 +1138,160 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1138 if ( inR->type() == "Todo" ) { 1138 if ( inR->type() == "Todo" ) {
1139 Todo * t = (Todo*)inR; 1139 Todo * t = (Todo*)inR;
1140 if ( t->hasDueDate() ) 1140 if ( t->hasDueDate() )
1141 dt = t->dtDue(); 1141 dt = t->dtDue();
1142 else 1142 else
1143 dt = cur.addSecs( 62 ); 1143 dt = cur.addSecs( 62 );
1144 } 1144 }
1145 else if (inR->type() == "Event" ) { 1145 else if (inR->type() == "Event" ) {
1146 bool ok; 1146 bool ok;
1147 dt = inR->getNextOccurence( cur, &ok ); 1147 dt = inR->getNextOccurence( cur, &ok );
1148 if ( !ok ) 1148 if ( !ok )
1149 dt = cur.addSecs( -62 ); 1149 dt = cur.addSecs( -62 );
1150 } 1150 }
1151 else 1151 else
1152 dt = inR->dtStart(); 1152 dt = inR->dtStart();
1153 if ( dt < cur || dt > end ) { 1153 if ( dt < cur || dt > end ) {
1154 remote->deleteIncidence( inR ); 1154 remote->deleteIncidence( inR );
1155 ++delFut; 1155 ++delFut;
1156 } 1156 }
1157 inR = er.next(); 1157 inR = er.next();
1158 } 1158 }
1159 } 1159 }
1160 bar.hide(); 1160 bar.hide();
1161 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1161 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1162 eventLSync->setReadOnly( false ); 1162 eventLSync->setReadOnly( false );
1163 eventLSync->setDtStart( mLastCalendarSync ); 1163 eventLSync->setDtStart( mLastCalendarSync );
1164 eventRSync->setDtStart( mLastCalendarSync ); 1164 eventRSync->setDtStart( mLastCalendarSync );
1165 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1165 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1166 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1166 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1167 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1167 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1168 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1168 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1169 eventLSync->setReadOnly( true ); 1169 eventLSync->setReadOnly( true );
1170 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal... 1170 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncKDE) // kde is abnormal...
1171 remote->addEvent( eventRSync ); 1171 remote->addEvent( eventRSync );
1172 else 1172 else
1173 delete eventRSync; 1173 delete eventRSync;
1174 QString mes; 1174 QString mes;
1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1175 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1176 QString delmess; 1176 QString delmess;
1177 if ( delFut ) { 1177 if ( delFut ) {
1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1178 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut);
1179 mes += delmess; 1179 mes += delmess;
1180 } 1180 }
1181 if ( mSyncManager->mShowSyncSummary ) { 1181 if ( mSyncManager->mShowSyncSummary ) {
1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1182 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1183 } 1183 }
1184 qDebug( mes ); 1184 qDebug( mes );
1185 mCalendar->checkAlarmForIncidence( 0, true ); 1185 mCalendar->checkAlarmForIncidence( 0, true );
1186 return syncOK; 1186 return syncOK;
1187} 1187}
1188 1188
1189void CalendarView::setSyncDevice( QString s ) 1189void CalendarView::setSyncDevice( QString s )
1190{ 1190{
1191 mCurrentSyncDevice= s; 1191 mCurrentSyncDevice= s;
1192} 1192}
1193void CalendarView::setSyncName( QString s ) 1193void CalendarView::setSyncName( QString s )
1194{ 1194{
1195 mCurrentSyncName= s; 1195 mCurrentSyncName= s;
1196} 1196}
1197bool CalendarView::syncCalendar(QString filename, int mode) 1197bool CalendarView::syncCalendar(QString filename, int mode)
1198{ 1198{
1199 //qDebug("syncCalendar %s ", filename.latin1()); 1199 //qDebug("syncCalendar %s ", filename.latin1());
1200 mGlobalSyncMode = SYNC_MODE_NORMAL; 1200 mGlobalSyncMode = SYNC_MODE_NORMAL;
1201 CalendarLocal* calendar = new CalendarLocal(); 1201 CalendarLocal* calendar = new CalendarLocal();
1202 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1202 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1203 FileStorage* storage = new FileStorage( calendar ); 1203 FileStorage* storage = new FileStorage( calendar );
1204 bool syncOK = false; 1204 bool syncOK = false;
1205 storage->setFileName( filename ); 1205 storage->setFileName( filename );
1206 // qDebug("loading ... "); 1206 // qDebug("loading ... ");
1207 if ( storage->load() ) { 1207 if ( storage->load() ) {
1208 getEventViewerDialog()->setSyncMode( true ); 1208 getEventViewerDialog()->setSyncMode( true );
1209 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1209 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1210 getEventViewerDialog()->setSyncMode( false ); 1210 getEventViewerDialog()->setSyncMode( false );
1211 if ( syncOK ) { 1211 if ( syncOK ) {
1212 if ( mSyncManager->mWriteBackFile ) 1212 if ( mSyncManager->mWriteBackFile )
1213 { 1213 {
1214 storage->setSaveFormat( new ICalFormat() ); 1214 storage->setSaveFormat( new ICalFormat() );
1215 storage->save(); 1215 storage->save();
1216 } 1216 }
1217 } 1217 }
1218 setModified( true ); 1218 setModified( true );
1219 } 1219 }
1220 delete storage; 1220 delete storage;
1221 delete calendar; 1221 delete calendar;
1222 if ( syncOK ) 1222 if ( syncOK )
1223 updateView(); 1223 updateView();
1224 return syncOK; 1224 return syncOK;
1225} 1225}
1226 1226
1227void CalendarView::syncExternal( int mode ) 1227void CalendarView::syncExternal( int mode )
1228{ 1228{
1229 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1229 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1230 1230
1231 qApp->processEvents(); 1231 qApp->processEvents();
1232 CalendarLocal* calendar = new CalendarLocal(); 1232 CalendarLocal* calendar = new CalendarLocal();
1233 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1233 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1234 bool syncOK = false; 1234 bool syncOK = false;
1235 bool loadSuccess = false; 1235 bool loadSuccess = false;
1236 PhoneFormat* phoneFormat = 0; 1236 PhoneFormat* phoneFormat = 0;
1237 emit tempDisableBR(true); 1237 emit tempDisableBR(true);
1238#ifndef DESKTOP_VERSION 1238#ifndef DESKTOP_VERSION
1239 SharpFormat* sharpFormat = 0; 1239 SharpFormat* sharpFormat = 0;
1240 if ( mode == 0 ) { // sharp 1240 if ( mode == 0 ) { // sharp
1241 sharpFormat = new SharpFormat () ; 1241 sharpFormat = new SharpFormat () ;
1242 loadSuccess = sharpFormat->load( calendar, mCalendar ); 1242 loadSuccess = sharpFormat->load( calendar, mCalendar );
1243 1243
1244 } else 1244 } else
1245#endif 1245#endif
1246 if ( mode == 1 ) { // phone 1246 if ( mode == 1 ) { // phone
1247 phoneFormat = new PhoneFormat (mCurrentSyncDevice, 1247 phoneFormat = new PhoneFormat (mCurrentSyncDevice,
1248 mSyncManager->mPhoneDevice, 1248 mSyncManager->mPhoneDevice,
1249 mSyncManager->mPhoneConnection, 1249 mSyncManager->mPhoneConnection,
1250 mSyncManager->mPhoneModel); 1250 mSyncManager->mPhoneModel);
1251 loadSuccess = phoneFormat->load( calendar,mCalendar); 1251 loadSuccess = phoneFormat->load( calendar,mCalendar);
1252 1252
1253 } else { 1253 } else {
1254 emit tempDisableBR(false); 1254 emit tempDisableBR(false);
1255 return; 1255 return;
1256 } 1256 }
1257 if ( loadSuccess ) { 1257 if ( loadSuccess ) {
1258 getEventViewerDialog()->setSyncMode( true ); 1258 getEventViewerDialog()->setSyncMode( true );
1259 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1259 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1260 getEventViewerDialog()->setSyncMode( false ); 1260 getEventViewerDialog()->setSyncMode( false );
1261 qApp->processEvents(); 1261 qApp->processEvents();
1262 if ( syncOK ) { 1262 if ( syncOK ) {
1263 if ( mSyncManager->mWriteBackFile ) 1263 if ( mSyncManager->mWriteBackFile )
1264 { 1264 {
1265 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1265 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1266 Incidence* inc = iL.first(); 1266 Incidence* inc = iL.first();
1267 if ( phoneFormat ) { 1267 if ( phoneFormat ) {
1268 while ( inc ) { 1268 while ( inc ) {
1269 inc->removeID(mCurrentSyncDevice); 1269 inc->removeID(mCurrentSyncDevice);
1270 inc = iL.next(); 1270 inc = iL.next();
1271 } 1271 }
1272 } 1272 }
1273#ifndef DESKTOP_VERSION 1273#ifndef DESKTOP_VERSION
1274 if ( sharpFormat ) 1274 if ( sharpFormat )
1275 sharpFormat->save(calendar); 1275 sharpFormat->save(calendar);
1276#endif 1276#endif
1277 if ( phoneFormat ) 1277 if ( phoneFormat )
1278 phoneFormat->save(calendar); 1278 phoneFormat->save(calendar);
1279 iL = calendar->rawIncidences(); 1279 iL = calendar->rawIncidences();
1280 inc = iL.first(); 1280 inc = iL.first();
1281 Incidence* loc; 1281 Incidence* loc;
1282 while ( inc ) { 1282 while ( inc ) {
1283 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1283 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1284 loc = mCalendar->incidence(inc->uid() ); 1284 loc = mCalendar->incidence(inc->uid() );
1285 if ( loc ) { 1285 if ( loc ) {
1286 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); 1286 loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) );
1287 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); 1287 loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) );
1288 } 1288 }
1289 } 1289 }
1290 inc = iL.next(); 1290 inc = iL.next();
1291 } 1291 }
1292 Incidence* lse = getLastSyncEvent(); 1292 Incidence* lse = getLastSyncEvent();
1293 if ( lse ) { 1293 if ( lse ) {
1294 lse->setReadOnly( false ); 1294 lse->setReadOnly( false );
1295 lse->setDescription( "" ); 1295 lse->setDescription( "" );
1296 lse->setReadOnly( true ); 1296 lse->setReadOnly( true );
1297 } 1297 }
@@ -1437,129 +1437,129 @@ void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthd
1437 KCal::Attendee::ReqParticipant,uid) ; 1437 KCal::Attendee::ReqParticipant,uid) ;
1438 if ( addAnniversary( anniversary, assembledName, a, false ) ) 1438 if ( addAnniversary( anniversary, assembledName, a, false ) )
1439 ++addCount; 1439 ++addCount;
1440 } 1440 }
1441 } 1441 }
1442 1442
1443 updateView(); 1443 updateView();
1444 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); 1444 topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!"));
1445 1445
1446 } 1446 }
1447 1447
1448} 1448}
1449 1449
1450 1450
1451 1451
1452bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) 1452bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday)
1453{ 1453{
1454 //qDebug("addAnni "); 1454 //qDebug("addAnni ");
1455 Event * ev = new Event(); 1455 Event * ev = new Event();
1456 if ( a ) { 1456 if ( a ) {
1457 ev->addAttendee( a ); 1457 ev->addAttendee( a );
1458 } 1458 }
1459 QString kind; 1459 QString kind;
1460 if ( birthday ) 1460 if ( birthday )
1461 kind = i18n( "Birthday" ); 1461 kind = i18n( "Birthday" );
1462 else 1462 else
1463 kind = i18n( "Anniversary" ); 1463 kind = i18n( "Anniversary" );
1464 ev->setSummary( name + " - " + kind ); 1464 ev->setSummary( name + " - " + kind );
1465 ev->setOrganizer( "nobody@nowhere" ); 1465 ev->setOrganizer( "nobody@nowhere" );
1466 ev->setCategories( kind ); 1466 ev->setCategories( kind );
1467 ev->setDtStart( QDateTime(date) ); 1467 ev->setDtStart( QDateTime(date) );
1468 ev->setDtEnd( QDateTime(date) ); 1468 ev->setDtEnd( QDateTime(date) );
1469 ev->setFloats( true ); 1469 ev->setFloats( true );
1470 Recurrence * rec = ev->recurrence(); 1470 Recurrence * rec = ev->recurrence();
1471 rec->setYearly(Recurrence::rYearlyMonth,1,-1); 1471 rec->setYearly(Recurrence::rYearlyMonth,1,-1);
1472 rec->addYearlyNum( date.month() ); 1472 rec->addYearlyNum( date.month() );
1473 if ( !mCalendar->addAnniversaryNoDup( ev ) ) { 1473 if ( !mCalendar->addAnniversaryNoDup( ev ) ) {
1474 delete ev; 1474 delete ev;
1475 return false; 1475 return false;
1476 } 1476 }
1477 return true; 1477 return true;
1478 1478
1479} 1479}
1480bool CalendarView::importQtopia( const QString &categories, 1480bool CalendarView::importQtopia( const QString &categories,
1481 const QString &datebook, 1481 const QString &datebook,
1482 const QString &todolist ) 1482 const QString &todolist )
1483{ 1483{
1484 1484
1485 QtopiaFormat qtopiaFormat; 1485 QtopiaFormat qtopiaFormat;
1486 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1486 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1487 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); 1487 if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories );
1488 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); 1488 if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook );
1489 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); 1489 if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist );
1490 1490
1491 updateView(); 1491 updateView();
1492 return true; 1492 return true;
1493 1493
1494#if 0 1494#if 0
1495 mGlobalSyncMode = SYNC_MODE_QTOPIA; 1495 mGlobalSyncMode = SYNC_MODE_QTOPIA;
1496 mCurrentSyncDevice = "qtopia-XML"; 1496 mCurrentSyncDevice = "qtopia-XML";
1497 if ( mSyncManager->mAskForPreferences ) 1497 if ( mSyncManager->mAskForPreferences )
1498 edit_sync_options(); 1498 edit_sync_options();
1499 qApp->processEvents(); 1499 qApp->processEvents();
1500 CalendarLocal* calendar = new CalendarLocal(); 1500 CalendarLocal* calendar = new CalendarLocal();
1501 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1501 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1502 bool syncOK = false; 1502 bool syncOK = false;
1503 QtopiaFormat qtopiaFormat; 1503 QtopiaFormat qtopiaFormat;
1504 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); 1504 qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories));
1505 bool loadOk = true; 1505 bool loadOk = true;
1506 if ( !categories.isEmpty() ) 1506 if ( !categories.isEmpty() )
1507 loadOk = qtopiaFormat.load( calendar, categories ); 1507 loadOk = qtopiaFormat.load( calendar, categories );
1508 if ( loadOk && !datebook.isEmpty() ) 1508 if ( loadOk && !datebook.isEmpty() )
1509 loadOk = qtopiaFormat.load( calendar, datebook ); 1509 loadOk = qtopiaFormat.load( calendar, datebook );
1510 if ( loadOk && !todolist.isEmpty() ) 1510 if ( loadOk && !todolist.isEmpty() )
1511 loadOk = qtopiaFormat.load( calendar, todolist ); 1511 loadOk = qtopiaFormat.load( calendar, todolist );
1512 1512
1513 if ( loadOk ) { 1513 if ( loadOk ) {
1514 getEventViewerDialog()->setSyncMode( true ); 1514 getEventViewerDialog()->setSyncMode( true );
1515 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); 1515 syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs );
1516 getEventViewerDialog()->setSyncMode( false ); 1516 getEventViewerDialog()->setSyncMode( false );
1517 qApp->processEvents(); 1517 qApp->processEvents();
1518 if ( syncOK ) { 1518 if ( syncOK ) {
1519 if ( mSyncManager->mWriteBackFile ) 1519 if ( mSyncManager->mWriteBackFile )
1520 { 1520 {
1521 // write back XML file 1521 // write back XML file
1522 1522
1523 } 1523 }
1524 setModified( true ); 1524 setModified( true );
1525 } 1525 }
1526 } else { 1526 } else {
1527 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; 1527 QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ;
1528 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), 1528 QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"),
1529 question, i18n("Ok")) ; 1529 question, i18n("Ok")) ;
1530 } 1530 }
1531 delete calendar; 1531 delete calendar;
1532 updateView(); 1532 updateView();
1533 return syncOK; 1533 return syncOK;
1534 1534
1535 1535
1536#endif 1536#endif
1537 1537
1538} 1538}
1539 1539
1540void CalendarView::setSyncEventsReadOnly() 1540void CalendarView::setSyncEventsReadOnly()
1541{ 1541{
1542 Event * ev; 1542 Event * ev;
1543 QPtrList<Event> eL = mCalendar->rawEvents(); 1543 QPtrList<Event> eL = mCalendar->rawEvents();
1544 ev = eL.first(); 1544 ev = eL.first();
1545 while ( ev ) { 1545 while ( ev ) {
1546 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1546 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1547 ev->setReadOnly( true ); 1547 ev->setReadOnly( true );
1548 ev = eL.next(); 1548 ev = eL.next();
1549 } 1549 }
1550} 1550}
1551bool CalendarView::openCalendar(QString filename, bool merge) 1551bool CalendarView::openCalendar(QString filename, bool merge)
1552{ 1552{
1553 1553
1554 if (filename.isEmpty()) { 1554 if (filename.isEmpty()) {
1555 return false; 1555 return false;
1556 } 1556 }
1557 1557
1558 if (!QFile::exists(filename)) { 1558 if (!QFile::exists(filename)) {
1559 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1559 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1560 return false; 1560 return false;
1561 } 1561 }
1562 1562
1563 globalFlagBlockAgenda = 1; 1563 globalFlagBlockAgenda = 1;
1564 if (!merge) mCalendar->close(); 1564 if (!merge) mCalendar->close();
1565 1565
@@ -1940,140 +1940,140 @@ void CalendarView::readFilterSettings(KConfig *config)
1940} 1940}
1941 1941
1942void CalendarView::writeFilterSettings(KConfig *config) 1942void CalendarView::writeFilterSettings(KConfig *config)
1943{ 1943{
1944 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1944 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1945 1945
1946 QStringList filterList; 1946 QStringList filterList;
1947 1947
1948 CalFilter *filter = mFilters.first(); 1948 CalFilter *filter = mFilters.first();
1949 while(filter) { 1949 while(filter) {
1950 // kdDebug() << " fn: " << filter->name() << endl; 1950 // kdDebug() << " fn: " << filter->name() << endl;
1951 filterList << filter->name(); 1951 filterList << filter->name();
1952 config->setGroup("Filter_" + filter->name()); 1952 config->setGroup("Filter_" + filter->name());
1953 config->writeEntry("Criteria",filter->criteria()); 1953 config->writeEntry("Criteria",filter->criteria());
1954 config->writeEntry("CategoryList",filter->categoryList()); 1954 config->writeEntry("CategoryList",filter->categoryList());
1955 filter = mFilters.next(); 1955 filter = mFilters.next();
1956 } 1956 }
1957 config->setGroup("General"); 1957 config->setGroup("General");
1958 config->writeEntry("CalendarFilters",filterList); 1958 config->writeEntry("CalendarFilters",filterList);
1959 1959
1960 config->setGroup("FilterView"); 1960 config->setGroup("FilterView");
1961 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1961 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1962 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1962 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1963} 1963}
1964 1964
1965 1965
1966void CalendarView::goToday() 1966void CalendarView::goToday()
1967{ 1967{
1968 mNavigator->selectToday(); 1968 mNavigator->selectToday();
1969} 1969}
1970 1970
1971void CalendarView::goNext() 1971void CalendarView::goNext()
1972{ 1972{
1973 mNavigator->selectNext(); 1973 mNavigator->selectNext();
1974} 1974}
1975 1975
1976void CalendarView::goPrevious() 1976void CalendarView::goPrevious()
1977{ 1977{
1978 mNavigator->selectPrevious(); 1978 mNavigator->selectPrevious();
1979} 1979}
1980void CalendarView::goNextMonth() 1980void CalendarView::goNextMonth()
1981{ 1981{
1982 mNavigator->selectNextMonth(); 1982 mNavigator->selectNextMonth();
1983} 1983}
1984 1984
1985void CalendarView::goPreviousMonth() 1985void CalendarView::goPreviousMonth()
1986{ 1986{
1987 mNavigator->selectPreviousMonth(); 1987 mNavigator->selectPreviousMonth();
1988} 1988}
1989void CalendarView::writeLocale() 1989void CalendarView::writeLocale()
1990{ 1990{
1991 //KPimGlobalPrefs::instance()->setGlobalConfig(); 1991 //KPimGlobalPrefs::instance()->setGlobalConfig();
1992#if 0 1992#if 0
1993 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); 1993 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
1994 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); 1994 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
1995 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); 1995 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
1996 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); 1996 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
1997 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1997 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1998 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 1998 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
1999 dummy = KOPrefs::instance()->mUserDateFormatShort; 1999 dummy = KOPrefs::instance()->mUserDateFormatShort;
2000 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 2000 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2001 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, 2001 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2002 KOPrefs::instance()->mDaylightsavingStart, 2002 KOPrefs::instance()->mDaylightsavingStart,
2003 KOPrefs::instance()->mDaylightsavingEnd ); 2003 KOPrefs::instance()->mDaylightsavingEnd );
2004 KGlobal::locale()->setTimezone( KOPrefs::instance()->mTimeZoneId ); 2004 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2005#endif 2005#endif
2006} 2006}
2007void CalendarView::updateConfig() 2007void CalendarView::updateConfig()
2008{ 2008{
2009 writeLocale(); 2009 writeLocale();
2010 if ( KOPrefs::instance()->mUseAppColors ) 2010 if ( KOPrefs::instance()->mUseAppColors )
2011 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2011 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2012 emit configChanged(); 2012 emit configChanged();
2013 mTodoList->updateConfig(); 2013 mTodoList->updateConfig();
2014 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2014 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2015 mCalendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2015 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2016 // To make the "fill window" configurations work 2016 // To make the "fill window" configurations work
2017 //mViewManager->raiseCurrentView(); 2017 //mViewManager->raiseCurrentView();
2018} 2018}
2019 2019
2020 2020
2021void CalendarView::eventChanged(Event *event) 2021void CalendarView::eventChanged(Event *event)
2022{ 2022{
2023 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2023 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2024 //updateUnmanagedViews(); 2024 //updateUnmanagedViews();
2025} 2025}
2026 2026
2027void CalendarView::eventAdded(Event *event) 2027void CalendarView::eventAdded(Event *event)
2028{ 2028{
2029 changeEventDisplay(event,KOGlobals::EVENTADDED); 2029 changeEventDisplay(event,KOGlobals::EVENTADDED);
2030} 2030}
2031 2031
2032void CalendarView::eventToBeDeleted(Event *) 2032void CalendarView::eventToBeDeleted(Event *)
2033{ 2033{
2034 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2034 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2035} 2035}
2036 2036
2037void CalendarView::eventDeleted() 2037void CalendarView::eventDeleted()
2038{ 2038{
2039 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2039 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2040} 2040}
2041void CalendarView::changeTodoDisplay(Todo *which, int action) 2041void CalendarView::changeTodoDisplay(Todo *which, int action)
2042{ 2042{
2043 changeIncidenceDisplay((Incidence *)which, action); 2043 changeIncidenceDisplay((Incidence *)which, action);
2044 mDateNavigator->updateView(); //LR 2044 mDateNavigator->updateView(); //LR
2045 //mDialogManager->updateSearchDialog(); 2045 //mDialogManager->updateSearchDialog();
2046 2046
2047 if (which) { 2047 if (which) {
2048 mViewManager->updateWNview(); 2048 mViewManager->updateWNview();
2049 //mTodoList->updateView(); 2049 //mTodoList->updateView();
2050 } 2050 }
2051 2051
2052} 2052}
2053 2053
2054void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2054void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2055{ 2055{
2056 updateUnmanagedViews(); 2056 updateUnmanagedViews();
2057 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2057 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2058 if ( action == KOGlobals::EVENTDELETED ) { //delete 2058 if ( action == KOGlobals::EVENTDELETED ) { //delete
2059 mCalendar->checkAlarmForIncidence( 0, true ); 2059 mCalendar->checkAlarmForIncidence( 0, true );
2060 if ( mEventViewerDialog ) 2060 if ( mEventViewerDialog )
2061 mEventViewerDialog->hide(); 2061 mEventViewerDialog->hide();
2062 } 2062 }
2063 else 2063 else
2064 mCalendar->checkAlarmForIncidence( which , false ); 2064 mCalendar->checkAlarmForIncidence( which , false );
2065} 2065}
2066 2066
2067// most of the changeEventDisplays() right now just call the view's 2067// most of the changeEventDisplays() right now just call the view's
2068// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2068// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2069void CalendarView::changeEventDisplay(Event *which, int action) 2069void CalendarView::changeEventDisplay(Event *which, int action)
2070{ 2070{
2071 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2071 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2072 changeIncidenceDisplay((Incidence *)which, action); 2072 changeIncidenceDisplay((Incidence *)which, action);
2073 mDateNavigator->updateView(); 2073 mDateNavigator->updateView();
2074 //mDialogManager->updateSearchDialog(); 2074 //mDialogManager->updateSearchDialog();
2075 2075
2076 if (which) { 2076 if (which) {
2077 // If there is an event view visible update the display 2077 // If there is an event view visible update the display
2078 mViewManager->currentView()->changeEventDisplay(which,action); 2078 mViewManager->currentView()->changeEventDisplay(which,action);
2079 // TODO: check, if update needed 2079 // TODO: check, if update needed
@@ -2259,129 +2259,129 @@ int CalendarView::addCategories()
2259} 2259}
2260 2260
2261void CalendarView::manageCategories() 2261void CalendarView::manageCategories()
2262{ 2262{
2263 KOCatPrefs* cp = new KOCatPrefs(); 2263 KOCatPrefs* cp = new KOCatPrefs();
2264 cp->show(); 2264 cp->show();
2265 int w =cp->sizeHint().width() ; 2265 int w =cp->sizeHint().width() ;
2266 int h = cp->sizeHint().height() ; 2266 int h = cp->sizeHint().height() ;
2267 int dw = QApplication::desktop()->width(); 2267 int dw = QApplication::desktop()->width();
2268 int dh = QApplication::desktop()->height(); 2268 int dh = QApplication::desktop()->height();
2269 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2269 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2270 if ( !cp->exec() ) { 2270 if ( !cp->exec() ) {
2271 delete cp; 2271 delete cp;
2272 return; 2272 return;
2273 } 2273 }
2274 int count = 0; 2274 int count = 0;
2275 if ( cp->addCat() ) { 2275 if ( cp->addCat() ) {
2276 count = addCategories(); 2276 count = addCategories();
2277 if ( count ) { 2277 if ( count ) {
2278 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2278 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2279 writeSettings(); 2279 writeSettings();
2280 } 2280 }
2281 } else { 2281 } else {
2282 removeCategories(); 2282 removeCategories();
2283 updateView(); 2283 updateView();
2284 } 2284 }
2285 delete cp; 2285 delete cp;
2286} 2286}
2287 2287
2288void CalendarView::beamIncidence(Incidence * Inc) 2288void CalendarView::beamIncidence(Incidence * Inc)
2289{ 2289{
2290 QPtrList<Incidence> delSel ; 2290 QPtrList<Incidence> delSel ;
2291 delSel.append(Inc); 2291 delSel.append(Inc);
2292 beamIncidenceList( delSel ); 2292 beamIncidenceList( delSel );
2293} 2293}
2294void CalendarView::beamCalendar() 2294void CalendarView::beamCalendar()
2295{ 2295{
2296 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2296 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2297 //qDebug("beamCalendar() "); 2297 //qDebug("beamCalendar() ");
2298 beamIncidenceList( delSel ); 2298 beamIncidenceList( delSel );
2299} 2299}
2300void CalendarView::beamFilteredCalendar() 2300void CalendarView::beamFilteredCalendar()
2301{ 2301{
2302 QPtrList<Incidence> delSel = mCalendar->incidences(); 2302 QPtrList<Incidence> delSel = mCalendar->incidences();
2303 //qDebug("beamFilteredCalendar() "); 2303 //qDebug("beamFilteredCalendar() ");
2304 beamIncidenceList( delSel ); 2304 beamIncidenceList( delSel );
2305} 2305}
2306void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2306void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2307{ 2307{
2308 if ( beamDialog->exec () == QDialog::Rejected ) 2308 if ( beamDialog->exec () == QDialog::Rejected )
2309 return; 2309 return;
2310#ifdef DESKTOP_VERSION 2310#ifdef DESKTOP_VERSION
2311 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2311 QString fn = locateLocal( "tmp", "kopibeamfile" );
2312#else 2312#else
2313 QString fn = "/tmp/kopibeamfile"; 2313 QString fn = "/tmp/kopibeamfile";
2314#endif 2314#endif
2315 QString mes; 2315 QString mes;
2316 bool createbup = true; 2316 bool createbup = true;
2317 if ( createbup ) { 2317 if ( createbup ) {
2318 QString description = "\n"; 2318 QString description = "\n";
2319 CalendarLocal* cal = new CalendarLocal(); 2319 CalendarLocal* cal = new CalendarLocal();
2320 if ( beamDialog->beamLocal() ) 2320 if ( beamDialog->beamLocal() )
2321 cal->setLocalTime(); 2321 cal->setLocalTime();
2322 else 2322 else
2323 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2323 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2324 Incidence *incidence = delSel.first(); 2324 Incidence *incidence = delSel.first();
2325 bool addText = false; 2325 bool addText = false;
2326 if ( delSel.count() < 10 ) 2326 if ( delSel.count() < 10 )
2327 addText = true; 2327 addText = true;
2328 else { 2328 else {
2329 description.sprintf(i18n(" %d items?"),delSel.count() ); 2329 description.sprintf(i18n(" %d items?"),delSel.count() );
2330 } 2330 }
2331 while ( incidence ) { 2331 while ( incidence ) {
2332 Incidence *in = incidence->clone(); 2332 Incidence *in = incidence->clone();
2333 if ( ! in->summary().isEmpty() ) { 2333 if ( ! in->summary().isEmpty() ) {
2334 in->setDescription(""); 2334 in->setDescription("");
2335 } else { 2335 } else {
2336 in->setSummary( in->description().left(20)); 2336 in->setSummary( in->description().left(20));
2337 in->setDescription(""); 2337 in->setDescription("");
2338 } 2338 }
2339 if ( addText ) 2339 if ( addText )
2340 description += in->summary() + "\n"; 2340 description += in->summary() + "\n";
2341 cal->addIncidence( in ); 2341 cal->addIncidence( in );
2342 incidence = delSel.next(); 2342 incidence = delSel.next();
2343 } 2343 }
2344 if ( beamDialog->beamVcal() ) { 2344 if ( beamDialog->beamVcal() ) {
2345 fn += ".vcs"; 2345 fn += ".vcs";
2346 FileStorage storage( cal, fn, new VCalFormat ); 2346 FileStorage storage( cal, fn, new VCalFormat );
2347 storage.save(); 2347 storage.save();
2348 } else { 2348 } else {
2349 fn += ".ics"; 2349 fn += ".ics";
2350 FileStorage storage( cal, fn, new ICalFormat( ) ); 2350 FileStorage storage( cal, fn, new ICalFormat( ) );
2351 storage.save(); 2351 storage.save();
2352 } 2352 }
2353 delete cal; 2353 delete cal;
2354 mes = i18n("KO/Pi: Ready for beaming"); 2354 mes = i18n("KO/Pi: Ready for beaming");
2355 topLevelWidget()->setCaption(mes); 2355 topLevelWidget()->setCaption(mes);
2356 KApplication::convert2latin1( fn ); 2356 KApplication::convert2latin1( fn );
2357#ifndef DESKTOP_VERSION 2357#ifndef DESKTOP_VERSION
2358 Ir *ir = new Ir( this ); 2358 Ir *ir = new Ir( this );
2359 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2359 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2360 ir->send( fn, description, "text/x-vCalendar" ); 2360 ir->send( fn, description, "text/x-vCalendar" );
2361#endif 2361#endif
2362 } 2362 }
2363} 2363}
2364void CalendarView::beamDone( Ir *ir ) 2364void CalendarView::beamDone( Ir *ir )
2365{ 2365{
2366#ifndef DESKTOP_VERSION 2366#ifndef DESKTOP_VERSION
2367 delete ir; 2367 delete ir;
2368#endif 2368#endif
2369 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2369 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2370 topLevelWidget()->raise(); 2370 topLevelWidget()->raise();
2371} 2371}
2372 2372
2373void CalendarView::moveIncidence(Incidence * inc ) 2373void CalendarView::moveIncidence(Incidence * inc )
2374{ 2374{
2375 if ( !inc ) return; 2375 if ( !inc ) return;
2376 // qDebug("showDatePickerForIncidence( ) "); 2376 // qDebug("showDatePickerForIncidence( ) ");
2377 if ( mDateFrame->isVisible() ) 2377 if ( mDateFrame->isVisible() )
2378 mDateFrame->hide(); 2378 mDateFrame->hide();
2379 else { 2379 else {
2380 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2380 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2381 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2381 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2382 int dw = QApplication::desktop()->width(); 2382 int dw = QApplication::desktop()->width();
2383 int dh = QApplication::desktop()->height(); 2383 int dh = QApplication::desktop()->height();
2384 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2384 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2385 mDateFrame->show(); 2385 mDateFrame->show();
2386 } 2386 }
2387 mDatePickerMode = 2; 2387 mDatePickerMode = 2;
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index bafd349..d3aa650 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -1,105 +1,106 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qfileinfo.h> 30#include <qfileinfo.h>
31#include <qmessagebox.h> 31#include <qmessagebox.h>
32#include <qdialog.h> 32#include <qdialog.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qregexp.h> 35#include <qregexp.h>
36 36
37#include <klocale.h> 37#include <klocale.h>
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kiconloader.h> 39#include <kiconloader.h>
40#include <kglobal.h> 40#include <kglobal.h>
41 41
42#include <libkdepim/kpimglobalprefs.h>
42#include <libkcal/calendar.h> 43#include <libkcal/calendar.h>
43#include <libkcal/calendarlocal.h> 44#include <libkcal/calendarlocal.h>
44#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
45#include <libkcal/vcalformat.h> 46#include <libkcal/vcalformat.h>
46#include <libkcal/recurrence.h> 47#include <libkcal/recurrence.h>
47#include <libkcal/filestorage.h> 48#include <libkcal/filestorage.h>
48#include <libkdepim/categoryselectdialog.h> 49#include <libkdepim/categoryselectdialog.h>
49#ifndef DESKTOP_VERSION 50#ifndef DESKTOP_VERSION
50#include <qpe/qpeapplication.h> 51#include <qpe/qpeapplication.h>
51#else 52#else
52#include <qapplication.h> 53#include <qapplication.h>
53#endif 54#endif
54 55
55#ifndef KORG_NOPRINTER 56#ifndef KORG_NOPRINTER
56#include "calprinter.h" 57#include "calprinter.h"
57#endif 58#endif
58#include "koglobals.h" 59#include "koglobals.h"
59#include "koprefs.h" 60#include "koprefs.h"
60#include "kfiledialog.h" 61#include "kfiledialog.h"
61 62
62#include "kolistview.h" 63#include "kolistview.h"
63 64
64ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) 65ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date )
65{ 66{
66 mItem = item; 67 mItem = item;
67 mDate = date; 68 mDate = date;
68} 69}
69 70
70ListItemVisitor::~ListItemVisitor() 71ListItemVisitor::~ListItemVisitor()
71{ 72{
72} 73}
73 74
74bool ListItemVisitor::visit(Event *e) 75bool ListItemVisitor::visit(Event *e)
75{ 76{
76 77
77 bool ok = false; 78 bool ok = false;
78 QString start, end; 79 QString start, end;
79 if ( e->doesRecur() ) { 80 if ( e->doesRecur() ) {
80 QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); 81 QDate d = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
81 if ( ok ) { 82 if ( ok ) {
82 int days = e->dtStart().date().daysTo(e->dtEnd().date() ); 83 int days = e->dtStart().date().daysTo(e->dtEnd().date() );
83 start = KGlobal::locale()->formatDate(d,true); 84 start = KGlobal::locale()->formatDate(d,true);
84 end = KGlobal::locale()->formatDate(d.addDays( days),true); 85 end = KGlobal::locale()->formatDate(d.addDays( days),true);
85 } 86 }
86 87
87 } 88 }
88 if ( ! ok ) { 89 if ( ! ok ) {
89 start =e->dtStartDateStr(); 90 start =e->dtStartDateStr();
90 end = e->dtEndDateStr(); 91 end = e->dtEndDateStr();
91 } 92 }
92 mItem->setText(0,e->summary()); 93 mItem->setText(0,e->summary());
93 mItem->setText(1,start); 94 mItem->setText(1,start);
94 mItem->setText(2,e->dtStartTimeStr()); 95 mItem->setText(2,e->dtStartTimeStr());
95 mItem->setText(3,end); 96 mItem->setText(3,end);
96 mItem->setText(4,e->dtEndTimeStr()); 97 mItem->setText(4,e->dtEndTimeStr());
97 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); 98 mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No"));
98 mItem->setText(6, e->recurrence()->recurrenceText()); 99 mItem->setText(6, e->recurrence()->recurrenceText());
99 mItem->setText(7,"---"); 100 mItem->setText(7,"---");
100 mItem->setText(8,"---"); 101 mItem->setText(8,"---");
101 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); 102 mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No"));
102 mItem->setText(10,e->categoriesStr()); 103 mItem->setText(10,e->categoriesStr());
103 104
104 QString key; 105 QString key;
105 QDate d = e->dtStart().date(); 106 QDate d = e->dtStart().date();
@@ -316,129 +317,129 @@ void KOListView::setCategories( bool removeOld )
316 } 317 }
317 QStringList catList = csd->selectedCategories(); 318 QStringList catList = csd->selectedCategories();
318 delete csd; 319 delete csd;
319 // if ( catList.count() == 0 ) 320 // if ( catList.count() == 0 )
320 // return; 321 // return;
321 catList.sort(); 322 catList.sort();
322 QString categoriesStr = catList.join(","); 323 QString categoriesStr = catList.join(",");
323 int i; 324 int i;
324 QStringList itemList; 325 QStringList itemList;
325 QPtrList<KOListViewItem> sel ; 326 QPtrList<KOListViewItem> sel ;
326 QListViewItem *qitem = mListView->firstChild (); 327 QListViewItem *qitem = mListView->firstChild ();
327 while ( qitem ) { 328 while ( qitem ) {
328 if ( qitem->isSelected() ) { 329 if ( qitem->isSelected() ) {
329 sel.append(((KOListViewItem *)qitem)); 330 sel.append(((KOListViewItem *)qitem));
330 } 331 }
331 qitem = qitem->nextSibling(); 332 qitem = qitem->nextSibling();
332 } 333 }
333 KOListViewItem * item, *temp; 334 KOListViewItem * item, *temp;
334 item = sel.first(); 335 item = sel.first();
335 Incidence* inc; 336 Incidence* inc;
336 while ( item ) { 337 while ( item ) {
337 inc = item->data(); 338 inc = item->data();
338 if ( removeOld ) { 339 if ( removeOld ) {
339 inc->setCategories( categoriesStr ); 340 inc->setCategories( categoriesStr );
340 } else { 341 } else {
341 itemList = QStringList::split (",", inc->categoriesStr() ); 342 itemList = QStringList::split (",", inc->categoriesStr() );
342 for( i = 0; i< catList.count(); ++i ) { 343 for( i = 0; i< catList.count(); ++i ) {
343 if ( !itemList.contains (catList[i])) 344 if ( !itemList.contains (catList[i]))
344 itemList.append( catList[i] ); 345 itemList.append( catList[i] );
345 } 346 }
346 itemList.sort(); 347 itemList.sort();
347 inc->setCategories( itemList.join(",") ); 348 inc->setCategories( itemList.join(",") );
348 } 349 }
349 temp = item; 350 temp = item;
350 item = sel.next(); 351 item = sel.next();
351 mUidDict.remove( inc->uid() ); 352 mUidDict.remove( inc->uid() );
352 delete temp;; 353 delete temp;;
353 addIncidence( inc ); 354 addIncidence( inc );
354 } 355 }
355} 356}
356 357
357void KOListView::beamSelected() 358void KOListView::beamSelected()
358{ 359{
359 int icount = 0; 360 int icount = 0;
360 QPtrList<Incidence> delSel ; 361 QPtrList<Incidence> delSel ;
361 QListViewItem *item = mListView->firstChild (); 362 QListViewItem *item = mListView->firstChild ();
362 while ( item ) { 363 while ( item ) {
363 if ( item->isSelected() ) { 364 if ( item->isSelected() ) {
364 delSel.append(((KOListViewItem *)item)->data()); 365 delSel.append(((KOListViewItem *)item)->data());
365 ++icount; 366 ++icount;
366 } 367 }
367 368
368 item = item->nextSibling(); 369 item = item->nextSibling();
369 } 370 }
370 if ( icount ) { 371 if ( icount ) {
371 emit beamIncidenceList( delSel ); 372 emit beamIncidenceList( delSel );
372 return; 373 return;
373 QString fn ; 374 QString fn ;
374 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 375 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
375 QString mes; 376 QString mes;
376 bool createbup = true; 377 bool createbup = true;
377 if ( createbup ) { 378 if ( createbup ) {
378 QString description = "\n"; 379 QString description = "\n";
379 CalendarLocal* cal = new CalendarLocal(); 380 CalendarLocal* cal = new CalendarLocal();
380 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 381 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
381 Incidence *incidence = delSel.first(); 382 Incidence *incidence = delSel.first();
382 while ( incidence ) { 383 while ( incidence ) {
383 Incidence *in = incidence->clone(); 384 Incidence *in = incidence->clone();
384 description += in->summary() + "\n"; 385 description += in->summary() + "\n";
385 cal->addIncidence( in ); 386 cal->addIncidence( in );
386 incidence = delSel.next(); 387 incidence = delSel.next();
387 } 388 }
388 FileStorage storage( cal, fn, new VCalFormat ); 389 FileStorage storage( cal, fn, new VCalFormat );
389 storage.save(); 390 storage.save();
390 delete cal; 391 delete cal;
391 mes = i18n("KO/Pi: Ready for beaming"); 392 mes = i18n("KO/Pi: Ready for beaming");
392 topLevelWidget()->setCaption(mes); 393 topLevelWidget()->setCaption(mes);
393 394
394#ifndef DESKTOP_VERSION 395#ifndef DESKTOP_VERSION
395 Ir *ir = new Ir( this ); 396 Ir *ir = new Ir( this );
396 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 397 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
397 ir->send( fn, description, "text/x-vCalendar" ); 398 ir->send( fn, description, "text/x-vCalendar" );
398#endif 399#endif
399 } 400 }
400 } 401 }
401} 402}
402void KOListView::beamDone( Ir *ir ) 403void KOListView::beamDone( Ir *ir )
403{ 404{
404#ifndef DESKTOP_VERSION 405#ifndef DESKTOP_VERSION
405 delete ir; 406 delete ir;
406#endif 407#endif
407 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 408 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
408} 409}
409 410
410void KOListView::saveDescriptionToFile() 411void KOListView::saveDescriptionToFile()
411{ 412{
412 413
413 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
414 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 415 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
415 i18n("Continue"), i18n("Cancel"), 0, 416 i18n("Continue"), i18n("Cancel"), 0,
416 0, 1 ); 417 0, 1 );
417 if ( result != 0 ) { 418 if ( result != 0 ) {
418 return; 419 return;
419 } 420 }
420 int icount = 0; 421 int icount = 0;
421 QPtrList<Incidence> delSel ; 422 QPtrList<Incidence> delSel ;
422 QListViewItem *item = mListView->firstChild (); 423 QListViewItem *item = mListView->firstChild ();
423 while ( item ) { 424 while ( item ) {
424 if ( item->isSelected() ) { 425 if ( item->isSelected() ) {
425 delSel.append(((KOListViewItem *)item)->data()); 426 delSel.append(((KOListViewItem *)item)->data());
426 ++icount; 427 ++icount;
427 } 428 }
428 429
429 item = item->nextSibling(); 430 item = item->nextSibling();
430 } 431 }
431 if ( icount ) { 432 if ( icount ) {
432 QString fn = KOPrefs::instance()->mLastSaveFile; 433 QString fn = KOPrefs::instance()->mLastSaveFile;
433 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 434 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
434 435
435 if ( fn == "" ) 436 if ( fn == "" )
436 return; 437 return;
437 QFileInfo info; 438 QFileInfo info;
438 info.setFile( fn ); 439 info.setFile( fn );
439 QString mes; 440 QString mes;
440 bool createbup = true; 441 bool createbup = true;
441 if ( info. exists() ) { 442 if ( info. exists() ) {
442 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 443 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
443 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 444 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
444 i18n("Overwrite!"), i18n("Cancel"), 0, 445 i18n("Overwrite!"), i18n("Cancel"), 0,
@@ -467,129 +468,129 @@ void KOListView::saveDescriptionToFile()
467 text += i18n("To-Do: "); 468 text += i18n("To-Do: ");
468 text += incidence->summary(); 469 text += incidence->summary();
469 if ( incidence->hasStartDate() ) 470 if ( incidence->hasStartDate() )
470 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 471 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
471 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 472 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
472 if ( !incidence->location().isEmpty() ) 473 if ( !incidence->location().isEmpty() )
473 text += "\n" +i18n("Location: ") + incidence->location(); 474 text += "\n" +i18n("Location: ") + incidence->location();
474 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 475 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
475 ++icount; 476 ++icount;
476 477
477 } 478 }
478 } 479 }
479 incidence = delSel.next(); 480 incidence = delSel.next();
480 } 481 }
481 QFile file( fn ); 482 QFile file( fn );
482 if (!file.open( IO_WriteOnly ) ) { 483 if (!file.open( IO_WriteOnly ) ) {
483 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") ); 484 topLevelWidget()->setCaption(i18n("File open error - nothing saved!") );
484 return; 485 return;
485 } 486 }
486 QTextStream ts( &file ); 487 QTextStream ts( &file );
487 ts << text; 488 ts << text;
488 file.close(); 489 file.close();
489 //qDebug("%s ", text.latin1()); 490 //qDebug("%s ", text.latin1());
490 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount ); 491 mes = i18n("KO/Pi:Saved %1 descriptions/journals").arg(icount );
491 KOPrefs::instance()->mLastSaveFile = fn; 492 KOPrefs::instance()->mLastSaveFile = fn;
492 topLevelWidget()->setCaption(mes); 493 topLevelWidget()->setCaption(mes);
493 } 494 }
494 } 495 }
495} 496}
496void KOListView::saveToFile() 497void KOListView::saveToFile()
497{ 498{
498 499
499 int icount = 0; 500 int icount = 0;
500 QPtrList<Incidence> delSel ; 501 QPtrList<Incidence> delSel ;
501 QListViewItem *item = mListView->firstChild (); 502 QListViewItem *item = mListView->firstChild ();
502 while ( item ) { 503 while ( item ) {
503 if ( item->isSelected() ) { 504 if ( item->isSelected() ) {
504 delSel.append(((KOListViewItem *)item)->data()); 505 delSel.append(((KOListViewItem *)item)->data());
505 ++icount; 506 ++icount;
506 } 507 }
507 508
508 item = item->nextSibling(); 509 item = item->nextSibling();
509 } 510 }
510 if ( icount ) { 511 if ( icount ) {
511 QString fn = KOPrefs::instance()->mLastSaveFile; 512 QString fn = KOPrefs::instance()->mLastSaveFile;
512 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 513 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
513 514
514 if ( fn == "" ) 515 if ( fn == "" )
515 return; 516 return;
516 QFileInfo info; 517 QFileInfo info;
517 info.setFile( fn ); 518 info.setFile( fn );
518 QString mes; 519 QString mes;
519 bool createbup = true; 520 bool createbup = true;
520 if ( info. exists() ) { 521 if ( info. exists() ) {
521 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 522 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
522 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 523 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
523 i18n("Overwrite!"), i18n("Cancel"), 0, 524 i18n("Overwrite!"), i18n("Cancel"), 0,
524 0, 1 ); 525 0, 1 );
525 if ( result != 0 ) { 526 if ( result != 0 ) {
526 createbup = false; 527 createbup = false;
527 } 528 }
528 } 529 }
529 if ( createbup ) { 530 if ( createbup ) {
530 CalendarLocal cal; 531 CalendarLocal cal;
531 cal.setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 532 cal.setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
532 Incidence *incidence = delSel.first(); 533 Incidence *incidence = delSel.first();
533 while ( incidence ) { 534 while ( incidence ) {
534 cal.addIncidence( incidence->clone() ); 535 cal.addIncidence( incidence->clone() );
535 incidence = delSel.next(); 536 incidence = delSel.next();
536 } 537 }
537 ICalFormat format; 538 ICalFormat format;
538 format.save( &cal, fn ); 539 format.save( &cal, fn );
539 mes = i18n("KO/Pi:Saved %1").arg(fn ); 540 mes = i18n("KO/Pi:Saved %1").arg(fn );
540 KOPrefs::instance()->mLastSaveFile = fn; 541 KOPrefs::instance()->mLastSaveFile = fn;
541 topLevelWidget()->setCaption(mes); 542 topLevelWidget()->setCaption(mes);
542 } 543 }
543 } 544 }
544} 545}
545void KOListView::deleteAll() 546void KOListView::deleteAll()
546{ 547{
547 int icount = 0; 548 int icount = 0;
548 QPtrList<Incidence> delSel ; 549 QPtrList<Incidence> delSel ;
549 QListViewItem *item = mListView->firstChild (); 550 QListViewItem *item = mListView->firstChild ();
550 while ( item ) { 551 while ( item ) {
551 if ( item->isSelected() ) { 552 if ( item->isSelected() ) {
552 delSel.append(((KOListViewItem *)item)->data()); 553 delSel.append(((KOListViewItem *)item)->data());
553 ++icount; 554 ++icount;
554 } 555 }
555 556
556 item = item->nextSibling(); 557 item = item->nextSibling();
557 } 558 }
558 if ( icount ) { 559 if ( icount ) {
559 Incidence *incidence = delSel.first(); 560 Incidence *incidence = delSel.first();
560 Incidence *toDelete; 561 Incidence *toDelete;
561 KOPrefs *p = KOPrefs::instance(); 562 KOPrefs *p = KOPrefs::instance();
562 bool confirm = p->mConfirm; 563 bool confirm = p->mConfirm;
563 QString mess; 564 QString mess;
564 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount ); 565 mess = mess.sprintf( i18n("You have %d item(s) selected.\n"), icount );
565 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) { 566 if ( KMessageBox::Continue == KMessageBox::warningContinueCancel(this, mess + i18n("All selected items will be\npermanently deleted.\n(Deleting items will take\nsome time on a PDA)\n"), i18n("KO/Pi Confirmation"),i18n("Delete")) ) {
566 p->mConfirm = false; 567 p->mConfirm = false;
567 int delCounter = 0; 568 int delCounter = 0;
568 QDialog dia ( this, "p-dialog", true ); 569 QDialog dia ( this, "p-dialog", true );
569 QLabel lab (i18n("Close dialog to abort deletion!"), &dia ); 570 QLabel lab (i18n("Close dialog to abort deletion!"), &dia );
570 QVBoxLayout lay( &dia ); 571 QVBoxLayout lay( &dia );
571 lay.setMargin(7); 572 lay.setMargin(7);
572 lay.setSpacing(7); 573 lay.setSpacing(7);
573 lay.addWidget( &lab); 574 lay.addWidget( &lab);
574 QProgressBar bar( icount, &dia ); 575 QProgressBar bar( icount, &dia );
575 lay.addWidget( &bar); 576 lay.addWidget( &bar);
576 int w = 220; 577 int w = 220;
577 int h = 50; 578 int h = 50;
578 int dw = QApplication::desktop()->width(); 579 int dw = QApplication::desktop()->width();
579 int dh = QApplication::desktop()->height(); 580 int dh = QApplication::desktop()->height();
580 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 581 dia.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
581 //dia.resize( 240,50 ); 582 //dia.resize( 240,50 );
582 dia.show(); 583 dia.show();
583 584
584 while ( incidence ) { 585 while ( incidence ) {
585 bar.setProgress( delCounter ); 586 bar.setProgress( delCounter );
586 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter ); 587 mess = mess.sprintf( i18n("Deleting item %d ..."), ++delCounter );
587 dia.setCaption( mess ); 588 dia.setCaption( mess );
588 qApp->processEvents(); 589 qApp->processEvents();
589 toDelete = (incidence); 590 toDelete = (incidence);
590 incidence = delSel.next(); 591 incidence = delSel.next();
591 emit deleteIncidenceSignal(toDelete ); 592 emit deleteIncidenceSignal(toDelete );
592 if ( dia.result() != 0 ) 593 if ( dia.result() != 0 )
593 break; 594 break;
594 595
595 } 596 }
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 258f738..ba1c6d1 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -82,140 +82,132 @@ KOPrefs::KOPrefs() :
82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
83 83
84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
86 addItemBool("ShowIconSearch",&mShowIconSearch,true); 86 addItemBool("ShowIconSearch",&mShowIconSearch,true);
87 addItemBool("ShowIconList",&mShowIconList,true); 87 addItemBool("ShowIconList",&mShowIconList,true);
88 addItemBool("ShowIconDay1",&mShowIconDay1,true); 88 addItemBool("ShowIconDay1",&mShowIconDay1,true);
89 addItemBool("ShowIconDay5",&mShowIconDay5,true); 89 addItemBool("ShowIconDay5",&mShowIconDay5,true);
90 addItemBool("ShowIconDay7",&mShowIconDay7,true); 90 addItemBool("ShowIconDay7",&mShowIconDay7,true);
91 addItemBool("ShowIconMonth",&mShowIconMonth,true); 91 addItemBool("ShowIconMonth",&mShowIconMonth,true);
92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
94 addItemBool("ShowIconBack",&mShowIconBack,true); 94 addItemBool("ShowIconBack",&mShowIconBack,true);
95 addItemBool("ShowIconToday",&mShowIconToday,true); 95 addItemBool("ShowIconToday",&mShowIconToday,true);
96 addItemBool("ShowIconForward",&mShowIconForward,true); 96 addItemBool("ShowIconForward",&mShowIconForward,true);
97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
100 addItemBool("ShowIconNext",&mShowIconNext,true); 100 addItemBool("ShowIconNext",&mShowIconNext,true);
101 addItemBool("ShowIconJournal",&mShowIconJournal,true); 101 addItemBool("ShowIconJournal",&mShowIconJournal,true);
102 addItemBool("ShowIconStretch",&mShowIconStretch,true); 102 addItemBool("ShowIconStretch",&mShowIconStretch,true);
103 addItemBool("LanguageChanged",&mLanguageChanged,false); 103 addItemBool("LanguageChanged",&mLanguageChanged,false);
104 104
105 addItemBool("AskForQuit",&mAskForQuit,false); 105 addItemBool("AskForQuit",&mAskForQuit,false);
106 106
107#ifndef DESKTOP_VERSION 107#ifndef DESKTOP_VERSION
108 addItemBool("ShowFullMenu",&mShowFullMenu,false); 108 addItemBool("ShowFullMenu",&mShowFullMenu,false);
109#else 109#else
110 addItemBool("ShowFullMenu",&mShowFullMenu,true); 110 addItemBool("ShowFullMenu",&mShowFullMenu,true);
111#endif 111#endif
112 addItemBool("ToolBarHor",&mToolBarHor, true ); 112 addItemBool("ToolBarHor",&mToolBarHor, true );
113 addItemBool("ToolBarUp",&mToolBarUp, false ); 113 addItemBool("ToolBarUp",&mToolBarUp, false );
114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
115 addItemInt("Whats Next Days",&mWhatsNextDays,3); 115 addItemInt("Whats Next Days",&mWhatsNextDays,3);
116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
117 117
118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
120 addItemInt("AllDay Size",&mAllDaySize,28); 120 addItemInt("AllDay Size",&mAllDaySize,28);
121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
123 123
124 addItemStringList("LocationDefaults",&mLocationDefaults ); 124 addItemStringList("LocationDefaults",&mLocationDefaults );
125 addItemStringList("EventSummary User",&mEventSummaryUser); 125 addItemStringList("EventSummary User",&mEventSummaryUser);
126 addItemStringList("TodoSummary User",&mTodoSummaryUser); 126 addItemStringList("TodoSummary User",&mTodoSummaryUser);
127 127
128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
129 addItemBool("Enable Project View",&mEnableProjectView,false); 129 addItemBool("Enable Project View",&mEnableProjectView,false);
130 addItemBool("Auto Save",&mAutoSave,false); 130 addItemBool("Auto Save",&mAutoSave,false);
131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
132 addItemBool("Confirm Deletes",&mConfirm,true); 132 addItemBool("Confirm Deletes",&mConfirm,true);
133 addItemString("Archive File",&mArchiveFile); 133 addItemString("Archive File",&mArchiveFile);
134 addItemString("Html Export File",&mHtmlExportFile, 134 addItemString("Html Export File",&mHtmlExportFile,
135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
136 addItemBool("Html With Save",&mHtmlWithSave,false); 136 addItemBool("Html With Save",&mHtmlWithSave,false);
137 137
138 KPrefs::setCurrentGroup("Personal Settings"); 138 KPrefs::setCurrentGroup("Personal Settings");
139 139
140 addItemInt("Mail Client",&mMailClient,MailClientKMail); 140 addItemInt("Mail Client",&mMailClient,MailClientKMail);
141 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 141 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
142 addItemBool("Bcc",&mBcc,false); 142 addItemBool("Bcc",&mBcc,false);
143 143
144 KPrefs::setCurrentGroup("Time & Date"); 144 KPrefs::setCurrentGroup("Time & Date");
145 145
146 // addItemString("Time Zone",&mTimeZone,"+0100");
147 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
148 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
149 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
150 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
151 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
152
153 146
154 addItemInt("Default Start Time",&mStartTime,10); 147 addItemInt("Default Start Time",&mStartTime,10);
155 addItemInt("Default Duration",&mDefaultDuration,2); 148 addItemInt("Default Duration",&mDefaultDuration,2);
156 addItemInt("Default Alarm Time",&mAlarmTime,3); 149 addItemInt("Default Alarm Time",&mAlarmTime,3);
157 addItemInt("Daylight Savings",&mDaylightSavings,0);
158 KPrefs::setCurrentGroup("AlarmSettings"); 150 KPrefs::setCurrentGroup("AlarmSettings");
159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 151 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 152 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 153 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 154 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
163 155
164 156
165 KPrefs::setCurrentGroup("Calendar"); 157 KPrefs::setCurrentGroup("Calendar");
166 158
167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 159 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
168 160
169 KPrefs::setCurrentGroup("Fonts"); 161 KPrefs::setCurrentGroup("Fonts");
170 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 162 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
171 addItemFont("TimeBar Font",&mTimeBarFont); 163 addItemFont("TimeBar Font",&mTimeBarFont);
172 addItemFont("MonthView Font",&mMonthViewFont); 164 addItemFont("MonthView Font",&mMonthViewFont);
173 addItemFont("AgendaView Font",&mAgendaViewFont); 165 addItemFont("AgendaView Font",&mAgendaViewFont);
174 addItemFont("MarcusBains Font",&mMarcusBainsFont); 166 addItemFont("MarcusBains Font",&mMarcusBainsFont);
175 addItemFont("TimeLabels Font",&mTimeLabelsFont); 167 addItemFont("TimeLabels Font",&mTimeLabelsFont);
176 addItemFont("TodoView Font",&mTodoViewFont); 168 addItemFont("TodoView Font",&mTodoViewFont);
177 addItemFont("ListView Font",&mListViewFont); 169 addItemFont("ListView Font",&mListViewFont);
178 addItemFont("DateNavigator Font",&mDateNavigatorFont); 170 addItemFont("DateNavigator Font",&mDateNavigatorFont);
179 addItemFont("EditBox Font",&mEditBoxFont); 171 addItemFont("EditBox Font",&mEditBoxFont);
180 addItemFont("JournalView Font",&mJornalViewFont); 172 addItemFont("JournalView Font",&mJornalViewFont);
181 addItemFont("WhatsNextView Font",&mWhatsNextFont); 173 addItemFont("WhatsNextView Font",&mWhatsNextFont);
182 addItemFont("EventView Font",&mEventViewFont); 174 addItemFont("EventView Font",&mEventViewFont);
183 175
184// KPrefs::setCurrentGroup("SyncProfiles"); 176// KPrefs::setCurrentGroup("SyncProfiles");
185// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 177// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
186// addItemStringList("SyncProfileNames",&mSyncProfileNames); 178// addItemStringList("SyncProfileNames",&mSyncProfileNames);
187// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); 179// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
188 180
189 KPrefs::setCurrentGroup("RemoteSyncing"); 181 KPrefs::setCurrentGroup("RemoteSyncing");
190// addItemBool("UsePasswd",&mUsePassWd,false); 182// addItemBool("UsePasswd",&mUsePassWd,false);
191// addItemBool("WriteBackFile",&mWriteBackFile,true); 183// addItemBool("WriteBackFile",&mWriteBackFile,true);
192// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 184// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
193// addItemBool("AskForPreferences",&mAskForPreferences,true); 185// addItemBool("AskForPreferences",&mAskForPreferences,true);
194// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 186// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
195 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 187 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
196 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 188 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
197 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 189 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
198 addItemInt("LastSyncTime",&mLastSyncTime,0); 190 addItemInt("LastSyncTime",&mLastSyncTime,0);
199 191
200#ifdef _WIN32_ 192#ifdef _WIN32_
201 QString hdp= locateLocal("data","korganizer")+"\\\\"; 193 QString hdp= locateLocal("data","korganizer")+"\\\\";
202#else 194#else
203 QString hdp= locateLocal("data","korganizer")+"/"; 195 QString hdp= locateLocal("data","korganizer")+"/";
204#endif 196#endif
205 197
206 KPrefs::setCurrentGroup("LoadSaveFileNames"); 198 KPrefs::setCurrentGroup("LoadSaveFileNames");
207 199
208 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 200 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
209 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 201 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
210 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 202 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
211 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 203 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
212 204
213 205
214 KPrefs::setCurrentGroup("Locale"); 206 KPrefs::setCurrentGroup("Locale");
215 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 207 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
216 addItemInt("PreferredTime",&mPreferredTime,0); 208 addItemInt("PreferredTime",&mPreferredTime,0);
217 addItemInt("PreferredDate",&mPreferredDate,0); 209 addItemInt("PreferredDate",&mPreferredDate,0);
218 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 210 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
219 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 211 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
220 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 212 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
221 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 213 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
@@ -293,129 +285,129 @@ KOPrefs::KOPrefs() :
293 addItemBool("CompactDialogs",&mCompactDialogs,false); 285 addItemBool("CompactDialogs",&mCompactDialogs,false);
294 addItemBool("VerticalScreen",&mVerticalScreen,true); 286 addItemBool("VerticalScreen",&mVerticalScreen,true);
295 287
296 KPrefs::setCurrentGroup("KOrganizer Plugins"); 288 KPrefs::setCurrentGroup("KOrganizer Plugins");
297 289
298 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 290 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
299 291
300 KPrefs::setCurrentGroup("Group Scheduling"); 292 KPrefs::setCurrentGroup("Group Scheduling");
301 293
302 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 294 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
303 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 295 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
304 addItemStringList("AdditionalMails",&mAdditionalMails,""); 296 addItemStringList("AdditionalMails",&mAdditionalMails,"");
305 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 297 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
306 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 298 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
307 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 299 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
308 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 300 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
309 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 301 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
310 302
311 KPrefs::setCurrentGroup( "Editors" ); 303 KPrefs::setCurrentGroup( "Editors" );
312 304
313 addItemStringList( "EventTemplates", &mEventTemplates ); 305 addItemStringList( "EventTemplates", &mEventTemplates );
314 addItemStringList( "TodoTemplates", &mTodoTemplates ); 306 addItemStringList( "TodoTemplates", &mTodoTemplates );
315 307
316 addItemInt("DestinationPolicy",&mDestination,standardDestination); 308 addItemInt("DestinationPolicy",&mDestination,standardDestination);
317 309
318 310
319 311
320} 312}
321 313
322 314
323KOPrefs::~KOPrefs() 315KOPrefs::~KOPrefs()
324{ 316{
325 if (mInstance == this) 317 if (mInstance == this)
326 mInstance = insd.setObject(0); 318 mInstance = insd.setObject(0);
327 setLocaleDict( 0 ); 319 setLocaleDict( 0 );
328 if ( mLocaleDict ) 320 if ( mLocaleDict )
329 delete mLocaleDict; 321 delete mLocaleDict;
330 //qDebug("KOPrefs::~KOPrefs() "); 322 //qDebug("KOPrefs::~KOPrefs() ");
331} 323}
332 324
333 325
334KOPrefs *KOPrefs::instance() 326KOPrefs *KOPrefs::instance()
335{ 327{
336 if (!mInstance) { 328 if (!mInstance) {
337 mInstance = insd.setObject(new KOPrefs()); 329 mInstance = insd.setObject(new KOPrefs());
338 mInstance->readConfig(); 330 mInstance->readConfig();
339 } 331 }
340 332
341 return mInstance; 333 return mInstance;
342} 334}
343 335
344void KOPrefs::usrSetDefaults() 336void KOPrefs::usrSetDefaults()
345{ 337{
346 338
347} 339}
348 340
349void KOPrefs::fillMailDefaults() 341void KOPrefs::fillMailDefaults()
350{ 342{
351 if (mName.isEmpty()) mName = i18n("Anonymous"); 343 if (mName.isEmpty()) mName = i18n("Anonymous");
352 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 344 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
353} 345}
354 346
355void KOPrefs::setTimeZoneIdDefault() 347void KOPrefs::setTimeZoneIdDefault()
356{ 348{
357 mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); 349 ;
358} 350}
359 351
360void KOPrefs::setCategoryDefaults() 352void KOPrefs::setCategoryDefaults()
361{ 353{
362 mCustomCategories.clear(); 354 mCustomCategories.clear();
363 mCustomCategories = getDefaultList(); 355 mCustomCategories = getDefaultList();
364 356
365 QStringList::Iterator it; 357 QStringList::Iterator it;
366 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 358 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
367 setCategoryColor(*it,mDefaultCategoryColor); 359 setCategoryColor(*it,mDefaultCategoryColor);
368 } 360 }
369} 361}
370 362
371QStringList KOPrefs::getDefaultList() 363QStringList KOPrefs::getDefaultList()
372{ 364{
373 QStringList retval ; 365 QStringList retval ;
374 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 366 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
375 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 367 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
376 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 368 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
377 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 369 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
378 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 370 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
379 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 371 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
380 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 372 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
381 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 373 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
382 retval.sort(); 374 retval.sort();
383 return retval; 375 return retval;
384} 376}
385 377
386void KOPrefs::usrReadConfig() 378void KOPrefs::usrReadConfig()
387{ 379{
388 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 380 mPreferredLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
389 mLocaleDict = 0; 381 mLocaleDict = 0;
390 // pending LR fix translation 382 // pending LR fix translation
391 // qDebug("KOPrefs::usrReadConfig() fix translation "); 383 // qDebug("KOPrefs::usrReadConfig() fix translation ");
392 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { 384 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
393 if ( mPreferredLanguage == 1 ) { 385 if ( mPreferredLanguage == 1 ) {
394 mLocaleDict = new QDict<QString>; 386 mLocaleDict = new QDict<QString>;
395 int i = 0; 387 int i = 0;
396 QString fw ( germanwords[i] [0]); 388 QString fw ( germanwords[i] [0]);
397 while ( !fw.isEmpty() ) { 389 while ( !fw.isEmpty() ) {
398 mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); 390 mLocaleDict->insert( fw, new QString (germanwords[i] [1] ));
399 ++i; 391 ++i;
400 fw = germanwords[i] [0]; 392 fw = germanwords[i] [0];
401 } 393 }
402 394
403 setLocaleDict( mLocaleDict ); 395 setLocaleDict( mLocaleDict );
404 } else { 396 } else {
405 QString fileName ; 397 QString fileName ;
406 if ( mPreferredLanguage == 4 ) 398 if ( mPreferredLanguage == 4 )
407 fileName = MainWindow::resourcePath()+"usertranslation.txt"; 399 fileName = MainWindow::resourcePath()+"usertranslation.txt";
408 else if ( mPreferredLanguage == 2 ) 400 else if ( mPreferredLanguage == 2 )
409 fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; 401 fileName = MainWindow::resourcePath()+"frenchtranslation.txt";
410 else if ( mPreferredLanguage == 3 ) 402 else if ( mPreferredLanguage == 3 )
411 fileName = MainWindow::resourcePath()+"italiantranslation.txt"; 403 fileName = MainWindow::resourcePath()+"italiantranslation.txt";
412 QFile file( fileName ); 404 QFile file( fileName );
413 if (file.open( IO_ReadOnly ) ) { 405 if (file.open( IO_ReadOnly ) ) {
414 QTextStream ts( &file ); 406 QTextStream ts( &file );
415 ts.setEncoding( QTextStream::Latin1 ); 407 ts.setEncoding( QTextStream::Latin1 );
416 //ts.setCodec( QTextCodec::latin1 ); 408 //ts.setCodec( QTextCodec::latin1 );
417 QString text = ts.read(); 409 QString text = ts.read();
418 file.close(); 410 file.close();
419 text.replace( QRegExp("\\\\n"), "\n" ); 411 text.replace( QRegExp("\\\\n"), "\n" );
420 QString line; 412 QString line;
421 QString we; 413 QString we;
@@ -426,132 +418,129 @@ void KOPrefs::usrReadConfig()
426 line = text.mid( br, nbr - br ); 418 line = text.mid( br, nbr - br );
427 br = nbr+1; 419 br = nbr+1;
428 int se, ee, st, et; 420 int se, ee, st, et;
429 mLocaleDict = new QDict<QString>; 421 mLocaleDict = new QDict<QString>;
430 QString end = "{ \"\",\"\" }"; 422 QString end = "{ \"\",\"\" }";
431 while ( (line != end) && (br > 1) ) { 423 while ( (line != end) && (br > 1) ) {
432 //qDebug("%d *%s* ", br, line.latin1()); 424 //qDebug("%d *%s* ", br, line.latin1());
433 se = line.find("\"")+1; 425 se = line.find("\"")+1;
434 et = line.findRev("\"",-1); 426 et = line.findRev("\"",-1);
435 ee = line.find("\",\""); 427 ee = line.find("\",\"");
436 st = ee+3; 428 st = ee+3;
437 we = line.mid( se, ee-se ); 429 we = line.mid( se, ee-se );
438 wt = line.mid( st, et-st ); 430 wt = line.mid( st, et-st );
439 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 431 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
440 mLocaleDict->insert( we, new QString (wt) ); 432 mLocaleDict->insert( we, new QString (wt) );
441 nbr = text.find ( "}", br ); 433 nbr = text.find ( "}", br );
442 line = text.mid( br, nbr - br ); 434 line = text.mid( br, nbr - br );
443 br = nbr+1; 435 br = nbr+1;
444 } 436 }
445 //qDebug("end *%s* ", end.latin1()); 437 //qDebug("end *%s* ", end.latin1());
446 438
447 setLocaleDict( mLocaleDict ); 439 setLocaleDict( mLocaleDict );
448 } else { 440 } else {
449 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 441 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
450 } 442 }
451 443
452 } 444 }
453 } 445 }
454 config()->setGroup("General"); 446 config()->setGroup("General");
455 447
456 mCustomCategories = config()->readListEntry("Custom Categories"); 448 mCustomCategories = config()->readListEntry("Custom Categories");
457 if ( KOPrefs::instance()->mLanguageChanged ) { 449 if ( KOPrefs::instance()->mLanguageChanged ) {
458 mLocationDefaults.clear(); 450 mLocationDefaults.clear();
459 mEventSummaryUser.clear(); 451 mEventSummaryUser.clear();
460 mTodoSummaryUser.clear(); 452 mTodoSummaryUser.clear();
461 } 453 }
462 if (mLocationDefaults.isEmpty()) { 454 if (mLocationDefaults.isEmpty()) {
463 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 455 mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
464 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 456 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
465 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 457 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
466 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 458 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
467 mLocationDefaults.sort(); 459 mLocationDefaults.sort();
468 } 460 }
469 461
470 if (mEventSummaryUser.isEmpty()) { 462 if (mEventSummaryUser.isEmpty()) {
471 mEventSummaryUser = getDefaultList() ; 463 mEventSummaryUser = getDefaultList() ;
472 } 464 }
473 if (mTodoSummaryUser.isEmpty()) { 465 if (mTodoSummaryUser.isEmpty()) {
474 mTodoSummaryUser = getDefaultList() ; 466 mTodoSummaryUser = getDefaultList() ;
475 } 467 }
476 468
477 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 469 if (mCustomCategories.isEmpty()) setCategoryDefaults();
478 470
479 config()->setGroup("Personal Settings"); 471 config()->setGroup("Personal Settings");
480 mName = config()->readEntry("user_name",""); 472 mName = config()->readEntry("user_name","");
481 mEmail = config()->readEntry("user_email",""); 473 mEmail = config()->readEntry("user_email","");
482 fillMailDefaults(); 474 fillMailDefaults();
483 475
484 config()->setGroup("Category Colors"); 476 config()->setGroup("Category Colors");
485 QStringList::Iterator it; 477 QStringList::Iterator it;
486 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 478 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
487 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 479 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
488 480
489 } 481 }
490 482
491 if (mTimeZoneId.isEmpty()) {
492 setTimeZoneIdDefault();
493 }
494 KPimPrefs::usrReadConfig(); 483 KPimPrefs::usrReadConfig();
495} 484}
496 485
497 486
498void KOPrefs::usrWriteConfig() 487void KOPrefs::usrWriteConfig()
499{ 488{
500 config()->setGroup("General"); 489 config()->setGroup("General");
501 config()->writeEntry("Custom Categories",mCustomCategories); 490 config()->writeEntry("Custom Categories",mCustomCategories);
502 491
503 config()->setGroup("Personal Settings"); 492 config()->setGroup("Personal Settings");
504 config()->writeEntry("user_name",mName); 493 config()->writeEntry("user_name",mName);
505 config()->writeEntry("user_email",mEmail); 494 config()->writeEntry("user_email",mEmail);
506 495
507 config()->setGroup("Category Colors"); 496 config()->setGroup("Category Colors");
508 QDictIterator<QColor> it(mCategoryColors); 497 QDictIterator<QColor> it(mCategoryColors);
509 while (it.current()) { 498 while (it.current()) {
510 config()->writeEntry(it.currentKey(),*(it.current())); 499 config()->writeEntry(it.currentKey(),*(it.current()));
511 ++it; 500 ++it;
512 } 501 }
513 502
514 503
515 KPimPrefs::usrWriteConfig(); 504 KPimPrefs::usrWriteConfig();
516} 505}
517 506
518void KOPrefs::setCategoryColor(QString cat,const QColor & color) 507void KOPrefs::setCategoryColor(QString cat,const QColor & color)
519{ 508{
520 mCategoryColors.replace(cat,new QColor(color)); 509 mCategoryColors.replace(cat,new QColor(color));
521} 510}
522 511
523QColor *KOPrefs::categoryColor(QString cat) 512QColor *KOPrefs::categoryColor(QString cat)
524{ 513{
525 QColor *color = 0; 514 QColor *color = 0;
526 515
527 if (!cat.isEmpty()) color = mCategoryColors[cat]; 516 if (!cat.isEmpty()) color = mCategoryColors[cat];
528 517
529 if (color) return color; 518 if (color) return color;
530 else return &mDefaultCategoryColor; 519 else return &mDefaultCategoryColor;
531} 520}
532 521
533void KOPrefs::setFullName(const QString &name) 522void KOPrefs::setFullName(const QString &name)
534{ 523{
535 mName = name; 524 mName = name;
536} 525}
537 526
538void KOPrefs::setEmail(const QString &email) 527void KOPrefs::setEmail(const QString &email)
539{ 528{
540 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 529 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
541 mEmail = email; 530 mEmail = email;
542} 531}
543 532
544QString KOPrefs::fullName() 533QString KOPrefs::fullName()
545{ 534{
546 if (mEmailControlCenter) { 535 if (mEmailControlCenter) {
547 KEMailSettings settings; 536 KEMailSettings settings;
548 return settings.getSetting(KEMailSettings::RealName); 537 return settings.getSetting(KEMailSettings::RealName);
549 } else { 538 } else {
550 return mName; 539 return mName;
551 } 540 }
552} 541}
553 542
554QString KOPrefs::email() 543QString KOPrefs::email()
555{ 544{
556 if (mEmailControlCenter) { 545 if (mEmailControlCenter) {
557 KEMailSettings settings; 546 KEMailSettings settings;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 03df59b..c74b0ef 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -34,135 +34,131 @@ class 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 };
41 enum { IMIPOutbox, IMIPdirectsend }; 41 enum { IMIPOutbox, IMIPdirectsend };
42 enum { neverAuto, addressbookAuto, selectedAuto }; 42 enum { neverAuto, addressbookAuto, selectedAuto };
43 enum { standardDestination, askDestination }; 43 enum { standardDestination, askDestination };
44 44
45 virtual ~KOPrefs(); 45 virtual ~KOPrefs();
46 46
47 /** Get instance of KOPrefs. It is made sure that there is only one 47 /** Get instance of KOPrefs. It is made sure that there is only one
48 instance. */ 48 instance. */
49 static KOPrefs *instance(); 49 static KOPrefs *instance();
50 50
51 /** Set preferences to default values */ 51 /** Set preferences to default values */
52 void usrSetDefaults(); 52 void usrSetDefaults();
53 53
54 /** Read preferences from config file */ 54 /** Read preferences from config file */
55 void usrReadConfig(); 55 void usrReadConfig();
56 56
57 /** Write preferences to config file */ 57 /** Write preferences to config file */
58 void usrWriteConfig(); 58 void usrWriteConfig();
59 void setCategoryDefaults(); 59 void setCategoryDefaults();
60 60
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; 73 QDict<QString> *mLocaleDict;
74 QStringList getDefaultList(); 74 QStringList getDefaultList();
75 public: 75 public:
76 // preferences data 76 // preferences data
77 KConfig* getConfig(); 77 KConfig* getConfig();
78 void setFullName(const QString &); 78 void setFullName(const QString &);
79 QString fullName(); 79 QString fullName();
80 void setEmail(const QString &); 80 void setEmail(const QString &);
81 QString email(); 81 QString email();
82 82
83 QString mAdditional; 83 QString mAdditional;
84 84
85 bool mEmailControlCenter; 85 bool mEmailControlCenter;
86 86
87 bool mBcc; 87 bool mBcc;
88 bool mAutoSave; 88 bool mAutoSave;
89 int mAutoSaveInterval; 89 int mAutoSaveInterval;
90 bool mConfirm; 90 bool mConfirm;
91 91
92 bool mEnableGroupScheduling; 92 bool mEnableGroupScheduling;
93 bool mEnableProjectView; 93 bool mEnableProjectView;
94 94
95 int mDefaultFormat; 95 int mDefaultFormat;
96 int mMailClient; 96 int mMailClient;
97 97
98 QString mTimeZone;
99 //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius
100 //int mTimeZoneOffset; // e.g. -240 min
101 int mStartTime; 98 int mStartTime;
102 int mDefaultDuration; 99 int mDefaultDuration;
103 int mAlarmTime; 100 int mAlarmTime;
104 int mDaylightSavings;
105 101
106 int mWorkingHoursStart; 102 int mWorkingHoursStart;
107 int mWorkingHoursEnd; 103 int mWorkingHoursEnd;
108 bool mExcludeHolidays; 104 bool mExcludeHolidays;
109 bool mExcludeSaturdays; 105 bool mExcludeSaturdays;
110 bool mMarcusBainsShowSeconds; 106 bool mMarcusBainsShowSeconds;
111 107
112 QFont mTimeBarFont; 108 QFont mTimeBarFont;
113 QFont mMonthViewFont; 109 QFont mMonthViewFont;
114 QFont mAgendaViewFont; 110 QFont mAgendaViewFont;
115 QFont mMarcusBainsFont; 111 QFont mMarcusBainsFont;
116 QFont mTimeLabelsFont; 112 QFont mTimeLabelsFont;
117 QFont mTodoViewFont; 113 QFont mTodoViewFont;
118 QFont mListViewFont; 114 QFont mListViewFont;
119 QFont mDateNavigatorFont; 115 QFont mDateNavigatorFont;
120 QFont mEditBoxFont; 116 QFont mEditBoxFont;
121 QFont mJornalViewFont; 117 QFont mJornalViewFont;
122 QFont mWhatsNextFont; 118 QFont mWhatsNextFont;
123 QFont mEventViewFont; 119 QFont mEventViewFont;
124 120
125 121
126 122
127 123
128 QColor mHolidayColor; 124 QColor mHolidayColor;
129 QColor mHighlightColor; 125 QColor mHighlightColor;
130 QColor mEventColor; 126 QColor mEventColor;
131 QColor mAgendaBgColor; 127 QColor mAgendaBgColor;
132 QColor mWorkingHoursColor; 128 QColor mWorkingHoursColor;
133 QColor mTodoDueTodayColor; 129 QColor mTodoDueTodayColor;
134 QColor mTodoOverdueColor; 130 QColor mTodoOverdueColor;
135 QColor mMonthViewEvenColor; 131 QColor mMonthViewEvenColor;
136 QColor mMonthViewOddColor; 132 QColor mMonthViewOddColor;
137 QColor mMonthViewHolidayColor; 133 QColor mMonthViewHolidayColor;
138 bool mMonthViewUsesDayColors; 134 bool mMonthViewUsesDayColors;
139 bool mMonthViewSatSunTog; 135 bool mMonthViewSatSunTog;
140 QColor mAppColor1; 136 QColor mAppColor1;
141 QColor mAppColor2; 137 QColor mAppColor2;
142 bool mUseAppColors; 138 bool mUseAppColors;
143 139
144 int mDayBegins; 140 int mDayBegins;
145 int mHourSize; 141 int mHourSize;
146 int mAllDaySize; 142 int mAllDaySize;
147 bool mShowFullMenu; 143 bool mShowFullMenu;
148 bool mDailyRecur; 144 bool mDailyRecur;
149 bool mWeeklyRecur; 145 bool mWeeklyRecur;
150 bool mMonthDailyRecur; 146 bool mMonthDailyRecur;
151 bool mMonthWeeklyRecur; 147 bool mMonthWeeklyRecur;
152 bool mMonthShowIcons; 148 bool mMonthShowIcons;
153 bool mMonthShowShort; 149 bool mMonthShowShort;
154 bool mEnableToolTips; 150 bool mEnableToolTips;
155 bool mEnableMonthScroll; 151 bool mEnableMonthScroll;
156 bool mFullViewMonth; 152 bool mFullViewMonth;
157 bool mMonthViewUsesCategoryColor; 153 bool mMonthViewUsesCategoryColor;
158 bool mFullViewTodo; 154 bool mFullViewTodo;
159 bool mShowCompletedTodo; 155 bool mShowCompletedTodo;
160 bool mMarcusBainsEnabled; 156 bool mMarcusBainsEnabled;
161 int mNextXDays; 157 int mNextXDays;
162 int mWhatsNextDays; 158 int mWhatsNextDays;
163 int mWhatsNextPrios; 159 int mWhatsNextPrios;
164 bool mEnableQuickTodo; 160 bool mEnableQuickTodo;
165 bool mLanguageChanged; 161 bool mLanguageChanged;
166 162
167 bool mCompactDialogs; 163 bool mCompactDialogs;
168 bool mVerticalScreen; 164 bool mVerticalScreen;
@@ -210,83 +206,78 @@ class KOPrefs : public KPimPrefs
210 QString mLastImportFile; 206 QString mLastImportFile;
211 QString mLastVcalFile; 207 QString mLastVcalFile;
212 QString mLastSaveFile; 208 QString mLastSaveFile;
213 QString mLastLoadFile; 209 QString mLastLoadFile;
214 210
215 211
216 QString mDefaultAlarmFile; 212 QString mDefaultAlarmFile;
217 int mIMIPScheduler; 213 int mIMIPScheduler;
218 int mIMIPSend; 214 int mIMIPSend;
219 QStringList mAdditionalMails; 215 QStringList mAdditionalMails;
220 int mIMIPAutoRefresh; 216 int mIMIPAutoRefresh;
221 int mIMIPAutoInsertReply; 217 int mIMIPAutoInsertReply;
222 int mIMIPAutoInsertRequest; 218 int mIMIPAutoInsertRequest;
223 int mIMIPAutoFreeBusy; 219 int mIMIPAutoFreeBusy;
224 int mIMIPAutoFreeBusyReply; 220 int mIMIPAutoFreeBusyReply;
225 221
226 QStringList mTodoTemplates; 222 QStringList mTodoTemplates;
227 QStringList mEventTemplates; 223 QStringList mEventTemplates;
228 224
229 int mDestination; 225 int mDestination;
230 226
231 227
232 bool mEditOnDoubleClick; 228 bool mEditOnDoubleClick;
233 bool mViewChangeHoldFullscreen; 229 bool mViewChangeHoldFullscreen;
234 bool mViewChangeHoldNonFullscreen; 230 bool mViewChangeHoldNonFullscreen;
235 bool mCenterOnCurrentTime; 231 bool mCenterOnCurrentTime;
236 bool mSetTimeToDayStartAt; 232 bool mSetTimeToDayStartAt;
237 bool mHighlightCurrentDay; 233 bool mHighlightCurrentDay;
238 bool mUseHighlightLightColor; 234 bool mUseHighlightLightColor;
239 bool mListViewMonthTimespan; 235 bool mListViewMonthTimespan;
240 bool mWNViewShowsParents; 236 bool mWNViewShowsParents;
241 bool mWNViewShowLocation; 237 bool mWNViewShowLocation;
242 bool mTodoViewShowsPercentage; 238 bool mTodoViewShowsPercentage;
243 bool mTodoViewUsesCatColors; 239 bool mTodoViewUsesCatColors;
244 bool mTodoViewUsesSmallFont; 240 bool mTodoViewUsesSmallFont;
245 bool mTodoViewUsesForegroundColor; 241 bool mTodoViewUsesForegroundColor;
246 bool mMonthViewUsesForegroundColor; 242 bool mMonthViewUsesForegroundColor;
247 243
248 bool mHightlightDateTimeEdit; 244 bool mHightlightDateTimeEdit;
249 bool mShortDateInViewer; 245 bool mShortDateInViewer;
250 246
251 QStringList mLocationDefaults; 247 QStringList mLocationDefaults;
252 QStringList mEventSummaryUser; 248 QStringList mEventSummaryUser;
253 QStringList mTodoSummaryUser; 249 QStringList mTodoSummaryUser;
254 250
255 bool mUseInternalAlarmNotification; 251 bool mUseInternalAlarmNotification;
256 int mAlarmPlayBeeps; 252 int mAlarmPlayBeeps;
257 int mAlarmSuspendTime; 253 int mAlarmSuspendTime;
258 int mAlarmSuspendCount; 254 int mAlarmSuspendCount;
259 int mAlarmBeepInterval; 255 int mAlarmBeepInterval;
260 256
261 257
262 QString mActiveSyncPort; 258 QString mActiveSyncPort;
263 QString mActiveSyncIP; 259 QString mActiveSyncIP;
264 260
265 261
266 //US I copied the following settings into KPimGlobalPrefs 262 //US I copied the following settings into KPimGlobalPrefs
267 // that allows us later to easily remove the settings from here. 263 // that allows us later to easily remove the settings from here.
268 int mPreferredDate; 264 int mPreferredDate;
269 QString mUserDateFormatLong; 265 QString mUserDateFormatLong;
270 QString mUserDateFormatShort; 266 QString mUserDateFormatShort;
271 int mPreferredLanguage; 267 int mPreferredLanguage;
272 int mPreferredTime; 268 int mPreferredTime;
273 bool mWeekStartsOnSunday; 269 bool mWeekStartsOnSunday;
274 QString mTimeZoneId;
275 bool mUseDaylightsaving;
276 int mDaylightsavingStart;
277 int mDaylightsavingEnd;
278
279 270
280 private: 271 private:
281 QDict<QColor> mCategoryColors; 272 QDict<QColor> mCategoryColors;
282 QColor mDefaultCategoryColor; 273 QColor mDefaultCategoryColor;
283 274
284 QFont mDefaultTimeBarFont; 275 QFont mDefaultTimeBarFont;
285 QFont mDefaultViewFont; 276 QFont mDefaultViewFont;
286 QFont mDefaultMonthViewFont; 277 QFont mDefaultMonthViewFont;
287 278
288 QString mName; 279 QString mName;
289 QString mEmail; 280 QString mEmail;
290}; 281};
291 282
292#endif 283#endif
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 7cd6038..0a580ca 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,124 +1,124 @@
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 <qregexp.h> 37#include <qregexp.h>
38#include "kpimglobalprefs.h" 38#include "kpimglobalprefs.h"
39 39
40KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 40KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
41static KStaticDeleter<KPimGlobalPrefs> staticDeleter; 41static KStaticDeleter<KPimGlobalPrefs> staticDeleter;
42 42
43 43
44KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 44KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
45 : KPrefs("microkdeglobalrc") 45 : KPrefs("microkdeglobalrc")
46{ 46{
47 47
48 KPrefs::setCurrentGroup("Locale"); 48 KPrefs::setCurrentGroup("Locale");
49 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 49 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
50 addItemInt("PreferredTime",&mPreferredTime,0); 50 addItemInt("PreferredTime",&mPreferredTime,0);
51 addItemInt("PreferredDate",&mPreferredDate,0); 51 addItemInt("PreferredDate",&mPreferredDate,0);
52 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 52 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
53 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); 53 //addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false);
54 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 54 // addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
55 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 55 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
56 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 56 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
57 57
58 KPrefs::setCurrentGroup("Time & Date"); 58 KPrefs::setCurrentGroup("Time & Date");
59 59
60 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 60 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") );
61 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 61 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
62 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); 62 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false);
63 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 63 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
64 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 64 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
65 65
66 KPrefs::setCurrentGroup( "ExternalApplications" ); 66 KPrefs::setCurrentGroup( "ExternalApplications" );
67 67
68 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 68 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
69 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 69 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
70 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 70 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
71 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 71 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
72 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 72 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
73 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 73 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
74 74
75 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 75 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
76 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 76 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
77 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 77 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
78 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 78 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
79 79
80 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 80 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
81 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 81 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
82 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 82 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
83 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 83 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
84 84
85 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 85 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
86 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 86 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
87 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 87 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
88 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 88 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
89 89
90 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 90 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
91 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 91 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
92 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 92 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
93 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 93 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
94 94
95 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); 95 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
96 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 96 addItemString( "SIPChannel", &mSipOtherChannel, "" );
97 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 97 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
98 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 98 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
99 99
100 KPrefs::setCurrentGroup( "PhoneAccess" ); 100 KPrefs::setCurrentGroup( "PhoneAccess" );
101 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); 101 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
102 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); 102 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
103 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); 103 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
104 104
105} 105}
106 106
107 107
108void KPimGlobalPrefs::setGlobalConfig() 108void KPimGlobalPrefs::setGlobalConfig()
109{ 109{
110 110
111 KGlobal::locale()->setHore24Format( !mPreferredTime ); 111 KGlobal::locale()->setHore24Format( !mPreferredTime );
112 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 112 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
113 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 113 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
114 KGlobal::locale()->setLanguage( mPreferredLanguage ); 114 KGlobal::locale()->setLanguage( mPreferredLanguage );
115 QString dummy = mUserDateFormatLong; 115 QString dummy = mUserDateFormatLong;
116 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 116 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
117 dummy = mUserDateFormatShort; 117 dummy = mUserDateFormatShort;
118 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 118 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
119 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 119 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
120 mDaylightsavingStart, 120 mDaylightsavingStart,
121 mDaylightsavingEnd ); 121 mDaylightsavingEnd );
122 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 122 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
123 123
124} 124}
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index 21e6937..d3b04dc 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -70,153 +70,153 @@ QString i18n(const char *text)
70 } 70 }
71 } 71 }
72 72
73} 73}
74 74
75QString i18n(const char *,const char *text) 75QString i18n(const char *,const char *text)
76{ 76{
77 return i18n( text ); 77 return i18n( text );
78} 78}
79 79
80QString i18n(const char *text1, const char *textn, int num) 80QString i18n(const char *text1, const char *textn, int num)
81{ 81{
82 if ( num == 1 ) return i18n( text1 ); 82 if ( num == 1 ) return i18n( text1 );
83 else { 83 else {
84 QString text = i18n( textn ); 84 QString text = i18n( textn );
85 int pos = text.find( "%n" ); 85 int pos = text.find( "%n" );
86 if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) ); 86 if ( pos >= 0 ) text.replace( pos, 2, QString::number( num ) );
87 return text; 87 return text;
88 } 88 }
89} 89}
90 90
91inline void put_it_in( QChar *buffer, uint& index, const QString &s ) 91inline void put_it_in( QChar *buffer, uint& index, const QString &s )
92{ 92{
93 for ( uint l = 0; l < s.length(); l++ ) 93 for ( uint l = 0; l < s.length(); l++ )
94 buffer[index++] = s.at( l ); 94 buffer[index++] = s.at( l );
95} 95}
96 96
97inline void put_it_in( QChar *buffer, uint& index, int number ) 97inline void put_it_in( QChar *buffer, uint& index, int number )
98{ 98{
99 buffer[index++] = number / 10 + '0'; 99 buffer[index++] = number / 10 + '0';
100 buffer[index++] = number % 10 + '0'; 100 buffer[index++] = number % 10 + '0';
101} 101}
102 102
103static int readInt(const QString &str, uint &pos) 103static int readInt(const QString &str, uint &pos)
104{ 104{
105 if (!str.at(pos).isDigit()) return -1; 105 if (!str.at(pos).isDigit()) return -1;
106 int result = 0; 106 int result = 0;
107 for (; str.length() > pos && str.at(pos).isDigit(); pos++) 107 for (; str.length() > pos && str.at(pos).isDigit(); pos++)
108 { 108 {
109 result *= 10; 109 result *= 10;
110 result += str.at(pos).digitValue(); 110 result += str.at(pos).digitValue();
111 } 111 }
112 112
113 return result; 113 return result;
114} 114}
115 115
116KLocale::KLocale() : mCalendarSystem( 0 ) 116KLocale::KLocale() : mCalendarSystem( 0 )
117{ 117{
118 118
119 m_decimalSymbol = "."; 119 m_decimalSymbol = ".";
120 m_positiveSign = ""; 120 m_positiveSign = "";
121 m_negativeSign = "-"; 121 m_negativeSign = "-";
122 m_thousandsSeparator = ","; 122 m_thousandsSeparator = ",";
123 123
124 124
125 125
126 126
127 mWeekStartsMonday = true; 127 mWeekStartsMonday = true;
128 mHourF24Format = true; 128 mHourF24Format = true;
129 mIntDateFormat = Default; 129 mIntDateFormat = Default;
130 mIntTimeFormat = Default; 130 mIntTimeFormat = Default;
131 mLanguage = 0; 131 mLanguage = 0;
132 mDateFormat = "%a %Y %b %d"; 132 mDateFormat = "%a %Y %b %d";
133 mDateFormatShort = "%Y-%m-%d"; 133 mDateFormatShort = "%Y-%m-%d";
134 mTimeZoneList << i18n ("-11:00 US/Samoa") 134 mTimeZoneList << ("-11:00 US/Samoa")
135 << i18n ("-10:00 US/Hawaii") 135 << ("-10:00 US/Hawaii")
136 << i18n ("-09:00 US/Alaska") 136 << ("-09:00 US/Alaska")
137 << i18n ("-08:00 US/Pacific") 137 << ("-08:00 US/Pacific")
138 << i18n ("-07:00 US/Mountain") 138 << ("-07:00 US/Mountain")
139 << i18n ("-06:00 US/Central") 139 << ("-06:00 US/Central")
140 << i18n ("-05:00 US/Eastern") 140 << ("-05:00 US/Eastern")
141 << i18n ("-04:00 Brazil/West") 141 << ("-04:00 Brazil/West")
142 << i18n ("-03:00 Brazil/East") 142 << ("-03:00 Brazil/East")
143 << i18n ("-02:00 Brazil/DeNoronha") 143 << ("-02:00 Brazil/DeNoronha")
144 << i18n ("-01:00 Atlantic/Azores") 144 << ("-01:00 Atlantic/Azores")
145 << i18n (" 00:00 Europe/London(UTC)") 145 << (" 00:00 Europe/London(UTC)")
146 << i18n ("+01:00 Europe/Oslo(CET)") 146 << ("+01:00 Europe/Oslo(CET)")
147 << i18n ("+02:00 Europe/Helsinki") 147 << ("+02:00 Europe/Helsinki")
148 << i18n ("+03:00 Europe/Moscow") 148 << ("+03:00 Europe/Moscow")
149 << i18n ("+04:00 Indian/Mauritius") 149 << ("+04:00 Indian/Mauritius")
150 << i18n ("+05:00 Indian/Maldives") 150 << ("+05:00 Indian/Maldives")
151 << i18n ("+06:00 Indian/Chagos") 151 << ("+06:00 Indian/Chagos")
152 << i18n ("+07:00 Asia/Bangkok") 152 << ("+07:00 Asia/Bangkok")
153 << i18n ("+08:00 Asia/Hongkong") 153 << ("+08:00 Asia/Hongkong")
154 << i18n ("+09:00 Asia/Tokyo") 154 << ("+09:00 Asia/Tokyo")
155 << i18n ("+10:00 Asia/Vladivostok") 155 << ("+10:00 Asia/Vladivostok")
156 << i18n ("+11:00 Asia/Magadan") 156 << ("+11:00 Asia/Magadan")
157 << i18n ("+12:00 Asia/Kamchatka") 157 << ("+12:00 Asia/Kamchatka")
158 // << i18n (" xx:xx User defined offset") 158 // << (" xx:xx User defined offset")
159 << i18n (" Local Time"); 159 << i18n (" Local Time");
160 mSouthDaylight = false; 160 mSouthDaylight = false;
161 mTimeZoneOffset = 0; 161 mTimeZoneOffset = 0;
162 daylightEnabled = false; 162 daylightEnabled = false;
163} 163}
164 164
165void KLocale::setDateFormat( QString s ) 165void KLocale::setDateFormat( QString s )
166{ 166{
167 mDateFormat = s; 167 mDateFormat = s;
168} 168}
169 169
170void KLocale::setDateFormatShort( QString s ) 170void KLocale::setDateFormatShort( QString s )
171{ 171{
172 mDateFormatShort = s; 172 mDateFormatShort = s;
173} 173}
174 174
175void KLocale::setHore24Format ( bool b ) 175void KLocale::setHore24Format ( bool b )
176{ 176{
177 mHourF24Format = b; 177 mHourF24Format = b;
178} 178}
179void KLocale::setWeekStartMonday( bool b ) 179void KLocale::setWeekStartMonday( bool b )
180{ 180{
181 mWeekStartsMonday = b; 181 mWeekStartsMonday = b;
182} 182}
183 183
184KLocale::IntDateFormat KLocale::getIntDateFormat( ) 184KLocale::IntDateFormat KLocale::getIntDateFormat( )
185{ 185{
186 return mIntDateFormat; 186 return mIntDateFormat;
187 187
188} 188}
189void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) 189void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
190{ 190{
191 mIntDateFormat = i; 191 mIntDateFormat = i;
192} 192}
193KLocale::IntDateFormat KLocale::getIntTimeFormat( ) 193KLocale::IntDateFormat KLocale::getIntTimeFormat( )
194{ 194{
195 return mIntTimeFormat; 195 return mIntTimeFormat;
196 196
197} 197}
198void KLocale::setIntTimeFormat( KLocale::IntDateFormat i ) 198void KLocale::setIntTimeFormat( KLocale::IntDateFormat i )
199{ 199{
200 mIntTimeFormat = i; 200 mIntTimeFormat = i;
201} 201}
202 202
203void KLocale::setLanguage( int i ) 203void KLocale::setLanguage( int i )
204{ 204{
205 mLanguage = i; 205 mLanguage = i;
206} 206}
207int KLocale::language( ) 207int KLocale::language( )
208{ 208{
209 return mLanguage; 209 return mLanguage;
210} 210}
211QString KLocale::translate( const char *index ) const 211QString KLocale::translate( const char *index ) const
212{ 212{
213 return i18n( index ); 213 return i18n( index );
214} 214}
215 215
216QString KLocale::translate( const char *, const char *fallback) const 216QString KLocale::translate( const char *, const char *fallback) const
217{ 217{
218 return i18n( fallback ); 218 return i18n( fallback );
219} 219}
220 220
221QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const 221QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const
222{ 222{