summaryrefslogtreecommitdiffabout
path: root/microkde/kdatetbl.cpp
authorzautrix <zautrix>2005-02-08 23:15:22 (UTC)
committer zautrix <zautrix>2005-02-08 23:15:22 (UTC)
commitd0ab37d35ca9a9d919c9fc4856f3314bfef6dd5a (patch) (unidiff)
tree751d52e216392132e8ad36ba9e8a23ae64083951 /microkde/kdatetbl.cpp
parent2124ce7f8c6edbd0e3ec32b1d1e6a625ef9450d6 (diff)
downloadkdepimpi-d0ab37d35ca9a9d919c9fc4856f3314bfef6dd5a.zip
kdepimpi-d0ab37d35ca9a9d919c9fc4856f3314bfef6dd5a.tar.gz
kdepimpi-d0ab37d35ca9a9d919c9fc4856f3314bfef6dd5a.tar.bz2
fff
Diffstat (limited to 'microkde/kdatetbl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdatetbl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index 1024796..d182279 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -397,129 +397,129 @@ KDateTable::setDate(const QDate& date_)
397 firstday=temp.dayOfWeek(); 397 firstday=temp.dayOfWeek();
398 if(firstday==1) firstday=8; 398 if(firstday==1) firstday=8;
399 numdays=date.daysInMonth(); 399 numdays=date.daysInMonth();
400 if(date.month()==1) 400 if(date.month()==1)
401 { // set to december of previous year 401 { // set to december of previous year
402 temp.setYMD(date.year()-1, 12, 1); 402 temp.setYMD(date.year()-1, 12, 1);
403 } else { // set to previous month 403 } else { // set to previous month
404 temp.setYMD(date.year(), date.month()-1, 1); 404 temp.setYMD(date.year(), date.month()-1, 1);
405 } 405 }
406 numDaysPrevMonth=temp.daysInMonth(); 406 numDaysPrevMonth=temp.daysInMonth();
407 if(changed) 407 if(changed)
408 { 408 {
409 repaintContents(false); 409 repaintContents(false);
410 } 410 }
411 emit(dateChanged(date)); 411 emit(dateChanged(date));
412 return true; 412 return true;
413} 413}
414 414
415const QDate& 415const QDate&
416KDateTable::getDate() const 416KDateTable::getDate() const
417{ 417{
418 return date; 418 return date;
419} 419}
420 420
421void KDateTable::focusInEvent( QFocusEvent *e ) 421void KDateTable::focusInEvent( QFocusEvent *e )
422{ 422{
423 repaintContents(false); 423 repaintContents(false);
424 QGridView::focusInEvent( e ); 424 QGridView::focusInEvent( e );
425} 425}
426 426
427void KDateTable::focusOutEvent( QFocusEvent *e ) 427void KDateTable::focusOutEvent( QFocusEvent *e )
428{ 428{
429 repaintContents(false); 429 repaintContents(false);
430 QGridView::focusOutEvent( e ); 430 QGridView::focusOutEvent( e );
431} 431}
432 432
433QSize 433QSize
434KDateTable::sizeHint() const 434KDateTable::sizeHint() const
435{ 435{
436 if(maxCell.height()>0 && maxCell.width()>0) 436 if(maxCell.height()>0 && maxCell.width()>0)
437 { 437 {
438 return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), 438 return QSize((maxCell.width()+2)*numCols()+2*frameWidth(),
439 (maxCell.height()+4)*numRows()+2*frameWidth()); 439 (maxCell.height()+4)*numRows()+2*frameWidth());
440 } else { 440 } else {
441 return QSize(-1, -1); 441 return QSize(-1, -1);
442 } 442 }
443} 443}
444 444
445KDateInternalMonthPicker::KDateInternalMonthPicker 445KDateInternalMonthPicker::KDateInternalMonthPicker
446(QWidget* parent, const char* name) 446(QWidget* parent, const char* name)
447 : QGridView(parent, name), 447 : QGridView(parent, name),
448 result(0) // invalid 448 result(0) // invalid
449{ 449{
450 QRect rect; 450 QRect rect;
451 QFont font; 451 QFont font;
452 // ----- 452 // -----
453 activeCol = -1; 453 activeCol = -1;
454 activeRow = -1; 454 activeRow = -1;
455 font=KGlobalSettings::generalFont(); 455 font=KGlobalSettings::generalFont();
456 int fontsize = 10; 456 int fontsize = 10;
457 int add = 2; 457 int add = 2;
458 if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) 458 if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
459 add += 8; 459 add += 8;
460 if ( QApplication::desktop()->width() > 640 ) 460 if ( QApplication::desktop()->width() > 640 )
461 add += 4; 461 add += 6;
462 font.setPointSize(fontsize+add); 462 font.setPointSize(fontsize+add);
463 setFont(font); 463 setFont(font);
464 setHScrollBarMode(AlwaysOff); 464 setHScrollBarMode(AlwaysOff);
465 setVScrollBarMode(AlwaysOff); 465 setVScrollBarMode(AlwaysOff);
466 setFrameStyle(QFrame::NoFrame); 466 setFrameStyle(QFrame::NoFrame);
467 setNumRows(4); 467 setNumRows(4);
468 setNumCols(3); 468 setNumCols(3);
469 // enable to find drawing failures: 469 // enable to find drawing failures:
470 // setTableFlags(Tbl_clipCellPainting); 470 // setTableFlags(Tbl_clipCellPainting);
471#if 0 471#if 0
472 viewport()->setEraseColor(lightGray); // for consistency with the datepicker 472 viewport()->setEraseColor(lightGray); // for consistency with the datepicker
473#endif 473#endif
474 // ----- find the preferred size 474 // ----- find the preferred size
475 // (this is slow, possibly, but unfortunatly it is needed here): 475 // (this is slow, possibly, but unfortunatly it is needed here):
476 QFontMetrics metrics(font); 476 QFontMetrics metrics(font);
477 for(int i=1; i <= 12; ++i) 477 for(int i=1; i <= 12; ++i)
478 { 478 {
479 rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); 479 rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false));
480 if(max.width()<rect.width()) max.setWidth(rect.width()); 480 if(max.width()<rect.width()) max.setWidth(rect.width());
481 if(max.height()<rect.height()) max.setHeight(rect.height()); 481 if(max.height()<rect.height()) max.setHeight(rect.height());
482 } 482 }
483 483
484} 484}
485 485
486QSize 486QSize
487KDateInternalMonthPicker::sizeHint() const 487KDateInternalMonthPicker::sizeHint() const
488{ 488{
489 return QSize((max.width()+6)*numCols()+2*frameWidth(), 489 return QSize((max.width()+6)*numCols()+2*frameWidth(),
490 (max.height()+6)*numRows()+2*frameWidth()); 490 (max.height()+6)*numRows()+2*frameWidth());
491} 491}
492 492
493int 493int
494KDateInternalMonthPicker::getResult() const 494KDateInternalMonthPicker::getResult() const
495{ 495{
496 return result; 496 return result;
497} 497}
498 498
499void 499void
500KDateInternalMonthPicker::setupPainter(QPainter *p) 500KDateInternalMonthPicker::setupPainter(QPainter *p)
501{ 501{
502 p->setPen(black); 502 p->setPen(black);
503} 503}
504 504
505void 505void
506KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) 506KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*)
507{ 507{
508 setCellWidth(width()/3); 508 setCellWidth(width()/3);
509 setCellHeight(height()/4); 509 setCellHeight(height()/4);
510} 510}
511 511
512void 512void
513KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col) 513KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col)
514{ 514{
515 int index; 515 int index;
516 QString text; 516 QString text;
517 // ----- find the number of the cell: 517 // ----- find the number of the cell:
518 index=3*row+col+1; 518 index=3*row+col+1;
519 text=KGlobal::locale()->monthName(index, false); 519 text=KGlobal::locale()->monthName(index, false);
520 painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); 520 painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
521 if ( activeCol == col && activeRow == row ) 521 if ( activeCol == col && activeRow == row )
522 painter->drawRect( 0, 0, cellWidth(), cellHeight() ); 522 painter->drawRect( 0, 0, cellWidth(), cellHeight() );
523} 523}
524 524
525void 525void