author | zautrix <zautrix> | 2005-02-19 15:39:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-19 15:39:43 (UTC) |
commit | 4858dcb045afc57ce98877cca787c4430146bea8 (patch) (unidiff) | |
tree | 9c9ea4b6d93a34d4bea97d7cea0b294c9c8665de | |
parent | d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3 (diff) | |
download | kdepimpi-4858dcb045afc57ce98877cca787c4430146bea8.zip kdepimpi-4858dcb045afc57ce98877cca787c4430146bea8.tar.gz kdepimpi-4858dcb045afc57ce98877cca787c4430146bea8.tar.bz2 |
multiday fixes in monthview
-rw-r--r-- | korganizer/komonthview.cpp | 91 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 |
2 files changed, 69 insertions, 24 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 2fe80af..f558084 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -31,706 +31,749 @@ | |||
31 | #include <qwhatsthis.h> | 31 | #include <qwhatsthis.h> |
32 | #ifndef DESKTOP_VERSION | 32 | #ifndef DESKTOP_VERSION |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #else | 34 | #else |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <klocale.h> | 39 | #include <klocale.h> |
40 | #include <kglobal.h> | 40 | #include <kglobal.h> |
41 | #include <kconfig.h> | 41 | #include <kconfig.h> |
42 | #include <kiconloader.h> | 42 | #include <kiconloader.h> |
43 | 43 | ||
44 | #include <kcalendarsystem.h> | 44 | #include <kcalendarsystem.h> |
45 | 45 | ||
46 | #ifndef KORG_NOPRINTER | 46 | #ifndef KORG_NOPRINTER |
47 | #include "calprinter.h" | 47 | #include "calprinter.h" |
48 | #endif | 48 | #endif |
49 | #include "koprefs.h" | 49 | #include "koprefs.h" |
50 | #ifndef KORG_NOPLUGINS | 50 | #ifndef KORG_NOPLUGINS |
51 | #include "kocore.h" | 51 | #include "kocore.h" |
52 | #endif | 52 | #endif |
53 | #include "koglobals.h" | 53 | #include "koglobals.h" |
54 | #include <libkcal/kincidenceformatter.h> | 54 | #include <libkcal/kincidenceformatter.h> |
55 | 55 | ||
56 | #include "komonthview.h" | 56 | #include "komonthview.h" |
57 | 57 | ||
58 | #define PIXMAP_SIZE 5 | 58 | #define PIXMAP_SIZE 5 |
59 | #ifdef DESKTOP_VERSION | 59 | #ifdef DESKTOP_VERSION |
60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; | 60 | QToolTipGroup *MonthViewCell::mToolTipGroup = 0; |
61 | #endif | 61 | #endif |
62 | class KNOWhatsThis :public QWhatsThis | 62 | class KNOWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 65 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; | 66 | //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p) | 69 | virtual QString text( const QPoint& p) |
70 | { | 70 | { |
71 | return _wid->getWhatsThisText(p) ; | 71 | return _wid->getWhatsThisText(p) ; |
72 | }; | 72 | }; |
73 | private: | 73 | private: |
74 | KNoScrollListBox* _wid; | 74 | KNoScrollListBox* _wid; |
75 | 75 | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | 78 | ||
79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 79 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
80 | : QListBox(parent, name, WRepaintNoErase) | 80 | : QListBox(parent, name, WRepaintNoErase) |
81 | { | 81 | { |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 83 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
84 | #endif | 84 | #endif |
85 | mWT = new KNOWhatsThis(this); | 85 | mWT = new KNOWhatsThis(this); |
86 | } | 86 | } |
87 | KNoScrollListBox::~KNoScrollListBox() | 87 | KNoScrollListBox::~KNoScrollListBox() |
88 | { | 88 | { |
89 | 89 | ||
90 | } | 90 | } |
91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 91 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
92 | { | 92 | { |
93 | QListBoxItem* item = itemAt ( p ); | 93 | QListBoxItem* item = itemAt ( p ); |
94 | if ( ! item ) { | 94 | if ( ! item ) { |
95 | return i18n("Click in the cell\nto add an event!"); | 95 | return i18n("Click in the cell\nto add an event!"); |
96 | } | 96 | } |
97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), | 97 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
98 | KOPrefs::instance()->mWTshowDetails, | 98 | KOPrefs::instance()->mWTshowDetails, |
99 | KOPrefs::instance()->mWTshowCreated, | 99 | KOPrefs::instance()->mWTshowCreated, |
100 | KOPrefs::instance()->mWTshowChanged); | 100 | KOPrefs::instance()->mWTshowChanged); |
101 | } | 101 | } |
102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
103 | { | 103 | { |
104 | 104 | ||
105 | switch(e->key()) { | 105 | switch(e->key()) { |
106 | case Key_Right: | 106 | case Key_Right: |
107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
108 | { | 108 | { |
109 | e->ignore(); | 109 | e->ignore(); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | scrollBy(10,0); | 112 | scrollBy(10,0); |
113 | break; | 113 | break; |
114 | case Key_Left: | 114 | case Key_Left: |
115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
116 | { | 116 | { |
117 | e->ignore(); | 117 | e->ignore(); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | scrollBy(-10,0); | 120 | scrollBy(-10,0); |
121 | break; | 121 | break; |
122 | case Key_Up: | 122 | case Key_Up: |
123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | setCurrentItem((currentItem()+count()-1)%count()); | 127 | setCurrentItem((currentItem()+count()-1)%count()); |
128 | if(!itemVisible(currentItem())) { | 128 | if(!itemVisible(currentItem())) { |
129 | if((unsigned int) currentItem() == (count()-1)) { | 129 | if((unsigned int) currentItem() == (count()-1)) { |
130 | setTopItem(currentItem()-numItemsVisible()+1); | 130 | setTopItem(currentItem()-numItemsVisible()+1); |
131 | } else { | 131 | } else { |
132 | setTopItem(topItem()-1); | 132 | setTopItem(topItem()-1); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | break; | 135 | break; |
136 | case Key_Down: | 136 | case Key_Down: |
137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
138 | e->ignore(); | 138 | e->ignore(); |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | setCurrentItem((currentItem()+1)%count()); | 141 | setCurrentItem((currentItem()+1)%count()); |
142 | if(!itemVisible(currentItem())) { | 142 | if(!itemVisible(currentItem())) { |
143 | if(currentItem() == 0) { | 143 | if(currentItem() == 0) { |
144 | setTopItem(0); | 144 | setTopItem(0); |
145 | } else { | 145 | } else { |
146 | setTopItem(topItem()+1); | 146 | setTopItem(topItem()+1); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | break; | 149 | break; |
150 | case Key_I: | 150 | case Key_I: |
151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
152 | e->ignore(); | 152 | e->ignore(); |
153 | break; | 153 | break; |
154 | case Key_Shift: | 154 | case Key_Shift: |
155 | emit shiftDown(); | 155 | emit shiftDown(); |
156 | break; | 156 | break; |
157 | default: | 157 | default: |
158 | e->ignore(); | 158 | e->ignore(); |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | void KNoScrollListBox::oneDown() | 163 | void KNoScrollListBox::oneDown() |
164 | { | 164 | { |
165 | setCurrentItem((currentItem()+1)%count()); | 165 | setCurrentItem((currentItem()+1)%count()); |
166 | if(!itemVisible(currentItem())) { | 166 | if(!itemVisible(currentItem())) { |
167 | if(currentItem() == 0) { | 167 | if(currentItem() == 0) { |
168 | setTopItem(0); | 168 | setTopItem(0); |
169 | } else { | 169 | } else { |
170 | setTopItem(topItem()+1); | 170 | setTopItem(topItem()+1); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
175 | { | 175 | { |
176 | switch(e->key()) { | 176 | switch(e->key()) { |
177 | case Key_Shift: | 177 | case Key_Shift: |
178 | emit shiftUp(); | 178 | emit shiftUp(); |
179 | break; | 179 | break; |
180 | default: | 180 | default: |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
186 | { | 186 | { |
187 | QListBox::mousePressEvent(e); | 187 | QListBox::mousePressEvent(e); |
188 | 188 | ||
189 | if(e->button() == RightButton) { | 189 | if(e->button() == RightButton) { |
190 | emit rightClick(); | 190 | emit rightClick(); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
195 | : QListBoxItem() | 195 | : QListBoxItem() |
196 | { | 196 | { |
197 | setText( s ); | 197 | setText( s ); |
198 | 198 | ||
199 | mIncidence = incidence; | 199 | mIncidence = incidence; |
200 | mDate = qd; | 200 | mDate = qd; |
201 | mRecur = false; | 201 | mRecur = false; |
202 | mAlarm = false; | 202 | mAlarm = false; |
203 | mReply = false; | 203 | mReply = false; |
204 | mInfo = false; | 204 | mInfo = false; |
205 | } | 205 | } |
206 | 206 | ||
207 | void MonthViewItem::paint(QPainter *p) | 207 | void MonthViewItem::paint(QPainter *p) |
208 | { | 208 | { |
209 | #if QT_VERSION >= 0x030000 | 209 | #if QT_VERSION >= 0x030000 |
210 | bool sel = isSelected(); | 210 | bool sel = isSelected(); |
211 | #else | 211 | #else |
212 | bool sel = selected(); | 212 | bool sel = selected(); |
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | 215 | ||
216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
217 | { | 217 | { |
218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
221 | } | 221 | } |
222 | int x = 1; | 222 | int x = 1; |
223 | int y = 3;//(height() - mRecurPixmap.height()) /2; | 223 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
224 | int size = PIXMAP_SIZE; | 224 | int size = PIXMAP_SIZE; |
225 | if ( QApplication::desktop()->width() < 300 ) | 225 | if ( QApplication::desktop()->width() < 300 ) |
226 | size = 3; | 226 | size = 3; |
227 | int y = (height( listBox () ) - size -1 ) /2; | ||
228 | |||
227 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 229 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
228 | if ( mInfo ) { | 230 | if ( mInfo ) { |
229 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 231 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
230 | x += size + 1; | 232 | x += size + 1; |
231 | } | 233 | } |
232 | if ( mRecur ) { | 234 | if ( mRecur ) { |
233 | p->fillRect ( x, y,size,size, Qt::blue ); | 235 | p->fillRect ( x, y,size,size, Qt::blue ); |
234 | x += size + 1; | 236 | x += size + 1; |
235 | } | 237 | } |
236 | if ( mAlarm ) { | 238 | if ( mAlarm ) { |
237 | p->fillRect ( x, y,size,size, Qt::red ); | 239 | p->fillRect ( x, y,size,size, Qt::red ); |
238 | x += size + 1; | 240 | x += size + 1; |
239 | } | 241 | } |
240 | if ( mReply ) { | 242 | if ( mReply ) { |
241 | p->fillRect ( x, y,size,size, Qt::yellow ); | 243 | p->fillRect ( x, y,size,size, Qt::yellow ); |
242 | x += size + 1; | 244 | x += size + 1; |
243 | } | 245 | } |
244 | } | 246 | } |
247 | if ( mMultiday ) { | ||
248 | int yyy = y+(size/2); | ||
249 | int sizeM = size+2; | ||
250 | p->setBrush( QBrush::SolidPattern ); | ||
251 | p->drawLine ( x+sizeM/2, yyy, x +sizeM +sizeM/2-2, yyy ) ; | ||
252 | if ( mMultiday == 2 || mMultiday == 3 ) { | ||
253 | QPointArray pa ( 3 ); | ||
254 | pa.setPoint (0, x, yyy ); | ||
255 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | ||
256 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | ||
257 | p->drawPolygon( pa ); | ||
258 | } | ||
259 | if ( mMultiday == 2 || mMultiday == 1 ) { | ||
260 | QPointArray pa ( 3 ); | ||
261 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | ||
262 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | ||
263 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | ||
264 | p->drawPolygon( pa ); | ||
265 | } | ||
266 | if ( mMultiday == 1 ) { | ||
267 | p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | ||
268 | |||
269 | } | ||
270 | if ( mMultiday == 3 ) { | ||
271 | p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | ||
272 | |||
273 | } | ||
274 | x += sizeM/2 + 1; | ||
275 | x += sizeM + 1; | ||
276 | } | ||
245 | QFontMetrics fm = p->fontMetrics(); | 277 | QFontMetrics fm = p->fontMetrics(); |
246 | int yPos; | 278 | int yPos; |
247 | int pmheight = size; | 279 | int pmheight = size; |
248 | if( pmheight < fm.height() ) | 280 | if( pmheight < fm.height() ) |
249 | yPos = fm.ascent() + fm.leading()/2; | 281 | yPos = fm.ascent() + fm.leading()/2; |
250 | else | 282 | else |
251 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 283 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
252 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 284 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
253 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 285 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
254 | p->drawText( x, yPos, text() ); | 286 | p->drawText( x, yPos, text() ); |
255 | if ( mIncidence->cancelled() ) { | 287 | if ( mIncidence->cancelled() ) { |
256 | int wid = fm.width( text() ); | 288 | int wid = fm.width( text() ); |
257 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); | 289 | p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); |
258 | } | 290 | } |
259 | 291 | ||
260 | } | 292 | } |
261 | 293 | ||
262 | int MonthViewItem::height(const QListBox *lb) const | 294 | int MonthViewItem::height(const QListBox *lb) const |
263 | { | 295 | { |
264 | return lb->fontMetrics().lineSpacing()+1; | 296 | if ( lb ) |
297 | return lb->fontMetrics().lineSpacing()+1; | ||
298 | return 10; | ||
265 | } | 299 | } |
266 | 300 | ||
267 | int MonthViewItem::width(const QListBox *lb) const | 301 | int MonthViewItem::width(const QListBox *lb) const |
268 | { | 302 | { |
269 | int size = PIXMAP_SIZE; | 303 | int size = PIXMAP_SIZE; |
270 | if ( QApplication::desktop()->width() < 300 ) | 304 | if ( QApplication::desktop()->width() < 300 ) |
271 | size = 3; | 305 | size = 3; |
272 | int x = 1; | 306 | int x = 1; |
273 | if ( mInfo ) { | 307 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
274 | x += size + 1; | 308 | if ( mInfo ) { |
275 | } | 309 | x += size + 1; |
276 | if( mRecur ) { | 310 | } |
277 | x += size+1; | 311 | if( mRecur ) { |
278 | } | 312 | x += size+1; |
279 | if( mAlarm ) { | 313 | } |
280 | x += size+1; | 314 | if( mAlarm ) { |
315 | x += size+1; | ||
316 | } | ||
317 | if( mReply ) { | ||
318 | x += size+1; | ||
319 | } | ||
281 | } | 320 | } |
282 | if( mReply ) { | 321 | if( mMultiday ) { |
283 | x += size+1; | 322 | x += size+1+2+size/2; |
284 | } | 323 | } |
285 | 324 | ||
286 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 325 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
287 | } | 326 | } |
288 | 327 | ||
289 | 328 | ||
290 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 329 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
291 | : QWidget( par ), | 330 | : QWidget( par ), |
292 | mMonthView( parent ) | 331 | mMonthView( parent ) |
293 | { | 332 | { |
294 | 333 | ||
295 | QVBoxLayout *topLayout = new QVBoxLayout( this ); | 334 | QVBoxLayout *topLayout = new QVBoxLayout( this ); |
296 | 335 | ||
297 | // mLabel = new QLabel( this );QPushButton | 336 | // mLabel = new QLabel( this );QPushButton |
298 | mLabel = new QPushButton( this ); | 337 | mLabel = new QPushButton( this ); |
299 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 338 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
300 | //mLabel->setLineWidth( 1 ); | 339 | //mLabel->setLineWidth( 1 ); |
301 | //mLabel->setAlignment( AlignCenter ); | 340 | //mLabel->setAlignment( AlignCenter ); |
302 | mLabel->setFlat( true ); | 341 | mLabel->setFlat( true ); |
303 | mLabel->setFocusPolicy(NoFocus); | 342 | mLabel->setFocusPolicy(NoFocus); |
304 | mItemList = new KNoScrollListBox( this ); | 343 | mItemList = new KNoScrollListBox( this ); |
305 | mItemList->setMinimumSize( 10, 10 ); | 344 | mItemList->setMinimumSize( 10, 10 ); |
306 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 345 | mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
307 | mItemList->setLineWidth( 1 ); | 346 | mItemList->setLineWidth( 1 ); |
308 | topLayout->addWidget( mItemList ); | 347 | topLayout->addWidget( mItemList ); |
309 | mLabel->raise(); | 348 | mLabel->raise(); |
310 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 349 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
311 | mStandardPalette = palette(); | 350 | mStandardPalette = palette(); |
312 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 351 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
313 | 352 | ||
314 | enableScrollBars( false ); | 353 | enableScrollBars( false ); |
315 | updateConfig(); | 354 | updateConfig(); |
316 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 355 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
317 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 356 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
318 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), | 357 | connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), |
319 | SLOT( defaultAction( QListBoxItem * ) ) ); | 358 | SLOT( defaultAction( QListBoxItem * ) ) ); |
320 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, | 359 | connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, |
321 | const QPoint &) ), | 360 | const QPoint &) ), |
322 | SLOT( contextMenu( QListBoxItem * ) ) ); | 361 | SLOT( contextMenu( QListBoxItem * ) ) ); |
323 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), | 362 | connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), |
324 | SLOT( selection( QListBoxItem * ) ) ); | 363 | SLOT( selection( QListBoxItem * ) ) ); |
325 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 364 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
326 | SLOT( cellClicked( QListBoxItem * ) ) ); | 365 | SLOT( cellClicked( QListBoxItem * ) ) ); |
327 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), | 366 | connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), |
328 | SLOT( selection( QListBoxItem * ) ) ); | 367 | SLOT( selection( QListBoxItem * ) ) ); |
329 | } | 368 | } |
330 | #ifdef DESKTOP_VERSION | 369 | #ifdef DESKTOP_VERSION |
331 | QToolTipGroup *MonthViewCell::toolTipGroup() | 370 | QToolTipGroup *MonthViewCell::toolTipGroup() |
332 | { | 371 | { |
333 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 372 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
334 | return mToolTipGroup; | 373 | return mToolTipGroup; |
335 | } | 374 | } |
336 | #endif | 375 | #endif |
337 | 376 | ||
338 | void MonthViewCell::setDate( const QDate &date ) | 377 | void MonthViewCell::setDate( const QDate &date ) |
339 | { | 378 | { |
340 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 379 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
341 | mDate = date; | 380 | mDate = date; |
342 | 381 | ||
343 | 382 | ||
344 | 383 | ||
345 | //resizeEvent( 0 ); | 384 | //resizeEvent( 0 ); |
346 | } | 385 | } |
347 | 386 | ||
348 | QDate MonthViewCell::date() const | 387 | QDate MonthViewCell::date() const |
349 | { | 388 | { |
350 | return mDate; | 389 | return mDate; |
351 | } | 390 | } |
352 | 391 | ||
353 | void MonthViewCell::setPrimary( bool primary ) | 392 | void MonthViewCell::setPrimary( bool primary ) |
354 | { | 393 | { |
355 | mPrimary = primary; | 394 | mPrimary = primary; |
356 | //setMyPalette(); | 395 | //setMyPalette(); |
357 | } | 396 | } |
358 | void MonthViewCell::setMyPalette() | 397 | void MonthViewCell::setMyPalette() |
359 | { | 398 | { |
360 | 399 | ||
361 | if ( mHoliday) { | 400 | if ( mHoliday) { |
362 | setPalette( mHolidayPalette ); | 401 | setPalette( mHolidayPalette ); |
363 | } else { | 402 | } else { |
364 | if ( mPrimary ) { | 403 | if ( mPrimary ) { |
365 | setPalette( mPrimaryPalette ); | 404 | setPalette( mPrimaryPalette ); |
366 | } else { | 405 | } else { |
367 | setPalette( mNonPrimaryPalette ); | 406 | setPalette( mNonPrimaryPalette ); |
368 | } | 407 | } |
369 | } | 408 | } |
370 | QPalette pal = palette(); | 409 | QPalette pal = palette(); |
371 | 410 | ||
372 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 411 | mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
373 | } | 412 | } |
374 | QPalette MonthViewCell::getPalette () | 413 | QPalette MonthViewCell::getPalette () |
375 | { | 414 | { |
376 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 415 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
377 | return mStandardPalette; | 416 | return mStandardPalette; |
378 | if ( mHoliday) { | 417 | if ( mHoliday) { |
379 | return mHolidayPalette ; | 418 | return mHolidayPalette ; |
380 | } else { | 419 | } else { |
381 | if ( mPrimary ) { | 420 | if ( mPrimary ) { |
382 | return mPrimaryPalette ; | 421 | return mPrimaryPalette ; |
383 | } | 422 | } |
384 | } | 423 | } |
385 | return mNonPrimaryPalette; | 424 | return mNonPrimaryPalette; |
386 | } | 425 | } |
387 | bool MonthViewCell::isPrimary() const | 426 | bool MonthViewCell::isPrimary() const |
388 | { | 427 | { |
389 | return mPrimary; | 428 | return mPrimary; |
390 | } | 429 | } |
391 | 430 | ||
392 | void MonthViewCell::setHoliday( bool holiday ) | 431 | void MonthViewCell::setHoliday( bool holiday ) |
393 | { | 432 | { |
394 | mHoliday = holiday; | 433 | mHoliday = holiday; |
395 | //setMyPalette(); | 434 | //setMyPalette(); |
396 | } | 435 | } |
397 | 436 | ||
398 | void MonthViewCell::setHoliday( const QString &holiday ) | 437 | void MonthViewCell::setHoliday( const QString &holiday ) |
399 | { | 438 | { |
400 | mHolidayString = holiday; | 439 | mHolidayString = holiday; |
401 | 440 | ||
402 | if ( !holiday.isEmpty() ) { | 441 | if ( !holiday.isEmpty() ) { |
403 | setHoliday( true ); | 442 | setHoliday( true ); |
404 | } | 443 | } |
405 | } | 444 | } |
406 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 445 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
407 | { | 446 | { |
408 | 447 | ||
409 | e->ignore(); | 448 | e->ignore(); |
410 | 449 | ||
411 | } | 450 | } |
412 | 451 | ||
413 | void MonthViewCell::startUpdateCell() | 452 | void MonthViewCell::startUpdateCell() |
414 | { | 453 | { |
415 | 454 | ||
416 | mItemList->setFocusPolicy(NoFocus); | 455 | mItemList->setFocusPolicy(NoFocus); |
417 | if ( !mMonthView->isUpdatePossible() ) | 456 | if ( !mMonthView->isUpdatePossible() ) |
418 | return; | 457 | return; |
419 | 458 | ||
420 | /* | 459 | /* |
421 | if ( !isVisible() ){ | 460 | if ( !isVisible() ){ |
422 | return; | 461 | return; |
423 | } | 462 | } |
424 | */ | 463 | */ |
425 | // qDebug("MonthViewCell::updateCell() "); | 464 | // qDebug("MonthViewCell::updateCell() "); |
426 | setPrimary( mDate.month()%2 ); | 465 | setPrimary( mDate.month()%2 ); |
427 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 466 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
428 | if ( mDate == QDate::currentDate() ) { | 467 | if ( mDate == QDate::currentDate() ) { |
429 | mItemList->setLineWidth( 3 ); | 468 | mItemList->setLineWidth( 3 ); |
430 | } else { | 469 | } else { |
431 | mItemList->setLineWidth( 1 ); | 470 | mItemList->setLineWidth( 1 ); |
432 | } | 471 | } |
433 | mItemList->clear(); | 472 | mItemList->clear(); |
434 | 473 | ||
435 | #ifdef DESKTOP_VERSION | 474 | #ifdef DESKTOP_VERSION |
436 | QToolTip::remove(this); | 475 | QToolTip::remove(this); |
437 | #endif | 476 | #endif |
438 | mToolTip = ""; | 477 | mToolTip = ""; |
439 | //qApp->processEvents(); | 478 | //qApp->processEvents(); |
440 | if ( !mHolidayString.isEmpty() ) { | 479 | if ( !mHolidayString.isEmpty() ) { |
441 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 480 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
442 | item->setPalette( mHolidayPalette ); | 481 | item->setPalette( mHolidayPalette ); |
443 | mItemList->insertItem( item ); | 482 | mItemList->insertItem( item ); |
444 | mToolTip += mHolidayString+"\n"; | 483 | mToolTip += mHolidayString+"\n"; |
445 | } | 484 | } |
446 | } | 485 | } |
447 | 486 | ||
448 | void MonthViewCell::insertEvent(Event *event) | 487 | void MonthViewCell::insertEvent(Event *event) |
449 | { | 488 | { |
450 | 489 | ||
451 | mItemList->setFocusPolicy(WheelFocus); | 490 | mItemList->setFocusPolicy(WheelFocus); |
452 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 491 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
453 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 492 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
454 | return; | 493 | return; |
455 | else | 494 | else |
456 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 495 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
457 | return; | 496 | return; |
458 | } | 497 | } |
459 | 498 | ||
460 | if ( event->categories().contains("Holiday") || | 499 | if ( event->categories().contains("Holiday") || |
461 | event->categories().contains(i18n("Holiday"))) { | 500 | event->categories().contains(i18n("Holiday"))) { |
462 | setHoliday( true ); | 501 | setHoliday( true ); |
463 | if ( mDate.dayOfWeek() == 7 ) | 502 | if ( mDate.dayOfWeek() == 7 ) |
464 | mItemList->setLineWidth( 3 ); | 503 | mItemList->setLineWidth( 3 ); |
465 | } | 504 | } |
466 | QString text; | 505 | QString text; |
506 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | ||
467 | if (event->isMultiDay()) { | 507 | if (event->isMultiDay()) { |
468 | QString prefix = "<->"; | 508 | QString prefix = "<->";multiday = 2; |
509 | QString time; | ||
469 | if ( event->doesRecur() ) { | 510 | if ( event->doesRecur() ) { |
470 | if ( event->recursOn( mDate) ) | 511 | if ( event->recursOn( mDate) ) { |
471 | prefix ="->" ; | 512 | prefix ="->" ;multiday = 1; |
513 | } | ||
472 | else { | 514 | else { |
473 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 515 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
474 | if ( event->recursOn( mDate.addDays( -days)) ) | 516 | if ( event->recursOn( mDate.addDays( -days)) ) |
475 | prefix ="<-" ; | 517 | prefix ="<-" ;multiday = 3; |
476 | } | 518 | } |
477 | 519 | ||
478 | } else { | 520 | } else { |
479 | if (mDate == event->dtStart().date()) { | 521 | if (mDate == event->dtStart().date()) { |
480 | prefix ="->" ; | 522 | prefix ="->" ;multiday = 1; |
481 | } else if (mDate == event->dtEnd().date()) { | 523 | } else if (mDate == event->dtEnd().date()) { |
482 | prefix ="<-" ; | 524 | prefix ="<-" ;multiday = 3; |
483 | } | 525 | } |
484 | } | 526 | } |
485 | if ( !event->doesFloat() ) { | 527 | if ( !event->doesFloat() ) { |
486 | if ( mDate == event->dtStart().date () ) | 528 | if ( mDate == event->dtStart().date () ) |
487 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 529 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
488 | else if ( mDate == event->dtEnd().date () ) | 530 | else if ( mDate == event->dtEnd().date () ) |
489 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 531 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
490 | 532 | ||
491 | } | 533 | } |
492 | text = prefix + event->summary(); | 534 | text = time + event->summary(); |
493 | mToolTip += text; | 535 | mToolTip += prefix + text; |
494 | } else { | 536 | } else { |
495 | if (event->doesFloat()) { | 537 | if (event->doesFloat()) { |
496 | text = event->summary(); | 538 | text = event->summary(); |
497 | mToolTip += text; | 539 | mToolTip += text; |
498 | } | 540 | } |
499 | else { | 541 | else { |
500 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 542 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
501 | text += " " + event->summary(); | 543 | text += " " + event->summary(); |
502 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 544 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
503 | } | 545 | } |
504 | } | 546 | } |
505 | 547 | ||
506 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 548 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
507 | QPalette pal; | 549 | QPalette pal; |
508 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 550 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
509 | QStringList categories = event->categories(); | 551 | QStringList categories = event->categories(); |
510 | QString cat = categories.first(); | 552 | QString cat = categories.first(); |
511 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 553 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
512 | pal = getPalette(); | 554 | pal = getPalette(); |
513 | if (cat.isEmpty()) { | 555 | if (cat.isEmpty()) { |
514 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 556 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
515 | } else { | 557 | } else { |
516 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 558 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
517 | } | 559 | } |
518 | 560 | ||
519 | } else { | 561 | } else { |
520 | if (cat.isEmpty()) { | 562 | if (cat.isEmpty()) { |
521 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 563 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
522 | } else { | 564 | } else { |
523 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 565 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
524 | } | 566 | } |
525 | } | 567 | } |
526 | 568 | ||
527 | } else { | 569 | } else { |
528 | pal = mStandardPalette ; | 570 | pal = mStandardPalette ; |
529 | } | 571 | } |
530 | item->setPalette( pal ); | 572 | item->setPalette( pal ); |
531 | item->setRecur( event->recurrence()->doesRecur() ); | 573 | item->setRecur( event->recurrence()->doesRecur() ); |
532 | item->setAlarm( event->isAlarmEnabled() ); | 574 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); |
533 | item->setMoreInfo( event->description().length() > 0 ); | 575 | item->setMoreInfo( event->description().length() > 0 ); |
534 | #ifdef DESKTOP_VERSION | 576 | #ifdef DESKTOP_VERSION |
535 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 577 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
536 | KOPrefs::instance()->email()); | 578 | KOPrefs::instance()->email()); |
537 | if ( me != 0 ) { | 579 | if ( me != 0 ) { |
538 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 580 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
539 | item->setReply(true); | 581 | item->setReply(true && multiday < 2); |
540 | else | 582 | else |
541 | item->setReply(false); | 583 | item->setReply(false); |
542 | } else | 584 | } else |
543 | item->setReply(false); | 585 | item->setReply(false); |
544 | #endif | 586 | #endif |
587 | item->setMultiDay( multiday ); | ||
545 | mItemList->insertItem( item ); | 588 | mItemList->insertItem( item ); |
546 | mToolTip += "\n"; | 589 | mToolTip += "\n"; |
547 | } | 590 | } |
548 | void MonthViewCell::insertTodo(Todo *todo) | 591 | void MonthViewCell::insertTodo(Todo *todo) |
549 | { | 592 | { |
550 | mItemList->setFocusPolicy(WheelFocus); | 593 | mItemList->setFocusPolicy(WheelFocus); |
551 | QString text; | 594 | QString text; |
552 | if (todo->hasDueDate()) { | 595 | if (todo->hasDueDate()) { |
553 | if (!todo->doesFloat()) { | 596 | if (!todo->doesFloat()) { |
554 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 597 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
555 | text += " "; | 598 | text += " "; |
556 | } | 599 | } |
557 | } | 600 | } |
558 | text += i18n("T: %1").arg(todo->summary()); | 601 | text += i18n("T: %1").arg(todo->summary()); |
559 | 602 | ||
560 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 603 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
561 | //item->setPalette( mStandardPalette ); | 604 | //item->setPalette( mStandardPalette ); |
562 | QPalette pal; | 605 | QPalette pal; |
563 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 606 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
564 | QStringList categories = todo->categories(); | 607 | QStringList categories = todo->categories(); |
565 | QString cat = categories.first(); | 608 | QString cat = categories.first(); |
566 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 609 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
567 | pal = getPalette(); | 610 | pal = getPalette(); |
568 | if (cat.isEmpty()) { | 611 | if (cat.isEmpty()) { |
569 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 612 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
570 | } else { | 613 | } else { |
571 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 614 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
572 | } | 615 | } |
573 | 616 | ||
574 | } else { | 617 | } else { |
575 | if (cat.isEmpty()) { | 618 | if (cat.isEmpty()) { |
576 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 619 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
577 | } else { | 620 | } else { |
578 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 621 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
579 | } | 622 | } |
580 | } | 623 | } |
581 | 624 | ||
582 | } else { | 625 | } else { |
583 | pal = mStandardPalette ; | 626 | pal = mStandardPalette ; |
584 | } | 627 | } |
585 | item->setPalette( pal ); | 628 | item->setPalette( pal ); |
586 | item->setRecur( todo->recurrence()->doesRecur() ); | 629 | item->setRecur( todo->recurrence()->doesRecur() ); |
587 | item->setAlarm( todo->isAlarmEnabled() ); | 630 | item->setAlarm( todo->isAlarmEnabled() ); |
588 | item->setMoreInfo( todo->description().length() > 0 ); | 631 | item->setMoreInfo( todo->description().length() > 0 ); |
589 | mItemList->insertItem( item ); | 632 | mItemList->insertItem( item ); |
590 | mToolTip += text+"\n"; | 633 | mToolTip += text+"\n"; |
591 | } | 634 | } |
592 | void MonthViewCell::finishUpdateCell() | 635 | void MonthViewCell::finishUpdateCell() |
593 | { | 636 | { |
594 | #ifdef DESKTOP_VERSION | 637 | #ifdef DESKTOP_VERSION |
595 | if (mToolTip != "") | 638 | if (mToolTip != "") |
596 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 639 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
597 | #endif | 640 | #endif |
598 | mItemList->sort(); | 641 | mItemList->sort(); |
599 | //setMyPalette(); | 642 | //setMyPalette(); |
600 | setMyPalette(); | 643 | setMyPalette(); |
601 | QString text; | 644 | QString text; |
602 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 645 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
603 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 646 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
604 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 647 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
605 | mLabel->resize( mLabelBigSize ); | 648 | mLabel->resize( mLabelBigSize ); |
606 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 649 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
607 | } else { | 650 | } else { |
608 | mLabel->resize( mLabelSize ); | 651 | mLabel->resize( mLabelSize ); |
609 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 652 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
610 | } | 653 | } |
611 | 654 | ||
612 | mLabel->setText( text ); | 655 | mLabel->setText( text ); |
613 | resizeEvent( 0 ); | 656 | resizeEvent( 0 ); |
614 | } | 657 | } |
615 | void MonthViewCell::updateCell() | 658 | void MonthViewCell::updateCell() |
616 | { | 659 | { |
617 | qDebug("MonthViewCell::updateCell() "); | 660 | qDebug("MonthViewCell::updateCell() "); |
618 | if ( !mMonthView->isUpdatePossible() ) | 661 | if ( !mMonthView->isUpdatePossible() ) |
619 | return; | 662 | return; |
620 | startUpdateCell(); | 663 | startUpdateCell(); |
621 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 664 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
622 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 665 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
623 | Event *event; | 666 | Event *event; |
624 | for( event = events.first(); event; event = events.next() ) { // for event | 667 | for( event = events.first(); event; event = events.next() ) { // for event |
625 | insertEvent(event); | 668 | insertEvent(event); |
626 | } | 669 | } |
627 | // insert due todos | 670 | // insert due todos |
628 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 671 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
629 | Todo *todo; | 672 | Todo *todo; |
630 | for(todo = todos.first(); todo; todo = todos.next()) { | 673 | for(todo = todos.first(); todo; todo = todos.next()) { |
631 | insertTodo( todo ); | 674 | insertTodo( todo ); |
632 | } | 675 | } |
633 | finishUpdateCell(); | 676 | finishUpdateCell(); |
634 | // if ( isVisible()) | 677 | // if ( isVisible()) |
635 | //qApp->processEvents(); | 678 | //qApp->processEvents(); |
636 | } | 679 | } |
637 | 680 | ||
638 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 681 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
639 | { | 682 | { |
640 | 683 | ||
641 | if ( bigFont ) { | 684 | if ( bigFont ) { |
642 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 685 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
643 | int ps = fo.pointSize() + 2; | 686 | int ps = fo.pointSize() + 2; |
644 | if ( ps < 18 ) | 687 | if ( ps < 18 ) |
645 | ps += 2; | 688 | ps += 2; |
646 | fo.setPointSize( ps ); | 689 | fo.setPointSize( ps ); |
647 | setFont( fo ); | 690 | setFont( fo ); |
648 | } else | 691 | } else |
649 | setFont( KOPrefs::instance()->mMonthViewFont ); | 692 | setFont( KOPrefs::instance()->mMonthViewFont ); |
650 | 693 | ||
651 | QFontMetrics fm( font() ); | 694 | QFontMetrics fm( font() ); |
652 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 695 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
653 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 696 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
654 | mHolidayPalette = mStandardPalette; | 697 | mHolidayPalette = mStandardPalette; |
655 | mPrimaryPalette = mStandardPalette; | 698 | mPrimaryPalette = mStandardPalette; |
656 | mNonPrimaryPalette = mStandardPalette; | 699 | mNonPrimaryPalette = mStandardPalette; |
657 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 700 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
658 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 701 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
659 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 702 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
660 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 703 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
661 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 704 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
662 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 705 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
663 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 706 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
664 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 707 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
665 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 708 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
666 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 709 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
667 | } | 710 | } |
668 | //updateCell(); | 711 | //updateCell(); |
669 | } | 712 | } |
670 | 713 | ||
671 | void MonthViewCell::enableScrollBars( bool enabled ) | 714 | void MonthViewCell::enableScrollBars( bool enabled ) |
672 | { | 715 | { |
673 | if ( enabled ) { | 716 | if ( enabled ) { |
674 | mItemList->setVScrollBarMode(QScrollView::Auto); | 717 | mItemList->setVScrollBarMode(QScrollView::Auto); |
675 | mItemList->setHScrollBarMode(QScrollView::Auto); | 718 | mItemList->setHScrollBarMode(QScrollView::Auto); |
676 | } else { | 719 | } else { |
677 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); | 720 | mItemList->setVScrollBarMode(QScrollView::AlwaysOff); |
678 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); | 721 | mItemList->setHScrollBarMode(QScrollView::AlwaysOff); |
679 | } | 722 | } |
680 | } | 723 | } |
681 | 724 | ||
682 | Incidence *MonthViewCell::selectedIncidence() | 725 | Incidence *MonthViewCell::selectedIncidence() |
683 | { | 726 | { |
684 | int index = mItemList->currentItem(); | 727 | int index = mItemList->currentItem(); |
685 | if ( index < 0 ) return 0; | 728 | if ( index < 0 ) return 0; |
686 | 729 | ||
687 | MonthViewItem *item = | 730 | MonthViewItem *item = |
688 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 731 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
689 | 732 | ||
690 | if ( !item ) return 0; | 733 | if ( !item ) return 0; |
691 | 734 | ||
692 | return item->incidence(); | 735 | return item->incidence(); |
693 | } | 736 | } |
694 | 737 | ||
695 | QDate MonthViewCell::selectedIncidenceDate() | 738 | QDate MonthViewCell::selectedIncidenceDate() |
696 | { | 739 | { |
697 | QDate qd; | 740 | QDate qd; |
698 | int index = mItemList->currentItem(); | 741 | int index = mItemList->currentItem(); |
699 | if ( index < 0 ) return qd; | 742 | if ( index < 0 ) return qd; |
700 | 743 | ||
701 | MonthViewItem *item = | 744 | MonthViewItem *item = |
702 | static_cast<MonthViewItem *>( mItemList->item( index ) ); | 745 | static_cast<MonthViewItem *>( mItemList->item( index ) ); |
703 | 746 | ||
704 | if ( !item ) return qd; | 747 | if ( !item ) return qd; |
705 | 748 | ||
706 | return item->incidenceDate(); | 749 | return item->incidenceDate(); |
707 | } | 750 | } |
708 | 751 | ||
709 | void MonthViewCell::deselect() | 752 | void MonthViewCell::deselect() |
710 | { | 753 | { |
711 | mItemList->clearSelection(); | 754 | mItemList->clearSelection(); |
712 | enableScrollBars( false ); | 755 | enableScrollBars( false ); |
713 | // updateCell(); | 756 | // updateCell(); |
714 | } | 757 | } |
715 | void MonthViewCell::select() | 758 | void MonthViewCell::select() |
716 | { | 759 | { |
717 | ;// updateCell(); | 760 | ;// updateCell(); |
718 | } | 761 | } |
719 | 762 | ||
720 | void MonthViewCell::resizeEvent ( QResizeEvent * ) | 763 | void MonthViewCell::resizeEvent ( QResizeEvent * ) |
721 | { | 764 | { |
722 | if ( !mMonthView->isUpdatePossible() ) | 765 | if ( !mMonthView->isUpdatePossible() ) |
723 | return; | 766 | return; |
724 | 767 | ||
725 | int size = height() - mLabel->height() - 2; | 768 | int size = height() - mLabel->height() - 2; |
726 | if ( size > 0 ) | 769 | if ( size > 0 ) |
727 | mItemList->verticalScrollBar()->setMaximumHeight( size ); | 770 | mItemList->verticalScrollBar()->setMaximumHeight( size ); |
728 | size = width() - mLabel->width() -2; | 771 | size = width() - mLabel->width() -2; |
729 | if ( size > 0 ) | 772 | if ( size > 0 ) |
730 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); | 773 | mItemList->horizontalScrollBar()->setMaximumWidth( size ); |
731 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); | 774 | mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); |
732 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 775 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
733 | } | 776 | } |
734 | 777 | ||
735 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 778 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
736 | { | 779 | { |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 2f6f5dc..b79a41f 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,299 +1,301 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
33 | #include <qptrvector.h> | 33 | #include <qptrvector.h> |
34 | 34 | ||
35 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
36 | #include <libkcal/event.h> | 36 | #include <libkcal/event.h> |
37 | 37 | ||
38 | #include "koeventview.h" | 38 | #include "koeventview.h" |
39 | #include "navigatorbar.h" | 39 | #include "navigatorbar.h" |
40 | 40 | ||
41 | #ifdef DESKTOP_VERSION | 41 | #ifdef DESKTOP_VERSION |
42 | class QToolTipGroup; | 42 | class QToolTipGroup; |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | class KNOWhatsThis; | 45 | class KNOWhatsThis; |
46 | class KOWeekButton : public QPushButton | 46 | class KOWeekButton : public QPushButton |
47 | { | 47 | { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 50 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
51 | QPushButton( parent, name) | 51 | QPushButton( parent, name) |
52 | { | 52 | { |
53 | connect( this, SIGNAL( clicked() ), | 53 | connect( this, SIGNAL( clicked() ), |
54 | SLOT( bottonClicked() )); | 54 | SLOT( bottonClicked() )); |
55 | mNumber = -1; | 55 | mNumber = -1; |
56 | } | 56 | } |
57 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 57 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
58 | int getWeekNum() { return mNumber;} | 58 | int getWeekNum() { return mNumber;} |
59 | signals: | 59 | signals: |
60 | void selectWeekNum ( int ); | 60 | void selectWeekNum ( int ); |
61 | private: | 61 | private: |
62 | int mNumber; | 62 | int mNumber; |
63 | private slots : | 63 | private slots : |
64 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 64 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
65 | }; | 65 | }; |
66 | 66 | ||
67 | class KNoScrollListBox: public QListBox | 67 | class KNoScrollListBox: public QListBox |
68 | { | 68 | { |
69 | Q_OBJECT | 69 | Q_OBJECT |
70 | public: | 70 | public: |
71 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 71 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
72 | ~KNoScrollListBox(); | 72 | ~KNoScrollListBox(); |
73 | QString getWhatsThisText(QPoint p) ; | 73 | QString getWhatsThisText(QPoint p) ; |
74 | 74 | ||
75 | signals: | 75 | signals: |
76 | void shiftDown(); | 76 | void shiftDown(); |
77 | void shiftUp(); | 77 | void shiftUp(); |
78 | void rightClick(); | 78 | void rightClick(); |
79 | 79 | ||
80 | protected slots: | 80 | protected slots: |
81 | void oneDown(); | 81 | void oneDown(); |
82 | void keyPressEvent(QKeyEvent *); | 82 | void keyPressEvent(QKeyEvent *); |
83 | void keyReleaseEvent(QKeyEvent *); | 83 | void keyReleaseEvent(QKeyEvent *); |
84 | void mousePressEvent(QMouseEvent *); | 84 | void mousePressEvent(QMouseEvent *); |
85 | 85 | ||
86 | private: | 86 | private: |
87 | KNOWhatsThis * mWT; | 87 | KNOWhatsThis * mWT; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
91 | class MonthViewItem: public QListBoxItem | 91 | class MonthViewItem: public QListBoxItem |
92 | { | 92 | { |
93 | public: | 93 | public: |
94 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 94 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
95 | 95 | ||
96 | void setRecur(bool on) { mRecur = on; } | 96 | void setRecur(bool on) { mRecur = on; } |
97 | void setAlarm(bool on) { mAlarm = on; } | 97 | void setAlarm(bool on) { mAlarm = on; } |
98 | void setReply(bool on) { mReply = on; } | 98 | void setReply(bool on) { mReply = on; } |
99 | void setMoreInfo(bool on) { mInfo = on; } | 99 | void setMoreInfo(bool on) { mInfo = on; } |
100 | void setMultiDay(int type) { mMultiday = type; } | ||
100 | 101 | ||
101 | 102 | ||
102 | void setPalette(const QPalette &p) { mPalette = p; } | 103 | void setPalette(const QPalette &p) { mPalette = p; } |
103 | QPalette palette() const { return mPalette; } | 104 | QPalette palette() const { return mPalette; } |
104 | 105 | ||
105 | Incidence *incidence() const { return mIncidence; } | 106 | Incidence *incidence() const { return mIncidence; } |
106 | QDate incidenceDate() { return mDate; } | 107 | QDate incidenceDate() { return mDate; } |
107 | 108 | ||
108 | protected: | 109 | protected: |
109 | virtual void paint(QPainter *); | 110 | virtual void paint(QPainter *); |
110 | virtual int height(const QListBox *) const; | 111 | virtual int height(const QListBox *) const; |
111 | virtual int width(const QListBox *) const; | 112 | virtual int width(const QListBox *) const; |
112 | 113 | ||
113 | private: | 114 | private: |
115 | int mMultiday; | ||
114 | bool mRecur; | 116 | bool mRecur; |
115 | bool mAlarm; | 117 | bool mAlarm; |
116 | bool mReply; | 118 | bool mReply; |
117 | bool mInfo; | 119 | bool mInfo; |
118 | 120 | ||
119 | QPalette mPalette; | 121 | QPalette mPalette; |
120 | QDate mDate; | 122 | QDate mDate; |
121 | 123 | ||
122 | Incidence *mIncidence; | 124 | Incidence *mIncidence; |
123 | }; | 125 | }; |
124 | 126 | ||
125 | 127 | ||
126 | class KOMonthView; | 128 | class KOMonthView; |
127 | 129 | ||
128 | class MonthViewCell : public QWidget | 130 | class MonthViewCell : public QWidget |
129 | { | 131 | { |
130 | Q_OBJECT | 132 | Q_OBJECT |
131 | public: | 133 | public: |
132 | MonthViewCell(KOMonthView *,QWidget* ); | 134 | MonthViewCell(KOMonthView *,QWidget* ); |
133 | 135 | ||
134 | void setDate( const QDate & ); | 136 | void setDate( const QDate & ); |
135 | QDate date() const; | 137 | QDate date() const; |
136 | 138 | ||
137 | void setPrimary( bool ); | 139 | void setPrimary( bool ); |
138 | bool isPrimary() const; | 140 | bool isPrimary() const; |
139 | 141 | ||
140 | void setHoliday( bool ); | 142 | void setHoliday( bool ); |
141 | void setHoliday( const QString & ); | 143 | void setHoliday( const QString & ); |
142 | 144 | ||
143 | void updateCell(); | 145 | void updateCell(); |
144 | void startUpdateCell(); | 146 | void startUpdateCell(); |
145 | void finishUpdateCell(); | 147 | void finishUpdateCell(); |
146 | void insertEvent(Event *); | 148 | void insertEvent(Event *); |
147 | void insertTodo(Todo *); | 149 | void insertTodo(Todo *); |
148 | 150 | ||
149 | void updateConfig( bool bigFont = false ); | 151 | void updateConfig( bool bigFont = false ); |
150 | 152 | ||
151 | void enableScrollBars( bool ); | 153 | void enableScrollBars( bool ); |
152 | 154 | ||
153 | Incidence *selectedIncidence(); | 155 | Incidence *selectedIncidence(); |
154 | QDate selectedIncidenceDate(); | 156 | QDate selectedIncidenceDate(); |
155 | 157 | ||
156 | void deselect(); | 158 | void deselect(); |
157 | void select(); | 159 | void select(); |
158 | 160 | ||
159 | #ifdef DESKTOP_VERSION | 161 | #ifdef DESKTOP_VERSION |
160 | static QToolTipGroup *toolTipGroup(); | 162 | static QToolTipGroup *toolTipGroup(); |
161 | #endif | 163 | #endif |
162 | signals: | 164 | signals: |
163 | void defaultAction( Incidence * ); | 165 | void defaultAction( Incidence * ); |
164 | void newEventSignal( QDateTime ); | 166 | void newEventSignal( QDateTime ); |
165 | void showDaySignal( QDate ); | 167 | void showDaySignal( QDate ); |
166 | 168 | ||
167 | protected: | 169 | protected: |
168 | QString mToolTip; | 170 | QString mToolTip; |
169 | void resizeEvent( QResizeEvent * ); | 171 | void resizeEvent( QResizeEvent * ); |
170 | 172 | ||
171 | protected slots: | 173 | protected slots: |
172 | void defaultAction( QListBoxItem * ); | 174 | void defaultAction( QListBoxItem * ); |
173 | void contextMenu( QListBoxItem * ); | 175 | void contextMenu( QListBoxItem * ); |
174 | void selection( QListBoxItem * ); | 176 | void selection( QListBoxItem * ); |
175 | void cellClicked( QListBoxItem * ); | 177 | void cellClicked( QListBoxItem * ); |
176 | void newEvent(); | 178 | void newEvent(); |
177 | void showDay(); | 179 | void showDay(); |
178 | 180 | ||
179 | private: | 181 | private: |
180 | KOMonthView *mMonthView; | 182 | KOMonthView *mMonthView; |
181 | 183 | ||
182 | QDate mDate; | 184 | QDate mDate; |
183 | bool mPrimary; | 185 | bool mPrimary; |
184 | bool mHoliday; | 186 | bool mHoliday; |
185 | QString mHolidayString; | 187 | QString mHolidayString; |
186 | 188 | ||
187 | //QLabel *mLabel; | 189 | //QLabel *mLabel; |
188 | QPushButton *mLabel; | 190 | QPushButton *mLabel; |
189 | QListBox *mItemList; | 191 | QListBox *mItemList; |
190 | #ifdef DESKTOP_VERSION | 192 | #ifdef DESKTOP_VERSION |
191 | static QToolTipGroup *mToolTipGroup; | 193 | static QToolTipGroup *mToolTipGroup; |
192 | #endif | 194 | #endif |
193 | QSize mLabelSize; | 195 | QSize mLabelSize; |
194 | QSize mLabelBigSize; | 196 | QSize mLabelBigSize; |
195 | QPalette mHolidayPalette; | 197 | QPalette mHolidayPalette; |
196 | QPalette mStandardPalette; | 198 | QPalette mStandardPalette; |
197 | QPalette mPrimaryPalette; | 199 | QPalette mPrimaryPalette; |
198 | QPalette mNonPrimaryPalette; | 200 | QPalette mNonPrimaryPalette; |
199 | void setMyPalette(); | 201 | void setMyPalette(); |
200 | QPalette getPalette (); | 202 | QPalette getPalette (); |
201 | void keyPressEvent ( QKeyEvent * ) ; | 203 | void keyPressEvent ( QKeyEvent * ) ; |
202 | 204 | ||
203 | }; | 205 | }; |
204 | 206 | ||
205 | 207 | ||
206 | class KOMonthView: public KOEventView | 208 | class KOMonthView: public KOEventView |
207 | { | 209 | { |
208 | Q_OBJECT | 210 | Q_OBJECT |
209 | public: | 211 | public: |
210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 212 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
211 | ~KOMonthView(); | 213 | ~KOMonthView(); |
212 | 214 | ||
213 | /** Returns maximum number of days supported by the komonthview */ | 215 | /** Returns maximum number of days supported by the komonthview */ |
214 | virtual int maxDatesHint(); | 216 | virtual int maxDatesHint(); |
215 | 217 | ||
216 | /** Returns number of currently shown dates. */ | 218 | /** Returns number of currently shown dates. */ |
217 | virtual int currentDateCount(); | 219 | virtual int currentDateCount(); |
218 | 220 | ||
219 | /** returns the currently selected events */ | 221 | /** returns the currently selected events */ |
220 | virtual QPtrList<Incidence> selectedIncidences(); | 222 | virtual QPtrList<Incidence> selectedIncidences(); |
221 | 223 | ||
222 | /** returns dates of the currently selected events */ | 224 | /** returns dates of the currently selected events */ |
223 | virtual DateList selectedDates(); | 225 | virtual DateList selectedDates(); |
224 | 226 | ||
225 | virtual void printPreview(CalPrinter *calPrinter, | 227 | virtual void printPreview(CalPrinter *calPrinter, |
226 | const QDate &, const QDate &); | 228 | const QDate &, const QDate &); |
227 | bool isMonthView() { return true; } | 229 | bool isMonthView() { return true; } |
228 | bool isUpdatePossible() { return updatePossible; } | 230 | bool isUpdatePossible() { return updatePossible; } |
229 | 231 | ||
230 | MonthViewCell * selectedCell(); | 232 | MonthViewCell * selectedCell(); |
231 | bool skipResize; | 233 | bool skipResize; |
232 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 234 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
233 | public slots: | 235 | public slots: |
234 | virtual void updateView(); | 236 | virtual void updateView(); |
235 | virtual void updateConfig(); | 237 | virtual void updateConfig(); |
236 | virtual void showDates(const QDate &start, const QDate &end); | 238 | virtual void showDates(const QDate &start, const QDate &end); |
237 | virtual void showEvents(QPtrList<Event> eventList); | 239 | virtual void showEvents(QPtrList<Event> eventList); |
238 | 240 | ||
239 | void changeEventDisplay(Event *, int); | 241 | void changeEventDisplay(Event *, int); |
240 | 242 | ||
241 | void clearSelection(); | 243 | void clearSelection(); |
242 | 244 | ||
243 | void showContextMenu( Incidence * ); | 245 | void showContextMenu( Incidence * ); |
244 | 246 | ||
245 | void setSelectedCell( MonthViewCell * ); | 247 | void setSelectedCell( MonthViewCell * ); |
246 | void switchView(); | 248 | void switchView(); |
247 | 249 | ||
248 | protected slots: | 250 | protected slots: |
249 | void selectInternalWeekNum ( int ); | 251 | void selectInternalWeekNum ( int ); |
250 | void processSelectionChange(); | 252 | void processSelectionChange(); |
251 | signals: | 253 | signals: |
252 | void nextMonth(); | 254 | void nextMonth(); |
253 | void prevMonth(); | 255 | void prevMonth(); |
254 | void selectWeekNum ( int ); | 256 | void selectWeekNum ( int ); |
255 | void selectMonth (); | 257 | void selectMonth (); |
256 | void showDaySignal( QDate ); | 258 | void showDaySignal( QDate ); |
257 | protected: | 259 | protected: |
258 | void resizeEvent(QResizeEvent *); | 260 | void resizeEvent(QResizeEvent *); |
259 | void viewChanged(); | 261 | void viewChanged(); |
260 | void updateDayLabels(); | 262 | void updateDayLabels(); |
261 | 263 | ||
262 | private: | 264 | private: |
263 | NavigatorBar* mNavigatorBar; | 265 | NavigatorBar* mNavigatorBar; |
264 | int currentWeek(); | 266 | int currentWeek(); |
265 | bool clPending; | 267 | bool clPending; |
266 | QWidgetStack * mWidStack; | 268 | QWidgetStack * mWidStack; |
267 | QWidget* mMonthView; | 269 | QWidget* mMonthView; |
268 | QWidget* mWeekView; | 270 | QWidget* mWeekView; |
269 | bool mShowWeekView; | 271 | bool mShowWeekView; |
270 | bool updatePossible; | 272 | bool updatePossible; |
271 | int mDaysPerWeek; | 273 | int mDaysPerWeek; |
272 | int mNumWeeks; | 274 | int mNumWeeks; |
273 | int mNumCells; | 275 | int mNumCells; |
274 | bool mWeekStartsMonday; | 276 | bool mWeekStartsMonday; |
275 | bool mShowSatSunComp; | 277 | bool mShowSatSunComp; |
276 | void computeLayout(); | 278 | void computeLayout(); |
277 | void computeLayoutWeek(); | 279 | void computeLayoutWeek(); |
278 | 280 | ||
279 | QPtrVector<MonthViewCell> mCells; | 281 | QPtrVector<MonthViewCell> mCells; |
280 | QPtrVector<QLabel> mDayLabels; | 282 | QPtrVector<QLabel> mDayLabels; |
281 | QPtrVector<KOWeekButton> mWeekLabels; | 283 | QPtrVector<KOWeekButton> mWeekLabels; |
282 | QPtrVector<MonthViewCell> mCellsW; | 284 | QPtrVector<MonthViewCell> mCellsW; |
283 | QPtrVector<QLabel> mDayLabelsW; | 285 | QPtrVector<QLabel> mDayLabelsW; |
284 | QPtrVector<KOWeekButton> mWeekLabelsW; | 286 | QPtrVector<KOWeekButton> mWeekLabelsW; |
285 | 287 | ||
286 | bool mShortDayLabelsM; | 288 | bool mShortDayLabelsM; |
287 | bool mShortDayLabelsW; | 289 | bool mShortDayLabelsW; |
288 | int mWidthLongDayLabel; | 290 | int mWidthLongDayLabel; |
289 | 291 | ||
290 | QDate mStartDate; | 292 | QDate mStartDate; |
291 | 293 | ||
292 | MonthViewCell *mSelectedCell; | 294 | MonthViewCell *mSelectedCell; |
293 | 295 | ||
294 | KOEventPopupMenu *mContextMenu; | 296 | KOEventPopupMenu *mContextMenu; |
295 | void keyPressEvent ( QKeyEvent * ) ; | 297 | void keyPressEvent ( QKeyEvent * ) ; |
296 | 298 | ||
297 | }; | 299 | }; |
298 | 300 | ||
299 | #endif | 301 | #endif |