summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index ddac6e4..3aaa50a 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -179,161 +179,162 @@ void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
179 break; 179 break;
180 default: 180 default:
181 break; 181 break;
182 } 182 }
183} 183}
184 184
185void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 185void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
186{ 186{
187 QListBox::mousePressEvent(e); 187 QListBox::mousePressEvent(e);
188 188
189 if(e->button() == RightButton) { 189 if(e->button() == RightButton) {
190 emit rightClick(); 190 emit rightClick();
191 } 191 }
192} 192}
193 193
194MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 194MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
195 : QListBoxItem() 195 : QListBoxItem()
196{ 196{
197 setText( s ); 197 setText( s );
198 198
199 mIncidence = incidence; 199 mIncidence = incidence;
200 mDate = qd; 200 mDate = qd;
201 mRecur = false; 201 mRecur = false;
202 mAlarm = false; 202 mAlarm = false;
203 mReply = false; 203 mReply = false;
204 mInfo = false; 204 mInfo = false;
205} 205}
206 206
207void MonthViewItem::paint(QPainter *p) 207void MonthViewItem::paint(QPainter *p)
208{ 208{
209#if QT_VERSION >= 0x030000 209#if QT_VERSION >= 0x030000
210 bool sel = isSelected(); 210 bool sel = isSelected();
211#else 211#else
212 bool sel = selected(); 212 bool sel = selected();
213#endif 213#endif
214 214
215 215
216 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 216 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
217 { 217 {
218 p->setBackgroundColor( palette().color( QPalette::Normal, \ 218 p->setBackgroundColor( palette().color( QPalette::Normal, \
219 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 219 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
220 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 220 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
221 } 221 }
222 int x = 1; 222 int x = 1;
223 //int y = 3;//(height() - mRecurPixmap.height()) /2; 223 //int y = 3;//(height() - mRecurPixmap.height()) /2;
224 int size = PIXMAP_SIZE; 224 int size = PIXMAP_SIZE;
225 if ( QApplication::desktop()->width() < 300 ) 225 if ( QApplication::desktop()->width() < 300 )
226 size = 3; 226 size = 3;
227 int y = (height( listBox () ) - size -1 ) /2; 227 int heihei = height( listBox () );
228 int y = (heihei - size -1 ) /2;
228 229
229 if ( KOPrefs::instance()->mMonthShowIcons ) { 230 if ( KOPrefs::instance()->mMonthShowIcons ) {
230 if ( mInfo ) { 231 if ( mInfo ) {
231 p->fillRect ( x, y,size,size, Qt::darkGreen ); 232 p->fillRect ( x, y,size,size, Qt::darkGreen );
232 x += size + 1; 233 x += size + 1;
233 } 234 }
234 if ( mRecur ) { 235 if ( mRecur ) {
235 p->fillRect ( x, y,size,size, Qt::blue ); 236 p->fillRect ( x, y,size,size, Qt::blue );
236 x += size + 1; 237 x += size + 1;
237 } 238 }
238 if ( mAlarm ) { 239 if ( mAlarm ) {
239 p->fillRect ( x, y,size,size, Qt::red ); 240 p->fillRect ( x, y,size,size, Qt::red );
240 x += size + 1; 241 x += size + 1;
241 } 242 }
242 if ( mReply ) { 243 if ( mReply ) {
243 p->fillRect ( x, y,size,size, Qt::yellow ); 244 p->fillRect ( x, y,size,size, Qt::yellow );
244 x += size + 1; 245 x += size + 1;
245 } 246 }
246 } 247 }
247 if ( mMultiday ) { 248 if ( mMultiday ) {
248 int yyy = y+(size/2); 249 int yyy = y+(size/2);
249 int sizeM = size+2; 250 int sizeM = size+2;
250 p->setBrush( QBrush::SolidPattern ); 251 p->setBrush( QBrush::SolidPattern );
251 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 252 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
252 if ( mMultiday == 2 || mMultiday == 3 ) { 253 if ( mMultiday == 2 || mMultiday == 3 ) {
253 QPointArray pa ( 3 ); 254 QPointArray pa ( 3 );
254 pa.setPoint (0, x, yyy ); 255 pa.setPoint (0, x, yyy );
255 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 256 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
256 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 257 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
257 p->drawPolygon( pa ); 258 p->drawPolygon( pa );
258 } 259 }
259 if ( mMultiday == 2 || mMultiday == 1 ) { 260 if ( mMultiday == 2 || mMultiday == 1 ) {
260 QPointArray pa ( 3 ); 261 QPointArray pa ( 3 );
261 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 262 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
262 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 263 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
263 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 264 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
264 p->drawPolygon( pa ); 265 p->drawPolygon( pa );
265 } 266 }
266 if ( mMultiday == 1 ) { 267 if ( mMultiday == 1 ) {
267 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 268 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
268 269
269 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 270 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
270 } 271 }
271 if ( mMultiday == 3 ) { 272 if ( mMultiday == 3 ) {
272 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 273 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
273 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 274 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
274 275
275 } 276 }
276 x += sizeM/2 + 1; 277 x += sizeM/2 + 1;
277 x += sizeM + 1; 278 x += sizeM + 1;
278 } 279 }
279 QFontMetrics fm = p->fontMetrics(); 280 QFontMetrics fm = p->fontMetrics();
280 int yPos; 281 int yPos;
281 int pmheight = size; 282 int pmheight = size;
282 if( pmheight < fm.height() ) 283 if( pmheight < fm.height() )
283 yPos = fm.ascent() + fm.leading()/2; 284 yPos = fm.ascent() + fm.leading()/2;
284 else 285 else
285 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 286 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
286 p->setPen( palette().color( QPalette::Normal, sel ? \ 287 p->setPen( palette().color( QPalette::Normal, sel ? \
287 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 288 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
288 p->drawText( x, yPos, text() ); 289 p->drawText( x, yPos, text() );
289 if ( mIncidence->cancelled() ) { 290 if ( mIncidence->cancelled() ) {
290 int wid = fm.width( text() ); 291 int wid = fm.width( text() );
291 p->drawLine( x, yPos- fm.height()/2+3,x+wid, yPos- fm.height()/2 +3); 292 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
292 } 293 }
293 294
294} 295}
295 296
296int MonthViewItem::height(const QListBox *lb) const 297int MonthViewItem::height(const QListBox *lb) const
297{ 298{
298 if ( lb ) 299 if ( lb )
299 return lb->fontMetrics().lineSpacing()+1; 300 return lb->fontMetrics().lineSpacing()+1;
300 return 10; 301 return 10;
301} 302}
302 303
303int MonthViewItem::width(const QListBox *lb) const 304int MonthViewItem::width(const QListBox *lb) const
304{ 305{
305 int size = PIXMAP_SIZE; 306 int size = PIXMAP_SIZE;
306 if ( QApplication::desktop()->width() < 300 ) 307 if ( QApplication::desktop()->width() < 300 )
307 size = 3; 308 size = 3;
308 int x = 1; 309 int x = 1;
309 if ( KOPrefs::instance()->mMonthShowIcons ) { 310 if ( KOPrefs::instance()->mMonthShowIcons ) {
310 if ( mInfo ) { 311 if ( mInfo ) {
311 x += size + 1; 312 x += size + 1;
312 } 313 }
313 if( mRecur ) { 314 if( mRecur ) {
314 x += size+1; 315 x += size+1;
315 } 316 }
316 if( mAlarm ) { 317 if( mAlarm ) {
317 x += size+1; 318 x += size+1;
318 } 319 }
319 if( mReply ) { 320 if( mReply ) {
320 x += size+1; 321 x += size+1;
321 } 322 }
322 } 323 }
323 if( mMultiday ) { 324 if( mMultiday ) {
324 x += size+1+2+size/2; 325 x += size+1+2+size/2;
325 } 326 }
326 327
327 return( x + lb->fontMetrics().width( text() ) + 1 ); 328 return( x + lb->fontMetrics().width( text() ) + 1 );
328} 329}
329 330
330 331
331MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 332MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
332 : QWidget( par ), 333 : QWidget( par ),
333 mMonthView( parent ) 334 mMonthView( parent )
334{ 335{
335 336
336 QVBoxLayout *topLayout = new QVBoxLayout( this ); 337 QVBoxLayout *topLayout = new QVBoxLayout( this );
337 338
338 // mLabel = new QLabel( this );QPushButton 339 // mLabel = new QLabel( this );QPushButton
339 mLabel = new QPushButton( this ); 340 mLabel = new QPushButton( this );