-rw-r--r-- | korganizer/kodaymatrix.cpp | 30 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 17 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 4 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 1 |
6 files changed, 39 insertions, 21 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ca896b5..549ef2a 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -212,7 +212,6 @@ void KODayMatrix::updateView() | |||
212 | } | 212 | } |
213 | void KODayMatrix::repaintViewTimed() | 213 | void KODayMatrix::repaintViewTimed() |
214 | { | 214 | { |
215 | qDebug("KODayMatrix::repaintViewTimed "); | ||
216 | mRepaintTimer->stop(); | 215 | mRepaintTimer->stop(); |
217 | repaint(false); | 216 | repaint(false); |
218 | } | 217 | } |
@@ -220,35 +219,29 @@ void KODayMatrix::updateViewTimed() | |||
220 | { | 219 | { |
221 | 220 | ||
222 | mUpdateTimer->stop(); | 221 | mUpdateTimer->stop(); |
223 | qDebug("KODayMatrix::updateView(QDate actdate)"); | ||
224 | for(int i = 0; i < NUMDAYS; i++) { | 222 | for(int i = 0; i < NUMDAYS; i++) { |
225 | |||
226 | // if events are set for the day then remember to draw it bold | 223 | // if events are set for the day then remember to draw it bold |
227 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 224 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
228 | Event *event; | 225 | Event *event; |
229 | int numEvents = eventlist.count(); | 226 | int numEvents = eventlist.count(); |
230 | 227 | QString holiStr = ""; | |
231 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 228 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
232 | ushort recurType = event->recurrence()->doesRecur(); | 229 | ushort recurType = event->recurrence()->doesRecur(); |
233 | |||
234 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 230 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
235 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 231 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
236 | numEvents--; | 232 | numEvents--; |
237 | } | 233 | } |
234 | if ( event->categories().contains( i18n("Holiday") ) || event->categories().contains( "Holiday" )) { | ||
235 | if ( !holiStr.isEmpty() ) | ||
236 | holiStr += "\n"; | ||
237 | holiStr += event->summary(); | ||
238 | } | ||
238 | } | 239 | } |
239 | events[i] = numEvents; | 240 | events[i] = numEvents; |
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 | ||
243 | QString holiStr = KOCore::self()->holiday(days[i]); | ||
244 | #else | ||
245 | QString holiStr = QString::null; | ||
246 | #endif | ||
247 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 242 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
248 | !holiStr.isEmpty()) { | 243 | !holiStr.isEmpty()) { |
249 | if (holiStr.isNull()) holiStr = ""; | ||
250 | mHolidays[i] = holiStr; | 244 | mHolidays[i] = holiStr; |
251 | |||
252 | } else { | 245 | } else { |
253 | mHolidays[i] = QString::null; | 246 | mHolidays[i] = QString::null; |
254 | } | 247 | } |
@@ -288,7 +281,7 @@ void KODayMatrix::updateView(QDate actdate) | |||
288 | mDayChanged = true; | 281 | mDayChanged = true; |
289 | recalculateToday(); | 282 | recalculateToday(); |
290 | } | 283 | } |
291 | qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 284 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
292 | if ( !isVisible() ) { | 285 | if ( !isVisible() ) { |
293 | mPendingUpdateBeforeRepaint = true; | 286 | mPendingUpdateBeforeRepaint = true; |
294 | } else { | 287 | } else { |
@@ -487,12 +480,16 @@ void KODayMatrix::dropEvent(QDropEvent *e) | |||
487 | 480 | ||
488 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 481 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
489 | { | 482 | { |
490 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; | 483 | if ( width() <= 0 || height() <= 0 ) |
484 | return; | ||
491 | if ( mPendingUpdateBeforeRepaint ) { | 485 | if ( mPendingUpdateBeforeRepaint ) { |
492 | updateViewTimed(); | 486 | updateViewTimed(); |
493 | mPendingUpdateBeforeRepaint = false; | 487 | mPendingUpdateBeforeRepaint = false; |
494 | } | 488 | } |
495 | QPainter p(this); | 489 | if ( myPix.width() != width() || myPix.height()!=height() ) { |
490 | myPix.resize(size() ); | ||
491 | } | ||
492 | QPainter p(&myPix); | ||
496 | 493 | ||
497 | QRect sz = frameRect(); | 494 | QRect sz = frameRect(); |
498 | int dheight = daysize.height(); | 495 | int dheight = daysize.height(); |
@@ -616,6 +613,7 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
616 | p.setFont(myFont); | 613 | p.setFont(myFont); |
617 | } | 614 | } |
618 | } | 615 | } |
616 | bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); | ||
619 | } | 617 | } |
620 | 618 | ||
621 | // ---------------------------------------------------------------------------- | 619 | // ---------------------------------------------------------------------------- |
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index ac2f59c..2dd112a 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <qpen.h> | 31 | #include <qpen.h> |
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qtooltip.h> | 33 | #include <qtooltip.h> |
34 | #include <qpixmap.h> | ||
34 | 35 | ||
35 | #include <qmap.h> | 36 | #include <qmap.h> |
36 | 37 | ||
@@ -221,6 +222,7 @@ protected: | |||
221 | void resizeEvent(QResizeEvent *); | 222 | void resizeEvent(QResizeEvent *); |
222 | 223 | ||
223 | private: | 224 | private: |
225 | QPixmap myPix; | ||
224 | QTimer* mUpdateTimer; | 226 | QTimer* mUpdateTimer; |
225 | QTimer* mRepaintTimer; | 227 | QTimer* mRepaintTimer; |
226 | bool mDayChanged; | 228 | bool mDayChanged; |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4cff23a..6411156 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -976,8 +976,8 @@ void KOMonthView::updateView() | |||
976 | 976 | ||
977 | if ( !updatePossible ) | 977 | if ( !updatePossible ) |
978 | return; | 978 | return; |
979 | QTime ti; | 979 | //QTime ti; |
980 | ti.start(); | 980 | //ti.start(); |
981 | #if 1 | 981 | #if 1 |
982 | int i; | 982 | int i; |
983 | for( i = 0; i < mCells.count(); ++i ) { | 983 | for( i = 0; i < mCells.count(); ++i ) { |
@@ -1080,7 +1080,7 @@ void KOMonthView::updateView() | |||
1080 | mCells[0]->setFocus(); | 1080 | mCells[0]->setFocus(); |
1081 | #endif | 1081 | #endif |
1082 | 1082 | ||
1083 | qDebug("update time %d ", ti.elapsed()); | 1083 | //qDebug("update time %d ", ti.elapsed()); |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1086 | void KOMonthView::resizeEvent(QResizeEvent * e) |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 82437d8..99402c4 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -209,7 +209,11 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | |||
209 | #endif | 209 | #endif |
210 | QListView::contentsMousePressEvent(e); | 210 | QListView::contentsMousePressEvent(e); |
211 | } | 211 | } |
212 | 212 | void KOTodoListView::paintEvent(QPaintEvent* e) | |
213 | { | ||
214 | emit paintNeeded(); | ||
215 | QListView::paintEvent( e); | ||
216 | } | ||
213 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) | 217 | void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) |
214 | { | 218 | { |
215 | 219 | ||
@@ -501,6 +505,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
501 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 505 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
502 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 506 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
503 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 507 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
508 | connect( mTodoListView, SIGNAL( paintNeeded() ), | ||
509 | SLOT( paintNeeded()) ); | ||
504 | 510 | ||
505 | #if 0 | 511 | #if 0 |
506 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 512 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
@@ -534,6 +540,13 @@ void KOTodoView::jumpToDate () | |||
534 | // if ( mActiveItem->todo()->hasDueDate() ) | 540 | // if ( mActiveItem->todo()->hasDueDate() ) |
535 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 541 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
536 | } | 542 | } |
543 | void KOTodoView::paintNeeded() | ||
544 | { | ||
545 | if ( mPendingUpdateBeforeRepaint ) { | ||
546 | updateView(); | ||
547 | mPendingUpdateBeforeRepaint = false; | ||
548 | } | ||
549 | } | ||
537 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 550 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
538 | { | 551 | { |
539 | if ( mPendingUpdateBeforeRepaint ) { | 552 | if ( mPendingUpdateBeforeRepaint ) { |
@@ -542,7 +555,7 @@ void KOTodoView::paintEvent(QPaintEvent * pevent) | |||
542 | } | 555 | } |
543 | KOrg::BaseView::paintEvent( pevent); | 556 | KOrg::BaseView::paintEvent( pevent); |
544 | } | 557 | } |
545 | bool mPendingUpdateBeforeRepaint; | 558 | |
546 | void KOTodoView::updateView() | 559 | void KOTodoView::updateView() |
547 | { | 560 | { |
548 | pendingSubtodo = 0; | 561 | pendingSubtodo = 0; |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 16bc133..2a9e737 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -60,6 +60,7 @@ class KOTodoListView : public KListView | |||
60 | virtual ~KOTodoListView() {} | 60 | virtual ~KOTodoListView() {} |
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | void paintNeeded(); | ||
63 | void todoDropped(Todo *, int); | 64 | void todoDropped(Todo *, int); |
64 | void double_Clicked(QListViewItem *item); | 65 | void double_Clicked(QListViewItem *item); |
65 | void reparentTodoSignal( Todo *,Todo * ); | 66 | void reparentTodoSignal( Todo *,Todo * ); |
@@ -77,6 +78,7 @@ class KOTodoListView : public KListView | |||
77 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 78 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
78 | 79 | ||
79 | private: | 80 | private: |
81 | void paintEvent(QPaintEvent * pevent); | ||
80 | bool internalDrop; | 82 | bool internalDrop; |
81 | QString mName; | 83 | QString mName; |
82 | Calendar *mCalendar; | 84 | Calendar *mCalendar; |
@@ -198,6 +200,7 @@ class KOTodoView : public KOrg::BaseView | |||
198 | void purgeCompletedSignal(); | 200 | void purgeCompletedSignal(); |
199 | 201 | ||
200 | protected slots: | 202 | protected slots: |
203 | void paintNeeded(); | ||
201 | void processSelectionChange(); | 204 | void processSelectionChange(); |
202 | void addQuickTodo(); | 205 | void addQuickTodo(); |
203 | void setTodoModified( Todo* ); | 206 | void setTodoModified( Todo* ); |
@@ -213,6 +216,7 @@ class KOTodoView : public KOrg::BaseView | |||
213 | * 3. add a private method for setting a todo modified + friend here? | 216 | * 3. add a private method for setting a todo modified + friend here? |
214 | * -- zecke 2002-07-08 | 217 | * -- zecke 2002-07-08 |
215 | */ | 218 | */ |
219 | friend class KOTodoListView; | ||
216 | void paintEvent(QPaintEvent * pevent); | 220 | void paintEvent(QPaintEvent * pevent); |
217 | bool mPendingUpdateBeforeRepaint; | 221 | bool mPendingUpdateBeforeRepaint; |
218 | friend class KOTodoViewItem; | 222 | friend class KOTodoViewItem; |
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 30f5fb1..188ad23 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -604,6 +604,7 @@ void KOViewManager::showJournalView() | |||
604 | } | 604 | } |
605 | 605 | ||
606 | showView(mJournalView); | 606 | showView(mJournalView); |
607 | mMainView->dateNavigator()->selectDates( 1 ); | ||
607 | } | 608 | } |
608 | 609 | ||
609 | void KOViewManager::showTimeSpanView() | 610 | void KOViewManager::showTimeSpanView() |