summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp11
-rw-r--r--korganizer/kofilterview.cpp10
-rw-r--r--korganizer/komonthview.cpp12
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefsdialog.cpp1
5 files changed, 22 insertions, 13 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index e660c32..a8e0678 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -1,520 +1,525 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#include <qapplication.h> 38#include <qapplication.h>
39#define AGENDA_ICON_SIZE 7 39#define AGENDA_ICON_SIZE 7
40#endif 40#endif
41#include <libkcal/icaldrag.h> 41#include <libkcal/icaldrag.h>
42#include <libkcal/vcaldrag.h> 42#include <libkcal/vcaldrag.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44extern int globalFlagBlockAgenda; 44extern int globalFlagBlockAgenda;
45extern int globalFlagBlockAgendaItemPaint; 45extern int globalFlagBlockAgendaItemPaint;
46extern int globalFlagBlockAgendaItemUpdate; 46extern int globalFlagBlockAgendaItemUpdate;
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49 49
50#include "koagendaitem.h" 50#include "koagendaitem.h"
51//#include "koagendaitem.moc" 51//#include "koagendaitem.moc"
52 52
53 53
54//-------------------------------------------------------------------------- 54//--------------------------------------------------------------------------
55 55
56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
57 57
58//-------------------------------------------------------------------------- 58//--------------------------------------------------------------------------
59 59
60class KOAgendaItemWhatsThis :public QWhatsThis 60class KOAgendaItemWhatsThis :public QWhatsThis
61{ 61{
62public: 62public:
63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
64 64
65protected: 65protected:
66 virtual QString text( const QPoint& ) 66 virtual QString text( const QPoint& )
67 { 67 {
68 return _view->getWhatsThisText() ; 68 return _view->getWhatsThisText() ;
69 } 69 }
70private: 70private:
71 KOAgendaItem * _view; 71 KOAgendaItem * _view;
72}; 72};
73 73
74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
75 const char *name,WFlags) : 75 const char *name,WFlags) :
76 QWidget(parent, name), mIncidence(incidence), mDate(qd) 76 QWidget(parent, name), mIncidence(incidence), mDate(qd)
77{ 77{
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
80#endif 80#endif
81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
83 setWFlags ( wflags); 83 setWFlags ( wflags);
84 mAllDay = allday; 84 mAllDay = allday;
85 init ( incidence, qd ); 85 init ( incidence, qd );
86 //setMouseTracking(true); 86 //setMouseTracking(true);
87 //setAcceptDrops(true); 87 //setAcceptDrops(true);
88 xPaintCoord = -1; 88 xPaintCoord = -1;
89 yPaintCoord = -1; 89 yPaintCoord = -1;
90} 90}
91QString KOAgendaItem::getWhatsThisText() 91QString KOAgendaItem::getWhatsThisText()
92{ 92{
93 if ( mIncidence ) 93 if ( mIncidence )
94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
95 KOPrefs::instance()->mWTshowDetails, 95 KOPrefs::instance()->mWTshowDetails,
96 KOPrefs::instance()->mWTshowCreated, 96 KOPrefs::instance()->mWTshowCreated,
97 KOPrefs::instance()->mWTshowChanged); 97 KOPrefs::instance()->mWTshowChanged);
98 return "KOAgendaItem::getWhatsThisText()::internal error"; 98 return "KOAgendaItem::getWhatsThisText()::internal error";
99} 99}
100void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100void KOAgendaItem::init ( Incidence *incidence, QDate qd )
101{ 101{
102 mIncidence = incidence; 102 mIncidence = incidence;
103 mDate = qd; 103 mDate = qd;
104 mFirstMultiItem = 0; 104 mFirstMultiItem = 0;
105 mNextMultiItem = 0; 105 mNextMultiItem = 0;
106 mLastMultiItem = 0; 106 mLastMultiItem = 0;
107 computeText(); 107 computeText();
108 108
109 if ( (incidence->typeID() == todoID ) && 109 if ( (incidence->typeID() == todoID ) &&
110 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
114 else 114 else
115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
116 } 116 }
117 else { 117 else {
118 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
119 QString cat = categories.first(); 119 QString cat = categories.first();
120 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
121 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
123 else 123 else
124 mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); 124 mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() );
125 } else { 125 } else {
126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
127 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
129 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
130 } 130 }
131 } 131 }
132 132
133 } 133 }
134 mColorGroup = QColorGroup( mBackgroundColor.light(), 134
135 mBackgroundColor.dark(),mBackgroundColor.light(), 135 QColor BackgroundColor ( mBackgroundColor );
136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 136 if ( mIncidence->calID() > 1 ) {
137 BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
138 }
139 mColorGroup = QColorGroup( BackgroundColor.light(),
140 BackgroundColor.dark(),BackgroundColor.light(),
141 BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ;
137 setBackgroundColor( mBackgroundColor ); 142 setBackgroundColor( mBackgroundColor );
138 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); 143 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
139 mConflictItems.clear(); 144 mConflictItems.clear();
140 setCellXY(0,0,1); 145 setCellXY(0,0,1);
141 setCellXWidth(0); 146 setCellXWidth(0);
142 setSubCell(0); 147 setSubCell(0);
143 setSubCells(1); 148 setSubCells(1);
144 setMultiItem(0,0,0); 149 setMultiItem(0,0,0);
145 startMove(); 150 startMove();
146 mSelected = true; 151 mSelected = true;
147 select(false); 152 select(false);
148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 153 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
149 mFontPixelSize = fontinf.height();; 154 mFontPixelSize = fontinf.height();;
150 hide(); 155 hide();
151 xPaintCoord = -1; 156 xPaintCoord = -1;
152 yPaintCoord = -1; 157 yPaintCoord = -1;
153} 158}
154 159
155 160
156KOAgendaItem::~KOAgendaItem() 161KOAgendaItem::~KOAgendaItem()
157{ 162{
158#if QT_VERSION >= 0x030000 163#if QT_VERSION >= 0x030000
159 164
160#else 165#else
161 delete mKOAgendaItemWhatsThis; 166 delete mKOAgendaItemWhatsThis;
162#endif 167#endif
163 168
164} 169}
165 170
166void KOAgendaItem::recreateIncidence() 171void KOAgendaItem::recreateIncidence()
167{ 172{
168#if 0 173#if 0
169 Incidence* newInc = mIncidence->clone(); 174 Incidence* newInc = mIncidence->clone();
170 newInc->recreate(); 175 newInc->recreate();
171 if ( mIncidence->doesRecur() ) { 176 if ( mIncidence->doesRecur() ) {
172 mIncidence->addExDate( mDate ); 177 mIncidence->addExDate( mDate );
173 newInc->recurrence()->unsetRecurs(); 178 newInc->recurrence()->unsetRecurs();
174 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 179 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
175 QTime tim = mIncidence->dtStart().time(); 180 QTime tim = mIncidence->dtStart().time();
176 newInc->setDtStart( QDateTime(mDate, tim) ); 181 newInc->setDtStart( QDateTime(mDate, tim) );
177 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 182 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
178 } 183 }
179#endif 184#endif
180 mIncidence = mIncidence->recreateCloneException( mDate ); 185 mIncidence = mIncidence->recreateCloneException( mDate );
181} 186}
182bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 187bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
183{ 188{
184 int size = AGENDA_ICON_SIZE; 189 int size = AGENDA_ICON_SIZE;
185 190
186 int yOff = 0; 191 int yOff = 0;
187 int xOff = 0; 192 int xOff = 0;
188 int x = pos().x() +3; 193 int x = pos().x() +3;
189 int y; 194 int y;
190 if ( mAllDay ) 195 if ( mAllDay )
191 y = pos().y()+3; 196 y = pos().y()+3;
192 else 197 else
193 y = mCellYTop * ( height() / cellHeight() ) +3; 198 y = mCellYTop * ( height() / cellHeight() ) +3;
194 if (mIncidence->cancelled()) { 199 if (mIncidence->cancelled()) {
195 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 200 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
196 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 201 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
197 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 202 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
198 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 203 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
199 if ( horLayout ) 204 if ( horLayout )
200 ++xOff; 205 ++xOff;
201 else 206 else
202 ++yOff; 207 ++yOff;
203 } 208 }
204 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { 209 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
205 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 210 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
206 if ( horLayout ) 211 if ( horLayout )
207 ++xOff; 212 ++xOff;
208 else 213 else
209 ++yOff; 214 ++yOff;
210 } 215 }
211 if (mIncidence->recurrence()->doesRecur()) { 216 if (mIncidence->recurrence()->doesRecur()) {
212 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 217 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
213 if ( horLayout ) 218 if ( horLayout )
214 ++xOff; 219 ++xOff;
215 else 220 else
216 ++yOff; 221 ++yOff;
217 } 222 }
218 if (mIncidence->description().length() > 0) { 223 if (mIncidence->description().length() > 0) {
219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 224 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
220 if ( horLayout ) 225 if ( horLayout )
221 ++xOff; 226 ++xOff;
222 else 227 else
223 ++yOff; 228 ++yOff;
224 } 229 }
225 if (mIncidence->isReadOnly()) { 230 if (mIncidence->isReadOnly()) {
226 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
227 if ( horLayout ) 232 if ( horLayout )
228 ++xOff; 233 ++xOff;
229 else 234 else
230 ++yOff; 235 ++yOff;
231 } 236 }
232 237
233 if (mIncidence->attendeeCount()>0) { 238 if (mIncidence->attendeeCount()>0) {
234 239
235 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 240 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
236 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 241 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
237 if ( horLayout ) 242 if ( horLayout )
238 ++xOff; 243 ++xOff;
239 else 244 else
240 ++yOff; 245 ++yOff;
241 } else { 246 } else {
242 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 247 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
243 if (me!=0) { 248 if (me!=0) {
244 249
245 250
246 } else { 251 } else {
247 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
248 if ( horLayout ) 253 if ( horLayout )
249 ++xOff; 254 ++xOff;
250 else 255 else
251 ++yOff; 256 ++yOff;
252 257
253 } 258 }
254 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 259 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
255 if ( horLayout ) 260 if ( horLayout )
256 ++xOff; 261 ++xOff;
257 else 262 else
258 ++yOff; 263 ++yOff;
259 264
260 } 265 }
261 266
262 } 267 }
263 return ( yOff || xOff ); 268 return ( yOff || xOff );
264} 269}
265 270
266 271
267void KOAgendaItem::select(bool selected) 272void KOAgendaItem::select(bool selected)
268{ 273{
269 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 274 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
270 if (mSelected == selected) return; 275 if (mSelected == selected) return;
271 mSelected = selected; 276 mSelected = selected;
272 if ( ! isVisible() ) 277 if ( ! isVisible() )
273 return; 278 return;
274 if ( firstMultiItem() ) 279 if ( firstMultiItem() )
275 firstMultiItem()->select( selected ); 280 firstMultiItem()->select( selected );
276 if ( !firstMultiItem() && nextMultiItem() ) { 281 if ( !firstMultiItem() && nextMultiItem() ) {
277 KOAgendaItem * placeItem = nextMultiItem(); 282 KOAgendaItem * placeItem = nextMultiItem();
278 while ( placeItem ) { 283 while ( placeItem ) {
279 placeItem->select( selected ); 284 placeItem->select( selected );
280 placeItem = placeItem->nextMultiItem(); 285 placeItem = placeItem->nextMultiItem();
281 } 286 }
282 } 287 }
283 globalFlagBlockAgendaItemUpdate = 0; 288 globalFlagBlockAgendaItemUpdate = 0;
284 paintMe( selected ); 289 paintMe( selected );
285 globalFlagBlockAgendaItemUpdate = 1; 290 globalFlagBlockAgendaItemUpdate = 1;
286 repaint( false ); 291 repaint( false );
287} 292}
288 293
289 294
290/* 295/*
291 The eventFilter has to filter the mouse events of the agenda item childs. The 296 The eventFilter has to filter the mouse events of the agenda item childs. The
292 events are fed into the event handling method of KOAgendaItem. This allows the 297 events are fed into the event handling method of KOAgendaItem. This allows the
293 KOAgenda to handle the KOAgendaItems by using an eventFilter. 298 KOAgenda to handle the KOAgendaItems by using an eventFilter.
294*/ 299*/
295bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 300bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
296{ 301{
297 if (e->type() == QEvent::MouseButtonPress || 302 if (e->type() == QEvent::MouseButtonPress ||
298 e->type() == QEvent::MouseButtonDblClick || 303 e->type() == QEvent::MouseButtonDblClick ||
299 e->type() == QEvent::MouseButtonRelease || 304 e->type() == QEvent::MouseButtonRelease ||
300 e->type() == QEvent::MouseMove) { 305 e->type() == QEvent::MouseMove) {
301 QMouseEvent *me = (QMouseEvent *)e; 306 QMouseEvent *me = (QMouseEvent *)e;
302 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 307 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
303 mapToGlobal(me->pos())); 308 mapToGlobal(me->pos()));
304 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 309 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
305 return event(&returnEvent); 310 return event(&returnEvent);
306 } else { 311 } else {
307 return false; 312 return false;
308 } 313 }
309} 314}
310void KOAgendaItem::repaintMe( ) 315void KOAgendaItem::repaintMe( )
311{ 316{
312 paintMe ( mSelected ); 317 paintMe ( mSelected );
313} 318}
314void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 319void KOAgendaItem::paintMe( bool selected, QPainter* paint )
315{ 320{
316 if ( globalFlagBlockAgendaItemUpdate && ! selected) 321 if ( globalFlagBlockAgendaItemUpdate && ! selected)
317 return; 322 return;
318 QPainter pa; 323 QPainter pa;
319 324
320 if ( mSelected ) { 325 if ( mSelected ) {
321 pa.begin( paintPixSel() ); 326 pa.begin( paintPixSel() );
322 } else { 327 } else {
323 if ( mAllDay ) 328 if ( mAllDay )
324 pa.begin( paintPixAllday() ); 329 pa.begin( paintPixAllday() );
325 else 330 else
326 pa.begin( paintPix() ); 331 pa.begin( paintPix() );
327 } 332 }
328 int x, yy, w, h; 333 int x, yy, w, h;
329 float nfh = 7.0; 334 float nfh = 7.0;
330 x = pos().x(); w = width(); h = height (); 335 x = pos().x(); w = width(); h = height ();
331 if ( mAllDay ) 336 if ( mAllDay )
332 yy = y(); 337 yy = y();
333 else 338 else
334 yy = mCellYTop * ( height() / cellHeight() ); 339 yy = mCellYTop * ( height() / cellHeight() );
335 xPaintCoord= x; 340 xPaintCoord= x;
336 yPaintCoord = yy; 341 yPaintCoord = yy;
337 wPaintCoord = width(); 342 wPaintCoord = width();
338 hPaintCoord = height(); 343 hPaintCoord = height();
339 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 344 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
340 if ( paint == 0 ) 345 if ( paint == 0 )
341 paint = &pa; 346 paint = &pa;
342 bool horLayout = ( w < h ); 347 bool horLayout = ( w < h );
343 int maxhei = mFontPixelSize+4; 348 int maxhei = mFontPixelSize+4;
344 if ( horLayout ) 349 if ( horLayout )
345 maxhei += AGENDA_ICON_SIZE -4; 350 maxhei += AGENDA_ICON_SIZE -4;
346 bool small = ( h < maxhei ); 351 bool small = ( h < maxhei );
347 if ( ! small ) 352 if ( ! small )
348 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 353 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
349 else { 354 else {
350 QFont f = KOPrefs::instance()->mAgendaViewFont; 355 QFont f = KOPrefs::instance()->mAgendaViewFont;
351 f.setBold( false ); 356 f.setBold( false );
352 int fh = f.pointSize(); 357 int fh = f.pointSize();
353 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 358 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
354 if ( nfh < 6 ) 359 if ( nfh < 6 )
355 nfh = 6; 360 nfh = 6;
356 f.setPointSize( nfh ); 361 f.setPointSize( nfh );
357 paint->setFont(f); 362 paint->setFont(f);
358 } 363 }
359 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 364 paint->fillRect ( x, yy, w, h, mBackgroundColor );
360 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 365 static const QPixmap completedPxmp = SmallIcon("greenhook16");
361 static const QPixmap overduePxmp = SmallIcon("redcross16"); 366 static const QPixmap overduePxmp = SmallIcon("redcross16");
362 if ( mIncidence->typeID() == todoID ) { 367 if ( mIncidence->typeID() == todoID ) {
363 Todo* tempTodo = static_cast<Todo*>(mIncidence); 368 Todo* tempTodo = static_cast<Todo*>(mIncidence);
364 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 369 int xx = pos().x()+(width()-completedPxmp.width()-3 );
365 int yyy = yy+3; 370 int yyy = yy+3;
366 if ( tempTodo->isCompleted() ) 371 if ( tempTodo->isCompleted() )
367 paint->drawPixmap ( xx, yyy, completedPxmp ); 372 paint->drawPixmap ( xx, yyy, completedPxmp );
368 else { 373 else {
369 paint->drawPixmap ( xx, yyy, overduePxmp ); 374 paint->drawPixmap ( xx, yyy, overduePxmp );
370 375
371 } 376 }
372 } 377 }
373 bool addIcon = false; 378 bool addIcon = false;
374 if ( ! small || w > 3 * h || h > 3* w ) 379 if ( ! small || w > 3 * h || h > 3* w )
375 addIcon = updateIcons( paint, horLayout ); 380 addIcon = updateIcons( paint, horLayout );
376 381
377 //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 382 //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
378 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); 383 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0);
379 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 384 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
380 if ( ! small ) { 385 if ( ! small ) {
381 x += 3; yy += 3;w -= 6; h-= 5; 386 x += 3; yy += 3;w -= 6; h-= 5;
382 } else { 387 } else {
383 x += 2; yy += 1;w -= 4; h-= 4; 388 x += 2; yy += 1;w -= 4; h-= 4;
384 if ( nfh < 6.01 ) { 389 if ( nfh < 6.01 ) {
385 yy -= 2; 390 yy -= 2;
386 h += 4; 391 h += 4;
387 } 392 }
388 else 393 else
389 if ( nfh < h -2 ) 394 if ( nfh < h -2 )
390 ++yy; 395 ++yy;
391 } 396 }
392 int align; 397 int align;
393#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
394 align = ( AlignLeft|WordBreak|AlignTop); 399 align = ( AlignLeft|WordBreak|AlignTop);
395#else 400#else
396 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 401 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
397#endif 402#endif
398 if ( addIcon ) { 403 if ( addIcon ) {
399 if ( ! horLayout ) { 404 if ( ! horLayout ) {
400 x += AGENDA_ICON_SIZE+3; 405 x += AGENDA_ICON_SIZE+3;
401 w -= (AGENDA_ICON_SIZE+3); 406 w -= (AGENDA_ICON_SIZE+3);
402 } 407 }
403 else { 408 else {
404 yy+= AGENDA_ICON_SIZE+2; 409 yy+= AGENDA_ICON_SIZE+2;
405 h -=(AGENDA_ICON_SIZE+3); 410 h -=(AGENDA_ICON_SIZE+3);
406 } 411 }
407 } 412 }
408 if ( mWhiteText ) 413 if ( mWhiteText )
409 paint->setPen ( white); 414 paint->setPen ( white);
410 if ( x < 0 ) { 415 if ( x < 0 ) {
411 w = w+x-3; 416 w = w+x-3;
412 x = 3; 417 x = 3;
413 if ( w > parentWidget()->width() ){ 418 if ( w > parentWidget()->width() ){
414 w = parentWidget()->width() - 6; 419 w = parentWidget()->width() - 6;
415#ifndef DESKTOP_VERSION 420#ifndef DESKTOP_VERSION
416 align = ( AlignHCenter|WordBreak|AlignTop); 421 align = ( AlignHCenter|WordBreak|AlignTop);
417#else 422#else
418 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); 423 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
419#endif 424#endif
420 425
421 } 426 }
422 } 427 }
423 QRect dr; 428 QRect dr;
424 if ( w + x > parentWidget()->width() ) 429 if ( w + x > parentWidget()->width() )
425 w = parentWidget()->width()-x; 430 w = parentWidget()->width()-x;
426 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 431 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
427 //qDebug("%d %d %d %d ", x, yy, w, h ); 432 //qDebug("%d %d %d %d ", x, yy, w, h );
428 if ( mIncidence->cancelled() ){ 433 if ( mIncidence->cancelled() ){
429 434
430 435
431 small = ( height() < 20 ); 436 small = ( height() < 20 );
432 437
433 if ( ! small ) { 438 if ( ! small ) {
434 QFontMetrics fm ( paint->font() ); 439 QFontMetrics fm ( paint->font() );
435 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 440 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
436 } 441 }
437 442
438 } 443 }
439 pa.end(); 444 pa.end();
440 445
441} 446}
442void KOAgendaItem::resizePixmap( int w , int h ) 447void KOAgendaItem::resizePixmap( int w , int h )
443{ 448{
444 paintPix()->resize( w, h ); 449 paintPix()->resize( w, h );
445 paintPixSel()->resize( w, h ); 450 paintPixSel()->resize( w, h );
446 451
447} 452}
448QPixmap * KOAgendaItem::paintPix() 453QPixmap * KOAgendaItem::paintPix()
449{ 454{
450 static QPixmap* mPaintPix = 0; 455 static QPixmap* mPaintPix = 0;
451 if ( ! mPaintPix ) { 456 if ( ! mPaintPix ) {
452 int w = QApplication::desktop()->width(); 457 int w = QApplication::desktop()->width();
453 int h = QApplication::desktop()->height(); 458 int h = QApplication::desktop()->height();
454 mPaintPix = new QPixmap(w,h); 459 mPaintPix = new QPixmap(w,h);
455 } 460 }
456 return mPaintPix ; 461 return mPaintPix ;
457} 462}
458QPixmap * KOAgendaItem::paintPixAllday() 463QPixmap * KOAgendaItem::paintPixAllday()
459{ 464{
460 static QPixmap* mPaintPixA = 0; 465 static QPixmap* mPaintPixA = 0;
461 if ( ! mPaintPixA ) { 466 if ( ! mPaintPixA ) {
462 int w = QApplication::desktop()->width(); 467 int w = QApplication::desktop()->width();
463 int h = QApplication::desktop()->height()/3; 468 int h = QApplication::desktop()->height()/3;
464 mPaintPixA = new QPixmap(w,h); 469 mPaintPixA = new QPixmap(w,h);
465 } 470 }
466 return mPaintPixA ; 471 return mPaintPixA ;
467} 472}
468QPixmap * KOAgendaItem::paintPixSel() 473QPixmap * KOAgendaItem::paintPixSel()
469{ 474{
470 static QPixmap* mPaintPixSel = 0; 475 static QPixmap* mPaintPixSel = 0;
471 if ( ! mPaintPixSel ) { 476 if ( ! mPaintPixSel ) {
472 int w = QApplication::desktop()->width(); 477 int w = QApplication::desktop()->width();
473 int h = QApplication::desktop()->height(); 478 int h = QApplication::desktop()->height();
474 mPaintPixSel = new QPixmap(w,h); 479 mPaintPixSel = new QPixmap(w,h);
475 } 480 }
476 return mPaintPixSel ; 481 return mPaintPixSel ;
477} 482}
478void KOAgendaItem::paintEvent ( QPaintEvent *e ) 483void KOAgendaItem::paintEvent ( QPaintEvent *e )
479{ 484{
480 485
481 if ( globalFlagBlockAgendaItemPaint ) 486 if ( globalFlagBlockAgendaItemPaint )
482 return; 487 return;
483 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 488 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
484 return; 489 return;
485 int yy; 490 int yy;
486 if ( mAllDay ) 491 if ( mAllDay )
487 yy = y(); 492 yy = y();
488 else 493 else
489 yy = mCellYTop * ( height() / cellHeight() ); 494 yy = mCellYTop * ( height() / cellHeight() );
490 int xx = x(); 495 int xx = x();
491 496
492 if ( xPaintCoord != xx || yPaintCoord != yy || 497 if ( xPaintCoord != xx || yPaintCoord != yy ||
493 wPaintCoord != width() || hPaintCoord != height()) { 498 wPaintCoord != width() || hPaintCoord != height()) {
494 xPaintCoord= xx; 499 xPaintCoord= xx;
495 yPaintCoord = yy; 500 yPaintCoord = yy;
496 wPaintCoord = width(); 501 wPaintCoord = width();
497 hPaintCoord = height(); 502 hPaintCoord = height();
498 globalFlagBlockAgendaItemUpdate = 0; 503 globalFlagBlockAgendaItemUpdate = 0;
499 paintMe( mSelected ); 504 paintMe( mSelected );
500 //qDebug("calling paintMe "); 505 //qDebug("calling paintMe ");
501 globalFlagBlockAgendaItemUpdate = 1; 506 globalFlagBlockAgendaItemUpdate = 1;
502 } 507 }
503 int rx, ry, rw, rh; 508 int rx, ry, rw, rh;
504 rx = e->rect().x(); 509 rx = e->rect().x();
505 ry = e->rect().y(); 510 ry = e->rect().y();
506 rw = e->rect().width(); 511 rw = e->rect().width();
507 rh = e->rect().height(); 512 rh = e->rect().height();
508 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 513 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
509 514
510 QPixmap* paintFrom ; 515 QPixmap* paintFrom ;
511 if ( mSelected ) { 516 if ( mSelected ) {
512 paintFrom = paintPixSel(); 517 paintFrom = paintPixSel();
513 } else { 518 } else {
514 if ( mAllDay ) 519 if ( mAllDay )
515 paintFrom = paintPixAllday(); 520 paintFrom = paintPixAllday();
516 else 521 else
517 paintFrom = paintPix(); 522 paintFrom = paintPix();
518 } 523 }
519 xx += rx; 524 xx += rx;
520 525
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 52bc463..a653c18 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -1,420 +1,420 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qcheckbox.h> 24#include <qcheckbox.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qdialog.h> 29#include <qdialog.h>
30 30
31 31
32#include <libkcal/calfilter.h> 32#include <libkcal/calfilter.h>
33 33
34#include "kofilterview.h" 34#include "kofilterview.h"
35#include "koprefs.h" 35#include "koprefs.h"
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include <kglobal.h> 37#include <kglobal.h>
38#include <kcolorbutton.h> 38#include <kcolorbutton.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40 40
41 41
42#include <kurlrequester.h> 42#include <kurlrequester.h>
43#include <klineedit.h> 43#include <klineedit.h>
44 44
45class KONewCalPrefs : public QDialog 45class KONewCalPrefs : public QDialog
46{ 46{
47 public: 47 public:
48 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : 48 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) :
49 QDialog( parent, name, true ) 49 QDialog( parent, name, true )
50 { 50 {
51 setCaption( i18n("Add new Calendar") ); 51 setCaption( i18n("Add new Calendar") );
52 QVBoxLayout* lay = new QVBoxLayout( this ); 52 QVBoxLayout* lay = new QVBoxLayout( this );
53 lay->setSpacing( 3 ); 53 lay->setSpacing( 3 );
54 lay->setMargin( 3 ); 54 lay->setMargin( 3 );
55 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); 55 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this );
56 lay->addWidget( lab ); 56 lay->addWidget( lab );
57 nameE = new KLineEdit( this ); 57 nameE = new KLineEdit( this );
58 lay->addWidget( nameE ); 58 lay->addWidget( nameE );
59 lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); 59 lab = new QLabel( i18n("Local ical (*.ics) file:"), this );
60 lay->addWidget( lab ); 60 lay->addWidget( lab );
61 url = new KURLRequester ( this ); 61 url = new KURLRequester ( this );
62 lay->addWidget( url ); 62 lay->addWidget( url );
63 QPushButton * ok = new QPushButton( i18n("OK"), this ); 63 QPushButton * ok = new QPushButton( i18n("OK"), this );
64 lay->addWidget( ok ); 64 lay->addWidget( ok );
65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
66 lay->addWidget( cancel ); 66 lay->addWidget( cancel );
67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
69 //resize( 200, 200 ); 69 //resize( 200, 200 );
70 } 70 }
71 71
72 QString calName() { return nameE->text(); } 72 QString calName() { return nameE->text(); }
73 QString calFileName() { return url->url(); } 73 QString calFileName() { return url->url(); }
74private: 74private:
75 KLineEdit* nameE; 75 KLineEdit* nameE;
76 KURLRequester *url; 76 KURLRequester *url;
77}; 77};
78 78
79 79
80KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 80KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
81 const char* name,WFlags fl ) 81 const char* name,WFlags fl )
82 : KOFilterView_base(parent,name,fl) 82 : KOFilterView_base(parent,name,fl)
83{ 83{
84 mFilters = filterList; 84 mFilters = filterList;
85 85
86 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 86 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
87 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 87 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
88 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 88 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
89} 89}
90 90
91KOFilterView::~KOFilterView() 91KOFilterView::~KOFilterView()
92{ 92{
93 // no need to delete child widgets, Qt does it all for us 93 // no need to delete child widgets, Qt does it all for us
94} 94}
95 95
96bool KOFilterView::filtersEnabled() 96bool KOFilterView::filtersEnabled()
97{ 97{
98 return mEnabledCheck->isChecked(); 98 return mEnabledCheck->isChecked();
99} 99}
100 100
101void KOFilterView::setFiltersEnabled(bool set) 101void KOFilterView::setFiltersEnabled(bool set)
102{ 102{
103 mEnabledCheck->setChecked(set); 103 mEnabledCheck->setChecked(set);
104 emit filterChanged(); 104 emit filterChanged();
105} 105}
106 106
107 107
108void KOFilterView::updateFilters() 108void KOFilterView::updateFilters()
109{ 109{
110 mSelectionCombo->clear(); 110 mSelectionCombo->clear();
111 111
112 CalFilter *filter = mFilters->first(); 112 CalFilter *filter = mFilters->first();
113 while(filter) { 113 while(filter) {
114 mSelectionCombo->insertItem(filter->name()); 114 mSelectionCombo->insertItem(filter->name());
115 filter = mFilters->next(); 115 filter = mFilters->next();
116 } 116 }
117} 117}
118 118
119CalFilter *KOFilterView::selectedFilter() 119CalFilter *KOFilterView::selectedFilter()
120{ 120{
121 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 121 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
122 return f; 122 return f;
123} 123}
124 124
125void KOFilterView::setSelectedFilter(QString filterName) 125void KOFilterView::setSelectedFilter(QString filterName)
126{ 126{
127 int filter_num = mSelectionCombo->count(); 127 int filter_num = mSelectionCombo->count();
128 int i; 128 int i;
129 for (i=0;i<filter_num;i++) { 129 for (i=0;i<filter_num;i++) {
130 if (mSelectionCombo->text(i)==filterName) 130 if (mSelectionCombo->text(i)==filterName)
131 mSelectionCombo->setCurrentItem(i); 131 mSelectionCombo->setCurrentItem(i);
132 } 132 }
133 emit filterChanged(); 133 emit filterChanged();
134} 134}
135void KOFilterView::setSelectedFilter( int fil ) 135void KOFilterView::setSelectedFilter( int fil )
136{ 136{
137 if ( fil >= mSelectionCombo->count() ) 137 if ( fil >= mSelectionCombo->count() )
138 return; 138 return;
139 mSelectionCombo->setCurrentItem( fil ); 139 mSelectionCombo->setCurrentItem( fil );
140 emit filterChanged(); 140 emit filterChanged();
141} 141}
142 142
143 143
144 144
145KOCalEditView::KOCalEditView(QWidget* parent, 145KOCalEditView::KOCalEditView(QWidget* parent,
146 const char* name ) 146 const char* name )
147 : QScrollView(parent,name) 147 : QScrollView(parent,name)
148{ 148{
149 mw = 0; 149 mw = 0;
150 setResizePolicy( AutoOneFit ); 150 setResizePolicy( AutoOneFit );
151 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 151 setFrameStyle ( QFrame::Panel | QFrame::Plain );
152 setLineWidth ( 1 ); 152 setLineWidth ( 1 );
153 setMidLineWidth ( 1 ); 153 setMidLineWidth ( 1 );
154} 154}
155 155
156KOCalEditView::~KOCalEditView() 156KOCalEditView::~KOCalEditView()
157{ 157{
158 // no need to delete child widgets, Qt does it all for us 158 // no need to delete child widgets, Qt does it all for us
159} 159}
160void KOCalEditView::selectCal(int id ,bool b) 160void KOCalEditView::selectCal(int id ,bool b)
161{ 161{
162 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 162 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
163 emit calendarEnabled ( id, b ); 163 emit calendarEnabled ( id, b );
164 emit needsUpdate(); 164 emit needsUpdate();
165 165
166} 166}
167void KOCalEditView::selectStdCal( int id, bool b ) 167void KOCalEditView::selectStdCal( int id, bool b )
168{ 168{
169 169
170 if ( !b ) { 170 if ( !b ) {
171 KOCalCheckButton* it = (KOCalCheckButton*) sender(); 171 KOCalCheckButton* it = (KOCalCheckButton*) sender();
172 if ( it ) { 172 if ( it ) {
173 it->blockSignals( true ); 173 it->blockSignals( true );
174 it->setChecked( true ); 174 it->setChecked( true );
175 it->blockSignals( false ); 175 it->blockSignals( false );
176 return; 176 return;
177 } 177 }
178 return; 178 return;
179 } 179 }
180 KOCalCheckButton* sen = (KOCalCheckButton*) sender(); 180 KOCalCheckButton* sen = (KOCalCheckButton*) sender();
181 KOCalCheckButton* it = mStdandardB.first(); 181 KOCalCheckButton* it = mStdandardB.first();
182 while ( it ) { 182 while ( it ) {
183 if ( it->isChecked() ) { 183 if ( it->isChecked() ) {
184 if ( it != sen ) { 184 if ( it != sen ) {
185 it->blockSignals( true ); 185 it->blockSignals( true );
186 it->setChecked( false ); 186 it->setChecked( false );
187 it->blockSignals( false ); 187 it->blockSignals( false );
188 break; 188 break;
189 } 189 }
190 } 190 }
191 it = mStdandardB.next(); 191 it = mStdandardB.next();
192 } 192 }
193 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 193 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
194 while ( kkf ) { 194 while ( kkf ) {
195 kkf->isStandard = false; 195 kkf->isStandard = false;
196 kkf = KOPrefs::instance()->mCalendars.next(); 196 kkf = KOPrefs::instance()->mCalendars.next();
197 } 197 }
198 KOPrefs::instance()->getCalendar( id )->isStandard = true; 198 KOPrefs::instance()->getCalendar( id )->isStandard = true;
199 emit setCalendarDefault ( id ); 199 emit setCalendarDefault ( id );
200} 200}
201 201
202void KOCalEditView::selectCalAlarm(int id ,bool b ) 202void KOCalEditView::selectCalAlarm(int id ,bool b )
203{ 203{
204 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 204 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
205 emit alarmEnabled ( id , b ); 205 emit alarmEnabled ( id , b );
206 emit needsUpdate(); 206 emit needsUpdate();
207} 207}
208void KOCalEditView::selectReadOnly(int id ,bool b ) 208void KOCalEditView::selectReadOnly(int id ,bool b )
209{ 209{
210 KOPrefs::instance()->getCalendar( id )->isReadOnly = b; 210 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
211 emit calendarReadonly ( id , b ); 211 emit calendarReadonly ( id , b );
212 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { 212 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) {
213 KOPrefs::instance()->getCalendar( id )->isStandard = false; 213 KOPrefs::instance()->getCalendar( id )->isStandard = false;
214 KOPrefs::instance()->getCalendar( 1 )->isStandard = true; 214 KOPrefs::instance()->getCalendar( 1 )->isStandard = true;
215 emit setCalendarDefault ( 1 ); 215 emit setCalendarDefault ( 1 );
216 } 216 }
217 emit needsUpdate(); 217 emit needsUpdate();
218 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 218 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
219 219
220} 220}
221void KOCalEditView::setColor( const QColor& c, int id ) 221void KOCalEditView::setColor( const QColor& c, int id )
222{ 222{
223 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 223 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
224 emit needsUpdate(); 224 emit needsUpdate();
225} 225}
226void KOCalEditView::deleteCal( int id ) 226void KOCalEditView::deleteCal( int id )
227{ 227{
228 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 228 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
229 QString name = kkf->mName; 229 QString name = kkf->mName;
230 QString file = kkf->mFileName; 230 QString file = kkf->mFileName;
231 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 231 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
232 if ( kkf->isStandard ) 232 if ( kkf->isStandard )
233 selectStdCal( 1, true ); 233 selectStdCal( 1, true );
234 emit removeCalendar ( id ); 234 emit removeCalendar ( id );
235 KOPrefs::instance()->mCalendars.remove ( kkf ); 235 KOPrefs::instance()->mCalendars.remove ( kkf );
236 emit needsUpdate(); 236 emit needsUpdate();
237 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 237 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
238} 238}
239void KOCalEditView::infoCal( int id ) 239void KOCalEditView::infoCal( int id )
240{ 240{
241 QString name = KOPrefs::instance()->getCalendar( id )->mName; 241 QString name = KOPrefs::instance()->getCalendar( id )->mName;
242 QString file = KOPrefs::instance()->getCalendar( id )->mFileName; 242 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
243 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 243 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
244 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { 244 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) {
245 emit calendarAdded( id ); 245 emit calendarAdded( id );
246 emit needsUpdate(); 246 emit needsUpdate();
247 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 247 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
248 } 248 }
249 } 249 }
250 else 250 else
251 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 251 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
252} 252}
253void KOCalEditView::readConfig() 253void KOCalEditView::readConfig()
254{ 254{
255 255
256 mStdandardB.clear(); 256 mStdandardB.clear();
257 mEnabledB.clear(); 257 mEnabledB.clear();
258 mAlarmB.clear(); 258 mAlarmB.clear();
259 mROB.clear(); 259 mROB.clear();
260 260
261 if ( mw ) delete mw; 261 if ( mw ) delete mw;
262 mw = new QWidget ( viewport() ); 262 mw = new QWidget ( viewport() );
263 addChild(mw); 263 addChild(mw);
264 264
265 mainLayout = new QGridLayout ( mw , 2, 8 ); 265 mainLayout = new QGridLayout ( mw , 2, 8 );
266 mainLayout->setMargin( 3); 266 mainLayout->setMargin( 3);
267 mainLayout->setSpacing( 2); 267 mainLayout->setSpacing( 2);
268 QPushButton * addBut = new QPushButton ( mw ); 268 QPushButton * addBut = new QPushButton ( mw );
269 mainLayout->addWidget( addBut,0,0 ); 269 mainLayout->addWidget( addBut,0,0 );
270 addBut->setPixmap ( SmallIcon("plus")); 270 addBut->setPixmap ( SmallIcon("plus"));
271 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 271 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
272 addBut->setMaximumWidth( addBut->sizeHint().height() ); 272 addBut->setMaximumWidth( addBut->sizeHint().height() );
273 273
274 addBut = new QPushButton ( mw ); 274 addBut = new QPushButton ( mw );
275 mainLayout->addWidget( addBut,0,1 ); 275 mainLayout->addWidget( addBut,0,1 );
276 addBut->setPixmap ( SmallIcon("eye")); 276 addBut->setPixmap ( SmallIcon("eye"));
277 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 277 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
278 addBut->setMaximumWidth( addBut->sizeHint().height() ); 278 addBut->setMaximumWidth( addBut->sizeHint().height() );
279 279
280 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 280 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
281 mainLayout->addWidget( lab,0,2 ); 281 mainLayout->addWidget( lab,0,2 );
282 lab = new QLabel ( i18n(" "), mw ); 282 lab = new QLabel ( i18n(" "), mw );
283 mainLayout->addWidget( lab,0,3 ); 283 mainLayout->addWidget( lab,0,3 );
284 lab->setFixedWidth( 6 ); 284 lab->setFixedWidth( 6 );
285 addBut = new QPushButton ( mw ); 285 addBut = new QPushButton ( mw );
286 mainLayout->addWidget( addBut,0,4 ); 286 mainLayout->addWidget( addBut,0,4 );
287 addBut->setPixmap ( SmallIcon("bell")); 287 addBut->setPixmap ( SmallIcon("bell"));
288 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 288 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
289 addBut->setMaximumWidth( addBut->sizeHint().height() ); 289 addBut->setMaximumWidth( addBut->sizeHint().height() );
290 290
291 addBut = new QPushButton ( mw ); 291 addBut = new QPushButton ( mw );
292 mainLayout->addWidget( addBut,0,5 ); 292 mainLayout->addWidget( addBut,0,5 );
293 addBut->setPixmap ( SmallIcon("pencil")); 293 addBut->setPixmap ( SmallIcon("pencil"));
294 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 294 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
295 addBut->setMaximumWidth( addBut->sizeHint().height() ); 295 addBut->setMaximumWidth( addBut->sizeHint().height() );
296 296
297 lab = new QLabel ( i18n(" Color "), mw ); 297 lab = new QLabel ( i18n(" Color "), mw );
298 mainLayout->addWidget( lab,0,6 ); 298 mainLayout->addWidget( lab,0,6 );
299#if 0 299#if 0
300 addBut = new QPushButton ( mw ); 300 addBut = new QPushButton ( mw );
301 mainLayout->addWidget( addBut,0,6 ); 301 mainLayout->addWidget( addBut,0,6 );
302 addBut->setPixmap ( SmallIcon("minus")); 302 addBut->setPixmap ( SmallIcon("minus"));
303 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); 303 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
304 addBut->setMaximumWidth( addBut->sizeHint().height() ); 304 addBut->setMaximumWidth( addBut->sizeHint().height() );
305#endif 305#endif
306 306
307 307
308 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 308 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
309 int row = 1; 309 int row = 1;
310 while ( kkf ) { 310 while ( kkf ) {
311 int iii = 0; 311 int iii = 0;
312 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 312 KOCalCheckButton* cb = new KOCalCheckButton( mw );
313 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); 313 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
314 cb->setChecked( kkf->isStandard ); 314 cb->setChecked( kkf->isStandard );
315 cb->setNum( kkf->mCalNumber ); 315 cb->setNum( kkf->mCalNumber );
316 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); 316 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
317 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 317 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
318 cb->setEnabled( false ); 318 cb->setEnabled( false );
319 cb = new KOCalCheckButton( mw ); 319 cb = new KOCalCheckButton( mw );
320 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); 320 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
321 cb->setChecked( kkf->isEnabled ); 321 cb->setChecked( kkf->isEnabled );
322 cb->setNum( kkf->mCalNumber ); 322 cb->setNum( kkf->mCalNumber );
323 if ( kkf->mErrorOnLoad ) 323 if ( kkf->mErrorOnLoad )
324 cb->setEnabled( false ); 324 cb->setEnabled( false );
325 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 325 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
326 KOCalButton* name = new KOCalButton( mw ); 326 KOCalButton* name = new KOCalButton( mw );
327 name->setNum( kkf->mCalNumber ); 327 name->setNum( kkf->mCalNumber );
328 name->setText( kkf->mName ); 328 name->setText( kkf->mName );
329 mainLayout->addWidget( name,row,++iii ); 329 mainLayout->addWidget( name,row,++iii );
330 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 330 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
331 lab = new QLabel ( i18n(" "), mw ); 331 lab = new QLabel ( i18n(" "), mw );
332 mainLayout->addWidget( lab,row,++iii ); 332 mainLayout->addWidget( lab,row,++iii );
333 cb = new KOCalCheckButton( mw ); 333 cb = new KOCalCheckButton( mw );
334 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); 334 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
335 cb->setChecked( kkf->isAlarmEnabled ); 335 cb->setChecked( kkf->isAlarmEnabled );
336 cb->setNum( kkf->mCalNumber ); 336 cb->setNum( kkf->mCalNumber );
337 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 337 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
338 if ( kkf->mErrorOnLoad ) 338 if ( kkf->mErrorOnLoad )
339 cb->setEnabled( false ); 339 cb->setEnabled( false );
340 cb = new KOCalCheckButton( mw ); 340 cb = new KOCalCheckButton( mw );
341 mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); 341 mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
342 cb->setChecked( kkf->isReadOnly ); 342 cb->setChecked( kkf->isReadOnly );
343 cb->setNum( kkf->mCalNumber ); 343 cb->setNum( kkf->mCalNumber );
344 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 344 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
345 if ( kkf->mErrorOnLoad ) 345 if ( kkf->mErrorOnLoad )
346 cb->setEnabled( false ); 346 cb->setEnabled( false );
347 KColorButton *colb = new KColorButton( mw );
348 mainLayout->addWidget( colb,row,++iii );
349 colb->setID( kkf->mCalNumber );
350 colb->setColor( kkf->mDefaultColor );
351 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
352 if ( row > 1) { 347 if ( row > 1) {
348 KColorButton *colb = new KColorButton( mw );
349 mainLayout->addWidget( colb,row,++iii );
350 colb->setID( kkf->mCalNumber );
351 colb->setColor( kkf->mDefaultColor );
352 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
353 KOCalButton* calb = new KOCalButton( mw ); 353 KOCalButton* calb = new KOCalButton( mw );
354 mainLayout->addWidget( calb,row,++iii ); 354 mainLayout->addWidget( calb,row,++iii );
355 calb->setNum( kkf->mCalNumber ); 355 calb->setNum( kkf->mCalNumber );
356 calb->setPixmap ( SmallIcon("minus")); 356 calb->setPixmap ( SmallIcon("minus"));
357 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); 357 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
358 int hei = calb->sizeHint().height(); 358 int hei = calb->sizeHint().height();
359 //calb->setMaximumSize( hei*9/10, hei*9/10 ); 359 //calb->setMaximumSize( hei*9/10, hei*9/10 );
360 } 360 }
361 ++row; 361 ++row;
362 kkf = KOPrefs::instance()->mCalendars.next(); 362 kkf = KOPrefs::instance()->mCalendars.next();
363 } 363 }
364 lab = new QLabel ( "", mw ); 364 lab = new QLabel ( "", mw );
365 mainLayout->addWidget( lab,row,0 ); 365 mainLayout->addWidget( lab,row,0 );
366 mw->show(); 366 mw->show();
367 367
368} 368}
369void KOCalEditView::addCal() 369void KOCalEditView::addCal()
370{ 370{
371 KONewCalPrefs prefs ( this ); 371 KONewCalPrefs prefs ( this );
372 if ( ! prefs.exec() ) 372 if ( ! prefs.exec() )
373 return; 373 return;
374 QString name = prefs.calName(); 374 QString name = prefs.calName();
375 QString file = prefs.calFileName(); 375 QString file = prefs.calFileName();
376 QFileInfo fi ( file ); 376 QFileInfo fi ( file );
377 if (!fi.exists() ) { 377 if (!fi.exists() ) {
378 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); 378 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!"));
379 return; 379 return;
380 } 380 }
381 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 381 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
382 kkf->mName = name; 382 kkf->mName = name;
383 kkf->mFileName = file; 383 kkf->mFileName = file;
384 emit calendarAdded( kkf->mCalNumber ); 384 emit calendarAdded( kkf->mCalNumber );
385 emit needsUpdate(); 385 emit needsUpdate();
386 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 386 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
387} 387}
388void KOCalEditView::enableAll() 388void KOCalEditView::enableAll()
389{ 389{
390 toggleList( mEnabledB ); 390 toggleList( mEnabledB );
391} 391}
392void KOCalEditView::enableAlarm() 392void KOCalEditView::enableAlarm()
393{ 393{
394 toggleList( mAlarmB ); 394 toggleList( mAlarmB );
395} 395}
396void KOCalEditView::disableRO() 396void KOCalEditView::disableRO()
397{ 397{
398 toggleList( mROB ); 398 toggleList( mROB );
399} 399}
400void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) 400void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
401{ 401{
402 bool dis = false; 402 bool dis = false;
403 KOCalCheckButton* it = list.first(); 403 KOCalCheckButton* it = list.first();
404 while ( it ) { 404 while ( it ) {
405 if ( !it->isChecked() ) { 405 if ( !it->isChecked() ) {
406 dis = true; 406 dis = true;
407 break; 407 break;
408 } 408 }
409 it = list.next(); 409 it = list.next();
410 } 410 }
411 it = list.first(); 411 it = list.first();
412 while ( it ) { 412 while ( it ) {
413 it->setChecked(dis); 413 it->setChecked(dis);
414 it = list.next(); 414 it = list.next();
415 } 415 }
416} 416}
417void KOCalEditView::deleteAll() 417void KOCalEditView::deleteAll()
418{ 418{
419 qDebug("delteAll"); 419 qDebug("delteAll");
420} 420}
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 96f2502..2150654 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -349,857 +349,861 @@ void MonthViewItem::paint(QPainter *p)
349 x += size + 1; 349 x += size + 1;
350 } 350 }
351 } 351 }
352 if ( mMultiday ) { 352 if ( mMultiday ) {
353 int yyy = y+(size/2); 353 int yyy = y+(size/2);
354 int sizeM = size+2; 354 int sizeM = size+2;
355 p->setBrush( QBrush::SolidPattern ); 355 p->setBrush( QBrush::SolidPattern );
356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 356 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
357 if ( mMultiday == 2 || mMultiday == 3 ) { 357 if ( mMultiday == 2 || mMultiday == 3 ) {
358 QPointArray pa ( 3 ); 358 QPointArray pa ( 3 );
359 pa.setPoint (0, x, yyy ); 359 pa.setPoint (0, x, yyy );
360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 360 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 361 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
362 p->drawPolygon( pa ); 362 p->drawPolygon( pa );
363 } 363 }
364 if ( mMultiday == 2 || mMultiday == 1 ) { 364 if ( mMultiday == 2 || mMultiday == 1 ) {
365 QPointArray pa ( 3 ); 365 QPointArray pa ( 3 );
366 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 366 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 367 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 368 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
369 p->drawPolygon( pa ); 369 p->drawPolygon( pa );
370 } 370 }
371 if ( mMultiday == 1 ) { 371 if ( mMultiday == 1 ) {
372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 372 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
373 373
374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 374 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
375 } 375 }
376 if ( mMultiday == 3 ) { 376 if ( mMultiday == 3 ) {
377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 377 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 378 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
379 379
380 } 380 }
381 x += sizeM/2 + 1; 381 x += sizeM/2 + 1;
382 x += sizeM + 1; 382 x += sizeM + 1;
383 } 383 }
384 384
385 if ( mIncidence->typeID() == todoID ){ 385 if ( mIncidence->typeID() == todoID ){
386 Todo* td = ( Todo* ) mIncidence; 386 Todo* td = ( Todo* ) mIncidence;
387 if ( td->isCompleted() ) { 387 if ( td->isCompleted() ) {
388 int half = size/2; 388 int half = size/2;
389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 389 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 390 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
391 x += half+half + 4; 391 x += half+half + 4;
392 392
393 } else { 393 } else {
394 int val = td->percentComplete()/20; 394 int val = td->percentComplete()/20;
395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); 395 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
396 p->drawRect ( x, y-2,7,size+4); 396 p->drawRect ( x, y-2,7,size+4);
397 x += size + 3; 397 x += size + 3;
398 } 398 }
399 } 399 }
400 QFontMetrics fm = p->fontMetrics(); 400 QFontMetrics fm = p->fontMetrics();
401 int yPos; 401 int yPos;
402 int pmheight = size; 402 int pmheight = size;
403 if( pmheight < fm.height() ) 403 if( pmheight < fm.height() )
404 yPos = fm.ascent() + fm.leading()/2; 404 yPos = fm.ascent() + fm.leading()/2;
405 else 405 else
406 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 406 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
407 p->setPen( palette().color( QPalette::Normal, sel ? \ 407 p->setPen( palette().color( QPalette::Normal, sel ? \
408 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 408 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
409 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { 409 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
410 p->drawText( x, yPos, text() ); 410 p->drawText( x, yPos, text() );
411 if ( mIncidence->cancelled() ) { 411 if ( mIncidence->cancelled() ) {
412 int wid = fm.width( text() ); 412 int wid = fm.width( text() );
413 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 413 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
414 } 414 }
415 } else { 415 } else {
416 QString pText = text(); 416 QString pText = text();
417 if( pText.mid(2,1) == ":" ) 417 if( pText.mid(2,1) == ":" )
418 pText = pText.mid( 6 ); 418 pText = pText.mid( 6 );
419 p->drawText( x, yPos, pText ); 419 p->drawText( x, yPos, pText );
420 if ( mIncidence->cancelled() ) { 420 if ( mIncidence->cancelled() ) {
421 int wid = fm.width( pText ); 421 int wid = fm.width( pText );
422 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 422 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
423 } 423 }
424 } 424 }
425} 425}
426 426
427int MonthViewItem::height(const QListBox *lb) const 427int MonthViewItem::height(const QListBox *lb) const
428{ 428{
429 int ret = 10; 429 int ret = 10;
430 if ( lb ) 430 if ( lb )
431 ret = lb->fontMetrics().lineSpacing()+1; 431 ret = lb->fontMetrics().lineSpacing()+1;
432 return ret; 432 return ret;
433} 433}
434 434
435int MonthViewItem::width(const QListBox *lb) const 435int MonthViewItem::width(const QListBox *lb) const
436{ 436{
437 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { 437 if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) {
438 int size = PIXMAP_SIZE; 438 int size = PIXMAP_SIZE;
439 if ( QApplication::desktop()->width() < 300 ) 439 if ( QApplication::desktop()->width() < 300 )
440 size = 3; 440 size = 3;
441 int x = 1; 441 int x = 1;
442 if ( KOPrefs::instance()->mMonthShowIcons ) { 442 if ( KOPrefs::instance()->mMonthShowIcons ) {
443 if ( mInfo ) { 443 if ( mInfo ) {
444 x += size + 1; 444 x += size + 1;
445 } 445 }
446 if( mRecur ) { 446 if( mRecur ) {
447 x += size+1; 447 x += size+1;
448 } 448 }
449 if( mAlarm ) { 449 if( mAlarm ) {
450 x += size+1; 450 x += size+1;
451 } 451 }
452 if( mReply ) { 452 if( mReply ) {
453 x += size+1; 453 x += size+1;
454 } 454 }
455 } 455 }
456 if( mMultiday ) { 456 if( mMultiday ) {
457 x += size+1+2+size/2; 457 x += size+1+2+size/2;
458 } 458 }
459 return( x + lb->fontMetrics().width( text() ) + 1 ); 459 return( x + lb->fontMetrics().width( text() ) + 1 );
460 } 460 }
461 if ( ! lb ) 461 if ( ! lb )
462 return 10; 462 return 10;
463 return lb->width(); 463 return lb->width();
464} 464}
465 465
466 466
467MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 467MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
468 : KNoScrollListBox( par ), 468 : KNoScrollListBox( par ),
469 mMonthView( parent ) 469 mMonthView( parent )
470{ 470{
471 //QVBoxLayout *topLayout = new QVBoxLayout( this ); 471 //QVBoxLayout *topLayout = new QVBoxLayout( this );
472 currentPalette = 0; 472 currentPalette = 0;
473 // mLabel = new QLabel( this );QPushButton 473 // mLabel = new QLabel( this );QPushButton
474 mLabel = new QPushButton( this ); 474 mLabel = new QPushButton( this );
475 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 475 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
476 //mLabel->setLineWidth( 1 ); 476 //mLabel->setLineWidth( 1 );
477 //mLabel->setAlignment( AlignCenter ); 477 //mLabel->setAlignment( AlignCenter );
478 mLabel->setFlat( true ); 478 mLabel->setFlat( true );
479 mLabel->setFocusPolicy(NoFocus); 479 mLabel->setFocusPolicy(NoFocus);
480 //mItemList = new KNoScrollListBox( this ); 480 //mItemList = new KNoScrollListBox( this );
481 setMinimumSize( 10, 10 ); 481 setMinimumSize( 10, 10 );
482 setFrameStyle( QFrame::Panel | QFrame::Plain ); 482 setFrameStyle( QFrame::Panel | QFrame::Plain );
483 setLineWidth( 1 ); 483 setLineWidth( 1 );
484 //topLayout->addWidget( mItemList ); 484 //topLayout->addWidget( mItemList );
485 mLabel->raise(); 485 mLabel->raise();
486 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 486 // QColor( 0,0,255 ) QColor( 160,1600,255 )
487 mStandardPalette = palette(); 487 mStandardPalette = palette();
488 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 488 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
489 489
490 enableScrollBars( false ); 490 enableScrollBars( false );
491 updateConfig(); 491 updateConfig();
492 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 492 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
493 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 493 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
494 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), 494 connect( this , SIGNAL( doubleClicked( QListBoxItem *) ),
495 SLOT( defaultAction( QListBoxItem * ) ) ); 495 SLOT( defaultAction( QListBoxItem * ) ) );
496 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, 496 connect( this, SIGNAL( rightButtonPressed( QListBoxItem *,
497 const QPoint &) ), 497 const QPoint &) ),
498 SLOT( contextMenu( QListBoxItem * ) ) ); 498 SLOT( contextMenu( QListBoxItem * ) ) );
499 connect( this, SIGNAL( highlighted( QListBoxItem *) ), 499 connect( this, SIGNAL( highlighted( QListBoxItem *) ),
500 SLOT( selection( QListBoxItem * ) ) ); 500 SLOT( selection( QListBoxItem * ) ) );
501 501
502 /* 502 /*
503 connect( this, SIGNAL( clicked( QListBoxItem * ) ), 503 connect( this, SIGNAL( clicked( QListBoxItem * ) ),
504 SLOT( selection( QListBoxItem * ) ) ); 504 SLOT( selection( QListBoxItem * ) ) );
505 */ 505 */
506} 506}
507#ifdef DESKTOP_VERSION 507#ifdef DESKTOP_VERSION
508QToolTipGroup *MonthViewCell::toolTipGroup() 508QToolTipGroup *MonthViewCell::toolTipGroup()
509{ 509{
510 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 510 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
511 return mToolTipGroup; 511 return mToolTipGroup;
512} 512}
513#endif 513#endif
514 514
515void MonthViewCell::setDate( const QDate &date ) 515void MonthViewCell::setDate( const QDate &date )
516{ 516{
517 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 517 // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
518 mDate = date; 518 mDate = date;
519 519
520 520
521 521
522 //resizeEvent( 0 ); 522 //resizeEvent( 0 );
523} 523}
524 524
525QDate MonthViewCell::date() const 525QDate MonthViewCell::date() const
526{ 526{
527 return mDate; 527 return mDate;
528} 528}
529 529
530void MonthViewCell::setPrimary( bool primary ) 530void MonthViewCell::setPrimary( bool primary )
531{ 531{
532 mPrimary = primary; 532 mPrimary = primary;
533 //setMyPalette(); 533 //setMyPalette();
534} 534}
535void MonthViewCell::setMyPalette() 535void MonthViewCell::setMyPalette()
536{ 536{
537 537
538 if ( mHoliday) { 538 if ( mHoliday) {
539 if ( currentPalette == 1 ) return; 539 if ( currentPalette == 1 ) return;
540 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); 540 mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) ));
541 setPalette( mHolidayPalette ); 541 setPalette( mHolidayPalette );
542 //mLabel->setPalette( mHolidayPalette ); 542 //mLabel->setPalette( mHolidayPalette );
543 currentPalette = 1; 543 currentPalette = 1;
544 544
545 } else { 545 } else {
546 if ( mPrimary ) { 546 if ( mPrimary ) {
547 if ( currentPalette == 2 ) return; 547 if ( currentPalette == 2 ) return;
548 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 548 mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
549 //mLabel->setPalette( mPrimaryPalette ); 549 //mLabel->setPalette( mPrimaryPalette );
550 setPalette( mPrimaryPalette ); 550 setPalette( mPrimaryPalette );
551 currentPalette = 2; 551 currentPalette = 2;
552 552
553 } else { 553 } else {
554 if ( currentPalette == 3 ) return; 554 if ( currentPalette == 3 ) return;
555 setPalette( mNonPrimaryPalette ); 555 setPalette( mNonPrimaryPalette );
556 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); 556 mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) ));
557 //mLabel->setPalette( mNonPrimaryPalette );; 557 //mLabel->setPalette( mNonPrimaryPalette );;
558 currentPalette = 3; 558 currentPalette = 3;
559 } 559 }
560 } 560 }
561 //QPalette pal = palette(); 561 //QPalette pal = palette();
562 562
563 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); 563 //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) ));
564} 564}
565QPalette MonthViewCell::getPalette () 565QPalette MonthViewCell::getPalette ()
566{ 566{
567 if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) 567 if ( !KOPrefs::instance()->mMonthViewUsesDayColors )
568 return mStandardPalette; 568 return mStandardPalette;
569 if ( mHoliday) { 569 if ( mHoliday) {
570 return mHolidayPalette ; 570 return mHolidayPalette ;
571 } else { 571 } else {
572 if ( mPrimary ) { 572 if ( mPrimary ) {
573 return mPrimaryPalette ; 573 return mPrimaryPalette ;
574 } 574 }
575 } 575 }
576 return mNonPrimaryPalette; 576 return mNonPrimaryPalette;
577} 577}
578bool MonthViewCell::isPrimary() const 578bool MonthViewCell::isPrimary() const
579{ 579{
580 return mPrimary; 580 return mPrimary;
581} 581}
582 582
583void MonthViewCell::setHoliday( bool holiday ) 583void MonthViewCell::setHoliday( bool holiday )
584{ 584{
585 mHoliday = holiday; 585 mHoliday = holiday;
586 //setMyPalette(); 586 //setMyPalette();
587} 587}
588 588
589void MonthViewCell::setHoliday( const QString &holiday ) 589void MonthViewCell::setHoliday( const QString &holiday )
590{ 590{
591 mHolidayString = holiday; 591 mHolidayString = holiday;
592 592
593 if ( !holiday.isEmpty() ) { 593 if ( !holiday.isEmpty() ) {
594 setHoliday( true ); 594 setHoliday( true );
595 } 595 }
596} 596}
597 597
598void MonthViewCell::startUpdateCell() 598void MonthViewCell::startUpdateCell()
599{ 599{
600 mdayCount = 0; 600 mdayCount = 0;
601 setFocusPolicy(NoFocus); 601 setFocusPolicy(NoFocus);
602 if ( !mMonthView->isUpdatePossible() ) 602 if ( !mMonthView->isUpdatePossible() )
603 return; 603 return;
604 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 604 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
605 while ( mitem ) { 605 while ( mitem ) {
606 mitem->setBlockRepaint( true ); 606 mitem->setBlockRepaint( true );
607 mitem = (MonthViewItem *)mitem->next(); 607 mitem = (MonthViewItem *)mitem->next();
608 } 608 }
609 if ( mAvailItemList.count() > 20 ) { 609 if ( mAvailItemList.count() > 20 ) {
610 mAvailItemList.setAutoDelete( true ); 610 mAvailItemList.setAutoDelete( true );
611 mAvailItemList.clear(); 611 mAvailItemList.clear();
612 mAvailItemList.setAutoDelete( false ); 612 mAvailItemList.setAutoDelete( false );
613 } 613 }
614 614
615 setPrimary( mDate.month()%2 ); 615 setPrimary( mDate.month()%2 );
616 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 616 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
617 if ( mDate == QDate::currentDate() ) { 617 if ( mDate == QDate::currentDate() ) {
618 setLineWidth( 3 ); 618 setLineWidth( 3 );
619 } else { 619 } else {
620 setLineWidth( 1 ); 620 setLineWidth( 1 );
621 } 621 }
622 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); 622 MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
623 //clear(); 623 //clear();
624 while ( CurrentAvailItem ) { 624 while ( CurrentAvailItem ) {
625 MonthViewItem *item = CurrentAvailItem; 625 MonthViewItem *item = CurrentAvailItem;
626 CurrentAvailItem = (MonthViewItem *)item->next(); 626 CurrentAvailItem = (MonthViewItem *)item->next();
627 mAvailItemList.append( item ); 627 mAvailItemList.append( item );
628 takeItem ( item ); 628 takeItem ( item );
629 } 629 }
630 630
631#ifdef DESKTOP_VERSION 631#ifdef DESKTOP_VERSION
632 QToolTip::remove(this); 632 QToolTip::remove(this);
633#endif 633#endif
634 mToolTip.clear(); 634 mToolTip.clear();
635 //qApp->processEvents(); 635 //qApp->processEvents();
636#if 0 636#if 0
637 if ( !mHolidayString.isEmpty() ) { 637 if ( !mHolidayString.isEmpty() ) {
638 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 638 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
639 item->setPalette( mHolidayPalette ); 639 item->setPalette( mHolidayPalette );
640 insertItem( item ); 640 insertItem( item );
641 mToolTip.append ( mHolidayString ); 641 mToolTip.append ( mHolidayString );
642 } 642 }
643#endif 643#endif
644} 644}
645 645
646int MonthViewCell::insertEvent(Event *event) 646int MonthViewCell::insertEvent(Event *event)
647{ 647{
648 bool useToolTips = true; 648 bool useToolTips = true;
649#ifndef DESKTOP_VERSION 649#ifndef DESKTOP_VERSION
650 useToolTips = false; 650 useToolTips = false;
651#endif 651#endif
652 QString mToolTipText; 652 QString mToolTipText;
653 setFocusPolicy(WheelFocus); 653 setFocusPolicy(WheelFocus);
654 if ( !(event->doesRecur() == Recurrence::rNone) ) { 654 if ( !(event->doesRecur() == Recurrence::rNone) ) {
655 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 655 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
656 return mdayCount; 656 return mdayCount;
657 else 657 else
658 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 658 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
659 return mdayCount; 659 return mdayCount;
660 } 660 }
661 661
662 if ( event->isHoliday()) { 662 if ( event->isHoliday()) {
663 setHoliday( true ); 663 setHoliday( true );
664 if ( mDate.dayOfWeek() == 7 ) 664 if ( mDate.dayOfWeek() == 7 )
665 setLineWidth( 3 ); 665 setLineWidth( 3 );
666 } 666 }
667 QString text; 667 QString text;
668 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 668 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
669 if (event->isMultiDay()) { 669 if (event->isMultiDay()) {
670 QString prefix = "<->";multiday = 2; 670 QString prefix = "<->";multiday = 2;
671 QString time; 671 QString time;
672 if ( event->doesRecur() ) { 672 if ( event->doesRecur() ) {
673 if ( event->recursOn( mDate) ) { 673 if ( event->recursOn( mDate) ) {
674 prefix ="->" ;multiday = 1; 674 prefix ="->" ;multiday = 1;
675 } 675 }
676 else { 676 else {
677 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 677 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
678 if ( event->recursOn( mDate.addDays( -days)) ) { 678 if ( event->recursOn( mDate.addDays( -days)) ) {
679 prefix ="<-" ;multiday = 3; 679 prefix ="<-" ;multiday = 3;
680 } 680 }
681 } 681 }
682 682
683 } else { 683 } else {
684 if (mDate == event->dtStart().date()) { 684 if (mDate == event->dtStart().date()) {
685 prefix ="->" ;multiday = 1; 685 prefix ="->" ;multiday = 1;
686 } else if (mDate == event->dtEnd().date()) { 686 } else if (mDate == event->dtEnd().date()) {
687 prefix ="<-" ;multiday = 3; 687 prefix ="<-" ;multiday = 3;
688 } 688 }
689 } 689 }
690 if ( !event->doesFloat() ) { 690 if ( !event->doesFloat() ) {
691 if ( mDate == event->dtStart().date () ) 691 if ( mDate == event->dtStart().date () )
692 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 692 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
693 else if ( mDate == event->dtEnd().date () ) 693 else if ( mDate == event->dtEnd().date () )
694 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 694 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
695 695
696 } 696 }
697 text = time + event->summary(); 697 text = time + event->summary();
698 if ( useToolTips ) 698 if ( useToolTips )
699 mToolTipText += prefix + text; 699 mToolTipText += prefix + text;
700 } else { 700 } else {
701 if (event->doesFloat()) { 701 if (event->doesFloat()) {
702 text = event->summary(); 702 text = event->summary();
703 if ( useToolTips ) 703 if ( useToolTips )
704 mToolTipText += text; 704 mToolTipText += text;
705 } 705 }
706 else { 706 else {
707 text = KGlobal::locale()->formatTime(event->dtStart().time()); 707 text = KGlobal::locale()->formatTime(event->dtStart().time());
708 text += " " + event->summary(); 708 text += " " + event->summary();
709 if ( useToolTips ) 709 if ( useToolTips )
710 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 710 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
711 } 711 }
712 } 712 }
713 if ( useToolTips && ! event->location().isEmpty() ) { 713 if ( useToolTips && ! event->location().isEmpty() ) {
714 mToolTipText += " (" + event->location() +")"; 714 mToolTipText += " (" + event->location() +")";
715 } 715 }
716 MonthViewItem *item ; 716 MonthViewItem *item ;
717 717
718 if ( mAvailItemList.count() ) { 718 if ( mAvailItemList.count() ) {
719 item = mAvailItemList.first(); 719 item = mAvailItemList.first();
720 mAvailItemList.remove( item ); 720 mAvailItemList.remove( item );
721 item->recycle( event, mDate, text ); 721 item->recycle( event, mDate, text );
722 } else { 722 } else {
723 item = new MonthViewItem( event, mDate, text ); 723 item = new MonthViewItem( event, mDate, text );
724 } 724 }
725 725
726 QPalette pal; 726 QPalette pal;
727 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 727 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
728 QStringList categories = event->categories(); 728 QStringList categories = event->categories();
729 QString cat = categories.first(); 729 QString cat = categories.first();
730 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 730 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
731 pal = getPalette(); 731 pal = getPalette();
732 if (cat.isEmpty()) { 732 if (cat.isEmpty()) {
733 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 733 //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
734 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() ));
734 } else { 735 } else {
735 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 736 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
736 } 737 }
737 738
738 } else { 739 } else {
739 if (cat.isEmpty()) { 740 if (cat.isEmpty()) {
740 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 741 //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
742 pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() ));
741 } else { 743 } else {
742 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 744 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
743 } 745 }
744 } 746 }
745 747
746 } else { 748 } else {
747 pal = mStandardPalette ; 749 pal = mStandardPalette ;
748 } 750 }
749 item->setPalette( pal ); 751 item->setPalette( pal );
750 item->setRecur( event->recurrence()->doesRecur() ); 752 item->setRecur( event->recurrence()->doesRecur() );
751 item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); 753 item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
752 item->setMoreInfo( event->description().length() > 0 ); 754 item->setMoreInfo( event->description().length() > 0 );
753#ifdef DESKTOP_VERSION 755#ifdef DESKTOP_VERSION
754 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 756 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
755 KOPrefs::instance()->email()); 757 KOPrefs::instance()->email());
756 if ( me != 0 ) { 758 if ( me != 0 ) {
757 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 759 if ( me->status() == Attendee::NeedsAction && me->RSVP())
758 item->setReply(true && multiday < 2); 760 item->setReply(true && multiday < 2);
759 else 761 else
760 item->setReply(false); 762 item->setReply(false);
761 } else 763 } else
762 item->setReply(false); 764 item->setReply(false);
763#endif 765#endif
764 item->setMultiDay( multiday ); 766 item->setMultiDay( multiday );
765 if ( multiday ) { 767 if ( multiday ) {
766 insertItem( item ,mdayCount); 768 insertItem( item ,mdayCount);
767 ++mdayCount; 769 ++mdayCount;
768 } else { 770 } else {
769 uint i; 771 uint i;
770 int pos = mdayCount; 772 int pos = mdayCount;
771 for ( i = mdayCount; i < count();++i ) { 773 for ( i = mdayCount; i < count();++i ) {
772 QListBoxItem* it = this->item ( i ); 774 QListBoxItem* it = this->item ( i );
773 if ( it && text < it->text() ) { 775 if ( it && text < it->text() ) {
774 pos = i; 776 pos = i;
775 break; 777 break;
776 } 778 }
777 ++pos; 779 ++pos;
778 } 780 }
779 insertItem( item ,pos); 781 insertItem( item ,pos);
780 } 782 }
781 if ( useToolTips ) { 783 if ( useToolTips ) {
782 mToolTip.append( mToolTipText ); 784 mToolTip.append( mToolTipText );
783 } 785 }
784 return mdayCount; 786 return mdayCount;
785} 787}
786void MonthViewCell::insertTodo(Todo *todo) 788void MonthViewCell::insertTodo(Todo *todo)
787{ 789{
788 setFocusPolicy(WheelFocus); 790 setFocusPolicy(WheelFocus);
789 QString text; 791 QString text;
790 if (todo->hasDueDate()) { 792 if (todo->hasDueDate()) {
791 if (!todo->doesFloat()) { 793 if (!todo->doesFloat()) {
792 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 794 text += KGlobal::locale()->formatTime(todo->dtDue().time());
793 text += " "; 795 text += " ";
794 } 796 }
795 } 797 }
796 text += todo->summary(); 798 text += todo->summary();
797 MonthViewItem *item ; 799 MonthViewItem *item ;
798 if ( mAvailItemList.count() ) { 800 if ( mAvailItemList.count() ) {
799 item = mAvailItemList.first(); 801 item = mAvailItemList.first();
800 mAvailItemList.remove( item ); 802 mAvailItemList.remove( item );
801 item->recycle( todo, mDate, text ); 803 item->recycle( todo, mDate, text );
802 } else { 804 } else {
803 item = new MonthViewItem( todo, mDate, text ); 805 item = new MonthViewItem( todo, mDate, text );
804 } 806 }
805 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 807 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
806 //item->setPalette( mStandardPalette ); 808 //item->setPalette( mStandardPalette );
807 QPalette pal; 809 QPalette pal;
808 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 810 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
809 QStringList categories = todo->categories(); 811 QStringList categories = todo->categories();
810 QString cat = categories.first(); 812 QString cat = categories.first();
811 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 813 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
812 pal = getPalette(); 814 pal = getPalette();
813 if (cat.isEmpty()) { 815 if (cat.isEmpty()) {
814 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 816 //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
817 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() ));
815 } else { 818 } else {
816 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 819 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
817 } 820 }
818 821
819 } else { 822 } else {
820 if (cat.isEmpty()) { 823 if (cat.isEmpty()) {
821 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 824 //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
825 pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() ));
822 } else { 826 } else {
823 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 827 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
824 } 828 }
825 } 829 }
826 830
827 } else { 831 } else {
828 pal = mStandardPalette ; 832 pal = mStandardPalette ;
829 } 833 }
830 item->setPalette( pal ); 834 item->setPalette( pal );
831 item->setRecur( todo->recurrence()->doesRecur() ); 835 item->setRecur( todo->recurrence()->doesRecur() );
832 item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); 836 item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
833 item->setMoreInfo( todo->description().length() > 0 ); 837 item->setMoreInfo( todo->description().length() > 0 );
834 insertItem( item , count()); 838 insertItem( item , count());
835#ifdef DESKTOP_VERSION 839#ifdef DESKTOP_VERSION
836 mToolTip.append( text ); 840 mToolTip.append( text );
837#endif 841#endif
838} 842}
839void MonthViewCell::repaintfinishUpdateCell() 843void MonthViewCell::repaintfinishUpdateCell()
840{ 844{
841 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 845 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
842 while ( mitem ) { 846 while ( mitem ) {
843 mitem->setBlockRepaint( false ); 847 mitem->setBlockRepaint( false );
844 updateItem ( mitem ); 848 updateItem ( mitem );
845 mitem = (MonthViewItem *)mitem->next(); 849 mitem = (MonthViewItem *)mitem->next();
846 } 850 }
847} 851}
848void MonthViewCell::finishUpdateCell() 852void MonthViewCell::finishUpdateCell()
849{ 853{
850 854
851 855
852 856
853#ifdef DESKTOP_VERSION 857#ifdef DESKTOP_VERSION
854 if (mToolTip.count() > 0 ) { 858 if (mToolTip.count() > 0 ) {
855 mToolTip.sort(); 859 mToolTip.sort();
856 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 860 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
857 } 861 }
858#endif 862#endif
859 //sort(); 863 //sort();
860 //setMyPalette(); 864 //setMyPalette();
861 setMyPalette(); 865 setMyPalette();
862 866
863 resizeEvent( 0 ); 867 resizeEvent( 0 );
864 868
865} 869}
866void MonthViewCell::updateCell() 870void MonthViewCell::updateCell()
867{ 871{
868 if ( !mMonthView->isUpdatePossible() ) 872 if ( !mMonthView->isUpdatePossible() )
869 return; 873 return;
870 startUpdateCell(); 874 startUpdateCell();
871 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 875 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
872 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 876 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
873 Event *event; 877 Event *event;
874 for( event = events.first(); event; event = events.next() ) { // for event 878 for( event = events.first(); event; event = events.next() ) { // for event
875 insertEvent(event); 879 insertEvent(event);
876 } 880 }
877 // insert due todos 881 // insert due todos
878 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 882 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
879 Todo *todo; 883 Todo *todo;
880 for(todo = todos.first(); todo; todo = todos.next()) { 884 for(todo = todos.first(); todo; todo = todos.next()) {
881 insertTodo( todo ); 885 insertTodo( todo );
882 } 886 }
883 finishUpdateCell(); 887 finishUpdateCell();
884 // if ( isVisible()) 888 // if ( isVisible())
885 //qApp->processEvents(); 889 //qApp->processEvents();
886} 890}
887 891
888void MonthViewCell::updateConfig( bool bigFont ) // = false 892void MonthViewCell::updateConfig( bool bigFont ) // = false
889{ 893{
890 894
891 if ( bigFont ) { 895 if ( bigFont ) {
892 QFont fo = KOPrefs::instance()->mMonthViewFont; 896 QFont fo = KOPrefs::instance()->mMonthViewFont;
893 int ps = fo.pointSize() + 2; 897 int ps = fo.pointSize() + 2;
894 if ( ps < 18 ) 898 if ( ps < 18 )
895 ps += 2; 899 ps += 2;
896 fo.setPointSize( ps ); 900 fo.setPointSize( ps );
897 setFont( fo ); 901 setFont( fo );
898 } else 902 } else
899 setFont( KOPrefs::instance()->mMonthViewFont ); 903 setFont( KOPrefs::instance()->mMonthViewFont );
900 904
901 QFontMetrics fm( font() ); 905 QFontMetrics fm( font() );
902 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 906 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
903 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 907 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
904 mHolidayPalette = mStandardPalette; 908 mHolidayPalette = mStandardPalette;
905 mPrimaryPalette = mStandardPalette; 909 mPrimaryPalette = mStandardPalette;
906 mNonPrimaryPalette = mStandardPalette; 910 mNonPrimaryPalette = mStandardPalette;
907 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 911 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
908 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 912 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
909 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 913 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
910 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 914 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
911 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 915 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
912 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 916 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
913 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 917 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
914 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 918 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
915 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 919 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
916 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 920 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
917 } 921 }
918 //updateCell(); 922 //updateCell();
919} 923}
920 924
921void MonthViewCell::enableScrollBars( bool enabled ) 925void MonthViewCell::enableScrollBars( bool enabled )
922{ 926{
923 927
924 return; 928 return;
925 if ( enabled ) { 929 if ( enabled ) {
926 QListBoxItem *fi = firstItem (); 930 QListBoxItem *fi = firstItem ();
927 if (fi ) { 931 if (fi ) {
928 int ihei = fi->height( this ); 932 int ihei = fi->height( this );
929 int hei = numRows () * ihei; 933 int hei = numRows () * ihei;
930 if ( hei < height() - horizontalScrollBar()->height () ) { 934 if ( hei < height() - horizontalScrollBar()->height () ) {
931 setVScrollBarMode(QScrollView::AlwaysOff); 935 setVScrollBarMode(QScrollView::AlwaysOff);
932 } 936 }
933 else 937 else
934 setVScrollBarMode(QScrollView::Auto); 938 setVScrollBarMode(QScrollView::Auto);
935 if ( ihei *3 > height() ) { 939 if ( ihei *3 > height() ) {
936 setHScrollBarMode(QScrollView::AlwaysOff); 940 setHScrollBarMode(QScrollView::AlwaysOff);
937 } 941 }
938 else { 942 else {
939 setHScrollBarMode(QScrollView::Auto); 943 setHScrollBarMode(QScrollView::Auto);
940 } 944 }
941 } else { 945 } else {
942 setVScrollBarMode(QScrollView::Auto); 946 setVScrollBarMode(QScrollView::Auto);
943 setHScrollBarMode(QScrollView::Auto); 947 setHScrollBarMode(QScrollView::Auto);
944 } 948 }
945 } else { 949 } else {
946 setVScrollBarMode(QScrollView::AlwaysOff); 950 setVScrollBarMode(QScrollView::AlwaysOff);
947 setHScrollBarMode(QScrollView::AlwaysOff); 951 setHScrollBarMode(QScrollView::AlwaysOff);
948 } 952 }
949} 953}
950 954
951Incidence *MonthViewCell::selectedIncidence() 955Incidence *MonthViewCell::selectedIncidence()
952{ 956{
953 int index = currentItem(); 957 int index = currentItem();
954 if ( index < 0 ) return 0; 958 if ( index < 0 ) return 0;
955 959
956 MonthViewItem *mitem = 960 MonthViewItem *mitem =
957 static_cast<MonthViewItem *>( item( index ) ); 961 static_cast<MonthViewItem *>( item( index ) );
958 962
959 if ( !mitem ) return 0; 963 if ( !mitem ) return 0;
960 964
961 return mitem->incidence(); 965 return mitem->incidence();
962} 966}
963 967
964QDate MonthViewCell::selectedIncidenceDate() 968QDate MonthViewCell::selectedIncidenceDate()
965{ 969{
966 QDate qd; 970 QDate qd;
967 int index = currentItem(); 971 int index = currentItem();
968 if ( index < 0 ) return qd; 972 if ( index < 0 ) return qd;
969 973
970 MonthViewItem *mitem = 974 MonthViewItem *mitem =
971 static_cast<MonthViewItem *>( item( index ) ); 975 static_cast<MonthViewItem *>( item( index ) );
972 976
973 if ( !mitem ) return qd; 977 if ( !mitem ) return qd;
974 978
975 return mitem->incidenceDate(); 979 return mitem->incidenceDate();
976} 980}
977 981
978void MonthViewCell::deselect() 982void MonthViewCell::deselect()
979{ 983{
980 clearSelection(); 984 clearSelection();
981 enableScrollBars( false ); 985 enableScrollBars( false );
982 // updateCell(); 986 // updateCell();
983} 987}
984void MonthViewCell::select() 988void MonthViewCell::select()
985{ 989{
986 ;// updateCell(); 990 ;// updateCell();
987} 991}
988 992
989void MonthViewCell::resizeEvent ( QResizeEvent * e ) 993void MonthViewCell::resizeEvent ( QResizeEvent * e )
990{ 994{
991 if ( !mMonthView->isUpdatePossible() ) 995 if ( !mMonthView->isUpdatePossible() )
992 return; 996 return;
993 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 997 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
994 deselect(); 998 deselect();
995 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 999 mLabel->setMaximumHeight( height() - lineWidth()*2 );
996 1000
997 QString text; 1001 QString text;
998 mLabel->setText( text ); 1002 mLabel->setText( text );
999 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 1003 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
1000 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 1004 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
1001 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 1005 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
1002 mLabel->resize( mLabelBigSize ); 1006 mLabel->resize( mLabelBigSize );
1003 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1007 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1004 } else { 1008 } else {
1005 mLabel->resize( mLabelSize ); 1009 mLabel->resize( mLabelSize );
1006 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 1010 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
1007 } 1011 }
1008 mLabel->setText( text ); 1012 mLabel->setText( text );
1009 1013
1010 int size = height() - mLabel->height() - lineWidth()-1; 1014 int size = height() - mLabel->height() - lineWidth()-1;
1011 //qDebug("LW %d ", lineWidth()); 1015 //qDebug("LW %d ", lineWidth());
1012 if ( size > 0 ) 1016 if ( size > 0 )
1013 verticalScrollBar()->setMaximumHeight( size ); 1017 verticalScrollBar()->setMaximumHeight( size );
1014 size = width() - mLabel->width() -lineWidth()-1; 1018 size = width() - mLabel->width() -lineWidth()-1;
1015 if ( size > 0 ) 1019 if ( size > 0 )
1016 horizontalScrollBar()->setMaximumWidth( size ); 1020 horizontalScrollBar()->setMaximumWidth( size );
1017 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 1021 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
1018 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 1022 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
1019 // mItemList->resize ( width(), height () ); 1023 // mItemList->resize ( width(), height () );
1020 if ( e ) 1024 if ( e )
1021 KNoScrollListBox::resizeEvent ( e ); 1025 KNoScrollListBox::resizeEvent ( e );
1022} 1026}
1023 1027
1024void MonthViewCell::defaultAction( QListBoxItem *item ) 1028void MonthViewCell::defaultAction( QListBoxItem *item )
1025{ 1029{
1026 1030
1027 if ( !item ) { 1031 if ( !item ) {
1028 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1032 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1029 emit newEventSignal( dt ); 1033 emit newEventSignal( dt );
1030 return; 1034 return;
1031 } 1035 }
1032 1036
1033 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1037 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1034 Incidence *incidence = eventItem->incidence(); 1038 Incidence *incidence = eventItem->incidence();
1035 if ( incidence ) mMonthView->defaultAction( incidence ); 1039 if ( incidence ) mMonthView->defaultAction( incidence );
1036} 1040}
1037void MonthViewCell::showDay() 1041void MonthViewCell::showDay()
1038{ 1042{
1039 emit showDaySignal( date() ); 1043 emit showDaySignal( date() );
1040} 1044}
1041void MonthViewCell::newEvent() 1045void MonthViewCell::newEvent()
1042{ 1046{
1043 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1047 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1044 emit newEventSignal( dt ); 1048 emit newEventSignal( dt );
1045} 1049}
1046void MonthViewCell::cellClicked( QListBoxItem *item ) 1050void MonthViewCell::cellClicked( QListBoxItem *item )
1047{ 1051{
1048 mMonthView->setSelectedCell( this ); 1052 mMonthView->setSelectedCell( this );
1049 if ( item == 0 ) { 1053 if ( item == 0 ) {
1050 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1054 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1051 emit newEventSignal( dt ); 1055 emit newEventSignal( dt );
1052 return; 1056 return;
1053 } 1057 }
1054 1058
1055} 1059}
1056 1060
1057void MonthViewCell::contextMenu( QListBoxItem *item ) 1061void MonthViewCell::contextMenu( QListBoxItem *item )
1058{ 1062{
1059 mMonthView->setPopupCell( this ); 1063 mMonthView->setPopupCell( this );
1060 if ( !item ) { 1064 if ( !item ) {
1061 mMonthView->showContextMenu( 0 ); 1065 mMonthView->showContextMenu( 0 );
1062 return; 1066 return;
1063 } 1067 }
1064 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1068 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1065 Incidence *incidence = eventItem->incidence(); 1069 Incidence *incidence = eventItem->incidence();
1066 if ( incidence ) mMonthView->showContextMenu( incidence ); 1070 if ( incidence ) mMonthView->showContextMenu( incidence );
1067} 1071}
1068 1072
1069void MonthViewCell::selection( QListBoxItem *item ) 1073void MonthViewCell::selection( QListBoxItem *item )
1070{ 1074{
1071 if ( !item ) return; 1075 if ( !item ) return;
1072 1076
1073 mMonthView->setSelectedCell( this ); 1077 mMonthView->setSelectedCell( this );
1074} 1078}
1075 1079
1076 1080
1077// ******************************************************************************* 1081// *******************************************************************************
1078// ******************************************************************************* 1082// *******************************************************************************
1079// ******************************************************************************* 1083// *******************************************************************************
1080 1084
1081 1085
1082KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1086KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1083 : KOEventView( calendar, parent, name ), 1087 : KOEventView( calendar, parent, name ),
1084 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1088 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1085 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1089 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1086{ 1090{
1087 mFlagKeyPressed = false; 1091 mFlagKeyPressed = false;
1088 mShortDayLabelsM = false; 1092 mShortDayLabelsM = false;
1089 mShortDayLabelsW = false; 1093 mShortDayLabelsW = false;
1090 skipResize = false; 1094 skipResize = false;
1091 clPending = true; 1095 clPending = true;
1092 mPopupCell = 0; 1096 mPopupCell = 0;
1093 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1097 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1094 mWidStack = new QWidgetStack( this ); 1098 mWidStack = new QWidgetStack( this );
1095 QVBoxLayout* hb = new QVBoxLayout( this ); 1099 QVBoxLayout* hb = new QVBoxLayout( this );
1096 mMonthView = new QWidget( mWidStack ); 1100 mMonthView = new QWidget( mWidStack );
1097 mWeekView = new QWidget( mWidStack ); 1101 mWeekView = new QWidget( mWidStack );
1098#if QT_VERSION >= 0x030000 1102#if QT_VERSION >= 0x030000
1099 mWidStack->addWidget(mMonthView ); 1103 mWidStack->addWidget(mMonthView );
1100 mWidStack->addWidget(mWeekView ); 1104 mWidStack->addWidget(mWeekView );
1101#else 1105#else
1102 mWidStack->addWidget( mMonthView, 1 ); 1106 mWidStack->addWidget( mMonthView, 1 );
1103 mWidStack->addWidget( mWeekView , 1 ); 1107 mWidStack->addWidget( mWeekView , 1 );
1104#endif 1108#endif
1105 hb->addWidget( mNavigatorBar ); 1109 hb->addWidget( mNavigatorBar );
1106 hb->addWidget( mWidStack ); 1110 hb->addWidget( mWidStack );
1107 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1111 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1108 updatePossible = false; 1112 updatePossible = false;
1109 //updatePossible = true; 1113 //updatePossible = true;
1110 mCells.setAutoDelete( true ); 1114 mCells.setAutoDelete( true );
1111 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1115 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1112 mDayLabels.resize( mDaysPerWeek ); 1116 mDayLabels.resize( mDaysPerWeek );
1113 mDayLabelsW.resize( mDaysPerWeek ); 1117 mDayLabelsW.resize( mDaysPerWeek );
1114 QFont bfont = font(); 1118 QFont bfont = font();
1115 if ( QApplication::desktop()->width() < 650 ) { 1119 if ( QApplication::desktop()->width() < 650 ) {
1116 bfont.setPointSize( bfont.pointSize() - 2 ); 1120 bfont.setPointSize( bfont.pointSize() - 2 );
1117 } 1121 }
1118 bfont.setBold( true ); 1122 bfont.setBold( true );
1119 int i; 1123 int i;
1120 1124
1121 for( i = 0; i < mDaysPerWeek; i++ ) { 1125 for( i = 0; i < mDaysPerWeek; i++ ) {
1122 QLabel *label = new QLabel( mMonthView ); 1126 QLabel *label = new QLabel( mMonthView );
1123 label->setFont(bfont); 1127 label->setFont(bfont);
1124 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1128 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1125 label->setLineWidth(1); 1129 label->setLineWidth(1);
1126 label->setAlignment(AlignCenter); 1130 label->setAlignment(AlignCenter);
1127 mDayLabels.insert( i, label ); 1131 mDayLabels.insert( i, label );
1128 label = new QLabel( mWeekView ); 1132 label = new QLabel( mWeekView );
1129 label->setFont(bfont); 1133 label->setFont(bfont);
1130 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1134 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1131 label->setLineWidth(1); 1135 label->setLineWidth(1);
1132 label->setAlignment(AlignCenter); 1136 label->setAlignment(AlignCenter);
1133 mDayLabelsW.insert( i, label ); 1137 mDayLabelsW.insert( i, label );
1134 } 1138 }
1135 1139
1136 bfont.setBold( false ); 1140 bfont.setBold( false );
1137 mWeekLabels.resize( mNumWeeks+1 ); 1141 mWeekLabels.resize( mNumWeeks+1 );
1138 mWeekLabelsW.resize( 2 ); 1142 mWeekLabelsW.resize( 2 );
1139 for( i = 0; i < mNumWeeks+1; i++ ) { 1143 for( i = 0; i < mNumWeeks+1; i++ ) {
1140 KOWeekButton *label = new KOWeekButton( mMonthView ); 1144 KOWeekButton *label = new KOWeekButton( mMonthView );
1141 label->setFocusPolicy(NoFocus); 1145 label->setFocusPolicy(NoFocus);
1142 label->setFont(bfont); 1146 label->setFont(bfont);
1143 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1147 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1144 label->setFlat(true); 1148 label->setFlat(true);
1145 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1149 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1146 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1150 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1147 //label->setLineWidth(1); 1151 //label->setLineWidth(1);
1148 //label->setAlignment(AlignCenter); 1152 //label->setAlignment(AlignCenter);
1149 mWeekLabels.insert( i, label ); 1153 mWeekLabels.insert( i, label );
1150 } 1154 }
1151 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1155 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1152 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1156 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
1153 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1157 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1154 1158
1155 for( i = 0; i < 1+1; i++ ) { 1159 for( i = 0; i < 1+1; i++ ) {
1156 KOWeekButton *label = new KOWeekButton( mWeekView ); 1160 KOWeekButton *label = new KOWeekButton( mWeekView );
1157 label->setFocusPolicy(NoFocus); 1161 label->setFocusPolicy(NoFocus);
1158 label->setFont(bfont); 1162 label->setFont(bfont);
1159 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1163 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1160 label->setFlat(true); 1164 label->setFlat(true);
1161 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1165 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1162 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1166 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1163 //label->setLineWidth(1); 1167 //label->setLineWidth(1);
1164 //label->setAlignment(AlignCenter); 1168 //label->setAlignment(AlignCenter);
1165 mWeekLabelsW.insert( i, label ); 1169 mWeekLabelsW.insert( i, label );
1166 } 1170 }
1167 mWeekLabelsW[1]->setText( i18n("W")); 1171 mWeekLabelsW[1]->setText( i18n("W"));
1168 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1172 mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
1169 1173
1170 1174
1171 int row, col; 1175 int row, col;
1172 mCells.resize( mNumCells ); 1176 mCells.resize( mNumCells );
1173 for( row = 0; row < mNumWeeks; ++row ) { 1177 for( row = 0; row < mNumWeeks; ++row ) {
1174 for( col = 0; col < mDaysPerWeek; ++col ) { 1178 for( col = 0; col < mDaysPerWeek; ++col ) {
1175 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1179 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1176 mCells.insert( row * mDaysPerWeek + col, cell ); 1180 mCells.insert( row * mDaysPerWeek + col, cell );
1177 1181
1178 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1182 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1179 SLOT( defaultAction( Incidence * ) ) ); 1183 SLOT( defaultAction( Incidence * ) ) );
1180 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1184 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1181 SIGNAL( newEventSignal( QDateTime ) ) ); 1185 SIGNAL( newEventSignal( QDateTime ) ) );
1182 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1186 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1183 SIGNAL( showDaySignal( QDate ) ) ); 1187 SIGNAL( showDaySignal( QDate ) ) );
1184 connect( cell, SIGNAL( nextCell() ), 1188 connect( cell, SIGNAL( nextCell() ),
1185 SLOT( nextCell() ) ); 1189 SLOT( nextCell() ) );
1186 connect( cell, SIGNAL( prevCell() ), 1190 connect( cell, SIGNAL( prevCell() ),
1187 SLOT( prevCell() ) ); 1191 SLOT( prevCell() ) );
1188 } 1192 }
1189 } 1193 }
1190 mCellsW.resize( mDaysPerWeek ); 1194 mCellsW.resize( mDaysPerWeek );
1191 for( col = 0; col < mDaysPerWeek; ++col ) { 1195 for( col = 0; col < mDaysPerWeek; ++col ) {
1192 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1196 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1193 mCellsW.insert( col, cell ); 1197 mCellsW.insert( col, cell );
1194 1198
1195 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1199 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1196 SLOT( defaultAction( Incidence * ) ) ); 1200 SLOT( defaultAction( Incidence * ) ) );
1197 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1201 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1198 SIGNAL( newEventSignal( QDateTime ) ) ); 1202 SIGNAL( newEventSignal( QDateTime ) ) );
1199 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1203 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1200 SIGNAL( showDaySignal( QDate ) ) ); 1204 SIGNAL( showDaySignal( QDate ) ) );
1201 connect( cell, SIGNAL( nextCell() ), 1205 connect( cell, SIGNAL( nextCell() ),
1202 SLOT( nextCell() ) ); 1206 SLOT( nextCell() ) );
1203 connect( cell, SIGNAL( prevCell() ), 1207 connect( cell, SIGNAL( prevCell() ),
1204 SLOT( prevCell() ) ); 1208 SLOT( prevCell() ) );
1205 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1209 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index e679bd3..65f0342 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -116,479 +116,480 @@ KOPrefs::KOPrefs() :
116 addItemBool("ToolBarHorF",&mToolBarHorF, true ); 116 addItemBool("ToolBarHorF",&mToolBarHorF, true );
117 addItemBool("ToolBarUpF",&mToolBarUpF, false ); 117 addItemBool("ToolBarUpF",&mToolBarUpF, false );
118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 118 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
119 addItemInt("Whats Next Days",&mWhatsNextDays,3); 119 addItemInt("Whats Next Days",&mWhatsNextDays,3);
120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 120 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
121 121
122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 122 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true); 123 addItemBool("ShowCompletedTodoInAgenda",&mShowCompletedTodoInAgenda,true);
124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); 124 addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true);
125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); 125 addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false);
126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 126 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
127 addItemInt("AllDay Size",&mAllDaySize,28); 127 addItemInt("AllDay Size",&mAllDaySize,28);
128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 128 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 129 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
130 130
131 addItemStringList("LocationDefaults",&mLocationDefaults ); 131 addItemStringList("LocationDefaults",&mLocationDefaults );
132 addItemStringList("EventSummary User",&mEventSummaryUser); 132 addItemStringList("EventSummary User",&mEventSummaryUser);
133 addItemStringList("TodoSummary User",&mTodoSummaryUser); 133 addItemStringList("TodoSummary User",&mTodoSummaryUser);
134 134
135 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 135 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
136 addItemBool("Enable Project View",&mEnableProjectView,false); 136 addItemBool("Enable Project View",&mEnableProjectView,false);
137 addItemBool("Auto Save",&mAutoSave,false); 137 addItemBool("Auto Save",&mAutoSave,false);
138 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 138 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
139 addItemBool("Confirm Deletes",&mConfirm,true); 139 addItemBool("Confirm Deletes",&mConfirm,true);
140 addItemString("Archive File",&mArchiveFile); 140 addItemString("Archive File",&mArchiveFile);
141 addItemString("Html Export File",&mHtmlExportFile, 141 addItemString("Html Export File",&mHtmlExportFile,
142 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 142 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
143 addItemBool("Html With Save",&mHtmlWithSave,false); 143 addItemBool("Html With Save",&mHtmlWithSave,false);
144 144
145 KPrefs::setCurrentGroup("Personal Settings"); 145 KPrefs::setCurrentGroup("Personal Settings");
146 146
147 addItemInt("Mail Client",&mMailClient,MailClientKMail); 147 addItemInt("Mail Client",&mMailClient,MailClientKMail);
148 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 148 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
149 addItemBool("Bcc",&mBcc,false); 149 addItemBool("Bcc",&mBcc,false);
150 150
151 KPrefs::setCurrentGroup("Time & Date"); 151 KPrefs::setCurrentGroup("Time & Date");
152 152
153 153
154 addItemInt("Default Start Time",&mStartTime,10); 154 addItemInt("Default Start Time",&mStartTime,10);
155 addItemInt("Default Duration",&mDefaultDuration,2); 155 addItemInt("Default Duration",&mDefaultDuration,2);
156 addItemInt("Default Alarm Time",&mAlarmTime,3); 156 addItemInt("Default Alarm Time",&mAlarmTime,3);
157 KPrefs::setCurrentGroup("AlarmSettings"); 157 KPrefs::setCurrentGroup("AlarmSettings");
158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 158 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 159 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 160 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 161 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
162 162
163 163
164 KPrefs::setCurrentGroup("Calendar"); 164 KPrefs::setCurrentGroup("Calendar");
165 165
166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 166 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
167 167
168 KPrefs::setCurrentGroup("Fonts"); 168 KPrefs::setCurrentGroup("Fonts");
169 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 169 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
170 QFont fon = KGlobalSettings::generalFont(); 170 QFont fon = KGlobalSettings::generalFont();
171 addItemFont("TimeBar Font",&mTimeBarFont,fon ); 171 addItemFont("TimeBar Font",&mTimeBarFont,fon );
172 addItemFont("MonthView Font",&mMonthViewFont,fon); 172 addItemFont("MonthView Font",&mMonthViewFont,fon);
173 addItemFont("AgendaView Font",&mAgendaViewFont,fon); 173 addItemFont("AgendaView Font",&mAgendaViewFont,fon);
174 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); 174 addItemFont("MarcusBains Font",&mMarcusBainsFont,fon);
175 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); 175 addItemFont("TimeLabels Font",&mTimeLabelsFont,fon);
176 addItemFont("TodoView Font",&mTodoViewFont,fon); 176 addItemFont("TodoView Font",&mTodoViewFont,fon);
177 addItemFont("ListView Font",&mListViewFont,fon); 177 addItemFont("ListView Font",&mListViewFont,fon);
178 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); 178 addItemFont("DateNavigator Font",&mDateNavigatorFont,fon);
179 addItemFont("EditBox Font",&mEditBoxFont,fon); 179 addItemFont("EditBox Font",&mEditBoxFont,fon);
180 addItemFont("JournalView Font",&mJornalViewFont,fon); 180 addItemFont("JournalView Font",&mJornalViewFont,fon);
181 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); 181 addItemFont("WhatsNextView Font",&mWhatsNextFont,fon);
182 addItemFont("EventView Font",&mEventViewFont,fon); 182 addItemFont("EventView Font",&mEventViewFont,fon);
183 183
184 KPrefs::setCurrentGroup("RemoteSyncing"); 184 KPrefs::setCurrentGroup("RemoteSyncing");
185 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 185 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
186 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 186 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
187 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 187 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
188 addItemInt("LastSyncTime",&mLastSyncTime,0); 188 addItemInt("LastSyncTime",&mLastSyncTime,0);
189 189
190#ifdef _WIN32_ 190#ifdef _WIN32_
191 QString hdp= locateLocal("data","korganizer")+"\\\\"; 191 QString hdp= locateLocal("data","korganizer")+"\\\\";
192#else 192#else
193 QString hdp= locateLocal("data","korganizer")+"/"; 193 QString hdp= locateLocal("data","korganizer")+"/";
194#endif 194#endif
195 195
196 KPrefs::setCurrentGroup("LoadSaveFileNames"); 196 KPrefs::setCurrentGroup("LoadSaveFileNames");
197 197
198 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 198 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
199 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 199 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
200 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 200 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
201 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 201 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
202 202
203 203
204 KPrefs::setCurrentGroup("Locale"); 204 KPrefs::setCurrentGroup("Locale");
205 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 205 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
206 206
207 207
208 KPrefs::setCurrentGroup("Colors"); 208 KPrefs::setCurrentGroup("Colors");
209 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 209 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
210 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 210 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
211 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 211 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
212 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 212 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
213 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 213 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
214 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 214 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
215 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 215 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
216 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 216 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
217 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor); 217 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
218 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 218 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
219 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 219 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
220 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 220 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
221 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 221 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
222 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 222 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
223 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 223 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
224 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 224 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
225 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 225 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
226 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 226 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
227 addItemBool("UseAppColors",&mUseAppColors,false); 227 addItemBool("UseAppColors",&mUseAppColors,false);
228 228
229 229
230 230
231 KPrefs::setCurrentGroup("Views"); 231 KPrefs::setCurrentGroup("Views");
232 addItemBool("Block Popup Menu",&mBlockPopupMenu,true); 232 addItemBool("Block Popup Menu",&mBlockPopupMenu,true);
233 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 233 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
234 addItemInt("Hour Size",&mHourSize,8); 234 addItemInt("Hour Size",&mHourSize,8);
235 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 235 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
236 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 236 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
237 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 237 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
238 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 238 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
239 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 239 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
240 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 240 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
241 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true); 241 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
242#ifdef DESKTOP_VERION 242#ifdef DESKTOP_VERION
243 addItemBool("Enable ToolTips",&mEnableToolTips,true); 243 addItemBool("Enable ToolTips",&mEnableToolTips,true);
244#else 244#else
245 addItemBool("Enable ToolTips",&mEnableToolTips,false); 245 addItemBool("Enable ToolTips",&mEnableToolTips,false);
246#endif 246#endif
247 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 247 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
248 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 248 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
249 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 249 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
250 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 250 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
251 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 251 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
252 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 252 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
253 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 253 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
254 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 254 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
255 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 255 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
256 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 256 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
257 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 257 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
258 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 258 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
259 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 259 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
260 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 260 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
261 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 261 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
262 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 262 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
263 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); 263 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true);
264 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); 264 addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true);
265 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 265 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
266 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 266 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
267#ifdef DESKTOP_VERSION 267#ifdef DESKTOP_VERSION
268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 268 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
269#else 269#else
270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 270 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
271#endif 271#endif
272 addItemInt("Day Begins",&mDayBegins,7); 272 addItemInt("Day Begins",&mDayBegins,7);
273 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 273 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
274 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 274 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
275 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 275 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
276 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 276 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
277 277
278 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 278 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
279 addItemBool("Full View Month",&mFullViewMonth,true); 279 addItemBool("Full View Month",&mFullViewMonth,true);
280 addItemBool("Full View Todo",&mFullViewTodo,true); 280 addItemBool("Full View Todo",&mFullViewTodo,true);
281 addItemBool("Quick Todo",&mEnableQuickTodo,false); 281 addItemBool("Quick Todo",&mEnableQuickTodo,false);
282 282
283 addItemInt("Next X Days",&mNextXDays,3); 283 addItemInt("Next X Days",&mNextXDays,3);
284 284
285 KPrefs::setCurrentGroup("Printer"); 285 KPrefs::setCurrentGroup("Printer");
286 286
287 KPrefs::setCurrentGroup("Layout"); 287 KPrefs::setCurrentGroup("Layout");
288 288
289 addItemBool("CompactDialogs",&mCompactDialogs,false); 289 addItemBool("CompactDialogs",&mCompactDialogs,false);
290 addItemBool("VerticalScreen",&mVerticalScreen,true); 290 addItemBool("VerticalScreen",&mVerticalScreen,true);
291 291
292 KPrefs::setCurrentGroup("KOrganizer Plugins"); 292 KPrefs::setCurrentGroup("KOrganizer Plugins");
293 293
294 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 294 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
295 295
296 KPrefs::setCurrentGroup("Group Scheduling"); 296 KPrefs::setCurrentGroup("Group Scheduling");
297 297
298 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 298 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
299 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 299 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
300 addItemStringList("AdditionalMails",&mAdditionalMails,""); 300 addItemStringList("AdditionalMails",&mAdditionalMails,"");
301 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 301 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
302 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 302 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
303 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 303 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
304 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 304 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
305 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 305 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
306 306
307 KPrefs::setCurrentGroup( "Editors" ); 307 KPrefs::setCurrentGroup( "Editors" );
308 308
309 addItemStringList( "EventTemplates", &mEventTemplates ); 309 addItemStringList( "EventTemplates", &mEventTemplates );
310 addItemStringList( "TodoTemplates", &mTodoTemplates ); 310 addItemStringList( "TodoTemplates", &mTodoTemplates );
311 311
312 addItemInt("DestinationPolicy",&mDestination,standardDestination); 312 addItemInt("DestinationPolicy",&mDestination,standardDestination);
313 313
314 KPrefs::setCurrentGroup( "ViewOptions" ); 314 KPrefs::setCurrentGroup( "ViewOptions" );
315 addItemBool("EVshowDetails",&mEVshowDetails,true); 315 addItemBool("EVshowDetails",&mEVshowDetails,true);
316 addItemBool("EVshowCreated",&mEVshowCreated,true); 316 addItemBool("EVshowCreated",&mEVshowCreated,true);
317 addItemBool("EVshowChanged",&mEVshowChanged,true); 317 addItemBool("EVshowChanged",&mEVshowChanged,true);
318 addItemBool("WTshowDetails",&mWTshowDetails,false); 318 addItemBool("WTshowDetails",&mWTshowDetails,false);
319 addItemBool("WTshowCreated",&mWTshowCreated,false); 319 addItemBool("WTshowCreated",&mWTshowCreated,false);
320 addItemBool("WTshowChanged",&mWTshowChanged,false); 320 addItemBool("WTshowChanged",&mWTshowChanged,false);
321 mCalendars.setAutoDelete( true ); 321 mCalendars.setAutoDelete( true );
322} 322}
323 323
324 324
325KOPrefs::~KOPrefs() 325KOPrefs::~KOPrefs()
326{ 326{
327 if (mInstance == this) 327 if (mInstance == this)
328 mInstance = insd.setObject(0); 328 mInstance = insd.setObject(0);
329 mCalendars.setAutoDelete( true ); 329 mCalendars.setAutoDelete( true );
330 mCalendars.clear(); 330 mCalendars.clear();
331 //qDebug("KOPrefs::~KOPrefs() "); 331 //qDebug("KOPrefs::~KOPrefs() ");
332} 332}
333 333
334 334
335KOPrefs *KOPrefs::instance() 335KOPrefs *KOPrefs::instance()
336{ 336{
337 if (!mInstance) { 337 if (!mInstance) {
338 mInstance = insd.setObject(new KOPrefs()); 338 mInstance = insd.setObject(new KOPrefs());
339 mInstance->readConfig(); 339 mInstance->readConfig();
340 } 340 }
341 341
342 return mInstance; 342 return mInstance;
343} 343}
344 344
345void KOPrefs::usrSetDefaults() 345void KOPrefs::usrSetDefaults()
346{ 346{
347 347
348} 348}
349 349
350void KOPrefs::fillMailDefaults() 350void KOPrefs::fillMailDefaults()
351{ 351{
352 if (mName.isEmpty()) mName = i18n("Anonymous"); 352 if (mName.isEmpty()) mName = i18n("Anonymous");
353 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); 353 if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere");
354} 354}
355 355
356void KOPrefs::setTimeZoneIdDefault() 356void KOPrefs::setTimeZoneIdDefault()
357{ 357{
358 ; 358 ;
359} 359}
360 360
361void KOPrefs::setAllDefaults() 361void KOPrefs::setAllDefaults()
362{ 362{
363 setCategoryDefaults(); 363 setCategoryDefaults();
364 mEventSummaryUser = getDefaultList() ; 364 mEventSummaryUser = getDefaultList() ;
365 mTodoSummaryUser = getDefaultList() ; 365 mTodoSummaryUser = getDefaultList() ;
366 mLocationDefaults = getLocationDefaultList(); 366 mLocationDefaults = getLocationDefaultList();
367} 367}
368 368
369void KOPrefs::setCategoryDefaults() 369void KOPrefs::setCategoryDefaults()
370{ 370{
371 mCustomCategories.clear(); 371 mCustomCategories.clear();
372 mCustomCategories = getDefaultList(); 372 mCustomCategories = getDefaultList();
373 373
374 QStringList::Iterator it; 374 QStringList::Iterator it;
375 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 375 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
376 setCategoryColor(*it,mDefaultCategoryColor); 376 setCategoryColor(*it,mDefaultCategoryColor);
377 } 377 }
378} 378}
379QStringList KOPrefs::getLocationDefaultList() 379QStringList KOPrefs::getLocationDefaultList()
380{ 380{
381 QStringList retval ; 381 QStringList retval ;
382 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") 382 retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach")
383 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") 383 << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room")
384 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") 384 << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten")
385 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; 385 << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ;
386 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") 386 // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("")
387 387
388 retval.sort(); 388 retval.sort();
389 return retval; 389 return retval;
390} 390}
391QStringList KOPrefs::getDefaultList() 391QStringList KOPrefs::getDefaultList()
392{ 392{
393 QStringList retval ; 393 QStringList retval ;
394 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") 394 retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer")
395 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") 395 << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner")
396 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") 396 << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts")
397 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") 397 << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids")
398 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") 398 << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel")
399 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") 399 << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping")
400 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") 400 << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University")
401 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; 401 << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ;
402 retval.sort(); 402 retval.sort();
403 //qDebug("cat %s ", retval.join("-").latin1()); 403 //qDebug("cat %s ", retval.join("-").latin1());
404 return retval; 404 return retval;
405} 405}
406 406
407void KOPrefs::usrReadConfig() 407void KOPrefs::usrReadConfig()
408{ 408{
409 config()->setGroup("General"); 409 config()->setGroup("General");
410 410
411 //qDebug("KOPrefs::usrReadConfig() "); 411 //qDebug("KOPrefs::usrReadConfig() ");
412 mCustomCategories = config()->readListEntry("Custom Categories"); 412 mCustomCategories = config()->readListEntry("Custom Categories");
413 mOldLoadedLanguage = mOldLanguage ; 413 mOldLoadedLanguage = mOldLanguage ;
414 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; 414 mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage;
415 if (mLocationDefaults.isEmpty()) { 415 if (mLocationDefaults.isEmpty()) {
416 mLocationDefaults = getLocationDefaultList(); 416 mLocationDefaults = getLocationDefaultList();
417 } 417 }
418 418
419 if (mEventSummaryUser.isEmpty()) { 419 if (mEventSummaryUser.isEmpty()) {
420 mEventSummaryUser = getDefaultList() ; 420 mEventSummaryUser = getDefaultList() ;
421 } 421 }
422 if (mTodoSummaryUser.isEmpty()) { 422 if (mTodoSummaryUser.isEmpty()) {
423 mTodoSummaryUser = getDefaultList() ; 423 mTodoSummaryUser = getDefaultList() ;
424 } 424 }
425 425
426 if (mCustomCategories.isEmpty()) setCategoryDefaults(); 426 if (mCustomCategories.isEmpty()) setCategoryDefaults();
427 427
428 config()->setGroup("Personal Settings"); 428 config()->setGroup("Personal Settings");
429 mName = config()->readEntry("user_name",""); 429 mName = config()->readEntry("user_name","");
430 mEmail = config()->readEntry("user_email",""); 430 mEmail = config()->readEntry("user_email","");
431 fillMailDefaults(); 431 fillMailDefaults();
432 432
433 config()->setGroup("Category Colors"); 433 config()->setGroup("Category Colors");
434 QStringList::Iterator it; 434 QStringList::Iterator it;
435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
437 437
438 } 438 }
439 KConfig fc (locateLocal("config","kopicalendarrc")); 439 KConfig fc (locateLocal("config","kopicalendarrc"));
440 fc.setGroup("CC"); 440 fc.setGroup("CC");
441 int numCals = fc.readNumEntry("NumberCalendars",0 ); 441 int numCals = fc.readNumEntry("NumberCalendars",0 );
442 mNextAvailableCalendar = 1; 442 mNextAvailableCalendar = 1;
443 if ( numCals == 0 ) { 443 if ( numCals == 0 ) {
444 KopiCalendarFile *kkf = getNewCalendar(); 444 KopiCalendarFile *kkf = getNewCalendar();
445 kkf->isStandard = true; 445 kkf->isStandard = true;
446 kkf->mName = i18n("Standard"); 446 kkf->mName = i18n("Standard");
447 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 447 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
448 } 448 }
449 while ( mNextAvailableCalendar <= numCals ) { 449 while ( mNextAvailableCalendar <= numCals ) {
450 //qDebug("Read cal #%d ", mNextAvailableCalendar ); 450 //qDebug("Read cal #%d ", mNextAvailableCalendar );
451 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 451 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
452 KopiCalendarFile *kkf = getNewCalendar(); 452 KopiCalendarFile *kkf = getNewCalendar();
453 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false ); 453 kkf->isStandard = fc.readBoolEntry( prefix+"_isStandard", false );
454 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true); 454 kkf->isEnabled = fc.readBoolEntry( prefix+"_isEnabled", true);
455 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true); 455 kkf->isAlarmEnabled = fc.readBoolEntry( prefix+"_isAlarmEnabled", true);
456 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false); 456 kkf->isReadOnly = fc.readBoolEntry( prefix+"_isReadOnly", false);
457 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar"); 457 kkf->mName = fc.readEntry( prefix+"_Name", "Calendar");
458 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName); 458 kkf->mFileName = fc.readEntry( prefix+"_FileName", kkf->mFileName);
459 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor); 459 kkf->mDefaultColor = fc.readColorEntry( prefix+"_Color",&mEventColor);
460 if ( kkf->mCalNumber == 1 ) { 460 if ( kkf->mCalNumber == 1 ) {
461 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 461 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
462 } 462 }
463 } 463 }
464 464
465 KPimPrefs::usrReadConfig(); 465 KPimPrefs::usrReadConfig();
466} 466}
467 467
468KopiCalendarFile * KOPrefs::getCalendar( int num ) 468KopiCalendarFile * KOPrefs::getCalendar( int num )
469{ 469{
470 return mDefCalColors[num-1]; 470 return mDefCalColors[num-1];
471} 471}
472 472
473KopiCalendarFile * KOPrefs::getNewCalendar() 473KopiCalendarFile * KOPrefs::getNewCalendar()
474{ 474{
475 KopiCalendarFile * kkf = new KopiCalendarFile(); 475 KopiCalendarFile * kkf = new KopiCalendarFile();
476 kkf->mCalNumber = mNextAvailableCalendar; 476 kkf->mCalNumber = mNextAvailableCalendar;
477 mDefCalColors.resize( mNextAvailableCalendar ); 477 mDefCalColors.resize( mNextAvailableCalendar );
478 mDefCalColors[mNextAvailableCalendar-1] = kkf; 478 mDefCalColors[mNextAvailableCalendar-1] = kkf;
479 ++mNextAvailableCalendar; 479 ++mNextAvailableCalendar;
480 kkf->mDefaultColor = mEventColor; 480 kkf->mDefaultColor = mEventColor;
481 kkf->mName = i18n("New Calendar"); 481 kkf->mName = i18n("New Calendar");
482 mCalendars.append( kkf ); 482 mCalendars.append( kkf );
483 return kkf; 483 return kkf;
484} 484}
485void KOPrefs::deleteCalendar( int num ) 485void KOPrefs::deleteCalendar( int num )
486{ 486{
487 KopiCalendarFile * kkf = mCalendars.first(); 487 KopiCalendarFile * kkf = mCalendars.first();
488 while ( kkf ) { 488 while ( kkf ) {
489 if ( kkf->mCalNumber == num ) { 489 if ( kkf->mCalNumber == num ) {
490 qDebug("KOPrefs::deleteCalendar %d ", num ); 490 qDebug("KOPrefs::deleteCalendar %d ", num );
491 mCalendars.remove( kkf ); 491 mCalendars.remove( kkf );
492 delete kkf; 492 delete kkf;
493 return; 493 return;
494 } 494 }
495 kkf = mCalendars.next(); 495 kkf = mCalendars.next();
496 } 496 }
497} 497}
498QColor KOPrefs::defaultColor( int calNum ) const 498QColor KOPrefs::defaultColor( int calNum ) const
499{ 499{
500 if ( calNum == 1 ) return mEventColor;
500 return (mDefCalColors[calNum-1])->mDefaultColor; 501 return (mDefCalColors[calNum-1])->mDefaultColor;
501} 502}
502void KOPrefs::usrWriteConfig() 503void KOPrefs::usrWriteConfig()
503{ 504{
504 config()->setGroup("General"); 505 config()->setGroup("General");
505 config()->writeEntry("Custom Categories",mCustomCategories); 506 config()->writeEntry("Custom Categories",mCustomCategories);
506 507
507 config()->setGroup("Personal Settings"); 508 config()->setGroup("Personal Settings");
508 config()->writeEntry("user_name",mName); 509 config()->writeEntry("user_name",mName);
509 config()->writeEntry("user_email",mEmail); 510 config()->writeEntry("user_email",mEmail);
510 511
511 config()->setGroup("Category Colors"); 512 config()->setGroup("Category Colors");
512 QDictIterator<QColor> it(mCategoryColors); 513 QDictIterator<QColor> it(mCategoryColors);
513 while (it.current()) { 514 while (it.current()) {
514 config()->writeEntry(it.currentKey(),*(it.current())); 515 config()->writeEntry(it.currentKey(),*(it.current()));
515 ++it; 516 ++it;
516 } 517 }
517 KConfig fc (locateLocal("config","kopicalendarrc")); 518 KConfig fc (locateLocal("config","kopicalendarrc"));
518 fc.setGroup("CC"); 519 fc.setGroup("CC");
519 fc.writeEntry("NumberCalendars",mCalendars.count()); 520 fc.writeEntry("NumberCalendars",mCalendars.count());
520 int numCal = 1; 521 int numCal = 1;
521 int writeCal = 0; 522 int writeCal = 0;
522 while ( numCal < mNextAvailableCalendar ) { 523 while ( numCal < mNextAvailableCalendar ) {
523 KopiCalendarFile * kkf = mCalendars.first(); 524 KopiCalendarFile * kkf = mCalendars.first();
524 while ( kkf ) { 525 while ( kkf ) {
525 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal); 526 //qDebug("cal num %d %d ", kkf->mCalNumber, numCal);
526 if ( kkf->mCalNumber == numCal ) { 527 if ( kkf->mCalNumber == numCal ) {
527 ++writeCal; 528 ++writeCal;
528 //qDebug("Write calendar %d %d ", numCal , writeCal); 529 //qDebug("Write calendar %d %d ", numCal , writeCal);
529 QString prefix = "Cal_" + QString::number( writeCal ); 530 QString prefix = "Cal_" + QString::number( writeCal );
530 fc.writeEntry( prefix+"_isStandard", kkf->isStandard ); 531 fc.writeEntry( prefix+"_isStandard", kkf->isStandard );
531 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled ); 532 fc.writeEntry( prefix+"_isEnabled", kkf->isEnabled );
532 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled ); 533 fc.writeEntry( prefix+"_isAlarmEnabled", kkf->isAlarmEnabled );
533 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly ); 534 fc.writeEntry( prefix+"_isReadOnly", kkf->isReadOnly );
534 fc.writeEntry( prefix+"_Name", kkf->mName); 535 fc.writeEntry( prefix+"_Name", kkf->mName);
535 fc.writeEntry( prefix+"_FileName", kkf->mFileName); 536 fc.writeEntry( prefix+"_FileName", kkf->mFileName);
536 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor); 537 fc.writeEntry( prefix+"_Color",kkf->mDefaultColor);
537 } 538 }
538 kkf = mCalendars.next(); 539 kkf = mCalendars.next();
539 } 540 }
540 ++numCal; 541 ++numCal;
541 } 542 }
542 fc.sync(); 543 fc.sync();
543 KPimPrefs::usrWriteConfig(); 544 KPimPrefs::usrWriteConfig();
544} 545}
545 546
546void KOPrefs::setCategoryColor(QString cat,const QColor & color) 547void KOPrefs::setCategoryColor(QString cat,const QColor & color)
547{ 548{
548 mCategoryColors.replace(cat,new QColor(color)); 549 mCategoryColors.replace(cat,new QColor(color));
549} 550}
550 551
551QColor *KOPrefs::categoryColor(QString cat) 552QColor *KOPrefs::categoryColor(QString cat)
552{ 553{
553 QColor *color = 0; 554 QColor *color = 0;
554 555
555 if (!cat.isEmpty()) color = mCategoryColors[cat]; 556 if (!cat.isEmpty()) color = mCategoryColors[cat];
556 557
557 if (color) return color; 558 if (color) return color;
558 else return &mDefaultCategoryColor; 559 else return &mDefaultCategoryColor;
559} 560}
560 561
561void KOPrefs::setFullName(const QString &name) 562void KOPrefs::setFullName(const QString &name)
562{ 563{
563 mName = name; 564 mName = name;
564} 565}
565 566
566void KOPrefs::setEmail(const QString &email) 567void KOPrefs::setEmail(const QString &email)
567{ 568{
568 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); 569 //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() );
569 mEmail = email; 570 mEmail = email;
570} 571}
571 572
572QString KOPrefs::fullName() 573QString KOPrefs::fullName()
573{ 574{
574 if (mEmailControlCenter) { 575 if (mEmailControlCenter) {
575 KEMailSettings settings; 576 KEMailSettings settings;
576 return settings.getSetting(KEMailSettings::RealName); 577 return settings.getSetting(KEMailSettings::RealName);
577 } else { 578 } else {
578 return mName; 579 return mName;
579 } 580 }
580} 581}
581 582
582QString KOPrefs::email() 583QString KOPrefs::email()
583{ 584{
584 if (mEmailControlCenter) { 585 if (mEmailControlCenter) {
585 KEMailSettings settings; 586 KEMailSettings settings;
586 return settings.getSetting(KEMailSettings::EmailAddress); 587 return settings.getSetting(KEMailSettings::EmailAddress);
587 } else { 588 } else {
588 return mEmail; 589 return mEmail;
589 } 590 }
590} 591}
591KConfig* KOPrefs::getConfig() 592KConfig* KOPrefs::getConfig()
592{ 593{
593 return config(); 594 return config();
594} 595}
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 3ee9a22..35a56ca 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1084,456 +1084,455 @@ void KOPrefsDialog::setupFontsTab()
1084 topLayout->addWidget(tVFont->preview(),i,1); 1084 topLayout->addWidget(tVFont->preview(),i,1);
1085 topLayout->addWidget(tVFont->button(),i,2); 1085 topLayout->addWidget(tVFont->button(),i,2);
1086 ++i; 1086 ++i;
1087 KPrefsDialogWidFont *agendaViewFont = 1087 KPrefsDialogWidFont *agendaViewFont =
1088 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1088 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1089 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1089 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1090 topLayout->addWidget(agendaViewFont->label(),i,0); 1090 topLayout->addWidget(agendaViewFont->label(),i,0);
1091 topLayout->addWidget(agendaViewFont->preview(),i,1); 1091 topLayout->addWidget(agendaViewFont->preview(),i,1);
1092 topLayout->addWidget(agendaViewFont->button(),i,2); 1092 topLayout->addWidget(agendaViewFont->button(),i,2);
1093 ++i; 1093 ++i;
1094 1094
1095 1095
1096 KPrefsDialogWidFont *monthViewFont = 1096 KPrefsDialogWidFont *monthViewFont =
1097 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1097 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1098 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1098 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1099 topLayout->addWidget(monthViewFont->label(),i,0); 1099 topLayout->addWidget(monthViewFont->label(),i,0);
1100 topLayout->addWidget(monthViewFont->preview(),i,1); 1100 topLayout->addWidget(monthViewFont->preview(),i,1);
1101 topLayout->addWidget(monthViewFont->button(),i,2); 1101 topLayout->addWidget(monthViewFont->button(),i,2);
1102 ++i; 1102 ++i;
1103 1103
1104 1104
1105 KPrefsDialogWidFont *lVFont = 1105 KPrefsDialogWidFont *lVFont =
1106 addWidFont(i18n("Event"),i18n("List View:"), 1106 addWidFont(i18n("Event"),i18n("List View:"),
1107 &(KOPrefs::instance()->mListViewFont),topFrame); 1107 &(KOPrefs::instance()->mListViewFont),topFrame);
1108 topLayout->addWidget(lVFont->label(),i,0); 1108 topLayout->addWidget(lVFont->label(),i,0);
1109 topLayout->addWidget(lVFont->preview(),i,1); 1109 topLayout->addWidget(lVFont->preview(),i,1);
1110 topLayout->addWidget(lVFont->button(),i,2); 1110 topLayout->addWidget(lVFont->button(),i,2);
1111 ++i; 1111 ++i;
1112 1112
1113 1113
1114 tVFont = 1114 tVFont =
1115 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1115 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1116 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1116 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1117 topLayout->addWidget(tVFont->label(),i,0); 1117 topLayout->addWidget(tVFont->label(),i,0);
1118 topLayout->addWidget(tVFont->preview(),i,1); 1118 topLayout->addWidget(tVFont->preview(),i,1);
1119 topLayout->addWidget(tVFont->button(),i,2); 1119 topLayout->addWidget(tVFont->button(),i,2);
1120 ++i; 1120 ++i;
1121 1121
1122 1122
1123 tVFont = 1123 tVFont =
1124 addWidFont(i18n("Today"),i18n("JournalView:"), 1124 addWidFont(i18n("Today"),i18n("JournalView:"),
1125 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1125 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1126 topLayout->addWidget(tVFont->label(),i,0); 1126 topLayout->addWidget(tVFont->label(),i,0);
1127 topLayout->addWidget(tVFont->preview(),i,1); 1127 topLayout->addWidget(tVFont->preview(),i,1);
1128 topLayout->addWidget(tVFont->button(),i,2); 1128 topLayout->addWidget(tVFont->button(),i,2);
1129 ++i; 1129 ++i;
1130 1130
1131 1131
1132 1132
1133 1133
1134 topLayout->setColStretch(1,1); 1134 topLayout->setColStretch(1,1);
1135 topLayout->setRowStretch(4,1); 1135 topLayout->setRowStretch(4,1);
1136 1136
1137 1137
1138 1138
1139 1139
1140} 1140}
1141 1141
1142void KOPrefsDialog::setupColorsTab() 1142void KOPrefsDialog::setupColorsTab()
1143{ 1143{
1144 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1144 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1145 // DesktopIcon("colorize",KIcon::SizeMedium)); 1145 // DesktopIcon("colorize",KIcon::SizeMedium));
1146 1146
1147 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1147 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1148 // topLayout->setSpacing(mSpacingHint); 1148 // topLayout->setSpacing(mSpacingHint);
1149 // topLayout->setMargin(mMarginHint); 1149 // topLayout->setMargin(mMarginHint);
1150 1150
1151 topLayout->setSpacing(2); 1151 topLayout->setSpacing(2);
1152 topLayout->setMargin(3); 1152 topLayout->setMargin(3);
1153 1153
1154 int ii = 1; 1154 int ii = 1;
1155 QGroupBox *categoryGroup ; 1155 QGroupBox *categoryGroup ;
1156 1156
1157 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1157 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1158 topFrame); 1158 topFrame);
1159 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1159 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1160 1160
1161 mCategoryCombo = new QComboBox(categoryGroup); 1161 mCategoryCombo = new QComboBox(categoryGroup);
1162 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1162 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1163 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1163 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1164 1164
1165 mCategoryButton = new KColorButton(categoryGroup); 1165 mCategoryButton = new KColorButton(categoryGroup);
1166 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1166 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1167 updateCategoryColor(); 1167 updateCategoryColor();
1168 1168
1169 1169
1170 // Holiday Color 1170 // Holiday Color
1171 1171
1172 KPrefsDialogWidColor *holidayColor = 1172 KPrefsDialogWidColor *holidayColor =
1173 addWidColor(i18n("Holiday color:"), 1173 addWidColor(i18n("Holiday color:"),
1174 &(KOPrefs::instance()->mHolidayColor),topFrame); 1174 &(KOPrefs::instance()->mHolidayColor),topFrame);
1175 topLayout->addWidget(holidayColor->label(),ii,0); 1175 topLayout->addWidget(holidayColor->label(),ii,0);
1176 topLayout->addWidget(holidayColor->button(),ii++,1); 1176 topLayout->addWidget(holidayColor->button(),ii++,1);
1177 1177
1178 // Highlight Color 1178 // Highlight Color
1179 KPrefsDialogWidColor *highlightColor = 1179 KPrefsDialogWidColor *highlightColor =
1180 addWidColor(i18n("Highlight color:"), 1180 addWidColor(i18n("Highlight color:"),
1181 &(KOPrefs::instance()->mHighlightColor),topFrame); 1181 &(KOPrefs::instance()->mHighlightColor),topFrame);
1182 topLayout->addWidget(highlightColor->label(),ii,0); 1182 topLayout->addWidget(highlightColor->label(),ii,0);
1183 topLayout->addWidget(highlightColor->button(),ii++,1); 1183 topLayout->addWidget(highlightColor->button(),ii++,1);
1184 1184
1185 // Event color 1185 // Event color
1186 KPrefsDialogWidColor *eventColor = 1186 KPrefsDialogWidColor *eventColor =
1187 addWidColor(i18n("Default event color:"), 1187 addWidColor(i18n("Default event color:"),
1188 &(KOPrefs::instance()->mEventColor),topFrame); 1188 &(KOPrefs::instance()->mEventColor),topFrame);
1189 topLayout->addWidget(eventColor->label(),ii,0); 1189 topLayout->addWidget(eventColor->label(),ii,0);
1190 topLayout->addWidget(eventColor->button(),ii++,1); 1190 topLayout->addWidget(eventColor->button(),ii++,1);
1191 eventColor = 1191 eventColor =
1192 addWidColor(i18n("Default todo done color:"), 1192 addWidColor(i18n("Default todo done color:"),
1193 &(KOPrefs::instance()->mTodoDoneColor),topFrame); 1193 &(KOPrefs::instance()->mTodoDoneColor),topFrame);
1194 topLayout->addWidget(eventColor->label(),ii,0); 1194 topLayout->addWidget(eventColor->label(),ii,0);
1195 topLayout->addWidget(eventColor->button(),ii++,1); 1195 topLayout->addWidget(eventColor->button(),ii++,1);
1196 1196
1197 if ( QApplication::desktop()->height() <= 240 ) { 1197 if ( QApplication::desktop()->height() <= 240 ) {
1198 topFrame = addPage(i18n("Colors") +" 2",0,0); 1198 topFrame = addPage(i18n("Colors") +" 2",0,0);
1199 // DesktopIcon("colorize",KIcon::SizeMedium)); 1199 // DesktopIcon("colorize",KIcon::SizeMedium));
1200 1200
1201 topLayout = new QGridLayout(topFrame,5,2); 1201 topLayout = new QGridLayout(topFrame,5,2);
1202 // topLayout->setSpacing(mSpacingHint); 1202 // topLayout->setSpacing(mSpacingHint);
1203 // topLayout->setMargin(mMarginHint); 1203 // topLayout->setMargin(mMarginHint);
1204 1204
1205 topLayout->setSpacing(2); 1205 topLayout->setSpacing(2);
1206 topLayout->setMargin(3); 1206 topLayout->setMargin(3);
1207 } 1207 }
1208 1208
1209 1209
1210 // agenda view background color 1210 // agenda view background color
1211 KPrefsDialogWidColor *agendaBgColor = 1211 KPrefsDialogWidColor *agendaBgColor =
1212 addWidColor(i18n("Agenda view background color:"), 1212 addWidColor(i18n("Agenda view background color:"),
1213 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1213 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1214 topLayout->addWidget(agendaBgColor->label(),ii,0); 1214 topLayout->addWidget(agendaBgColor->label(),ii,0);
1215 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1215 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1216 1216
1217 // working hours color 1217 // working hours color
1218 KPrefsDialogWidColor *workingHoursColor = 1218 KPrefsDialogWidColor *workingHoursColor =
1219 addWidColor(i18n("Working hours color:"), 1219 addWidColor(i18n("Working hours color:"),
1220 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1220 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1221 topLayout->addWidget(workingHoursColor->label(),ii,0); 1221 topLayout->addWidget(workingHoursColor->label(),ii,0);
1222 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1222 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1223 1223
1224 KPrefsDialogWidBool *sb = 1224 KPrefsDialogWidBool *sb =
1225 addWidBool(i18n("Use colors for application:"), 1225 addWidBool(i18n("Use colors for application:"),
1226 &(KOPrefs::instance()->mUseAppColors),topFrame); 1226 &(KOPrefs::instance()->mUseAppColors),topFrame);
1227 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1227 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1228 1228
1229 ii++; 1229 ii++;
1230 KPrefsDialogWidColor * workingHoursColor1 = 1230 KPrefsDialogWidColor * workingHoursColor1 =
1231 addWidColor(i18n("Buttons, menus, etc.:"), 1231 addWidColor(i18n("Buttons, menus, etc.:"),
1232 &(KOPrefs::instance()->mAppColor1),topFrame); 1232 &(KOPrefs::instance()->mAppColor1),topFrame);
1233 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1233 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1234 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1234 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1235 1235
1236 KPrefsDialogWidColor * workingHoursColor2 = 1236 KPrefsDialogWidColor * workingHoursColor2 =
1237 addWidColor(i18n("Frames, labels, etc.:"), 1237 addWidColor(i18n("Frames, labels, etc.:"),
1238 &(KOPrefs::instance()->mAppColor2),topFrame); 1238 &(KOPrefs::instance()->mAppColor2),topFrame);
1239 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1239 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1240 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1240 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1241 1241
1242 1242
1243 1243
1244} 1244}
1245 1245
1246void KOPrefsDialog::setCategoryColor() 1246void KOPrefsDialog::setCategoryColor()
1247{ 1247{
1248 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1248 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1249} 1249}
1250 1250
1251void KOPrefsDialog::updateCategoryColor() 1251void KOPrefsDialog::updateCategoryColor()
1252{ 1252{
1253 QString cat = mCategoryCombo->currentText(); 1253 QString cat = mCategoryCombo->currentText();
1254 QColor *color = mCategoryDict.find(cat); 1254 QColor *color = mCategoryDict.find(cat);
1255 if (!color) { 1255 if (!color) {
1256 color = KOPrefs::instance()->categoryColor(cat); 1256 color = KOPrefs::instance()->categoryColor(cat);
1257 } 1257 }
1258 if (color) { 1258 if (color) {
1259 mCategoryButton->setColor(*color); 1259 mCategoryButton->setColor(*color);
1260 } 1260 }
1261} 1261}
1262 1262
1263void KOPrefsDialog::setupPrinterTab() 1263void KOPrefsDialog::setupPrinterTab()
1264{ 1264{
1265 mPrinterTab = addPage(i18n("Printing"),0, 1265 mPrinterTab = addPage(i18n("Printing"),0,
1266 DesktopIcon("fileprint",KIcon::SizeMedium)); 1266 DesktopIcon("fileprint",KIcon::SizeMedium));
1267 1267
1268 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1268 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1269 topLayout->setSpacing(mSpacingHint); 1269 topLayout->setSpacing(mSpacingHint);
1270 topLayout->setMargin(mMarginHint); 1270 topLayout->setMargin(mMarginHint);
1271 1271
1272 topLayout->setRowStretch(4,1); 1272 topLayout->setRowStretch(4,1);
1273} 1273}
1274 1274
1275void KOPrefsDialog::setupGroupSchedulingTab() 1275void KOPrefsDialog::setupGroupSchedulingTab()
1276{ 1276{
1277#if 0 1277#if 0
1278 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1278 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1279 DesktopIcon("personal",KIcon::SizeMedium)); 1279 DesktopIcon("personal",KIcon::SizeMedium));
1280 1280
1281 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1281 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1282 topLayout->setSpacing(mSpacingHint); 1282 topLayout->setSpacing(mSpacingHint);
1283 topLayout->setMargin(mMarginHint); 1283 topLayout->setMargin(mMarginHint);
1284 1284
1285#if 0 1285#if 0
1286 KPrefsDialogWidRadios *schedulerGroup = 1286 KPrefsDialogWidRadios *schedulerGroup =
1287 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1287 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1288 topFrame); 1288 topFrame);
1289 schedulerGroup->addRadio("Dummy"); // Only for debugging 1289 schedulerGroup->addRadio("Dummy"); // Only for debugging
1290 schedulerGroup->addRadio(i18n("Mail client")); 1290 schedulerGroup->addRadio(i18n("Mail client"));
1291 1291
1292 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1292 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1293#endif 1293#endif
1294 1294
1295 KPrefsDialogWidRadios *sendGroup = 1295 KPrefsDialogWidRadios *sendGroup =
1296 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1296 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1297 topFrame); 1297 topFrame);
1298 sendGroup->addRadio(i18n("Send to outbox")); 1298 sendGroup->addRadio(i18n("Send to outbox"));
1299 sendGroup->addRadio(i18n("Send directly")); 1299 sendGroup->addRadio(i18n("Send directly"));
1300 1300
1301 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1301 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1302 1302
1303 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1303 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1304 mAMails = new QListView(topFrame); 1304 mAMails = new QListView(topFrame);
1305 mAMails->addColumn(i18n("Email"),300); 1305 mAMails->addColumn(i18n("Email"),300);
1306 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1306 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1307 1307
1308 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1308 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1309 aEmailsEdit = new QLineEdit(topFrame); 1309 aEmailsEdit = new QLineEdit(topFrame);
1310 aEmailsEdit->setEnabled(false); 1310 aEmailsEdit->setEnabled(false);
1311 topLayout->addWidget(aEmailsEdit,4,1); 1311 topLayout->addWidget(aEmailsEdit,4,1);
1312 1312
1313 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1313 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1314 topLayout->addWidget(add,5,0); 1314 topLayout->addWidget(add,5,0);
1315 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1315 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1316 topLayout->addWidget(del,5,1); 1316 topLayout->addWidget(del,5,1);
1317 1317
1318 //topLayout->setRowStretch(2,1); 1318 //topLayout->setRowStretch(2,1);
1319 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1319 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1320 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1320 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1321 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1321 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1322 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1322 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1323#endif 1323#endif
1324} 1324}
1325 1325
1326void KOPrefsDialog::setupGroupAutomationTab() 1326void KOPrefsDialog::setupGroupAutomationTab()
1327{ 1327{
1328 return; 1328 return;
1329 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1329 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1330 DesktopIcon("personal",KIcon::SizeMedium)); 1330 DesktopIcon("personal",KIcon::SizeMedium));
1331 1331
1332 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1332 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1333 topLayout->setSpacing(mSpacingHint); 1333 topLayout->setSpacing(mSpacingHint);
1334 topLayout->setMargin(mMarginHint); 1334 topLayout->setMargin(mMarginHint);
1335 1335
1336 KPrefsDialogWidRadios *autoRefreshGroup = 1336 KPrefsDialogWidRadios *autoRefreshGroup =
1337 addWidRadios(i18n("Auto Send Refresh"), 1337 addWidRadios(i18n("Auto Send Refresh"),
1338 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1338 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1339 autoRefreshGroup->addRadio(i18n("Never")); 1339 autoRefreshGroup->addRadio(i18n("Never"));
1340 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1340 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1341 //autoRefreshGroup->addRadio(i18n("selected emails")); 1341 //autoRefreshGroup->addRadio(i18n("selected emails"));
1342 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1342 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1343 1343
1344 KPrefsDialogWidRadios *autoInsertGroup = 1344 KPrefsDialogWidRadios *autoInsertGroup =
1345 addWidRadios(i18n("Auto Insert IMIP Replies"), 1345 addWidRadios(i18n("Auto Insert IMIP Replies"),
1346 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1346 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1347 autoInsertGroup->addRadio(i18n("Never")); 1347 autoInsertGroup->addRadio(i18n("Never"));
1348 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1348 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1349 //autoInsertGroup->addRadio(i18n("selected emails")); 1349 //autoInsertGroup->addRadio(i18n("selected emails"));
1350 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1350 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1351 1351
1352 KPrefsDialogWidRadios *autoRequestGroup = 1352 KPrefsDialogWidRadios *autoRequestGroup =
1353 addWidRadios(i18n("Auto Insert IMIP Requests"), 1353 addWidRadios(i18n("Auto Insert IMIP Requests"),
1354 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1354 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1355 autoRequestGroup->addRadio(i18n("Never")); 1355 autoRequestGroup->addRadio(i18n("Never"));
1356 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1356 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1357 //autoInsertGroup->addRadio(i18n("selected emails")); 1357 //autoInsertGroup->addRadio(i18n("selected emails"));
1358 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1358 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1359 1359
1360 KPrefsDialogWidRadios *autoFreeBusyGroup = 1360 KPrefsDialogWidRadios *autoFreeBusyGroup =
1361 addWidRadios(i18n("Auto Send FreeBusy Information"), 1361 addWidRadios(i18n("Auto Send FreeBusy Information"),
1362 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1362 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1363 autoFreeBusyGroup->addRadio(i18n("Never")); 1363 autoFreeBusyGroup->addRadio(i18n("Never"));
1364 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1364 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1365 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1365 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1366 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1366 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1367 1367
1368 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1368 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1369 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1369 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1370 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1370 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1371 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1371 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1372 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1372 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1373 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1373 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1374 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1374 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1375} 1375}
1376 1376
1377void KOPrefsDialog::showPrinterTab() 1377void KOPrefsDialog::showPrinterTab()
1378{ 1378{
1379 showPage(pageIndex(mPrinterTab)); 1379 showPage(pageIndex(mPrinterTab));
1380} 1380}
1381 1381
1382 1382
1383void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1383void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1384 const QStringList *tags) 1384 const QStringList *tags)
1385{ 1385{
1386 if (tags) { 1386 if (tags) {
1387 int i = tags->findIndex(text); 1387 int i = tags->findIndex(text);
1388 if (i > 0) combo->setCurrentItem(i); 1388 if (i > 0) combo->setCurrentItem(i);
1389 } else { 1389 } else {
1390 for(int i=0;i<combo->count();++i) { 1390 for(int i=0;i<combo->count();++i) {
1391 if (combo->text(i) == text) { 1391 if (combo->text(i) == text) {
1392 combo->setCurrentItem(i); 1392 combo->setCurrentItem(i);
1393 break; 1393 break;
1394 } 1394 }
1395 } 1395 }
1396 } 1396 }
1397} 1397}
1398 1398
1399void KOPrefsDialog::usrReadConfig() 1399void KOPrefsDialog::usrReadConfig()
1400{ 1400{
1401 1401
1402 mNameEdit->setText(KOPrefs::instance()->fullName()); 1402 mNameEdit->setText(KOPrefs::instance()->fullName());
1403 mEmailEdit->setText(KOPrefs::instance()->email()); 1403 mEmailEdit->setText(KOPrefs::instance()->email());
1404 1404
1405 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1405 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1406 1406
1407 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1407 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1408 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1408 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1409 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1409 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1410 1410
1411 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1411 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1412 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1412 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1413 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1413 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1414 // mAMails->clear(); 1414 // mAMails->clear();
1415 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1415 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1416// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1416// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1417// QListViewItem *item = new QListViewItem(mAMails); 1417// QListViewItem *item = new QListViewItem(mAMails);
1418// item->setText(0,*it); 1418// item->setText(0,*it);
1419// mAMails->insertItem(item); 1419// mAMails->insertItem(item);
1420// } 1420// }
1421 1421
1422 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1422 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1423 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1423 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1424 updateCategories(); 1424 updateCategories();
1425 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1425 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1426 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1426 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1427 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1427 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1428 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1428 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1429 1429
1430} 1430}
1431 1431
1432 1432
1433void KOPrefsDialog::usrWriteConfig() 1433void KOPrefsDialog::usrWriteConfig()
1434{ 1434{
1435 1435
1436 1436
1437 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1437 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1438 KOPrefs::instance()->setFullName(mNameEdit->text()); 1438 KOPrefs::instance()->setFullName(mNameEdit->text());
1439 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1439 KOPrefs::instance()->setEmail(mEmailEdit->text());
1440 1440
1441 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1441 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1442 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1442 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1443 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1443 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1444 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1444 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1445 1445
1446 QDictIterator<QColor> it(mCategoryDict); 1446 QDictIterator<QColor> it(mCategoryDict);
1447 while (it.current()) { 1447 while (it.current()) {
1448 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1448 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1449 ++it; 1449 ++it;
1450 } 1450 }
1451 1451
1452 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1452 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1453 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1453 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1454 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1454 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1455 1455
1456 KOPrefs::instance()->mAdditionalMails.clear(); 1456 KOPrefs::instance()->mAdditionalMails.clear();
1457 // QListViewItem *item; 1457 // QListViewItem *item;
1458 // item = mAMails->firstChild(); 1458 // item = mAMails->firstChild();
1459 // while (item) 1459 // while (item)
1460 // { 1460 // {
1461 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1461 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1462 // item = item->nextSibling(); 1462 // item = item->nextSibling();
1463 // } 1463 // }
1464 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1464 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1465 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1465 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1466 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1466 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1467 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1467 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1468
1469} 1468}
1470 1469
1471void KOPrefsDialog::updateCategories() 1470void KOPrefsDialog::updateCategories()
1472{ 1471{
1473 mCategoryCombo->clear(); 1472 mCategoryCombo->clear();
1474 mCategoryDict.clear(); 1473 mCategoryDict.clear();
1475 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1474 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1476 updateCategoryColor(); 1475 updateCategoryColor();
1477} 1476}
1478 1477
1479void KOPrefsDialog::toggleEmailSettings(bool on) 1478void KOPrefsDialog::toggleEmailSettings(bool on)
1480{ 1479{
1481 if (on) { 1480 if (on) {
1482 mEmailEdit->setEnabled(false); 1481 mEmailEdit->setEnabled(false);
1483 mNameEdit->setEnabled(false); 1482 mNameEdit->setEnabled(false);
1484 mEmailLabel->setEnabled(false); 1483 mEmailLabel->setEnabled(false);
1485 mNameLabel->setEnabled(false); 1484 mNameLabel->setEnabled(false);
1486 1485
1487 KEMailSettings settings; 1486 KEMailSettings settings;
1488 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1487 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1489 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1488 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1490 } else { 1489 } else {
1491 mEmailEdit->setEnabled(true); 1490 mEmailEdit->setEnabled(true);
1492 mNameEdit->setEnabled(true); 1491 mNameEdit->setEnabled(true);
1493 mEmailLabel->setEnabled(true); 1492 mEmailLabel->setEnabled(true);
1494 mNameLabel->setEnabled(true); 1493 mNameLabel->setEnabled(true);
1495 } 1494 }
1496} 1495}
1497 1496
1498void KOPrefsDialog::addItem() 1497void KOPrefsDialog::addItem()
1499{ 1498{
1500 // aEmailsEdit->setEnabled(true); 1499 // aEmailsEdit->setEnabled(true);
1501// QListViewItem *item = new QListViewItem(mAMails); 1500// QListViewItem *item = new QListViewItem(mAMails);
1502// mAMails->insertItem(item); 1501// mAMails->insertItem(item);
1503// mAMails->setSelected(item,true); 1502// mAMails->setSelected(item,true);
1504// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1503// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1505} 1504}
1506 1505
1507void KOPrefsDialog::removeItem() 1506void KOPrefsDialog::removeItem()
1508{ 1507{
1509// QListViewItem *item; 1508// QListViewItem *item;
1510// item = mAMails->selectedItem(); 1509// item = mAMails->selectedItem();
1511// if (!item) return; 1510// if (!item) return;
1512// mAMails->takeItem(item); 1511// mAMails->takeItem(item);
1513// item = mAMails->selectedItem(); 1512// item = mAMails->selectedItem();
1514// if (!item) { 1513// if (!item) {
1515// aEmailsEdit->setText(""); 1514// aEmailsEdit->setText("");
1516// aEmailsEdit->setEnabled(false); 1515// aEmailsEdit->setEnabled(false);
1517// } 1516// }
1518// if (mAMails->childCount() == 0) { 1517// if (mAMails->childCount() == 0) {
1519// aEmailsEdit->setEnabled(false); 1518// aEmailsEdit->setEnabled(false);
1520// } 1519// }
1521} 1520}
1522 1521
1523void KOPrefsDialog::updateItem() 1522void KOPrefsDialog::updateItem()
1524{ 1523{
1525 // QListViewItem *item; 1524 // QListViewItem *item;
1526// item = mAMails->selectedItem(); 1525// item = mAMails->selectedItem();
1527// if (!item) return; 1526// if (!item) return;
1528// item->setText(0,aEmailsEdit->text()); 1527// item->setText(0,aEmailsEdit->text());
1529} 1528}
1530 1529
1531void KOPrefsDialog::updateInput() 1530void KOPrefsDialog::updateInput()
1532{ 1531{
1533// QListViewItem *item; 1532// QListViewItem *item;
1534// item = mAMails->selectedItem(); 1533// item = mAMails->selectedItem();
1535// if (!item) return; 1534// if (!item) return;
1536// aEmailsEdit->setEnabled(true); 1535// aEmailsEdit->setEnabled(true);
1537// aEmailsEdit->setText(item->text(0)); 1536// aEmailsEdit->setText(item->text(0));
1538} 1537}
1539 1538