6 files changed, 57 insertions, 18 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index 0a0d186..8277529 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp @@ -59,5 +59,8 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, // start time of event - msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) ) + QDate tempDate = (ev).event().start().date(); + msg += "<br>" + + ampmTime( QTime( (ev).event().start().time() ) ) // end time of event - + "<b> - </b>" + ampmTime(QTime( (ev).event().end().time() ) ); + + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ) + + differDate( tempDate ); } @@ -97,2 +100,19 @@ QString DateBookEvent::ampmTime( QTime tm ) { +QString DateBookEvent::differDate( QDate date ) { + QDate currentDate = QDate::currentDate(); + QString returnText = "<font color = #407DD9><b> "; + int differDate = currentDate.daysTo( date ); + if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { + returnText += "" ; + // not working right for recurring events + //} else if ( differDate == 1 ) { + //returnText += tr( "tomorrow" ); + } else { + //returnText += tr( "in %1 days" ).arg( differDate ); + returnText += " [ " + date.dayName( date.dayOfWeek() ) + " ] "; + } + returnText += "</b></font>"; + return returnText; +} + diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h index 7b0371a..f8a9c03 100644 --- a/core/pim/today/plugins/datebook/datebookevent.h +++ b/core/pim/today/plugins/datebook/datebookevent.h @@ -28,13 +28,13 @@ class DateBookEvent: public OClickableLabel { public: - DateBookEvent(const EffectiveEvent &ev, - QWidget* parent = 0, - bool show_location = 0, - bool show_notes = 0, - int maxCharClip = 0, - const char* name = 0, - WFlags fl = 0); + DateBookEvent( const EffectiveEvent &ev, + QWidget* parent = 0, + bool show_location = 0, + bool show_notes = 0, + int maxCharClip = 0, + const char* name = 0, + WFlags fl = 0 ); signals: - void editEvent(const Event &e); + void editEvent( const Event &e ); private slots: - void editEventSlot(const Event &e); + void editEventSlot( const Event &e ); void editMe(); @@ -42,3 +42,4 @@ private: DateBookDB *db; - QString ampmTime(QTime); + QString ampmTime( QTime ); + QString differDate( QDate date ); const EffectiveEvent event; diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp index e93c82c..0fc38de 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp @@ -37,2 +37,4 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) + + QHBox *box4 = new QHBox( this ); @@ -46,2 +48,12 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) + + QHBox *box5 = new QHBox( this ); + QLabel *TextLabelDays = new QLabel( box5 ); + TextLabelDays->setText( tr( "How many more days" ) ); + SpinBox2 = new QSpinBox( box5, "SpinBox2" ); + QWhatsThis::add( SpinBox2 , tr( "How many more days should be in the range" ) ); + SpinBox2->setMaxValue( 7 ); + SpinBox2->setSuffix( tr( " day(s)" ) ); + SpinBox2->setSpecialValueText ( tr("only today") ); + layout->addWidget( box1 ); @@ -50,2 +62,3 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) layout->addWidget( box4 ); + layout->addWidget( box5 ); @@ -66,2 +79,4 @@ void DatebookPluginConfig::readConfig() { CheckBox3->setChecked( m_only_later ); + m_more_days = cfg.readNumEntry( "moredays", 0 ); + SpinBox2->setValue( m_more_days ); } @@ -79,4 +94,6 @@ void DatebookPluginConfig::writeConfig() { cfg.writeEntry( "shownotes", m_show_notes ); - m_only_later = CheckBox3->isChecked(); + m_only_later = CheckBox3->isChecked(); cfg.writeEntry( "onlylater", m_only_later ); + m_more_days = SpinBox2->value(); + cfg.writeEntry( "moredays", m_more_days ); cfg.write(); diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h index feba9ee..6c32ae9 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.h +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h @@ -30,2 +30,4 @@ private: QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + @@ -39,3 +41,3 @@ private: int m_only_later; - + int m_more_days; @@ -44,5 +46,2 @@ private: - - - #endif diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index a8ce059..c6aa2a6 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp @@ -49,2 +49,3 @@ void DatebookPluginWidget::readConfig() { m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); + m_moreDays = cfg.readNumEntry( "moredays", 0 ); } @@ -70,3 +71,3 @@ void DatebookPluginWidget::getDates() { - QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date ); + QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h index 1720bb2..3ebbc3d 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.h +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h @@ -48,2 +48,3 @@ private: bool m_onlyLater; + int m_moreDays; |