summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-01-31 11:47:44 (UTC)
committer zautrix <zautrix>2005-01-31 11:47:44 (UTC)
commit0ee7cc932ca9c973b086f847a38d29531a815712 (patch) (unidiff)
treec16662cdcfffb31d517ff700aa6dcd13f2f8c643 /korganizer/komonthview.cpp
parent3e0b1c7cd48903b6886e081210cd83b7441b48ac (diff)
downloadkdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.zip
kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.gz
kdepimpi-0ee7cc932ca9c973b086f847a38d29531a815712.tar.bz2
many fixes
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4cefb26..770a42b 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -928,96 +928,97 @@ void KOMonthView::showDates(const QDate &start, const QDate &)
928 for( i = 0; i < 6; ++i ) { 928 for( i = 0; i < 6; ++i ) {
929 int wno; 929 int wno;
930 // remember, according to ISO 8601, the first week of the year is the 930 // remember, according to ISO 8601, the first week of the year is the
931 // first week that contains a thursday. Thus we must subtract off 4, 931 // first week that contains a thursday. Thus we must subtract off 4,
932 // not just 1. 932 // not just 1.
933 int dayOfYear = date.dayOfYear(); 933 int dayOfYear = date.dayOfYear();
934 if (dayOfYear % 7 != 0) 934 if (dayOfYear % 7 != 0)
935 wno = dayOfYear / 7 + 1; 935 wno = dayOfYear / 7 + 1;
936 else 936 else
937 wno =dayOfYear / 7; 937 wno =dayOfYear / 7;
938 mWeekLabels[i]->setWeekNum( wno ); 938 mWeekLabels[i]->setWeekNum( wno );
939 date = date.addDays( 7 ); 939 date = date.addDays( 7 );
940 } 940 }
941 updateView(); 941 updateView();
942} 942}
943 943
944void KOMonthView::showEvents(QPtrList<Event>) 944void KOMonthView::showEvents(QPtrList<Event>)
945{ 945{
946 qDebug("KOMonthView::selectEvents is not implemented yet. "); 946 qDebug("KOMonthView::selectEvents is not implemented yet. ");
947} 947}
948 948
949void KOMonthView::changeEventDisplay(Event *, int) 949void KOMonthView::changeEventDisplay(Event *, int)
950{ 950{
951 // this should be re-written to be much more efficient, but this 951 // this should be re-written to be much more efficient, but this
952 // quick-and-dirty-hack gets the job done for right now. 952 // quick-and-dirty-hack gets the job done for right now.
953 updateView(); 953 updateView();
954} 954}
955 955
956void KOMonthView::updateView() 956void KOMonthView::updateView()
957{ 957{
958 958
959 if ( !updatePossible ) 959 if ( !updatePossible )
960 return; 960 return;
961 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 961 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
962 int i; 962 int i;
963 for( i = 0; i < mCells.count(); ++i ) { 963 for( i = 0; i < mCells.count(); ++i ) {
964 mCells[i]->updateCell(); 964 mCells[i]->updateCell();
965 } 965 }
966 966
967 //qDebug("KOMonthView::updateView() "); 967 //qDebug("KOMonthView::updateView() ");
968 processSelectionChange(); 968 processSelectionChange();
969 // qDebug("---------------------------------------------------------------------+ "); 969 // qDebug("---------------------------------------------------------------------+ ");
970 mCells[0]->setFocus(); 970 mCells[0]->setFocus();
971} 971}
972 972
973void KOMonthView::resizeEvent(QResizeEvent * e) 973void KOMonthView::resizeEvent(QResizeEvent * e)
974{ 974{
975 computeLayout(); 975 computeLayout();
976 mCells[0]->setFocus();
976} 977}
977void KOMonthView::computeLayout() 978void KOMonthView::computeLayout()
978{ 979{
979 // select the appropriate heading string size. E.g. "Wednesday" or "Wed". 980 // select the appropriate heading string size. E.g. "Wednesday" or "Wed".
980 // note this only changes the text if the requested size crosses the 981 // note this only changes the text if the requested size crosses the
981 // threshold between big enough to support the full name and not big 982 // threshold between big enough to support the full name and not big
982 // enough. 983 // enough.
983 984
984 int daysToShow = 7; 985 int daysToShow = 7;
985 bool combinedSatSun = false; 986 bool combinedSatSun = false;
986 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 987 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
987 daysToShow = 6; 988 daysToShow = 6;
988 combinedSatSun = true; 989 combinedSatSun = true;
989 } 990 }
990 int tWid = topLevelWidget()->size().width(); 991 int tWid = topLevelWidget()->size().width();
991 int tHei = topLevelWidget()->size().height(); 992 int tHei = topLevelWidget()->size().height();
992 993
993 int wid = size().width();//e 994 int wid = size().width();//e
994 int hei = size().height()-1; 995 int hei = size().height()-1;
995 996
996 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 997 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
997 return; 998 return;
998 //qDebug("KOMonthView::computeLayout()------------------------------------ "); 999 //qDebug("KOMonthView::computeLayout()------------------------------------ ");
999 QFontMetrics fm ( mWeekLabels[0]->font() ); 1000 QFontMetrics fm ( mWeekLabels[0]->font() );
1000 int weeklabelwid = fm.width( "888" ); 1001 int weeklabelwid = fm.width( "888" );
1001 wid -= weeklabelwid; 1002 wid -= weeklabelwid;
1002 1003
1003 int colWid = wid / daysToShow; 1004 int colWid = wid / daysToShow;
1004 int lastCol = wid - ( colWid*6 ); 1005 int lastCol = wid - ( colWid*6 );
1005 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1006 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1006 int cellHei = (hei - dayLabelHei) /6; 1007 int cellHei = (hei - dayLabelHei) /6;
1007 int colModulo = wid % daysToShow; 1008 int colModulo = wid % daysToShow;
1008 int rowModulo = (hei- dayLabelHei) % 6; 1009 int rowModulo = (hei- dayLabelHei) % 6;
1009 //qDebug("rowmod %d ", rowModulo); 1010 //qDebug("rowmod %d ", rowModulo);
1010 int i; 1011 int i;
1011 int x,y,w,h; 1012 int x,y,w,h;
1012 x= 0; 1013 x= 0;
1013 y= 0; 1014 y= 0;
1014 w = colWid; 1015 w = colWid;
1015 h = dayLabelHei ; 1016 h = dayLabelHei ;
1016 for ( i = 0; i < 7; i++) { 1017 for ( i = 0; i < 7; i++) {
1017 if ( i == daysToShow-colModulo ) 1018 if ( i == daysToShow-colModulo )
1018 ++w; 1019 ++w;
1019 if ( combinedSatSun ) { 1020 if ( combinedSatSun ) {
1020 if ( i >= daysToShow-1 ) { 1021 if ( i >= daysToShow-1 ) {
1021 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1022 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1022 x -= w/2 ; 1023 x -= w/2 ;
1023 } 1024 }