summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-31 09:21:57 (UTC)
committer zautrix <zautrix>2005-01-31 09:21:57 (UTC)
commit1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd (patch) (unidiff)
treedd55b89fd37ffb8a880c175c5237f5ca57ca6d4c
parent9b13105b4cc0ede4ca2d01a3d998fdb90bf67b58 (diff)
downloadkdepimpi-1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd.zip
kdepimpi-1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd.tar.gz
kdepimpi-1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd.tar.bz2
fix
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp12
-rw-r--r--korganizer/kotodoviewitem.cpp4
2 files changed, 10 insertions, 6 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 9812321..ca896b5 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -191,57 +191,57 @@ void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
191void KODayMatrix::recalculateToday() 191void KODayMatrix::recalculateToday()
192{ 192{
193 today = -1; 193 today = -1;
194 for (int i=0; i<NUMDAYS; i++) { 194 for (int i=0; i<NUMDAYS; i++) {
195 events[i] = 0; 195 events[i] = 0;
196 days[i] = startdate.addDays(i); 196 days[i] = startdate.addDays(i);
197 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 197 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
198 198
199 // if today is in the currently displayed month, hilight today 199 // if today is in the currently displayed month, hilight today
200 if (days[i].year() == QDate::currentDate().year() && 200 if (days[i].year() == QDate::currentDate().year() &&
201 days[i].month() == QDate::currentDate().month() && 201 days[i].month() == QDate::currentDate().month() &&
202 days[i].day() == QDate::currentDate().day()) { 202 days[i].day() == QDate::currentDate().day()) {
203 today = i; 203 today = i;
204 } 204 }
205 } 205 }
206 // qDebug(QString("Today is visible at %1.").arg(today)); 206 // qDebug(QString("Today is visible at %1.").arg(today));
207} 207}
208 208
209void KODayMatrix::updateView() 209void KODayMatrix::updateView()
210{ 210{
211 updateView(startdate); 211 updateView(startdate);
212} 212}
213void KODayMatrix::repaintViewTimed() 213void KODayMatrix::repaintViewTimed()
214{ 214{
215 //qDebug("KODayMatrix::repaintViewTimed "); 215 qDebug("KODayMatrix::repaintViewTimed ");
216 mRepaintTimer->stop(); 216 mRepaintTimer->stop();
217 repaint(false); 217 repaint(false);
218} 218}
219void KODayMatrix::updateViewTimed() 219void KODayMatrix::updateViewTimed()
220{ 220{
221 221
222 mUpdateTimer->stop(); 222 mUpdateTimer->stop();
223 //qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); 223 qDebug("KODayMatrix::updateView(QDate actdate)");
224 for(int i = 0; i < NUMDAYS; i++) { 224 for(int i = 0; i < NUMDAYS; i++) {
225 225
226 // if events are set for the day then remember to draw it bold 226 // if events are set for the day then remember to draw it bold
227 QPtrList<Event> eventlist = mCalendar->events(days[i]); 227 QPtrList<Event> eventlist = mCalendar->events(days[i]);
228 Event *event; 228 Event *event;
229 int numEvents = eventlist.count(); 229 int numEvents = eventlist.count();
230 230
231 for(event=eventlist.first();event != 0;event=eventlist.next()) { 231 for(event=eventlist.first();event != 0;event=eventlist.next()) {
232 ushort recurType = event->recurrence()->doesRecur(); 232 ushort recurType = event->recurrence()->doesRecur();
233 233
234 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 234 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
235 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 235 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
236 numEvents--; 236 numEvents--;
237 } 237 }
238 } 238 }
239 events[i] = numEvents; 239 events[i] = numEvents;
240 240
241 //if it is a holy day then draw it red. Sundays are consider holidays, too 241 //if it is a holy day then draw it red. Sundays are consider holidays, too
242#ifndef KORG_NOPLUGINS 242#ifndef KORG_NOPLUGINS
243 QString holiStr = KOCore::self()->holiday(days[i]); 243 QString holiStr = KOCore::self()->holiday(days[i]);
244#else 244#else
245 QString holiStr = QString::null; 245 QString holiStr = QString::null;
246#endif 246#endif
247 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 247 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
@@ -267,58 +267,58 @@ void KODayMatrix::updateView(QDate actdate)
267 //flag to indicate if the starting day of the matrix has changed by this call 267 //flag to indicate if the starting day of the matrix has changed by this call
268 //mDayChanged = false; 268 //mDayChanged = false;
269 // if a new startdate is to be set then apply Cornelius's calculation 269 // if a new startdate is to be set then apply Cornelius's calculation
270 // of the first day to be shown 270 // of the first day to be shown
271 if (actdate != startdate) { 271 if (actdate != startdate) {
272 // reset index of selection according to shift of starting date from startdate to actdate 272 // reset index of selection according to shift of starting date from startdate to actdate
273 if (mSelStart != NOSELECTION) { 273 if (mSelStart != NOSELECTION) {
274 int tmp = actdate.daysTo(startdate); 274 int tmp = actdate.daysTo(startdate);
275 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; 275 //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl;
276 // shift selection if new one would be visible at least partly ! 276 // shift selection if new one would be visible at least partly !
277 277
278 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { 278 if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) {
279 // nested if is required for next X display pushed from a different month - correction required 279 // nested if is required for next X display pushed from a different month - correction required
280 // otherwise, for month forward and backward, it must be avoided 280 // otherwise, for month forward and backward, it must be avoided
281 if( mSelStart > NUMDAYS || mSelStart < 0 ) 281 if( mSelStart > NUMDAYS || mSelStart < 0 )
282 mSelStart = mSelStart + tmp; 282 mSelStart = mSelStart + tmp;
283 if( mSelEnd > NUMDAYS || mSelEnd < 0 ) 283 if( mSelEnd > NUMDAYS || mSelEnd < 0 )
284 mSelEnd = mSelEnd + tmp; 284 mSelEnd = mSelEnd + tmp;
285 } 285 }
286 } 286 }
287 startdate = actdate; 287 startdate = actdate;
288 mDayChanged = true; 288 mDayChanged = true;
289 recalculateToday(); 289 recalculateToday();
290 } 290 }
291 //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); 291 qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() );
292 if ( !isVisible() ) { 292 if ( !isVisible() ) {
293 mPendingUpdateBeforeRepaint = true; 293 mPendingUpdateBeforeRepaint = true;
294 } else { 294 } else {
295#ifdef DESKTOP_VERSION 295#ifdef DESKTOP_VERSION
296 mRepaintTimer->start( 250 ); 296 //mRepaintTimer->start( 250 );
297 mUpdateTimer->start( 2000 ); 297 mUpdateTimer->start( 250 );
298#else 298#else
299 mRepaintTimer->start( 350 ); 299 mRepaintTimer->start( 350 );
300 mUpdateTimer->start( 4000 ); 300 mUpdateTimer->start( 2000 );
301#endif 301#endif
302 } 302 }
303} 303}
304 304
305const QDate& KODayMatrix::getDate(int offset) 305const QDate& KODayMatrix::getDate(int offset)
306{ 306{
307 if (offset < 0 || offset > NUMDAYS-1) { 307 if (offset < 0 || offset > NUMDAYS-1) {
308 qDebug("Wrong offset2 "); 308 qDebug("Wrong offset2 ");
309 return days[0]; 309 return days[0];
310 } 310 }
311 return days[offset]; 311 return days[offset];
312} 312}
313 313
314QString KODayMatrix::getHolidayLabel(int offset) 314QString KODayMatrix::getHolidayLabel(int offset)
315{ 315{
316 if (offset < 0 || offset > NUMDAYS-1) { 316 if (offset < 0 || offset > NUMDAYS-1) {
317 qDebug("Wrong offset1 "); 317 qDebug("Wrong offset1 ");
318 return 0; 318 return 0;
319 } 319 }
320 return mHolidays[offset]; 320 return mHolidays[offset];
321} 321}
322 322
323int KODayMatrix::getDayIndexFrom(int x, int y) 323int KODayMatrix::getDayIndexFrom(int x, int y)
324{ 324{
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 1edddac..6bdee18 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -187,48 +187,52 @@ void KOTodoViewItem::setMyPixmap()
187 pixi.resize(size, pixSize+size); 187 pixi.resize(size, pixSize+size);
188 pPix.fill( Qt::red ); 188 pPix.fill( Qt::red );
189 p.begin( &pixi ); 189 p.begin( &pixi );
190 p. drawPixmap ( 0, pixSize, pPix); 190 p. drawPixmap ( 0, pixSize, pPix);
191 p.end(); 191 p.end();
192 pixSize += size; 192 pixSize += size;
193 } 193 }
194 // } 194 // }
195 if ( pixi.width() > 1 ) { 195 if ( pixi.width() > 1 ) {
196 setPixmap ( 0,pixi ) ; 196 setPixmap ( 0,pixi ) ;
197 } else { 197 } else {
198 setPixmap ( 0,QPixmap() ) ; 198 setPixmap ( 0,QPixmap() ) ;
199 } 199 }
200} 200}
201void KOTodoViewItem::stateChange(bool state) 201void KOTodoViewItem::stateChange(bool state)
202{ 202{
203 // qDebug("KOTodoViewItem::stateChange "); 203 // qDebug("KOTodoViewItem::stateChange ");
204 // do not change setting on startup 204 // do not change setting on startup
205 if ( m_init ) return; 205 if ( m_init ) return;
206 if (isOn()!=state) { 206 if (isOn()!=state) {
207 setOn(state); 207 setOn(state);
208 //qDebug("SETON "); 208 //qDebug("SETON ");
209 return; 209 return;
210 } 210 }
211 if ( mTodo->isCompleted() == state ) {
212 //qDebug("STATECHANGE:nothing to do ");
213 return;
214 }
211 QString keyd = "=="; 215 QString keyd = "==";
212 QString keyt = "=="; 216 QString keyt = "==";
213 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); 217 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1());
214 mTodo->setCompleted(state); 218 mTodo->setCompleted(state);
215 if (state) mTodo->setCompleted(QDateTime::currentDateTime()); 219 if (state) mTodo->setCompleted(QDateTime::currentDateTime());
216 220
217 if (mTodo->hasDueDate()) { 221 if (mTodo->hasDueDate()) {
218 setText(3, mTodo->dtDueDateStr()); 222 setText(3, mTodo->dtDueDateStr());
219 QDate d = mTodo->dtDue().date(); 223 QDate d = mTodo->dtDue().date();
220 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 224 keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
221 setSortKey(3,keyd); 225 setSortKey(3,keyd);
222 if (mTodo->doesFloat()) { 226 if (mTodo->doesFloat()) {
223 setText(4,""); 227 setText(4,"");
224 } 228 }
225 else { 229 else {
226 setText(4,mTodo->dtDueTimeStr()); 230 setText(4,mTodo->dtDueTimeStr());
227 QTime t = mTodo->dtDue().time(); 231 QTime t = mTodo->dtDue().time();
228 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 232 keyt.sprintf("%02d%02d",t.hour(),t.minute());
229 setSortKey(4,keyt); 233 setSortKey(4,keyt);
230 } 234 }
231 } 235 }
232 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 236 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);
233 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 237 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
234 238