summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookweek.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/datebookweek.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweek.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp
index 8435132..933e191 100644
--- a/core/pim/datebook/datebookweek.cpp
+++ b/core/pim/datebook/datebookweek.cpp
@@ -61,51 +61,48 @@ DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday,
viewport()->setBackgroundMode( PaletteBase );
header = new QHeader( this );
header->addLabel( "" );
header->setMovingEnabled( false );
header->setResizeEnabled( false );
header->setClickEnabled( false, 0 );
initNames();
connect( header, SIGNAL(clicked(int)), this, SIGNAL(showDay(int)) );
QObject::connect(qApp, SIGNAL(clockChanged(bool)),
this, SLOT(slotChangeClock(bool)));
QFontMetrics fm( font() );
rowHeight = fm.height()+2;
resizeContents( width(), 24*rowHeight );
}
void DateBookWeekView::initNames()
{
-#warning Please review this ! (eilers)
-
- // Ok, I am Mr. Pedantic, but shouldn't we count until 6 instead of 7, if bOnMonday is false ? (eilers)
static bool bFirst = true;
if ( bFirst ) {
if ( bOnMonday ) {
for ( int i = 1; i<=7; i++ ) {
header->addLabel( Calendar::nameOfDay( i ) );
}
} else {
header->addLabel( Calendar::nameOfDay( 7 ) );
for ( int i = 1; i<7; i++ ) {
header->addLabel( Calendar::nameOfDay( i ) );
}
}
bFirst = false;
} else {
// we are change things...
if ( bOnMonday ) {
for ( int i = 1; i<=7; i++ ) {
header->setLabel( i, Calendar::nameOfDay( i ) );
}
} else {
header->setLabel( 1, Calendar::nameOfDay( 7 ) );
@@ -293,49 +290,48 @@ void DateBookWeekView::drawContents( QPainter *p, int cx, int cy, int cw, int ch
} else {
s = QString::number( t );
if ( s.length() == 1 )
s.prepend( "0" );
}
p->drawText( 1, y+p->fontMetrics().ascent()+1, s );
}
}
QListIterator<DateBookWeekItem> it(items);
for ( ; it.current(); ++it ) {
DateBookWeekItem *i = it.current();
if ( i->geometry().intersects( ur ) ) {
p->setBrush( i->color() );
p->drawRect( i->geometry() );
}
}
}
void DateBookWeekView::resizeEvent( QResizeEvent *e )
{
const int hourWidth = 20;
QScrollView::resizeEvent( e );
-#warning check the geometry i have choosen BRANCH_1_0 (waspe)
//HEAD
/*
int avail = visibleWidth();
header->setGeometry( leftMargin()+frameWidth()+frameRect().left() , frameWidth(),
visibleWidth(), header->sizeHint().height() );
setMargins( 0, header->sizeHint().height(), 0, 0 );
*/
//BRANCH_1_0
int avail = width()-qApp->style().scrollBarExtent().width()-1;
header->setGeometry( 0, 0, avail, header->sizeHint().height() );
setMargins( 0, header->height(), 0, 0 );
header->resizeSection( 0, hourWidth );
int sw = (avail - hourWidth) / 7;
for ( int i = 1; i < 7; i++ )
header->resizeSection( i, sw );
header->resizeSection( 7, avail - hourWidth - sw*6 );
}
void DateBookWeekView::setStartOfWeek( bool bStartOnMonday )
{
bOnMonday = bStartOnMonday;