author | Michael Krelin <hacker@klever.net> | 2008-01-28 23:33:00 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-01-28 23:33:00 (UTC) |
commit | 64a94e6b6ee261c21c68709134631a16b39a0256 (patch) (unidiff) | |
tree | 12e7693f1b665711c3487ae2779b2469ea8e1499 | |
parent | 1c5369f3785b118ff4d18c4940913b800dd201fb (diff) | |
download | kdepimpi-master.zip kdepimpi-master.tar.gz kdepimpi-master.tar.bz2 |
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | korganizer/koagendaitem.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 0f9a38f..d38cb00 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -59,129 +59,130 @@ extern int globalFlagBlockAgendaItemUpdate; | |||
59 | 59 | ||
60 | #include "koagendaitem.h" | 60 | #include "koagendaitem.h" |
61 | //#include "koagendaitem.moc" | 61 | //#include "koagendaitem.moc" |
62 | 62 | ||
63 | 63 | ||
64 | //-------------------------------------------------------------------------- | 64 | //-------------------------------------------------------------------------- |
65 | 65 | ||
66 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 66 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
67 | 67 | ||
68 | //-------------------------------------------------------------------------- | 68 | //-------------------------------------------------------------------------- |
69 | 69 | ||
70 | class KOAgendaItemWhatsThis :public Q3WhatsThis | 70 | class KOAgendaItemWhatsThis :public Q3WhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { }; | 73 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { }; |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | virtual QString text( const QPoint& ) | 76 | virtual QString text( const QPoint& ) |
77 | { | 77 | { |
78 | return _view->getWhatsThisText() ; | 78 | return _view->getWhatsThisText() ; |
79 | } | 79 | } |
80 | private: | 80 | private: |
81 | KOAgendaItem * _view; | 81 | KOAgendaItem * _view; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 84 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
85 | const char *name,Qt::WFlags) : | 85 | const char *name,Qt::WFlags) : |
86 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 86 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
87 | { | 87 | { |
88 | #ifndef DESKTOP_VERSION | 88 | #ifndef DESKTOP_VERSION |
89 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 89 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
90 | #endif | 90 | #endif |
91 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); | 91 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); |
92 | Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase | 92 | Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase |
93 | setWindowFlags ( wflags); | 93 | setWindowFlags ( wflags); |
94 | mAllDay = allday; | 94 | mAllDay = allday; |
95 | init ( incidence, qd ); | 95 | init ( incidence, qd ); |
96 | //setMouseTracking(true); | 96 | //setMouseTracking(true); |
97 | //setAcceptDrops(true); | 97 | //setAcceptDrops(true); |
98 | xPaintCoord = -1; | 98 | xPaintCoord = -1; |
99 | yPaintCoord = -1; | 99 | yPaintCoord = -1; |
100 | } | 100 | } |
101 | QString KOAgendaItem::getWhatsThisText() | 101 | QString KOAgendaItem::getWhatsThisText() |
102 | { | 102 | { |
103 | if ( mIncidence ) | 103 | if ( mIncidence ) |
104 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 104 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
105 | KOPrefs::instance()->mWTshowDetails, | 105 | KOPrefs::instance()->mWTshowDetails, |
106 | KOPrefs::instance()->mWTshowCreated, | 106 | KOPrefs::instance()->mWTshowCreated, |
107 | KOPrefs::instance()->mWTshowChanged); | 107 | KOPrefs::instance()->mWTshowChanged); |
108 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 108 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
109 | } | 109 | } |
110 | 110 | ||
111 | void KOAgendaItem::initColor () | 111 | void KOAgendaItem::initColor () |
112 | { | 112 | { |
113 | if ( (mIncidence->typeID() == todoID ) && | 113 | if ( (mIncidence->typeID() == todoID ) && |
114 | ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && | 114 | ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && |
115 | ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 115 | ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
116 | if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date()) | 116 | if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date()) |
117 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 117 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
118 | else | 118 | else |
119 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 119 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
120 | } | 120 | } |
121 | else { | 121 | else { |
122 | QStringList categories = mIncidence->categories(); | 122 | QStringList categories = mIncidence->categories(); |
123 | QString cat = categories.first(); | 123 | QString cat; |
124 | if(!categories.isEmpty()) cat = categories.first(); | ||
124 | if (cat.isEmpty()) { | 125 | if (cat.isEmpty()) { |
125 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) | 126 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) |
126 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 127 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
127 | else | 128 | else |
128 | mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); | 129 | mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
129 | } else { | 130 | } else { |
130 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 131 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
131 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { | 132 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { |
132 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 133 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
133 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; | 134 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; |
134 | } | 135 | } |
135 | } | 136 | } |
136 | 137 | ||
137 | } | 138 | } |
138 | 139 | ||
139 | QColor BackgroundColor ( mBackgroundColor ); | 140 | QColor BackgroundColor ( mBackgroundColor ); |
140 | if ( mIncidence->calID() > 1 ) { | 141 | if ( mIncidence->calID() > 1 ) { |
141 | //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); | 142 | //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
142 | } | 143 | } |
143 | mColorGroup = QColorGroup( BackgroundColor.light(), | 144 | mColorGroup = QColorGroup( BackgroundColor.light(), |
144 | BackgroundColor.dark(),BackgroundColor.light(), | 145 | BackgroundColor.dark(),BackgroundColor.light(), |
145 | BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ; | 146 | BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ; |
146 | setBackgroundColor( mBackgroundColor ); | 147 | setBackgroundColor( mBackgroundColor ); |
147 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); | 148 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); |
148 | } | 149 | } |
149 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 150 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
150 | { | 151 | { |
151 | mIncidence = incidence; | 152 | mIncidence = incidence; |
152 | mDate = qd; | 153 | mDate = qd; |
153 | mFirstMultiItem = 0; | 154 | mFirstMultiItem = 0; |
154 | mNextMultiItem = 0; | 155 | mNextMultiItem = 0; |
155 | mLastMultiItem = 0; | 156 | mLastMultiItem = 0; |
156 | computeText(); | 157 | computeText(); |
157 | initColor(); | 158 | initColor(); |
158 | mConflictItems.clear(); | 159 | mConflictItems.clear(); |
159 | setCellXY(0,0,1); | 160 | setCellXY(0,0,1); |
160 | setCellXWidth(0); | 161 | setCellXWidth(0); |
161 | setSubCell(0); | 162 | setSubCell(0); |
162 | setSubCells(1); | 163 | setSubCells(1); |
163 | setMultiItem(0,0,0); | 164 | setMultiItem(0,0,0); |
164 | startMove(); | 165 | startMove(); |
165 | mSelected = true; | 166 | mSelected = true; |
166 | select(false); | 167 | select(false); |
167 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 168 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
168 | mFontPixelSize = fontinf.height();; | 169 | mFontPixelSize = fontinf.height();; |
169 | hide(); | 170 | hide(); |
170 | xPaintCoord = -1; | 171 | xPaintCoord = -1; |
171 | yPaintCoord = -1; | 172 | yPaintCoord = -1; |
172 | } | 173 | } |
173 | 174 | ||
174 | 175 | ||
175 | KOAgendaItem::~KOAgendaItem() | 176 | KOAgendaItem::~KOAgendaItem() |
176 | { | 177 | { |
177 | #if QT_VERSION >= 0x030000 | 178 | #if QT_VERSION >= 0x030000 |
178 | 179 | ||
179 | #else | 180 | #else |
180 | delete mKOAgendaItemWhatsThis; | 181 | delete mKOAgendaItemWhatsThis; |
181 | #endif | 182 | #endif |
182 | 183 | ||
183 | } | 184 | } |
184 | 185 | ||
185 | void KOAgendaItem::recreateIncidence() | 186 | void KOAgendaItem::recreateIncidence() |
186 | { | 187 | { |
187 | #if 0 | 188 | #if 0 |