-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 @@ -81,4 +81,6 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) presetTime( -1 ), startTime( 8 ), // an acceptable default + rowStyle( 0 ), + bJumpToCurTime(FALSE), syncing(FALSE), inSearch(FALSE), @@ -250,4 +252,6 @@ void DateBook::slotSettings() frmSettings.setStartTime( startTime ); frmSettings.setAlarmPreset( aPreset, presetTime ); + frmSettings.setJumpToCurTime( bJumpToCurTime ); + frmSettings.setRowStyle( rowStyle ); #if defined (Q_WS_QWS) || defined(_WS_QWS_) frmSettings.showMaximized(); @@ -258,6 +262,10 @@ void DateBook::slotSettings() presetTime = frmSettings.presetTime(); startTime = frmSettings.startTime(); + bJumpToCurTime = frmSettings.jumpToCurTime(); + rowStyle = frmSettings.rowStyle(); if ( dayView ) dayView->setStartViewTime( startTime ); + dayView->setJumpToCurTime( bJumpToCurTime ); + dayView->setRowStyle( rowStyle ); if ( weekView ) weekView->setStartViewTime( startTime ); @@ -454,4 +462,6 @@ void DateBook::initDay() views->addWidget( dayView, DAY ); dayView->setStartViewTime( startTime ); + dayView->setJumpToCurTime( bJumpToCurTime ); + dayView->setRowStyle( rowStyle ); connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); @@ -548,4 +558,6 @@ void DateBook::loadSettings() aPreset = config.readBoolEntry("alarmpreset"); presetTime = config.readNumEntry("presettime"); + bJumpToCurTime = config.readBoolEntry("jumptocurtime"); + rowStyle = config.readNumEntry("rowstyle"); } } @@ -559,4 +571,6 @@ void DateBook::saveSettings() configDB.writeEntry("alarmpreset",aPreset); 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 @@ -115,4 +115,6 @@ private: int presetTime; // the standard time for the alarm int startTime; + int rowStyle; + bool bJumpToCurTime; //should jump to current time in dayview? bool ampm; bool onMonday; 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 @@ -8,4 +8,5 @@ HEADERS = datebookday.h \ datebookdayheaderimpl.h \ datebooksettings.h \ + datebooksettingsbase.h \ datebookweek.h \ datebookweeklst.h \ @@ -21,4 +22,5 @@ SOURCES = main.cpp \ dateentryimpl.cpp \ datebookdayheaderimpl.cpp \ + datebooksettingsbase.cpp \ datebooksettings.cpp \ datebookweek.cpp \ @@ -32,5 +34,4 @@ SOURCES = main.cpp \ INTERFACES = dateentry.ui \ datebookdayheader.ui \ - datebooksettingsbase.ui \ datebookweekheader.ui \ datebookweeklstheader.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 @@ -61,5 +61,5 @@ DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, tmp = new QTableItem( this, QTableItem::Never, QString::null); setItem( row, 0, tmp ); - setRowHeight( row, 40); + //setRowHeight( row, 40); } initHeader(); @@ -160,4 +160,11 @@ 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); +} //=========================================================================== @@ -175,4 +182,5 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, header->setDate( currDate.year(), currDate.month(), currDate.day() ); view = new DateBookDayView( ampm, this, "day view" ); + connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); @@ -194,4 +202,16 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, timeMarker = new DateBookDayTimeMarker( this ); 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; } @@ -258,13 +278,19 @@ void DateBookDay::dateChanged( int y, int m, int d ) dayView()->clearSelection(); 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 ); selectedWidget = 0; - if (this->date() == QDate::currentDate()) - timeMarker->show(); else timeMarker->hide(); - } @@ -400,4 +426,7 @@ 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) ); @@ -445,4 +474,8 @@ 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) ); } @@ -450,4 +483,7 @@ void DateBookDay::relayoutPage( bool fromResize ) timeMarker->setTime( QTime::currentTime() ); //display timeMarker 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 ); return; @@ -480,6 +516,15 @@ void DateBookDay::setStartViewTime( int startHere ) dayView()->clearSelection(); 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 @@ -42,4 +42,6 @@ public: bool whichClock() const; + void setRowStyle( int style ); + public slots: void moveUp(); @@ -150,4 +152,6 @@ public: void setSelectedWidget( DateBookDayWidget * ); DateBookDayWidget * getSelectedWidget( void ); + void setJumpToCurTime( bool bJump ); + void setRowStyle( int style ); public slots: @@ -182,4 +186,6 @@ private: WidgetListClass widgetList; //reimplemented QList for sorting widgets by height int startTime; + bool jumpToCurTime; //should we jump to current time in dayview? + int rowStyle; DateBookDayWidget *selectedWidget; //actual selected widget (obviously) DateBookDayTimeMarker *timeMarker; //marker for current time 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 @@ -134,2 +134,22 @@ void DateBookSettings::slotChangeClock( bool whichClock ) setStartTime( saveMe ); } + +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 @@ -37,4 +37,9 @@ public: int alarmType() const; + void setJumpToCurTime( bool bJump ); + bool jumpToCurTime() const; + void setRowStyle( int style ); + int rowStyle() const; + private slots: void slot12Hour( int ); 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 @@ -33,5 +33,5 @@ <x>0</x> <y>0</y> - <width>232</width> + <width>220</width> <height>290</height> </rect> @@ -47,14 +47,14 @@ <name>layoutSpacing</name> </property> - <vbox> + <grid> <property stdset="1"> <name>margin</name> - <number>5</number> + <number>11</number> </property> <property stdset="1"> <name>spacing</name> - <number>1</number> + <number>6</number> </property> - <widget> + <widget row="0" column="0" > <class>QGroupBox</class> <property stdset="1"> @@ -74,8 +74,23 @@ <string>Start viewing events</string> </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> <property stdset="1"> @@ -83,5 +98,26 @@ <number>6</number> </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> <property stdset="1"> @@ -130,7 +166,8 @@ </hbox> </widget> - </vbox> + </grid> </widget> - <widget> + </widget> + <widget row="1" column="0" > <class>QGroupBox</class> <property stdset="1"> @@ -142,8 +179,23 @@ <string>Alarm Settings</string> </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> <property stdset="1"> @@ -151,5 +203,26 @@ <number>6</number> </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> <property stdset="1"> @@ -210,7 +283,101 @@ </hbox> </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> <connections> 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 @@ -28,5 +28,5 @@ bool calcWeek(const QDate &d, int &week, int &year, bool startOnMonday = false); -DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, +DateBookWeekLstHeader::DateBookWeekLstHeader(bool /*onM*/, QWidget* parent, const char* name, WFlags fl) : DateBookWeekLstHeaderBase(parent, name, fl) |