author | zecke <zecke> | 2002-06-23 18:18:27 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-23 18:18:27 (UTC) |
commit | f0e656b51a2dcee1dec594636cbc1ba8d4b11eef (patch) (side-by-side diff) | |
tree | 1eb83b120f8ce404324575799d75c32d4056d1f6 /core | |
parent | 6fd46f6d23538ec6e0f48209f6c0f0d939a2effe (diff) | |
download | opie-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 )
-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 @@ -80,6 +80,8 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) aPreset( FALSE ), presetTime( -1 ), startTime( 8 ), // an acceptable default + rowStyle( 0 ), + bJumpToCurTime(FALSE), syncing(FALSE), inSearch(FALSE), alarmCounter(0) @@ -249,6 +251,8 @@ void DateBook::slotSettings() DateBookSettings frmSettings( ampm, this ); frmSettings.setStartTime( startTime ); frmSettings.setAlarmPreset( aPreset, presetTime ); + frmSettings.setJumpToCurTime( bJumpToCurTime ); + frmSettings.setRowStyle( rowStyle ); #if defined (Q_WS_QWS) || defined(_WS_QWS_) frmSettings.showMaximized(); #endif @@ -257,8 +261,12 @@ void DateBook::slotSettings() aPreset = frmSettings.alarmPreset(); 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 ); saveSettings(); @@ -453,6 +461,8 @@ void DateBook::initDay() dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); views->addWidget( dayView, DAY ); dayView->setStartViewTime( startTime ); + dayView->setJumpToCurTime( bJumpToCurTime ); + dayView->setRowStyle( rowStyle ); connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); connect( dayView, SIGNAL( newEvent() ), @@ -547,6 +557,8 @@ void DateBook::loadSettings() startTime = config.readNumEntry("startviewtime", 8); aPreset = config.readBoolEntry("alarmpreset"); presetTime = config.readNumEntry("presettime"); + bJumpToCurTime = config.readBoolEntry("jumptocurtime"); + rowStyle = config.readNumEntry("rowstyle"); } } @@ -558,6 +570,8 @@ void DateBook::saveSettings() configDB.writeEntry("startviewtime",startTime); configDB.writeEntry("alarmpreset",aPreset); configDB.writeEntry("presettime",presetTime); + configDB.writeEntry("jumptocurtime", bJumpToCurTime); + configDB.writeEntry("rowstyle", rowStyle); } void DateBook::newDefaultView(QAction *a) { 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 @@ -114,6 +114,8 @@ private: bool aPreset; // have everything set to alarm? 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 @@ -7,6 +7,7 @@ HEADERS = datebookday.h \ dateentryimpl.h \ datebookdayheaderimpl.h \ datebooksettings.h \ + datebooksettingsbase.h \ datebookweek.h \ datebookweeklst.h \ datebookweekheaderimpl.h \ @@ -20,6 +21,7 @@ SOURCES = main.cpp \ datebook.cpp \ dateentryimpl.cpp \ datebookdayheaderimpl.cpp \ + datebooksettingsbase.cpp \ datebooksettings.cpp \ datebookweek.cpp \ datebookweeklst.cpp \ @@ -31,7 +33,6 @@ SOURCES = main.cpp \ INTERFACES = dateentry.ui \ datebookdayheader.ui \ - datebooksettingsbase.ui \ datebookweekheader.ui \ datebookweeklstheader.ui \ datebookweeklstdayhdr.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 @@ -60,7 +60,7 @@ DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, for ( row = 0; row < numRows(); row++ ) { tmp = new QTableItem( this, QTableItem::Never, QString::null); setItem( row, 0, tmp ); - setRowHeight( row, 40); + //setRowHeight( row, 40); } initHeader(); QObject::connect( qApp, SIGNAL(clockChanged(bool)), @@ -159,6 +159,13 @@ 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); +} //=========================================================================== @@ -174,6 +181,7 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, header = new DateBookDayHeader( startOnMonday, this, "day header" ); 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 ) ) ); connect( view, SIGNAL( sigColWidthChanged() ), @@ -193,6 +201,18 @@ 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; } void DateBookDay::updateView( void ) @@ -257,15 +277,21 @@ void DateBookDay::dateChanged( int y, int m, int d ) relayoutPage(); 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(); - } void DateBookDay::redraw() @@ -399,6 +425,9 @@ void DateBookDay::relayoutPage( bool fromResize ) w->setGeometry( geom ); } + 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) ); @@ -444,11 +473,18 @@ void DateBookDay::relayoutPage( bool fromResize ) w->setGeometry( geom ); } } + + 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) ); } 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; } @@ -479,8 +515,17 @@ void DateBookDay::setStartViewTime( int startHere ) startTime = 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 @@ -41,6 +41,8 @@ public: DateBookDayView( bool hourClock, QWidget *parent, const char *name ); bool whichClock() const; + void setRowStyle( int style ); + public slots: void moveUp(); void moveDown(); @@ -149,6 +151,8 @@ public: int startViewTime() const; void setSelectedWidget( DateBookDayWidget * ); DateBookDayWidget * getSelectedWidget( void ); + void setJumpToCurTime( bool bJump ); + void setRowStyle( int style ); public slots: void setDate( int y, int m, int d ); @@ -181,6 +185,8 @@ private: DateBookDB *db; 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 @@ -133,3 +133,23 @@ void DateBookSettings::slotChangeClock( bool whichClock ) init(); 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 @@ -36,6 +36,11 @@ public: void setAlarmType( int alarmType ); int alarmType() const; + void setJumpToCurTime( bool bJump ); + bool jumpToCurTime() const; + void setRowStyle( int style ); + int rowStyle() const; + private slots: void slot12Hour( int ); void slotChangeClock( bool ); 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 @@ -32,7 +32,7 @@ <rect> <x>0</x> <y>0</y> - <width>232</width> + <width>220</width> <height>290</height> </rect> </property> @@ -46,16 +46,16 @@ <property> <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"> <name>name</name> @@ -73,16 +73,52 @@ <name>title</name> <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"> <name>spacing</name> <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"> <name>name</name> @@ -129,9 +165,10 @@ </widget> </hbox> </widget> - </vbox> + </grid> </widget> - <widget> + </widget> + <widget row="1" column="0" > <class>QGroupBox</class> <property stdset="1"> <name>name</name> @@ -141,16 +178,52 @@ <name>title</name> <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"> <name>spacing</name> <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"> <name>name</name> @@ -209,9 +282,103 @@ </widget> </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> <connection> 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 @@ -27,7 +27,7 @@ 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) { |