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
@@ -61,5 +61,5 @@ DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent,
61 tmp = new QTableItem( this, QTableItem::Never, QString::null); 61 tmp = new QTableItem( this, QTableItem::Never, QString::null);
62 setItem( row, 0, tmp ); 62 setItem( row, 0, tmp );
63 setRowHeight( row, 40); 63 //setRowHeight( row, 40);
64 } 64 }
65 initHeader(); 65 initHeader();
@@ -160,4 +160,11 @@ void DateBookDayView::keyPressEvent( QKeyEvent *e )
160} 160}
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
163//=========================================================================== 170//===========================================================================
@@ -175,4 +182,5 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday,
175 header->setDate( currDate.year(), currDate.month(), currDate.day() ); 182 header->setDate( currDate.year(), currDate.month(), currDate.day() );
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 ) ),
178 this, SLOT( dateChanged( int, int, int ) ) ); 186 this, SLOT( dateChanged( int, int, int ) ) );
@@ -194,4 +202,16 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday,
194 timeMarker = new DateBookDayTimeMarker( this ); 202 timeMarker = new DateBookDayTimeMarker( this );
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}
197 217
@@ -258,13 +278,19 @@ void DateBookDay::dateChanged( int y, int m, int d )
258 dayView()->clearSelection(); 278 dayView()->clearSelection();
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 );
263 292
264 selectedWidget = 0; 293 selectedWidget = 0;
265 294
266 if (this->date() == QDate::currentDate())
267 timeMarker->show(); else timeMarker->hide();
268
269} 295}
270 296
@@ -400,5 +426,8 @@ void DateBookDay::relayoutPage( bool fromResize )
400 } 426 }
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
404 433
@@ -445,9 +474,16 @@ void DateBookDay::relayoutPage( bool fromResize )
445 } 474 }
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 }
449 482
450 timeMarker->setTime( QTime::currentTime() );//display timeMarker 483 timeMarker->setTime( QTime::currentTime() );//display timeMarker
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 );
453 return; 489 return;
@@ -480,6 +516,15 @@ void DateBookDay::setStartViewTime( int startHere )
480 dayView()->clearSelection(); 516 dayView()->clearSelection();
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 );
485} 530}