author | zautrix <zautrix> | 2005-07-28 12:59:27 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-28 12:59:27 (UTC) |
commit | 8e21306a697d77c80d42f450a721cb3d7c23fd0f (patch) (unidiff) | |
tree | a7eed1d0dafc2725709704a3658f1ff42b7d8b8b | |
parent | fee4c893fe8fd01af1b55c1ccd40213fc18a36b4 (diff) | |
download | kdepimpi-8e21306a697d77c80d42f450a721cb3d7c23fd0f.zip kdepimpi-8e21306a697d77c80d42f450a721cb3d7c23fd0f.tar.gz kdepimpi-8e21306a697d77c80d42f450a721cb3d7c23fd0f.tar.bz2 |
monv fix
-rw-r--r-- | korganizer/komonthview.cpp | 12 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 4aeb20c..8d06040 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,337 +1,342 @@ | |||
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 | mBlockDeselect = false; | ||
85 | mWT = new KNOWhatsThis(this); | 86 | mWT = new KNOWhatsThis(this); |
86 | resetOnFocusIn = true; | 87 | resetOnFocusIn = true; |
87 | setVScrollBarMode(QScrollView::AlwaysOff); | 88 | setVScrollBarMode(QScrollView::AlwaysOff); |
88 | setHScrollBarMode(QScrollView::AlwaysOff); | 89 | setHScrollBarMode(QScrollView::AlwaysOff); |
89 | } | 90 | } |
90 | KNoScrollListBox::~KNoScrollListBox() | 91 | KNoScrollListBox::~KNoScrollListBox() |
91 | { | 92 | { |
92 | #if QT_VERSION >= 0x030000 | 93 | #if QT_VERSION >= 0x030000 |
93 | 94 | ||
94 | #else | 95 | #else |
95 | delete mWT; | 96 | delete mWT; |
96 | #endif | 97 | #endif |
97 | } | 98 | } |
98 | 99 | ||
99 | 100 | ||
100 | void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) | 101 | void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) |
101 | { | 102 | { |
102 | QListBox::focusInEvent ( e ); | 103 | QListBox::focusInEvent ( e ); |
103 | if ( count() ){ | 104 | if ( count() ){ |
104 | int ci = currentItem(); | 105 | int ci = currentItem(); |
105 | if ( ci < 0 ) ci = 0; | 106 | if ( ci < 0 ) ci = 0; |
106 | 107 | ||
107 | setCurrentItem( ci ); | 108 | setCurrentItem( ci ); |
108 | setSelected ( ci, true ); | 109 | setSelected ( ci, true ); |
109 | emit highlighted( item ( ci ) ); | 110 | emit highlighted( item ( ci ) ); |
110 | 111 | ||
111 | resetOnFocusIn = true; | 112 | resetOnFocusIn = true; |
112 | 113 | ||
113 | if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { | 114 | if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { |
114 | QListBoxItem *fi = firstItem (); | 115 | QListBoxItem *fi = firstItem (); |
115 | if (fi ) { | 116 | if (fi ) { |
116 | int ihei = fi->height( this ); | 117 | int ihei = fi->height( this ); |
117 | int hei = numRows () * ihei; | 118 | int hei = numRows () * ihei; |
118 | if ( hei < height() - horizontalScrollBar()->height () ) { | 119 | if ( hei < height() - horizontalScrollBar()->height () ) { |
119 | setVScrollBarMode(QScrollView::AlwaysOff); | 120 | setVScrollBarMode(QScrollView::AlwaysOff); |
120 | } | 121 | } |
121 | else | 122 | else |
122 | setVScrollBarMode(QScrollView::Auto); | 123 | setVScrollBarMode(QScrollView::Auto); |
123 | if ( ihei *3 > height() ) { | 124 | if ( ihei *3 > height() ) { |
124 | setHScrollBarMode(QScrollView::AlwaysOff); | 125 | setHScrollBarMode(QScrollView::AlwaysOff); |
125 | } | 126 | } |
126 | else { | 127 | else { |
127 | setHScrollBarMode(QScrollView::Auto); | 128 | setHScrollBarMode(QScrollView::Auto); |
128 | } | 129 | } |
129 | } else { | 130 | } else { |
130 | setVScrollBarMode(QScrollView::Auto); | 131 | setVScrollBarMode(QScrollView::Auto); |
131 | setHScrollBarMode(QScrollView::Auto); | 132 | setHScrollBarMode(QScrollView::Auto); |
132 | } | 133 | } |
133 | } | 134 | } |
134 | } | 135 | } |
135 | } | 136 | } |
136 | void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) | 137 | void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) |
137 | { | 138 | { |
139 | if ( ! mBlockDeselect ) { | ||
138 | int i = currentItem (); | 140 | int i = currentItem (); |
139 | if ( i >= 0 ) { | 141 | if ( i >= 0 ) { |
140 | setSelected ( i, false ); | 142 | setSelected ( i, false ); |
141 | } | 143 | } |
142 | QListBox::focusOutEvent ( e ); | 144 | QListBox::focusOutEvent ( e ); |
145 | } | ||
143 | setVScrollBarMode(QScrollView::AlwaysOff); | 146 | setVScrollBarMode(QScrollView::AlwaysOff); |
144 | setHScrollBarMode(QScrollView::AlwaysOff); | 147 | setHScrollBarMode(QScrollView::AlwaysOff); |
145 | emit highlightIncidence( 0, (MonthViewCell*)this, 0 ); | 148 | if ( ! mBlockDeselect ) |
149 | emit highlightIncidence( 0, (MonthViewCell*)this, 0 ); | ||
150 | mBlockDeselect = false; | ||
146 | } | 151 | } |
147 | 152 | ||
148 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 153 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
149 | { | 154 | { |
150 | QListBoxItem* item = itemAt ( p ); | 155 | QListBoxItem* item = itemAt ( p ); |
151 | if ( ! item ) { | 156 | if ( ! item ) { |
152 | return i18n("Click in the cell\nto add an event!"); | 157 | return i18n("Click in the cell\nto add an event!"); |
153 | } | 158 | } |
154 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), | 159 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
155 | KOPrefs::instance()->mWTshowDetails, | 160 | KOPrefs::instance()->mWTshowDetails, |
156 | KOPrefs::instance()->mWTshowCreated, | 161 | KOPrefs::instance()->mWTshowCreated, |
157 | KOPrefs::instance()->mWTshowChanged); | 162 | KOPrefs::instance()->mWTshowChanged); |
158 | } | 163 | } |
159 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 164 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
160 | { | 165 | { |
161 | //qDebug("KNoScrollListBox::keyPressEvent "); | 166 | //qDebug("KNoScrollListBox::keyPressEvent "); |
162 | switch(e->key()) { | 167 | switch(e->key()) { |
163 | case Key_Right: | 168 | case Key_Right: |
164 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 169 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
165 | { | 170 | { |
166 | e->ignore(); | 171 | e->ignore(); |
167 | return; | 172 | return; |
168 | } | 173 | } |
169 | scrollBy(10,0); | 174 | scrollBy(10,0); |
170 | break; | 175 | break; |
171 | case Key_Left: | 176 | case Key_Left: |
172 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 177 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
173 | { | 178 | { |
174 | e->ignore(); | 179 | e->ignore(); |
175 | return; | 180 | return; |
176 | } | 181 | } |
177 | scrollBy(-10,0); | 182 | scrollBy(-10,0); |
178 | break; | 183 | break; |
179 | case Key_Up: | 184 | case Key_Up: |
180 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 185 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
181 | e->ignore(); | 186 | e->ignore(); |
182 | break; | 187 | break; |
183 | } | 188 | } |
184 | if ( count() ) { | 189 | if ( count() ) { |
185 | if ( currentItem() == 0 ) { | 190 | if ( currentItem() == 0 ) { |
186 | emit prevCell(); | 191 | emit prevCell(); |
187 | } else { | 192 | } else { |
188 | setCurrentItem((currentItem()+count()-1)%count()); | 193 | setCurrentItem((currentItem()+count()-1)%count()); |
189 | if(!itemVisible(currentItem())) { | 194 | if(!itemVisible(currentItem())) { |
190 | if((unsigned int) currentItem() == (count()-1)) { | 195 | if((unsigned int) currentItem() == (count()-1)) { |
191 | setTopItem(currentItem()-numItemsVisible()+1); | 196 | setTopItem(currentItem()-numItemsVisible()+1); |
192 | } else { | 197 | } else { |
193 | setTopItem(topItem()-1); | 198 | setTopItem(topItem()-1); |
194 | } | 199 | } |
195 | } | 200 | } |
196 | } | 201 | } |
197 | } | 202 | } |
198 | break; | 203 | break; |
199 | case Key_Down: | 204 | case Key_Down: |
200 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 205 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
201 | e->ignore(); | 206 | e->ignore(); |
202 | break; | 207 | break; |
203 | } | 208 | } |
204 | if ( count () ) { | 209 | if ( count () ) { |
205 | if ( ((uint)currentItem()+1) == count () ) { | 210 | if ( ((uint)currentItem()+1) == count () ) { |
206 | emit nextCell(); | 211 | emit nextCell(); |
207 | } else { | 212 | } else { |
208 | setCurrentItem((currentItem()+1)%count()); | 213 | setCurrentItem((currentItem()+1)%count()); |
209 | if(!itemVisible(currentItem())) { | 214 | if(!itemVisible(currentItem())) { |
210 | if(currentItem() == 0) { | 215 | if(currentItem() == 0) { |
211 | setTopItem(0); | 216 | setTopItem(0); |
212 | } else { | 217 | } else { |
213 | setTopItem(topItem()+1); | 218 | setTopItem(topItem()+1); |
214 | } | 219 | } |
215 | } | 220 | } |
216 | } | 221 | } |
217 | } | 222 | } |
218 | break; | 223 | break; |
219 | case Key_I: | 224 | case Key_I: |
220 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); | 225 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); |
221 | e->ignore(); | 226 | e->ignore(); |
222 | break; | 227 | break; |
223 | case Key_Return: | 228 | case Key_Return: |
224 | case Key_Enter: | 229 | case Key_Enter: |
225 | { | 230 | { |
226 | if ( currentItem() >= 0 ) { | 231 | if ( currentItem() >= 0 ) { |
227 | emit doubleClicked( item( currentItem() ) ); | 232 | emit doubleClicked( item( currentItem() ) ); |
228 | e->accept(); | 233 | e->accept(); |
229 | } else { | 234 | } else { |
230 | e->ignore(); | 235 | e->ignore(); |
231 | } | 236 | } |
232 | } | 237 | } |
233 | break; | 238 | break; |
234 | case Key_Shift: | 239 | case Key_Shift: |
235 | emit shiftDown(); | 240 | emit shiftDown(); |
236 | break; | 241 | break; |
237 | default: | 242 | default: |
238 | e->ignore(); | 243 | e->ignore(); |
239 | break; | 244 | break; |
240 | } | 245 | } |
241 | } | 246 | } |
242 | 247 | ||
243 | void KNoScrollListBox::oneDown() | 248 | void KNoScrollListBox::oneDown() |
244 | { | 249 | { |
245 | if ( count () ) { | 250 | if ( count () ) { |
246 | if ( ((uint)currentItem()+1) == count () ) { | 251 | if ( ((uint)currentItem()+1) == count () ) { |
247 | emit nextCell(); | 252 | emit nextCell(); |
248 | } else { | 253 | } else { |
249 | resetOnFocusIn = false; | 254 | resetOnFocusIn = false; |
250 | setCurrentItem((currentItem()+1)%count()); | 255 | setCurrentItem((currentItem()+1)%count()); |
251 | if(!itemVisible(currentItem())) { | 256 | if(!itemVisible(currentItem())) { |
252 | if(currentItem() == 0) { | 257 | if(currentItem() == 0) { |
253 | setTopItem(0); | 258 | setTopItem(0); |
254 | } else { | 259 | } else { |
255 | setTopItem(topItem()+1); | 260 | setTopItem(topItem()+1); |
256 | } | 261 | } |
257 | } | 262 | } |
258 | } | 263 | } |
259 | } | 264 | } |
260 | } | 265 | } |
261 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 266 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
262 | { | 267 | { |
263 | switch(e->key()) { | 268 | switch(e->key()) { |
264 | case Key_Shift: | 269 | case Key_Shift: |
265 | emit shiftUp(); | 270 | emit shiftUp(); |
266 | break; | 271 | break; |
267 | default: | 272 | default: |
268 | break; | 273 | break; |
269 | } | 274 | } |
270 | } | 275 | } |
271 | 276 | ||
272 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 277 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
273 | { | 278 | { |
274 | QListBox::mousePressEvent(e); | 279 | QListBox::mousePressEvent(e); |
275 | 280 | ||
276 | if(e->button() == RightButton) { | 281 | if(e->button() == RightButton) { |
277 | emit rightClick(); | 282 | emit rightClick(); |
278 | } | 283 | } |
279 | } | 284 | } |
280 | 285 | ||
281 | MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) | 286 | MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) |
282 | : QListBoxItem() | 287 | : QListBoxItem() |
283 | { | 288 | { |
284 | mblockRepaint = true; | 289 | mblockRepaint = true; |
285 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 290 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
286 | recycle( incidence, s ); | 291 | recycle( incidence, s ); |
287 | } | 292 | } |
288 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) | 293 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) |
289 | { | 294 | { |
290 | mDisplayHighlighted = false; | 295 | mDisplayHighlighted = false; |
291 | setText( s ); | 296 | setText( s ); |
292 | mMultiday = 0; | 297 | mMultiday = 0; |
293 | mIncidence = incidence; | 298 | mIncidence = incidence; |
294 | mRecur = false; | 299 | mRecur = false; |
295 | mAlarm = false; | 300 | mAlarm = false; |
296 | mReply = false; | 301 | mReply = false; |
297 | mInfo = false; | 302 | mInfo = false; |
298 | mdayPos = 0; | 303 | mdayPos = 0; |
299 | } | 304 | } |
300 | 305 | ||
301 | bool MonthViewItem::setHighlightedFalse() | 306 | bool MonthViewItem::setHighlightedFalse() |
302 | { | 307 | { |
303 | if ( !mDisplayHighlighted ) | 308 | if ( !mDisplayHighlighted ) |
304 | return false; | 309 | return false; |
305 | mDisplayHighlighted = false; | 310 | mDisplayHighlighted = false; |
306 | return true; | 311 | return true; |
307 | } | 312 | } |
308 | 313 | ||
309 | bool MonthViewItem::setHighlighted( Incidence * inc ) | 314 | bool MonthViewItem::setHighlighted( Incidence * inc ) |
310 | { | 315 | { |
311 | if ( inc == mIncidence ) { | 316 | if ( inc == mIncidence ) { |
312 | if ( mDisplayHighlighted ) | 317 | if ( mDisplayHighlighted ) |
313 | return false; | 318 | return false; |
314 | mDisplayHighlighted = true; | 319 | mDisplayHighlighted = true; |
315 | return true; | 320 | return true; |
316 | } else { | 321 | } else { |
317 | if ( !mDisplayHighlighted ) | 322 | if ( !mDisplayHighlighted ) |
318 | return false; | 323 | return false; |
319 | mDisplayHighlighted = false; | 324 | mDisplayHighlighted = false; |
320 | return true; | 325 | return true; |
321 | } | 326 | } |
322 | return false; | 327 | return false; |
323 | } | 328 | } |
324 | void MonthViewItem::paint(QPainter *p) | 329 | void MonthViewItem::paint(QPainter *p) |
325 | { | 330 | { |
326 | if ( mblockRepaint || !mIncidence ) { | 331 | if ( mblockRepaint || !mIncidence ) { |
327 | return; | 332 | return; |
328 | } | 333 | } |
329 | #if QT_VERSION >= 0x030000 | 334 | #if QT_VERSION >= 0x030000 |
330 | bool sel = isSelected(); | 335 | bool sel = isSelected(); |
331 | #else | 336 | #else |
332 | bool sel = selected(); | 337 | bool sel = selected(); |
333 | #endif | 338 | #endif |
334 | int heihei = height( listBox () ); | 339 | int heihei = height( listBox () ); |
335 | int x = 1; | 340 | int x = 1; |
336 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHighlighted || sel ) | 341 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHighlighted || sel ) |
337 | { | 342 | { |
@@ -921,387 +926,386 @@ void MonthViewCell::updateCell() | |||
921 | startUpdateCell(); | 926 | startUpdateCell(); |
922 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 927 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
923 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 928 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
924 | Event *event; | 929 | Event *event; |
925 | for( event = events.first(); event; event = events.next() ) { // for event | 930 | for( event = events.first(); event; event = events.next() ) { // for event |
926 | insertEvent(event); | 931 | insertEvent(event); |
927 | } | 932 | } |
928 | // insert due todos | 933 | // insert due todos |
929 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 934 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
930 | Todo *todo; | 935 | Todo *todo; |
931 | for(todo = todos.first(); todo; todo = todos.next()) { | 936 | for(todo = todos.first(); todo; todo = todos.next()) { |
932 | insertTodo( todo ); | 937 | insertTodo( todo ); |
933 | } | 938 | } |
934 | finishUpdateCell(); | 939 | finishUpdateCell(); |
935 | // if ( isVisible()) | 940 | // if ( isVisible()) |
936 | //qApp->processEvents(); | 941 | //qApp->processEvents(); |
937 | } | 942 | } |
938 | 943 | ||
939 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 944 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
940 | { | 945 | { |
941 | 946 | ||
942 | if ( bigFont ) { | 947 | if ( bigFont ) { |
943 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 948 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
944 | int ps = fo.pointSize() + 2; | 949 | int ps = fo.pointSize() + 2; |
945 | if ( ps < 18 ) | 950 | if ( ps < 18 ) |
946 | ps += 2; | 951 | ps += 2; |
947 | fo.setPointSize( ps ); | 952 | fo.setPointSize( ps ); |
948 | setFont( fo ); | 953 | setFont( fo ); |
949 | } else | 954 | } else |
950 | setFont( KOPrefs::instance()->mMonthViewFont ); | 955 | setFont( KOPrefs::instance()->mMonthViewFont ); |
951 | 956 | ||
952 | QFontMetrics fm( font() ); | 957 | QFontMetrics fm( font() ); |
953 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 958 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
954 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 959 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
955 | mHolidayPalette = mStandardPalette; | 960 | mHolidayPalette = mStandardPalette; |
956 | mPrimaryPalette = mStandardPalette; | 961 | mPrimaryPalette = mStandardPalette; |
957 | mNonPrimaryPalette = mStandardPalette; | 962 | mNonPrimaryPalette = mStandardPalette; |
958 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 963 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
959 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 964 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
960 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 965 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
961 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 966 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
962 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 967 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
963 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 968 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
964 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 969 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
965 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 970 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
966 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 971 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
967 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 972 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
968 | } | 973 | } |
969 | //updateCell(); | 974 | //updateCell(); |
970 | } | 975 | } |
971 | 976 | ||
972 | void MonthViewCell::enableScrollBars( bool enabled ) | 977 | void MonthViewCell::enableScrollBars( bool enabled ) |
973 | { | 978 | { |
974 | 979 | ||
975 | return; | 980 | return; |
976 | if ( enabled ) { | 981 | if ( enabled ) { |
977 | QListBoxItem *fi = firstItem (); | 982 | QListBoxItem *fi = firstItem (); |
978 | if (fi ) { | 983 | if (fi ) { |
979 | int ihei = fi->height( this ); | 984 | int ihei = fi->height( this ); |
980 | int hei = numRows () * ihei; | 985 | int hei = numRows () * ihei; |
981 | if ( hei < height() - horizontalScrollBar()->height () ) { | 986 | if ( hei < height() - horizontalScrollBar()->height () ) { |
982 | setVScrollBarMode(QScrollView::AlwaysOff); | 987 | setVScrollBarMode(QScrollView::AlwaysOff); |
983 | } | 988 | } |
984 | else | 989 | else |
985 | setVScrollBarMode(QScrollView::Auto); | 990 | setVScrollBarMode(QScrollView::Auto); |
986 | if ( ihei *3 > height() ) { | 991 | if ( ihei *3 > height() ) { |
987 | setHScrollBarMode(QScrollView::AlwaysOff); | 992 | setHScrollBarMode(QScrollView::AlwaysOff); |
988 | } | 993 | } |
989 | else { | 994 | else { |
990 | setHScrollBarMode(QScrollView::Auto); | 995 | setHScrollBarMode(QScrollView::Auto); |
991 | } | 996 | } |
992 | } else { | 997 | } else { |
993 | setVScrollBarMode(QScrollView::Auto); | 998 | setVScrollBarMode(QScrollView::Auto); |
994 | setHScrollBarMode(QScrollView::Auto); | 999 | setHScrollBarMode(QScrollView::Auto); |
995 | } | 1000 | } |
996 | } else { | 1001 | } else { |
997 | setVScrollBarMode(QScrollView::AlwaysOff); | 1002 | setVScrollBarMode(QScrollView::AlwaysOff); |
998 | setHScrollBarMode(QScrollView::AlwaysOff); | 1003 | setHScrollBarMode(QScrollView::AlwaysOff); |
999 | } | 1004 | } |
1000 | } | 1005 | } |
1001 | 1006 | ||
1002 | Incidence *MonthViewCell::selectedIncidence() | 1007 | Incidence *MonthViewCell::selectedIncidence() |
1003 | { | 1008 | { |
1004 | int index = currentItem(); | 1009 | int index = currentItem(); |
1005 | if ( index < 0 ) return 0; | 1010 | if ( index < 0 ) return 0; |
1006 | 1011 | ||
1007 | MonthViewItem *mitem = | 1012 | MonthViewItem *mitem = |
1008 | static_cast<MonthViewItem *>( item( index ) ); | 1013 | static_cast<MonthViewItem *>( item( index ) ); |
1009 | 1014 | ||
1010 | if ( !mitem ) return 0; | 1015 | if ( !mitem ) return 0; |
1011 | 1016 | ||
1012 | return mitem->incidence(); | 1017 | return mitem->incidence(); |
1013 | } | 1018 | } |
1014 | 1019 | ||
1015 | QDate MonthViewCell::selectedIncidenceDate() | 1020 | QDate MonthViewCell::selectedIncidenceDate() |
1016 | { | 1021 | { |
1017 | QDate qd; | 1022 | QDate qd; |
1018 | int index = currentItem(); | 1023 | int index = currentItem(); |
1019 | if ( index < 0 ) return qd; | 1024 | if ( index < 0 ) return qd; |
1020 | return mDate; | 1025 | return mDate; |
1021 | } | 1026 | } |
1022 | 1027 | ||
1023 | void MonthViewCell::deselect() | 1028 | void MonthViewCell::deselect() |
1024 | { | 1029 | { |
1025 | clearSelection(); | 1030 | clearSelection(); |
1026 | enableScrollBars( false ); | 1031 | enableScrollBars( false ); |
1027 | // updateCell(); | 1032 | // updateCell(); |
1028 | } | 1033 | } |
1029 | void MonthViewCell::select() | 1034 | void MonthViewCell::select() |
1030 | { | 1035 | { |
1031 | ;// updateCell(); | 1036 | ;// updateCell(); |
1032 | } | 1037 | } |
1033 | 1038 | ||
1034 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) | 1039 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) |
1035 | { | 1040 | { |
1036 | if ( !mMonthView->isUpdatePossible() ) | 1041 | if ( !mMonthView->isUpdatePossible() ) |
1037 | return; | 1042 | return; |
1038 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 1043 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
1039 | deselect(); | 1044 | deselect(); |
1040 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); | 1045 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); |
1041 | 1046 | ||
1042 | QString text; | 1047 | QString text; |
1043 | //mLabel->setText( text ); | 1048 | //mLabel->setText( text ); |
1044 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 1049 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
1045 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 1050 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
1046 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); | 1051 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); |
1047 | mLabel->resize( mLabelBigSize ); | 1052 | mLabel->resize( mLabelBigSize ); |
1048 | } else { | 1053 | } else { |
1049 | mLabel->resize( mLabelSize ); | 1054 | mLabel->resize( mLabelSize ); |
1050 | text = QString::number( mDate.day() ); | 1055 | text = QString::number( mDate.day() ); |
1051 | } | 1056 | } |
1052 | mLabel->setText( text ); | 1057 | mLabel->setText( text ); |
1053 | 1058 | ||
1054 | int size = height() - mLabel->height() - lineWidth()-1; | 1059 | int size = height() - mLabel->height() - lineWidth()-1; |
1055 | //qDebug("LW %d ", lineWidth()); | 1060 | //qDebug("LW %d ", lineWidth()); |
1056 | if ( size > 0 ) | 1061 | if ( size > 0 ) |
1057 | verticalScrollBar()->setMaximumHeight( size ); | 1062 | verticalScrollBar()->setMaximumHeight( size ); |
1058 | size = width() - mLabel->width() -lineWidth()-1; | 1063 | size = width() - mLabel->width() -lineWidth()-1; |
1059 | if ( size > 0 ) | 1064 | if ( size > 0 ) |
1060 | horizontalScrollBar()->setMaximumWidth( size ); | 1065 | horizontalScrollBar()->setMaximumWidth( size ); |
1061 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 1066 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
1062 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 1067 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
1063 | // mItemList->resize ( width(), height () ); | 1068 | // mItemList->resize ( width(), height () ); |
1064 | if ( e ) | 1069 | if ( e ) |
1065 | KNoScrollListBox::resizeEvent ( e ); | 1070 | KNoScrollListBox::resizeEvent ( e ); |
1066 | } | 1071 | } |
1067 | 1072 | ||
1068 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 1073 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
1069 | { | 1074 | { |
1070 | 1075 | ||
1071 | if ( !item ) { | 1076 | if ( !item ) { |
1072 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1077 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1073 | emit newEventSignal( dt ); | 1078 | emit newEventSignal( dt ); |
1074 | return; | 1079 | return; |
1075 | } | 1080 | } |
1076 | 1081 | ||
1077 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1082 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1078 | Incidence *incidence = eventItem->incidence(); | 1083 | Incidence *incidence = eventItem->incidence(); |
1079 | if ( incidence ) mMonthView->defaultAction( incidence ); | 1084 | if ( incidence ) mMonthView->defaultAction( incidence ); |
1080 | } | 1085 | } |
1081 | void MonthViewCell::showDay() | 1086 | void MonthViewCell::showDay() |
1082 | { | 1087 | { |
1083 | emit showDaySignal( date() ); | 1088 | emit showDaySignal( date() ); |
1084 | } | 1089 | } |
1085 | void MonthViewCell::newEvent() | 1090 | void MonthViewCell::newEvent() |
1086 | { | 1091 | { |
1087 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1092 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1088 | emit newEventSignal( dt ); | 1093 | emit newEventSignal( dt ); |
1089 | } | 1094 | } |
1090 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 1095 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
1091 | { | 1096 | { |
1092 | mMonthView->setSelectedCell( this ); | 1097 | mMonthView->setSelectedCell( this ); |
1093 | if ( item == 0 ) { | 1098 | if ( item == 0 ) { |
1094 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1099 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1095 | emit newEventSignal( dt ); | 1100 | emit newEventSignal( dt ); |
1096 | return; | 1101 | return; |
1097 | } | 1102 | } |
1098 | 1103 | ||
1099 | } | 1104 | } |
1100 | 1105 | ||
1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 1106 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
1102 | { | 1107 | { |
1103 | mMonthView->setPopupCell( this ); | 1108 | mMonthView->setPopupCell( this ); |
1104 | if ( !item ) { | 1109 | if ( !item ) { |
1105 | mMonthView->showContextMenu( 0 ); | 1110 | mMonthView->showContextMenu( 0 ); |
1106 | return; | 1111 | return; |
1107 | } | 1112 | } |
1108 | //selection( item ); | 1113 | //selection( item ); |
1109 | //qApp->processEvents(); | 1114 | //qApp->processEvents(); |
1110 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1115 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1111 | Incidence *incidence = eventItem->incidence(); | 1116 | Incidence *incidence = eventItem->incidence(); |
1112 | if ( incidence ) { | 1117 | if ( incidence ) { |
1118 | mBlockDeselect = true; | ||
1113 | mMonthView->showContextMenu( incidence ); | 1119 | mMonthView->showContextMenu( incidence ); |
1114 | selection( item ); | ||
1115 | doHighLight( incidence ); | ||
1116 | } | 1120 | } |
1117 | } | 1121 | } |
1118 | 1122 | ||
1119 | void MonthViewCell::selection( QListBoxItem *item ) | 1123 | void MonthViewCell::selection( QListBoxItem *item ) |
1120 | { | 1124 | { |
1121 | if ( !item ) { | 1125 | if ( !item ) { |
1122 | emit highlightIncidence( 0 , this, 0 ); | 1126 | emit highlightIncidence( 0 , this, 0 ); |
1123 | return; | 1127 | return; |
1124 | } | 1128 | } |
1125 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); | 1129 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); |
1126 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); | 1130 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); |
1127 | mMonthView->setSelectedCell( this ); | 1131 | mMonthView->setSelectedCell( this ); |
1128 | } | 1132 | } |
1129 | 1133 | ||
1130 | void MonthViewCell::deHighLight() | 1134 | void MonthViewCell::deHighLight() |
1131 | { | 1135 | { |
1132 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1136 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1133 | while ( mitem ) { | 1137 | while ( mitem ) { |
1134 | if ( mitem->setHighlightedFalse() ) | 1138 | if ( mitem->setHighlightedFalse() ) |
1135 | updateItem ( mitem ); | 1139 | updateItem ( mitem ); |
1136 | mitem = (MonthViewItem *)mitem->next(); | 1140 | mitem = (MonthViewItem *)mitem->next(); |
1137 | } | 1141 | } |
1138 | } | 1142 | } |
1139 | // returns true if no inc found | 1143 | // returns true if no inc found |
1140 | bool MonthViewCell::doHighLight( Incidence * inc ) | 1144 | bool MonthViewCell::doHighLight( Incidence * inc ) |
1141 | { | 1145 | { |
1142 | 1146 | ||
1143 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1147 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1144 | while ( mitem ) { | 1148 | while ( mitem ) { |
1145 | if ( mitem->incidence() == inc ) { | 1149 | if ( mitem->incidence() == inc ) { |
1146 | if ( mitem->setHighlighted( inc ) ) | 1150 | if ( mitem->setHighlighted( inc ) ) |
1147 | updateItem ( mitem ); | 1151 | updateItem ( mitem ); |
1148 | return false; | 1152 | return false; |
1149 | } | 1153 | } |
1150 | mitem = (MonthViewItem *)mitem->next(); | 1154 | mitem = (MonthViewItem *)mitem->next(); |
1151 | } | 1155 | } |
1152 | return true; | 1156 | return true; |
1153 | } | 1157 | } |
1154 | // ******************************************************************************* | 1158 | // ******************************************************************************* |
1155 | // ******************************************************************************* | 1159 | // ******************************************************************************* |
1156 | // ******************************************************************************* | 1160 | // ******************************************************************************* |
1157 | 1161 | ||
1158 | 1162 | ||
1159 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 1163 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
1160 | : KOEventView( calendar, parent, name ), | 1164 | : KOEventView( calendar, parent, name ), |
1161 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 1165 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
1162 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 1166 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
1163 | { | 1167 | { |
1164 | mFlagKeyPressed = false; | 1168 | mFlagKeyPressed = false; |
1165 | mShortDayLabelsM = false; | 1169 | mShortDayLabelsM = false; |
1166 | mShortDayLabelsW = false; | 1170 | mShortDayLabelsW = false; |
1167 | skipResize = false; | 1171 | skipResize = false; |
1168 | clPending = true; | 1172 | clPending = true; |
1169 | mPopupCell = 0; | 1173 | mPopupCell = 0; |
1170 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 1174 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
1171 | mWidStack = new QWidgetStack( this ); | 1175 | mWidStack = new QWidgetStack( this ); |
1172 | QVBoxLayout* hb = new QVBoxLayout( this ); | 1176 | QVBoxLayout* hb = new QVBoxLayout( this ); |
1173 | mMonthView = new QWidget( mWidStack ); | 1177 | mMonthView = new QWidget( mWidStack ); |
1174 | mWeekView = new QWidget( mWidStack ); | 1178 | mWeekView = new QWidget( mWidStack ); |
1175 | #if QT_VERSION >= 0x030000 | 1179 | #if QT_VERSION >= 0x030000 |
1176 | mWidStack->addWidget(mMonthView ); | 1180 | mWidStack->addWidget(mMonthView ); |
1177 | mWidStack->addWidget(mWeekView ); | 1181 | mWidStack->addWidget(mWeekView ); |
1178 | #else | 1182 | #else |
1179 | mWidStack->addWidget( mMonthView, 1 ); | 1183 | mWidStack->addWidget( mMonthView, 1 ); |
1180 | mWidStack->addWidget( mWeekView , 1 ); | 1184 | mWidStack->addWidget( mWeekView , 1 ); |
1181 | #endif | 1185 | #endif |
1182 | hb->addWidget( mNavigatorBar ); | 1186 | hb->addWidget( mNavigatorBar ); |
1183 | hb->addWidget( mWidStack ); | 1187 | hb->addWidget( mWidStack ); |
1184 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; | 1188 | mShowWeekView = KOPrefs::instance()->mMonthViewWeek; |
1185 | updatePossible = false; | 1189 | updatePossible = false; |
1186 | //updatePossible = true; | 1190 | //updatePossible = true; |
1187 | mCells.setAutoDelete( true ); | 1191 | mCells.setAutoDelete( true ); |
1188 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1192 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1189 | mDayLabels.resize( mDaysPerWeek ); | 1193 | mDayLabels.resize( mDaysPerWeek ); |
1190 | mDayLabelsW.resize( mDaysPerWeek ); | 1194 | mDayLabelsW.resize( mDaysPerWeek ); |
1191 | QFont bfont = font(); | 1195 | QFont bfont = font(); |
1192 | if ( QApplication::desktop()->width() < 650 ) { | 1196 | if ( QApplication::desktop()->width() < 650 ) { |
1193 | bfont.setPointSize( bfont.pointSize() - 2 ); | 1197 | bfont.setPointSize( bfont.pointSize() - 2 ); |
1194 | } | 1198 | } |
1195 | bfont.setBold( true ); | 1199 | bfont.setBold( true ); |
1196 | int i; | 1200 | int i; |
1197 | 1201 | ||
1198 | for( i = 0; i < mDaysPerWeek; i++ ) { | 1202 | for( i = 0; i < mDaysPerWeek; i++ ) { |
1199 | QLabel *label = new QLabel( mMonthView ); | 1203 | QLabel *label = new QLabel( mMonthView ); |
1200 | label->setFont(bfont); | 1204 | label->setFont(bfont); |
1201 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1205 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1202 | label->setLineWidth(1); | 1206 | label->setLineWidth(1); |
1203 | label->setAlignment(AlignCenter); | 1207 | label->setAlignment(AlignCenter); |
1204 | mDayLabels.insert( i, label ); | 1208 | mDayLabels.insert( i, label ); |
1205 | label = new QLabel( mWeekView ); | 1209 | label = new QLabel( mWeekView ); |
1206 | label->setFont(bfont); | 1210 | label->setFont(bfont); |
1207 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1211 | label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1208 | label->setLineWidth(1); | 1212 | label->setLineWidth(1); |
1209 | label->setAlignment(AlignCenter); | 1213 | label->setAlignment(AlignCenter); |
1210 | mDayLabelsW.insert( i, label ); | 1214 | mDayLabelsW.insert( i, label ); |
1211 | } | 1215 | } |
1212 | 1216 | ||
1213 | bfont.setBold( false ); | 1217 | bfont.setBold( false ); |
1214 | mWeekLabels.resize( mNumWeeks+1 ); | 1218 | mWeekLabels.resize( mNumWeeks+1 ); |
1215 | mWeekLabelsW.resize( 2 ); | 1219 | mWeekLabelsW.resize( 2 ); |
1216 | for( i = 0; i < mNumWeeks+1; i++ ) { | 1220 | for( i = 0; i < mNumWeeks+1; i++ ) { |
1217 | KOWeekButton *label = new KOWeekButton( mMonthView ); | 1221 | KOWeekButton *label = new KOWeekButton( mMonthView ); |
1218 | label->setFocusPolicy(NoFocus); | 1222 | label->setFocusPolicy(NoFocus); |
1219 | label->setFont(bfont); | 1223 | label->setFont(bfont); |
1220 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1224 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1221 | label->setFlat(true); | 1225 | label->setFlat(true); |
1222 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1226 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1223 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1227 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1224 | //label->setLineWidth(1); | 1228 | //label->setLineWidth(1); |
1225 | //label->setAlignment(AlignCenter); | 1229 | //label->setAlignment(AlignCenter); |
1226 | mWeekLabels.insert( i, label ); | 1230 | mWeekLabels.insert( i, label ); |
1227 | } | 1231 | } |
1228 | mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1232 | mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1229 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); | 1233 | mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); |
1230 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); | 1234 | QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); |
1231 | 1235 | ||
1232 | for( i = 0; i < 1+1; i++ ) { | 1236 | for( i = 0; i < 1+1; i++ ) { |
1233 | KOWeekButton *label = new KOWeekButton( mWeekView ); | 1237 | KOWeekButton *label = new KOWeekButton( mWeekView ); |
1234 | label->setFocusPolicy(NoFocus); | 1238 | label->setFocusPolicy(NoFocus); |
1235 | label->setFont(bfont); | 1239 | label->setFont(bfont); |
1236 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); | 1240 | connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); |
1237 | label->setFlat(true); | 1241 | label->setFlat(true); |
1238 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); | 1242 | QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); |
1239 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); | 1243 | //label->setFrameStyle(QFrame::Panel|QFrame::Raised); |
1240 | //label->setLineWidth(1); | 1244 | //label->setLineWidth(1); |
1241 | //label->setAlignment(AlignCenter); | 1245 | //label->setAlignment(AlignCenter); |
1242 | mWeekLabelsW.insert( i, label ); | 1246 | mWeekLabelsW.insert( i, label ); |
1243 | } | 1247 | } |
1244 | mWeekLabelsW[1]->setText( i18n("W")); | 1248 | mWeekLabelsW[1]->setText( i18n("W")); |
1245 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); | 1249 | mWeekLabelsW[1]->setFocusPolicy(WheelFocus); |
1246 | 1250 | ||
1247 | 1251 | ||
1248 | int row, col; | 1252 | int row, col; |
1249 | mCells.resize( mNumCells ); | 1253 | mCells.resize( mNumCells ); |
1250 | for( row = 0; row < mNumWeeks; ++row ) { | 1254 | for( row = 0; row < mNumWeeks; ++row ) { |
1251 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1255 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1252 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); | 1256 | MonthViewCell *cell = new MonthViewCell( this, mMonthView ); |
1253 | mCells.insert( row * mDaysPerWeek + col, cell ); | 1257 | mCells.insert( row * mDaysPerWeek + col, cell ); |
1254 | 1258 | ||
1255 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1259 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1256 | SLOT( defaultAction( Incidence * ) ) ); | 1260 | SLOT( defaultAction( Incidence * ) ) ); |
1257 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1261 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1258 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1262 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1259 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1263 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1260 | SIGNAL( showDaySignal( QDate ) ) ); | 1264 | SIGNAL( showDaySignal( QDate ) ) ); |
1261 | connect( cell, SIGNAL( nextCell() ), | 1265 | connect( cell, SIGNAL( nextCell() ), |
1262 | SLOT( nextCell() ) ); | 1266 | SLOT( nextCell() ) ); |
1263 | connect( cell, SIGNAL( prevCell() ), | 1267 | connect( cell, SIGNAL( prevCell() ), |
1264 | SLOT( prevCell() ) ); | 1268 | SLOT( prevCell() ) ); |
1265 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), | 1269 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1266 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1270 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1267 | } | 1271 | } |
1268 | } | 1272 | } |
1269 | mCellsW.resize( mDaysPerWeek ); | 1273 | mCellsW.resize( mDaysPerWeek ); |
1270 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1274 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1271 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1275 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
1272 | mCellsW.insert( col, cell ); | 1276 | mCellsW.insert( col, cell ); |
1273 | 1277 | ||
1274 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1278 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1275 | SLOT( defaultAction( Incidence * ) ) ); | 1279 | SLOT( defaultAction( Incidence * ) ) ); |
1276 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1280 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1277 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1281 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1278 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1282 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1279 | SIGNAL( showDaySignal( QDate ) ) ); | 1283 | SIGNAL( showDaySignal( QDate ) ) ); |
1280 | connect( cell, SIGNAL( nextCell() ), | 1284 | connect( cell, SIGNAL( nextCell() ), |
1281 | SLOT( nextCell() ) ); | 1285 | SLOT( nextCell() ) ); |
1282 | connect( cell, SIGNAL( prevCell() ), | 1286 | connect( cell, SIGNAL( prevCell() ), |
1283 | SLOT( prevCell() ) ); | 1287 | SLOT( prevCell() ) ); |
1284 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), | 1288 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1285 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1289 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1286 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1290 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1287 | } | 1291 | } |
1288 | 1292 | ||
1289 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1293 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1290 | mContextMenu = eventPopup(); | 1294 | mContextMenu = eventPopup(); |
1291 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1295 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1292 | i18n("New Event..."),this, | 1296 | i18n("New Event..."),this, |
1293 | SLOT(slotNewEvent()),false); | 1297 | SLOT(slotNewEvent()),false); |
1294 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1298 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1295 | i18n("New Todo..."),this, | 1299 | i18n("New Todo..."),this, |
1296 | SLOT(slotNewTodo()),false); | 1300 | SLOT(slotNewTodo()),false); |
1297 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1301 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1298 | i18n("Journal"),this, | 1302 | i18n("Journal"),this, |
1299 | SLOT(slotEditJournal()),false); | 1303 | SLOT(slotEditJournal()),false); |
1300 | 1304 | ||
1301 | connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, | 1305 | connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this, |
1302 | SLOT( catChanged( Incidence * ) )); | 1306 | SLOT( catChanged( Incidence * ) )); |
1303 | 1307 | ||
1304 | 1308 | ||
1305 | QString pathString = ""; | 1309 | QString pathString = ""; |
1306 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 1310 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
1307 | if ( QApplication::desktop()->width() < 480 ) | 1311 | if ( QApplication::desktop()->width() < 480 ) |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 61a141a..1a9d16d 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,282 +1,283 @@ | |||
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 MonthViewCell; | 47 | class MonthViewCell; |
48 | class KOWeekButton : public QPushButton | 48 | class KOWeekButton : public QPushButton |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | public: | 51 | public: |
52 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 52 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
53 | QPushButton( parent, name) | 53 | QPushButton( parent, name) |
54 | { | 54 | { |
55 | connect( this, SIGNAL( clicked() ), | 55 | connect( this, SIGNAL( clicked() ), |
56 | SLOT( bottonClicked() )); | 56 | SLOT( bottonClicked() )); |
57 | mNumber = -1; | 57 | mNumber = -1; |
58 | } | 58 | } |
59 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 59 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
60 | int getWeekNum() { return mNumber;} | 60 | int getWeekNum() { return mNumber;} |
61 | signals: | 61 | signals: |
62 | void selectWeekNum ( int ); | 62 | void selectWeekNum ( int ); |
63 | private: | 63 | private: |
64 | void focusInEvent ( QFocusEvent * ){;} | 64 | void focusInEvent ( QFocusEvent * ){;} |
65 | int mNumber; | 65 | int mNumber; |
66 | void keyPressEvent ( QKeyEvent * e ) | 66 | void keyPressEvent ( QKeyEvent * e ) |
67 | { | 67 | { |
68 | e->ignore(); | 68 | e->ignore(); |
69 | } | 69 | } |
70 | 70 | ||
71 | private slots : | 71 | private slots : |
72 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 72 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
73 | }; | 73 | }; |
74 | 74 | ||
75 | class KNoScrollListBox: public QListBox | 75 | class KNoScrollListBox: public QListBox |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | public: | 78 | public: |
79 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 79 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
80 | ~KNoScrollListBox(); | 80 | ~KNoScrollListBox(); |
81 | QString getWhatsThisText(QPoint p) ; | 81 | QString getWhatsThisText(QPoint p) ; |
82 | 82 | ||
83 | signals: | 83 | signals: |
84 | void shiftDown(); | 84 | void shiftDown(); |
85 | void shiftUp(); | 85 | void shiftUp(); |
86 | void rightClick(); | 86 | void rightClick(); |
87 | void nextCell(); | 87 | void nextCell(); |
88 | void prevCell(); | 88 | void prevCell(); |
89 | void highlightIncidence( Incidence * , MonthViewCell*, int ); | 89 | void highlightIncidence( Incidence * , MonthViewCell*, int ); |
90 | 90 | protected: | |
91 | bool mBlockDeselect; | ||
91 | protected slots: | 92 | protected slots: |
92 | void oneDown(); | 93 | void oneDown(); |
93 | void keyPressEvent(QKeyEvent *); | 94 | void keyPressEvent(QKeyEvent *); |
94 | void keyReleaseEvent(QKeyEvent *); | 95 | void keyReleaseEvent(QKeyEvent *); |
95 | void mousePressEvent(QMouseEvent *); | 96 | void mousePressEvent(QMouseEvent *); |
96 | void focusInEvent ( QFocusEvent * ); | 97 | void focusInEvent ( QFocusEvent * ); |
97 | void focusOutEvent ( QFocusEvent * ); | 98 | void focusOutEvent ( QFocusEvent * ); |
98 | 99 | ||
99 | private: | 100 | private: |
100 | bool resetOnFocusIn; | 101 | bool resetOnFocusIn; |
101 | KNOWhatsThis * mWT; | 102 | KNOWhatsThis * mWT; |
102 | }; | 103 | }; |
103 | 104 | ||
104 | 105 | ||
105 | class MonthViewItem: public QListBoxItem | 106 | class MonthViewItem: public QListBoxItem |
106 | { | 107 | { |
107 | public: | 108 | public: |
108 | MonthViewItem( Incidence *,const QString & title ); | 109 | MonthViewItem( Incidence *,const QString & title ); |
109 | void recycle( Incidence *incidence, const QString & s); | 110 | void recycle( Incidence *incidence, const QString & s); |
110 | void setRecur(bool on) { mRecur = on; } | 111 | void setRecur(bool on) { mRecur = on; } |
111 | void setAlarm(bool on) { mAlarm = on; } | 112 | void setAlarm(bool on) { mAlarm = on; } |
112 | void setReply(bool on) { mReply = on; } | 113 | void setReply(bool on) { mReply = on; } |
113 | void setMoreInfo(bool on) { mInfo = on; } | 114 | void setMoreInfo(bool on) { mInfo = on; } |
114 | void setMultiDay(int type) { mMultiday = type; } | 115 | void setMultiDay(int type) { mMultiday = type; } |
115 | int multiDay() { return mMultiday; } | 116 | int multiDay() { return mMultiday; } |
116 | void setMultiDayPos(int type) { mdayPos = type; } | 117 | void setMultiDayPos(int type) { mdayPos = type; } |
117 | int gettMultiDayPos() { return mdayPos; } | 118 | int gettMultiDayPos() { return mdayPos; } |
118 | void setBlockRepaint(bool on) { mblockRepaint = on; } | 119 | void setBlockRepaint(bool on) { mblockRepaint = on; } |
119 | bool setHighlighted( Incidence * ); | 120 | bool setHighlighted( Incidence * ); |
120 | 121 | ||
121 | void setPalette(const QPalette &p) { mPalette = p; } | 122 | void setPalette(const QPalette &p) { mPalette = p; } |
122 | QPalette palette() const { return mPalette; } | 123 | QPalette palette() const { return mPalette; } |
123 | bool setHighlightedFalse(); | 124 | bool setHighlightedFalse(); |
124 | Incidence *incidence() const { return mIncidence; } | 125 | Incidence *incidence() const { return mIncidence; } |
125 | 126 | ||
126 | protected: | 127 | protected: |
127 | virtual void paint(QPainter *); | 128 | virtual void paint(QPainter *); |
128 | virtual int height(const QListBox *) const; | 129 | virtual int height(const QListBox *) const; |
129 | virtual int width(const QListBox *) const; | 130 | virtual int width(const QListBox *) const; |
130 | 131 | ||
131 | private: | 132 | private: |
132 | int mdayPos; | 133 | int mdayPos; |
133 | bool isWeekItem; | 134 | bool isWeekItem; |
134 | bool mblockRepaint; | 135 | bool mblockRepaint; |
135 | int mMultiday; | 136 | int mMultiday; |
136 | bool mRecur; | 137 | bool mRecur; |
137 | bool mAlarm; | 138 | bool mAlarm; |
138 | bool mReply; | 139 | bool mReply; |
139 | bool mInfo; | 140 | bool mInfo; |
140 | bool mDisplayHighlighted; | 141 | bool mDisplayHighlighted; |
141 | 142 | ||
142 | QPalette mPalette; | 143 | QPalette mPalette; |
143 | QDate mDate; | 144 | QDate mDate; |
144 | 145 | ||
145 | Incidence *mIncidence; | 146 | Incidence *mIncidence; |
146 | }; | 147 | }; |
147 | 148 | ||
148 | 149 | ||
149 | class KOMonthView; | 150 | class KOMonthView; |
150 | 151 | ||
151 | class MonthViewCell : public KNoScrollListBox | 152 | class MonthViewCell : public KNoScrollListBox |
152 | { | 153 | { |
153 | Q_OBJECT | 154 | Q_OBJECT |
154 | public: | 155 | public: |
155 | MonthViewCell(KOMonthView *,QWidget* ); | 156 | MonthViewCell(KOMonthView *,QWidget* ); |
156 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | 157 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} |
157 | 158 | ||
158 | void setDate( const QDate & ); | 159 | void setDate( const QDate & ); |
159 | QDate date() const; | 160 | QDate date() const; |
160 | 161 | ||
161 | void setPrimary( bool ); | 162 | void setPrimary( bool ); |
162 | bool isPrimary() const; | 163 | bool isPrimary() const; |
163 | 164 | ||
164 | void setHoliday( bool ); | 165 | void setHoliday( bool ); |
165 | void setHoliday( const QString & ); | 166 | void setHoliday( const QString & ); |
166 | 167 | ||
167 | void updateCell(); | 168 | void updateCell(); |
168 | void startUpdateCell(); | 169 | void startUpdateCell(); |
169 | void finishUpdateCell(); | 170 | void finishUpdateCell(); |
170 | int insertEvent(Event *); | 171 | int insertEvent(Event *); |
171 | void insertTodo(Todo *); | 172 | void insertTodo(Todo *); |
172 | 173 | ||
173 | void updateConfig( bool bigFont = false ); | 174 | void updateConfig( bool bigFont = false ); |
174 | 175 | ||
175 | void enableScrollBars( bool ); | 176 | void enableScrollBars( bool ); |
176 | 177 | ||
177 | Incidence *selectedIncidence(); | 178 | Incidence *selectedIncidence(); |
178 | QDate selectedIncidenceDate(); | 179 | QDate selectedIncidenceDate(); |
179 | QPushButton * dateLabel() { return mLabel; } | 180 | QPushButton * dateLabel() { return mLabel; } |
180 | bool doHighLight( Incidence *); | 181 | bool doHighLight( Incidence *); |
181 | void deselect(); | 182 | void deselect(); |
182 | void select(); | 183 | void select(); |
183 | #ifdef DESKTOP_VERSION | 184 | #ifdef DESKTOP_VERSION |
184 | static QToolTipGroup *toolTipGroup(); | 185 | static QToolTipGroup *toolTipGroup(); |
185 | #endif | 186 | #endif |
186 | signals: | 187 | signals: |
187 | void defaultAction( Incidence * ); | 188 | void defaultAction( Incidence * ); |
188 | void newEventSignal( QDateTime ); | 189 | void newEventSignal( QDateTime ); |
189 | void showDaySignal( QDate ); | 190 | void showDaySignal( QDate ); |
190 | 191 | ||
191 | protected: | 192 | protected: |
192 | QStringList mToolTip; | 193 | QStringList mToolTip; |
193 | void resizeEvent( QResizeEvent * ); | 194 | void resizeEvent( QResizeEvent * ); |
194 | 195 | ||
195 | public slots: | 196 | public slots: |
196 | void showDay(); | 197 | void showDay(); |
197 | void deHighLight(); | 198 | void deHighLight(); |
198 | void repaintfinishUpdateCell(); | 199 | void repaintfinishUpdateCell(); |
199 | protected slots: | 200 | protected slots: |
200 | void defaultAction( QListBoxItem * ); | 201 | void defaultAction( QListBoxItem * ); |
201 | void contextMenu( QListBoxItem * ); | 202 | void contextMenu( QListBoxItem * ); |
202 | void selection( QListBoxItem * ); | 203 | void selection( QListBoxItem * ); |
203 | void cellClicked( QListBoxItem * ); | 204 | void cellClicked( QListBoxItem * ); |
204 | void newEvent(); | 205 | void newEvent(); |
205 | 206 | ||
206 | private: | 207 | private: |
207 | int mdayCount; | 208 | int mdayCount; |
208 | QPtrList <MonthViewItem> mAvailItemList; | 209 | QPtrList <MonthViewItem> mAvailItemList; |
209 | KOMonthView *mMonthView; | 210 | KOMonthView *mMonthView; |
210 | int currentPalette; | 211 | int currentPalette; |
211 | 212 | ||
212 | QDate mDate; | 213 | QDate mDate; |
213 | bool mPrimary; | 214 | bool mPrimary; |
214 | bool mHoliday; | 215 | bool mHoliday; |
215 | QString mHolidayString; | 216 | QString mHolidayString; |
216 | 217 | ||
217 | //QLabel *mLabel; | 218 | //QLabel *mLabel; |
218 | QPushButton *mLabel; | 219 | QPushButton *mLabel; |
219 | //QListBox *mItemList; | 220 | //QListBox *mItemList; |
220 | #ifdef DESKTOP_VERSION | 221 | #ifdef DESKTOP_VERSION |
221 | static QToolTipGroup *mToolTipGroup; | 222 | static QToolTipGroup *mToolTipGroup; |
222 | #endif | 223 | #endif |
223 | QSize mLabelSize; | 224 | QSize mLabelSize; |
224 | QSize mLabelBigSize; | 225 | QSize mLabelBigSize; |
225 | QPalette mHolidayPalette; | 226 | QPalette mHolidayPalette; |
226 | QPalette mStandardPalette; | 227 | QPalette mStandardPalette; |
227 | QPalette mPrimaryPalette; | 228 | QPalette mPrimaryPalette; |
228 | QPalette mNonPrimaryPalette; | 229 | QPalette mNonPrimaryPalette; |
229 | void setMyPalette(); | 230 | void setMyPalette(); |
230 | QPalette getPalette (); | 231 | QPalette getPalette (); |
231 | 232 | ||
232 | }; | 233 | }; |
233 | 234 | ||
234 | 235 | ||
235 | class KOMonthView: public KOEventView | 236 | class KOMonthView: public KOEventView |
236 | { | 237 | { |
237 | Q_OBJECT | 238 | Q_OBJECT |
238 | public: | 239 | public: |
239 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 240 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
240 | ~KOMonthView(); | 241 | ~KOMonthView(); |
241 | 242 | ||
242 | /** Returns maximum number of days supported by the komonthview */ | 243 | /** Returns maximum number of days supported by the komonthview */ |
243 | virtual int maxDatesHint(); | 244 | virtual int maxDatesHint(); |
244 | 245 | ||
245 | /** Returns number of currently shown dates. */ | 246 | /** Returns number of currently shown dates. */ |
246 | virtual int currentDateCount(); | 247 | virtual int currentDateCount(); |
247 | 248 | ||
248 | /** returns the currently selected events */ | 249 | /** returns the currently selected events */ |
249 | virtual QPtrList<Incidence> selectedIncidences(); | 250 | virtual QPtrList<Incidence> selectedIncidences(); |
250 | 251 | ||
251 | /** returns dates of the currently selected events */ | 252 | /** returns dates of the currently selected events */ |
252 | virtual DateList selectedDates(); | 253 | virtual DateList selectedDates(); |
253 | #if 0 | 254 | #if 0 |
254 | virtual void printPreview(CalPrinter *calPrinter, | 255 | virtual void printPreview(CalPrinter *calPrinter, |
255 | const QDate &, const QDate &); | 256 | const QDate &, const QDate &); |
256 | #endif | 257 | #endif |
257 | bool isMonthView() { return !mShowWeekView; } | 258 | bool isMonthView() { return !mShowWeekView; } |
258 | bool isUpdatePossible() { return updatePossible; } | 259 | bool isUpdatePossible() { return updatePossible; } |
259 | 260 | ||
260 | MonthViewCell * selectedCell(); | 261 | MonthViewCell * selectedCell(); |
261 | bool skipResize; | 262 | bool skipResize; |
262 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 263 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
263 | void clearList(); | 264 | void clearList(); |
264 | public slots: | 265 | public slots: |
265 | void incidenceHighlighted( Incidence *, MonthViewCell*, int ); | 266 | void incidenceHighlighted( Incidence *, MonthViewCell*, int ); |
266 | void nextCell(); | 267 | void nextCell(); |
267 | void prevCell(); | 268 | void prevCell(); |
268 | virtual void updateView(); | 269 | virtual void updateView(); |
269 | virtual void updateConfig(); | 270 | virtual void updateConfig(); |
270 | virtual void showDates(const QDate &start, const QDate &end); | 271 | virtual void showDates(const QDate &start, const QDate &end); |
271 | virtual void showEvents(QPtrList<Event> eventList); | 272 | virtual void showEvents(QPtrList<Event> eventList); |
272 | 273 | ||
273 | void changeEventDisplay(Event *, int); | 274 | void changeEventDisplay(Event *, int); |
274 | 275 | ||
275 | void clearSelection(); | 276 | void clearSelection(); |
276 | 277 | ||
277 | void showContextMenu( Incidence * ); | 278 | void showContextMenu( Incidence * ); |
278 | 279 | ||
279 | void setSelectedCell( MonthViewCell * ); | 280 | void setSelectedCell( MonthViewCell * ); |
280 | void setPopupCell( MonthViewCell * ); | 281 | void setPopupCell( MonthViewCell * ); |
281 | void switchView(); | 282 | void switchView(); |
282 | void setKeyBFocus(); | 283 | void setKeyBFocus(); |