summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp72
-rw-r--r--korganizer/komonthview.h1
2 files changed, 46 insertions, 27 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 38cfda7..12233ee 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -749,28 +749,17 @@ void MonthViewCell::finishUpdateCell()
749 if (mToolTip.count() > 0 ) { 749 if (mToolTip.count() > 0 ) {
750 mToolTip.sort(); 750 mToolTip.sort();
751 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 751 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
752 } 752 }
753#endif 753#endif
754 sort(); 754 sort();
755 //setMyPalette(); 755 //setMyPalette();
756 setMyPalette(); 756 setMyPalette();
757 QString text; 757
758 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
759 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
760 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
761 mLabel->resize( mLabelBigSize );
762 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
763 } else {
764 mLabel->resize( mLabelSize );
765 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
766 }
767
768 mLabel->setText( text );
769 resizeEvent( 0 ); 758 resizeEvent( 0 );
770 759
771} 760}
772void MonthViewCell::updateCell() 761void MonthViewCell::updateCell()
773{ 762{
774 //qDebug("MonthViewCell::updateCell() "); 763 //qDebug("MonthViewCell::updateCell() ");
775 if ( !mMonthView->isUpdatePossible() ) 764 if ( !mMonthView->isUpdatePossible() )
776 return; 765 return;
@@ -890,16 +879,31 @@ void MonthViewCell::select()
890} 879}
891 880
892void MonthViewCell::resizeEvent ( QResizeEvent * e ) 881void MonthViewCell::resizeEvent ( QResizeEvent * e )
893{ 882{
894 if ( !mMonthView->isUpdatePossible() ) 883 if ( !mMonthView->isUpdatePossible() )
895 return; 884 return;
896 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 885 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
897 deselect(); 886 deselect();
887 mLabel->setMaximumHeight( height() - lineWidth()*2 );
888
889 QString text;
890 mLabel->setText( text );
891 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
892 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
893 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
894 mLabel->resize( mLabelBigSize );
895 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
896 } else {
897 mLabel->resize( mLabelSize );
898 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
899 }
900 mLabel->setText( text );
901
898 int size = height() - mLabel->height() - lineWidth()-1; 902 int size = height() - mLabel->height() - lineWidth()-1;
899 //qDebug("LW %d ", lineWidth()); 903 //qDebug("LW %d ", lineWidth());
900 if ( size > 0 ) 904 if ( size > 0 )
901 verticalScrollBar()->setMaximumHeight( size ); 905 verticalScrollBar()->setMaximumHeight( size );
902 size = width() - mLabel->width() -lineWidth()-1; 906 size = width() - mLabel->width() -lineWidth()-1;
903 if ( size > 0 ) 907 if ( size > 0 )
904 horizontalScrollBar()->setMaximumWidth( size ); 908 horizontalScrollBar()->setMaximumWidth( size );
905 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 909 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
@@ -1443,17 +1447,17 @@ void KOMonthView::updateView()
1443 } 1447 }
1444 } 1448 }
1445 } 1449 }
1446 1450
1447 for( i = 0; i < timeSpan+1; ++i ) { 1451 for( i = 0; i < timeSpan+1; ++i ) {
1448 (*cells)[i]->finishUpdateCell(); 1452 (*cells)[i]->finishUpdateCell();
1449 } 1453 }
1450 processSelectionChange(); 1454 processSelectionChange();
1451 qApp->processEvents(); 1455 //qApp->processEvents();
1452 for( i = 0; i < timeSpan+1; ++i ) { 1456 for( i = 0; i < timeSpan+1; ++i ) {
1453 (*cells)[i]->repaintfinishUpdateCell(); 1457 (*cells)[i]->repaintfinishUpdateCell();
1454 } 1458 }
1455 (*cells)[0]->setFocus(); 1459 (*cells)[0]->setFocus();
1456 1460
1457 1461
1458#else 1462#else
1459 // old code 1463 // old code
@@ -1469,28 +1473,28 @@ void KOMonthView::updateView()
1469 (*cells)[0]->setFocus(); 1473 (*cells)[0]->setFocus();
1470#endif 1474#endif
1471 1475
1472 //qDebug("update time %d ", ti.elapsed()); 1476 //qDebug("update time %d ", ti.elapsed());
1473} 1477}
1474 1478
1475void KOMonthView::resizeEvent(QResizeEvent * e) 1479void KOMonthView::resizeEvent(QResizeEvent * e)
1476{ 1480{
1477 qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1481 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1478 if ( isVisible() ) { 1482 if ( isVisible() ) {
1479 qDebug("KOMonthView::isVisible "); 1483 //qDebug("KOMonthView::isVisible ");
1480 slotComputeLayout(); 1484 slotComputeLayout();
1481 } else 1485 } else
1482 mComputeLayoutTimer->start( 100 ); 1486 mComputeLayoutTimer->start( 100 );
1483} 1487}
1484 1488
1485void KOMonthView::slotComputeLayout() 1489void KOMonthView::slotComputeLayout()
1486{ 1490{
1487 mComputeLayoutTimer->stop(); 1491 mComputeLayoutTimer->stop();
1488 qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1492 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1489 computeLayout(); 1493 computeLayout();
1490 clPending = true; 1494 clPending = true;
1491 if ( mShowWeekView ) 1495 if ( mShowWeekView )
1492 mCellsW[0]->setFocus(); 1496 mCellsW[0]->setFocus();
1493 else 1497 else
1494 mCells[0]->setFocus(); 1498 mCells[0]->setFocus();
1495 1499
1496} 1500}
@@ -1509,17 +1513,17 @@ void KOMonthView::computeLayoutWeek()
1509 1513
1510 int wid = width();//e 1514 int wid = width();//e
1511 int hei = height()-1-mNavigatorBar->height(); 1515 int hei = height()-1-mNavigatorBar->height();
1512 1516
1513 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1517 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1514 return; 1518 return;
1515 1519
1516 if ( lastWid == width() && lastHei == height() ) { 1520 if ( lastWid == width() && lastHei == height() ) {
1517 qDebug("KOListWeekView::No compute layout needed "); 1521 //qDebug("KOListWeekView::No compute layout needed ");
1518 return; 1522 return;
1519 } 1523 }
1520 lastWid = width(); 1524 lastWid = width();
1521 lastHei = height(); 1525 lastHei = height();
1522 1526
1523 1527
1524 if ( wid < hei ) 1528 if ( wid < hei )
1525 daysToShow = 2; 1529 daysToShow = 2;
@@ -1562,49 +1566,55 @@ void KOMonthView::computeLayoutWeek()
1562 else 1566 else
1563 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); 1567 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1564 x += w; 1568 x += w;
1565 } 1569 }
1566 x= 0; 1570 x= 0;
1567 y= dayLabelHei; 1571 y= dayLabelHei;
1568 w = colWid; 1572 w = colWid;
1569 h = cellHei; 1573 h = cellHei;
1574 int max = 0;
1570 for ( i = 0; i < mCellsW.count(); ++i) { 1575 for ( i = 0; i < mCellsW.count(); ++i) {
1571 if ( i > 6 ) { 1576 if ( i > 6 ) {
1572 mCellsW[i]->hide(); 1577 mCellsW[i]->hide();
1573 continue; 1578 continue;
1574 } 1579 }
1575 1580
1576 w = colWid; 1581 w = colWid;
1577 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1582 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1578 ++w; 1583 ++w;
1579 } 1584 }
1580 if ( i == (daysToShow-1-rowModulo)*7) 1585 if ( i == (daysToShow-1-rowModulo)*7)
1581 ++h; 1586 ++h;
1582 1587
1583 if ( i >= 5 ) { 1588 if ( i >= 5 ) {
1584 if ( i ==5 ) { 1589 if ( i ==5 ) {
1585 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1590 max = h/2;
1591 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1586 x -= w ;y += h/2; 1592 x -= w ;y += h/2;
1587 } else { 1593 } else {
1588 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1594 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1589 ++w; 1595 ++w;
1590 } 1596 }
1591 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1597 max = h-h/2;
1598 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1592 y -= h/2; 1599 y -= h/2;
1593 } 1600 }
1594 } else 1601 } else {
1602 max = h;
1595 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1603 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1604 }
1596 1605
1597 1606
1598 x += w; 1607 x += w;
1599 if ( x + w/2 > wid ) { 1608 if ( x + w/2 > wid ) {
1600 x = 0; 1609 x = 0;
1601 y += h+dayLabelHei ; 1610 y += h+dayLabelHei ;
1602 } 1611 }
1612 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
1603 } 1613 }
1604 y= dayLabelHei; 1614 y= dayLabelHei;
1605 h = cellHei ; 1615 h = cellHei ;
1606 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1616 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1607 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1617 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1608 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1618 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1609 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1619 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1610 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; 1620 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ;
@@ -1637,23 +1647,23 @@ void KOMonthView::computeLayout()
1637 1647
1638 int wid = width();//e 1648 int wid = width();//e
1639 int hei = height()-1-mNavigatorBar->height(); 1649 int hei = height()-1-mNavigatorBar->height();
1640 1650
1641 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 1651 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1642 return; 1652 return;
1643 } 1653 }
1644 if ( lastWid == width() && lastHei == height() ){ 1654 if ( lastWid == width() && lastHei == height() ){
1645 qDebug("KOMonthview::No compute layout needed "); 1655 //qDebug("KOMonthview::No compute layout needed ");
1646 return; 1656 return;
1647 } 1657 }
1648 1658
1649 lastWid = width(); 1659 lastWid = width();
1650 lastHei = height(); 1660 lastHei = height();
1651 qDebug("KOMonthView::computeLayout() MMM ------------------- "); 1661 //qDebug("KOMonthView::computeLayout() MMM ------------------- ");
1652 QFontMetrics fm ( mWeekLabels[0]->font() ); 1662 QFontMetrics fm ( mWeekLabels[0]->font() );
1653 int weeklabelwid = fm.width( "888" ); 1663 int weeklabelwid = fm.width( "888" );
1654 wid -= weeklabelwid; 1664 wid -= weeklabelwid;
1655 1665
1656 int colWid = wid / daysToShow; 1666 int colWid = wid / daysToShow;
1657 int lastCol = wid - ( colWid*6 ); 1667 int lastCol = wid - ( colWid*6 );
1658 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1668 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1659 int cellHei = (hei - dayLabelHei) /6; 1669 int cellHei = (hei - dayLabelHei) /6;
@@ -1679,44 +1689,52 @@ void KOMonthView::computeLayout()
1679 } else 1689 } else
1680 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1690 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1681 x += w; 1691 x += w;
1682 } 1692 }
1683 x= 0; 1693 x= 0;
1684 y= dayLabelHei; 1694 y= dayLabelHei;
1685 w = colWid; 1695 w = colWid;
1686 h = cellHei ; 1696 h = cellHei ;
1697 int max = 0;
1687 for ( i = 0; i < mCells.count(); ++i) { 1698 for ( i = 0; i < mCells.count(); ++i) {
1688 //qDebug("iii %d ", i); 1699 //qDebug("iii %d ", i);
1689 w = colWid; 1700 w = colWid;
1690 if ( ((i) % 7) >= 7-colModulo ) { 1701 if ( ((i) % 7) >= 7-colModulo ) {
1691 ++w; 1702 ++w;
1692 } 1703 }
1693 if ( i == (6-rowModulo)*7) 1704 if ( i == (6-rowModulo)*7)
1694 ++h; 1705 ++h;
1695 if ( combinedSatSun ) { 1706 if ( combinedSatSun ) {
1696 if ( (i)%7 >= daysToShow-1 ) { 1707 if ( (i)%7 >= daysToShow-1 ) {
1697 if ( (i)%7 == daysToShow-1 ) { 1708 if ( (i)%7 == daysToShow-1 ) {
1698 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1709 max = h/2;
1710 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1699 x -= w ;y += h/2; 1711 x -= w ;y += h/2;
1700 } else { 1712 } else {
1701 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1713 max = h-h/2;
1714 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1702 y -= h/2; 1715 y -= h/2;
1703 } 1716 }
1704 } else 1717 } else {
1718 max = h;
1705 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1719 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1720 }
1706 1721
1707 } 1722 }
1708 else 1723 else {
1724 max = h;
1709 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1725 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1726 }
1710 x += w; 1727 x += w;
1711 if ( x + w/2 > wid ) { 1728 if ( x + w/2 > wid ) {
1712 x = 0; 1729 x = 0;
1713 y += h; 1730 y += h;
1714 } 1731 }
1732 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
1715 } 1733 }
1716 y= dayLabelHei; 1734 y= dayLabelHei;
1717 h = cellHei ; 1735 h = cellHei ;
1718 for ( i = 0; i < 6; i++) { 1736 for ( i = 0; i < 6; i++) {
1719 if ( i == (6-rowModulo)) 1737 if ( i == (6-rowModulo))
1720 ++h; 1738 ++h;
1721 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1739 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1722 y += h; 1740 y += h;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index b997c1a..a58f6b8 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -154,16 +154,17 @@ class MonthViewCell : public KNoScrollListBox
154 void insertTodo(Todo *); 154 void insertTodo(Todo *);
155 155
156 void updateConfig( bool bigFont = false ); 156 void updateConfig( bool bigFont = false );
157 157
158 void enableScrollBars( bool ); 158 void enableScrollBars( bool );
159 159
160 Incidence *selectedIncidence(); 160 Incidence *selectedIncidence();
161 QDate selectedIncidenceDate(); 161 QDate selectedIncidenceDate();
162 QPushButton * dateLabel() { return mLabel; }
162 163
163 void deselect(); 164 void deselect();
164 void select(); 165 void select();
165 166
166#ifdef DESKTOP_VERSION 167#ifdef DESKTOP_VERSION
167 static QToolTipGroup *toolTipGroup(); 168 static QToolTipGroup *toolTipGroup();
168#endif 169#endif
169 signals: 170 signals: