-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 | 65 | ||||
-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 | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettingsbase.ui | 371 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 64 |
9 files changed, 406 insertions, 146 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 @@ -75,16 +75,18 @@ #define MONTH 3 DateBook::DateBook( QWidget *parent, const char *, WFlags f ) : QMainWindow( parent, "datebook", f ), aPreset( FALSE ), presetTime( -1 ), startTime( 8 ), // an acceptable default + rowStyle( 0 ), + bJumpToCurTime(FALSE), syncing(FALSE), inSearch(FALSE), alarmCounter(0) { QTime t; t.start(); db = new DateBookDBHack; qDebug("loading db t=%d", t.elapsed() ); @@ -244,26 +246,32 @@ DateBook::~DateBook() { } 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 if ( frmSettings.exec() ) { 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(); // make the change obvious if ( views->visibleWidget() ) { if ( views->visibleWidget() == dayView ) dayView->redraw(); @@ -448,16 +456,18 @@ void DateBook::showDay( int year, int month, int day ) } void DateBook::initDay() { if ( !dayView ) { 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() ), this, SLOT( fileNew() ) ); connect( dayView, SIGNAL( removeEvent( const Event & ) ), this, SLOT( removeEvent( const Event & ) ) ); connect( dayView, SIGNAL( editEvent( const Event & ) ), this, SLOT( editEvent( const Event & ) ) ); @@ -542,27 +552,31 @@ void DateBook::loadSettings() } { Config config("DateBook"); config.setGroup("Main"); startTime = config.readNumEntry("startviewtime", 8); aPreset = config.readBoolEntry("alarmpreset"); presetTime = config.readNumEntry("presettime"); + bJumpToCurTime = config.readBoolEntry("jumptocurtime"); + rowStyle = config.readNumEntry("rowstyle"); } } void DateBook::saveSettings() { Config config( "qpe" ); Config configDB( "DateBook" ); configDB.setGroup( "Main" ); 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) { int val=DAY; if (a->text() == "Day") val=DAY; if (a->text() == "Week") val=WEEK; if (a->text() == "WeekLst") val=WEEKLST; if (a->text() == "Month") val=MONTH; 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 @@ -109,16 +109,18 @@ private: DateBookDay *dayView; DateBookWeek *weekView; DateBookMonth *monthView; DateBookWeekLst *weekLstView; QAction *dayAction, *weekAction, *weekLstAction, *monthAction; 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; bool syncing; bool inSearch; int alarmCounter; 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 @@ -2,41 +2,42 @@ TEMPLATE = app CONFIG += qt warn_on release DESTDIR = $(OPIEDIR)/bin HEADERS = datebookday.h \ datebook.h \ dateentryimpl.h \ datebookdayheaderimpl.h \ datebooksettings.h \ + datebooksettingsbase.h \ datebookweek.h \ datebookweeklst.h \ datebookweekheaderimpl.h \ repeatentry.h \ timepicker.h \ noteentryimpl.h \ onoteedit.h SOURCES = main.cpp \ datebookday.cpp \ datebook.cpp \ dateentryimpl.cpp \ datebookdayheaderimpl.cpp \ + datebooksettingsbase.cpp \ datebooksettings.cpp \ datebookweek.cpp \ datebookweeklst.cpp \ datebookweekheaderimpl.cpp \ repeatentry.cpp \ timepicker.cpp \ noteentryimpl.cpp \ onoteedit.cpp INTERFACES = dateentry.ui \ datebookdayheader.ui \ - datebooksettingsbase.ui \ datebookweekheader.ui \ datebookweeklstheader.ui \ datebookweeklstdayhdr.ui \ repeatentrybase.ui \ noteentry.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include 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 @@ -55,17 +55,17 @@ DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent, setSelectionMode( Single ); // get rid of being able to edit things... QTableItem *tmp; int row; 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)), this, SLOT(slotChangeClock(bool)) ); } void DateBookDayView::initHeader() { @@ -154,31 +154,39 @@ void DateBookDayView::keyPressEvent( QKeyEvent *e ) e->accept(); emit sigCapturedKey( txt ); } else { // I don't know what this key is, do you? e->ignore(); } } +void DateBookDayView::setRowStyle( int style ) +{ + if (style<0) style = 0; + + for (int i=0; i<numRows(); i++) + setRowHeight(i, style*10+20); +} //=========================================================================== DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWidget *parent, const char *name ) : QVBox( parent, name ), currDate( QDate::currentDate() ), db( newDb ), startTime( 0 ) { widgetList.setAutoDelete( true ); 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() ), this, SLOT( slotColWidthChanged() ) ); connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(slotWeekChanged(bool)) ); connect( view, SIGNAL(sigCapturedKey(const QString &)), this, SIGNAL(sigNewEvent(const QString&)) ); @@ -188,16 +196,28 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, connect( timer, SIGNAL(timeout()), this, SLOT(updateView()) ); //connect timer for updating timeMarker & daywidgetcolors timer->start( 1000*60*5, FALSE ); //update every 5min selectedWidget = 0; 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 ) { timeMarker->setTime( QTime::currentTime() ); //need to find a way to update all DateBookDayWidgets } @@ -252,25 +272,31 @@ void DateBookDay::dateChanged( int y, int m, int d ) { QDate date( y, m, d ); if ( currDate == date ) return; currDate.setYMD( y, m, d ); relayoutPage(); dayView()->clearSelection(); QTableSelection ts; - ts.init( startTime, 0 ); - ts.expandTo( startTime, 0 ); + + 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() { if ( isUpdatesEnabled() ) relayoutPage(); } @@ -394,17 +420,20 @@ void DateBookDay::relayoutPage( bool fromResize ) geom.setWidth( wd ); while ( intersects( w, geom ) ) { geom.moveBy( wd + 2 + 1, 0 ); } w->setGeometry( geom ); } - view->setContentsPos( 0, startTime * view->rowHeight(0) ); + 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) ); } else { int hours[24]; memset( hours, 0, 24*sizeof( int ) ); bool overFlow = FALSE; @@ -439,21 +468,28 @@ void DateBookDay::relayoutPage( bool fromResize ) int xp = place( w, used, n ); if ( xp != -1 ) { QRect geom = w->geometry(); geom.setX( xp*(wid+2) ); geom.setWidth( wid ); w->setGeometry( geom ); } } - view->setContentsPos( 0, startTime * view->rowHeight(0) ); + + 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; } DateBookDayWidget *DateBookDay::intersects( const DateBookDayWidget *item, const QRect &geom ) { int i = 0; DateBookDayWidget *w = widgetList.at(i); @@ -474,18 +510,27 @@ QDate DateBookDay::date() const return currDate; } void DateBookDay::setStartViewTime( int startHere ) { startTime = startHere; dayView()->clearSelection(); QTableSelection ts; - ts.init( startTime, 0 ); - ts.expandTo( startTime, 0 ); + + 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 ); } int DateBookDay::startViewTime() const { return startTime; } 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 @@ -35,16 +35,18 @@ class QPaintEvent; class QResizeEvent; class DateBookDayView : public QTable { Q_OBJECT public: DateBookDayView( bool hourClock, QWidget *parent, const char *name ); bool whichClock() const; + + void setRowStyle( int style ); public slots: void moveUp(); void moveDown(); signals: void sigColWidthChanged(); void sigCapturedKey( const QString &txt ); @@ -144,16 +146,18 @@ public: QWidget *parent, const char *name ); void selectedDates( QDateTime &start, QDateTime &end ); QDate date() const; DateBookDayView *dayView() const { return view; } void setStartViewTime( int startHere ); 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 ); void setDate( QDate ); void redraw(); void slotWeekChanged( bool bStartOnMonday ); void updateView(); //updates TimeMarker and DayWidget-colors @@ -176,13 +180,15 @@ private: void relayoutPage( bool fromResize = false ); DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); QDate currDate; DateBookDayView *view; DateBookDayHeader *header; 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 }; #endif 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 @@ -128,8 +128,28 @@ void DateBookSettings::slotChangeClock( bool whichClock ) } else if ( ampm && spinStart->suffix().contains( tr("PM"), FALSE ) ) { if ( saveMe != 12 ) saveMe += 12; } ampm = 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 @@ -30,17 +30,22 @@ public: ~DateBookSettings(); void setStartTime( int newStartViewTime ); int startTime() const; void setAlarmPreset( bool bAlarm, int presetTime ); bool alarmPreset() const; int presetTime() const; 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 ); private: void init(); bool ampm; int oldtime; 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 @@ -27,40 +27,40 @@ <name>name</name> <cstring>DateBookSettingsBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>232</width> + <width>220</width> <height>290</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Preferences</string> </property> <property> <name>layoutMargin</name> </property> <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> <cstring>fraStart</cstring> </property> <property stdset="1"> <name>frameShape</name> <enum>Box</enum> @@ -68,155 +68,322 @@ <property stdset="1"> <name>frameShadow</name> <enum>Sunken</enum> </property> <property stdset="1"> <name>title</name> <string>Start viewing events</string> </property> - <vbox> + <widget> + <class>QLayoutWidget</class> <property stdset="1"> - <name>margin</name> - <number>11</number> + <name>name</name> + <cstring>Layout6</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>geometry</name> + <rect> + <x>3</x> + <y>21</y> + <width>210</width> + <height>53</height> + </rect> </property> - <widget> - <class>QLayoutWidget</class> + <grid> <property stdset="1"> - <name>name</name> - <cstring>Layout1</cstring> + <name>margin</name> + <number>0</number> </property> - <hbox> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <spacer row="1" column="0" > + <property> + <name>name</name> + <cstring>Spacer1</cstring> + </property> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>orientation</name> + <enum>Vertical</enum> </property> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>sizeType</name> + <enum>Expanding</enum> </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>lblStartTime</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Start Time:</string> - </property> - </widget> - <widget> - <class>QSpinBox</class> - <property stdset="1"> - <name>name</name> - <cstring>spinStart</cstring> - </property> - <property stdset="1"> - <name>suffix</name> - <string>:00</string> - </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> + <cstring>Layout1</cstring> + </property> + <hbox> <property stdset="1"> - <name>wrapping</name> - <bool>true</bool> + <name>margin</name> + <number>0</number> </property> <property stdset="1"> - <name>maxValue</name> - <number>23</number> + <name>spacing</name> + <number>6</number> </property> - </widget> - </hbox> - </widget> - </vbox> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>lblStartTime</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Start Time:</string> + </property> + </widget> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>spinStart</cstring> + </property> + <property stdset="1"> + <name>suffix</name> + <string>:00</string> + </property> + <property stdset="1"> + <name>wrapping</name> + <bool>true</bool> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>23</number> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> </widget> - <widget> + <widget row="1" column="0" > <class>QGroupBox</class> <property stdset="1"> <name>name</name> <cstring>fraAlarm</cstring> </property> <property stdset="1"> <name>title</name> <string>Alarm Settings</string> </property> - <vbox> + <widget> + <class>QLayoutWidget</class> <property stdset="1"> - <name>margin</name> - <number>11</number> + <name>name</name> + <cstring>Layout4</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>geometry</name> + <rect> + <x>10</x> + <y>20</y> + <width>200</width> + <height>53</height> + </rect> </property> - <widget> - <class>QLayoutWidget</class> + <grid> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> <property stdset="1"> - <name>name</name> - <cstring>Layout6</cstring> + <name>spacing</name> + <number>6</number> </property> - <hbox> + <spacer row="1" column="0" > + <property> + <name>name</name> + <cstring>Spacer2</cstring> + </property> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>orientation</name> + <enum>Vertical</enum> </property> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>sizeType</name> + <enum>Expanding</enum> </property> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>chkAlarmPreset</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Alarm Preset</string> - </property> - </widget> - <widget> - <class>QSpinBox</class> - <property stdset="1"> - <name>name</name> - <cstring>spinPreset</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </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> + <cstring>Layout6</cstring> + </property> + <hbox> <property stdset="1"> - <name>suffix</name> - <string> minutes</string> + <name>margin</name> + <number>0</number> </property> <property stdset="1"> - <name>maxValue</name> - <number>180</number> + <name>spacing</name> + <number>6</number> </property> - <property stdset="1"> - <name>minValue</name> - <number>0</number> + <widget> + <class>QCheckBox</class> + <property stdset="1"> + <name>name</name> + <cstring>chkAlarmPreset</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Alarm Preset</string> + </property> + </widget> + <widget> + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>spinPreset</cstring> + </property> + <property stdset="1"> + <name>enabled</name> + <bool>false</bool> + </property> + <property stdset="1"> + <name>suffix</name> + <string> minutes</string> + </property> + <property stdset="1"> + <name>maxValue</name> + <number>180</number> + </property> + <property stdset="1"> + <name>minValue</name> + <number>0</number> + </property> + <property stdset="1"> + <name>lineStep</name> + <number>5</number> + </property> + <property stdset="1"> + <name>value</name> + <number>5</number> + </property> + </widget> + </hbox> + </widget> + </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> - <property stdset="1"> - <name>lineStep</name> - <number>5</number> + </item> + <item> + <property> + <name>text</name> + <string>Medium</string> </property> - <property stdset="1"> - <name>value</name> - <number>5</number> + </item> + <item> + <property> + <name>text</name> + <string>Large</string> </property> - </widget> - </hbox> - </widget> - </vbox> + </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> <sender>chkAlarmPreset</sender> <signal>toggled(bool)</signal> <receiver>spinPreset</receiver> <slot>setEnabled(bool)</slot> </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 @@ -15,24 +15,24 @@ #include <qlabel.h> #include <qlayout.h> #include <qpainter.h> #include <qpopupmenu.h> #include <qtimer.h> #include <qstyle.h> #include <qtoolbutton.h> #include <qvbox.h> -#include <qsizepolicy.h> -#include <qabstractlayout.h> +#include <qsizepolicy.h> +#include <qabstractlayout.h> #include <qtl.h> 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) { setBackgroundMode( PaletteButton ); labelDate->setBackgroundMode( PaletteButton ); labelWeek->setBackgroundMode( PaletteButton ); forward->setBackgroundMode( PaletteButton ); back->setBackgroundMode( PaletteButton ); @@ -49,22 +49,22 @@ DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent, } DateBookWeekLstHeader::~DateBookWeekLstHeader(){} void DateBookWeekLstHeader::setDate(const QDate &d) { date=d; int year,week; calcWeek(d,week,year,onMonday); labelWeek->setText("W: " + QString::number(week)); - + QDate start=date; QDate stop=start.addDays(6); - labelDate->setText( QString::number(start.day()) + " " + + labelDate->setText( QString::number(start.day()) + " " + start.monthName(start.month()) + " - " + - QString::number(stop.day()) + " " + + QString::number(stop.day()) + " " + start.monthName(stop.month()) ); emit dateChanged(year,week); } void DateBookWeekLstHeader::pickDate() { static QPopupMenu *m1 = 0; static DateBookMonth *picker = 0; if ( !m1 ) { m1 = new QPopupMenu( this ); @@ -87,35 +87,35 @@ void DateBookWeekLstHeader::setDate(int y, int m, int d) { void DateBookWeekLstHeader::nextWeek() { setDate(date.addDays(7)); } void DateBookWeekLstHeader::prevWeek() { setDate(date.addDays(-7)); } DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool onM, - QWidget* parent, - const char* name, - WFlags fl ) + QWidget* parent, + const char* name, + WFlags fl ) : DateBookWeekLstDayHdrBase(parent, name, fl) { date=d; static const char *wdays="MTWTFSS"; char day=wdays[d.dayOfWeek()-1]; - label->setText( QString(QChar(day)) + " " + + label->setText( QString(QChar(day)) + " " + QString::number(d.day()) ); add->setText("+"); if (d == QDate::currentDate()) { QPalette pal=label->palette(); pal.setColor(QColorGroup::Foreground, QColor(0,0,255)); label->setPalette(pal); - + /* QFont f=label->font(); f.setItalic(true); label->setFont(f); label->setPalette(QPalette(QColor(0,0,255),label->backgroundColor())); */ } else if (d.dayOfWeek() == 7) { // FIXME: Match any holiday QPalette pal=label->palette(); @@ -134,19 +134,19 @@ void DateBookWeekLstDayHdr::showDay() { void DateBookWeekLstDayHdr::newEvent() { QDateTime start, stop; start=stop=date; start.setTime(QTime(10,0)); stop.setTime(QTime(12,0)); emit addEvent(start,stop,""); } -DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, - QWidget* parent, - const char* name, +DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, + QWidget* parent, + const char* name, WFlags fl) : OClickableLabel(parent,name,fl), event(ev) { char s[10]; if ( ev.startDate() != ev.date() ) { // multiday event (not first day) if ( ev.endDate() == ev.date() ) { // last day strcpy(s, "__|__"); @@ -160,73 +160,73 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, connect(this, SIGNAL(clicked()), this, SLOT(editMe())); setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); } void DateBookWeekLstEvent::editMe() { emit editEvent(event.event()); } -DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, +DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, const QDate &d, bool onM, - QWidget* parent, + QWidget* parent, const char* name, WFlags fl) : QWidget( parent, name, fl ) { onMonday=onM; setPalette(white); setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); QVBoxLayout *layout = new QVBoxLayout( this ); - + qBubbleSort(ev); QValueListIterator<EffectiveEvent> it; it=ev.begin(); int dayOrder[7]; - if (onMonday) + if (onMonday) for (int d=0; d<7; d++) dayOrder[d]=d+1; else { for (int d=0; d<7; d++) dayOrder[d]=d; dayOrder[0]=7; } for (int i=0; i<7; i++) { // Header DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), onMonday,this); - connect(hdr, SIGNAL(showDate(int,int,int)), + connect(hdr, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); - connect(hdr, SIGNAL(addEvent(const QDateTime &, + connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, - const QString &)), - this, SIGNAL(addEvent(const QDateTime &, + const QString &)), + this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &))); layout->addWidget(hdr); - + // Events while ( (*it).date().dayOfWeek() == dayOrder[i] && it!=ev.end() ) { DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this); layout->addWidget(l); connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &))); it++; } - + layout->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); } } DateBookWeekLstView::~DateBookWeekLstView(){} void DateBookWeekLstView::keyPressEvent(QKeyEvent *e) {e->ignore();} -DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, - QValueList<EffectiveEvent> &ev2, +DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, + QValueList<EffectiveEvent> &ev2, QDate &d, bool onM, - QWidget* parent, + QWidget* parent, const char* name, WFlags fl) : QWidget( parent, name, fl ) { QHBoxLayout *layout = new QHBoxLayout( this ); DateBookWeekLstView *w=new DateBookWeekLstView(ev1,d,onM,this); layout->addWidget(w); connect (w, SIGNAL(editEvent(const Event &)), @@ -246,35 +246,35 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1, connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int))); connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &)), this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &))); } -DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, - QWidget *parent, +DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB, + QWidget *parent, const char *name ) : QWidget( parent, name ), db( newDB ), startTime( 0 ), ampm( ap ), onMonday(onM) { setFocusPolicy(StrongFocus); layout = new QVBoxLayout( this ); layout->setMargin(0); header=new DateBookWeekLstHeader(onM, this); layout->addWidget( header ); - connect(header, SIGNAL(dateChanged(int,int)), + connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int))); connect(header, SIGNAL(setDbl(bool)), - this, SLOT(setDbl(bool))); + this, SLOT(setDbl(bool))); scroll=new QScrollView(this); //scroll->setVScrollBarMode(QScrollView::AlwaysOn); //scroll->setHScrollBarMode(QScrollView::AlwaysOff); scroll->setResizePolicy(QScrollView::AutoOneFit); layout->addWidget(scroll); view=NULL; @@ -305,17 +305,17 @@ void DateBookWeekLst::redraw() {getEvents();} QDate DateBookWeekLst::date() const { QDate d; d.setYMD(year,1,1); int dow= d.dayOfWeek(); if (!onMonday) if (dow==7) dow=1; else dow++; - + d=d.addDays( (_week-1)*7 - dow + 1 ); return d; } void DateBookWeekLst::getEvents() { QDate start = date(); QDate stop = start.addDays(6); QValueList<EffectiveEvent> el = db->getEffectiveEvents(start, stop); |