author | zautrix <zautrix> | 2005-06-27 18:45:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-27 18:45:56 (UTC) |
commit | 427221638f1e652bd57a37835a1de0134266c3f7 (patch) (unidiff) | |
tree | 5ce070815756cdaccd6c2f0cd6a02e54a1052675 | |
parent | 2a6c47afc7688923f427f4a38e3353e3503ab09a (diff) | |
download | kdepimpi-427221638f1e652bd57a37835a1de0134266c3f7.zip kdepimpi-427221638f1e652bd57a37835a1de0134266c3f7.tar.gz kdepimpi-427221638f1e652bd57a37835a1de0134266c3f7.tar.bz2 |
fixx
-rw-r--r-- | korganizer/komonthview.cpp | 14 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9b0389d..00e5a6f 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -262,96 +262,108 @@ void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | |||
262 | { | 262 | { |
263 | switch(e->key()) { | 263 | switch(e->key()) { |
264 | case Key_Shift: | 264 | case Key_Shift: |
265 | emit shiftUp(); | 265 | emit shiftUp(); |
266 | break; | 266 | break; |
267 | default: | 267 | default: |
268 | break; | 268 | break; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 272 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
273 | { | 273 | { |
274 | QListBox::mousePressEvent(e); | 274 | QListBox::mousePressEvent(e); |
275 | 275 | ||
276 | if(e->button() == RightButton) { | 276 | if(e->button() == RightButton) { |
277 | emit rightClick(); | 277 | emit rightClick(); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 281 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
282 | : QListBoxItem() | 282 | : QListBoxItem() |
283 | { | 283 | { |
284 | mDisplayHightlighted = false; | 284 | mDisplayHightlighted = false; |
285 | mblockRepaint = true; | 285 | mblockRepaint = true; |
286 | setText( s ); | 286 | setText( s ); |
287 | mMultiday = 0; | 287 | mMultiday = 0; |
288 | mIncidence = incidence; | 288 | mIncidence = incidence; |
289 | mDate = qd; | 289 | mDate = qd; |
290 | mRecur = false; | 290 | mRecur = false; |
291 | mAlarm = false; | 291 | mAlarm = false; |
292 | mReply = false; | 292 | mReply = false; |
293 | mInfo = false; | 293 | mInfo = false; |
294 | mdayPos = 0; | 294 | mdayPos = 0; |
295 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 295 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
296 | } | 296 | } |
297 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | 297 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) |
298 | { | 298 | { |
299 | mDisplayHightlighted = false; | 299 | mDisplayHightlighted = false; |
300 | setText( s ); | 300 | setText( s ); |
301 | mMultiday = 0; | 301 | mMultiday = 0; |
302 | mIncidence = incidence; | 302 | mIncidence = incidence; |
303 | mDate = qd; | 303 | mDate = qd; |
304 | mRecur = false; | 304 | mRecur = false; |
305 | mAlarm = false; | 305 | mAlarm = false; |
306 | mReply = false; | 306 | mReply = false; |
307 | mInfo = false; | 307 | mInfo = false; |
308 | mdayPos = 0; | 308 | mdayPos = 0; |
309 | } | 309 | } |
310 | void MonthViewItem::clearData() | ||
311 | { | ||
312 | mDisplayHightlighted = false; | ||
313 | setText( "" ); | ||
314 | mMultiday = 0; | ||
315 | mIncidence = 0; | ||
316 | mRecur = false; | ||
317 | mAlarm = false; | ||
318 | mReply = false; | ||
319 | mInfo = false; | ||
320 | mdayPos = 0; | ||
321 | } | ||
310 | bool MonthViewItem::setHighlightedFalse() | 322 | bool MonthViewItem::setHighlightedFalse() |
311 | { | 323 | { |
312 | if ( !mDisplayHightlighted ) | 324 | if ( !mDisplayHightlighted ) |
313 | return false; | 325 | return false; |
314 | mDisplayHightlighted = false; | 326 | mDisplayHightlighted = false; |
315 | return true; | 327 | return true; |
316 | } | 328 | } |
317 | 329 | ||
318 | bool MonthViewItem::setHighlighted( Incidence * inc ) | 330 | bool MonthViewItem::setHighlighted( Incidence * inc ) |
319 | { | 331 | { |
320 | if ( inc == mIncidence ) { | 332 | if ( inc == mIncidence ) { |
321 | if ( mDisplayHightlighted ) | 333 | if ( mDisplayHightlighted ) |
322 | return false; | 334 | return false; |
323 | mDisplayHightlighted = true; | 335 | mDisplayHightlighted = true; |
324 | return true; | 336 | return true; |
325 | } else { | 337 | } else { |
326 | if ( !mDisplayHightlighted ) | 338 | if ( !mDisplayHightlighted ) |
327 | return false; | 339 | return false; |
328 | mDisplayHightlighted = false; | 340 | mDisplayHightlighted = false; |
329 | return true; | 341 | return true; |
330 | } | 342 | } |
331 | return false; | 343 | return false; |
332 | } | 344 | } |
333 | void MonthViewItem::paint(QPainter *p) | 345 | void MonthViewItem::paint(QPainter *p) |
334 | { | 346 | { |
335 | if ( mblockRepaint ) { | 347 | if ( mblockRepaint ) { |
336 | return; | 348 | return; |
337 | } | 349 | } |
338 | #if QT_VERSION >= 0x030000 | 350 | #if QT_VERSION >= 0x030000 |
339 | bool sel = isSelected(); | 351 | bool sel = isSelected(); |
340 | #else | 352 | #else |
341 | bool sel = selected(); | 353 | bool sel = selected(); |
342 | #endif | 354 | #endif |
343 | int heihei = height( listBox () ); | 355 | int heihei = height( listBox () ); |
344 | int x = 1; | 356 | int x = 1; |
345 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted ) | 357 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted ) |
346 | { | 358 | { |
347 | if ( mDisplayHightlighted ) | 359 | if ( mDisplayHightlighted ) |
348 | sel = true; | 360 | sel = true; |
349 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 361 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
350 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 362 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
351 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); | 363 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); |
352 | } | 364 | } |
353 | 365 | ||
354 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 366 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
355 | int size = PIXMAP_SIZE; | 367 | int size = PIXMAP_SIZE; |
356 | if ( QApplication::desktop()->width() < 300 ) | 368 | if ( QApplication::desktop()->width() < 300 ) |
357 | size = 3; | 369 | size = 3; |
@@ -610,96 +622,98 @@ bool MonthViewCell::isPrimary() const | |||
610 | return mPrimary; | 622 | return mPrimary; |
611 | } | 623 | } |
612 | 624 | ||
613 | void MonthViewCell::setHoliday( bool holiday ) | 625 | void MonthViewCell::setHoliday( bool holiday ) |
614 | { | 626 | { |
615 | mHoliday = holiday; | 627 | mHoliday = holiday; |
616 | //setMyPalette(); | 628 | //setMyPalette(); |
617 | } | 629 | } |
618 | 630 | ||
619 | void MonthViewCell::setHoliday( const QString &holiday ) | 631 | void MonthViewCell::setHoliday( const QString &holiday ) |
620 | { | 632 | { |
621 | mHolidayString = holiday; | 633 | mHolidayString = holiday; |
622 | 634 | ||
623 | if ( !holiday.isEmpty() ) { | 635 | if ( !holiday.isEmpty() ) { |
624 | setHoliday( true ); | 636 | setHoliday( true ); |
625 | } | 637 | } |
626 | } | 638 | } |
627 | 639 | ||
628 | void MonthViewCell::startUpdateCell() | 640 | void MonthViewCell::startUpdateCell() |
629 | { | 641 | { |
630 | 642 | ||
631 | mdayCount = 0; | 643 | mdayCount = 0; |
632 | setFocusPolicy(NoFocus); | 644 | setFocusPolicy(NoFocus); |
633 | if ( !mMonthView->isUpdatePossible() ) | 645 | if ( !mMonthView->isUpdatePossible() ) |
634 | return; | 646 | return; |
635 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 647 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
636 | while ( mitem ) { | 648 | while ( mitem ) { |
637 | mitem->setBlockRepaint( true ); | 649 | mitem->setBlockRepaint( true ); |
638 | mitem = (MonthViewItem *)mitem->next(); | 650 | mitem = (MonthViewItem *)mitem->next(); |
639 | } | 651 | } |
640 | if ( mAvailItemList.count() > 20 ) { | 652 | if ( mAvailItemList.count() > 20 ) { |
641 | mAvailItemList.setAutoDelete( true ); | 653 | mAvailItemList.setAutoDelete( true ); |
642 | mAvailItemList.clear(); | 654 | mAvailItemList.clear(); |
643 | mAvailItemList.setAutoDelete( false ); | 655 | mAvailItemList.setAutoDelete( false ); |
644 | clear(); | 656 | clear(); |
645 | } | 657 | } |
646 | 658 | ||
647 | setPrimary( mDate.month()%2 ); | 659 | setPrimary( mDate.month()%2 ); |
648 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 660 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
649 | if ( mDate == QDate::currentDate() ) { | 661 | if ( mDate == QDate::currentDate() ) { |
650 | setLineWidth( 3 ); | 662 | setLineWidth( 3 ); |
651 | } else { | 663 | } else { |
652 | setLineWidth( 1 ); | 664 | setLineWidth( 1 ); |
653 | } | 665 | } |
654 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); | 666 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); |
655 | //clear(); | 667 | //clear(); |
656 | while ( CurrentAvailItem ) { | 668 | while ( CurrentAvailItem ) { |
657 | MonthViewItem *item = CurrentAvailItem; | 669 | MonthViewItem *item = CurrentAvailItem; |
670 | //item->setHighlightedFalse(); | ||
671 | item->clearData(); | ||
658 | CurrentAvailItem = (MonthViewItem *)item->next(); | 672 | CurrentAvailItem = (MonthViewItem *)item->next(); |
659 | mAvailItemList.append( item ); | 673 | mAvailItemList.append( item ); |
660 | takeItem ( item ); | 674 | takeItem ( item ); |
661 | } | 675 | } |
662 | 676 | ||
663 | #ifdef DESKTOP_VERSION | 677 | #ifdef DESKTOP_VERSION |
664 | QToolTip::remove(this); | 678 | QToolTip::remove(this); |
665 | #endif | 679 | #endif |
666 | mToolTip.clear(); | 680 | mToolTip.clear(); |
667 | //qApp->processEvents(); | 681 | //qApp->processEvents(); |
668 | #if 0 | 682 | #if 0 |
669 | if ( !mHolidayString.isEmpty() ) { | 683 | if ( !mHolidayString.isEmpty() ) { |
670 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 684 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
671 | item->setPalette( mHolidayPalette ); | 685 | item->setPalette( mHolidayPalette ); |
672 | insertItem( item ); | 686 | insertItem( item ); |
673 | mToolTip.append ( mHolidayString ); | 687 | mToolTip.append ( mHolidayString ); |
674 | } | 688 | } |
675 | #endif | 689 | #endif |
676 | } | 690 | } |
677 | 691 | ||
678 | int MonthViewCell::insertEvent(Event *event) | 692 | int MonthViewCell::insertEvent(Event *event) |
679 | { | 693 | { |
680 | bool useToolTips = true; | 694 | bool useToolTips = true; |
681 | #ifndef DESKTOP_VERSION | 695 | #ifndef DESKTOP_VERSION |
682 | useToolTips = false; | 696 | useToolTips = false; |
683 | #endif | 697 | #endif |
684 | QString mToolTipText; | 698 | QString mToolTipText; |
685 | setFocusPolicy(WheelFocus); | 699 | setFocusPolicy(WheelFocus); |
686 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 700 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
687 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 701 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
688 | return mdayCount; | 702 | return mdayCount; |
689 | else | 703 | else |
690 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 704 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
691 | return mdayCount; | 705 | return mdayCount; |
692 | } | 706 | } |
693 | 707 | ||
694 | if ( event->isHoliday()) { | 708 | if ( event->isHoliday()) { |
695 | setHoliday( true ); | 709 | setHoliday( true ); |
696 | if ( mDate.dayOfWeek() == 7 ) | 710 | if ( mDate.dayOfWeek() == 7 ) |
697 | setLineWidth( 3 ); | 711 | setLineWidth( 3 ); |
698 | } | 712 | } |
699 | QString text; | 713 | QString text; |
700 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 714 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
701 | if (event->isMultiDay()) { | 715 | if (event->isMultiDay()) { |
702 | QString prefix = "<->";multiday = 2; | 716 | QString prefix = "<->";multiday = 2; |
703 | QString time; | 717 | QString time; |
704 | if ( event->doesRecur() ) { | 718 | if ( event->doesRecur() ) { |
705 | if ( event->recursOn( mDate) ) { | 719 | if ( event->recursOn( mDate) ) { |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 159af16..ac97860 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -62,96 +62,97 @@ class KOWeekButton : public QPushButton | |||
62 | void selectWeekNum ( int ); | 62 | void selectWeekNum ( int ); |
63 | private: | 63 | private: |
64 | void focusInEvent ( QFocusEvent * ){;} | 64 | void focusInEvent ( QFocusEvent * ){;} |
65 | int mNumber; | 65 | int mNumber; |
66 | void keyPressEvent ( QKeyEvent * e ) | 66 | void keyPressEvent ( QKeyEvent * e ) |
67 | { | 67 | { |
68 | e->ignore(); | 68 | e->ignore(); |
69 | } | 69 | } |
70 | 70 | ||
71 | private slots : | 71 | private slots : |
72 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 72 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
73 | }; | 73 | }; |
74 | 74 | ||
75 | class KNoScrollListBox: public QListBox | 75 | class KNoScrollListBox: public QListBox |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | public: | 78 | public: |
79 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 79 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
80 | ~KNoScrollListBox(); | 80 | ~KNoScrollListBox(); |
81 | QString getWhatsThisText(QPoint p) ; | 81 | QString getWhatsThisText(QPoint p) ; |
82 | 82 | ||
83 | signals: | 83 | signals: |
84 | void shiftDown(); | 84 | void shiftDown(); |
85 | void shiftUp(); | 85 | void shiftUp(); |
86 | void rightClick(); | 86 | void rightClick(); |
87 | void nextCell(); | 87 | void nextCell(); |
88 | void prevCell(); | 88 | void prevCell(); |
89 | void highligtIncidence( Incidence * , MonthViewCell*, int ); | 89 | void highligtIncidence( Incidence * , MonthViewCell*, int ); |
90 | 90 | ||
91 | protected slots: | 91 | protected slots: |
92 | void oneDown(); | 92 | void oneDown(); |
93 | void keyPressEvent(QKeyEvent *); | 93 | void keyPressEvent(QKeyEvent *); |
94 | void keyReleaseEvent(QKeyEvent *); | 94 | void keyReleaseEvent(QKeyEvent *); |
95 | void mousePressEvent(QMouseEvent *); | 95 | void mousePressEvent(QMouseEvent *); |
96 | void focusInEvent ( QFocusEvent * ); | 96 | void focusInEvent ( QFocusEvent * ); |
97 | void focusOutEvent ( QFocusEvent * ); | 97 | void focusOutEvent ( QFocusEvent * ); |
98 | 98 | ||
99 | private: | 99 | private: |
100 | bool resetOnFocusIn; | 100 | bool resetOnFocusIn; |
101 | KNOWhatsThis * mWT; | 101 | KNOWhatsThis * mWT; |
102 | }; | 102 | }; |
103 | 103 | ||
104 | 104 | ||
105 | class MonthViewItem: public QListBoxItem | 105 | class MonthViewItem: public QListBoxItem |
106 | { | 106 | { |
107 | public: | 107 | public: |
108 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 108 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
109 | void recycle( Incidence *incidence, QDate qd, const QString & s); | 109 | void recycle( Incidence *incidence, QDate qd, const QString & s); |
110 | void clearData(); | ||
110 | void setRecur(bool on) { mRecur = on; } | 111 | void setRecur(bool on) { mRecur = on; } |
111 | void setAlarm(bool on) { mAlarm = on; } | 112 | void setAlarm(bool on) { mAlarm = on; } |
112 | void setReply(bool on) { mReply = on; } | 113 | void setReply(bool on) { mReply = on; } |
113 | void setMoreInfo(bool on) { mInfo = on; } | 114 | void setMoreInfo(bool on) { mInfo = on; } |
114 | void setMultiDay(int type) { mMultiday = type; } | 115 | void setMultiDay(int type) { mMultiday = type; } |
115 | int multiDay() { return mMultiday; } | 116 | int multiDay() { return mMultiday; } |
116 | void setMultiDayPos(int type) { mdayPos = type; } | 117 | void setMultiDayPos(int type) { mdayPos = type; } |
117 | int gettMultiDayPos() { return mdayPos; } | 118 | int gettMultiDayPos() { return mdayPos; } |
118 | void setBlockRepaint(bool on) { mblockRepaint = on; } | 119 | void setBlockRepaint(bool on) { mblockRepaint = on; } |
119 | bool setHighlighted( Incidence * ); | 120 | bool setHighlighted( Incidence * ); |
120 | 121 | ||
121 | void setPalette(const QPalette &p) { mPalette = p; } | 122 | void setPalette(const QPalette &p) { mPalette = p; } |
122 | QPalette palette() const { return mPalette; } | 123 | QPalette palette() const { return mPalette; } |
123 | bool setHighlightedFalse(); | 124 | bool setHighlightedFalse(); |
124 | Incidence *incidence() const { return mIncidence; } | 125 | Incidence *incidence() const { return mIncidence; } |
125 | QDate incidenceDate() { return mDate; } | 126 | QDate incidenceDate() { return mDate; } |
126 | 127 | ||
127 | protected: | 128 | protected: |
128 | virtual void paint(QPainter *); | 129 | virtual void paint(QPainter *); |
129 | virtual int height(const QListBox *) const; | 130 | virtual int height(const QListBox *) const; |
130 | virtual int width(const QListBox *) const; | 131 | virtual int width(const QListBox *) const; |
131 | 132 | ||
132 | private: | 133 | private: |
133 | int mdayPos; | 134 | int mdayPos; |
134 | bool isWeekItem; | 135 | bool isWeekItem; |
135 | bool mblockRepaint; | 136 | bool mblockRepaint; |
136 | int mMultiday; | 137 | int mMultiday; |
137 | bool mRecur; | 138 | bool mRecur; |
138 | bool mAlarm; | 139 | bool mAlarm; |
139 | bool mReply; | 140 | bool mReply; |
140 | bool mInfo; | 141 | bool mInfo; |
141 | bool mDisplayHightlighted; | 142 | bool mDisplayHightlighted; |
142 | 143 | ||
143 | QPalette mPalette; | 144 | QPalette mPalette; |
144 | QDate mDate; | 145 | QDate mDate; |
145 | 146 | ||
146 | Incidence *mIncidence; | 147 | Incidence *mIncidence; |
147 | }; | 148 | }; |
148 | 149 | ||
149 | 150 | ||
150 | class KOMonthView; | 151 | class KOMonthView; |
151 | 152 | ||
152 | class MonthViewCell : public KNoScrollListBox | 153 | class MonthViewCell : public KNoScrollListBox |
153 | { | 154 | { |
154 | Q_OBJECT | 155 | Q_OBJECT |
155 | public: | 156 | public: |
156 | MonthViewCell(KOMonthView *,QWidget* ); | 157 | MonthViewCell(KOMonthView *,QWidget* ); |
157 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | 158 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} |