-rw-r--r-- | korganizer/komonthview.cpp | 146 | ||||
-rw-r--r-- | korganizer/komonthview.h | 5 |
2 files changed, 90 insertions, 61 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index e66ddce..4dfb9df 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,607 +1,624 @@ | |||
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 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
21 | #include <qfont.h> | 21 | #include <qfont.h> |
22 | #include <qfontmetrics.h> | 22 | #include <qfontmetrics.h> |
23 | #include <qkeycode.h> | 23 | #include <qkeycode.h> |
24 | #include <qhbox.h> | 24 | #include <qhbox.h> |
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qwidgetstack.h> | 26 | #include <qwidgetstack.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qtooltip.h> | 28 | #include <qtooltip.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
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 | resetOnFocusIn = true; | 86 | resetOnFocusIn = true; |
87 | setVScrollBarMode(QScrollView::AlwaysOff); | 87 | setVScrollBarMode(QScrollView::AlwaysOff); |
88 | setHScrollBarMode(QScrollView::AlwaysOff); | 88 | setHScrollBarMode(QScrollView::AlwaysOff); |
89 | } | 89 | } |
90 | KNoScrollListBox::~KNoScrollListBox() | 90 | KNoScrollListBox::~KNoScrollListBox() |
91 | { | 91 | { |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) | 96 | void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) |
97 | { | 97 | { |
98 | QListBox::focusInEvent ( e ); | 98 | QListBox::focusInEvent ( e ); |
99 | QListBoxItem * i = item ( 0 ); | 99 | if ( count() ){ |
100 | if ( i && resetOnFocusIn ) { | 100 | int ci = currentItem(); |
101 | setCurrentItem( i ); | 101 | if ( ci < 0 ) ci = 0; |
102 | setSelected ( 0, true ); | 102 | |
103 | } | 103 | setCurrentItem( ci ); |
104 | resetOnFocusIn = true; | 104 | setSelected ( ci, true ); |
105 | 105 | emit highlighted( item ( ci ) ); | |
106 | if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { | 106 | |
107 | QListBoxItem *fi = firstItem (); | 107 | resetOnFocusIn = true; |
108 | if (fi ) { | 108 | |
109 | int ihei = fi->height( this ); | 109 | if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { |
110 | int hei = numRows () * ihei; | 110 | QListBoxItem *fi = firstItem (); |
111 | if ( hei < height() - horizontalScrollBar()->height () ) { | 111 | if (fi ) { |
112 | setVScrollBarMode(QScrollView::AlwaysOff); | 112 | int ihei = fi->height( this ); |
113 | } | 113 | int hei = numRows () * ihei; |
114 | else | 114 | if ( hei < height() - horizontalScrollBar()->height () ) { |
115 | setVScrollBarMode(QScrollView::AlwaysOff); | ||
116 | } | ||
117 | else | ||
118 | setVScrollBarMode(QScrollView::Auto); | ||
119 | if ( ihei *3 > height() ) { | ||
120 | setHScrollBarMode(QScrollView::AlwaysOff); | ||
121 | } | ||
122 | else { | ||
123 | setHScrollBarMode(QScrollView::Auto); | ||
124 | } | ||
125 | } else { | ||
115 | setVScrollBarMode(QScrollView::Auto); | 126 | setVScrollBarMode(QScrollView::Auto); |
116 | if ( ihei *3 > height() ) { | ||
117 | setHScrollBarMode(QScrollView::AlwaysOff); | ||
118 | } | ||
119 | else { | ||
120 | setHScrollBarMode(QScrollView::Auto); | 127 | setHScrollBarMode(QScrollView::Auto); |
121 | } | 128 | } |
122 | } else { | 129 | } |
123 | setVScrollBarMode(QScrollView::Auto); | 130 | } |
124 | setHScrollBarMode(QScrollView::Auto); | ||
125 | } | ||
126 | } | ||
127 | } | 131 | } |
128 | void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) | 132 | void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) |
129 | { | 133 | { |
130 | int i = currentItem (); | 134 | int i = currentItem (); |
131 | if ( i >= 0 ) { | 135 | if ( i >= 0 ) { |
132 | setSelected ( i, false ); | 136 | setSelected ( i, false ); |
133 | } | 137 | } |
134 | QListBox::focusOutEvent ( e ); | 138 | QListBox::focusOutEvent ( e ); |
135 | setVScrollBarMode(QScrollView::AlwaysOff); | 139 | setVScrollBarMode(QScrollView::AlwaysOff); |
136 | setHScrollBarMode(QScrollView::AlwaysOff); | 140 | setHScrollBarMode(QScrollView::AlwaysOff); |
137 | } | 141 | } |
138 | 142 | ||
139 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 143 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
140 | { | 144 | { |
141 | QListBoxItem* item = itemAt ( p ); | 145 | QListBoxItem* item = itemAt ( p ); |
142 | if ( ! item ) { | 146 | if ( ! item ) { |
143 | return i18n("Click in the cell\nto add an event!"); | 147 | return i18n("Click in the cell\nto add an event!"); |
144 | } | 148 | } |
145 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), | 149 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
146 | KOPrefs::instance()->mWTshowDetails, | 150 | KOPrefs::instance()->mWTshowDetails, |
147 | KOPrefs::instance()->mWTshowCreated, | 151 | KOPrefs::instance()->mWTshowCreated, |
148 | KOPrefs::instance()->mWTshowChanged); | 152 | KOPrefs::instance()->mWTshowChanged); |
149 | } | 153 | } |
150 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 154 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
151 | { | 155 | { |
152 | //qDebug("KNoScrollListBox::keyPressEvent "); | 156 | //qDebug("KNoScrollListBox::keyPressEvent "); |
153 | switch(e->key()) { | 157 | switch(e->key()) { |
154 | case Key_Right: | 158 | case Key_Right: |
155 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 159 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
156 | { | 160 | { |
157 | e->ignore(); | 161 | e->ignore(); |
158 | return; | 162 | return; |
159 | } | 163 | } |
160 | scrollBy(10,0); | 164 | scrollBy(10,0); |
161 | break; | 165 | break; |
162 | case Key_Left: | 166 | case Key_Left: |
163 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 167 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
164 | { | 168 | { |
165 | e->ignore(); | 169 | e->ignore(); |
166 | return; | 170 | return; |
167 | } | 171 | } |
168 | scrollBy(-10,0); | 172 | scrollBy(-10,0); |
169 | break; | 173 | break; |
170 | case Key_Up: | 174 | case Key_Up: |
171 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 175 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
172 | e->ignore(); | 176 | e->ignore(); |
173 | break; | 177 | break; |
174 | } | 178 | } |
175 | if ( count() ) { | 179 | if ( count() ) { |
176 | setCurrentItem((currentItem()+count()-1)%count()); | 180 | if ( currentItem() == 0 ) { |
177 | if(!itemVisible(currentItem())) { | 181 | emit prevCell(); |
178 | if((unsigned int) currentItem() == (count()-1)) { | 182 | } else { |
179 | setTopItem(currentItem()-numItemsVisible()+1); | 183 | setCurrentItem((currentItem()+count()-1)%count()); |
180 | } else { | 184 | if(!itemVisible(currentItem())) { |
181 | setTopItem(topItem()-1); | 185 | if((unsigned int) currentItem() == (count()-1)) { |
186 | setTopItem(currentItem()-numItemsVisible()+1); | ||
187 | } else { | ||
188 | setTopItem(topItem()-1); | ||
189 | } | ||
182 | } | 190 | } |
183 | } | 191 | } |
184 | } | 192 | } |
185 | break; | 193 | break; |
186 | case Key_Down: | 194 | case Key_Down: |
187 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 195 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
188 | e->ignore(); | 196 | e->ignore(); |
189 | break; | 197 | break; |
190 | } | 198 | } |
191 | if ( count () ) { | 199 | if ( count () ) { |
192 | setCurrentItem((currentItem()+1)%count()); | 200 | if ( currentItem()+1 == count () ) { |
193 | if(!itemVisible(currentItem())) { | 201 | emit nextCell(); |
194 | if(currentItem() == 0) { | 202 | } else { |
195 | setTopItem(0); | 203 | setCurrentItem((currentItem()+1)%count()); |
196 | } else { | 204 | if(!itemVisible(currentItem())) { |
197 | setTopItem(topItem()+1); | 205 | if(currentItem() == 0) { |
206 | setTopItem(0); | ||
207 | } else { | ||
208 | setTopItem(topItem()+1); | ||
209 | } | ||
198 | } | 210 | } |
199 | } | 211 | } |
200 | } | 212 | } |
201 | break; | 213 | break; |
202 | case Key_I: | 214 | case Key_I: |
203 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); | 215 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); |
204 | e->ignore(); | 216 | e->ignore(); |
205 | break; | 217 | break; |
206 | case Key_Return: | 218 | case Key_Return: |
207 | case Key_Enter: | 219 | case Key_Enter: |
208 | { | 220 | { |
209 | if ( currentItem() >= 0 ) { | 221 | if ( currentItem() >= 0 ) { |
210 | emit doubleClicked( item( currentItem() ) ); | 222 | emit doubleClicked( item( currentItem() ) ); |
211 | e->accept(); | 223 | e->accept(); |
212 | } else { | 224 | } else { |
213 | e->ignore(); | 225 | e->ignore(); |
214 | } | 226 | } |
215 | } | 227 | } |
216 | break; | 228 | break; |
217 | case Key_Shift: | 229 | case Key_Shift: |
218 | emit shiftDown(); | 230 | emit shiftDown(); |
219 | break; | 231 | break; |
220 | default: | 232 | default: |
221 | e->ignore(); | 233 | e->ignore(); |
222 | break; | 234 | break; |
223 | } | 235 | } |
224 | } | 236 | } |
225 | 237 | ||
226 | void KNoScrollListBox::oneDown() | 238 | void KNoScrollListBox::oneDown() |
227 | { | 239 | { |
228 | if ( count () ) { | 240 | if ( count () ) { |
229 | resetOnFocusIn = false; | 241 | if ( currentItem()+1 == count () ) { |
230 | setCurrentItem((currentItem()+1)%count()); | 242 | emit nextCell(); |
231 | if(!itemVisible(currentItem())) { | 243 | } else { |
232 | if(currentItem() == 0) { | 244 | resetOnFocusIn = false; |
233 | setTopItem(0); | 245 | setCurrentItem((currentItem()+1)%count()); |
234 | } else { | 246 | if(!itemVisible(currentItem())) { |
235 | setTopItem(topItem()+1); | 247 | if(currentItem() == 0) { |
248 | setTopItem(0); | ||
249 | } else { | ||
250 | setTopItem(topItem()+1); | ||
251 | } | ||
236 | } | 252 | } |
237 | } | 253 | } |
238 | } | 254 | } |
239 | } | 255 | } |
240 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 256 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
241 | { | 257 | { |
242 | switch(e->key()) { | 258 | switch(e->key()) { |
243 | case Key_Shift: | 259 | case Key_Shift: |
244 | emit shiftUp(); | 260 | emit shiftUp(); |
245 | break; | 261 | break; |
246 | default: | 262 | default: |
247 | break; | 263 | break; |
248 | } | 264 | } |
249 | } | 265 | } |
250 | 266 | ||
251 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 267 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
252 | { | 268 | { |
253 | QListBox::mousePressEvent(e); | 269 | QListBox::mousePressEvent(e); |
254 | 270 | ||
255 | if(e->button() == RightButton) { | 271 | if(e->button() == RightButton) { |
256 | emit rightClick(); | 272 | emit rightClick(); |
257 | } | 273 | } |
258 | } | 274 | } |
259 | 275 | ||
260 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 276 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
261 | : QListBoxItem() | 277 | : QListBoxItem() |
262 | { | 278 | { |
263 | mblockRepaint = true; | 279 | mblockRepaint = true; |
264 | setText( s ); | 280 | setText( s ); |
265 | mMultiday = 0; | 281 | mMultiday = 0; |
266 | mIncidence = incidence; | 282 | mIncidence = incidence; |
267 | mDate = qd; | 283 | mDate = qd; |
268 | mRecur = false; | 284 | mRecur = false; |
269 | mAlarm = false; | 285 | mAlarm = false; |
270 | mReply = false; | 286 | mReply = false; |
271 | mInfo = false; | 287 | mInfo = false; |
272 | mdayPos = 0; | 288 | mdayPos = 0; |
273 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 289 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
274 | //qDebug("NEWWWWWWWWWWWWW "); | 290 | //qDebug("NEWWWWWWWWWWWWW "); |
275 | } | 291 | } |
276 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | 292 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) |
277 | { | 293 | { |
278 | setText( s ); | 294 | setText( s ); |
279 | mMultiday = 0; | 295 | mMultiday = 0; |
280 | mIncidence = incidence; | 296 | mIncidence = incidence; |
281 | mDate = qd; | 297 | mDate = qd; |
282 | mRecur = false; | 298 | mRecur = false; |
283 | mAlarm = false; | 299 | mAlarm = false; |
284 | mReply = false; | 300 | mReply = false; |
285 | mInfo = false; | 301 | mInfo = false; |
286 | mdayPos = 0; | 302 | mdayPos = 0; |
287 | //qDebug("recucleeeeeeeeeeeeeeeee "); | 303 | //qDebug("recucleeeeeeeeeeeeeeeee "); |
288 | } | 304 | } |
289 | 305 | ||
290 | void MonthViewItem::paint(QPainter *p) | 306 | void MonthViewItem::paint(QPainter *p) |
291 | { | 307 | { |
292 | if ( mblockRepaint ) { | 308 | if ( mblockRepaint ) { |
293 | //qDebug("block "); | 309 | //qDebug("block "); |
294 | return; | 310 | return; |
295 | } | 311 | } |
296 | //qDebug("NON block "); | 312 | //qDebug("NON block "); |
297 | #if QT_VERSION >= 0x030000 | 313 | #if QT_VERSION >= 0x030000 |
298 | bool sel = isSelected(); | 314 | bool sel = isSelected(); |
299 | #else | 315 | #else |
300 | bool sel = selected(); | 316 | bool sel = selected(); |
301 | #endif | 317 | #endif |
302 | 318 | ||
303 | 319 | ||
304 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 320 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
305 | { | 321 | { |
306 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 322 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
307 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 323 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
308 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 324 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
309 | } | 325 | } |
310 | int x = 1; | 326 | int x = 1; |
311 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 327 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
312 | int size = PIXMAP_SIZE; | 328 | int size = PIXMAP_SIZE; |
313 | if ( QApplication::desktop()->width() < 300 ) | 329 | if ( QApplication::desktop()->width() < 300 ) |
314 | size = 3; | 330 | size = 3; |
315 | int heihei = height( listBox () ); | 331 | int heihei = height( listBox () ); |
316 | int y = (heihei - size -1 ) /2; | 332 | int y = (heihei - size -1 ) /2; |
317 | 333 | ||
318 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 334 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
319 | if ( mInfo ) { | 335 | if ( mInfo ) { |
320 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 336 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
321 | x += size + 1; | 337 | x += size + 1; |
322 | } | 338 | } |
323 | if ( mRecur ) { | 339 | if ( mRecur ) { |
324 | p->fillRect ( x, y,size,size, Qt::blue ); | 340 | p->fillRect ( x, y,size,size, Qt::blue ); |
325 | x += size + 1; | 341 | x += size + 1; |
326 | } | 342 | } |
327 | if ( mAlarm ) { | 343 | if ( mAlarm ) { |
328 | p->fillRect ( x, y,size,size, Qt::red ); | 344 | p->fillRect ( x, y,size,size, Qt::red ); |
329 | x += size + 1; | 345 | x += size + 1; |
330 | } | 346 | } |
331 | if ( mReply ) { | 347 | if ( mReply ) { |
332 | p->fillRect ( x, y,size,size, Qt::yellow ); | 348 | p->fillRect ( x, y,size,size, Qt::yellow ); |
333 | x += size + 1; | 349 | x += size + 1; |
334 | } | 350 | } |
335 | } | 351 | } |
336 | if ( mMultiday ) { | 352 | if ( mMultiday ) { |
337 | int yyy = y+(size/2); | 353 | int yyy = y+(size/2); |
338 | int sizeM = size+2; | 354 | int sizeM = size+2; |
339 | p->setBrush( QBrush::SolidPattern ); | 355 | p->setBrush( QBrush::SolidPattern ); |
340 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
341 | if ( mMultiday == 2 || mMultiday == 3 ) { | 357 | if ( mMultiday == 2 || mMultiday == 3 ) { |
342 | QPointArray pa ( 3 ); | 358 | QPointArray pa ( 3 ); |
343 | pa.setPoint (0, x, yyy ); | 359 | pa.setPoint (0, x, yyy ); |
344 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
345 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
346 | p->drawPolygon( pa ); | 362 | p->drawPolygon( pa ); |
347 | } | 363 | } |
348 | if ( mMultiday == 2 || mMultiday == 1 ) { | 364 | if ( mMultiday == 2 || mMultiday == 1 ) { |
349 | QPointArray pa ( 3 ); | 365 | QPointArray pa ( 3 ); |
350 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
351 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
352 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
353 | p->drawPolygon( pa ); | 369 | p->drawPolygon( pa ); |
354 | } | 370 | } |
355 | if ( mMultiday == 1 ) { | 371 | if ( mMultiday == 1 ) { |
356 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
357 | 373 | ||
358 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
359 | } | 375 | } |
360 | if ( mMultiday == 3 ) { | 376 | if ( mMultiday == 3 ) { |
361 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
362 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
363 | 379 | ||
364 | } | 380 | } |
365 | x += sizeM/2 + 1; | 381 | x += sizeM/2 + 1; |
366 | x += sizeM + 1; | 382 | x += sizeM + 1; |
367 | } | 383 | } |
368 | 384 | ||
369 | if ( mIncidence->type() == "Todo" ){ | 385 | if ( mIncidence->type() == "Todo" ){ |
370 | Todo* td = ( Todo* ) mIncidence; | 386 | Todo* td = ( Todo* ) mIncidence; |
371 | if ( td->isCompleted() ) { | 387 | if ( td->isCompleted() ) { |
372 | int half = size/2; | 388 | int half = size/2; |
373 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 389 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
374 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 390 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
375 | x += half+half + 4; | 391 | x += half+half + 4; |
376 | 392 | ||
377 | } else { | 393 | } else { |
378 | int val = td->percentComplete()/20; | 394 | int val = td->percentComplete()/20; |
379 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); | 395 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); |
380 | p->drawRect ( x, y-2,7,size+4); | 396 | p->drawRect ( x, y-2,7,size+4); |
381 | x += size + 3; | 397 | x += size + 3; |
382 | } | 398 | } |
383 | } | 399 | } |
384 | QFontMetrics fm = p->fontMetrics(); | 400 | QFontMetrics fm = p->fontMetrics(); |
385 | int yPos; | 401 | int yPos; |
386 | int pmheight = size; | 402 | int pmheight = size; |
387 | if( pmheight < fm.height() ) | 403 | if( pmheight < fm.height() ) |
388 | yPos = fm.ascent() + fm.leading()/2; | 404 | yPos = fm.ascent() + fm.leading()/2; |
389 | else | 405 | else |
390 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 406 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
391 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 407 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
392 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 408 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
393 | p->drawText( x, yPos, text() ); | 409 | p->drawText( x, yPos, text() ); |
394 | if ( mIncidence->cancelled() ) { | 410 | if ( mIncidence->cancelled() ) { |
395 | int wid = fm.width( text() ); | 411 | int wid = fm.width( text() ); |
396 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 412 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
397 | } | 413 | } |
398 | 414 | ||
399 | } | 415 | } |
400 | 416 | ||
401 | int MonthViewItem::height(const QListBox *lb) const | 417 | int MonthViewItem::height(const QListBox *lb) const |
402 | { | 418 | { |
403 | int ret = 10; | 419 | int ret = 10; |
404 | if ( lb ) | 420 | if ( lb ) |
405 | ret = lb->fontMetrics().lineSpacing()+1; | 421 | ret = lb->fontMetrics().lineSpacing()+1; |
406 | return ret; | 422 | return ret; |
407 | } | 423 | } |
408 | 424 | ||
409 | int MonthViewItem::width(const QListBox *lb) const | 425 | int MonthViewItem::width(const QListBox *lb) const |
410 | { | 426 | { |
411 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { | 427 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { |
412 | int size = PIXMAP_SIZE; | 428 | int size = PIXMAP_SIZE; |
413 | if ( QApplication::desktop()->width() < 300 ) | 429 | if ( QApplication::desktop()->width() < 300 ) |
414 | size = 3; | 430 | size = 3; |
415 | int x = 1; | 431 | int x = 1; |
416 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 432 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
417 | if ( mInfo ) { | 433 | if ( mInfo ) { |
418 | x += size + 1; | 434 | x += size + 1; |
419 | } | 435 | } |
420 | if( mRecur ) { | 436 | if( mRecur ) { |
421 | x += size+1; | 437 | x += size+1; |
422 | } | 438 | } |
423 | if( mAlarm ) { | 439 | if( mAlarm ) { |
424 | x += size+1; | 440 | x += size+1; |
425 | } | 441 | } |
426 | if( mReply ) { | 442 | if( mReply ) { |
427 | x += size+1; | 443 | x += size+1; |
428 | } | 444 | } |
429 | } | 445 | } |
430 | if( mMultiday ) { | 446 | if( mMultiday ) { |
431 | x += size+1+2+size/2; | 447 | x += size+1+2+size/2; |
432 | } | 448 | } |
433 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 449 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
434 | } | 450 | } |
435 | if ( ! lb ) | 451 | if ( ! lb ) |
436 | return 10; | 452 | return 10; |
437 | //qDebug("ret wid %d ", lb->width()); | 453 | //qDebug("ret wid %d ", lb->width()); |
438 | return lb->width(); | 454 | return lb->width(); |
439 | } | 455 | } |
440 | 456 | ||
441 | 457 | ||
442 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 458 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
443 | : KNoScrollListBox( par ), | 459 | : KNoScrollListBox( par ), |
444 | mMonthView( parent ) | 460 | mMonthView( parent ) |
445 | { | 461 | { |
446 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); | 462 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); |
447 | currentPalette = 0; | 463 | currentPalette = 0; |
448 | // mLabel = new QLabel( this );QPushButton | 464 | // mLabel = new QLabel( this );QPushButton |
449 | mLabel = new QPushButton( this ); | 465 | mLabel = new QPushButton( this ); |
450 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 466 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
451 | //mLabel->setLineWidth( 1 ); | 467 | //mLabel->setLineWidth( 1 ); |
452 | //mLabel->setAlignment( AlignCenter ); | 468 | //mLabel->setAlignment( AlignCenter ); |
453 | mLabel->setFlat( true ); | 469 | mLabel->setFlat( true ); |
454 | mLabel->setFocusPolicy(NoFocus); | 470 | mLabel->setFocusPolicy(NoFocus); |
455 | //mItemList = new KNoScrollListBox( this ); | 471 | //mItemList = new KNoScrollListBox( this ); |
456 | setMinimumSize( 10, 10 ); | 472 | setMinimumSize( 10, 10 ); |
457 | setFrameStyle( QFrame::Panel | QFrame::Plain ); | 473 | setFrameStyle( QFrame::Panel | QFrame::Plain ); |
458 | setLineWidth( 1 ); | 474 | setLineWidth( 1 ); |
459 | //topLayout->addWidget( mItemList ); | 475 | //topLayout->addWidget( mItemList ); |
460 | mLabel->raise(); | 476 | mLabel->raise(); |
461 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 477 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
462 | mStandardPalette = palette(); | 478 | mStandardPalette = palette(); |
463 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 479 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
464 | 480 | ||
465 | enableScrollBars( false ); | 481 | enableScrollBars( false ); |
466 | updateConfig(); | 482 | updateConfig(); |
467 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 483 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
468 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 484 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
469 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), | 485 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), |
470 | SLOT( defaultAction( QListBoxItem * ) ) ); | 486 | SLOT( defaultAction( QListBoxItem * ) ) ); |
471 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, | 487 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, |
472 | const QPoint &) ), | 488 | const QPoint &) ), |
473 | SLOT( contextMenu( QListBoxItem * ) ) ); | 489 | SLOT( contextMenu( QListBoxItem * ) ) ); |
474 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), | 490 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), |
475 | SLOT( selection( QListBoxItem * ) ) ); | 491 | SLOT( selection( QListBoxItem * ) ) ); |
476 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 492 | |
477 | SLOT( cellClicked( QListBoxItem * ) ) ); | 493 | /* |
478 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 494 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
479 | SLOT( selection( QListBoxItem * ) ) ); | 495 | SLOT( selection( QListBoxItem * ) ) ); |
496 | */ | ||
480 | } | 497 | } |
481 | #ifdef DESKTOP_VERSION | 498 | #ifdef DESKTOP_VERSION |
482 | QToolTipGroup *MonthViewCell::toolTipGroup() | 499 | QToolTipGroup *MonthViewCell::toolTipGroup() |
483 | { | 500 | { |
484 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 501 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
485 | return mToolTipGroup; | 502 | return mToolTipGroup; |
486 | } | 503 | } |
487 | #endif | 504 | #endif |
488 | 505 | ||
489 | void MonthViewCell::setDate( const QDate &date ) | 506 | void MonthViewCell::setDate( const QDate &date ) |
490 | { | 507 | { |
491 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 508 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
492 | mDate = date; | 509 | mDate = date; |
493 | 510 | ||
494 | 511 | ||
495 | 512 | ||
496 | //resizeEvent( 0 ); | 513 | //resizeEvent( 0 ); |
497 | } | 514 | } |
498 | 515 | ||
499 | QDate MonthViewCell::date() const | 516 | QDate MonthViewCell::date() const |
500 | { | 517 | { |
501 | return mDate; | 518 | return mDate; |
502 | } | 519 | } |
503 | 520 | ||
504 | void MonthViewCell::setPrimary( bool primary ) | 521 | void MonthViewCell::setPrimary( bool primary ) |
505 | { | 522 | { |
506 | mPrimary = primary; | 523 | mPrimary = primary; |
507 | //setMyPalette(); | 524 | //setMyPalette(); |
508 | } | 525 | } |
509 | void MonthViewCell::setMyPalette() | 526 | void MonthViewCell::setMyPalette() |
510 | { | 527 | { |
511 | 528 | ||
512 | if ( mHoliday) { | 529 | if ( mHoliday) { |
513 | if ( currentPalette == 1 ) return; | 530 | if ( currentPalette == 1 ) return; |
514 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 531 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
515 | setPalette( mHolidayPalette ); | 532 | setPalette( mHolidayPalette ); |
516 | //mLabel->setPalette( mHolidayPalette ); | 533 | //mLabel->setPalette( mHolidayPalette ); |
517 | currentPalette = 1; | 534 | currentPalette = 1; |
518 | 535 | ||
519 | } else { | 536 | } else { |
520 | if ( mPrimary ) { | 537 | if ( mPrimary ) { |
521 | if ( currentPalette == 2 ) return; | 538 | if ( currentPalette == 2 ) return; |
522 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 539 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
523 | //mLabel->setPalette( mPrimaryPalette ); | 540 | //mLabel->setPalette( mPrimaryPalette ); |
524 | setPalette( mPrimaryPalette ); | 541 | setPalette( mPrimaryPalette ); |
525 | currentPalette = 2; | 542 | currentPalette = 2; |
526 | 543 | ||
527 | } else { | 544 | } else { |
528 | if ( currentPalette == 3 ) return; | 545 | if ( currentPalette == 3 ) return; |
529 | setPalette( mNonPrimaryPalette ); | 546 | setPalette( mNonPrimaryPalette ); |
530 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 547 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
531 | //mLabel->setPalette( mNonPrimaryPalette );; | 548 | //mLabel->setPalette( mNonPrimaryPalette );; |
532 | currentPalette = 3; | 549 | currentPalette = 3; |
533 | } | 550 | } |
534 | } | 551 | } |
535 | //QPalette pal = palette(); | 552 | //QPalette pal = palette(); |
536 | 553 | ||
537 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 554 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
538 | } | 555 | } |
539 | QPalette MonthViewCell::getPalette () | 556 | QPalette MonthViewCell::getPalette () |
540 | { | 557 | { |
541 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 558 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
542 | return mStandardPalette; | 559 | return mStandardPalette; |
543 | if ( mHoliday) { | 560 | if ( mHoliday) { |
544 | return mHolidayPalette ; | 561 | return mHolidayPalette ; |
545 | } else { | 562 | } else { |
546 | if ( mPrimary ) { | 563 | if ( mPrimary ) { |
547 | return mPrimaryPalette ; | 564 | return mPrimaryPalette ; |
548 | } | 565 | } |
549 | } | 566 | } |
550 | return mNonPrimaryPalette; | 567 | return mNonPrimaryPalette; |
551 | } | 568 | } |
552 | bool MonthViewCell::isPrimary() const | 569 | bool MonthViewCell::isPrimary() const |
553 | { | 570 | { |
554 | return mPrimary; | 571 | return mPrimary; |
555 | } | 572 | } |
556 | 573 | ||
557 | void MonthViewCell::setHoliday( bool holiday ) | 574 | void MonthViewCell::setHoliday( bool holiday ) |
558 | { | 575 | { |
559 | mHoliday = holiday; | 576 | mHoliday = holiday; |
560 | //setMyPalette(); | 577 | //setMyPalette(); |
561 | } | 578 | } |
562 | 579 | ||
563 | void MonthViewCell::setHoliday( const QString &holiday ) | 580 | void MonthViewCell::setHoliday( const QString &holiday ) |
564 | { | 581 | { |
565 | mHolidayString = holiday; | 582 | mHolidayString = holiday; |
566 | 583 | ||
567 | if ( !holiday.isEmpty() ) { | 584 | if ( !holiday.isEmpty() ) { |
568 | setHoliday( true ); | 585 | setHoliday( true ); |
569 | } | 586 | } |
570 | } | 587 | } |
571 | 588 | ||
572 | void MonthViewCell::startUpdateCell() | 589 | void MonthViewCell::startUpdateCell() |
573 | { | 590 | { |
574 | mdayCount = 0; | 591 | mdayCount = 0; |
575 | setFocusPolicy(NoFocus); | 592 | setFocusPolicy(NoFocus); |
576 | if ( !mMonthView->isUpdatePossible() ) | 593 | if ( !mMonthView->isUpdatePossible() ) |
577 | return; | 594 | return; |
578 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 595 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
579 | while ( mitem ) { | 596 | while ( mitem ) { |
580 | mitem->setBlockRepaint( true ); | 597 | mitem->setBlockRepaint( true ); |
581 | mitem = (MonthViewItem *)mitem->next(); | 598 | mitem = (MonthViewItem *)mitem->next(); |
582 | } | 599 | } |
583 | if ( mAvailItemList.count() > 20 ) { | 600 | if ( mAvailItemList.count() > 20 ) { |
584 | mAvailItemList.setAutoDelete( true ); | 601 | mAvailItemList.setAutoDelete( true ); |
585 | mAvailItemList.clear(); | 602 | mAvailItemList.clear(); |
586 | mAvailItemList.setAutoDelete( false ); | 603 | mAvailItemList.setAutoDelete( false ); |
587 | } | 604 | } |
588 | /* | 605 | /* |
589 | if ( !isVisible() ){ | 606 | if ( !isVisible() ){ |
590 | return; | 607 | return; |
591 | } | 608 | } |
592 | */ | 609 | */ |
593 | // qDebug("MonthViewCell::updateCell() "); | 610 | // qDebug("MonthViewCell::updateCell() "); |
594 | setPrimary( mDate.month()%2 ); | 611 | setPrimary( mDate.month()%2 ); |
595 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 612 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
596 | if ( mDate == QDate::currentDate() ) { | 613 | if ( mDate == QDate::currentDate() ) { |
597 | setLineWidth( 3 ); | 614 | setLineWidth( 3 ); |
598 | } else { | 615 | } else { |
599 | setLineWidth( 1 ); | 616 | setLineWidth( 1 ); |
600 | } | 617 | } |
601 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); | 618 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); |
602 | //clear(); | 619 | //clear(); |
603 | while ( CurrentAvailItem ) { | 620 | while ( CurrentAvailItem ) { |
604 | MonthViewItem *item = CurrentAvailItem; | 621 | MonthViewItem *item = CurrentAvailItem; |
605 | CurrentAvailItem = (MonthViewItem *)item->next(); | 622 | CurrentAvailItem = (MonthViewItem *)item->next(); |
606 | mAvailItemList.append( item ); | 623 | mAvailItemList.append( item ); |
607 | takeItem ( item ); | 624 | takeItem ( item ); |
@@ -864,431 +881,431 @@ void MonthViewCell::updateConfig( bool bigFont ) // = false | |||
864 | } else | 881 | } else |
865 | setFont( KOPrefs::instance()->mMonthViewFont ); | 882 | setFont( KOPrefs::instance()->mMonthViewFont ); |
866 | 883 | ||
867 | QFontMetrics fm( font() ); | 884 | QFontMetrics fm( font() ); |
868 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 885 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
869 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 886 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
870 | mHolidayPalette = mStandardPalette; | 887 | mHolidayPalette = mStandardPalette; |
871 | mPrimaryPalette = mStandardPalette; | 888 | mPrimaryPalette = mStandardPalette; |
872 | mNonPrimaryPalette = mStandardPalette; | 889 | mNonPrimaryPalette = mStandardPalette; |
873 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 890 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
874 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 891 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
875 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 892 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
876 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 893 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
877 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 894 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
878 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 895 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
879 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 896 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
880 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 897 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
881 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 898 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
882 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 899 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
883 | } | 900 | } |
884 | //updateCell(); | 901 | //updateCell(); |
885 | } | 902 | } |
886 | 903 | ||
887 | void MonthViewCell::enableScrollBars( bool enabled ) | 904 | void MonthViewCell::enableScrollBars( bool enabled ) |
888 | { | 905 | { |
889 | 906 | ||
890 | return; | 907 | return; |
891 | if ( enabled ) { | 908 | if ( enabled ) { |
892 | QListBoxItem *fi = firstItem (); | 909 | QListBoxItem *fi = firstItem (); |
893 | if (fi ) { | 910 | if (fi ) { |
894 | int ihei = fi->height( this ); | 911 | int ihei = fi->height( this ); |
895 | int hei = numRows () * ihei; | 912 | int hei = numRows () * ihei; |
896 | if ( hei < height() - horizontalScrollBar()->height () ) { | 913 | if ( hei < height() - horizontalScrollBar()->height () ) { |
897 | setVScrollBarMode(QScrollView::AlwaysOff); | 914 | setVScrollBarMode(QScrollView::AlwaysOff); |
898 | } | 915 | } |
899 | else | 916 | else |
900 | setVScrollBarMode(QScrollView::Auto); | 917 | setVScrollBarMode(QScrollView::Auto); |
901 | if ( ihei *3 > height() ) { | 918 | if ( ihei *3 > height() ) { |
902 | setHScrollBarMode(QScrollView::AlwaysOff); | 919 | setHScrollBarMode(QScrollView::AlwaysOff); |
903 | } | 920 | } |
904 | else { | 921 | else { |
905 | setHScrollBarMode(QScrollView::Auto); | 922 | setHScrollBarMode(QScrollView::Auto); |
906 | } | 923 | } |
907 | } else { | 924 | } else { |
908 | setVScrollBarMode(QScrollView::Auto); | 925 | setVScrollBarMode(QScrollView::Auto); |
909 | setHScrollBarMode(QScrollView::Auto); | 926 | setHScrollBarMode(QScrollView::Auto); |
910 | } | 927 | } |
911 | } else { | 928 | } else { |
912 | setVScrollBarMode(QScrollView::AlwaysOff); | 929 | setVScrollBarMode(QScrollView::AlwaysOff); |
913 | setHScrollBarMode(QScrollView::AlwaysOff); | 930 | setHScrollBarMode(QScrollView::AlwaysOff); |
914 | } | 931 | } |
915 | } | 932 | } |
916 | 933 | ||
917 | Incidence *MonthViewCell::selectedIncidence() | 934 | Incidence *MonthViewCell::selectedIncidence() |
918 | { | 935 | { |
919 | int index = currentItem(); | 936 | int index = currentItem(); |
920 | if ( index < 0 ) return 0; | 937 | if ( index < 0 ) return 0; |
921 | 938 | ||
922 | MonthViewItem *mitem = | 939 | MonthViewItem *mitem = |
923 | static_cast<MonthViewItem *>( item( index ) ); | 940 | static_cast<MonthViewItem *>( item( index ) ); |
924 | 941 | ||
925 | if ( !mitem ) return 0; | 942 | if ( !mitem ) return 0; |
926 | 943 | ||
927 | return mitem->incidence(); | 944 | return mitem->incidence(); |
928 | } | 945 | } |
929 | 946 | ||
930 | QDate MonthViewCell::selectedIncidenceDate() | 947 | QDate MonthViewCell::selectedIncidenceDate() |
931 | { | 948 | { |
932 | QDate qd; | 949 | QDate qd; |
933 | int index = currentItem(); | 950 | int index = currentItem(); |
934 | if ( index < 0 ) return qd; | 951 | if ( index < 0 ) return qd; |
935 | 952 | ||
936 | MonthViewItem *mitem = | 953 | MonthViewItem *mitem = |
937 | static_cast<MonthViewItem *>( item( index ) ); | 954 | static_cast<MonthViewItem *>( item( index ) ); |
938 | 955 | ||
939 | if ( !mitem ) return qd; | 956 | if ( !mitem ) return qd; |
940 | 957 | ||
941 | return mitem->incidenceDate(); | 958 | return mitem->incidenceDate(); |
942 | } | 959 | } |
943 | 960 | ||
944 | void MonthViewCell::deselect() | 961 | void MonthViewCell::deselect() |
945 | { | 962 | { |
946 | clearSelection(); | 963 | clearSelection(); |
947 | enableScrollBars( false ); | 964 | enableScrollBars( false ); |
948 | // updateCell(); | 965 | // updateCell(); |
949 | } | 966 | } |
950 | void MonthViewCell::select() | 967 | void MonthViewCell::select() |
951 | { | 968 | { |
952 | ;// updateCell(); | 969 | ;// updateCell(); |
953 | } | 970 | } |
954 | 971 | ||
955 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) | 972 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) |
956 | { | 973 | { |
957 | if ( !mMonthView->isUpdatePossible() ) | 974 | if ( !mMonthView->isUpdatePossible() ) |
958 | return; | 975 | return; |
959 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 976 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
960 | deselect(); | 977 | deselect(); |
961 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); | 978 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); |
962 | 979 | ||
963 | QString text; | 980 | QString text; |
964 | mLabel->setText( text ); | 981 | mLabel->setText( text ); |
965 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 982 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
966 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 983 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
967 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 984 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
968 | mLabel->resize( mLabelBigSize ); | 985 | mLabel->resize( mLabelBigSize ); |
969 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 986 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
970 | } else { | 987 | } else { |
971 | mLabel->resize( mLabelSize ); | 988 | mLabel->resize( mLabelSize ); |
972 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 989 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
973 | } | 990 | } |
974 | mLabel->setText( text ); | 991 | mLabel->setText( text ); |
975 | 992 | ||
976 | int size = height() - mLabel->height() - lineWidth()-1; | 993 | int size = height() - mLabel->height() - lineWidth()-1; |
977 | //qDebug("LW %d ", lineWidth()); | 994 | //qDebug("LW %d ", lineWidth()); |
978 | if ( size > 0 ) | 995 | if ( size > 0 ) |
979 | verticalScrollBar()->setMaximumHeight( size ); | 996 | verticalScrollBar()->setMaximumHeight( size ); |
980 | size = width() - mLabel->width() -lineWidth()-1; | 997 | size = width() - mLabel->width() -lineWidth()-1; |
981 | if ( size > 0 ) | 998 | if ( size > 0 ) |
982 | horizontalScrollBar()->setMaximumWidth( size ); | 999 | horizontalScrollBar()->setMaximumWidth( size ); |
983 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 1000 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
984 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 1001 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
985 | // mItemList->resize ( width(), height () ); | 1002 | // mItemList->resize ( width(), height () ); |
986 | if ( e ) | 1003 | if ( e ) |
987 | KNoScrollListBox::resizeEvent ( e ); | 1004 | KNoScrollListBox::resizeEvent ( e ); |
988 | } | 1005 | } |
989 | 1006 | ||
990 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 1007 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
991 | { | 1008 | { |
1009 | |||
992 | if ( !item ) { | 1010 | if ( !item ) { |
993 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1011 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
994 | emit newEventSignal( dt ); | 1012 | emit newEventSignal( dt ); |
995 | return; | 1013 | return; |
996 | } | 1014 | } |
997 | 1015 | ||
998 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1016 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
999 | Incidence *incidence = eventItem->incidence(); | 1017 | Incidence *incidence = eventItem->incidence(); |
1000 | if ( incidence ) mMonthView->defaultAction( incidence ); | 1018 | if ( incidence ) mMonthView->defaultAction( incidence ); |
1001 | } | 1019 | } |
1002 | void MonthViewCell::showDay() | 1020 | void MonthViewCell::showDay() |
1003 | { | 1021 | { |
1004 | emit showDaySignal( date() ); | 1022 | emit showDaySignal( date() ); |
1005 | } | 1023 | } |
1006 | void MonthViewCell::newEvent() | 1024 | void MonthViewCell::newEvent() |
1007 | { | 1025 | { |
1008 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1026 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1009 | emit newEventSignal( dt ); | 1027 | emit newEventSignal( dt ); |
1010 | } | 1028 | } |
1011 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 1029 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
1012 | { | 1030 | { |
1031 | qDebug("CELL "); | ||
1013 | if ( item == 0 ) { | 1032 | if ( item == 0 ) { |
1014 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1033 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1015 | emit newEventSignal( dt ); | 1034 | emit newEventSignal( dt ); |
1016 | return; | 1035 | return; |
1017 | } | 1036 | } |
1018 | /* | 1037 | |
1019 | if ( lastClicked ) | ||
1020 | if ( ! item ) { | ||
1021 | if ( lastClicked->listBox() != item->listBox() ) | ||
1022 | lastClicked->listBox()->clearSelection(); | ||
1023 | } | ||
1024 | */ | ||
1025 | |||
1026 | mMonthView->setSelectedCell( this ); | ||
1027 | if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); | ||
1028 | select(); | ||
1029 | } | 1038 | } |
1030 | 1039 | ||
1031 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 1040 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
1032 | { | 1041 | { |
1033 | if ( !item ) return; | 1042 | if ( !item ) return; |
1034 | 1043 | ||
1035 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1044 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1036 | Incidence *incidence = eventItem->incidence(); | 1045 | Incidence *incidence = eventItem->incidence(); |
1037 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1046 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
1038 | } | 1047 | } |
1039 | 1048 | ||
1040 | void MonthViewCell::selection( QListBoxItem *item ) | 1049 | void MonthViewCell::selection( QListBoxItem *item ) |
1041 | { | 1050 | { |
1042 | if ( !item ) return; | 1051 | if ( !item ) return; |
1043 | 1052 | ||
1044 | mMonthView->setSelectedCell( this ); | 1053 | mMonthView->setSelectedCell( this ); |
1045 | } | 1054 | } |
1046 | 1055 | ||
1047 | 1056 | ||
1048 | // ******************************************************************************* | 1057 | // ******************************************************************************* |
1049 | // ******************************************************************************* | 1058 | // ******************************************************************************* |
1050 | // ******************************************************************************* | 1059 | // ******************************************************************************* |
1051 | 1060 | ||
1052 | 1061 | ||
1053 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 1062 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
1054 | : KOEventView( calendar, parent, name ), | 1063 | : KOEventView( calendar, parent, name ), |
1055 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 1064 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
1056 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 1065 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
1057 | { | 1066 | { |
1058 | mFlagKeyPressed = false; | 1067 | mFlagKeyPressed = false; |
1059 | mShortDayLabelsM = false; | 1068 | mShortDayLabelsM = false; |
1060 | mShortDayLabelsW = false; | 1069 | mShortDayLabelsW = false; |
1061 | skipResize = false; | 1070 | skipResize = false; |
1062 | clPending = true; | 1071 | clPending = true; |
1063 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 1072 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
1064 | mWidStack = new QWidgetStack( this ); | 1073 | mWidStack = new QWidgetStack( this ); |
1065 | QVBoxLayout* hb = new QVBoxLayout( this ); | 1074 | QVBoxLayout* hb = new QVBoxLayout( this ); |
1066 | mMonthView = new QWidget( mWidStack ); | 1075 | mMonthView = new QWidget( mWidStack ); |
1067 | mWeekView = new QWidget( mWidStack ); | 1076 | mWeekView = new QWidget( mWidStack ); |
1068 | #if QT_VERSION >= 0x030000 | 1077 | #if QT_VERSION >= 0x030000 |
1069 | mWidStack->addWidget(mMonthView ); | 1078 | mWidStack->addWidget(mMonthView ); |
1070 | mWidStack->addWidget(mWeekView ); | 1079 | mWidStack->addWidget(mWeekView ); |
1071 | #else | 1080 | #else |
1072 | mWidStack->addWidget( mMonthView, 1 ); | 1081 | mWidStack->addWidget( mMonthView, 1 ); |
1073 | mWidStack->addWidget( mWeekView , 1 ); | 1082 | mWidStack->addWidget( mWeekView , 1 ); |
1074 | #endif | 1083 | #endif |
1075 | hb->addWidget( mNavigatorBar ); | 1084 | hb->addWidget( mNavigatorBar ); |
1076 | hb->addWidget( mWidStack ); | 1085 | hb->addWidget( mWidStack ); |
1077 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 1086 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
1078 | updatePossible = false; | 1087 | updatePossible = false; |
1079 | //updatePossible = true; | 1088 | //updatePossible = true; |
1080 | mCells.setAutoDelete( true ); | 1089 | mCells.setAutoDelete( true ); |
1081 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1090 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1082 | mDayLabels.resize( mDaysPerWeek ); | 1091 | mDayLabels.resize( mDaysPerWeek ); |
1083 | mDayLabelsW.resize( mDaysPerWeek ); | 1092 | mDayLabelsW.resize( mDaysPerWeek ); |
1084 | QFont bfont = font(); | 1093 | QFont bfont = font(); |
1085 | if ( QApplication::desktop()->width() < 650 ) { | 1094 | if ( QApplication::desktop()->width() < 650 ) { |
1086 | bfont.setPointSize( bfont.pointSize() - 2 ); | 1095 | bfont.setPointSize( bfont.pointSize() - 2 ); |
1087 | } | 1096 | } |
1088 | bfont.setBold( true ); | 1097 | bfont.setBold( true ); |
1089 | int i; | 1098 | int i; |
1090 | 1099 | ||
1091 | for( i = 0; i < mDaysPerWeek; i++ ) { | 1100 | for( i = 0; i < mDaysPerWeek; i++ ) { |
1092 | QLabel *label = new QLabel( mMonthView ); | 1101 | QLabel *label = new QLabel( mMonthView ); |
1093 | label->setFont(bfont); | 1102 | label->setFont(bfont); |
1094 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1103 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1095 | label->setLineWidth(1); | 1104 | label->setLineWidth(1); |
1096 | label->setAlignment(AlignCenter); | 1105 | label->setAlignment(AlignCenter); |
1097 | mDayLabels.insert( i, label ); | 1106 | mDayLabels.insert( i, label ); |
1098 | label = new QLabel( mWeekView ); | 1107 | label = new QLabel( mWeekView ); |
1099 | label->setFont(bfont); | 1108 | label->setFont(bfont); |
1100 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1109 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1101 | label->setLineWidth(1); | 1110 | label->setLineWidth(1); |
1102 | label->setAlignment(AlignCenter); | 1111 | label->setAlignment(AlignCenter); |
1103 | mDayLabelsW.insert( i, label ); | 1112 | mDayLabelsW.insert( i, label ); |
1104 | } | 1113 | } |
1105 | 1114 | ||
1106 | bfont.setBold( false ); | 1115 | bfont.setBold( false ); |
1107 | mWeekLabels.resize( mNumWeeks+1 ); | 1116 | mWeekLabels.resize( mNumWeeks+1 ); |
1108 | mWeekLabelsW.resize( 2 ); | 1117 | mWeekLabelsW.resize( 2 ); |
1109 | for( i = 0; i < mNumWeeks+1; i++ ) { | 1118 | for( i = 0; i < mNumWeeks+1; i++ ) { |
1110 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 1119 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
1111 | label->setFocusPolicy(NoFocus); | 1120 | label->setFocusPolicy(NoFocus); |
1112 | label->setFont(bfont); | 1121 | label->setFont(bfont); |
1113 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1122 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1114 | label->setFlat(true); | 1123 | label->setFlat(true); |
1115 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1124 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1116 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1125 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1117 | //label->setLineWidth(1); | 1126 | //label->setLineWidth(1); |
1118 | //label->setAlignment(AlignCenter); | 1127 | //label->setAlignment(AlignCenter); |
1119 | mWeekLabels.insert( i, label ); | 1128 | mWeekLabels.insert( i, label ); |
1120 | } | 1129 | } |
1121 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1130 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1122 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); | 1131 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); |
1123 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 1132 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
1124 | 1133 | ||
1125 | for( i = 0; i < 1+1; i++ ) { | 1134 | for( i = 0; i < 1+1; i++ ) { |
1126 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 1135 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
1127 | label->setFocusPolicy(NoFocus); | 1136 | label->setFocusPolicy(NoFocus); |
1128 | label->setFont(bfont); | 1137 | label->setFont(bfont); |
1129 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1138 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1130 | label->setFlat(true); | 1139 | label->setFlat(true); |
1131 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1140 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1132 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1141 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1133 | //label->setLineWidth(1); | 1142 | //label->setLineWidth(1); |
1134 | //label->setAlignment(AlignCenter); | 1143 | //label->setAlignment(AlignCenter); |
1135 | mWeekLabelsW.insert( i, label ); | 1144 | mWeekLabelsW.insert( i, label ); |
1136 | } | 1145 | } |
1137 | mWeekLabelsW[1]->setText( i18n("W")); | 1146 | mWeekLabelsW[1]->setText( i18n("W")); |
1138 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); | 1147 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); |
1139 | 1148 | ||
1140 | 1149 | ||
1141 | int row, col; | 1150 | int row, col; |
1142 | mCells.resize( mNumCells ); | 1151 | mCells.resize( mNumCells ); |
1143 | for( row = 0; row < mNumWeeks; ++row ) { | 1152 | for( row = 0; row < mNumWeeks; ++row ) { |
1144 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1153 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1145 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 1154 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
1146 | mCells.insert( row * mDaysPerWeek + col, cell ); | 1155 | mCells.insert( row * mDaysPerWeek + col, cell ); |
1147 | 1156 | ||
1148 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1157 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1149 | SLOT( defaultAction( Incidence * ) ) ); | 1158 | SLOT( defaultAction( Incidence * ) ) ); |
1150 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1159 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1151 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1160 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1152 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1161 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1153 | SIGNAL( showDaySignal( QDate ) ) ); | 1162 | SIGNAL( showDaySignal( QDate ) ) ); |
1163 | connect( cell, SIGNAL( nextCell() ), | ||
1164 | SLOT( nextCell() ) ); | ||
1165 | connect( cell, SIGNAL( prevCell() ), | ||
1166 | SLOT( prevCell() ) ); | ||
1154 | } | 1167 | } |
1155 | } | 1168 | } |
1156 | mCellsW.resize( mDaysPerWeek ); | 1169 | mCellsW.resize( mDaysPerWeek ); |
1157 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1170 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1158 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1171 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
1159 | mCellsW.insert( col, cell ); | 1172 | mCellsW.insert( col, cell ); |
1160 | 1173 | ||
1161 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1174 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1162 | SLOT( defaultAction( Incidence * ) ) ); | 1175 | SLOT( defaultAction( Incidence * ) ) ); |
1163 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1176 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1164 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1177 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1165 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1178 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1166 | SIGNAL( showDaySignal( QDate ) ) ); | 1179 | SIGNAL( showDaySignal( QDate ) ) ); |
1180 | connect( cell, SIGNAL( nextCell() ), | ||
1181 | SLOT( nextCell() ) ); | ||
1182 | connect( cell, SIGNAL( prevCell() ), | ||
1183 | SLOT( prevCell() ) ); | ||
1167 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1184 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1168 | } | 1185 | } |
1169 | 1186 | ||
1170 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1187 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1171 | mContextMenu = eventPopup(); | 1188 | mContextMenu = eventPopup(); |
1172 | // updateConfig(); //useless here... | 1189 | // updateConfig(); //useless here... |
1173 | // ... but we need mWidthLongDayLabel computed | 1190 | // ... but we need mWidthLongDayLabel computed |
1174 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1191 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1175 | mWidthLongDayLabel = 0; | 1192 | mWidthLongDayLabel = 0; |
1176 | for (int i = 0; i < 7; i++) { | 1193 | for (int i = 0; i < 7; i++) { |
1177 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1194 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1178 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1195 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1179 | } | 1196 | } |
1180 | 1197 | ||
1181 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1198 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1182 | 1199 | ||
1183 | #if 0 | 1200 | #if 0 |
1184 | if ( mShowWeekView ) | 1201 | if ( mShowWeekView ) |
1185 | mWidStack->raiseWidget( mWeekView ); | 1202 | mWidStack->raiseWidget( mWeekView ); |
1186 | else | 1203 | else |
1187 | mWidStack->raiseWidget( mMonthView ); | 1204 | mWidStack->raiseWidget( mMonthView ); |
1188 | #endif | 1205 | #endif |
1189 | 1206 | ||
1190 | emit incidenceSelected( 0 ); | 1207 | emit incidenceSelected( 0 ); |
1191 | 1208 | ||
1192 | mComputeLayoutTimer = new QTimer( this ); | 1209 | mComputeLayoutTimer = new QTimer( this ); |
1193 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); | 1210 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); |
1194 | 1211 | ||
1195 | 1212 | ||
1196 | #ifndef DESKTOP_VERSION | 1213 | #ifndef DESKTOP_VERSION |
1197 | resize( QApplication::desktop()->size() ); | 1214 | resize( QApplication::desktop()->size() ); |
1198 | #else | 1215 | #else |
1199 | resize(640, 480 ); | 1216 | resize(640, 480 ); |
1200 | updatePossible = true; | 1217 | updatePossible = true; |
1201 | #endif | 1218 | #endif |
1202 | computeLayout(); | 1219 | computeLayout(); |
1203 | 1220 | ||
1204 | if ( mShowWeekView ) | 1221 | if ( mShowWeekView ) |
1205 | mWidStack->raiseWidget( mWeekView ); | 1222 | mWidStack->raiseWidget( mWeekView ); |
1206 | else | 1223 | else |
1207 | mWidStack->raiseWidget( mMonthView ); | 1224 | mWidStack->raiseWidget( mMonthView ); |
1208 | } | 1225 | } |
1209 | 1226 | ||
1210 | KOMonthView::~KOMonthView() | 1227 | KOMonthView::~KOMonthView() |
1211 | { | 1228 | { |
1212 | delete mContextMenu; | 1229 | delete mContextMenu; |
1213 | } | 1230 | } |
1214 | 1231 | ||
1215 | void KOMonthView::selectInternalWeekNum ( int n ) | 1232 | void KOMonthView::selectInternalWeekNum ( int n ) |
1216 | { | 1233 | { |
1217 | switchView(); | 1234 | switchView(); |
1218 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 1235 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
1219 | emit selectMonth (); | 1236 | emit selectMonth (); |
1220 | else | 1237 | else |
1221 | emit selectWeekNum ( n ); | 1238 | emit selectWeekNum ( n ); |
1222 | } | 1239 | } |
1223 | 1240 | ||
1224 | int KOMonthView::currentWeek() | 1241 | int KOMonthView::currentWeek() |
1225 | { | 1242 | { |
1226 | if ( mShowWeekView ) | 1243 | if ( mShowWeekView ) |
1227 | return mWeekLabelsW[0]->getWeekNum(); | 1244 | return mWeekLabelsW[0]->getWeekNum(); |
1228 | return mWeekLabels[0]->getWeekNum(); | 1245 | return mWeekLabels[0]->getWeekNum(); |
1229 | } | 1246 | } |
1230 | void KOMonthView::switchView() | 1247 | void KOMonthView::switchView() |
1231 | { | 1248 | { |
1232 | if ( selectedCell( ) ) | 1249 | if ( selectedCell( ) ) |
1233 | selectedCell()->deselect(); | 1250 | selectedCell()->deselect(); |
1234 | mShowWeekView = !mShowWeekView; | 1251 | mShowWeekView = !mShowWeekView; |
1235 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 1252 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
1236 | if ( clPending ) { | 1253 | if ( clPending ) { |
1237 | computeLayout(); | 1254 | computeLayout(); |
1238 | updateConfig(); | 1255 | updateConfig(); |
1239 | } | 1256 | } |
1240 | if ( mShowWeekView ) | 1257 | if ( mShowWeekView ) |
1241 | mWidStack->raiseWidget( mWeekView ); | 1258 | mWidStack->raiseWidget( mWeekView ); |
1242 | else | 1259 | else |
1243 | mWidStack->raiseWidget( mMonthView ); | 1260 | mWidStack->raiseWidget( mMonthView ); |
1244 | clPending = false; | 1261 | clPending = false; |
1245 | } | 1262 | } |
1246 | 1263 | ||
1247 | int KOMonthView::maxDatesHint() | 1264 | int KOMonthView::maxDatesHint() |
1248 | { | 1265 | { |
1249 | return mNumCells; | 1266 | return mNumCells; |
1250 | } | 1267 | } |
1251 | 1268 | ||
1252 | int KOMonthView::currentDateCount() | 1269 | int KOMonthView::currentDateCount() |
1253 | { | 1270 | { |
1254 | return mNumCells; | 1271 | return mNumCells; |
1255 | } | 1272 | } |
1256 | 1273 | ||
1257 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 1274 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
1258 | { | 1275 | { |
1259 | QPtrList<Incidence> selected; | 1276 | QPtrList<Incidence> selected; |
1260 | 1277 | ||
1261 | if ( mSelectedCell ) { | 1278 | if ( mSelectedCell ) { |
1262 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 1279 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
1263 | if ( incidence ) selected.append( incidence ); | 1280 | if ( incidence ) selected.append( incidence ); |
1264 | } | 1281 | } |
1265 | 1282 | ||
1266 | return selected; | 1283 | return selected; |
1267 | } | 1284 | } |
1268 | 1285 | ||
1269 | DateList KOMonthView::selectedDates() | 1286 | DateList KOMonthView::selectedDates() |
1270 | { | 1287 | { |
1271 | DateList selected; | 1288 | DateList selected; |
1272 | 1289 | ||
1273 | if ( mSelectedCell ) { | 1290 | if ( mSelectedCell ) { |
1274 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1291 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1275 | if ( qd.isValid() ) selected.append( qd ); | 1292 | if ( qd.isValid() ) selected.append( qd ); |
1276 | } | 1293 | } |
1277 | 1294 | ||
1278 | return selected; | 1295 | return selected; |
1279 | } | 1296 | } |
1280 | 1297 | ||
1281 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1298 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1282 | const QDate &td) | 1299 | const QDate &td) |
1283 | { | 1300 | { |
1284 | #ifndef KORG_NOPRINTER | 1301 | #ifndef KORG_NOPRINTER |
1285 | calPrinter->preview(CalPrinter::Month, fd, td); | 1302 | calPrinter->preview(CalPrinter::Month, fd, td); |
1286 | #endif | 1303 | #endif |
1287 | } | 1304 | } |
1288 | 1305 | ||
1289 | void KOMonthView::updateConfig() | 1306 | void KOMonthView::updateConfig() |
1290 | { | 1307 | { |
1291 | 1308 | ||
1292 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1309 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1293 | 1310 | ||
1294 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1311 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
@@ -1849,128 +1866,137 @@ void KOMonthView::computeLayout() | |||
1849 | ++h; | 1866 | ++h; |
1850 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1867 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1851 | y += h; | 1868 | y += h; |
1852 | } | 1869 | } |
1853 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1870 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1854 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1871 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1855 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1872 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1856 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1873 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1857 | updateDayLabels(); | 1874 | updateDayLabels(); |
1858 | //bool forceUpdate = !updatePossible; | 1875 | //bool forceUpdate = !updatePossible; |
1859 | updatePossible = true; | 1876 | updatePossible = true; |
1860 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1877 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1861 | } | 1878 | } |
1862 | 1879 | ||
1863 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1880 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1864 | { | 1881 | { |
1865 | mContextMenu->showIncidencePopup(incidence); | 1882 | mContextMenu->showIncidencePopup(incidence); |
1866 | /* | 1883 | /* |
1867 | if( incidence && incidence->type() == "Event" ) { | 1884 | if( incidence && incidence->type() == "Event" ) { |
1868 | Event *event = static_cast<Event *>(incidence); | 1885 | Event *event = static_cast<Event *>(incidence); |
1869 | mContextMenu->showEventPopup(event); | 1886 | mContextMenu->showEventPopup(event); |
1870 | } else { | 1887 | } else { |
1871 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1888 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1872 | } | 1889 | } |
1873 | */ | 1890 | */ |
1874 | } | 1891 | } |
1875 | MonthViewCell * KOMonthView::selectedCell( ) | 1892 | MonthViewCell * KOMonthView::selectedCell( ) |
1876 | { | 1893 | { |
1877 | return mSelectedCell; | 1894 | return mSelectedCell; |
1878 | } | 1895 | } |
1879 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1896 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1880 | { | 1897 | { |
1881 | //qDebug("KOMonthView::setSelectedCell "); | 1898 | //qDebug("KOMonthView::setSelectedCell "); |
1882 | if ( mSelectedCell && mSelectedCell != cell ) { | 1899 | if ( mSelectedCell && mSelectedCell != cell ) { |
1883 | MonthViewCell * mvc = mSelectedCell; | 1900 | MonthViewCell * mvc = mSelectedCell; |
1884 | mSelectedCell = cell; | 1901 | mSelectedCell = cell; |
1885 | mvc->deselect(); | 1902 | mvc->deselect(); |
1886 | } else | 1903 | } else |
1887 | mSelectedCell = cell; | 1904 | mSelectedCell = cell; |
1888 | // if ( mSelectedCell ) | 1905 | // if ( mSelectedCell ) |
1889 | // mSelectedCell->select(); | 1906 | // mSelectedCell->select(); |
1890 | if ( !mSelectedCell ) | 1907 | if ( !mSelectedCell ) |
1891 | emit incidenceSelected( 0 ); | 1908 | emit incidenceSelected( 0 ); |
1892 | else | 1909 | else |
1893 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1910 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1894 | } | 1911 | } |
1895 | 1912 | ||
1896 | void KOMonthView::processSelectionChange() | 1913 | void KOMonthView::processSelectionChange() |
1897 | { | 1914 | { |
1898 | QPtrList<Incidence> incidences = selectedIncidences(); | 1915 | QPtrList<Incidence> incidences = selectedIncidences(); |
1899 | if (incidences.count() > 0) { | 1916 | if (incidences.count() > 0) { |
1900 | emit incidenceSelected( incidences.first() ); | 1917 | emit incidenceSelected( incidences.first() ); |
1901 | } else { | 1918 | } else { |
1902 | emit incidenceSelected( 0 ); | 1919 | emit incidenceSelected( 0 ); |
1903 | clearSelection(); | 1920 | clearSelection(); |
1904 | } | 1921 | } |
1905 | } | 1922 | } |
1906 | 1923 | ||
1907 | void KOMonthView::clearSelection() | 1924 | void KOMonthView::clearSelection() |
1908 | { | 1925 | { |
1909 | if ( mSelectedCell ) { | 1926 | if ( mSelectedCell ) { |
1910 | mSelectedCell->deselect(); | 1927 | mSelectedCell->deselect(); |
1911 | mSelectedCell = 0; | 1928 | mSelectedCell = 0; |
1912 | } | 1929 | } |
1913 | } | 1930 | } |
1914 | 1931 | ||
1915 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) | 1932 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) |
1916 | { | 1933 | { |
1917 | if ( !e->isAutoRepeat() ) { | 1934 | if ( !e->isAutoRepeat() ) { |
1918 | mFlagKeyPressed = false; | 1935 | mFlagKeyPressed = false; |
1919 | } | 1936 | } |
1920 | } | 1937 | } |
1921 | 1938 | ||
1922 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1939 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1923 | { | 1940 | { |
1924 | 1941 | ||
1925 | qApp->processEvents(); | 1942 | qApp->processEvents(); |
1926 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1943 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1927 | //e->ignore(); | 1944 | //e->ignore(); |
1928 | e->accept(); | 1945 | e->accept(); |
1929 | return; | 1946 | return; |
1930 | } | 1947 | } |
1931 | if (! e->isAutoRepeat() ) | 1948 | if (! e->isAutoRepeat() ) |
1932 | mFlagKeyPressed = true; | 1949 | mFlagKeyPressed = true; |
1933 | switch(e->key()) { | 1950 | switch(e->key()) { |
1934 | case Key_Up: | 1951 | case Key_Up: |
1935 | { | 1952 | { |
1936 | if ( mShowWeekView ) { | 1953 | if ( mShowWeekView ) { |
1937 | emit selectWeekNum ( currentWeek() - 1 ); | 1954 | emit selectWeekNum ( currentWeek() - 1 ); |
1938 | } | 1955 | } |
1939 | else { | 1956 | else { |
1940 | emit prevMonth(); | 1957 | emit prevMonth(); |
1941 | } | 1958 | } |
1942 | } | 1959 | } |
1943 | e->accept(); | 1960 | e->accept(); |
1944 | break; | 1961 | break; |
1945 | case Key_Down: | 1962 | case Key_Down: |
1946 | { | 1963 | { |
1947 | if ( mShowWeekView ) { | 1964 | if ( mShowWeekView ) { |
1948 | emit selectWeekNum ( currentWeek() +1); | 1965 | emit selectWeekNum ( currentWeek() +1); |
1949 | } | 1966 | } |
1950 | else { | 1967 | else { |
1951 | emit nextMonth(); | 1968 | emit nextMonth(); |
1952 | } | 1969 | } |
1953 | 1970 | ||
1954 | } | 1971 | } |
1955 | e->accept(); | 1972 | e->accept(); |
1956 | break; | 1973 | break; |
1957 | case Key_Return: | 1974 | case Key_Return: |
1958 | case Key_Enter: | 1975 | case Key_Enter: |
1959 | { | 1976 | { |
1960 | selectInternalWeekNum ( currentWeek() ); | 1977 | selectInternalWeekNum ( currentWeek() ); |
1961 | } | 1978 | } |
1962 | e->accept(); | 1979 | e->accept(); |
1963 | break; | 1980 | break; |
1964 | case Key_D: | 1981 | case Key_D: |
1965 | if ( mSelectedCell ) { | 1982 | if ( mSelectedCell ) { |
1966 | mSelectedCell->showDay(); | 1983 | mSelectedCell->showDay(); |
1967 | e->accept(); | 1984 | e->accept(); |
1968 | } else { | 1985 | } else { |
1969 | e->ignore(); | 1986 | e->ignore(); |
1970 | } | 1987 | } |
1971 | break; | 1988 | break; |
1972 | default: | 1989 | default: |
1973 | e->ignore(); | 1990 | e->ignore(); |
1974 | break; | 1991 | break; |
1975 | } | 1992 | } |
1976 | } | 1993 | } |
1994 | |||
1995 | void KOMonthView::nextCell() | ||
1996 | { | ||
1997 | bool res = focusNextPrevChild ( true ); | ||
1998 | } | ||
1999 | void KOMonthView::prevCell() | ||
2000 | { | ||
2001 | focusNextPrevChild ( false ); | ||
2002 | } | ||
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index e39eeb0..c6b6b5e 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,329 +1,332 @@ | |||
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 <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qintdict.h> | 31 | #include <qintdict.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qvaluelist.h> | 33 | #include <qvaluelist.h> |
34 | #include <qptrvector.h> | 34 | #include <qptrvector.h> |
35 | 35 | ||
36 | #include <libkcal/calendar.h> | 36 | #include <libkcal/calendar.h> |
37 | #include <libkcal/event.h> | 37 | #include <libkcal/event.h> |
38 | 38 | ||
39 | #include "koeventview.h" | 39 | #include "koeventview.h" |
40 | #include "navigatorbar.h" | 40 | #include "navigatorbar.h" |
41 | 41 | ||
42 | #ifdef DESKTOP_VERSION | 42 | #ifdef DESKTOP_VERSION |
43 | class QToolTipGroup; | 43 | class QToolTipGroup; |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | class KNOWhatsThis; | 46 | class KNOWhatsThis; |
47 | class KOWeekButton : public QPushButton | 47 | class KOWeekButton : public QPushButton |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 51 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
52 | QPushButton( parent, name) | 52 | QPushButton( parent, name) |
53 | { | 53 | { |
54 | connect( this, SIGNAL( clicked() ), | 54 | connect( this, SIGNAL( clicked() ), |
55 | SLOT( bottonClicked() )); | 55 | SLOT( bottonClicked() )); |
56 | mNumber = -1; | 56 | mNumber = -1; |
57 | } | 57 | } |
58 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 58 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
59 | int getWeekNum() { return mNumber;} | 59 | int getWeekNum() { return mNumber;} |
60 | signals: | 60 | signals: |
61 | void selectWeekNum ( int ); | 61 | void selectWeekNum ( int ); |
62 | private: | 62 | private: |
63 | void focusInEvent ( QFocusEvent * ){;} | 63 | void focusInEvent ( QFocusEvent * ){;} |
64 | int mNumber; | 64 | int mNumber; |
65 | void keyPressEvent ( QKeyEvent * e ) | 65 | void keyPressEvent ( QKeyEvent * e ) |
66 | { | 66 | { |
67 | e->ignore(); | 67 | e->ignore(); |
68 | } | 68 | } |
69 | 69 | ||
70 | private slots : | 70 | private slots : |
71 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 71 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
72 | }; | 72 | }; |
73 | 73 | ||
74 | class KNoScrollListBox: public QListBox | 74 | class KNoScrollListBox: public QListBox |
75 | { | 75 | { |
76 | Q_OBJECT | 76 | Q_OBJECT |
77 | public: | 77 | public: |
78 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 78 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
79 | ~KNoScrollListBox(); | 79 | ~KNoScrollListBox(); |
80 | QString getWhatsThisText(QPoint p) ; | 80 | QString getWhatsThisText(QPoint p) ; |
81 | 81 | ||
82 | signals: | 82 | signals: |
83 | void shiftDown(); | 83 | void shiftDown(); |
84 | void shiftUp(); | 84 | void shiftUp(); |
85 | void rightClick(); | 85 | void rightClick(); |
86 | void nextCell(); | ||
87 | void prevCell(); | ||
86 | 88 | ||
87 | protected slots: | 89 | protected slots: |
88 | void oneDown(); | 90 | void oneDown(); |
89 | void keyPressEvent(QKeyEvent *); | 91 | void keyPressEvent(QKeyEvent *); |
90 | void keyReleaseEvent(QKeyEvent *); | 92 | void keyReleaseEvent(QKeyEvent *); |
91 | void mousePressEvent(QMouseEvent *); | 93 | void mousePressEvent(QMouseEvent *); |
92 | void focusInEvent ( QFocusEvent * ); | 94 | void focusInEvent ( QFocusEvent * ); |
93 | void focusOutEvent ( QFocusEvent * ); | 95 | void focusOutEvent ( QFocusEvent * ); |
94 | 96 | ||
95 | private: | 97 | private: |
96 | bool resetOnFocusIn; | 98 | bool resetOnFocusIn; |
97 | KNOWhatsThis * mWT; | 99 | KNOWhatsThis * mWT; |
98 | }; | 100 | }; |
99 | 101 | ||
100 | 102 | ||
101 | class MonthViewItem: public QListBoxItem | 103 | class MonthViewItem: public QListBoxItem |
102 | { | 104 | { |
103 | public: | 105 | public: |
104 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 106 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
105 | void recycle( Incidence *incidence, QDate qd, const QString & s); | 107 | void recycle( Incidence *incidence, QDate qd, const QString & s); |
106 | void setRecur(bool on) { mRecur = on; } | 108 | void setRecur(bool on) { mRecur = on; } |
107 | void setAlarm(bool on) { mAlarm = on; } | 109 | void setAlarm(bool on) { mAlarm = on; } |
108 | void setReply(bool on) { mReply = on; } | 110 | void setReply(bool on) { mReply = on; } |
109 | void setMoreInfo(bool on) { mInfo = on; } | 111 | void setMoreInfo(bool on) { mInfo = on; } |
110 | void setMultiDay(int type) { mMultiday = type; } | 112 | void setMultiDay(int type) { mMultiday = type; } |
111 | void setMultiDayPos(int type) { mdayPos = type; } | 113 | void setMultiDayPos(int type) { mdayPos = type; } |
112 | int gettMultiDayPos() { return mdayPos; } | 114 | int gettMultiDayPos() { return mdayPos; } |
113 | void setBlockRepaint(bool on) { mblockRepaint = on; } | 115 | void setBlockRepaint(bool on) { mblockRepaint = on; } |
114 | 116 | ||
115 | 117 | ||
116 | void setPalette(const QPalette &p) { mPalette = p; } | 118 | void setPalette(const QPalette &p) { mPalette = p; } |
117 | QPalette palette() const { return mPalette; } | 119 | QPalette palette() const { return mPalette; } |
118 | 120 | ||
119 | Incidence *incidence() const { return mIncidence; } | 121 | Incidence *incidence() const { return mIncidence; } |
120 | QDate incidenceDate() { return mDate; } | 122 | QDate incidenceDate() { return mDate; } |
121 | 123 | ||
122 | protected: | 124 | protected: |
123 | virtual void paint(QPainter *); | 125 | virtual void paint(QPainter *); |
124 | virtual int height(const QListBox *) const; | 126 | virtual int height(const QListBox *) const; |
125 | virtual int width(const QListBox *) const; | 127 | virtual int width(const QListBox *) const; |
126 | 128 | ||
127 | private: | 129 | private: |
128 | int mdayPos; | 130 | int mdayPos; |
129 | bool isWeekItem; | 131 | bool isWeekItem; |
130 | bool mblockRepaint; | 132 | bool mblockRepaint; |
131 | int mMultiday; | 133 | int mMultiday; |
132 | bool mRecur; | 134 | bool mRecur; |
133 | bool mAlarm; | 135 | bool mAlarm; |
134 | bool mReply; | 136 | bool mReply; |
135 | bool mInfo; | 137 | bool mInfo; |
136 | 138 | ||
137 | QPalette mPalette; | 139 | QPalette mPalette; |
138 | QDate mDate; | 140 | QDate mDate; |
139 | 141 | ||
140 | Incidence *mIncidence; | 142 | Incidence *mIncidence; |
141 | }; | 143 | }; |
142 | 144 | ||
143 | 145 | ||
144 | class KOMonthView; | 146 | class KOMonthView; |
145 | 147 | ||
146 | class MonthViewCell : public KNoScrollListBox | 148 | class MonthViewCell : public KNoScrollListBox |
147 | { | 149 | { |
148 | Q_OBJECT | 150 | Q_OBJECT |
149 | public: | 151 | public: |
150 | MonthViewCell(KOMonthView *,QWidget* ); | 152 | MonthViewCell(KOMonthView *,QWidget* ); |
151 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | 153 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} |
152 | 154 | ||
153 | void setDate( const QDate & ); | 155 | void setDate( const QDate & ); |
154 | QDate date() const; | 156 | QDate date() const; |
155 | 157 | ||
156 | void setPrimary( bool ); | 158 | void setPrimary( bool ); |
157 | bool isPrimary() const; | 159 | bool isPrimary() const; |
158 | 160 | ||
159 | void setHoliday( bool ); | 161 | void setHoliday( bool ); |
160 | void setHoliday( const QString & ); | 162 | void setHoliday( const QString & ); |
161 | 163 | ||
162 | void updateCell(); | 164 | void updateCell(); |
163 | void startUpdateCell(); | 165 | void startUpdateCell(); |
164 | void finishUpdateCell(); | 166 | void finishUpdateCell(); |
165 | void repaintfinishUpdateCell(); | 167 | void repaintfinishUpdateCell(); |
166 | int insertEvent(Event *); | 168 | int insertEvent(Event *); |
167 | void insertTodo(Todo *); | 169 | void insertTodo(Todo *); |
168 | 170 | ||
169 | void updateConfig( bool bigFont = false ); | 171 | void updateConfig( bool bigFont = false ); |
170 | 172 | ||
171 | void enableScrollBars( bool ); | 173 | void enableScrollBars( bool ); |
172 | 174 | ||
173 | Incidence *selectedIncidence(); | 175 | Incidence *selectedIncidence(); |
174 | QDate selectedIncidenceDate(); | 176 | QDate selectedIncidenceDate(); |
175 | QPushButton * dateLabel() { return mLabel; } | 177 | QPushButton * dateLabel() { return mLabel; } |
176 | 178 | ||
177 | void deselect(); | 179 | void deselect(); |
178 | void select(); | 180 | void select(); |
179 | #ifdef DESKTOP_VERSION | 181 | #ifdef DESKTOP_VERSION |
180 | static QToolTipGroup *toolTipGroup(); | 182 | static QToolTipGroup *toolTipGroup(); |
181 | #endif | 183 | #endif |
182 | signals: | 184 | signals: |
183 | void defaultAction( Incidence * ); | 185 | void defaultAction( Incidence * ); |
184 | void newEventSignal( QDateTime ); | 186 | void newEventSignal( QDateTime ); |
185 | void showDaySignal( QDate ); | 187 | void showDaySignal( QDate ); |
186 | 188 | ||
187 | protected: | 189 | protected: |
188 | QStringList mToolTip; | 190 | QStringList mToolTip; |
189 | void resizeEvent( QResizeEvent * ); | 191 | void resizeEvent( QResizeEvent * ); |
190 | 192 | ||
191 | |||
192 | public slots: | 193 | public slots: |
193 | void showDay(); | 194 | void showDay(); |
194 | 195 | ||
195 | protected slots: | 196 | protected slots: |
196 | void defaultAction( QListBoxItem * ); | 197 | void defaultAction( QListBoxItem * ); |
197 | void contextMenu( QListBoxItem * ); | 198 | void contextMenu( QListBoxItem * ); |
198 | void selection( QListBoxItem * ); | 199 | void selection( QListBoxItem * ); |
199 | void cellClicked( QListBoxItem * ); | 200 | void cellClicked( QListBoxItem * ); |
200 | void newEvent(); | 201 | void newEvent(); |
201 | 202 | ||
202 | private: | 203 | private: |
203 | int mdayCount; | 204 | int mdayCount; |
204 | QPtrList <MonthViewItem> mAvailItemList; | 205 | QPtrList <MonthViewItem> mAvailItemList; |
205 | KOMonthView *mMonthView; | 206 | KOMonthView *mMonthView; |
206 | int currentPalette; | 207 | int currentPalette; |
207 | 208 | ||
208 | QDate mDate; | 209 | QDate mDate; |
209 | bool mPrimary; | 210 | bool mPrimary; |
210 | bool mHoliday; | 211 | bool mHoliday; |
211 | QString mHolidayString; | 212 | QString mHolidayString; |
212 | 213 | ||
213 | //QLabel *mLabel; | 214 | //QLabel *mLabel; |
214 | QPushButton *mLabel; | 215 | QPushButton *mLabel; |
215 | //QListBox *mItemList; | 216 | //QListBox *mItemList; |
216 | #ifdef DESKTOP_VERSION | 217 | #ifdef DESKTOP_VERSION |
217 | static QToolTipGroup *mToolTipGroup; | 218 | static QToolTipGroup *mToolTipGroup; |
218 | #endif | 219 | #endif |
219 | QSize mLabelSize; | 220 | QSize mLabelSize; |
220 | QSize mLabelBigSize; | 221 | QSize mLabelBigSize; |
221 | QPalette mHolidayPalette; | 222 | QPalette mHolidayPalette; |
222 | QPalette mStandardPalette; | 223 | QPalette mStandardPalette; |
223 | QPalette mPrimaryPalette; | 224 | QPalette mPrimaryPalette; |
224 | QPalette mNonPrimaryPalette; | 225 | QPalette mNonPrimaryPalette; |
225 | void setMyPalette(); | 226 | void setMyPalette(); |
226 | QPalette getPalette (); | 227 | QPalette getPalette (); |
227 | 228 | ||
228 | }; | 229 | }; |
229 | 230 | ||
230 | 231 | ||
231 | class KOMonthView: public KOEventView | 232 | class KOMonthView: public KOEventView |
232 | { | 233 | { |
233 | Q_OBJECT | 234 | Q_OBJECT |
234 | public: | 235 | public: |
235 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 236 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
236 | ~KOMonthView(); | 237 | ~KOMonthView(); |
237 | 238 | ||
238 | /** Returns maximum number of days supported by the komonthview */ | 239 | /** Returns maximum number of days supported by the komonthview */ |
239 | virtual int maxDatesHint(); | 240 | virtual int maxDatesHint(); |
240 | 241 | ||
241 | /** Returns number of currently shown dates. */ | 242 | /** Returns number of currently shown dates. */ |
242 | virtual int currentDateCount(); | 243 | virtual int currentDateCount(); |
243 | 244 | ||
244 | /** returns the currently selected events */ | 245 | /** returns the currently selected events */ |
245 | virtual QPtrList<Incidence> selectedIncidences(); | 246 | virtual QPtrList<Incidence> selectedIncidences(); |
246 | 247 | ||
247 | /** returns dates of the currently selected events */ | 248 | /** returns dates of the currently selected events */ |
248 | virtual DateList selectedDates(); | 249 | virtual DateList selectedDates(); |
249 | 250 | ||
250 | virtual void printPreview(CalPrinter *calPrinter, | 251 | virtual void printPreview(CalPrinter *calPrinter, |
251 | const QDate &, const QDate &); | 252 | const QDate &, const QDate &); |
252 | bool isMonthView() { return !mShowWeekView; } | 253 | bool isMonthView() { return !mShowWeekView; } |
253 | bool isUpdatePossible() { return updatePossible; } | 254 | bool isUpdatePossible() { return updatePossible; } |
254 | 255 | ||
255 | MonthViewCell * selectedCell(); | 256 | MonthViewCell * selectedCell(); |
256 | bool skipResize; | 257 | bool skipResize; |
257 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 258 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
258 | public slots: | 259 | public slots: |
260 | void nextCell(); | ||
261 | void prevCell(); | ||
259 | virtual void updateView(); | 262 | virtual void updateView(); |
260 | virtual void updateConfig(); | 263 | virtual void updateConfig(); |
261 | virtual void showDates(const QDate &start, const QDate &end); | 264 | virtual void showDates(const QDate &start, const QDate &end); |
262 | virtual void showEvents(QPtrList<Event> eventList); | 265 | virtual void showEvents(QPtrList<Event> eventList); |
263 | 266 | ||
264 | void changeEventDisplay(Event *, int); | 267 | void changeEventDisplay(Event *, int); |
265 | 268 | ||
266 | void clearSelection(); | 269 | void clearSelection(); |
267 | 270 | ||
268 | void showContextMenu( Incidence * ); | 271 | void showContextMenu( Incidence * ); |
269 | 272 | ||
270 | void setSelectedCell( MonthViewCell * ); | 273 | void setSelectedCell( MonthViewCell * ); |
271 | void switchView(); | 274 | void switchView(); |
272 | void setKeyBoardFocus(); | 275 | void setKeyBoardFocus(); |
273 | void setKeyBFocus(); | 276 | void setKeyBFocus(); |
274 | 277 | ||
275 | protected slots: | 278 | protected slots: |
276 | void slotComputeLayout(); | 279 | void slotComputeLayout(); |
277 | void selectInternalWeekNum ( int ); | 280 | void selectInternalWeekNum ( int ); |
278 | void processSelectionChange(); | 281 | void processSelectionChange(); |
279 | signals: | 282 | signals: |
280 | void nextMonth(); | 283 | void nextMonth(); |
281 | void prevMonth(); | 284 | void prevMonth(); |
282 | void selectWeekNum ( int ); | 285 | void selectWeekNum ( int ); |
283 | void selectMonth (); | 286 | void selectMonth (); |
284 | void showDaySignal( QDate ); | 287 | void showDaySignal( QDate ); |
285 | protected: | 288 | protected: |
286 | void resizeEvent(QResizeEvent *); | 289 | void resizeEvent(QResizeEvent *); |
287 | void viewChanged(); | 290 | void viewChanged(); |
288 | void updateDayLabels(); | 291 | void updateDayLabels(); |
289 | 292 | ||
290 | private: | 293 | private: |
291 | QTimer* mComputeLayoutTimer; | 294 | QTimer* mComputeLayoutTimer; |
292 | NavigatorBar* mNavigatorBar; | 295 | NavigatorBar* mNavigatorBar; |
293 | int currentWeek(); | 296 | int currentWeek(); |
294 | bool clPending; | 297 | bool clPending; |
295 | QWidgetStack * mWidStack; | 298 | QWidgetStack * mWidStack; |
296 | QWidget* mMonthView; | 299 | QWidget* mMonthView; |
297 | QWidget* mWeekView; | 300 | QWidget* mWeekView; |
298 | bool mShowWeekView; | 301 | bool mShowWeekView; |
299 | bool updatePossible; | 302 | bool updatePossible; |
300 | int mDaysPerWeek; | 303 | int mDaysPerWeek; |
301 | int mNumWeeks; | 304 | int mNumWeeks; |
302 | int mNumCells; | 305 | int mNumCells; |
303 | //bool mWeekStartsMonday; | 306 | //bool mWeekStartsMonday; |
304 | bool mShowSatSunComp; | 307 | bool mShowSatSunComp; |
305 | void computeLayout(); | 308 | void computeLayout(); |
306 | void computeLayoutWeek(); | 309 | void computeLayoutWeek(); |
307 | 310 | ||
308 | QPtrVector<MonthViewCell> mCells; | 311 | QPtrVector<MonthViewCell> mCells; |
309 | QPtrVector<QLabel> mDayLabels; | 312 | QPtrVector<QLabel> mDayLabels; |
310 | QPtrVector<KOWeekButton> mWeekLabels; | 313 | QPtrVector<KOWeekButton> mWeekLabels; |
311 | QPtrVector<MonthViewCell> mCellsW; | 314 | QPtrVector<MonthViewCell> mCellsW; |
312 | QPtrVector<QLabel> mDayLabelsW; | 315 | QPtrVector<QLabel> mDayLabelsW; |
313 | QPtrVector<KOWeekButton> mWeekLabelsW; | 316 | QPtrVector<KOWeekButton> mWeekLabelsW; |
314 | 317 | ||
315 | bool mShortDayLabelsM; | 318 | bool mShortDayLabelsM; |
316 | bool mShortDayLabelsW; | 319 | bool mShortDayLabelsW; |
317 | int mWidthLongDayLabel; | 320 | int mWidthLongDayLabel; |
318 | 321 | ||
319 | QDate mStartDate; | 322 | QDate mStartDate; |
320 | 323 | ||
321 | MonthViewCell *mSelectedCell; | 324 | MonthViewCell *mSelectedCell; |
322 | bool mFlagKeyPressed; | 325 | bool mFlagKeyPressed; |
323 | KOEventPopupMenu *mContextMenu; | 326 | KOEventPopupMenu *mContextMenu; |
324 | void keyPressEvent ( QKeyEvent * ) ; | 327 | void keyPressEvent ( QKeyEvent * ) ; |
325 | void keyReleaseEvent ( QKeyEvent * ) ; | 328 | void keyReleaseEvent ( QKeyEvent * ) ; |
326 | 329 | ||
327 | }; | 330 | }; |
328 | 331 | ||
329 | #endif | 332 | #endif |