-rw-r--r-- | core/pim/datebook/datebook.cpp | 14 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 3 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 53 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 20 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.h | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettingsbase.ui | 197 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 2 |
9 files changed, 281 insertions, 21 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index c0d45c9..7dd93a6 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -82,2 +82,4 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) startTime( 8 ), // an acceptable default + rowStyle( 0 ), + bJumpToCurTime(FALSE), syncing(FALSE), @@ -251,2 +253,4 @@ void DateBook::slotSettings() frmSettings.setAlarmPreset( aPreset, presetTime ); + frmSettings.setJumpToCurTime( bJumpToCurTime ); + frmSettings.setRowStyle( rowStyle ); #if defined (Q_WS_QWS) || defined(_WS_QWS_) @@ -259,4 +263,8 @@ void DateBook::slotSettings() startTime = frmSettings.startTime(); + bJumpToCurTime = frmSettings.jumpToCurTime(); + rowStyle = frmSettings.rowStyle(); if ( dayView ) dayView->setStartViewTime( startTime ); + dayView->setJumpToCurTime( bJumpToCurTime ); + dayView->setRowStyle( rowStyle ); if ( weekView ) @@ -455,2 +463,4 @@ void DateBook::initDay() dayView->setStartViewTime( startTime ); + dayView->setJumpToCurTime( bJumpToCurTime ); + dayView->setRowStyle( rowStyle ); connect( this, SIGNAL( newEvent() ), @@ -549,2 +559,4 @@ void DateBook::loadSettings() presetTime = config.readNumEntry("presettime"); + bJumpToCurTime = config.readBoolEntry("jumptocurtime"); + rowStyle = config.readNumEntry("rowstyle"); } @@ -560,2 +572,4 @@ void DateBook::saveSettings() configDB.writeEntry("presettime",presetTime); + configDB.writeEntry("jumptocurtime", bJumpToCurTime); + configDB.writeEntry("rowstyle", rowStyle); } diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index e7be0dd..ba8f97e 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h @@ -116,2 +116,4 @@ private: int startTime; + int rowStyle; + bool bJumpToCurTime; //should jump to current time in dayview? bool ampm; diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index 609b7dc..1db3e3a 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro @@ -9,2 +9,3 @@ HEADERS = datebookday.h \ datebooksettings.h \ + datebooksettingsbase.h \ datebookweek.h \ @@ -22,2 +23,3 @@ SOURCES = main.cpp \ datebookdayheaderimpl.cpp \ + datebooksettingsbase.cpp \ datebooksettings.cpp \ @@ -33,3 +35,2 @@ INTERFACES = dateentry.ui \ datebookdayheader.ui \ - datebooksettingsbase.ui \ datebookweekheader.ui \ 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 ); diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index db0f3b6..be7cc45 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h @@ -43,2 +43,4 @@ public: + void setRowStyle( int style ); + public slots: @@ -151,2 +153,4 @@ public: DateBookDayWidget * getSelectedWidget( void ); + void setJumpToCurTime( bool bJump ); + void setRowStyle( int style ); @@ -183,2 +187,4 @@ private: int startTime; + bool jumpToCurTime; //should we jump to current time in dayview? + int rowStyle; DateBookDayWidget *selectedWidget; //actual selected widget (obviously) diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp index c5d8ac1..49fcd17 100644 --- a/core/pim/datebook/datebooksettings.cpp +++ b/core/pim/datebook/datebooksettings.cpp @@ -135 +135,21 @@ void DateBookSettings::slotChangeClock( bool whichClock ) } + +void DateBookSettings::setJumpToCurTime( bool bJump ) +{ + chkJumpToCurTime->setChecked( bJump ); +} + +bool DateBookSettings::jumpToCurTime() const +{ + return chkJumpToCurTime->isChecked(); +} + +void DateBookSettings::setRowStyle( int style ) +{ + comboRowStyle->setCurrentItem( style ); +} + +int DateBookSettings::rowStyle() const +{ + return comboRowStyle->currentItem(); +} diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index ee9f39c..90a07f9 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h @@ -38,2 +38,7 @@ public: + void setJumpToCurTime( bool bJump ); + bool jumpToCurTime() const; + void setRowStyle( int style ); + int rowStyle() const; + private slots: diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui index 0f40773..816a441 100644 --- a/core/pim/datebook/datebooksettingsbase.ui +++ b/core/pim/datebook/datebooksettingsbase.ui @@ -34,3 +34,3 @@ <y>0</y> - <width>232</width> + <width>220</width> <height>290</height> @@ -48,6 +48,6 @@ </property> - <vbox> + <grid> <property stdset="1"> <name>margin</name> - <number>5</number> + <number>11</number> </property> @@ -55,5 +55,5 @@ <name>spacing</name> - <number>1</number> + <number>6</number> </property> - <widget> + <widget row="0" column="0" > <class>QGroupBox</class> @@ -75,6 +75,21 @@ </property> - <vbox> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout6</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>3</x> + <y>21</y> + <width>210</width> + <height>53</height> + </rect> + </property> + <grid> <property stdset="1"> <name>margin</name> - <number>11</number> + <number>0</number> </property> @@ -84,3 +99,24 @@ </property> - <widget> + <spacer row="1" column="0" > + <property> + <name>name</name> + <cstring>Spacer1</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget row="0" column="0" > <class>QLayoutWidget</class> @@ -131,5 +167,6 @@ </widget> - </vbox> + </grid> </widget> - <widget> + </widget> + <widget row="1" column="0" > <class>QGroupBox</class> @@ -143,6 +180,21 @@ </property> - <vbox> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout4</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>10</x> + <y>20</y> + <width>200</width> + <height>53</height> + </rect> + </property> + <grid> <property stdset="1"> <name>margin</name> - <number>11</number> + <number>0</number> </property> @@ -152,3 +204,24 @@ </property> - <widget> + <spacer row="1" column="0" > + <property> + <name>name</name> + <cstring>Spacer2</cstring> + </property> + <property stdset="1"> + <name>orientation</name> + <enum>Vertical</enum> + </property> + <property stdset="1"> + <name>sizeType</name> + <enum>Expanding</enum> + </property> + <property> + <name>sizeHint</name> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget row="0" column="0" > <class>QLayoutWidget</class> @@ -211,5 +284,99 @@ </widget> - </vbox> + </grid> + </widget> + </widget> + <widget row="2" column="0" > + <class>QGroupBox</class> + <property stdset="1"> + <name>name</name> + <cstring>fraMisc</cstring> + </property> + <property stdset="1"> + <name>title</name> + <string>Misc</string> + </property> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>Layout5</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>10</x> + <y>40</y> + <width>170</width> + <height>24</height> + </rect> + </property> + <hbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Row style:</string> + </property> + </widget> + <widget> + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>Default</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Medium</string> + </property> + </item> + <item> + <property> + <name>text</name> + <string>Large</string> + </property> + </item> + <property stdset="1"> + <name>name</name> + <cstring>comboRowStyle</cstring> + </property> + </widget> + </hbox> + </widget> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>chkJumpToCurTime</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>10</x> + <y>20</y> + <width>200</width> + <height>20</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>Jump to current time (dayview)</string> + </property> + </widget> </widget> - </vbox> + </grid> </widget> diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 8e88377..58a9c53 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -29,3 +29,3 @@ bool calcWeek(const QDate &d, int &week, int &year, -DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, +DateBookWeekLstHeader::DateBookWeekLstHeader(bool /*onM*/, QWidget* parent, const char* name, WFlags fl) |