summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-20 10:43:07 (UTC)
committer zautrix <zautrix>2005-04-20 10:43:07 (UTC)
commitf23afbb9c09b4ee0f00af8f04ee4458181792cd0 (patch) (unidiff)
tree807bcaf329d257ec2a0c5c6e3a6afc7ab53a6078 /korganizer
parent03f7f26ad34f50dd86f335c7c5a25a292d642793 (diff)
downloadkdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.zip
kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.tar.gz
kdepimpi-f23afbb9c09b4ee0f00af8f04ee4458181792cd0.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp14
-rw-r--r--korganizer/koprefsdialog.cpp4
2 files changed, 9 insertions, 9 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index df606d0..c32a2a4 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -1,758 +1,762 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> 3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
4 Parts of the source code have been copied from kdpdatebutton.cpp 4 Parts of the source code have been copied from kdpdatebutton.cpp
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 ode for Qt in the source distribution. 22 without including the source ode for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qevent.h> 25#include <qevent.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qptrlist.h> 27#include <qptrlist.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <libkcal/vcaldrag.h> 35#include <libkcal/vcaldrag.h>
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/dndfactory.h> 37#include <libkcal/dndfactory.h>
38#include <libkcal/calendarresources.h> 38#include <libkcal/calendarresources.h>
39#include <libkcal/resourcecalendar.h> 39#include <libkcal/resourcecalendar.h>
40#include <kresources/resourceselectdialog.h> 40#include <kresources/resourceselectdialog.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPLUGINS 44#ifndef KORG_NOPLUGINS
45#include "kocore.h" 45#include "kocore.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#include "koglobals.h" 48#include "koglobals.h"
49 49
50#include "kodaymatrix.h" 50#include "kodaymatrix.h"
51 51
52// ============================================================================ 52// ============================================================================
53// D Y N A M I C T I P 53// D Y N A M I C T I P
54// ============================================================================ 54// ============================================================================
55 55
56DynamicTip::DynamicTip( QWidget * parent ) 56DynamicTip::DynamicTip( QWidget * parent )
57 : QToolTip( parent ) 57 : QToolTip( parent )
58{ 58{
59 matrix = (KODayMatrix*)parent; 59 matrix = (KODayMatrix*)parent;
60} 60}
61 61
62class KODaymatrixWhatsThis :public QWhatsThis 62class KODaymatrixWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; 65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;};
66 ~KODaymatrixWhatsThis() { ; }; 66 ~KODaymatrixWhatsThis() { qDebug("DELETE KODaymatrixWhatsThis "); };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p ) 69 virtual QString text( const QPoint& p )
70 { 70 {
71 return _view->getWhatsThisText( p ) ; 71 return _view->getWhatsThisText( p ) ;
72 } 72 }
73private: 73private:
74 KODayMatrix * _view; 74 KODayMatrix * _view;
75}; 75};
76 76
77void DynamicTip::maybeTip( const QPoint &pos ) 77void DynamicTip::maybeTip( const QPoint &pos )
78{ 78{
79 //calculate which cell of the matrix the mouse is in 79 //calculate which cell of the matrix the mouse is in
80 QRect sz = matrix->frameRect(); 80 QRect sz = matrix->frameRect();
81 int dheight = sz.height()*7 / 42; 81 int dheight = sz.height()*7 / 42;
82 int dwidth = sz.width() / 7; 82 int dwidth = sz.width() / 7;
83 int row = pos.y()/dheight; 83 int row = pos.y()/dheight;
84 int col = pos.x()/dwidth; 84 int col = pos.x()/dwidth;
85 85
86 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 86 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
87 87
88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
89// col << "][" << row << "] => " <<(col+row*7) << endl; 89// col << "][" << row << "] => " <<(col+row*7) << endl;
90 90
91 //show holiday names only 91 //show holiday names only
92 QString str = matrix->getHolidayLabel(col+row*7); 92 QString str = matrix->getHolidayLabel(col+row*7);
93 if (str.isEmpty()) return; 93 if (str.isEmpty()) return;
94 tip(rct, str); 94 tip(rct, str);
95} 95}
96 96
97 97
98// ============================================================================ 98// ============================================================================
99// K O D A Y M A T R I X 99// K O D A Y M A T R I X
100// ============================================================================ 100// ============================================================================
101 101
102const int KODayMatrix::NOSELECTION = -1000; 102const int KODayMatrix::NOSELECTION = -1000;
103const int KODayMatrix::NUMDAYS = 42; 103const int KODayMatrix::NUMDAYS = 42;
104 104
105KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) 105KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) 106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 )
107 107
108#if 0 108
109KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
110 QFrame(parent, name)
111#endif
112{ 109{
110 mLastView = -1;
113 oldW = 0; 111 oldW = 0;
114 oldH = 0; 112 oldH = 0;
115 myPix.resize( 150, 120 ); 113 myPix.resize( 150, 120 );
116 mRedrawNeeded = true; 114 mRedrawNeeded = true;
117 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
118 mPendingUpdateBeforeRepaint = false; 116 mPendingUpdateBeforeRepaint = false;
119 mouseDown = false; 117 mouseDown = false;
120 // initialize dynamic arrays 118 // initialize dynamic arrays
121 bDays.resize ( NUMDAYS ); 119 bDays.resize ( NUMDAYS );
122 pDays.resize ( NUMDAYS ); 120 pDays.resize ( NUMDAYS );
123 hDays.resize ( NUMDAYS ); 121 hDays.resize ( NUMDAYS );
124 eDays.resize ( NUMDAYS ); 122 eDays.resize ( NUMDAYS );
125 days = new QDate[NUMDAYS]; 123 days = new QDate[NUMDAYS];
126 daylbls = new QString[NUMDAYS]; 124 daylbls = new QString[NUMDAYS];
127 //events = new int[NUMDAYS]; 125 //events = new int[NUMDAYS];
128 mToolTip = new DynamicTip(this); 126 mToolTip = new DynamicTip(this);
129 127
130 // set default values used for drawing the matrix 128 // set default values used for drawing the matrix
131 mDefaultBackColor = palette().active().base(); 129 mDefaultBackColor = palette().active().base();
132 mDefaultTextColor = palette().active().foreground(); 130 mDefaultTextColor = palette().active().foreground();
133 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
134 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
135 mSelectedDaysColor = QColor("white"); 133 mSelectedDaysColor = QColor("white");
136 mTodayMarginWidth = 2; 134 mTodayMarginWidth = 2;
137 mSelEnd = mSelStart = NOSELECTION; 135 mSelEnd = mSelStart = NOSELECTION;
138 136
139 setAcceptDrops(true); 137 setAcceptDrops(true);
140 //setFont( QFont("Arial", 10) ); 138 //setFont( QFont("Arial", 10) );
141 139
142 mUpdateTimer = new QTimer( this ); 140 mUpdateTimer = new QTimer( this );
143 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
144 mRepaintTimer = new QTimer( this ); 142 mRepaintTimer = new QTimer( this );
145 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
146 mDayChanged = false; 144 mDayChanged = false;
147 updateView(); 145 updateView();
148} 146}
149QString KODayMatrix::getWhatsThisText( QPoint p ) 147QString KODayMatrix::getWhatsThisText( QPoint p )
150{ 148{
151 149
152 int tmp = getDayIndexFrom(p.x(), p.y()); 150 int tmp = getDayIndexFrom(p.x(), p.y());
153 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
154 return QString(); 152 return QString();
155 QDate mDate = days[tmp]; 153 QDate mDate = days[tmp];
156 QPtrList<Event> eventlist = mCalendar->events(mDate); 154 QPtrList<Event> eventlist = mCalendar->events(mDate);
157 Event *event; 155 Event *event;
158 QStringList mToolTip; 156 QStringList mToolTip;
159 for(event=eventlist.first();event != 0;event=eventlist.next()) { 157 for(event=eventlist.first();event != 0;event=eventlist.next()) {
160 QString mToolTipText; 158 QString mToolTipText;
161 QString text; 159 QString text;
162 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
163 if (event->isMultiDay()) { 161 if (event->isMultiDay()) {
164 QString prefix = "<->";multiday = 2; 162 QString prefix = "<->";multiday = 2;
165 QString time; 163 QString time;
166 if ( event->doesRecur() ) { 164 if ( event->doesRecur() ) {
167 if ( event->recursOn( mDate) ) { 165 if ( event->recursOn( mDate) ) {
168 prefix ="->" ;multiday = 1; 166 prefix ="->" ;multiday = 1;
169 } 167 }
170 else { 168 else {
171 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
172 if ( event->recursOn( mDate.addDays( -days)) ) { 170 if ( event->recursOn( mDate.addDays( -days)) ) {
173 prefix ="<-" ;multiday = 3; 171 prefix ="<-" ;multiday = 3;
174 } 172 }
175 } 173 }
176 } else { 174 } else {
177 if (mDate == event->dtStart().date()) { 175 if (mDate == event->dtStart().date()) {
178 prefix ="->" ;multiday = 1; 176 prefix ="->" ;multiday = 1;
179 } else if (mDate == event->dtEnd().date()) { 177 } else if (mDate == event->dtEnd().date()) {
180 prefix ="<-" ;multiday = 3; 178 prefix ="<-" ;multiday = 3;
181 } 179 }
182 } 180 }
183 if ( !event->doesFloat() ) { 181 if ( !event->doesFloat() ) {
184 if ( mDate == event->dtStart().date () ) 182 if ( mDate == event->dtStart().date () )
185 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
186 else if ( mDate == event->dtEnd().date () ) 184 else if ( mDate == event->dtEnd().date () )
187 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
188 186
189 } 187 }
190 text = time + event->summary(); 188 text = time + event->summary();
191 mToolTipText += prefix + text; 189 mToolTipText += prefix + text;
192 } else { 190 } else {
193 if (event->doesFloat()) { 191 if (event->doesFloat()) {
194 text = event->summary(); 192 text = event->summary();
195 mToolTipText += text; 193 mToolTipText += text;
196 } 194 }
197 else { 195 else {
198 text = KGlobal::locale()->formatTime(event->dtStart().time()); 196 text = KGlobal::locale()->formatTime(event->dtStart().time());
199 text += " " + event->summary(); 197 text += " " + event->summary();
200 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
201 } 199 }
202 } 200 }
203 if ( !event->location().isEmpty() ) 201 if ( !event->location().isEmpty() )
204 mToolTipText += " (" + event->location() + ")"; 202 mToolTipText += " (" + event->location() + ")";
205#if QT_VERSION >= 0x030000 203#if QT_VERSION >= 0x030000
206 mToolTipText.replace( '<' , "&lt;" ); 204 mToolTipText.replace( '<' , "&lt;" );
207 mToolTipText.replace( '>' , "&gt;" ); 205 mToolTipText.replace( '>' , "&gt;" );
208#else 206#else
209 if ( mToolTipText.find ('<') >= 0 ) { 207 if ( mToolTipText.find ('<') >= 0 ) {
210 mToolTipText.replace( QRegExp("<") , "&lt;" ); 208 mToolTipText.replace( QRegExp("<") , "&lt;" );
211 } 209 }
212 if ( mToolTipText.find ('>') >= 0 ) { 210 if ( mToolTipText.find ('>') >= 0 ) {
213 mToolTipText.replace( QRegExp(">") , "&gt;" ); 211 mToolTipText.replace( QRegExp(">") , "&gt;" );
214 } 212 }
215#endif 213#endif
216 //qDebug("TTT: %s ", mToolTipText.latin1()); 214 //qDebug("TTT: %s ", mToolTipText.latin1());
217 mToolTip.append( mToolTipText ); 215 mToolTip.append( mToolTipText );
218 } 216 }
219 mToolTip.sort(); 217 mToolTip.sort();
220 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 218 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
221} 219}
222void KODayMatrix::setCalendar( Calendar *cal ) 220void KODayMatrix::setCalendar( Calendar *cal )
223{ 221{
224 mCalendar = cal; 222 mCalendar = cal;
225 223
226 setAcceptDrops( mCalendar ); 224 setAcceptDrops( mCalendar );
227 225
228 updateEvents(); 226 updateEvents();
229} 227}
230 228
231QColor KODayMatrix::getShadedColor(QColor color) 229QColor KODayMatrix::getShadedColor(QColor color)
232{ 230{
233 QColor shaded; 231 QColor shaded;
234 int h=0; 232 int h=0;
235 int s=0; 233 int s=0;
236 int v=0; 234 int v=0;
237 color.hsv(&h,&s,&v); 235 color.hsv(&h,&s,&v);
238 s = s/4; 236 s = s/4;
239 v = 192+v/4; 237 v = 192+v/4;
240 shaded.setHsv(h,s,v); 238 shaded.setHsv(h,s,v);
241 239
242 return shaded; 240 return shaded;
243} 241}
244 242
245KODayMatrix::~KODayMatrix() 243KODayMatrix::~KODayMatrix()
246{ 244{
245#if QT_VERSION >= 0x030000
246
247#else
248 delete mKODaymatrixWhatsThis;
249#endif
250
247 // delete mKODaymatrixWhatsThis; 251 // delete mKODaymatrixWhatsThis;
248 delete [] days; 252 delete [] days;
249 delete [] daylbls; 253 delete [] daylbls;
250 //delete [] events; 254 //delete [] events;
251 delete mToolTip; 255 delete mToolTip;
252} 256}
253 257
254/* 258/*
255void KODayMatrix::setStartDate(QDate start) 259void KODayMatrix::setStartDate(QDate start)
256{ 260{
257 updateView(start); 261 updateView(start);
258} 262}
259*/ 263*/
260 264
261void KODayMatrix::addSelectedDaysTo(DateList& selDays) 265void KODayMatrix::addSelectedDaysTo(DateList& selDays)
262{ 266{
263 267
264 if (mSelStart == NOSELECTION) { 268 if (mSelStart == NOSELECTION) {
265 return; 269 return;
266 } 270 }
267 271
268 //cope with selection being out of matrix limits at top (< 0) 272 //cope with selection being out of matrix limits at top (< 0)
269 int i0 = mSelStart; 273 int i0 = mSelStart;
270 if (i0 < 0) { 274 if (i0 < 0) {
271 for (int i = i0; i < 0; i++) { 275 for (int i = i0; i < 0; i++) {
272 selDays.append(days[0].addDays(i)); 276 selDays.append(days[0].addDays(i));
273 } 277 }
274 i0 = 0; 278 i0 = 0;
275 } 279 }
276 280
277 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 281 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
278 if (mSelEnd > NUMDAYS-1) { 282 if (mSelEnd > NUMDAYS-1) {
279 for (int i = i0; i <= NUMDAYS-1; i++) { 283 for (int i = i0; i <= NUMDAYS-1; i++) {
280 selDays.append(days[i]); 284 selDays.append(days[i]);
281 } 285 }
282 for (int i = NUMDAYS; i < mSelEnd; i++) { 286 for (int i = NUMDAYS; i < mSelEnd; i++) {
283 selDays.append(days[0].addDays(i)); 287 selDays.append(days[0].addDays(i));
284 } 288 }
285 289
286 // apply normal routine to selection being entirely within matrix limits 290 // apply normal routine to selection being entirely within matrix limits
287 } else { 291 } else {
288 for (int i = i0; i <= mSelEnd; i++) { 292 for (int i = i0; i <= mSelEnd; i++) {
289 selDays.append(days[i]); 293 selDays.append(days[i]);
290 } 294 }
291 } 295 }
292} 296}
293 297
294bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 298bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
295{ 299{
296 mRedrawNeeded = true; 300 mRedrawNeeded = true;
297 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); 301 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION );
298 mSelStart = startdate.daysTo(start); 302 mSelStart = startdate.daysTo(start);
299 if ( mSelStart < 0 ) 303 if ( mSelStart < 0 )
300 mSelStart = 0; 304 mSelStart = 0;
301 mSelEnd = startdate.daysTo(end); 305 mSelEnd = startdate.daysTo(end);
302 if ( mSelEnd > NUMDAYS-1 ) 306 if ( mSelEnd > NUMDAYS-1 )
303 mSelEnd = NUMDAYS-1; 307 mSelEnd = NUMDAYS-1;
304 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { 308 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) {
305 clearSelection(); 309 clearSelection();
306 if ( noSel ) 310 if ( noSel )
307 return false; 311 return false;
308 } 312 }
309 313
310 return true; 314 return true;
311} 315}
312void KODayMatrix::clearSelection() 316void KODayMatrix::clearSelection()
313{ 317{
314 mSelEnd = mSelStart = NOSELECTION; 318 mSelEnd = mSelStart = NOSELECTION;
315} 319}
316 320
317 321
318void KODayMatrix::recalculateToday() 322void KODayMatrix::recalculateToday()
319{ 323{
320 today = -1; 324 today = -1;
321 for (int i=0; i<NUMDAYS; i++) { 325 for (int i=0; i<NUMDAYS; i++) {
322 //events[i] = 0; 326 //events[i] = 0;
323 days[i] = startdate.addDays(i); 327 days[i] = startdate.addDays(i);
324 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 328 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
325 329
326 // if today is in the currently displayed month, hilight today 330 // if today is in the currently displayed month, hilight today
327 if (days[i].year() == QDate::currentDate().year() && 331 if (days[i].year() == QDate::currentDate().year() &&
328 days[i].month() == QDate::currentDate().month() && 332 days[i].month() == QDate::currentDate().month() &&
329 days[i].day() == QDate::currentDate().day()) { 333 days[i].day() == QDate::currentDate().day()) {
330 today = i; 334 today = i;
331 } 335 }
332 } 336 }
333 // qDebug(QString("Today is visible at %1.").arg(today)); 337 // qDebug(QString("Today is visible at %1.").arg(today));
334} 338}
335 339
336void KODayMatrix::updateView() 340void KODayMatrix::updateView()
337{ 341{
338 updateView(startdate); 342 updateView(startdate);
339} 343}
340void KODayMatrix::repaintViewTimed() 344void KODayMatrix::repaintViewTimed()
341{ 345{
342 mRedrawNeeded = true; 346 mRedrawNeeded = true;
343 // bDays.fill( false); 347 // bDays.fill( false);
344 //pDays.fill( false); 348 //pDays.fill( false);
345 //hDays.fill( false); 349 //hDays.fill( false);
346 //eDays.fill( false); 350 //eDays.fill( false);
347 mRepaintTimer->stop(); 351 mRepaintTimer->stop();
348 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 352 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
349 int i; 353 int i;
350 for(i = 0; i < NUMDAYS; i++) { 354 for(i = 0; i < NUMDAYS; i++) {
351 if ( ( (i+startDay) % 7 == 0 ) ) { 355 if ( ( (i+startDay) % 7 == 0 ) ) {
352 pDays.setBit(i); 356 pDays.setBit(i);
353 } 357 }
354 } 358 }
355 repaint(false); 359 repaint(false);
356} 360}
357void KODayMatrix::computeEvent(Event *event, int i ) 361void KODayMatrix::computeEvent(Event *event, int i )
358{ 362{
359 QString holiStr = mHolidays[i]; 363 QString holiStr = mHolidays[i];
360 if ( event->isHoliday()) { 364 if ( event->isHoliday()) {
361 pDays.setBit(i); 365 pDays.setBit(i);
362 hDays.setBit(i); 366 hDays.setBit(i);
363 if ( !holiStr.isEmpty() ) 367 if ( !holiStr.isEmpty() )
364 holiStr += "\n"; 368 holiStr += "\n";
365 holiStr += event->summary(); 369 holiStr += event->summary();
366 if ( !event->location().isEmpty() ) 370 if ( !event->location().isEmpty() )
367 holiStr += " (" + event->location() + ")"; 371 holiStr += " (" + event->location() + ")";
368 mHolidays[i] =holiStr ; 372 mHolidays[i] =holiStr ;
369 eDays.setBit(i); 373 eDays.setBit(i);
370 } 374 }
371 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) { 375 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) {
372 if ( event->isBirthday()) { 376 if ( event->isBirthday()) {
373 pDays.setBit(i); 377 pDays.setBit(i);
374 if ( !holiStr.isEmpty() ) 378 if ( !holiStr.isEmpty() )
375 holiStr += "\n"; 379 holiStr += "\n";
376 holiStr += i18n("Birthday") + ": "+event->summary(); 380 holiStr += i18n("Birthday") + ": "+event->summary();
377 if ( !event->location().isEmpty() ) 381 if ( !event->location().isEmpty() )
378 holiStr += " (" + event->location() + ")"; 382 holiStr += " (" + event->location() + ")";
379 bDays.setBit(i); 383 bDays.setBit(i);
380 mHolidays[i] =holiStr ; 384 mHolidays[i] =holiStr ;
381 } 385 }
382 } 386 }
383 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) 387 if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW )
384 eDays.setBit(i); 388 eDays.setBit(i);
385} 389}
386void KODayMatrix::updateViewTimed() 390void KODayMatrix::updateViewTimed()
387{ 391{
388 mUpdateTimer->stop(); 392 mUpdateTimer->stop();
389 if ( !mCalendar ) { 393 if ( !mCalendar ) {
390 qDebug("NOT CAL "); 394 qDebug("NOT CAL ");
391 return; 395 return;
392 } 396 }
393#if 1 397#if 1
394 398
395 399
396 int i; 400 int i;
397 int timeSpan = NUMDAYS-1; 401 int timeSpan = NUMDAYS-1;
398 QPtrList<Event> events = mCalendar->events(); 402 QPtrList<Event> events = mCalendar->events();
399 Event *event; 403 Event *event;
400 QDateTime dt; 404 QDateTime dt;
401 bool ok; 405 bool ok;
402 bDays.fill( false); 406 bDays.fill( false);
403 pDays.fill( false); 407 pDays.fill( false);
404 hDays.fill( false); 408 hDays.fill( false);
405 eDays.fill( false); 409 eDays.fill( false);
406 mHolidays.clear(); 410 mHolidays.clear();
407 QDate mStartDate = days[0]; 411 QDate mStartDate = days[0];
408 QDate endDate = mStartDate.addDays( timeSpan ); 412 QDate endDate = mStartDate.addDays( timeSpan );
409 for( event = events.first(); event; event = events.next() ) { // for event 413 for( event = events.first(); event; event = events.next() ) { // for event
410 ushort recurType = event->recurrence()->doesRecur(); 414 ushort recurType = event->recurrence()->doesRecur();
411 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 415 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
412 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 416 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
413 continue; 417 continue;
414 } 418 }
415 if ( event->doesRecur() ) { 419 if ( event->doesRecur() ) {
416 bool last; 420 bool last;
417 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 421 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
418 QDateTime incidenceEnd; 422 QDateTime incidenceEnd;
419 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 423 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
420 bool invalid = false; 424 bool invalid = false;
421 while( true ) { 425 while( true ) {
422 if ( incidenceStart.isValid() ) { 426 if ( incidenceStart.isValid() ) {
423 incidenceEnd = incidenceStart.addDays( eventlen ); 427 incidenceEnd = incidenceStart.addDays( eventlen );
424 int st = incidenceStart.date().daysTo( endDate ); 428 int st = incidenceStart.date().daysTo( endDate );
425 if ( st >= 0 ) { // start before timeend 429 if ( st >= 0 ) { // start before timeend
426 int end = mStartDate.daysTo( incidenceEnd.date() ); 430 int end = mStartDate.daysTo( incidenceEnd.date() );
427 if ( end >= 0 ) { // end after timestart --- got one! 431 if ( end >= 0 ) { // end after timestart --- got one!
428 //normalize 432 //normalize
429 st = timeSpan - st; 433 st = timeSpan - st;
430 if ( st < 0 ) st = 0; 434 if ( st < 0 ) st = 0;
431 if ( end > timeSpan ) end = timeSpan; 435 if ( end > timeSpan ) end = timeSpan;
432 int iii; 436 int iii;
433 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 437 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
434 for ( iii = st;iii<= end;++iii) { 438 for ( iii = st;iii<= end;++iii) {
435 computeEvent( event, iii ); 439 computeEvent( event, iii );
436 } 440 }
437 } 441 }
438 } 442 }
439 } else { 443 } else {
440 if ( invalid ) 444 if ( invalid )
441 break; 445 break;
442 invalid = true; 446 invalid = true;
443 //qDebug("invalid %s", event->summary().latin1()); 447 //qDebug("invalid %s", event->summary().latin1());
444 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 448 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
445 } 449 }
446 if ( last ) 450 if ( last )
447 break; 451 break;
448 bool ok; 452 bool ok;
449 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 453 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
450 if ( ! ok ) 454 if ( ! ok )
451 break; 455 break;
452 if ( incidenceStart.date() > endDate ) 456 if ( incidenceStart.date() > endDate )
453 break; 457 break;
454 } 458 }
455 } else { // no recur 459 } else { // no recur
456 int st = event->dtStart().date().daysTo( endDate ); 460 int st = event->dtStart().date().daysTo( endDate );
457 if ( st >= 0 ) { // start before timeend 461 if ( st >= 0 ) { // start before timeend
458 int end = mStartDate.daysTo( event->dtEnd().date() ); 462 int end = mStartDate.daysTo( event->dtEnd().date() );
459 if ( end >= 0 ) { // end after timestart --- got one! 463 if ( end >= 0 ) { // end after timestart --- got one!
460 //normalize 464 //normalize
461 st = timeSpan - st; 465 st = timeSpan - st;
462 if ( st < 0 ) st = 0; 466 if ( st < 0 ) st = 0;
463 if ( end > timeSpan ) end = timeSpan; 467 if ( end > timeSpan ) end = timeSpan;
464 int iii; 468 int iii;
465 for ( iii = st;iii<= end;++iii) 469 for ( iii = st;iii<= end;++iii)
466 computeEvent( event, iii ); 470 computeEvent( event, iii );
467 } 471 }
468 } 472 }
469 } 473 }
470 } 474 }
471 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday 475 int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
472 for(i = 0; i < NUMDAYS; i++) { 476 for(i = 0; i < NUMDAYS; i++) {
473 if ( ( (i+startDay) % 7 == 0 ) ) { 477 if ( ( (i+startDay) % 7 == 0 ) ) {
474 pDays.setBit(i); 478 pDays.setBit(i);
475 } 479 }
476 } 480 }
477 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { 481 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
478 bDays.fill( false); 482 bDays.fill( false);
479 // insert due todos 483 // insert due todos
480 QPtrList<Todo> todos = mCalendar->todos( ); 484 QPtrList<Todo> todos = mCalendar->todos( );
481 Todo *todo; 485 Todo *todo;
482 for(todo = todos.first(); todo; todo = todos.next()) { 486 for(todo = todos.first(); todo; todo = todos.next()) {
483 //insertTodo( todo ); 487 //insertTodo( todo );
484 if ( todo->hasDueDate() ) { 488 if ( todo->hasDueDate() ) {
485 int day = mStartDate.daysTo( todo->dtDue().date() ); 489 int day = mStartDate.daysTo( todo->dtDue().date() );
486 if ( day >= 0 && day < timeSpan + 1) { 490 if ( day >= 0 && day < timeSpan + 1) {
487 int i = day; 491 int i = day;
488 QString holiStr = mHolidays[i]; 492 QString holiStr = mHolidays[i];
489 pDays.setBit(i); 493 pDays.setBit(i);
490 if ( !holiStr.isEmpty() ) 494 if ( !holiStr.isEmpty() )
491 holiStr += "\n"; 495 holiStr += "\n";
492 holiStr += i18n("Todo") + ": "+todo->summary(); 496 holiStr += i18n("Todo") + ": "+todo->summary();
493 if ( !todo->location().isEmpty() ) 497 if ( !todo->location().isEmpty() )
494 holiStr += " (" + todo->location() + ")"; 498 holiStr += " (" + todo->location() + ")";
495 bDays.setBit(i); 499 bDays.setBit(i);
496 mHolidays[i] =holiStr ; 500 mHolidays[i] =holiStr ;
497 eDays.setBit(i); 501 eDays.setBit(i);
498 } 502 }
499 } 503 }
500 } 504 }
501 } 505 }
502 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { 506 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
503 bDays.fill( false); 507 bDays.fill( false);
504 // insert due todos 508 // insert due todos
505 QPtrList<Journal> todos = mCalendar->journals( ); 509 QPtrList<Journal> todos = mCalendar->journals( );
506 Journal *todo; 510 Journal *todo;
507 for(todo = todos.first(); todo; todo = todos.next()) { 511 for(todo = todos.first(); todo; todo = todos.next()) {
508 int day = mStartDate.daysTo( todo->dtStart().date() ); 512 int day = mStartDate.daysTo( todo->dtStart().date() );
509 if ( day >= 0 && day < timeSpan + 1) { 513 if ( day >= 0 && day < timeSpan + 1) {
510 int i = day; 514 int i = day;
511 QString holiStr = mHolidays[i]; 515 QString holiStr = mHolidays[i];
512 pDays.setBit(i); 516 pDays.setBit(i);
513 if ( !holiStr.isEmpty() ) 517 if ( !holiStr.isEmpty() )
514 holiStr += "\n"; 518 holiStr += "\n";
515 holiStr += i18n("Journal"); 519 holiStr += i18n("Journal");
516 bDays.setBit(i); 520 bDays.setBit(i);
517 mHolidays[i] =holiStr ; 521 mHolidays[i] =holiStr ;
518 eDays.setBit(i); 522 eDays.setBit(i);
519 523
520 } 524 }
521 } 525 }
522 } 526 }
523#else 527#else
524 //qDebug("KODayMatrix::updateViewTimed "); 528 //qDebug("KODayMatrix::updateViewTimed ");
525 for(int i = 0; i < NUMDAYS; i++) { 529 for(int i = 0; i < NUMDAYS; i++) {
526 // if events are set for the day then remember to draw it bold 530 // if events are set for the day then remember to draw it bold
527 QPtrList<Event> eventlist = mCalendar->events(days[i]); 531 QPtrList<Event> eventlist = mCalendar->events(days[i]);
528 Event *event; 532 Event *event;
529 int numEvents = eventlist.count(); 533 int numEvents = eventlist.count();
530 QString holiStr = ""; 534 QString holiStr = "";
531 bDays.clearBit(i); 535 bDays.clearBit(i);
532 hDays.clearBit(i); 536 hDays.clearBit(i);
533 eDays.clearBit(i); 537 eDays.clearBit(i);
534 for(event=eventlist.first();event != 0;event=eventlist.next()) { 538 for(event=eventlist.first();event != 0;event=eventlist.next()) {
535 ushort recurType = event->recurrence()->doesRecur(); 539 ushort recurType = event->recurrence()->doesRecur();
536 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 540 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
537 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 541 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
538 numEvents--; 542 numEvents--;
539 } 543 }
540 if ( event->isHoliday()) { 544 if ( event->isHoliday()) {
541 hDays.setBit(i); 545 hDays.setBit(i);
542 if ( !holiStr.isEmpty() ) 546 if ( !holiStr.isEmpty() )
543 holiStr += "\n"; 547 holiStr += "\n";
544 holiStr += event->summary(); 548 holiStr += event->summary();
545 if ( !event->location().isEmpty() ) 549 if ( !event->location().isEmpty() )
546 holiStr += " (" + event->location() + ")"; 550 holiStr += " (" + event->location() + ")";
547 } 551 }
548 if ( event->isBirthday()) { 552 if ( event->isBirthday()) {
549 if ( !holiStr.isEmpty() ) 553 if ( !holiStr.isEmpty() )
550 holiStr += "\n"; 554 holiStr += "\n";
551 holiStr += i18n("Birthday") + ": "+event->summary(); 555 holiStr += i18n("Birthday") + ": "+event->summary();
552 if ( !event->location().isEmpty() ) 556 if ( !event->location().isEmpty() )
553 holiStr += " (" + event->location() + ")"; 557 holiStr += " (" + event->location() + ")";
554 bDays.setBit(i); 558 bDays.setBit(i);
555 } 559 }
556 } 560 }
557 if ( numEvents ) 561 if ( numEvents )
558 eDays.setBit(i); 562 eDays.setBit(i);
559 //if it is a holy day then draw it red. Sundays are consider holidays, too 563 //if it is a holy day then draw it red. Sundays are consider holidays, too
560 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 564 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
561 !holiStr.isEmpty()) { 565 !holiStr.isEmpty()) {
562 mHolidays[i] = holiStr; 566 mHolidays[i] = holiStr;
563 } else { 567 } else {
564 mHolidays[i] = QString::null; 568 mHolidays[i] = QString::null;
565 } 569 }
566 } 570 }
567#endif 571#endif
568 mRedrawNeeded = true; 572 mRedrawNeeded = true;
569 if ( ! mPendingUpdateBeforeRepaint ) 573 if ( ! mPendingUpdateBeforeRepaint )
570 repaint(false); 574 repaint(false);
571} 575}
572void KODayMatrix::updateView(QDate actdate) 576void KODayMatrix::updateView(QDate actdate)
573{ 577{
574 if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView ) 578 if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView )
575 mRedrawNeeded = true; 579 mRedrawNeeded = true;
576 mLastView = KOPrefs::instance()->mCurrentDisplayedView; 580 mLastView = KOPrefs::instance()->mCurrentDisplayedView;
577 if ( ! actdate.isValid() ) { 581 if ( ! actdate.isValid() ) {
578 //qDebug("date not valid "); 582 //qDebug("date not valid ");
579 return; 583 return;
580 } 584 }
581 mDayChanged = false; 585 mDayChanged = false;
582 //flag to indicate if the starting day of the matrix has changed by this call 586 //flag to indicate if the starting day of the matrix has changed by this call
583 //mDayChanged = false; 587 //mDayChanged = false;
584 // if a new startdate is to be set then apply Cornelius's calculation 588 // if a new startdate is to be set then apply Cornelius's calculation
585 // of the first day to be shown 589 // of the first day to be shown
586 if (actdate != startdate) { 590 if (actdate != startdate) {
587 // reset index of selection according to shift of starting date from startdate to actdate 591 // reset index of selection according to shift of starting date from startdate to actdate
588 if (mSelStart != NOSELECTION) { 592 if (mSelStart != NOSELECTION) {
589 int tmp = actdate.daysTo(startdate); 593 int tmp = actdate.daysTo(startdate);
590 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 594 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
591 // shift selection if new one would be visible at least partly ! 595 // shift selection if new one would be visible at least partly !
592 596
593 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 597 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
594 // nested if is required for next X display pushed from a different month - correction required 598 // nested if is required for next X display pushed from a different month - correction required
595 // otherwise, for month forward and backward, it must be avoided 599 // otherwise, for month forward and backward, it must be avoided
596 if( mSelStart > NUMDAYS || mSelStart < 0 ) 600 if( mSelStart > NUMDAYS || mSelStart < 0 )
597 mSelStart = mSelStart + tmp; 601 mSelStart = mSelStart + tmp;
598 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 602 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
599 mSelEnd = mSelEnd + tmp; 603 mSelEnd = mSelEnd + tmp;
600 } 604 }
601 } 605 }
602 startdate = actdate; 606 startdate = actdate;
603 mDayChanged = true; 607 mDayChanged = true;
604 recalculateToday(); 608 recalculateToday();
605 mRedrawNeeded = true; 609 mRedrawNeeded = true;
606 } 610 }
607 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 611 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
608 if ( !isVisible() ) { 612 if ( !isVisible() ) {
609 mPendingUpdateBeforeRepaint = true; 613 mPendingUpdateBeforeRepaint = true;
610 } else { 614 } else {
611#ifdef DESKTOP_VERSION 615#ifdef DESKTOP_VERSION
612 //mRepaintTimer->start( 100 ); 616 //mRepaintTimer->start( 100 );
613 //updateViewTimed(); 617 //updateViewTimed();
614 mUpdateTimer->start( 50 ); 618 mUpdateTimer->start( 50 );
615#else 619#else
616 mRepaintTimer->start( 350 ); 620 mRepaintTimer->start( 350 );
617 mUpdateTimer->start( 800 ); 621 mUpdateTimer->start( 800 );
618#endif 622#endif
619 } 623 }
620} 624}
621void KODayMatrix::updateEvents() 625void KODayMatrix::updateEvents()
622{ 626{
623 if ( !mCalendar ) return; 627 if ( !mCalendar ) return;
624 628
625 for( int i = 0; i < NUMDAYS; i++ ) { 629 for( int i = 0; i < NUMDAYS; i++ ) {
626 // if events are set for the day then remember to draw it bold 630 // if events are set for the day then remember to draw it bold
627 QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); 631 QPtrList<Event> eventlist = mCalendar->events( days[ i ] );
628 int numEvents = eventlist.count(); 632 int numEvents = eventlist.count();
629 Event *event; 633 Event *event;
630 for( event = eventlist.first(); event != 0;event=eventlist.next()) { 634 for( event = eventlist.first(); event != 0;event=eventlist.next()) {
631 ushort recurType = event->doesRecur(); 635 ushort recurType = event->doesRecur();
632 636
633 if ( ( recurType == Recurrence::rDaily && 637 if ( ( recurType == Recurrence::rDaily &&
634 !KOPrefs::instance()->mDailyRecur ) || 638 !KOPrefs::instance()->mDailyRecur ) ||
635 ( recurType == Recurrence::rWeekly && 639 ( recurType == Recurrence::rWeekly &&
636 !KOPrefs::instance()->mWeeklyRecur ) ) { 640 !KOPrefs::instance()->mWeeklyRecur ) ) {
637 numEvents--; 641 numEvents--;
638 } 642 }
639 } 643 }
640 if ( numEvents ) 644 if ( numEvents )
641 eDays.setBit(i); 645 eDays.setBit(i);
642 else 646 else
643 eDays.clearBit(i); 647 eDays.clearBit(i);
644 } 648 }
645} 649}
646 650
647const QDate& KODayMatrix::getDate(int offset) 651const QDate& KODayMatrix::getDate(int offset)
648{ 652{
649 if (offset < 0 || offset > NUMDAYS-1) { 653 if (offset < 0 || offset > NUMDAYS-1) {
650 qDebug("Wrong offset2 %d", offset); 654 qDebug("Wrong offset2 %d", offset);
651 return days[0]; 655 return days[0];
652 } 656 }
653 return days[offset]; 657 return days[offset];
654} 658}
655 659
656QString KODayMatrix::getHolidayLabel(int offset) 660QString KODayMatrix::getHolidayLabel(int offset)
657{ 661{
658 if (offset < 0 || offset > NUMDAYS-1) { 662 if (offset < 0 || offset > NUMDAYS-1) {
659 qDebug("Wrong offset1 %d", offset); 663 qDebug("Wrong offset1 %d", offset);
660 return QString(); 664 return QString();
661 } 665 }
662 return mHolidays[offset]; 666 return mHolidays[offset];
663} 667}
664 668
665int KODayMatrix::getDayIndexFrom(int x, int y) 669int KODayMatrix::getDayIndexFrom(int x, int y)
666{ 670{
667 int colModulo = (width()-2) % 7; 671 int colModulo = (width()-2) % 7;
668 int rowModulo = (height()-2) % 6; 672 int rowModulo = (height()-2) % 6;
669#if 0 673#if 0
670 return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? 674 return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ?
671 6 - x/daysize.width() : x/daysize.width()); 675 6 - x/daysize.width() : x/daysize.width());
672#endif 676#endif
673 int xVal = (x-colModulo/2-2)/daysize.width(); 677 int xVal = (x-colModulo/2-2)/daysize.width();
674 int yVal = (y-rowModulo/2-2)/daysize.height(); 678 int yVal = (y-rowModulo/2-2)/daysize.height();
675 679
676 680
677 return 7*(yVal) + xVal; 681 return 7*(yVal) + xVal;
678 682
679} 683}
680 684
681// ---------------------------------------------------------------------------- 685// ----------------------------------------------------------------------------
682// M O U S E E V E N T H A N D L I N G 686// M O U S E E V E N T H A N D L I N G
683// ---------------------------------------------------------------------------- 687// ----------------------------------------------------------------------------
684 688
685void KODayMatrix::mousePressEvent (QMouseEvent* e) 689void KODayMatrix::mousePressEvent (QMouseEvent* e)
686{ 690{
687 691
688 if ( e->button() == LeftButton ) 692 if ( e->button() == LeftButton )
689 mouseDown = true; 693 mouseDown = true;
690 mSelStart = getDayIndexFrom(e->x(), e->y()); 694 mSelStart = getDayIndexFrom(e->x(), e->y());
691 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; 695 if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1;
692 mSelInit = mSelStart; 696 mSelInit = mSelStart;
693 mSelEnd = mSelStart; 697 mSelEnd = mSelStart;
694 mRedrawNeeded = true; 698 mRedrawNeeded = true;
695 repaint(false); 699 repaint(false);
696} 700}
697 701
698void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) 702void KODayMatrix::mouseReleaseEvent (QMouseEvent* e)
699{ 703{
700 mRedrawNeeded = true; 704 mRedrawNeeded = true;
701 if ( e->button() == LeftButton ) 705 if ( e->button() == LeftButton )
702 if ( ! mouseDown ) { 706 if ( ! mouseDown ) {
703 return; 707 return;
704 } 708 }
705 else 709 else
706 mouseDown = false; 710 mouseDown = false;
707 int tmp = getDayIndexFrom(e->x(), e->y()); 711 int tmp = getDayIndexFrom(e->x(), e->y());
708 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 712 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
709 713
710 if (mSelInit > tmp) { 714 if (mSelInit > tmp) {
711 mSelEnd = mSelInit; 715 mSelEnd = mSelInit;
712 if (tmp != mSelStart) { 716 if (tmp != mSelStart) {
713 mSelStart = tmp; 717 mSelStart = tmp;
714 repaint(false); 718 repaint(false);
715 } 719 }
716 } else { 720 } else {
717 mSelStart = mSelInit; 721 mSelStart = mSelInit;
718 722
719 //repaint only if selection has changed 723 //repaint only if selection has changed
720 if (tmp != mSelEnd) { 724 if (tmp != mSelEnd) {
721 mSelEnd = tmp; 725 mSelEnd = tmp;
722 repaint(false); 726 repaint(false);
723 } 727 }
724 } 728 }
725 729
726 DateList daylist; 730 DateList daylist;
727 if ( mSelStart < 0 ) 731 if ( mSelStart < 0 )
728 mSelStart = 0; 732 mSelStart = 0;
729 for (int i = mSelStart; i <= mSelEnd; i++) { 733 for (int i = mSelStart; i <= mSelEnd; i++) {
730 daylist.append(days[i]); 734 daylist.append(days[i]);
731 } 735 }
732 emit selected((const DateList)daylist); 736 emit selected((const DateList)daylist);
733 737
734} 738}
735 739
736void KODayMatrix::mouseMoveEvent (QMouseEvent* e) 740void KODayMatrix::mouseMoveEvent (QMouseEvent* e)
737{ 741{
738 if ( ! mouseDown ) { 742 if ( ! mouseDown ) {
739 return; 743 return;
740 } 744 }
741 mRedrawNeeded = true; 745 mRedrawNeeded = true;
742 int tmp = getDayIndexFrom(e->x(), e->y()); 746 int tmp = getDayIndexFrom(e->x(), e->y());
743 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; 747 if (tmp > NUMDAYS-1) tmp=NUMDAYS-1;
744 748
745 if (mSelInit > tmp) { 749 if (mSelInit > tmp) {
746 mSelEnd = mSelInit; 750 mSelEnd = mSelInit;
747 if (tmp != mSelStart) { 751 if (tmp != mSelStart) {
748 mSelStart = tmp; 752 mSelStart = tmp;
749 repaint(false); 753 repaint(false);
750 } 754 }
751 } else { 755 } else {
752 mSelStart = mSelInit; 756 mSelStart = mSelInit;
753 757
754 //repaint only if selection has changed 758 //repaint only if selection has changed
755 if (tmp != mSelEnd) { 759 if (tmp != mSelEnd) {
756 mSelEnd = tmp; 760 mSelEnd = tmp;
757 repaint(false); 761 repaint(false);
758 } 762 }
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index d9d7924..e4bee63 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -519,1028 +519,1024 @@ void KOPrefsDialog::setupTimeTab()
519 mStartTimeSpin->setSuffix(":00"); 519 mStartTimeSpin->setSuffix(":00");
520 topLayout->addWidget(mStartTimeSpin,1,1); 520 topLayout->addWidget(mStartTimeSpin,1,1);
521 521
522 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 522 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
523 topFrame),2,0); 523 topFrame),2,0);
524 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 524 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
525 mDefaultDurationSpin->setSuffix(":00"); 525 mDefaultDurationSpin->setSuffix(":00");
526 topLayout->addWidget(mDefaultDurationSpin,2,1); 526 topLayout->addWidget(mDefaultDurationSpin,2,1);
527 527
528 QStringList alarmList; 528 QStringList alarmList;
529 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 529 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
530 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 530 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
531 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 531 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
532 3,0); 532 3,0);
533 mAlarmTimeCombo = new QComboBox(topFrame); 533 mAlarmTimeCombo = new QComboBox(topFrame);
534 mAlarmTimeCombo->insertStringList(alarmList); 534 mAlarmTimeCombo->insertStringList(alarmList);
535 topLayout->addWidget(mAlarmTimeCombo,3,1); 535 topLayout->addWidget(mAlarmTimeCombo,3,1);
536 536
537 537
538 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 538 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
539 i18n("Working Hours"), 539 i18n("Working Hours"),
540 topFrame); 540 topFrame);
541 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 541 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
542 workingHoursGroup->layout()->setSpacing( 0 ); 542 workingHoursGroup->layout()->setSpacing( 0 );
543 workingHoursGroup->layout()->setMargin( 4 ); 543 workingHoursGroup->layout()->setMargin( 4 );
544 QHBox *workStartBox = new QHBox(workingHoursGroup); 544 QHBox *workStartBox = new QHBox(workingHoursGroup);
545 // workStartBox->setMargin( 0 ); 545 // workStartBox->setMargin( 0 );
546 addWidTime(i18n("Daily starting hour:"), 546 addWidTime(i18n("Daily starting hour:"),
547 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 547 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
548 548
549 QHBox *workEndBox = new QHBox(workingHoursGroup); 549 QHBox *workEndBox = new QHBox(workingHoursGroup);
550 //workEndBox->setMargin( 0 ); 550 //workEndBox->setMargin( 0 );
551 addWidTime(i18n("Daily ending hour:"), 551 addWidTime(i18n("Daily ending hour:"),
552 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 552 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
553 QVBox *excludeBox = new QVBox(workingHoursGroup); 553 QVBox *excludeBox = new QVBox(workingHoursGroup);
554 //excludeBox->setMargin( 0 ); 554 //excludeBox->setMargin( 0 );
555 addWidBool(i18n("Exclude holidays"), 555 addWidBool(i18n("Exclude holidays"),
556 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 556 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
557 557
558 addWidBool(i18n("Exclude Saturdays"), 558 addWidBool(i18n("Exclude Saturdays"),
559 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 559 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
560 560
561// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 561// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
562 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 562 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
563 // topFrame); 563 // topFrame);
564// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 564// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
565 565
566 // topLayout->setRowStretch(6,1); 566 // topLayout->setRowStretch(6,1);
567} 567}
568 568
569 569
570void KOPrefsDialog::setupViewsTab() 570void KOPrefsDialog::setupViewsTab()
571{ 571{
572 572
573 QFrame *topFrame = addPage(i18n("Views"),0,0); 573 QFrame *topFrame = addPage(i18n("Views"),0,0);
574 // DesktopIcon("viewmag",KIcon::SizeMedium)); 574 // DesktopIcon("viewmag",KIcon::SizeMedium));
575 575
576 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 576 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
577 topLayout->setSpacing(mSpacingHint); 577 topLayout->setSpacing(mSpacingHint);
578 topLayout->setMargin(mMarginHint); 578 topLayout->setMargin(mMarginHint);
579 579
580// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 580// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
581// topLayout->addLayout(dayBeginsLayout,0,0); 581// topLayout->addLayout(dayBeginsLayout,0,0);
582 582
583// KPrefsDialogWidTime *dayBegins = 583// KPrefsDialogWidTime *dayBegins =
584// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 584// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
585// topFrame); 585// topFrame);
586// dayBeginsLayout->addWidget(dayBegins->label()); 586// dayBeginsLayout->addWidget(dayBegins->label());
587// dayBeginsLayout->addStretch(1); 587// dayBeginsLayout->addStretch(1);
588// dayBeginsLayout->addWidget(dayBegins->spinBox()); 588// dayBeginsLayout->addWidget(dayBegins->spinBox());
589 589
590// QBoxLayout *nextDaysLayout = new QHBoxLayout; 590// QBoxLayout *nextDaysLayout = new QHBoxLayout;
591// topLayout->addLayout(nextDaysLayout,1,0); 591// topLayout->addLayout(nextDaysLayout,1,0);
592// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 592// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
593// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 593// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
594// nextDaysLayout->addStretch(1); 594// nextDaysLayout->addStretch(1);
595// nextDaysLayout->addWidget(mNextXDaysSpin); 595// nextDaysLayout->addWidget(mNextXDaysSpin);
596 596
597 597
598 int ii = 0; 598 int ii = 0;
599 KPrefsDialogWidBool *dummy = 599 KPrefsDialogWidBool *dummy =
600 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 600 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
601 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 601 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
602 topLayout->addWidget(dummy->checkBox(),ii++,0); 602 topLayout->addWidget(dummy->checkBox(),ii++,0);
603 603
604 604
605 605
606 606
607 607
608 608
609 // topLayout->addWidget(hourSizeGroup,ii++,0); 609 // topLayout->addWidget(hourSizeGroup,ii++,0);
610 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 610 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
611 //topLayout->setRowStretch(11,1); 611 //topLayout->setRowStretch(11,1);
612 612
613 613
614 614
615 615
616#if 0 616#if 0
617 617
618 topFrame = addPage(i18n("ViewChange"),0,0); 618 topFrame = addPage(i18n("ViewChange"),0,0);
619 // DesktopIcon("viewmag",KIcon::SizeMedium)); 619 // DesktopIcon("viewmag",KIcon::SizeMedium));
620 620
621 topLayout = new QGridLayout(topFrame,6,1); 621 topLayout = new QGridLayout(topFrame,6,1);
622 topLayout->setSpacing(mSpacingHint); 622 topLayout->setSpacing(mSpacingHint);
623 topLayout->setMargin(mMarginHint); 623 topLayout->setMargin(mMarginHint);
624 ii = 0; 624 ii = 0;
625 625
626#endif 626#endif
627 627
628 dummy = 628 dummy =
629 addWidBool(i18n("Hold fullscreen on view change"), 629 addWidBool(i18n("Hold fullscreen on view change"),
630 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 630 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
631 topLayout->addWidget(dummy->checkBox(),ii++,0); 631 topLayout->addWidget(dummy->checkBox(),ii++,0);
632 632
633 dummy = 633 dummy =
634 addWidBool(i18n("Hold non-fullscreen on view change"), 634 addWidBool(i18n("Hold non-fullscreen on view change"),
635 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 635 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
636 topLayout->addWidget(dummy->checkBox(),ii++,0); 636 topLayout->addWidget(dummy->checkBox(),ii++,0);
637 637
638 638
639 639
640 KPrefsDialogWidBool *fullViewMonth = 640 KPrefsDialogWidBool *fullViewMonth =
641 addWidBool(i18n("Next days view uses full window"), 641 addWidBool(i18n("Next days view uses full window"),
642 &(KOPrefs::instance()->mFullViewMonth),topFrame); 642 &(KOPrefs::instance()->mFullViewMonth),topFrame);
643 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 643 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
644 644
645 645
646 KPrefsDialogWidBool *fullViewTodo = 646 KPrefsDialogWidBool *fullViewTodo =
647 addWidBool(i18n("Event list view uses full window"), 647 addWidBool(i18n("Event list view uses full window"),
648 &(KOPrefs::instance()->mFullViewTodo),topFrame); 648 &(KOPrefs::instance()->mFullViewTodo),topFrame);
649 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 649 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
650 dummy = 650 dummy =
651 addWidBool(i18n("Listview uses monthly timespan"), 651 addWidBool(i18n("Listview uses monthly timespan"),
652 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 652 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
653 topLayout->addWidget(dummy->checkBox(),ii++,0); 653 topLayout->addWidget(dummy->checkBox(),ii++,0);
654 dummy = 654 dummy =
655 addWidBool(i18n("Highlight selection in Time Edit"), 655 addWidBool(i18n("Highlight selection in Time Edit"),
656 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 656 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
657 topLayout->addWidget( dummy->checkBox(), ii++,0); 657 topLayout->addWidget( dummy->checkBox(), ii++,0);
658 658
659 KPrefsDialogWidBool *dailyRecur = 659 KPrefsDialogWidBool *dailyRecur =
660 addWidBool(i18n("Show events that recur daily in date nav."), 660 addWidBool(i18n("Show events that recur daily in date nav."),
661 &(KOPrefs::instance()->mDailyRecur),topFrame); 661 &(KOPrefs::instance()->mDailyRecur),topFrame);
662 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 662 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
663 663
664 KPrefsDialogWidBool *weeklyRecur = 664 KPrefsDialogWidBool *weeklyRecur =
665 addWidBool(i18n("Show ev. that recur weekly in date nav."), 665 addWidBool(i18n("Show ev. that recur weekly in date nav."),
666 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 666 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
667 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 667 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
668 668
669#ifdef DESKTOP_VERSION 669#ifdef DESKTOP_VERSION
670 KPrefsDialogWidBool *enableToolTips = 670 KPrefsDialogWidBool *enableToolTips =
671 addWidBool(i18n("Enable tooltips displaying summary of ev."), 671 addWidBool(i18n("Enable tooltips displaying summary of ev."),
672 &(KOPrefs::instance()->mEnableToolTips),topFrame); 672 &(KOPrefs::instance()->mEnableToolTips),topFrame);
673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 673 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
674#endif 674#endif
675 // ********************************************************* 675 // *********************************************************
676 676
677 topFrame = addPage(i18n("Agenda View"),0,0); 677 topFrame = addPage(i18n("Agenda View"),0,0);
678 // DesktopIcon("viewmag",KIcon::SizeMedium)); 678 // DesktopIcon("viewmag",KIcon::SizeMedium));
679 679
680 topLayout = new QGridLayout(topFrame,5,1); 680 topLayout = new QGridLayout(topFrame,5,1);
681 topLayout->setSpacing(mSpacingHint); 681 topLayout->setSpacing(mSpacingHint);
682 topLayout->setMargin(mMarginHint); 682 topLayout->setMargin(mMarginHint);
683 ii = 0; 683 ii = 0;
684 684
685 685
686 dummy = 686 dummy =
687 addWidBool(i18n("Show time in agenda items"), 687 addWidBool(i18n("Show time in agenda items"),
688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 688 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
689 topLayout->addWidget(dummy->checkBox(),ii++,0); 689 topLayout->addWidget(dummy->checkBox(),ii++,0);
690 690
691 dummy = 691 dummy =
692 addWidBool(i18n("Highlight current day in agenda"), 692 addWidBool(i18n("Highlight current day in agenda"),
693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 693 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
694 topLayout->addWidget(dummy->checkBox(),ii++,0); 694 topLayout->addWidget(dummy->checkBox(),ii++,0);
695 695
696 dummy = 696 dummy =
697 addWidBool(i18n("Use light color for highlight current day"), 697 addWidBool(i18n("Use light color for highlight current day"),
698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 698 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
699 topLayout->addWidget(dummy->checkBox(),ii++,0); 699 topLayout->addWidget(dummy->checkBox(),ii++,0);
700 700
701 701
702 KPrefsDialogWidBool *marcusBainsEnabled = 702 KPrefsDialogWidBool *marcusBainsEnabled =
703 addWidBool(i18n("Show current time"), 703 addWidBool(i18n("Show current time"),
704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 704 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 705 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
706 706
707 707
708 dummy = 708 dummy =
709 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 709 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 710 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
711 topLayout->addWidget(dummy->checkBox(),ii++,0); 711 topLayout->addWidget(dummy->checkBox(),ii++,0);
712 712
713 dummy = 713 dummy =
714 addWidBool(i18n("Set agenda to current time on change"), 714 addWidBool(i18n("Set agenda to current time on change"),
715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 715 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
716 topLayout->addWidget(dummy->checkBox(),ii++,0); 716 topLayout->addWidget(dummy->checkBox(),ii++,0);
717 717
718 718
719 719
720 720
721 721
722 722
723 723
724 topFrame = addPage(i18n("Month View"),0,0); 724 topFrame = addPage(i18n("Month View"),0,0);
725 // DesktopIcon("viewmag",KIcon::SizeMedium)); 725 // DesktopIcon("viewmag",KIcon::SizeMedium));
726 726
727 topLayout = new QGridLayout(topFrame,5,1); 727 topLayout = new QGridLayout(topFrame,5,1);
728 topLayout->setSpacing(mSpacingHint); 728 topLayout->setSpacing(mSpacingHint);
729 topLayout->setMargin(mMarginHint); 729 topLayout->setMargin(mMarginHint);
730 ii = 0; 730 ii = 0;
731 QLabel *lab; 731 QLabel *lab;
732 QHBox *habo = new QHBox( topFrame ); 732 QHBox *habo = new QHBox( topFrame );
733 if ( QApplication::desktop()->width() <= 480 ) { 733 if ( QApplication::desktop()->width() <= 480 ) {
734 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 734 lab = new QLabel ( i18n("Show events that recur "), topFrame );
735 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 735 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
736 ii++; 736 ii++;
737 } else { 737 } else {
738 new QLabel ( i18n("Show events that recur "), habo ); 738 new QLabel ( i18n("Show events that recur "), habo );
739 } 739 }
740 dailyRecur = 740 dailyRecur =
741 addWidBool(i18n("daily"), 741 addWidBool(i18n("daily"),
742 &(KOPrefs::instance()->mMonthDailyRecur),habo); 742 &(KOPrefs::instance()->mMonthDailyRecur),habo);
743 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 743 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
744 744
745 weeklyRecur = 745 weeklyRecur =
746 addWidBool(i18n("weekly"), 746 addWidBool(i18n("weekly"),
747 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 747 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
748 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 748 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
749 ii++; 749 ii++;
750 750
751 751
752 habo = new QHBox( topFrame ); 752 habo = new QHBox( topFrame );
753 if ( QApplication::desktop()->width() <= 480 ) { 753 if ( QApplication::desktop()->width() <= 480 ) {
754 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 754 lab = new QLabel (i18n("Show in every cell ") , topFrame );
755 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 755 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
756 ii++; 756 ii++;
757 757
758 } else { 758 } else {
759 new QLabel ( i18n("Show in every cell "), habo ); 759 new QLabel ( i18n("Show in every cell "), habo );
760 } 760 }
761 weeklyRecur = 761 weeklyRecur =
762 addWidBool(i18n("short month"), 762 addWidBool(i18n("short month"),
763 &(KOPrefs::instance()->mMonthShowShort),habo); 763 &(KOPrefs::instance()->mMonthShowShort),habo);
764 weeklyRecur = 764 weeklyRecur =
765 addWidBool(i18n("icons"), 765 addWidBool(i18n("icons"),
766 &(KOPrefs::instance()->mMonthShowIcons),habo); 766 &(KOPrefs::instance()->mMonthShowIcons),habo);
767 weeklyRecur = 767 weeklyRecur =
768 addWidBool(i18n("times"), 768 addWidBool(i18n("times"),
769 &(KOPrefs::instance()->mMonthShowTimes),habo); 769 &(KOPrefs::instance()->mMonthShowTimes),habo);
770 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 770 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
771 ii++; 771 ii++;
772#ifdef DESKTOP_VERSION 772#ifdef DESKTOP_VERSION
773 KPrefsDialogWidBool *enableMonthScroll = 773 KPrefsDialogWidBool *enableMonthScroll =
774 addWidBool(i18n("Enable scrollbars in month view cells"), 774 addWidBool(i18n("Enable scrollbars in month view cells"),
775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
776 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 776 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
777#endif 777#endif
778 dummy = 778 dummy =
779 addWidBool(i18n("Week view mode uses bigger font"), 779 addWidBool(i18n("Week view mode uses bigger font"),
780 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); 780 &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame);
781 topLayout->addWidget(dummy->checkBox(),ii++,0); 781 topLayout->addWidget(dummy->checkBox(),ii++,0);
782 dummy = 782 dummy =
783 addWidBool(i18n("Show Sat/Sun together"), 783 addWidBool(i18n("Show Sat/Sun together"),
784 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 784 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
785 topLayout->addWidget(dummy->checkBox(),ii++,0); 785 topLayout->addWidget(dummy->checkBox(),ii++,0);
786 786
787 KPrefsDialogWidBool *coloredCategoriesInMonthView = 787 KPrefsDialogWidBool *coloredCategoriesInMonthView =
788 addWidBool(i18n("Month view uses category colors"), 788 addWidBool(i18n("Month view uses category colors"),
789 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 789 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 790 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
791 791
792 dummy = 792 dummy =
793 addWidBool(i18n("Categorie colors are applied to text"), 793 addWidBool(i18n("Categorie colors are applied to text"),
794 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 794 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
795 topLayout->addWidget(dummy->checkBox(),ii++,0); 795 topLayout->addWidget(dummy->checkBox(),ii++,0);
796 coloredCategoriesInMonthView = 796 coloredCategoriesInMonthView =
797 addWidBool(i18n("Month view uses day colors"), 797 addWidBool(i18n("Month view uses day colors"),
798 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 798 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
799 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 799 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
800 800
801 KPrefsDialogWidColor *holidayColor = 801 KPrefsDialogWidColor *holidayColor =
802 addWidColor(i18n("Day color odd months"), 802 addWidColor(i18n("Day color odd months"),
803 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 803 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
804 topLayout->addWidget(holidayColor->label(),ii,0); 804 topLayout->addWidget(holidayColor->label(),ii,0);
805 topLayout->addWidget(holidayColor->button(),ii++,1); 805 topLayout->addWidget(holidayColor->button(),ii++,1);
806 806
807 holidayColor = 807 holidayColor =
808 addWidColor(i18n("Day color even months"), 808 addWidColor(i18n("Day color even months"),
809 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 809 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
810 topLayout->addWidget(holidayColor->label(),ii,0); 810 topLayout->addWidget(holidayColor->label(),ii,0);
811 topLayout->addWidget(holidayColor->button(),ii++,1); 811 topLayout->addWidget(holidayColor->button(),ii++,1);
812 812
813 813
814 holidayColor = 814 holidayColor =
815 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 815 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
816 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 816 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
817 topLayout->addWidget(holidayColor->label(),ii,0); 817 topLayout->addWidget(holidayColor->label(),ii,0);
818 topLayout->addWidget(holidayColor->button(),ii++,1); 818 topLayout->addWidget(holidayColor->button(),ii++,1);
819 // *********************** What'sNext View 819 // *********************** What'sNext View
820 topFrame = addPage(i18n("What's Next View"),0,0); 820 topFrame = addPage(i18n("What's Next View"),0,0);
821 // DesktopIcon("viewmag",KIcon::SizeMedium)); 821 // DesktopIcon("viewmag",KIcon::SizeMedium));
822 822
823 topLayout = new QGridLayout(topFrame,4,1); 823 topLayout = new QGridLayout(topFrame,4,1);
824 topLayout->setSpacing(mSpacingHint); 824 topLayout->setSpacing(mSpacingHint);
825 topLayout->setMargin(mMarginHint); 825 topLayout->setMargin(mMarginHint);
826 ii = 0; 826 ii = 0;
827 827
828 828
829 QHBox* hdummy = new QHBox(topFrame); 829 QHBox* hdummy = new QHBox(topFrame);
830 new QLabel(i18n("Days in What's Next:"),hdummy); 830 new QLabel(i18n("Days in What's Next:"),hdummy);
831 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); 831 mWhatsNextSpin = new QSpinBox(1,14,1,hdummy);
832 832
833 topLayout->addWidget(hdummy,ii++,0); 833 topLayout->addWidget(hdummy,ii++,0);
834 834
835 QHBox *prioBox = new QHBox(topFrame); 835 QHBox *prioBox = new QHBox(topFrame);
836 // intervalBox->setSpacing(mSpacingHint); 836 // intervalBox->setSpacing(mSpacingHint);
837 topLayout->addWidget(prioBox,ii++,0); 837 topLayout->addWidget(prioBox,ii++,0);
838 838
839 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); 839 QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox);
840 mPrioSpin = new QSpinBox(0,5,1,prioBox); 840 mPrioSpin = new QSpinBox(0,5,1,prioBox);
841 if ( QApplication::desktop()->width() < 300 ) 841 if ( QApplication::desktop()->width() < 300 )
842 mPrioSpin->setFixedWidth( 40 ); 842 mPrioSpin->setFixedWidth( 40 );
843 843
844 KPrefsDialogWidBool *passwdk = 844 KPrefsDialogWidBool *passwdk =
845 845
846 addWidBool(i18n("Show events, that are done"), 846 addWidBool(i18n("Show events, that are done"),
847 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 847 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
848 topLayout->addWidget(passwdk->checkBox(), ii++,0); 848 topLayout->addWidget(passwdk->checkBox(), ii++,0);
849 passwdk = 849 passwdk =
850 addWidBool(i18n("Show parent To-Do's"), 850 addWidBool(i18n("Show parent To-Do's"),
851 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 851 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
852 topLayout->addWidget(passwdk->checkBox(), ii++,0); 852 topLayout->addWidget(passwdk->checkBox(), ii++,0);
853 853
854 passwdk = 854 passwdk =
855 addWidBool(i18n("Show location"), 855 addWidBool(i18n("Show location"),
856 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 856 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
857 topLayout->addWidget(passwdk->checkBox(), ii++,0); 857 topLayout->addWidget(passwdk->checkBox(), ii++,0);
858 858
859 859
860 passwdk = 860 passwdk =
861 addWidBool(i18n("Use short date in WN+Event view"), 861 addWidBool(i18n("Use short date in WN+Event view"),
862 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 862 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
863 topLayout->addWidget(passwdk->checkBox(), ii++,0); 863 topLayout->addWidget(passwdk->checkBox(), ii++,0);
864 864
865 865
866 866
867 867
868 // *********************** Todo View 868 // *********************** Todo View
869 869
870 topFrame = addPage(i18n("Todo View"),0,0); 870 topFrame = addPage(i18n("Todo View"),0,0);
871 // DesktopIcon("viewmag",KIcon::SizeMedium)); 871 // DesktopIcon("viewmag",KIcon::SizeMedium));
872 872
873 topLayout = new QGridLayout(topFrame,4,1); 873 topLayout = new QGridLayout(topFrame,4,1);
874 topLayout->setSpacing(mSpacingHint); 874 topLayout->setSpacing(mSpacingHint);
875 topLayout->setMargin(mMarginHint); 875 topLayout->setMargin(mMarginHint);
876 ii = 0; 876 ii = 0;
877dummy = 877dummy =
878 addWidBool(i18n("Hide not running Todos in To-do view"), 878 addWidBool(i18n("Hide not running Todos in To-do view"),
879 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 879 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
880 topLayout->addWidget(dummy->checkBox(),ii++,0); 880 topLayout->addWidget(dummy->checkBox(),ii++,0);
881 881
882 882
883 KPrefsDialogWidBool *showCompletedTodo = 883 KPrefsDialogWidBool *showCompletedTodo =
884 addWidBool(i18n("To-do view shows completed Todos"), 884 addWidBool(i18n("To-do view shows completed Todos"),
885 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 885 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
886 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 886 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
887 dummy = 887 dummy =
888 addWidBool(i18n("To-do view shows complete as 'xx %'"), 888 addWidBool(i18n("To-do view shows complete as 'xx %'"),
889 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 889 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
890 topLayout->addWidget(dummy->checkBox(),ii++,0); 890 topLayout->addWidget(dummy->checkBox(),ii++,0);
891 891
892 dummy = 892 dummy =
893 addWidBool(i18n("Small To-do view uses smaller font"), 893 addWidBool(i18n("Small To-do view uses smaller font"),
894 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 894 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
895 topLayout->addWidget(dummy->checkBox(),ii++,0); 895 topLayout->addWidget(dummy->checkBox(),ii++,0);
896 896
897 897
898 898
899 dummy = 899 dummy =
900 addWidBool(i18n("Todo view uses category colors"), 900 addWidBool(i18n("Todo view uses category colors"),
901 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 901 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
902 topLayout->addWidget(dummy->checkBox(),ii++,0); 902 topLayout->addWidget(dummy->checkBox(),ii++,0);
903 903
904 904
905 QWidget* wid = new QWidget( topFrame ); 905 QWidget* wid = new QWidget( topFrame );
906 // Todo run today color 906 // Todo run today color
907 KPrefsDialogWidColor *todoRunColor = 907 KPrefsDialogWidColor *todoRunColor =
908 addWidColor(i18n("Color for running todos:"), 908 addWidColor(i18n("Color for running todos:"),
909 &(KOPrefs::instance()->mTodoRunColor),wid); 909 &(KOPrefs::instance()->mTodoRunColor),wid);
910 QHBoxLayout *widLayout = new QHBoxLayout(wid); 910 QHBoxLayout *widLayout = new QHBoxLayout(wid);
911 widLayout->addWidget( todoRunColor->label() ); 911 widLayout->addWidget( todoRunColor->label() );
912 widLayout->addWidget( todoRunColor->button() ); 912 widLayout->addWidget( todoRunColor->button() );
913 topLayout->addWidget(wid,ii++,0); 913 topLayout->addWidget(wid,ii++,0);
914 914
915 wid = new QWidget( topFrame ); 915 wid = new QWidget( topFrame );
916 // Todo due today color 916 // Todo due today color
917 KPrefsDialogWidColor *todoDueTodayColor = 917 KPrefsDialogWidColor *todoDueTodayColor =
918 addWidColor(i18n("Todo due today color:"), 918 addWidColor(i18n("Todo due today color:"),
919 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 919 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
920 widLayout = new QHBoxLayout(wid); 920 widLayout = new QHBoxLayout(wid);
921 widLayout->addWidget( todoDueTodayColor->label() ); 921 widLayout->addWidget( todoDueTodayColor->label() );
922 widLayout->addWidget( todoDueTodayColor->button() ); 922 widLayout->addWidget( todoDueTodayColor->button() );
923 topLayout->addWidget(wid,ii++,0); 923 topLayout->addWidget(wid,ii++,0);
924 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 924 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
925 925
926 // Todo overdue color 926 // Todo overdue color
927 wid = new QWidget( topFrame ); 927 wid = new QWidget( topFrame );
928 widLayout = new QHBoxLayout(wid); 928 widLayout = new QHBoxLayout(wid);
929 KPrefsDialogWidColor *todoOverdueColor = 929 KPrefsDialogWidColor *todoOverdueColor =
930 addWidColor(i18n("Todo overdue color:"), 930 addWidColor(i18n("Todo overdue color:"),
931 &(KOPrefs::instance()->mTodoOverdueColor),wid); 931 &(KOPrefs::instance()->mTodoOverdueColor),wid);
932 widLayout->addWidget(todoOverdueColor->label()); 932 widLayout->addWidget(todoOverdueColor->label());
933 widLayout->addWidget(todoOverdueColor->button()); 933 widLayout->addWidget(todoOverdueColor->button());
934 topLayout->addWidget(wid,ii++,0); 934 topLayout->addWidget(wid,ii++,0);
935 935
936 dummy = 936 dummy =
937 addWidBool(i18n("Colors are applied to text"), 937 addWidBool(i18n("Colors are applied to text"),
938 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 938 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
939 topLayout->addWidget(dummy->checkBox(),ii++,0); 939 topLayout->addWidget(dummy->checkBox(),ii++,0);
940 940
941 dummy = 941 dummy =
942 addWidBool(i18n("Allday Agenda view shows todos"), 942 addWidBool(i18n("Allday Agenda view shows todos"),
943 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 943 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
944 topLayout->addWidget(dummy->checkBox(),ii++,0); 944 topLayout->addWidget(dummy->checkBox(),ii++,0);
945 945
946 946
947 topFrame = addPage(i18n("View Options"),0,0); 947 topFrame = addPage(i18n("View Options"),0,0);
948 948
949 topLayout = new QGridLayout(topFrame,4,1); 949 topLayout = new QGridLayout(topFrame,4,1);
950 topLayout->setSpacing(mSpacingHint); 950 topLayout->setSpacing(mSpacingHint);
951 topLayout->setMargin(mMarginHint); 951 topLayout->setMargin(mMarginHint);
952 ii = 0; 952 ii = 0;
953 953
954 dummy = 954 dummy =
955 addWidBool(i18n("Show Sync Events"), 955 addWidBool(i18n("Show Sync Events"),
956 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 956 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
957 topLayout->addWidget(dummy->checkBox(), ii++,0); 957 topLayout->addWidget(dummy->checkBox(), ii++,0);
958 958
959 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); 959 lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame);
960 topLayout->addWidget(lab ,ii++,0); 960 topLayout->addWidget(lab ,ii++,0);
961 961
962 dummy = addWidBool(i18n("Details"), 962 dummy = addWidBool(i18n("Details"),
963 &(KOPrefs::instance()->mEVshowDetails),topFrame); 963 &(KOPrefs::instance()->mEVshowDetails),topFrame);
964 topLayout->addWidget(dummy->checkBox(),ii++,0); 964 topLayout->addWidget(dummy->checkBox(),ii++,0);
965 dummy = addWidBool(i18n("Created time"), 965 dummy = addWidBool(i18n("Created time"),
966 &(KOPrefs::instance()->mEVshowCreated),topFrame); 966 &(KOPrefs::instance()->mEVshowCreated),topFrame);
967 topLayout->addWidget(dummy->checkBox(),ii++,0); 967 topLayout->addWidget(dummy->checkBox(),ii++,0);
968 dummy = addWidBool(i18n("Last modified time"), 968 dummy = addWidBool(i18n("Last modified time"),
969 &(KOPrefs::instance()->mEVshowChanged),topFrame); 969 &(KOPrefs::instance()->mEVshowChanged),topFrame);
970 topLayout->addWidget(dummy->checkBox(),ii++,0); 970 topLayout->addWidget(dummy->checkBox(),ii++,0);
971 971
972 972
973 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); 973 lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame);
974 topLayout->addWidget(lab ,ii++,0); 974 topLayout->addWidget(lab ,ii++,0);
975 975
976 dummy = addWidBool(i18n("Details"), 976 dummy = addWidBool(i18n("Details"),
977 &(KOPrefs::instance()->mWTshowDetails),topFrame); 977 &(KOPrefs::instance()->mWTshowDetails),topFrame);
978 topLayout->addWidget(dummy->checkBox(),ii++,0); 978 topLayout->addWidget(dummy->checkBox(),ii++,0);
979 dummy = addWidBool(i18n("Created time"), 979 dummy = addWidBool(i18n("Created time"),
980 &(KOPrefs::instance()->mWTshowCreated),topFrame); 980 &(KOPrefs::instance()->mWTshowCreated),topFrame);
981 topLayout->addWidget(dummy->checkBox(),ii++,0); 981 topLayout->addWidget(dummy->checkBox(),ii++,0);
982 dummy = addWidBool(i18n("Last modified time"), 982 dummy = addWidBool(i18n("Last modified time"),
983 &(KOPrefs::instance()->mWTshowChanged),topFrame); 983 &(KOPrefs::instance()->mWTshowChanged),topFrame);
984 topLayout->addWidget(dummy->checkBox(),ii++,0); 984 topLayout->addWidget(dummy->checkBox(),ii++,0);
985 985
986 986
987 topFrame = addPage(i18n("Alarm"),0,0); 987 topFrame = addPage(i18n("Alarm"),0,0);
988 // DesktopIcon("viewmag",KIcon::SizeMedium)); 988 // DesktopIcon("viewmag",KIcon::SizeMedium));
989 989
990 topLayout = new QGridLayout(topFrame,2,1); 990 topLayout = new QGridLayout(topFrame,2,1);
991 topLayout->setSpacing(mSpacingHint); 991 topLayout->setSpacing(mSpacingHint);
992 topLayout->setMargin(mMarginHint); 992 topLayout->setMargin(mMarginHint);
993 int iii = 0; 993 int iii = 0;
994 994
995 dummy = 995 dummy =
996 addWidBool(i18n("Use internal alarm notification"), 996 addWidBool(i18n("Use internal alarm notification"),
997 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 997 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
998 topLayout->addWidget(dummy->checkBox(),iii++,0); 998 topLayout->addWidget(dummy->checkBox(),iii++,0);
999 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 999 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
1000 1000
1001 topLayout->addWidget(lab ,iii++,0); 1001 topLayout->addWidget(lab ,iii++,0);
1002#ifndef DESKTOP_VERSION 1002#ifndef DESKTOP_VERSION
1003 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1003 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1004#else 1004#else
1005 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1005 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1006 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1006 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1007#endif 1007#endif
1008 1008
1009 QHBox* dummyBox = new QHBox(topFrame); 1009 QHBox* dummyBox = new QHBox(topFrame);
1010 new QLabel(i18n("Play beeps count:"),dummyBox); 1010 new QLabel(i18n("Play beeps count:"),dummyBox);
1011 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 1011 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
1012 topLayout->addWidget(dummyBox,iii++,0); 1012 topLayout->addWidget(dummyBox,iii++,0);
1013 1013
1014 dummyBox = new QHBox(topFrame); 1014 dummyBox = new QHBox(topFrame);
1015 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 1015 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
1016 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 1016 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
1017 topLayout->addWidget(dummyBox,iii++,0); 1017 topLayout->addWidget(dummyBox,iii++,0);
1018 1018
1019 dummyBox = new QHBox(topFrame); 1019 dummyBox = new QHBox(topFrame);
1020 new QLabel(i18n("Default suspend time in min:"),dummyBox); 1020 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1021 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 1021 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1022 topLayout->addWidget(dummyBox,iii++,0); 1022 topLayout->addWidget(dummyBox,iii++,0);
1023 1023
1024 dummyBox = new QHBox(topFrame); 1024 dummyBox = new QHBox(topFrame);
1025 new QLabel(i18n("Auto suspend count:"),dummyBox); 1025 new QLabel(i18n("Auto suspend count:"),dummyBox);
1026 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1026 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1027 topLayout->addWidget(dummyBox,iii++,0); 1027 topLayout->addWidget(dummyBox,iii++,0);
1028 1028
1029 1029
1030 1030
1031
1032
1033
1034
1035 QHBox* hbo = new QHBox ( topFrame ); 1031 QHBox* hbo = new QHBox ( topFrame );
1036 mDefaultAlarmFile = new QLineEdit(hbo); 1032 mDefaultAlarmFile = new QLineEdit(hbo);
1037 QPushButton * loadTemplate = new QPushButton(hbo); 1033 QPushButton * loadTemplate = new QPushButton(hbo);
1038 QPixmap icon; 1034 QPixmap icon;
1039 if ( QApplication::desktop()->width() < 321 ) 1035 if ( QApplication::desktop()->width() < 321 )
1040 icon = SmallIcon("fileimport16"); 1036 icon = SmallIcon("fileimport16");
1041 else 1037 else
1042 icon = SmallIcon("fileimport"); 1038 icon = SmallIcon("fileimport");
1043 loadTemplate->setIconSet (icon ) ; 1039 loadTemplate->setIconSet (icon ) ;
1044 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1040 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1045 int size = loadTemplate->sizeHint().height(); 1041 int size = loadTemplate->sizeHint().height();
1046 loadTemplate->setFixedSize( size, size ); 1042 loadTemplate->setFixedSize( size, size );
1047 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1043 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1048 // topLayout->addWidget(lab ,iii++,0); 1044 // topLayout->addWidget(lab ,iii++,0);
1049 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1045 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1050 topLayout->addWidget(lab ,iii++,0); 1046 topLayout->addWidget(lab ,iii++,0);
1051 topLayout->addWidget(hbo,iii++,0); 1047 topLayout->addWidget(hbo,iii++,0);
1052 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 1048 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
1053 1049
1054// topLayout->addWidget(lab ,iii++,0); 1050// topLayout->addWidget(lab ,iii++,0);
1055// #ifndef DESKTOP_VERSION 1051// #ifndef DESKTOP_VERSION
1056// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1052// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1057// #else 1053// #else
1058// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1054// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1059// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1055// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1060// #endif 1056// #endif
1061 1057
1062 1058
1063} 1059}
1064 1060
1065void KOPrefsDialog::selectSoundFile() 1061void KOPrefsDialog::selectSoundFile()
1066{ 1062{
1067 QString fileName = mDefaultAlarmFile->text(); 1063 QString fileName = mDefaultAlarmFile->text();
1068 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1064 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1069 if ( fileName.length() > 0 ) 1065 if ( fileName.length() > 0 )
1070 mDefaultAlarmFile->setText( fileName ); 1066 mDefaultAlarmFile->setText( fileName );
1071} 1067}
1072void KOPrefsDialog::setupFontsTab() 1068void KOPrefsDialog::setupFontsTab()
1073{ 1069{
1074 1070
1075 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1071 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1076 // DesktopIcon("fonts",KIcon::SizeMedium)); 1072 // DesktopIcon("fonts",KIcon::SizeMedium));
1077 1073
1078 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1074 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1079 topLayout->setSpacing(1); 1075 topLayout->setSpacing(1);
1080 topLayout->setMargin(3); 1076 topLayout->setMargin(3);
1081 KPrefsDialogWidFont * tVFont; 1077 KPrefsDialogWidFont * tVFont;
1082 int i = 0; 1078 int i = 0;
1083 KPrefsDialogWidFont *timeLabelsFont = 1079 KPrefsDialogWidFont *timeLabelsFont =
1084 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1080 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1085 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1081 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1086 topLayout->addWidget(timeLabelsFont->label(),i,0); 1082 topLayout->addWidget(timeLabelsFont->label(),i,0);
1087 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1083 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1088 topLayout->addWidget(timeLabelsFont->button(),i,2); 1084 topLayout->addWidget(timeLabelsFont->button(),i,2);
1089 ++i; 1085 ++i;
1090 1086
1091 1087
1092 timeLabelsFont = 1088 timeLabelsFont =
1093 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1089 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1094 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1090 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1095 topLayout->addWidget(timeLabelsFont->label(),i,0); 1091 topLayout->addWidget(timeLabelsFont->label(),i,0);
1096 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1092 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1097 topLayout->addWidget(timeLabelsFont->button(),i,2); 1093 topLayout->addWidget(timeLabelsFont->button(),i,2);
1098 ++i; 1094 ++i;
1099 1095
1100 KPrefsDialogWidFont *timeBarFont = 1096 KPrefsDialogWidFont *timeBarFont =
1101 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1097 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1102 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1098 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1103 topLayout->addWidget(timeBarFont->label(),i,0); 1099 topLayout->addWidget(timeBarFont->label(),i,0);
1104 topLayout->addWidget(timeBarFont->preview(),i,1); 1100 topLayout->addWidget(timeBarFont->preview(),i,1);
1105 topLayout->addWidget(timeBarFont->button(),i,2); 1101 topLayout->addWidget(timeBarFont->button(),i,2);
1106 ++i; 1102 ++i;
1107 1103
1108 1104
1109 KPrefsDialogWidFont *marcusBainsFont = 1105 KPrefsDialogWidFont *marcusBainsFont =
1110 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1106 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1111 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1107 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1112 topLayout->addWidget(marcusBainsFont->label(),i,0); 1108 topLayout->addWidget(marcusBainsFont->label(),i,0);
1113 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1109 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1114 topLayout->addWidget(marcusBainsFont->button(),i,2); 1110 topLayout->addWidget(marcusBainsFont->button(),i,2);
1115 ++i; 1111 ++i;
1116 1112
1117 tVFont = 1113 tVFont =
1118 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1114 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1119 &(KOPrefs::instance()->mEventViewFont),topFrame); 1115 &(KOPrefs::instance()->mEventViewFont),topFrame);
1120 topLayout->addWidget(tVFont->label(),i,0); 1116 topLayout->addWidget(tVFont->label(),i,0);
1121 topLayout->addWidget(tVFont->preview(),i,1); 1117 topLayout->addWidget(tVFont->preview(),i,1);
1122 topLayout->addWidget(tVFont->button(),i,2); 1118 topLayout->addWidget(tVFont->button(),i,2);
1123 ++i; 1119 ++i;
1124 1120
1125 1121
1126 1122
1127 tVFont = 1123 tVFont =
1128 addWidFont(i18n("Details"),i18n("EditorBox:"), 1124 addWidFont(i18n("Details"),i18n("EditorBox:"),
1129 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1125 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1130 topLayout->addWidget(tVFont->label(),i,0); 1126 topLayout->addWidget(tVFont->label(),i,0);
1131 topLayout->addWidget(tVFont->preview(),i,1); 1127 topLayout->addWidget(tVFont->preview(),i,1);
1132 topLayout->addWidget(tVFont->button(),i,2); 1128 topLayout->addWidget(tVFont->button(),i,2);
1133 ++i; 1129 ++i;
1134 1130
1135 1131
1136 1132
1137 topLayout->setColStretch(1,1); 1133 topLayout->setColStretch(1,1);
1138 topLayout->setRowStretch(4,1); 1134 topLayout->setRowStretch(4,1);
1139 1135
1140 1136
1141 i = 0; 1137 i = 0;
1142 topFrame = addPage(i18n("View Fonts"),0, 1138 topFrame = addPage(i18n("View Fonts"),0,
1143 DesktopIcon("fonts",KIcon::SizeMedium)); 1139 DesktopIcon("fonts",KIcon::SizeMedium));
1144 1140
1145 topLayout = new QGridLayout(topFrame,7,3); 1141 topLayout = new QGridLayout(topFrame,7,3);
1146 topLayout->setSpacing(1); 1142 topLayout->setSpacing(1);
1147 topLayout->setMargin(3); 1143 topLayout->setMargin(3);
1148 1144
1149 tVFont = 1145 tVFont =
1150 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1146 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1151 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1147 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1152 topLayout->addWidget(tVFont->label(),i,0); 1148 topLayout->addWidget(tVFont->label(),i,0);
1153 topLayout->addWidget(tVFont->preview(),i,1); 1149 topLayout->addWidget(tVFont->preview(),i,1);
1154 topLayout->addWidget(tVFont->button(),i,2); 1150 topLayout->addWidget(tVFont->button(),i,2);
1155 ++i; 1151 ++i;
1156 KPrefsDialogWidFont *agendaViewFont = 1152 KPrefsDialogWidFont *agendaViewFont =
1157 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1153 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1158 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1154 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1159 topLayout->addWidget(agendaViewFont->label(),i,0); 1155 topLayout->addWidget(agendaViewFont->label(),i,0);
1160 topLayout->addWidget(agendaViewFont->preview(),i,1); 1156 topLayout->addWidget(agendaViewFont->preview(),i,1);
1161 topLayout->addWidget(agendaViewFont->button(),i,2); 1157 topLayout->addWidget(agendaViewFont->button(),i,2);
1162 ++i; 1158 ++i;
1163 1159
1164 1160
1165 KPrefsDialogWidFont *monthViewFont = 1161 KPrefsDialogWidFont *monthViewFont =
1166 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1162 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1167 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1163 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1168 topLayout->addWidget(monthViewFont->label(),i,0); 1164 topLayout->addWidget(monthViewFont->label(),i,0);
1169 topLayout->addWidget(monthViewFont->preview(),i,1); 1165 topLayout->addWidget(monthViewFont->preview(),i,1);
1170 topLayout->addWidget(monthViewFont->button(),i,2); 1166 topLayout->addWidget(monthViewFont->button(),i,2);
1171 ++i; 1167 ++i;
1172 1168
1173 1169
1174 KPrefsDialogWidFont *lVFont = 1170 KPrefsDialogWidFont *lVFont =
1175 addWidFont(i18n("Event"),i18n("List View:"), 1171 addWidFont(i18n("Event"),i18n("List View:"),
1176 &(KOPrefs::instance()->mListViewFont),topFrame); 1172 &(KOPrefs::instance()->mListViewFont),topFrame);
1177 topLayout->addWidget(lVFont->label(),i,0); 1173 topLayout->addWidget(lVFont->label(),i,0);
1178 topLayout->addWidget(lVFont->preview(),i,1); 1174 topLayout->addWidget(lVFont->preview(),i,1);
1179 topLayout->addWidget(lVFont->button(),i,2); 1175 topLayout->addWidget(lVFont->button(),i,2);
1180 ++i; 1176 ++i;
1181 1177
1182 1178
1183 tVFont = 1179 tVFont =
1184 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1180 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1185 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1181 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1186 topLayout->addWidget(tVFont->label(),i,0); 1182 topLayout->addWidget(tVFont->label(),i,0);
1187 topLayout->addWidget(tVFont->preview(),i,1); 1183 topLayout->addWidget(tVFont->preview(),i,1);
1188 topLayout->addWidget(tVFont->button(),i,2); 1184 topLayout->addWidget(tVFont->button(),i,2);
1189 ++i; 1185 ++i;
1190 1186
1191 1187
1192 tVFont = 1188 tVFont =
1193 addWidFont(i18n("Today"),i18n("JournalView:"), 1189 addWidFont(i18n("Today"),i18n("JournalView:"),
1194 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1190 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1195 topLayout->addWidget(tVFont->label(),i,0); 1191 topLayout->addWidget(tVFont->label(),i,0);
1196 topLayout->addWidget(tVFont->preview(),i,1); 1192 topLayout->addWidget(tVFont->preview(),i,1);
1197 topLayout->addWidget(tVFont->button(),i,2); 1193 topLayout->addWidget(tVFont->button(),i,2);
1198 ++i; 1194 ++i;
1199 1195
1200 1196
1201 1197
1202 1198
1203 topLayout->setColStretch(1,1); 1199 topLayout->setColStretch(1,1);
1204 topLayout->setRowStretch(4,1); 1200 topLayout->setRowStretch(4,1);
1205 1201
1206 1202
1207 1203
1208 1204
1209} 1205}
1210 1206
1211void KOPrefsDialog::setupColorsTab() 1207void KOPrefsDialog::setupColorsTab()
1212{ 1208{
1213 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1209 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1214 // DesktopIcon("colorize",KIcon::SizeMedium)); 1210 // DesktopIcon("colorize",KIcon::SizeMedium));
1215 1211
1216 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1212 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1217 // topLayout->setSpacing(mSpacingHint); 1213 // topLayout->setSpacing(mSpacingHint);
1218 // topLayout->setMargin(mMarginHint); 1214 // topLayout->setMargin(mMarginHint);
1219 1215
1220 topLayout->setSpacing(2); 1216 topLayout->setSpacing(2);
1221 topLayout->setMargin(3); 1217 topLayout->setMargin(3);
1222 1218
1223 int ii = 1; 1219 int ii = 1;
1224 QGroupBox *categoryGroup ; 1220 QGroupBox *categoryGroup ;
1225 1221
1226 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1222 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1227 topFrame); 1223 topFrame);
1228 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1224 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1229 1225
1230 mCategoryCombo = new QComboBox(categoryGroup); 1226 mCategoryCombo = new QComboBox(categoryGroup);
1231 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1227 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1232 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1228 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1233 1229
1234 mCategoryButton = new KColorButton(categoryGroup); 1230 mCategoryButton = new KColorButton(categoryGroup);
1235 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1231 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1236 updateCategoryColor(); 1232 updateCategoryColor();
1237 1233
1238 1234
1239 // Holiday Color 1235 // Holiday Color
1240 1236
1241 KPrefsDialogWidColor *holidayColor = 1237 KPrefsDialogWidColor *holidayColor =
1242 addWidColor(i18n("Holiday color:"), 1238 addWidColor(i18n("Holiday color:"),
1243 &(KOPrefs::instance()->mHolidayColor),topFrame); 1239 &(KOPrefs::instance()->mHolidayColor),topFrame);
1244 topLayout->addWidget(holidayColor->label(),ii,0); 1240 topLayout->addWidget(holidayColor->label(),ii,0);
1245 topLayout->addWidget(holidayColor->button(),ii++,1); 1241 topLayout->addWidget(holidayColor->button(),ii++,1);
1246 1242
1247 // Highlight Color 1243 // Highlight Color
1248 KPrefsDialogWidColor *highlightColor = 1244 KPrefsDialogWidColor *highlightColor =
1249 addWidColor(i18n("Highlight color:"), 1245 addWidColor(i18n("Highlight color:"),
1250 &(KOPrefs::instance()->mHighlightColor),topFrame); 1246 &(KOPrefs::instance()->mHighlightColor),topFrame);
1251 topLayout->addWidget(highlightColor->label(),ii,0); 1247 topLayout->addWidget(highlightColor->label(),ii,0);
1252 topLayout->addWidget(highlightColor->button(),ii++,1); 1248 topLayout->addWidget(highlightColor->button(),ii++,1);
1253 1249
1254 // Event color 1250 // Event color
1255 KPrefsDialogWidColor *eventColor = 1251 KPrefsDialogWidColor *eventColor =
1256 addWidColor(i18n("Default event color:"), 1252 addWidColor(i18n("Default event color:"),
1257 &(KOPrefs::instance()->mEventColor),topFrame); 1253 &(KOPrefs::instance()->mEventColor),topFrame);
1258 topLayout->addWidget(eventColor->label(),ii,0); 1254 topLayout->addWidget(eventColor->label(),ii,0);
1259 topLayout->addWidget(eventColor->button(),ii++,1); 1255 topLayout->addWidget(eventColor->button(),ii++,1);
1260 eventColor = 1256 eventColor =
1261 addWidColor(i18n("Default todo done color:"), 1257 addWidColor(i18n("Default todo done color:"),
1262 &(KOPrefs::instance()->mTodoDoneColor),topFrame); 1258 &(KOPrefs::instance()->mTodoDoneColor),topFrame);
1263 topLayout->addWidget(eventColor->label(),ii,0); 1259 topLayout->addWidget(eventColor->label(),ii,0);
1264 topLayout->addWidget(eventColor->button(),ii++,1); 1260 topLayout->addWidget(eventColor->button(),ii++,1);
1265 1261
1266 1262
1267 // agenda view background color 1263 // agenda view background color
1268 KPrefsDialogWidColor *agendaBgColor = 1264 KPrefsDialogWidColor *agendaBgColor =
1269 addWidColor(i18n("Agenda view background color:"), 1265 addWidColor(i18n("Agenda view background color:"),
1270 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1266 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1271 topLayout->addWidget(agendaBgColor->label(),ii,0); 1267 topLayout->addWidget(agendaBgColor->label(),ii,0);
1272 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1268 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1273 1269
1274 // working hours color 1270 // working hours color
1275 KPrefsDialogWidColor *workingHoursColor = 1271 KPrefsDialogWidColor *workingHoursColor =
1276 addWidColor(i18n("Working hours color:"), 1272 addWidColor(i18n("Working hours color:"),
1277 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1273 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1278 topLayout->addWidget(workingHoursColor->label(),ii,0); 1274 topLayout->addWidget(workingHoursColor->label(),ii,0);
1279 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1275 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1280 1276
1281 KPrefsDialogWidBool *sb = 1277 KPrefsDialogWidBool *sb =
1282 addWidBool(i18n("Use colors for application:"), 1278 addWidBool(i18n("Use colors for application:"),
1283 &(KOPrefs::instance()->mUseAppColors),topFrame); 1279 &(KOPrefs::instance()->mUseAppColors),topFrame);
1284 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1280 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1285 1281
1286 ii++; 1282 ii++;
1287 KPrefsDialogWidColor * workingHoursColor1 = 1283 KPrefsDialogWidColor * workingHoursColor1 =
1288 addWidColor(i18n("Buttons, menus, etc.:"), 1284 addWidColor(i18n("Buttons, menus, etc.:"),
1289 &(KOPrefs::instance()->mAppColor1),topFrame); 1285 &(KOPrefs::instance()->mAppColor1),topFrame);
1290 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1286 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1291 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1287 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1292 1288
1293 KPrefsDialogWidColor * workingHoursColor2 = 1289 KPrefsDialogWidColor * workingHoursColor2 =
1294 addWidColor(i18n("Frames, labels, etc.:"), 1290 addWidColor(i18n("Frames, labels, etc.:"),
1295 &(KOPrefs::instance()->mAppColor2),topFrame); 1291 &(KOPrefs::instance()->mAppColor2),topFrame);
1296 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1292 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1297 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1293 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1298 1294
1299 1295
1300 1296
1301} 1297}
1302 1298
1303void KOPrefsDialog::setCategoryColor() 1299void KOPrefsDialog::setCategoryColor()
1304{ 1300{
1305 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1301 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1306} 1302}
1307 1303
1308void KOPrefsDialog::updateCategoryColor() 1304void KOPrefsDialog::updateCategoryColor()
1309{ 1305{
1310 QString cat = mCategoryCombo->currentText(); 1306 QString cat = mCategoryCombo->currentText();
1311 QColor *color = mCategoryDict.find(cat); 1307 QColor *color = mCategoryDict.find(cat);
1312 if (!color) { 1308 if (!color) {
1313 color = KOPrefs::instance()->categoryColor(cat); 1309 color = KOPrefs::instance()->categoryColor(cat);
1314 } 1310 }
1315 if (color) { 1311 if (color) {
1316 mCategoryButton->setColor(*color); 1312 mCategoryButton->setColor(*color);
1317 } 1313 }
1318} 1314}
1319 1315
1320void KOPrefsDialog::setupPrinterTab() 1316void KOPrefsDialog::setupPrinterTab()
1321{ 1317{
1322 mPrinterTab = addPage(i18n("Printing"),0, 1318 mPrinterTab = addPage(i18n("Printing"),0,
1323 DesktopIcon("fileprint",KIcon::SizeMedium)); 1319 DesktopIcon("fileprint",KIcon::SizeMedium));
1324 1320
1325 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1321 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1326 topLayout->setSpacing(mSpacingHint); 1322 topLayout->setSpacing(mSpacingHint);
1327 topLayout->setMargin(mMarginHint); 1323 topLayout->setMargin(mMarginHint);
1328 1324
1329 topLayout->setRowStretch(4,1); 1325 topLayout->setRowStretch(4,1);
1330} 1326}
1331 1327
1332void KOPrefsDialog::setupGroupSchedulingTab() 1328void KOPrefsDialog::setupGroupSchedulingTab()
1333{ 1329{
1334#if 0 1330#if 0
1335 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1331 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1336 DesktopIcon("personal",KIcon::SizeMedium)); 1332 DesktopIcon("personal",KIcon::SizeMedium));
1337 1333
1338 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1334 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1339 topLayout->setSpacing(mSpacingHint); 1335 topLayout->setSpacing(mSpacingHint);
1340 topLayout->setMargin(mMarginHint); 1336 topLayout->setMargin(mMarginHint);
1341 1337
1342#if 0 1338#if 0
1343 KPrefsDialogWidRadios *schedulerGroup = 1339 KPrefsDialogWidRadios *schedulerGroup =
1344 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1340 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1345 topFrame); 1341 topFrame);
1346 schedulerGroup->addRadio("Dummy"); // Only for debugging 1342 schedulerGroup->addRadio("Dummy"); // Only for debugging
1347 schedulerGroup->addRadio(i18n("Mail client")); 1343 schedulerGroup->addRadio(i18n("Mail client"));
1348 1344
1349 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1345 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1350#endif 1346#endif
1351 1347
1352 KPrefsDialogWidRadios *sendGroup = 1348 KPrefsDialogWidRadios *sendGroup =
1353 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1349 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1354 topFrame); 1350 topFrame);
1355 sendGroup->addRadio(i18n("Send to outbox")); 1351 sendGroup->addRadio(i18n("Send to outbox"));
1356 sendGroup->addRadio(i18n("Send directly")); 1352 sendGroup->addRadio(i18n("Send directly"));
1357 1353
1358 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1354 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1359 1355
1360 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1356 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1361 mAMails = new QListView(topFrame); 1357 mAMails = new QListView(topFrame);
1362 mAMails->addColumn(i18n("Email"),300); 1358 mAMails->addColumn(i18n("Email"),300);
1363 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1359 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1364 1360
1365 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1361 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1366 aEmailsEdit = new QLineEdit(topFrame); 1362 aEmailsEdit = new QLineEdit(topFrame);
1367 aEmailsEdit->setEnabled(false); 1363 aEmailsEdit->setEnabled(false);
1368 topLayout->addWidget(aEmailsEdit,4,1); 1364 topLayout->addWidget(aEmailsEdit,4,1);
1369 1365
1370 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1366 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1371 topLayout->addWidget(add,5,0); 1367 topLayout->addWidget(add,5,0);
1372 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1368 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1373 topLayout->addWidget(del,5,1); 1369 topLayout->addWidget(del,5,1);
1374 1370
1375 //topLayout->setRowStretch(2,1); 1371 //topLayout->setRowStretch(2,1);
1376 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1372 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1377 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1373 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1378 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1374 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1379 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1375 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1380#endif 1376#endif
1381} 1377}
1382 1378
1383void KOPrefsDialog::setupGroupAutomationTab() 1379void KOPrefsDialog::setupGroupAutomationTab()
1384{ 1380{
1385 return; 1381 return;
1386 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1382 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1387 DesktopIcon("personal",KIcon::SizeMedium)); 1383 DesktopIcon("personal",KIcon::SizeMedium));
1388 1384
1389 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1385 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1390 topLayout->setSpacing(mSpacingHint); 1386 topLayout->setSpacing(mSpacingHint);
1391 topLayout->setMargin(mMarginHint); 1387 topLayout->setMargin(mMarginHint);
1392 1388
1393 KPrefsDialogWidRadios *autoRefreshGroup = 1389 KPrefsDialogWidRadios *autoRefreshGroup =
1394 addWidRadios(i18n("Auto Send Refresh"), 1390 addWidRadios(i18n("Auto Send Refresh"),
1395 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1391 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1396 autoRefreshGroup->addRadio(i18n("Never")); 1392 autoRefreshGroup->addRadio(i18n("Never"));
1397 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1393 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1398 //autoRefreshGroup->addRadio(i18n("selected emails")); 1394 //autoRefreshGroup->addRadio(i18n("selected emails"));
1399 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1395 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1400 1396
1401 KPrefsDialogWidRadios *autoInsertGroup = 1397 KPrefsDialogWidRadios *autoInsertGroup =
1402 addWidRadios(i18n("Auto Insert IMIP Replies"), 1398 addWidRadios(i18n("Auto Insert IMIP Replies"),
1403 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1399 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1404 autoInsertGroup->addRadio(i18n("Never")); 1400 autoInsertGroup->addRadio(i18n("Never"));
1405 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1401 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1406 //autoInsertGroup->addRadio(i18n("selected emails")); 1402 //autoInsertGroup->addRadio(i18n("selected emails"));
1407 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1403 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1408 1404
1409 KPrefsDialogWidRadios *autoRequestGroup = 1405 KPrefsDialogWidRadios *autoRequestGroup =
1410 addWidRadios(i18n("Auto Insert IMIP Requests"), 1406 addWidRadios(i18n("Auto Insert IMIP Requests"),
1411 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1407 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1412 autoRequestGroup->addRadio(i18n("Never")); 1408 autoRequestGroup->addRadio(i18n("Never"));
1413 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1409 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1414 //autoInsertGroup->addRadio(i18n("selected emails")); 1410 //autoInsertGroup->addRadio(i18n("selected emails"));
1415 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1411 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1416 1412
1417 KPrefsDialogWidRadios *autoFreeBusyGroup = 1413 KPrefsDialogWidRadios *autoFreeBusyGroup =
1418 addWidRadios(i18n("Auto Send FreeBusy Information"), 1414 addWidRadios(i18n("Auto Send FreeBusy Information"),
1419 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1415 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1420 autoFreeBusyGroup->addRadio(i18n("Never")); 1416 autoFreeBusyGroup->addRadio(i18n("Never"));
1421 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1417 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1422 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1418 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1423 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1419 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1424 1420
1425 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1421 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1426 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1422 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1427 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1423 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1428 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1424 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1429 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1425 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1430 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1426 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1431 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1427 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1432} 1428}
1433 1429
1434void KOPrefsDialog::showPrinterTab() 1430void KOPrefsDialog::showPrinterTab()
1435{ 1431{
1436 showPage(pageIndex(mPrinterTab)); 1432 showPage(pageIndex(mPrinterTab));
1437} 1433}
1438 1434
1439 1435
1440void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1436void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1441 const QStringList *tags) 1437 const QStringList *tags)
1442{ 1438{
1443 if (tags) { 1439 if (tags) {
1444 int i = tags->findIndex(text); 1440 int i = tags->findIndex(text);
1445 if (i > 0) combo->setCurrentItem(i); 1441 if (i > 0) combo->setCurrentItem(i);
1446 } else { 1442 } else {
1447 for(int i=0;i<combo->count();++i) { 1443 for(int i=0;i<combo->count();++i) {
1448 if (combo->text(i) == text) { 1444 if (combo->text(i) == text) {
1449 combo->setCurrentItem(i); 1445 combo->setCurrentItem(i);
1450 break; 1446 break;
1451 } 1447 }
1452 } 1448 }
1453 } 1449 }
1454} 1450}
1455 1451
1456void KOPrefsDialog::usrReadConfig() 1452void KOPrefsDialog::usrReadConfig()
1457{ 1453{
1458 kdelibcfg->readConfig(); 1454 kdelibcfg->readConfig();
1459 mNameEdit->setText(KOPrefs::instance()->fullName()); 1455 mNameEdit->setText(KOPrefs::instance()->fullName());
1460 mEmailEdit->setText(KOPrefs::instance()->email()); 1456 mEmailEdit->setText(KOPrefs::instance()->email());
1461 1457
1462 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1458 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1463 // QDate current ( 2001, 1,1); 1459 // QDate current ( 2001, 1,1);
1464 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1460 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1465 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1461 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1466 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); 1462 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
1467 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1463 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1468 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1464 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1469 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1465 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1470 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1466 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1471 // if (KOPrefs::instance()->mAllDaySize > 47 ) 1467 // if (KOPrefs::instance()->mAllDaySize > 47 )
1472 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; 1468 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
1473 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 1469 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
1474 1470
1475 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1471 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1476 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1472 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1477 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1473 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1478 // mAMails->clear(); 1474 // mAMails->clear();
1479 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1475 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1480// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1476// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1481// QListViewItem *item = new QListViewItem(mAMails); 1477// QListViewItem *item = new QListViewItem(mAMails);
1482// item->setText(0,*it); 1478// item->setText(0,*it);
1483// mAMails->insertItem(item); 1479// mAMails->insertItem(item);
1484// } 1480// }
1485 1481
1486 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); 1482 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
1487 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); 1483 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
1488 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); 1484 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
1489 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); 1485 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
1490 1486
1491 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1487 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1492 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1488 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1493 //QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1489 //QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1494 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 1490 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
1495 //dummy = KOPrefs::instance()->mUserDateFormatShort; 1491 //dummy = KOPrefs::instance()->mUserDateFormatShort;
1496 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 1492 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
1497 updateCategories(); 1493 updateCategories();
1498 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1494 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1499 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1495 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1500 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1496 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1501 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1497 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1502} 1498}
1503 1499
1504 1500
1505void KOPrefsDialog::usrWriteConfig() 1501void KOPrefsDialog::usrWriteConfig()
1506{ 1502{
1507 1503
1508 kdelibcfg->writeConfig(); 1504 kdelibcfg->writeConfig();
1509 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); 1505 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
1510 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); 1506 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
1511 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); 1507 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
1512 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); 1508 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
1513 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); 1509 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
1514 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1510 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1515 1511
1516 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 1512 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
1517 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 1513 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
1518 KOPrefs::instance()->setFullName(mNameEdit->text()); 1514 KOPrefs::instance()->setFullName(mNameEdit->text());
1519 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1515 KOPrefs::instance()->setEmail(mEmailEdit->text());
1520 1516
1521 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1517 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1522 1518
1523 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); 1519 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
1524 //QDate date; 1520 //QDate date;
1525 //date = mStartDateSavingEdit->date(); 1521 //date = mStartDateSavingEdit->date();
1526 //int sub = 0; 1522 //int sub = 0;
1527 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1523 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1528 // sub = 1; 1524 // sub = 1;
1529// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; 1525// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
1530// date = mEndDateSavingEdit->date(); 1526// date = mEndDateSavingEdit->date();
1531// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1527// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1532// sub = 1; 1528// sub = 1;
1533// else 1529// else
1534// sub = 0; 1530// sub = 0;
1535// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; 1531// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
1536// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); 1532// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
1537 1533
1538 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1534 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1539 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1535 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1540 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1536 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1541 1537
1542 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 1538 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
1543 1539
1544 QDictIterator<QColor> it(mCategoryDict); 1540 QDictIterator<QColor> it(mCategoryDict);
1545 while (it.current()) { 1541 while (it.current()) {
1546 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1542 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());