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) (side-by-side diff)
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
@@ -1524,7 +1524,8 @@ void KOMonthView::updateConfig()
if ( ! mShowWeekView ) {
if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
computeLayout();
- }
+ } else
+ doComputeLayoutWeek();
updateDayLabels();
//qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
//int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
@@ -1815,7 +1816,8 @@ void KOMonthView::resizeEvent(QResizeEvent * e)
slotComputeLayout();
} else
mComputeLayoutTimer->start( 100 );
- KOEventView::resizeEvent( e );
+ if ( e )
+ KOEventView::resizeEvent( e );
}
void KOMonthView::slotComputeLayout()
@@ -1826,37 +1828,27 @@ void KOMonthView::slotComputeLayout()
clPending = true;
setKeyBFocus();
}
-void KOMonthView::computeLayoutWeek()
+
+void KOMonthView::doComputeLayoutWeek()
{
- static int lastWid = 0;
- static int lastHei = 0;
+
int daysToShow;
bool combinedSatSun = false;
if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
daysToShow = 6;
combinedSatSun = true;
}
- int tWid = topLevelWidget()->size().width();
- int tHei = topLevelWidget()->size().height();
-
int wid = width();//e
int hei = height()-1-mNavigatorBar->height();
-
- if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
- return;
-
- if ( lastWid == width() && lastHei == height() ) {
- //qDebug("KOListWeekView::No compute layout needed ");
- return;
- }
- lastWid = width();
- lastHei = height();
-
-
- if ( wid < hei )
+ if ( !KOPrefs::instance()->mMonthViewWeekRowlayout ) {
daysToShow = 2;
- else
- daysToShow = 3;
+ } else {
+ if ( wid < hei )
+ daysToShow = 2;
+ else
+ daysToShow = 3;
+ }
+ bool landscape = (daysToShow == 3);
mShowSatSunComp = true;
combinedSatSun = true;
@@ -1886,12 +1878,19 @@ void KOMonthView::computeLayoutWeek()
if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
++w;
}
+ int xC,yC,wC,hC;
if ( i >= 5 ) {
int wi = width() - x - weeklabelwid;
if ( i == 5 ) {
- mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h);
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = wi/2+wi%2;
+ hC = h;
} else {
- mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = wi;
+ hC = h;
}
x = x - w + wi - (wi/2 );
}
@@ -1900,8 +1899,14 @@ void KOMonthView::computeLayoutWeek()
if ( !(( i+1) % daysToShow)) {
wi = width() - x - weeklabelwid;
}
- mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = wi;
+ hC = h;
}
+ mDayLabelsW[mapWeekLayout(i,landscape)]->setGeometry( xC,yC,wC,hC);
+
+
x += w;
}
x= 0;
@@ -1923,23 +1928,34 @@ void KOMonthView::computeLayoutWeek()
if ( i == (daysToShow-1-rowModulo)*7)
++h;
+ int xC,yC,wC,hC;
if ( i >= 5 ) {
if ( i ==5 ) {
max = h/2;
- mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = w;
+ hC = max;
x -= w ;y += h/2;
} else {
if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
++w;
}
max = h-h/2;
- mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = w;
+ hC = max;
y -= h/2;
}
} else {
max = h;
- mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
+ xC = x+weeklabelwid;
+ yC = y;
+ wC = w;
+ hC = h;
}
+ mCellsW[mapWeekLayout(i,landscape)]->setGeometry ( xC,yC,wC,hC );
x += w;
@@ -1963,6 +1979,56 @@ void KOMonthView::computeLayoutWeek()
//if ( forceUpdate )
// updateView();
}
+void KOMonthView::computeLayoutWeek()
+{
+ static int lastWid = 0;
+ static int lastHei = 0;
+ int tWid = topLevelWidget()->size().width();
+ int tHei = topLevelWidget()->size().height();
+ int wid = width();//e
+ int hei = height()-1-mNavigatorBar->height();
+ if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
+ return;
+
+ if ( lastWid == width() && lastHei == height() ) {
+ //qDebug("KOListWeekView::No compute layout needed ");
+ return;
+ }
+ lastWid = width();
+ lastHei = height();
+ doComputeLayoutWeek();
+}
+int KOMonthView::mapWeekLayout( int index, bool landscape )
+{
+ if ( KOPrefs::instance()->mMonthViewWeekRowlayout )
+ return index;
+ int diff = 0;
+ if ( !landscape ) diff = 1;
+ switch( index ) {
+ case 0:
+ case 5:
+ case 6:
+ return index;
+ break;
+ case 1:
+ return 2+diff;
+ break;
+ case 2:
+ return 4-(3*diff);
+ break;
+ case 3:
+ return 1+(3*diff);
+ break;
+ case 4:
+ return 3-diff;
+ break;
+ default:
+ qDebug("KO: Error in mapping week layout ");
+ return index;
+ break;
+ }
+ return index;
+}
void KOMonthView::computeLayout()
{