summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-07-07 12:30:17 (UTC)
committer zautrix <zautrix>2005-07-07 12:30:17 (UTC)
commit766b53919de14b8faec22db32b6a750acde0b760 (patch) (unidiff)
treebb07c0af89b0dddf4257a61e9f5b1cf23c4a282a /korganizer/komonthview.cpp
parentb4d85da57e2d558ec088af6f3b2a34b1854462c0 (diff)
downloadkdepimpi-766b53919de14b8faec22db32b6a750acde0b760.zip
kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.gz
kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.bz2
fixesss
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp124
1 files changed, 95 insertions, 29 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 2289977..53bbe28 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1526,3 +1526,4 @@ void KOMonthView::updateConfig()
1526 computeLayout(); 1526 computeLayout();
1527 } 1527 } else
1528 doComputeLayoutWeek();
1528 updateDayLabels(); 1529 updateDayLabels();
@@ -1817,3 +1818,4 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
1817 mComputeLayoutTimer->start( 100 ); 1818 mComputeLayoutTimer->start( 100 );
1818 KOEventView::resizeEvent( e ); 1819 if ( e )
1820 KOEventView::resizeEvent( e );
1819} 1821}
@@ -1828,6 +1830,6 @@ void KOMonthView::slotComputeLayout()
1828} 1830}
1829void KOMonthView::computeLayoutWeek() 1831
1832void KOMonthView::doComputeLayoutWeek()
1830{ 1833{
1831 static int lastWid = 0; 1834
1832 static int lastHei = 0;
1833 int daysToShow; 1835 int daysToShow;
@@ -1838,23 +1840,13 @@ void KOMonthView::computeLayoutWeek()
1838 } 1840 }
1839 int tWid = topLevelWidget()->size().width();
1840 int tHei = topLevelWidget()->size().height();
1841
1842 int wid = width();//e 1841 int wid = width();//e
1843 int hei = height()-1-mNavigatorBar->height(); 1842 int hei = height()-1-mNavigatorBar->height();
1844 1843 if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) {
1845 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1846 return;
1847
1848 if ( lastWid == width() && lastHei == height() ) {
1849 //qDebug("KOListWeekView::No compute layout needed ");
1850 return;
1851 }
1852 lastWid = width();
1853 lastHei = height();
1854
1855
1856 if ( wid < hei )
1857 daysToShow = 2; 1844 daysToShow = 2;
1858 else 1845 } else {
1859 daysToShow = 3; 1846 if ( wid < hei )
1847 daysToShow = 2;
1848 else
1849 daysToShow = 3;
1850 }
1851 bool landscape = (daysToShow == 3);
1860 mShowSatSunComp = true; 1852 mShowSatSunComp = true;
@@ -1888,2 +1880,3 @@ void KOMonthView::computeLayoutWeek()
1888 } 1880 }
1881 int xC,yC,wC,hC;
1889 if ( i >= 5 ) { 1882 if ( i >= 5 ) {
@@ -1891,5 +1884,11 @@ void KOMonthView::computeLayoutWeek()
1891 if ( i == 5 ) { 1884 if ( i == 5 ) {
1892 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); 1885 xC = x+weeklabelwid;
1886 yC = y;
1887 wC = wi/2+wi%2;
1888 hC = h;
1893 } else { 1889 } else {
1894 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1890 xC = x+weeklabelwid;
1891 yC = y;
1892 wC = wi;
1893 hC = h;
1895 } 1894 }
@@ -1902,4 +1901,10 @@ void KOMonthView::computeLayoutWeek()
1902 } 1901 }
1903 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1902 xC = x+weeklabelwid;
1903 yC = y;
1904 wC = wi;
1905 hC = h;
1904 } 1906 }
1907 mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC);
1908
1909
1905 x += w; 1910 x += w;
@@ -1925,2 +1930,3 @@ void KOMonthView::computeLayoutWeek()
1925 1930
1931 int xC,yC,wC,hC;
1926 if ( i >= 5 ) { 1932 if ( i >= 5 ) {
@@ -1928,3 +1934,6 @@ void KOMonthView::computeLayoutWeek()
1928 max = h/2; 1934 max = h/2;
1929 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1935 xC = x+weeklabelwid;
1936 yC = y;
1937 wC = w;
1938 hC = max;
1930 x -= w ;y += h/2; 1939 x -= w ;y += h/2;
@@ -1935,3 +1944,6 @@ void KOMonthView::computeLayoutWeek()
1935 max = h-h/2; 1944 max = h-h/2;
1936 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1945 xC = x+weeklabelwid;
1946 yC = y;
1947 wC = w;
1948 hC = max;
1937 y -= h/2; 1949 y -= h/2;
@@ -1940,4 +1952,8 @@ void KOMonthView::computeLayoutWeek()
1940 max = h; 1952 max = h;
1941 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1953 xC = x+weeklabelwid;
1954 yC = y;
1955 wC = w;
1956 hC = h;
1942 } 1957 }
1958 mCellsW[mapWeekLayout(i,landscape)]->setGeometry ( xC,yC,wC,hC );
1943 1959
@@ -1965,2 +1981,52 @@ void KOMonthView::computeLayoutWeek()
1965} 1981}
1982void KOMonthView::computeLayoutWeek()
1983{
1984 static int lastWid = 0;
1985 static int lastHei = 0;
1986 int tWid = topLevelWidget()->size().width();
1987 int tHei = topLevelWidget()->size().height();
1988 int wid = width();//e
1989 int hei = height()-1-mNavigatorBar->height();
1990 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1991 return;
1992
1993 if ( lastWid == width() && lastHei == height() ) {
1994 //qDebug("KOListWeekView::No compute layout needed ");
1995 return;
1996 }
1997 lastWid = width();
1998 lastHei = height();
1999 doComputeLayoutWeek();
2000}
2001int KOMonthView::mapWeekLayout( int index, bool landscape )
2002{
2003 if ( KOPrefs::instance()->mMonthViewWeekRowlayout )
2004 return index;
2005 int diff = 0;
2006 if ( !landscape ) diff = 1;
2007 switch( index ) {
2008 case 0:
2009 case 5:
2010 case 6:
2011 return index;
2012 break;
2013 case 1:
2014 return 2+diff;
2015 break;
2016 case 2:
2017 return 4-(3*diff);
2018 break;
2019 case 3:
2020 return 1+(3*diff);
2021 break;
2022 case 4:
2023 return 3-diff;
2024 break;
2025 default:
2026 qDebug("KO: Error in mapping week layout ");
2027 return index;
2028 break;
2029 }
2030 return index;
2031}
1966void KOMonthView::computeLayout() 2032void KOMonthView::computeLayout()