-rw-r--r-- | korganizer/koagendaitem.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index ee9f39a..a05c60e 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -49,100 +49,108 @@ extern int globalFlagBlockAgendaItemUpdate; | |||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
60 | const char *name,WFlags) : | 60 | const char *name,WFlags) : |
61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
62 | { | 62 | { |
63 | #ifndef DESKTOP_VERSION | 63 | #ifndef DESKTOP_VERSION |
64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
65 | #endif | 65 | #endif |
66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
67 | setWFlags ( wflags); | 67 | setWFlags ( wflags); |
68 | mAllDay = allday; | 68 | mAllDay = allday; |
69 | init ( incidence, qd ); | 69 | init ( incidence, qd ); |
70 | setMouseTracking(true); | 70 | setMouseTracking(true); |
71 | //setAcceptDrops(true); | 71 | //setAcceptDrops(true); |
72 | xPaintCoord = -1; | 72 | xPaintCoord = -1; |
73 | yPaintCoord = -1; | 73 | yPaintCoord = -1; |
74 | } | 74 | } |
75 | 75 | ||
76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
77 | { | 77 | { |
78 | mIncidence = incidence; | 78 | mIncidence = incidence; |
79 | mDate = qd; | 79 | mDate = qd; |
80 | mFirstMultiItem = 0; | 80 | mFirstMultiItem = 0; |
81 | mNextMultiItem = 0; | 81 | mNextMultiItem = 0; |
82 | mLastMultiItem = 0; | 82 | mLastMultiItem = 0; |
83 | computeText(); | 83 | computeText(); |
84 | 84 | ||
85 | if ( (incidence->type() == "Todo") && | 85 | if ( (incidence->type() == "Todo") && |
86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
90 | else | 90 | else |
91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | QStringList categories = mIncidence->categories(); | 94 | QStringList categories = mIncidence->categories(); |
95 | QString cat = categories.first(); | 95 | QString cat = categories.first(); |
96 | if (cat.isEmpty()) { | 96 | if (cat.isEmpty()) { |
97 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 97 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
98 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | ||
99 | else | ||
100 | mBackgroundColor =KOPrefs::instance()->mEventColor; | ||
98 | } else { | 101 | } else { |
99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 102 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
103 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | ||
104 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | ||
105 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | ||
106 | } | ||
100 | } | 107 | } |
108 | |||
101 | } | 109 | } |
102 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 110 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
103 | mBackgroundColor.dark(),mBackgroundColor.light(), | 111 | mBackgroundColor.dark(),mBackgroundColor.light(), |
104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 112 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
105 | setBackgroundColor( mBackgroundColor ); | 113 | setBackgroundColor( mBackgroundColor ); |
106 | 114 | ||
107 | setCellXY(0,0,1); | 115 | setCellXY(0,0,1); |
108 | setCellXWidth(0); | 116 | setCellXWidth(0); |
109 | setSubCell(0); | 117 | setSubCell(0); |
110 | setSubCells(1); | 118 | setSubCells(1); |
111 | setMultiItem(0,0,0); | 119 | setMultiItem(0,0,0); |
112 | startMove(); | 120 | startMove(); |
113 | mSelected = true; | 121 | mSelected = true; |
114 | select(false); | 122 | select(false); |
115 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 123 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
116 | mFontPixelSize = fontinf.height();; | 124 | mFontPixelSize = fontinf.height();; |
117 | hide(); | 125 | hide(); |
118 | xPaintCoord = -1; | 126 | xPaintCoord = -1; |
119 | yPaintCoord = -1; | 127 | yPaintCoord = -1; |
120 | } | 128 | } |
121 | 129 | ||
122 | 130 | ||
123 | KOAgendaItem::~KOAgendaItem() | 131 | KOAgendaItem::~KOAgendaItem() |
124 | { | 132 | { |
125 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 133 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
126 | 134 | ||
127 | } | 135 | } |
128 | 136 | ||
129 | void KOAgendaItem::recreateIncidence() | 137 | void KOAgendaItem::recreateIncidence() |
130 | { | 138 | { |
131 | #if 0 | 139 | #if 0 |
132 | Incidence* newInc = mIncidence->clone(); | 140 | Incidence* newInc = mIncidence->clone(); |
133 | newInc->recreate(); | 141 | newInc->recreate(); |
134 | if ( mIncidence->doesRecur() ) { | 142 | if ( mIncidence->doesRecur() ) { |
135 | mIncidence->addExDate( mDate ); | 143 | mIncidence->addExDate( mDate ); |
136 | newInc->recurrence()->unsetRecurs(); | 144 | newInc->recurrence()->unsetRecurs(); |
137 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 145 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
138 | QTime tim = mIncidence->dtStart().time(); | 146 | QTime tim = mIncidence->dtStart().time(); |
139 | newInc->setDtStart( QDateTime(mDate, tim) ); | 147 | newInc->setDtStart( QDateTime(mDate, tim) ); |
140 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 148 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
141 | } | 149 | } |
142 | #endif | 150 | #endif |
143 | mIncidence = mIncidence->recreateCloneException( mDate ); | 151 | mIncidence = mIncidence->recreateCloneException( mDate ); |
144 | } | 152 | } |
145 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 153 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
146 | { | 154 | { |
147 | int size = AGENDA_ICON_SIZE; | 155 | int size = AGENDA_ICON_SIZE; |
148 | 156 | ||