Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 65 |
1 files changed, 55 insertions, 10 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, | |||
62 | setItem( row, 0, tmp ); | 62 | setItem( row, 0, tmp ); |
63 | setRowHeight( row, 40); | 63 | //setRowHeight( row, 40); |
64 | } | 64 | } |
@@ -161,2 +161,9 @@ void DateBookDayView::keyPressEvent( QKeyEvent *e ) | |||
161 | 161 | ||
162 | void DateBookDayView::setRowStyle( int style ) | ||
163 | { | ||
164 | if (style<0) style = 0; | ||
165 | |||
166 | for (int i=0; i<numRows(); i++) | ||
167 | setRowHeight(i, style*10+20); | ||
168 | } | ||
162 | 169 | ||
@@ -176,2 +183,3 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, | |||
176 | view = new DateBookDayView( ampm, this, "day view" ); | 183 | view = new DateBookDayView( ampm, this, "day view" ); |
184 | |||
177 | connect( header, SIGNAL( dateChanged( int, int, int ) ), | 185 | connect( header, SIGNAL( dateChanged( int, int, int ) ), |
@@ -195,2 +203,14 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, | |||
195 | timeMarker->setTime( QTime::currentTime() ); | 203 | timeMarker->setTime( QTime::currentTime() ); |
204 | rowStyle = -1; // initialize with bogus values | ||
205 | } | ||
206 | |||
207 | void DateBookDay::setJumpToCurTime( bool bJump ) | ||
208 | { | ||
209 | jumpToCurTime = bJump; | ||
210 | } | ||
211 | |||
212 | void DateBookDay::setRowStyle( int style ) | ||
213 | { | ||
214 | if (rowStyle != style) view->setRowStyle( style ); | ||
215 | rowStyle = style; | ||
196 | } | 216 | } |
@@ -259,4 +279,13 @@ void DateBookDay::dateChanged( int y, int m, int d ) | |||
259 | QTableSelection ts; | 279 | QTableSelection ts; |
260 | ts.init( startTime, 0 ); | 280 | |
261 | ts.expandTo( startTime, 0 ); | 281 | if (jumpToCurTime && this->date() == QDate::currentDate()) |
282 | { | ||
283 | ts.init( QTime::currentTime().hour(), 0); | ||
284 | ts.expandTo( QTime::currentTime().hour(), 0); | ||
285 | } else | ||
286 | { | ||
287 | ts.init( startTime, 0 ); | ||
288 | ts.expandTo( startTime, 0 ); | ||
289 | } | ||
290 | |||
262 | dayView()->addSelection( ts ); | 291 | dayView()->addSelection( ts ); |
@@ -265,5 +294,2 @@ void DateBookDay::dateChanged( int y, int m, int d ) | |||
265 | 294 | ||
266 | if (this->date() == QDate::currentDate()) | ||
267 | timeMarker->show(); else timeMarker->hide(); | ||
268 | |||
269 | } | 295 | } |
@@ -401,3 +427,6 @@ void DateBookDay::relayoutPage( bool fromResize ) | |||
401 | 427 | ||
402 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | 428 | if (jumpToCurTime && this->date() == QDate::currentDate()) |
429 | view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour | ||
430 | else | ||
431 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | ||
403 | 432 | ||
@@ -446,3 +475,7 @@ void DateBookDay::relayoutPage( bool fromResize ) | |||
446 | } | 475 | } |
447 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | 476 | |
477 | if (jumpToCurTime && this->date() == QDate::currentDate()) | ||
478 | view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour | ||
479 | else | ||
480 | view->setContentsPos( 0, startTime * view->rowHeight(0) ); | ||
448 | } | 481 | } |
@@ -451,2 +484,5 @@ void DateBookDay::relayoutPage( bool fromResize ) | |||
451 | timeMarker->raise(); //on top of all widgets | 484 | timeMarker->raise(); //on top of all widgets |
485 | if (this->date() == QDate::currentDate()) //only show timeMarker on current day | ||
486 | timeMarker->show(); else timeMarker->hide(); | ||
487 | |||
452 | setUpdatesEnabled( TRUE ); | 488 | setUpdatesEnabled( TRUE ); |
@@ -481,4 +517,13 @@ void DateBookDay::setStartViewTime( int startHere ) | |||
481 | QTableSelection ts; | 517 | QTableSelection ts; |
482 | ts.init( startTime, 0 ); | 518 | |
483 | ts.expandTo( startTime, 0 ); | 519 | if (jumpToCurTime && this->date() == QDate::currentDate())//this should probably be in datebook.cpp where it's called? |
520 | { | ||
521 | ts.init( QTime::currentTime().hour(), 0); | ||
522 | ts.expandTo( QTime::currentTime().hour(), 0); | ||
523 | } else | ||
524 | { | ||
525 | ts.init( startTime, 0 ); | ||
526 | ts.expandTo( startTime, 0 ); | ||
527 | } | ||
528 | |||
484 | dayView()->addSelection( ts ); | 529 | dayView()->addSelection( ts ); |