author | zautrix <zautrix> | 2005-07-07 12:30:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-07 12:30:17 (UTC) |
commit | 766b53919de14b8faec22db32b6a750acde0b760 (patch) (unidiff) | |
tree | bb07c0af89b0dddf4257a61e9f5b1cf23c4a282a /korganizer/komonthview.cpp | |
parent | b4d85da57e2d558ec088af6f3b2a34b1854462c0 (diff) | |
download | kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.zip kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.gz kdepimpi-766b53919de14b8faec22db32b6a750acde0b760.tar.bz2 |
fixesss
-rw-r--r-- | korganizer/komonthview.cpp | 124 |
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 | |||
@@ -1524,7 +1524,8 @@ void KOMonthView::updateConfig() | |||
1524 | if ( ! mShowWeekView ) { | 1524 | if ( ! mShowWeekView ) { |
1525 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1525 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1526 | computeLayout(); | 1526 | computeLayout(); |
1527 | } | 1527 | } else |
1528 | doComputeLayoutWeek(); | ||
1528 | updateDayLabels(); | 1529 | updateDayLabels(); |
1529 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); | 1530 | //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); |
1530 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; | 1531 | //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; |
@@ -1815,7 +1816,8 @@ void KOMonthView::resizeEvent(QResizeEvent * e) | |||
1815 | slotComputeLayout(); | 1816 | slotComputeLayout(); |
1816 | } else | 1817 | } else |
1817 | mComputeLayoutTimer->start( 100 ); | 1818 | mComputeLayoutTimer->start( 100 ); |
1818 | KOEventView::resizeEvent( e ); | 1819 | if ( e ) |
1820 | KOEventView::resizeEvent( e ); | ||
1819 | } | 1821 | } |
1820 | 1822 | ||
1821 | void KOMonthView::slotComputeLayout() | 1823 | void KOMonthView::slotComputeLayout() |
@@ -1826,37 +1828,27 @@ void KOMonthView::slotComputeLayout() | |||
1826 | clPending = true; | 1828 | clPending = true; |
1827 | setKeyBFocus(); | 1829 | setKeyBFocus(); |
1828 | } | 1830 | } |
1829 | void KOMonthView::computeLayoutWeek() | 1831 | |
1832 | void KOMonthView::doComputeLayoutWeek() | ||
1830 | { | 1833 | { |
1831 | static int lastWid = 0; | 1834 | |
1832 | static int lastHei = 0; | ||
1833 | int daysToShow; | 1835 | int daysToShow; |
1834 | bool combinedSatSun = false; | 1836 | bool combinedSatSun = false; |
1835 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1837 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1836 | daysToShow = 6; | 1838 | daysToShow = 6; |
1837 | combinedSatSun = true; | 1839 | combinedSatSun = true; |
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; |
1861 | combinedSatSun = true; | 1853 | combinedSatSun = true; |
1862 | 1854 | ||
@@ -1886,12 +1878,19 @@ void KOMonthView::computeLayoutWeek() | |||
1886 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { | 1878 | if ( ((i) % daysToShow) >= daysToShow-colModulo ) { |
1887 | ++w; | 1879 | ++w; |
1888 | } | 1880 | } |
1881 | int xC,yC,wC,hC; | ||
1889 | if ( i >= 5 ) { | 1882 | if ( i >= 5 ) { |
1890 | int wi = width() - x - weeklabelwid; | 1883 | int wi = width() - x - weeklabelwid; |
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 | } |
1896 | x = x - w + wi - (wi/2 ); | 1895 | x = x - w + wi - (wi/2 ); |
1897 | } | 1896 | } |
@@ -1900,8 +1899,14 @@ void KOMonthView::computeLayoutWeek() | |||
1900 | if ( !(( i+1) % daysToShow)) { | 1899 | if ( !(( i+1) % daysToShow)) { |
1901 | wi = width() - x - weeklabelwid; | 1900 | wi = width() - x - weeklabelwid; |
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; |
1906 | } | 1911 | } |
1907 | x= 0; | 1912 | x= 0; |
@@ -1923,23 +1928,34 @@ void KOMonthView::computeLayoutWeek() | |||
1923 | if ( i == (daysToShow-1-rowModulo)*7) | 1928 | if ( i == (daysToShow-1-rowModulo)*7) |
1924 | ++h; | 1929 | ++h; |
1925 | 1930 | ||
1931 | int xC,yC,wC,hC; | ||
1926 | if ( i >= 5 ) { | 1932 | if ( i >= 5 ) { |
1927 | if ( i ==5 ) { | 1933 | if ( i ==5 ) { |
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; |
1931 | } else { | 1940 | } else { |
1932 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { | 1941 | if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { |
1933 | ++w; | 1942 | ++w; |
1934 | } | 1943 | } |
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; |
1938 | } | 1950 | } |
1939 | } else { | 1951 | } else { |
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 | ||
1944 | 1960 | ||
1945 | x += w; | 1961 | x += w; |
@@ -1963,6 +1979,56 @@ void KOMonthView::computeLayoutWeek() | |||
1963 | //if ( forceUpdate ) | 1979 | //if ( forceUpdate ) |
1964 | // updateView(); | 1980 | // updateView(); |
1965 | } | 1981 | } |
1982 | void 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 | } | ||
2001 | int 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 | } | ||
1966 | void KOMonthView::computeLayout() | 2032 | void KOMonthView::computeLayout() |
1967 | { | 2033 | { |
1968 | 2034 | ||