summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (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
@@ -38,195 +38,200 @@
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
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index 52bc463..a653c18 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -251,170 +251,170 @@ void KOCalEditView::infoCal( int id )
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
@@ -637,281 +637,285 @@ void MonthViewCell::startUpdateCell()
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 }
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index e679bd3..65f0342 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -404,191 +404,192 @@ QStringList KOPrefs::getDefaultList()
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
@@ -1372,168 +1372,167 @@ void KOPrefsDialog::setupGroupAutomationTab()
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