summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookday.cpp
authorzecke <zecke>2002-06-23 18:18:27 (UTC)
committer zecke <zecke>2002-06-23 18:18:27 (UTC)
commitf0e656b51a2dcee1dec594636cbc1ba8d4b11eef (patch) (unidiff)
tree1eb83b120f8ce404324575799d75c32d4056d1f6 /core/pim/datebook/datebookday.cpp
parent6fd46f6d23538ec6e0f48209f6c0f0d939a2effe (diff)
downloadopie-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) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp65
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
162void 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
207void DateBookDay::setJumpToCurTime( bool bJump )
208{
209 jumpToCurTime = bJump;
210}
211
212void 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 );