summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebookday.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/datebookday.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp53
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 );