summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-28 07:40:22 (UTC)
committer zautrix <zautrix>2005-06-28 07:40:22 (UTC)
commit4385e73c51688f0b8b21bfe061c04a6c42e92701 (patch) (unidiff)
treecc55a5cdfa999b9e285d37116901f4c0a2357b20 /korganizer
parent386f48c2011e49c7c145bad7754a725cabc25dd5 (diff)
downloadkdepimpi-4385e73c51688f0b8b21bfe061c04a6c42e92701.zip
kdepimpi-4385e73c51688f0b8b21bfe061c04a6c42e92701.tar.gz
kdepimpi-4385e73c51688f0b8b21bfe061c04a6c42e92701.tar.bz2
fixx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp44
-rw-r--r--korganizer/komonthview.h8
2 files changed, 26 insertions, 26 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 64b0e95..1c2d6a2 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -97,97 +97,97 @@ KNoScrollListBox::~KNoScrollListBox()
97} 97}
98 98
99 99
100void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 100void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
101{ 101{
102 QListBox::focusInEvent ( e ); 102 QListBox::focusInEvent ( e );
103 if ( count() ){ 103 if ( count() ){
104 int ci = currentItem(); 104 int ci = currentItem();
105 if ( ci < 0 ) ci = 0; 105 if ( ci < 0 ) ci = 0;
106 106
107 setCurrentItem( ci ); 107 setCurrentItem( ci );
108 setSelected ( ci, true ); 108 setSelected ( ci, true );
109 emit highlighted( item ( ci ) ); 109 emit highlighted( item ( ci ) );
110 110
111 resetOnFocusIn = true; 111 resetOnFocusIn = true;
112 112
113 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 113 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
114 QListBoxItem *fi = firstItem (); 114 QListBoxItem *fi = firstItem ();
115 if (fi ) { 115 if (fi ) {
116 int ihei = fi->height( this ); 116 int ihei = fi->height( this );
117 int hei = numRows () * ihei; 117 int hei = numRows () * ihei;
118 if ( hei < height() - horizontalScrollBar()->height () ) { 118 if ( hei < height() - horizontalScrollBar()->height () ) {
119 setVScrollBarMode(QScrollView::AlwaysOff); 119 setVScrollBarMode(QScrollView::AlwaysOff);
120 } 120 }
121 else 121 else
122 setVScrollBarMode(QScrollView::Auto); 122 setVScrollBarMode(QScrollView::Auto);
123 if ( ihei *3 > height() ) { 123 if ( ihei *3 > height() ) {
124 setHScrollBarMode(QScrollView::AlwaysOff); 124 setHScrollBarMode(QScrollView::AlwaysOff);
125 } 125 }
126 else { 126 else {
127 setHScrollBarMode(QScrollView::Auto); 127 setHScrollBarMode(QScrollView::Auto);
128 } 128 }
129 } else { 129 } else {
130 setVScrollBarMode(QScrollView::Auto); 130 setVScrollBarMode(QScrollView::Auto);
131 setHScrollBarMode(QScrollView::Auto); 131 setHScrollBarMode(QScrollView::Auto);
132 } 132 }
133 } 133 }
134 } 134 }
135} 135}
136void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 136void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
137{ 137{
138 int i = currentItem (); 138 int i = currentItem ();
139 if ( i >= 0 ) { 139 if ( i >= 0 ) {
140 setSelected ( i, false ); 140 setSelected ( i, false );
141 } 141 }
142 QListBox::focusOutEvent ( e ); 142 QListBox::focusOutEvent ( e );
143 setVScrollBarMode(QScrollView::AlwaysOff); 143 setVScrollBarMode(QScrollView::AlwaysOff);
144 setHScrollBarMode(QScrollView::AlwaysOff); 144 setHScrollBarMode(QScrollView::AlwaysOff);
145 emit highligtIncidence( 0, (MonthViewCell*)this, 0 ); 145 emit highlightIncidence( 0, (MonthViewCell*)this, 0 );
146} 146}
147 147
148QString KNoScrollListBox::getWhatsThisText(QPoint p) 148QString KNoScrollListBox::getWhatsThisText(QPoint p)
149{ 149{
150 QListBoxItem* item = itemAt ( p ); 150 QListBoxItem* item = itemAt ( p );
151 if ( ! item ) { 151 if ( ! item ) {
152 return i18n("Click in the cell\nto add an event!"); 152 return i18n("Click in the cell\nto add an event!");
153 } 153 }
154 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 154 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
155 KOPrefs::instance()->mWTshowDetails, 155 KOPrefs::instance()->mWTshowDetails,
156 KOPrefs::instance()->mWTshowCreated, 156 KOPrefs::instance()->mWTshowCreated,
157 KOPrefs::instance()->mWTshowChanged); 157 KOPrefs::instance()->mWTshowChanged);
158} 158}
159void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 159void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
160{ 160{
161 //qDebug("KNoScrollListBox::keyPressEvent "); 161 //qDebug("KNoScrollListBox::keyPressEvent ");
162 switch(e->key()) { 162 switch(e->key()) {
163 case Key_Right: 163 case Key_Right:
164 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 164 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
165 { 165 {
166 e->ignore(); 166 e->ignore();
167 return; 167 return;
168 } 168 }
169 scrollBy(10,0); 169 scrollBy(10,0);
170 break; 170 break;
171 case Key_Left: 171 case Key_Left:
172 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 172 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
173 { 173 {
174 e->ignore(); 174 e->ignore();
175 return; 175 return;
176 } 176 }
177 scrollBy(-10,0); 177 scrollBy(-10,0);
178 break; 178 break;
179 case Key_Up: 179 case Key_Up:
180 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 180 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
181 e->ignore(); 181 e->ignore();
182 break; 182 break;
183 } 183 }
184 if ( count() ) { 184 if ( count() ) {
185 if ( currentItem() == 0 ) { 185 if ( currentItem() == 0 ) {
186 emit prevCell(); 186 emit prevCell();
187 } else { 187 } else {
188 setCurrentItem((currentItem()+count()-1)%count()); 188 setCurrentItem((currentItem()+count()-1)%count());
189 if(!itemVisible(currentItem())) { 189 if(!itemVisible(currentItem())) {
190 if((unsigned int) currentItem() == (count()-1)) { 190 if((unsigned int) currentItem() == (count()-1)) {
191 setTopItem(currentItem()-numItemsVisible()+1); 191 setTopItem(currentItem()-numItemsVisible()+1);
192 } else { 192 } else {
193 setTopItem(topItem()-1); 193 setTopItem(topItem()-1);
@@ -242,147 +242,147 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
242 242
243void KNoScrollListBox::oneDown() 243void KNoScrollListBox::oneDown()
244{ 244{
245 if ( count () ) { 245 if ( count () ) {
246 if ( currentItem()+1 == count () ) { 246 if ( currentItem()+1 == count () ) {
247 emit nextCell(); 247 emit nextCell();
248 } else { 248 } else {
249 resetOnFocusIn = false; 249 resetOnFocusIn = false;
250 setCurrentItem((currentItem()+1)%count()); 250 setCurrentItem((currentItem()+1)%count());
251 if(!itemVisible(currentItem())) { 251 if(!itemVisible(currentItem())) {
252 if(currentItem() == 0) { 252 if(currentItem() == 0) {
253 setTopItem(0); 253 setTopItem(0);
254 } else { 254 } else {
255 setTopItem(topItem()+1); 255 setTopItem(topItem()+1);
256 } 256 }
257 } 257 }
258 } 258 }
259 } 259 }
260} 260}
261void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 261void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
262{ 262{
263 switch(e->key()) { 263 switch(e->key()) {
264 case Key_Shift: 264 case Key_Shift:
265 emit shiftUp(); 265 emit shiftUp();
266 break; 266 break;
267 default: 267 default:
268 break; 268 break;
269 } 269 }
270} 270}
271 271
272void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 272void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
273{ 273{
274 QListBox::mousePressEvent(e); 274 QListBox::mousePressEvent(e);
275 275
276 if(e->button() == RightButton) { 276 if(e->button() == RightButton) {
277 emit rightClick(); 277 emit rightClick();
278 } 278 }
279} 279}
280 280
281MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) 281MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s)
282 : QListBoxItem() 282 : QListBoxItem()
283{ 283{
284 mblockRepaint = true; 284 mblockRepaint = true;
285 isWeekItem = KOPrefs::instance()->mMonthViewWeek; 285 isWeekItem = KOPrefs::instance()->mMonthViewWeek;
286 recycle( incidence, s ); 286 recycle( incidence, s );
287} 287}
288void MonthViewItem::recycle( Incidence *incidence, const QString & s) 288void MonthViewItem::recycle( Incidence *incidence, const QString & s)
289{ 289{
290 mDisplayHightlighted = false; 290 mDisplayHighlighted = false;
291 setText( s ); 291 setText( s );
292 mMultiday = 0; 292 mMultiday = 0;
293 mIncidence = incidence; 293 mIncidence = incidence;
294 mRecur = false; 294 mRecur = false;
295 mAlarm = false; 295 mAlarm = false;
296 mReply = false; 296 mReply = false;
297 mInfo = false; 297 mInfo = false;
298 mdayPos = 0; 298 mdayPos = 0;
299} 299}
300 300
301bool MonthViewItem::setHighlightedFalse() 301bool MonthViewItem::setHighlightedFalse()
302{ 302{
303 if ( !mDisplayHightlighted ) 303 if ( !mDisplayHighlighted )
304 return false; 304 return false;
305 mDisplayHightlighted = false; 305 mDisplayHighlighted = false;
306 return true; 306 return true;
307} 307}
308 308
309bool MonthViewItem::setHighlighted( Incidence * inc ) 309bool MonthViewItem::setHighlighted( Incidence * inc )
310{ 310{
311 if ( inc == mIncidence ) { 311 if ( inc == mIncidence ) {
312 if ( mDisplayHightlighted ) 312 if ( mDisplayHighlighted )
313 return false; 313 return false;
314 mDisplayHightlighted = true; 314 mDisplayHighlighted = true;
315 return true; 315 return true;
316 } else { 316 } else {
317 if ( !mDisplayHightlighted ) 317 if ( !mDisplayHighlighted )
318 return false; 318 return false;
319 mDisplayHightlighted = false; 319 mDisplayHighlighted = false;
320 return true; 320 return true;
321 } 321 }
322 return false; 322 return false;
323} 323}
324void MonthViewItem::paint(QPainter *p) 324void MonthViewItem::paint(QPainter *p)
325{ 325{
326 if ( mblockRepaint || !mIncidence ) { 326 if ( mblockRepaint || !mIncidence ) {
327 return; 327 return;
328 } 328 }
329#if QT_VERSION >= 0x030000 329#if QT_VERSION >= 0x030000
330 bool sel = isSelected(); 330 bool sel = isSelected();
331#else 331#else
332 bool sel = selected(); 332 bool sel = selected();
333#endif 333#endif
334 int heihei = height( listBox () ); 334 int heihei = height( listBox () );
335 int x = 1; 335 int x = 1;
336 if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted || sel ) 336 if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHighlighted || sel )
337 { 337 {
338 338
339 p->setBackgroundColor( palette().color( QPalette::Normal, \ 339 p->setBackgroundColor( palette().color( QPalette::Normal, \
340 sel ||mDisplayHightlighted ? QColorGroup::Highlight : QColorGroup::Background ) ); 340 sel ||mDisplayHighlighted ? QColorGroup::Highlight : QColorGroup::Background ) );
341 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); 341 p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei );
342 } 342 }
343 343
344 //int y = 3;//(height() - mRecurPixmap.height()) /2; 344 //int y = 3;//(height() - mRecurPixmap.height()) /2;
345 int size = PIXMAP_SIZE; 345 int size = PIXMAP_SIZE;
346 if ( QApplication::desktop()->width() < 300 ) 346 if ( QApplication::desktop()->width() < 300 )
347 size = 3; 347 size = 3;
348 int y = (heihei - size -1 ) /2; 348 int y = (heihei - size -1 ) /2;
349 349
350 if ( mIncidence->calID() > 1 ) { 350 if ( mIncidence->calID() > 1 ) {
351 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); 351 p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
352 p->drawRect ( x, y-2,size,size+4); 352 p->drawRect ( x, y-2,size,size+4);
353 x += size + 1; 353 x += size + 1;
354 } 354 }
355 if ( KOPrefs::instance()->mMonthShowIcons ) { 355 if ( KOPrefs::instance()->mMonthShowIcons ) {
356 if ( mInfo ) { 356 if ( mInfo ) {
357 p->fillRect ( x, y,size,size, Qt::darkGreen ); 357 p->fillRect ( x, y,size,size, Qt::darkGreen );
358 x += size + 1; 358 x += size + 1;
359 } 359 }
360 if ( mRecur ) { 360 if ( mRecur ) {
361 p->fillRect ( x, y,size,size, Qt::blue ); 361 p->fillRect ( x, y,size,size, Qt::blue );
362 x += size + 1; 362 x += size + 1;
363 } 363 }
364 if ( mAlarm ) { 364 if ( mAlarm ) {
365 p->fillRect ( x, y,size,size, Qt::red ); 365 p->fillRect ( x, y,size,size, Qt::red );
366 x += size + 1; 366 x += size + 1;
367 } 367 }
368 if ( mReply ) { 368 if ( mReply ) {
369 p->fillRect ( x, y,size,size, Qt::yellow ); 369 p->fillRect ( x, y,size,size, Qt::yellow );
370 x += size + 1; 370 x += size + 1;
371 } 371 }
372 } 372 }
373 if ( mMultiday ) { 373 if ( mMultiday ) {
374 int yyy = y+(size/2); 374 int yyy = y+(size/2);
375 int sizeM = size+2; 375 int sizeM = size+2;
376 p->setBrush( QBrush( p->pen().color() ) ); 376 p->setBrush( QBrush( p->pen().color() ) );
377 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 377 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
378 if ( mMultiday == 2 || mMultiday == 3 ) { 378 if ( mMultiday == 2 || mMultiday == 3 ) {
379 QPointArray pa ( 3 ); 379 QPointArray pa ( 3 );
380 pa.setPoint (0, x, yyy ); 380 pa.setPoint (0, x, yyy );
381 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 381 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
382 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 382 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
383 p->drawPolygon( pa ); 383 p->drawPolygon( pa );
384 } 384 }
385 if ( mMultiday == 2 || mMultiday == 1 ) { 385 if ( mMultiday == 2 || mMultiday == 1 ) {
386 QPointArray pa ( 3 ); 386 QPointArray pa ( 3 );
387 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 387 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
388 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 388 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
@@ -1055,115 +1055,115 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e )
1055void MonthViewCell::defaultAction( QListBoxItem *item ) 1055void MonthViewCell::defaultAction( QListBoxItem *item )
1056{ 1056{
1057 1057
1058 if ( !item ) { 1058 if ( !item ) {
1059 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1059 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1060 emit newEventSignal( dt ); 1060 emit newEventSignal( dt );
1061 return; 1061 return;
1062 } 1062 }
1063 1063
1064 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1064 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1065 Incidence *incidence = eventItem->incidence(); 1065 Incidence *incidence = eventItem->incidence();
1066 if ( incidence ) mMonthView->defaultAction( incidence ); 1066 if ( incidence ) mMonthView->defaultAction( incidence );
1067} 1067}
1068void MonthViewCell::showDay() 1068void MonthViewCell::showDay()
1069{ 1069{
1070 emit showDaySignal( date() ); 1070 emit showDaySignal( date() );
1071} 1071}
1072void MonthViewCell::newEvent() 1072void MonthViewCell::newEvent()
1073{ 1073{
1074 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1074 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1075 emit newEventSignal( dt ); 1075 emit newEventSignal( dt );
1076} 1076}
1077void MonthViewCell::cellClicked( QListBoxItem *item ) 1077void MonthViewCell::cellClicked( QListBoxItem *item )
1078{ 1078{
1079 mMonthView->setSelectedCell( this ); 1079 mMonthView->setSelectedCell( this );
1080 if ( item == 0 ) { 1080 if ( item == 0 ) {
1081 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1081 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1082 emit newEventSignal( dt ); 1082 emit newEventSignal( dt );
1083 return; 1083 return;
1084 } 1084 }
1085 1085
1086} 1086}
1087 1087
1088void MonthViewCell::contextMenu( QListBoxItem *item ) 1088void MonthViewCell::contextMenu( QListBoxItem *item )
1089{ 1089{
1090 mMonthView->setPopupCell( this ); 1090 mMonthView->setPopupCell( this );
1091 if ( !item ) { 1091 if ( !item ) {
1092 mMonthView->showContextMenu( 0 ); 1092 mMonthView->showContextMenu( 0 );
1093 return; 1093 return;
1094 } 1094 }
1095 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1095 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1096 Incidence *incidence = eventItem->incidence(); 1096 Incidence *incidence = eventItem->incidence();
1097 if ( incidence ) mMonthView->showContextMenu( incidence ); 1097 if ( incidence ) mMonthView->showContextMenu( incidence );
1098} 1098}
1099 1099
1100void MonthViewCell::selection( QListBoxItem *item ) 1100void MonthViewCell::selection( QListBoxItem *item )
1101{ 1101{
1102 if ( !item ) { 1102 if ( !item ) {
1103 emit highligtIncidence( 0 , this, 0 ); 1103 emit highlightIncidence( 0 , this, 0 );
1104 return; 1104 return;
1105 } 1105 }
1106 MonthViewItem * it = (static_cast<MonthViewItem *>( item )); 1106 MonthViewItem * it = (static_cast<MonthViewItem *>( item ));
1107 emit highligtIncidence( it->incidence(), this, it->multiDay() ); 1107 emit highlightIncidence( it->incidence(), this, it->multiDay() );
1108 mMonthView->setSelectedCell( this ); 1108 mMonthView->setSelectedCell( this );
1109} 1109}
1110 1110
1111void MonthViewCell::deHightLight() 1111void MonthViewCell::deHighLight()
1112{ 1112{
1113 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 1113 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
1114 while ( mitem ) { 1114 while ( mitem ) {
1115 if ( mitem->setHighlightedFalse() ) 1115 if ( mitem->setHighlightedFalse() )
1116 updateItem ( mitem ); 1116 updateItem ( mitem );
1117 mitem = (MonthViewItem *)mitem->next(); 1117 mitem = (MonthViewItem *)mitem->next();
1118 } 1118 }
1119} 1119}
1120// returns true if no inc found 1120// returns true if no inc found
1121bool MonthViewCell::doHightLight( Incidence * inc ) 1121bool MonthViewCell::doHighLight( Incidence * inc )
1122{ 1122{
1123 1123
1124 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 1124 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
1125 while ( mitem ) { 1125 while ( mitem ) {
1126 if ( mitem->incidence() == inc ) { 1126 if ( mitem->incidence() == inc ) {
1127 if ( mitem->setHighlighted( inc ) ) 1127 if ( mitem->setHighlighted( inc ) )
1128 updateItem ( mitem ); 1128 updateItem ( mitem );
1129 return false; 1129 return false;
1130 } 1130 }
1131 mitem = (MonthViewItem *)mitem->next(); 1131 mitem = (MonthViewItem *)mitem->next();
1132 } 1132 }
1133 return true; 1133 return true;
1134} 1134}
1135// ******************************************************************************* 1135// *******************************************************************************
1136// ******************************************************************************* 1136// *******************************************************************************
1137// ******************************************************************************* 1137// *******************************************************************************
1138 1138
1139 1139
1140KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 1140KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1141 : KOEventView( calendar, parent, name ), 1141 : KOEventView( calendar, parent, name ),
1142 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1142 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1143 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1143 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1144{ 1144{
1145 mFlagKeyPressed = false; 1145 mFlagKeyPressed = false;
1146 mShortDayLabelsM = false; 1146 mShortDayLabelsM = false;
1147 mShortDayLabelsW = false; 1147 mShortDayLabelsW = false;
1148 skipResize = false; 1148 skipResize = false;
1149 clPending = true; 1149 clPending = true;
1150 mPopupCell = 0; 1150 mPopupCell = 0;
1151 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1151 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1152 mWidStack = new QWidgetStack( this ); 1152 mWidStack = new QWidgetStack( this );
1153 QVBoxLayout* hb = new QVBoxLayout( this ); 1153 QVBoxLayout* hb = new QVBoxLayout( this );
1154 mMonthView = new QWidget( mWidStack ); 1154 mMonthView = new QWidget( mWidStack );
1155 mWeekView = new QWidget( mWidStack ); 1155 mWeekView = new QWidget( mWidStack );
1156#if QT_VERSION >= 0x030000 1156#if QT_VERSION >= 0x030000
1157 mWidStack->addWidget(mMonthView ); 1157 mWidStack->addWidget(mMonthView );
1158 mWidStack->addWidget(mWeekView ); 1158 mWidStack->addWidget(mWeekView );
1159#else 1159#else
1160 mWidStack->addWidget( mMonthView, 1 ); 1160 mWidStack->addWidget( mMonthView, 1 );
1161 mWidStack->addWidget( mWeekView , 1 ); 1161 mWidStack->addWidget( mWeekView , 1 );
1162#endif 1162#endif
1163 hb->addWidget( mNavigatorBar ); 1163 hb->addWidget( mNavigatorBar );
1164 hb->addWidget( mWidStack ); 1164 hb->addWidget( mWidStack );
1165 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1165 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1166 updatePossible = false; 1166 updatePossible = false;
1167 //updatePossible = true; 1167 //updatePossible = true;
1168 mCells.setAutoDelete( true ); 1168 mCells.setAutoDelete( true );
1169 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1169 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
@@ -1198,235 +1198,235 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1198 KOWeekButton *label = new KOWeekButton( mMonthView ); 1198 KOWeekButton *label = new KOWeekButton( mMonthView );
1199 label->setFocusPolicy(NoFocus); 1199 label->setFocusPolicy(NoFocus);
1200 label->setFont(bfont); 1200 label->setFont(bfont);
1201 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1201 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1202 label->setFlat(true); 1202 label->setFlat(true);
1203 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1203 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1204 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1204 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1205 //label->setLineWidth(1); 1205 //label->setLineWidth(1);
1206 //label->setAlignment(AlignCenter); 1206 //label->setAlignment(AlignCenter);
1207 mWeekLabels.insert( i, label ); 1207 mWeekLabels.insert( i, label );
1208 } 1208 }
1209 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1209 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1210 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus); 1210 mWeekLabels[mNumWeeks]->setFocusPolicy(WheelFocus);
1211 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1211 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1212 1212
1213 for( i = 0; i < 1+1; i++ ) { 1213 for( i = 0; i < 1+1; i++ ) {
1214 KOWeekButton *label = new KOWeekButton( mWeekView ); 1214 KOWeekButton *label = new KOWeekButton( mWeekView );
1215 label->setFocusPolicy(NoFocus); 1215 label->setFocusPolicy(NoFocus);
1216 label->setFont(bfont); 1216 label->setFont(bfont);
1217 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1217 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1218 label->setFlat(true); 1218 label->setFlat(true);
1219 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1219 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1220 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1220 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1221 //label->setLineWidth(1); 1221 //label->setLineWidth(1);
1222 //label->setAlignment(AlignCenter); 1222 //label->setAlignment(AlignCenter);
1223 mWeekLabelsW.insert( i, label ); 1223 mWeekLabelsW.insert( i, label );
1224 } 1224 }
1225 mWeekLabelsW[1]->setText( i18n("W")); 1225 mWeekLabelsW[1]->setText( i18n("W"));
1226 mWeekLabelsW[1]->setFocusPolicy(WheelFocus); 1226 mWeekLabelsW[1]->setFocusPolicy(WheelFocus);
1227 1227
1228 1228
1229 int row, col; 1229 int row, col;
1230 mCells.resize( mNumCells ); 1230 mCells.resize( mNumCells );
1231 for( row = 0; row < mNumWeeks; ++row ) { 1231 for( row = 0; row < mNumWeeks; ++row ) {
1232 for( col = 0; col < mDaysPerWeek; ++col ) { 1232 for( col = 0; col < mDaysPerWeek; ++col ) {
1233 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1233 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1234 mCells.insert( row * mDaysPerWeek + col, cell ); 1234 mCells.insert( row * mDaysPerWeek + col, cell );
1235 1235
1236 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1236 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1237 SLOT( defaultAction( Incidence * ) ) ); 1237 SLOT( defaultAction( Incidence * ) ) );
1238 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1238 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1239 SIGNAL( newEventSignal( QDateTime ) ) ); 1239 SIGNAL( newEventSignal( QDateTime ) ) );
1240 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1240 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1241 SIGNAL( showDaySignal( QDate ) ) ); 1241 SIGNAL( showDaySignal( QDate ) ) );
1242 connect( cell, SIGNAL( nextCell() ), 1242 connect( cell, SIGNAL( nextCell() ),
1243 SLOT( nextCell() ) ); 1243 SLOT( nextCell() ) );
1244 connect( cell, SIGNAL( prevCell() ), 1244 connect( cell, SIGNAL( prevCell() ),
1245 SLOT( prevCell() ) ); 1245 SLOT( prevCell() ) );
1246 connect( cell, SIGNAL( highligtIncidence( Incidence * , MonthViewCell *, int ) ), 1246 connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ),
1247 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); 1247 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) ));
1248 } 1248 }
1249 } 1249 }
1250 mCellsW.resize( mDaysPerWeek ); 1250 mCellsW.resize( mDaysPerWeek );
1251 for( col = 0; col < mDaysPerWeek; ++col ) { 1251 for( col = 0; col < mDaysPerWeek; ++col ) {
1252 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1252 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1253 mCellsW.insert( col, cell ); 1253 mCellsW.insert( col, cell );
1254 1254
1255 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1255 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1256 SLOT( defaultAction( Incidence * ) ) ); 1256 SLOT( defaultAction( Incidence * ) ) );
1257 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1257 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1258 SIGNAL( newEventSignal( QDateTime ) ) ); 1258 SIGNAL( newEventSignal( QDateTime ) ) );
1259 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1259 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1260 SIGNAL( showDaySignal( QDate ) ) ); 1260 SIGNAL( showDaySignal( QDate ) ) );
1261 connect( cell, SIGNAL( nextCell() ), 1261 connect( cell, SIGNAL( nextCell() ),
1262 SLOT( nextCell() ) ); 1262 SLOT( nextCell() ) );
1263 connect( cell, SIGNAL( prevCell() ), 1263 connect( cell, SIGNAL( prevCell() ),
1264 SLOT( prevCell() ) ); 1264 SLOT( prevCell() ) );
1265 connect( cell, SIGNAL( highligtIncidence( Incidence * , MonthViewCell *, int ) ), 1265 connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ),
1266 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); 1266 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) ));
1267 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1267 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1268 } 1268 }
1269 1269
1270 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1270 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1271 mContextMenu = eventPopup(); 1271 mContextMenu = eventPopup();
1272 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1272 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1273 i18n("New Event..."),this, 1273 i18n("New Event..."),this,
1274 SLOT(slotNewEvent()),false); 1274 SLOT(slotNewEvent()),false);
1275 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1275 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1276 i18n("New Todo..."),this, 1276 i18n("New Todo..."),this,
1277 SLOT(slotNewTodo()),false); 1277 SLOT(slotNewTodo()),false);
1278 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1278 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1279 i18n("Journal"),this, 1279 i18n("Journal"),this,
1280 SLOT(slotEditJournal()),false); 1280 SLOT(slotEditJournal()),false);
1281 1281
1282 1282
1283 1283
1284 QString pathString = ""; 1284 QString pathString = "";
1285 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 1285 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1286 if ( QApplication::desktop()->width() < 480 ) 1286 if ( QApplication::desktop()->width() < 480 )
1287 pathString += "icons16/"; 1287 pathString += "icons16/";
1288 } else 1288 } else
1289 pathString += "iconsmini/"; 1289 pathString += "iconsmini/";
1290 mNewItemMenu = new QPopupMenu( this ); 1290 mNewItemMenu = new QPopupMenu( this );
1291 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); 1291 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1292 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); 1292 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1293 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); 1293 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1294 1294
1295 // updateConfig(); //useless here... 1295 // updateConfig(); //useless here...
1296 // ... but we need mWidthLongDayLabel computed 1296 // ... but we need mWidthLongDayLabel computed
1297 QFontMetrics fontmetric(mDayLabels[0]->font()); 1297 QFontMetrics fontmetric(mDayLabels[0]->font());
1298 mWidthLongDayLabel = 0; 1298 mWidthLongDayLabel = 0;
1299 for (int i = 0; i < 7; i++) { 1299 for (int i = 0; i < 7; i++) {
1300 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1300 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1301 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1301 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1302 } 1302 }
1303 1303
1304 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1304 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1305 1305
1306#if 0 1306#if 0
1307 if ( mShowWeekView ) 1307 if ( mShowWeekView )
1308 mWidStack->raiseWidget( mWeekView ); 1308 mWidStack->raiseWidget( mWeekView );
1309 else 1309 else
1310 mWidStack->raiseWidget( mMonthView ); 1310 mWidStack->raiseWidget( mMonthView );
1311#endif 1311#endif
1312 1312
1313 emit incidenceSelected( 0 ); 1313 emit incidenceSelected( 0 );
1314 1314
1315 mComputeLayoutTimer = new QTimer( this ); 1315 mComputeLayoutTimer = new QTimer( this );
1316 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); 1316 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1317 1317
1318 1318
1319#ifndef DESKTOP_VERSION 1319#ifndef DESKTOP_VERSION
1320 resize( QApplication::desktop()->size() ); 1320 resize( QApplication::desktop()->size() );
1321#else 1321#else
1322 resize(640, 480 ); 1322 resize(640, 480 );
1323 updatePossible = true; 1323 updatePossible = true;
1324#endif 1324#endif
1325 computeLayout(); 1325 computeLayout();
1326 1326
1327 if ( mShowWeekView ) 1327 if ( mShowWeekView )
1328 mWidStack->raiseWidget( mWeekView ); 1328 mWidStack->raiseWidget( mWeekView );
1329 else 1329 else
1330 mWidStack->raiseWidget( mMonthView ); 1330 mWidStack->raiseWidget( mMonthView );
1331} 1331}
1332 1332
1333KOMonthView::~KOMonthView() 1333KOMonthView::~KOMonthView()
1334{ 1334{
1335 delete mContextMenu; 1335 delete mContextMenu;
1336} 1336}
1337 1337
1338void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) 1338void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday )
1339{ 1339{
1340 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); 1340 qDebug("11 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday );
1341 static Incidence * lastInc = 0; 1341 static Incidence * lastInc = 0;
1342 static MonthViewCell * lastCell = 0; 1342 static MonthViewCell * lastCell = 0;
1343 1343
1344 if ( lastInc == inc && lastCell == mc ) 1344 if ( lastInc == inc && lastCell == mc )
1345 return; 1345 return;
1346 lastInc = inc; 1346 lastInc = inc;
1347 lastCell = mc; 1347 lastCell = mc;
1348 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); 1348 qDebug("222 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday );
1349 1349
1350 bool weekview = false; 1350 bool weekview = false;
1351 int index = 0; 1351 int index = 0;
1352 for (uint i = 0; i < mCellsW.count(); ++i) { 1352 for (uint i = 0; i < mCellsW.count(); ++i) {
1353 if ( mCellsW[i] == mc ) { 1353 if ( mCellsW[i] == mc ) {
1354 weekview = true; 1354 weekview = true;
1355 index = i; 1355 index = i;
1356 break; 1356 break;
1357 } 1357 }
1358 } 1358 }
1359 QPtrVector<MonthViewCell> *cells; 1359 QPtrVector<MonthViewCell> *cells;
1360 if ( weekview ) 1360 if ( weekview )
1361 cells = &mCellsW; 1361 cells = &mCellsW;
1362 else { 1362 else {
1363 for (uint i = 0; i < mCells.count(); ++i) { 1363 for (uint i = 0; i < mCells.count(); ++i) {
1364 if ( mCells[i] == mc ) { 1364 if ( mCells[i] == mc ) {
1365 index = i; 1365 index = i;
1366 break; 1366 break;
1367 } 1367 }
1368 } 1368 }
1369 cells = &mCells; 1369 cells = &mCells;
1370 } 1370 }
1371 for (uint i = 0; i < (*cells).count(); ++i) { 1371 for (uint i = 0; i < (*cells).count(); ++i) {
1372 (*cells)[i]->deHightLight(); 1372 (*cells)[i]->deHighLight();
1373 } 1373 }
1374 if ( ! inc ) 1374 if ( ! inc )
1375 return; 1375 return;
1376 if ( mday > 1 && index > 0 ) 1376 if ( mday > 1 && index > 0 )
1377 for (int i = index-1; i >= 0; --i) { 1377 for (int i = index-1; i >= 0; --i) {
1378 //qDebug("index %d iii %d ", index, i); 1378 //qDebug("index %d iii %d ", index, i);
1379 if ( (*cells)[(uint)i]->doHightLight(inc) ) 1379 if ( (*cells)[(uint)i]->doHighLight(inc) )
1380 break; 1380 break;
1381 } 1381 }
1382 if ( mday < 3 && mday > 0 && index < (*cells).count()-1) 1382 if ( mday < 3 && mday > 0 && index < (*cells).count()-1)
1383 for (uint i = index+1; i < (*cells).count(); ++i) { 1383 for (uint i = index+1; i < (*cells).count(); ++i) {
1384 if ( (*cells)[i]->doHightLight(inc) ) 1384 if ( (*cells)[i]->doHighLight(inc) )
1385 break; 1385 break;
1386 } 1386 }
1387 1387
1388} 1388}
1389void KOMonthView::selectInternalWeekNum ( int n ) 1389void KOMonthView::selectInternalWeekNum ( int n )
1390{ 1390{
1391 switchView(); 1391 switchView();
1392 if ( !KOPrefs::instance()->mMonthViewWeek ) 1392 if ( !KOPrefs::instance()->mMonthViewWeek )
1393 emit selectMonth (); 1393 emit selectMonth ();
1394 else 1394 else
1395 emit selectWeekNum ( n ); 1395 emit selectWeekNum ( n );
1396} 1396}
1397 1397
1398int KOMonthView::currentWeek() 1398int KOMonthView::currentWeek()
1399{ 1399{
1400 if ( mShowWeekView ) 1400 if ( mShowWeekView )
1401 return mWeekLabelsW[0]->getWeekNum(); 1401 return mWeekLabelsW[0]->getWeekNum();
1402 return mWeekLabels[0]->getWeekNum(); 1402 return mWeekLabels[0]->getWeekNum();
1403} 1403}
1404void KOMonthView::switchView() 1404void KOMonthView::switchView()
1405{ 1405{
1406 if ( selectedCell( ) ) 1406 if ( selectedCell( ) )
1407 selectedCell()->deselect(); 1407 selectedCell()->deselect();
1408 mShowWeekView = !mShowWeekView; 1408 mShowWeekView = !mShowWeekView;
1409 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 1409 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
1410 if ( clPending ) { 1410 if ( clPending ) {
1411 computeLayout(); 1411 computeLayout();
1412 updateConfig(); 1412 updateConfig();
1413 } 1413 }
1414 if ( mShowWeekView ) 1414 if ( mShowWeekView )
1415 mWidStack->raiseWidget( mWeekView ); 1415 mWidStack->raiseWidget( mWeekView );
1416 else 1416 else
1417 mWidStack->raiseWidget( mMonthView ); 1417 mWidStack->raiseWidget( mMonthView );
1418 clPending = false; 1418 clPending = false;
1419} 1419}
1420 1420
1421int KOMonthView::maxDatesHint() 1421int KOMonthView::maxDatesHint()
1422{ 1422{
1423 return mNumCells; 1423 return mNumCells;
1424} 1424}
1425 1425
1426int KOMonthView::currentDateCount() 1426int KOMonthView::currentDateCount()
1427{ 1427{
1428 return mNumCells; 1428 return mNumCells;
1429} 1429}
1430 1430
1431QPtrList<Incidence> KOMonthView::selectedIncidences() 1431QPtrList<Incidence> KOMonthView::selectedIncidences()
1432{ 1432{
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 2622d10..0f3aa54 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -41,190 +41,190 @@
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43class QToolTipGroup; 43class QToolTipGroup;
44#endif 44#endif
45 45
46class KNOWhatsThis; 46class KNOWhatsThis;
47class MonthViewCell; 47class MonthViewCell;
48class KOWeekButton : public QPushButton 48class 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 );
63private: 63private:
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
71private slots : 71private slots :
72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 72 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
73}; 73};
74 74
75class KNoScrollListBox: public QListBox 75class 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 highligtIncidence( Incidence * , MonthViewCell*, int ); 89 void highlightIncidence( Incidence * , MonthViewCell*, int );
90 90
91 protected slots: 91 protected slots:
92 void oneDown(); 92 void oneDown();
93 void keyPressEvent(QKeyEvent *); 93 void keyPressEvent(QKeyEvent *);
94 void keyReleaseEvent(QKeyEvent *); 94 void keyReleaseEvent(QKeyEvent *);
95 void mousePressEvent(QMouseEvent *); 95 void mousePressEvent(QMouseEvent *);
96 void focusInEvent ( QFocusEvent * ); 96 void focusInEvent ( QFocusEvent * );
97 void focusOutEvent ( QFocusEvent * ); 97 void focusOutEvent ( QFocusEvent * );
98 98
99 private: 99 private:
100 bool resetOnFocusIn; 100 bool resetOnFocusIn;
101 KNOWhatsThis * mWT; 101 KNOWhatsThis * mWT;
102}; 102};
103 103
104 104
105class MonthViewItem: public QListBoxItem 105class MonthViewItem: public QListBoxItem
106{ 106{
107 public: 107 public:
108 MonthViewItem( Incidence *,const QString & title ); 108 MonthViewItem( Incidence *,const QString & title );
109 void recycle( Incidence *incidence, const QString & s); 109 void recycle( Incidence *incidence, const QString & s);
110 void setRecur(bool on) { mRecur = on; } 110 void setRecur(bool on) { mRecur = on; }
111 void setAlarm(bool on) { mAlarm = on; } 111 void setAlarm(bool on) { mAlarm = on; }
112 void setReply(bool on) { mReply = on; } 112 void setReply(bool on) { mReply = on; }
113 void setMoreInfo(bool on) { mInfo = on; } 113 void setMoreInfo(bool on) { mInfo = on; }
114 void setMultiDay(int type) { mMultiday = type; } 114 void setMultiDay(int type) { mMultiday = type; }
115 int multiDay() { return mMultiday; } 115 int multiDay() { return mMultiday; }
116 void setMultiDayPos(int type) { mdayPos = type; } 116 void setMultiDayPos(int type) { mdayPos = type; }
117 int gettMultiDayPos() { return mdayPos; } 117 int gettMultiDayPos() { return mdayPos; }
118 void setBlockRepaint(bool on) { mblockRepaint = on; } 118 void setBlockRepaint(bool on) { mblockRepaint = on; }
119 bool setHighlighted( Incidence * ); 119 bool setHighlighted( Incidence * );
120 120
121 void setPalette(const QPalette &p) { mPalette = p; } 121 void setPalette(const QPalette &p) { mPalette = p; }
122 QPalette palette() const { return mPalette; } 122 QPalette palette() const { return mPalette; }
123 bool setHighlightedFalse(); 123 bool setHighlightedFalse();
124 Incidence *incidence() const { return mIncidence; } 124 Incidence *incidence() const { return mIncidence; }
125 125
126 protected: 126 protected:
127 virtual void paint(QPainter *); 127 virtual void paint(QPainter *);
128 virtual int height(const QListBox *) const; 128 virtual int height(const QListBox *) const;
129 virtual int width(const QListBox *) const; 129 virtual int width(const QListBox *) const;
130 130
131 private: 131 private:
132 int mdayPos; 132 int mdayPos;
133 bool isWeekItem; 133 bool isWeekItem;
134 bool mblockRepaint; 134 bool mblockRepaint;
135 int mMultiday; 135 int mMultiday;
136 bool mRecur; 136 bool mRecur;
137 bool mAlarm; 137 bool mAlarm;
138 bool mReply; 138 bool mReply;
139 bool mInfo; 139 bool mInfo;
140 bool mDisplayHightlighted; 140 bool mDisplayHighlighted;
141 141
142 QPalette mPalette; 142 QPalette mPalette;
143 QDate mDate; 143 QDate mDate;
144 144
145 Incidence *mIncidence; 145 Incidence *mIncidence;
146}; 146};
147 147
148 148
149class KOMonthView; 149class KOMonthView;
150 150
151class MonthViewCell : public KNoScrollListBox 151class MonthViewCell : public KNoScrollListBox
152{ 152{
153 Q_OBJECT 153 Q_OBJECT
154 public: 154 public:
155 MonthViewCell(KOMonthView *,QWidget* ); 155 MonthViewCell(KOMonthView *,QWidget* );
156 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} 156 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
157 157
158 void setDate( const QDate & ); 158 void setDate( const QDate & );
159 QDate date() const; 159 QDate date() const;
160 160
161 void setPrimary( bool ); 161 void setPrimary( bool );
162 bool isPrimary() const; 162 bool isPrimary() const;
163 163
164 void setHoliday( bool ); 164 void setHoliday( bool );
165 void setHoliday( const QString & ); 165 void setHoliday( const QString & );
166 166
167 void updateCell(); 167 void updateCell();
168 void startUpdateCell(); 168 void startUpdateCell();
169 void finishUpdateCell(); 169 void finishUpdateCell();
170 void repaintfinishUpdateCell(); 170 void repaintfinishUpdateCell();
171 int insertEvent(Event *); 171 int insertEvent(Event *);
172 void insertTodo(Todo *); 172 void insertTodo(Todo *);
173 173
174 void updateConfig( bool bigFont = false ); 174 void updateConfig( bool bigFont = false );
175 175
176 void enableScrollBars( bool ); 176 void enableScrollBars( bool );
177 177
178 Incidence *selectedIncidence(); 178 Incidence *selectedIncidence();
179 QDate selectedIncidenceDate(); 179 QDate selectedIncidenceDate();
180 QPushButton * dateLabel() { return mLabel; } 180 QPushButton * dateLabel() { return mLabel; }
181 void deHightLight(); 181 void deHighLight();
182 bool doHightLight( Incidence *); 182 bool doHighLight( Incidence *);
183 void deselect(); 183 void deselect();
184 void select(); 184 void select();
185#ifdef DESKTOP_VERSION 185#ifdef DESKTOP_VERSION
186 static QToolTipGroup *toolTipGroup(); 186 static QToolTipGroup *toolTipGroup();
187#endif 187#endif
188 signals: 188 signals:
189 void defaultAction( Incidence * ); 189 void defaultAction( Incidence * );
190 void newEventSignal( QDateTime ); 190 void newEventSignal( QDateTime );
191 void showDaySignal( QDate ); 191 void showDaySignal( QDate );
192 192
193 protected: 193 protected:
194 QStringList mToolTip; 194 QStringList mToolTip;
195 void resizeEvent( QResizeEvent * ); 195 void resizeEvent( QResizeEvent * );
196 196
197public slots: 197public slots:
198 void showDay(); 198 void showDay();
199 protected slots: 199 protected slots:
200 void defaultAction( QListBoxItem * ); 200 void defaultAction( QListBoxItem * );
201 void contextMenu( QListBoxItem * ); 201 void contextMenu( QListBoxItem * );
202 void selection( QListBoxItem * ); 202 void selection( QListBoxItem * );
203 void cellClicked( QListBoxItem * ); 203 void cellClicked( QListBoxItem * );
204 void newEvent(); 204 void newEvent();
205 205
206 private: 206 private:
207 int mdayCount; 207 int mdayCount;
208 QPtrList <MonthViewItem> mAvailItemList; 208 QPtrList <MonthViewItem> mAvailItemList;
209 KOMonthView *mMonthView; 209 KOMonthView *mMonthView;
210 int currentPalette; 210 int currentPalette;
211 211
212 QDate mDate; 212 QDate mDate;
213 bool mPrimary; 213 bool mPrimary;
214 bool mHoliday; 214 bool mHoliday;
215 QString mHolidayString; 215 QString mHolidayString;
216 216
217 //QLabel *mLabel; 217 //QLabel *mLabel;
218 QPushButton *mLabel; 218 QPushButton *mLabel;
219 //QListBox *mItemList; 219 //QListBox *mItemList;
220#ifdef DESKTOP_VERSION 220#ifdef DESKTOP_VERSION
221 static QToolTipGroup *mToolTipGroup; 221 static QToolTipGroup *mToolTipGroup;
222#endif 222#endif
223 QSize mLabelSize; 223 QSize mLabelSize;
224 QSize mLabelBigSize; 224 QSize mLabelBigSize;
225 QPalette mHolidayPalette; 225 QPalette mHolidayPalette;
226 QPalette mStandardPalette; 226 QPalette mStandardPalette;
227 QPalette mPrimaryPalette; 227 QPalette mPrimaryPalette;
228 QPalette mNonPrimaryPalette; 228 QPalette mNonPrimaryPalette;
229 void setMyPalette(); 229 void setMyPalette();
230 QPalette getPalette (); 230 QPalette getPalette ();