-rw-r--r-- | core/pim/datebook/datebookday.cpp | 52 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 31 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 52 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.h | 16 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 5 |
5 files changed, 107 insertions, 49 deletions
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 9cc5fcd..5474cfc 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp @@ -567,5 +567,5 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, : QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db ) { - bool whichClock = db->dayView()->whichClock(); + // why would someone use "<"? Oh well, fix it up... @@ -598,25 +598,12 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, text = "<b>" + strDesc + "</b><br>" + "<i>" - + strCat + "</i>" - + "<br><b>" + tr("Start") + "</b>: "; - - - if ( e.startDate() != ev.date() ) { - // multi-day event. Show start date - text += TimeString::longDateString( e.startDate() ); - } else { - // Show start time. - text += TimeString::timeString( ev.start(), whichClock, FALSE ); - } + + strCat + "</i><br>"; + if (ev.event().type() == Event::Normal ) + setEventText( text ); + else + setAllDayText( text ); - text += "<br><b>" + tr("End") + "</b>: "; - if ( e.endDate() != ev.date() ) { - // multi-day event. Show end date - text += TimeString::longDateString( e.endDate() ); - } else { - // Show end time. - text += TimeString::timeString( ev.end(), whichClock, FALSE ); - } text += "<br><br>" + strNote; + setBackgroundMode( PaletteBase ); @@ -636,4 +623,28 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e, } +void DateBookDayWidget::setAllDayText( QString &text ) { + text += "<b>" + tr("This is an all day event.") + "</b><br>"; +} +void DateBookDayWidget::setEventText( QString& text ) { + bool whichClock = dateBook->dayView()->whichClock(); + text += "<b>" + tr("Start") + "</b>: "; + if ( ev.startDate() != ev.date() ) { + // multi-day event. Show start date + text += TimeString::longDateString( ev.startDate() ); + } else { + // Show start time. + text += TimeString::timeString( ev.start(), whichClock, FALSE ); + } + + text += "<br><b>" + tr("End") + "</b>: "; + if ( ev.endDate() != ev.date() ) { + // multi-day event. Show end date + text += TimeString::longDateString( ev.endDate() ); + } else { + // Show end time. + text += TimeString::timeString( ev.end(), whichClock, FALSE ); + } + +} DateBookDayWidget::~DateBookDayWidget() @@ -690,4 +701,5 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e ) p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) ); d = 20; + y += 20; } diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index be7cc45..db1cd04 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h @@ -41,5 +41,5 @@ public: DateBookDayView( bool hourClock, QWidget *parent, const char *name ); bool whichClock() const; - + void setRowStyle( int style ); @@ -56,5 +56,5 @@ protected: virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); virtual void paintFocus( QPainter *p, const QRect &cr ); - + virtual void resizeEvent( QResizeEvent *e ); void keyPressEvent( QKeyEvent *e ); @@ -77,5 +77,5 @@ public: const EffectiveEvent &event() const { return ev; } - + signals: void deleteMe( const Event &e ); @@ -88,4 +88,15 @@ protected: private: + /** + * Sets the text for an all day Event + * All day events have no time associated + */ + void setAllDayText( QString& text ); + + /** + * Sets the EventText + * it got a start and an end Time + */ + void setEventText( QString& text ); const EffectiveEvent ev; DateBookDay *dateBook; @@ -107,5 +118,5 @@ public: void setTime( const QTime &t ); -signals: +signals: protected: @@ -120,12 +131,12 @@ private: //reimplemented the compareItems function so that it sorts DayWidgets by geometry heights class WidgetListClass : public QList<DateBookDayWidget> -{ +{ private: - - int compareItems( QCollection::Item s1, QCollection::Item s2 ) - { + + int compareItems( QCollection::Item s1, QCollection::Item s2 ) + { //hmm, don't punish me for that ;) if (reinterpret_cast<DateBookDayWidget*>(s1)->geometry().height() > reinterpret_cast<DateBookDayWidget*>(s2)->geometry().height()) - { + { return -1; } else @@ -134,5 +145,5 @@ class WidgetListClass : public QList<DateBookDayWidget> } } - + }; diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index 6532ba4..e16f516 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp @@ -462,4 +462,31 @@ void DateBookWeek::getEvents() } +void DateBookWeek::generateAllDayTooltext( QString& text ) { + text += "<b>" + tr("This is an all day event.") + "</b><br>"; +} + +void DateBookWeek::generateNormalTooltext( QString& str, + const EffectiveEvent &ev ) { + str += "<b>" + QObject::tr("Start") + "</b>: "; + + if ( ev.startDate() != ev.date() ) { + // multi-day event. Show start date + str += TimeString::longDateString( ev.startDate() ); + } else { + // Show start time. + str += TimeString::timeString(ev.start(), ampm, FALSE ); + } + + + str += "<br><b>" + QObject::tr("End") + "</b>: "; + if ( ev.endDate() != ev.date() ) { + // multi-day event. Show end date + str += TimeString::longDateString( ev.endDate() ); + } else { + // Show end time. + str += TimeString::timeString( ev.end(), ampm, FALSE ); + } +} + void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) { @@ -496,24 +523,13 @@ void DateBookWeek::slotShowEvent( const EffectiveEvent &ev ) QString str = "<b>" + strDesc + "</b><br>" + "<i>" - + strCat + "</i>" - + "<br>" + TimeString::longDateString( ev.date() ) - + "<br><b>" + QObject::tr("Start") + "</b>: "; + + strCat + "</i>" + + "<br>" + TimeString::longDateString( ev.date() ) + + "<br>"; - if ( ev.startDate() != ev.date() ) { - // multi-day event. Show start date - str += TimeString::longDateString( ev.startDate() ); - } else { - // Show start time. - str += TimeString::timeString(ev.start(), ampm, FALSE ); - } + if (ev.event().type() == Event::Normal ) + generateNormalTooltext( str, ev ); + else + generateAllDayTooltext( str ); - str += "<br><b>" + QObject::tr("End") + "</b>: "; - if ( ev.endDate() != ev.date() ) { - // multi-day event. Show end date - str += TimeString::longDateString( ev.endDate() ); - } else { - // Show end time. - str += TimeString::timeString( ev.end(), ampm, FALSE ); - } str += "<br><br>" + strNote; diff --git a/core/pim/datebook/datebookweek.h b/core/pim/datebook/datebookweek.h index 6e675f1..acbc2c7 100644 --- a/core/pim/datebook/datebookweek.h +++ b/core/pim/datebook/datebookweek.h @@ -134,4 +134,20 @@ private slots: private: void getEvents(); + + /** + * Wow that's a hell lot of code duplication + * in datebook. I vote for a common base class + * but never the less. This add a note + * that the Event is an all day event + * + */ + void generateAllDayTooltext( QString& text ); + + /** + * This will add the times to the text + * It will be shown in the Tooltip bubble + */ + void generateNormalTooltext( QString& text, + const EffectiveEvent &ev); int year; int _week; diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 29519c1..5eefc27 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp @@ -155,5 +155,8 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev, } } else { - sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); + if(ev.event().type() == Event::Normal ) + sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute()); + else + sprintf(s," "); } setText(QString(s) + " " + ev.description()); |