author | zecke <zecke> | 2002-06-23 18:18:27 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-23 18:18:27 (UTC) |
commit | f0e656b51a2dcee1dec594636cbc1ba8d4b11eef (patch) (side-by-side diff) | |
tree | 1eb83b120f8ce404324575799d75c32d4056d1f6 /core/pim/datebook/datebookday.cpp | |
parent | 6fd46f6d23538ec6e0f48209f6c0f0d939a2effe (diff) | |
download | opie-f0e656b51a2dcee1dec594636cbc1ba8d4b11eef.zip opie-f0e656b51a2dcee1dec594636cbc1ba8d4b11eef.tar.gz opie-f0e656b51a2dcee1dec594636cbc1ba8d4b11eef.tar.bz2 |
Patch by <tboc@gmx.de> to configure the size
of the row of the dayview
Adds an option to jump to the current time in the dayview
and some small fixes ( zecke )
Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index c15ccef..9cc5fcd 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp @@ -62,3 +62,3 @@ DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, setItem( row, 0, tmp ); - setRowHeight( row, 40); + //setRowHeight( row, 40); } @@ -161,2 +161,9 @@ void DateBookDayView::keyPressEvent( QKeyEvent *e ) +void DateBookDayView::setRowStyle( int style ) +{ + if (style<0) style = 0; + + for (int i=0; i<numRows(); i++) + setRowHeight(i, style*10+20); +} @@ -176,2 +183,3 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, view = new DateBookDayView( ampm, this, "day view" ); + connect( header, SIGNAL( dateChanged( int, int, int ) ), @@ -195,2 +203,14 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, timeMarker->setTime( QTime::currentTime() ); + rowStyle = -1; // initialize with bogus values +} + +void DateBookDay::setJumpToCurTime( bool bJump ) +{ + jumpToCurTime = bJump; +} + +void DateBookDay::setRowStyle( int style ) +{ + if (rowStyle != style) view->setRowStyle( style ); + rowStyle = style; } @@ -259,4 +279,13 @@ void DateBookDay::dateChanged( int y, int m, int d ) QTableSelection ts; + + if (jumpToCurTime && this->date() == QDate::currentDate()) + { + ts.init( QTime::currentTime().hour(), 0); + ts.expandTo( QTime::currentTime().hour(), 0); + } else + { ts.init( startTime, 0 ); ts.expandTo( startTime, 0 ); + } + dayView()->addSelection( ts ); @@ -265,5 +294,2 @@ void DateBookDay::dateChanged( int y, int m, int d ) - if (this->date() == QDate::currentDate()) - timeMarker->show(); else timeMarker->hide(); - } @@ -401,2 +427,5 @@ void DateBookDay::relayoutPage( bool fromResize ) + if (jumpToCurTime && this->date() == QDate::currentDate()) + view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour + else view->setContentsPos( 0, startTime * view->rowHeight(0) ); @@ -446,2 +475,6 @@ void DateBookDay::relayoutPage( bool fromResize ) } + + if (jumpToCurTime && this->date() == QDate::currentDate()) + view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour + else view->setContentsPos( 0, startTime * view->rowHeight(0) ); @@ -451,2 +484,5 @@ void DateBookDay::relayoutPage( bool fromResize ) timeMarker->raise(); //on top of all widgets + if (this->date() == QDate::currentDate()) //only show timeMarker on current day + timeMarker->show(); else timeMarker->hide(); + setUpdatesEnabled( TRUE ); @@ -481,4 +517,13 @@ void DateBookDay::setStartViewTime( int startHere ) QTableSelection ts; + + if (jumpToCurTime && this->date() == QDate::currentDate()) //this should probably be in datebook.cpp where it's called? + { + ts.init( QTime::currentTime().hour(), 0); + ts.expandTo( QTime::currentTime().hour(), 0); + } else + { ts.init( startTime, 0 ); ts.expandTo( startTime, 0 ); + } + dayView()->addSelection( ts ); |