summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.cpp
Unidiff
Diffstat (limited to 'korganizer/koagenda.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 9b817bc..01cef35 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1852,134 +1852,138 @@ void KOAgenda::finishResize ( )
1852 if ( globalFlagBlockAgenda == 0 ) { 1852 if ( globalFlagBlockAgenda == 0 ) {
1853 finishUpdate(); 1853 finishUpdate();
1854 //qDebug("finishUpdate() called "); 1854 //qDebug("finishUpdate() called ");
1855 } 1855 }
1856} 1856}
1857/* 1857/*
1858 Overridden from QScrollView to provide proper resizing of KOAgendaItems. 1858 Overridden from QScrollView to provide proper resizing of KOAgendaItems.
1859*/ 1859*/
1860void KOAgenda::resizeEvent ( QResizeEvent *ev ) 1860void KOAgenda::resizeEvent ( QResizeEvent *ev )
1861{ 1861{
1862 mSelectionHeight = 0; 1862 mSelectionHeight = 0;
1863 mResizeTimer.start( 150 , true ); 1863 mResizeTimer.start( 150 , true );
1864 computeSizes(); 1864 computeSizes();
1865 return; 1865 return;
1866 1866
1867} 1867}
1868void KOAgenda::computeSizes() 1868void KOAgenda::computeSizes()
1869{ 1869{
1870 if ( globalFlagBlockStartup ) 1870 if ( globalFlagBlockStartup )
1871 return; 1871 return;
1872 int frameOffset = frameWidth() * 2 +1; 1872 int frameOffset = frameWidth() * 2 +1;
1873 if (mAllDayMode) { 1873 if (mAllDayMode) {
1874 mGridSpacingX = (width()-frameOffset) / mColumns; 1874 mGridSpacingX = (width()-frameOffset) / mColumns;
1875 mGridSpacingY = height() - 2 * frameWidth() - 1; 1875 mGridSpacingY = height() - 2 * frameWidth() - 1;
1876 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1); 1876 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY + 1);
1877 // mGridSpacingY = height(); 1877 // mGridSpacingY = height();
1878 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1878 // resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1879 1879
1880 KOAgendaItem *item; 1880 KOAgendaItem *item;
1881 int subCellWidth; 1881 int subCellWidth;
1882 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1882 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1883 subCellWidth = mGridSpacingY / item->subCells(); 1883 subCellWidth = mGridSpacingY / item->subCells();
1884 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth); 1884 item->resize(mGridSpacingX * item->cellWidth(),subCellWidth);
1885 moveChild(item,KOGlobals::self()->reverseLayout() ? 1885 moveChild(item,KOGlobals::self()->reverseLayout() ?
1886 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1886 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1887 item->cellX() * mGridSpacingX, 1887 item->cellX() * mGridSpacingX,
1888 item->subCell() * subCellWidth); 1888 item->subCell() * subCellWidth);
1889 } 1889 }
1890 KOPrefs::instance()->mAllDaySize = mGridSpacingY; 1890 KOPrefs::instance()->mAllDaySize = mGridSpacingY;
1891 } else { 1891 } else {
1892 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns; 1892 mGridSpacingX = (width() - verticalScrollBar()->width()-frameOffset)/mColumns;
1893 if (height() > mGridSpacingY * mRows + 1 ) { 1893 if (height() > mGridSpacingY * mRows + 1 ) {
1894 KOPrefs::instance()->mHourSize = ((height())/mRows)+1; 1894 KOPrefs::instance()->mHourSize = ((height())/mRows)+1;
1895 mGridSpacingY = KOPrefs::instance()->mHourSize ; 1895 mGridSpacingY = KOPrefs::instance()->mHourSize ;
1896 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1896 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1897 emit resizedSignal(); 1897 emit resizedSignal();
1898 } else 1898 } else
1899 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); 1899 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 );
1900 KOAgendaItem *item; 1900 KOAgendaItem *item;
1901 int subCellWidth; 1901 int subCellWidth;
1902 1902
1903 for ( item=mItems.first(); item != 0; item=mItems.next() ) { 1903 for ( item=mItems.first(); item != 0; item=mItems.next() ) {
1904 subCellWidth = mGridSpacingX / item->subCells(); 1904 subCellWidth = mGridSpacingX / item->subCells();
1905 item->resize(subCellWidth,item->height()); 1905 item->resize(subCellWidth,item->height());
1906 moveChild(item,(KOGlobals::self()->reverseLayout() ? 1906 moveChild(item,(KOGlobals::self()->reverseLayout() ?
1907 (mColumns - 1 - item->cellX()) * mGridSpacingX : 1907 (mColumns - 1 - item->cellX()) * mGridSpacingX :
1908 item->cellX() * mGridSpacingX) + 1908 item->cellX() * mGridSpacingX) +
1909 item->subCell() * subCellWidth,childY(item)); 1909 item->subCell() * subCellWidth,childY(item));
1910 } 1910 }
1911 } 1911 }
1912 int cw = contentsWidth(); 1912 int cw = contentsWidth();
1913 int ch = contentsHeight(); 1913 int ch = contentsHeight();
1914 if ( mAllDayMode ) { 1914 if ( mAllDayMode ) {
1915 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday(); 1915 QPixmap* paintPixAll = KOAgendaItem::paintPixAllday();
1916 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) 1916 if ( (paintPixAll->width() < cw || paintPixAll->height() < ch) && cw > 0 && ch > 0 ) {
1917 //qDebug("paintPixAll->resize ");
1917 paintPixAll->resize( cw, ch ); 1918 paintPixAll->resize( cw, ch );
1919 }
1918 } else { 1920 } else {
1919 QPixmap* paintPix = KOAgendaItem::paintPix(); 1921 QPixmap* paintPix = KOAgendaItem::paintPix();
1920 if ( paintPix->width() < cw || paintPix->height() < ch ) 1922 if ( paintPix->width() < cw || paintPix->height() < ch ) {
1921 KOAgendaItem::resizePixmap( cw , ch ); 1923 //qDebug("paintPix->resize ");
1924 paintPix->resize( cw , ch );
1925 }
1922 } 1926 }
1923 1927
1924 checkScrollBoundaries(); 1928 checkScrollBoundaries();
1925 marcus_bains(); 1929 marcus_bains();
1926 drawContentsToPainter(); 1930 drawContentsToPainter();
1927 viewport()->repaint(false); 1931 viewport()->repaint(false);
1928} 1932}
1929 1933
1930void KOAgenda::scrollUp() 1934void KOAgenda::scrollUp()
1931{ 1935{
1932 scrollBy(0,-mScrollOffset); 1936 scrollBy(0,-mScrollOffset);
1933} 1937}
1934 1938
1935 1939
1936void KOAgenda::scrollDown() 1940void KOAgenda::scrollDown()
1937{ 1941{
1938 scrollBy(0,mScrollOffset); 1942 scrollBy(0,mScrollOffset);
1939} 1943}
1940 1944
1941void KOAgenda::popupAlarm() 1945void KOAgenda::popupAlarm()
1942{ 1946{
1943 if (!mClickedItem) { 1947 if (!mClickedItem) {
1944 qDebug("KOAgenda::popupAlarm() called without having a clicked item "); 1948 qDebug("KOAgenda::popupAlarm() called without having a clicked item ");
1945 return; 1949 return;
1946 } 1950 }
1947 // TODO: deal correctly with multiple alarms 1951 // TODO: deal correctly with multiple alarms
1948 Alarm* alarm; 1952 Alarm* alarm;
1949 QPtrList<Alarm> list(mClickedItem->incidence()->alarms()); 1953 QPtrList<Alarm> list(mClickedItem->incidence()->alarms());
1950 for(alarm=list.first();alarm;alarm=list.next()) { 1954 for(alarm=list.first();alarm;alarm=list.next()) {
1951 alarm->toggleAlarm(); 1955 alarm->toggleAlarm();
1952 } 1956 }
1953 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED ); 1957 emit itemModified( mClickedItem , KOGlobals::EVENTEDITED );
1954 mClickedItem->paintMe( true ); 1958 mClickedItem->paintMe( true );
1955 mClickedItem->repaint( false ); 1959 mClickedItem->repaint( false );
1956} 1960}
1957 1961
1958/* 1962/*
1959 Calculates the minimum width 1963 Calculates the minimum width
1960*/ 1964*/
1961int KOAgenda::minimumWidth() const 1965int KOAgenda::minimumWidth() const
1962{ 1966{
1963 // TODO:: develop a way to dynamically determine the minimum width 1967 // TODO:: develop a way to dynamically determine the minimum width
1964 int min = 100; 1968 int min = 100;
1965 1969
1966 return min; 1970 return min;
1967} 1971}
1968 1972
1969void KOAgenda::updateConfig() 1973void KOAgenda::updateConfig()
1970{ 1974{
1971 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor) 1975 if ( viewport()->backgroundColor() != KOPrefs::instance()->mAgendaBgColor)
1972 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor); 1976 viewport()->setBackgroundColor(KOPrefs::instance()->mAgendaBgColor);
1973 if ( mAllDayMode ) { 1977 if ( mAllDayMode ) {
1974 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize; 1978 mGridSpacingY = height() - 1 ;// KOPrefs::instance()->mAllDaySize;
1975 //mGridSpacingY = KOPrefs::instance()->mAllDaySize; 1979 //mGridSpacingY = KOPrefs::instance()->mAllDaySize;
1976 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 ); 1980 resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY+1 );
1977 // setMaximumHeight( mGridSpacingY+1 ); 1981 // setMaximumHeight( mGridSpacingY+1 );
1978 viewport()->repaint( false ); 1982 viewport()->repaint( false );
1979 //setFixedHeight( mGridSpacingY+1 ); 1983 //setFixedHeight( mGridSpacingY+1 );
1980 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize); 1984 //qDebug("KOPrefs:aaaaa:instance()->mAllDaySize %d ", KOPrefs::instance()->mAllDaySize);
1981 } 1985 }
1982 else { 1986 else {
1983 mGridSpacingY = KOPrefs::instance()->mHourSize; 1987 mGridSpacingY = KOPrefs::instance()->mHourSize;
1984 calculateWorkingHours(); 1988 calculateWorkingHours();
1985 marcus_bains(); 1989 marcus_bains();