summaryrefslogtreecommitdiff
path: root/core
authorzecke <zecke>2002-06-25 19:55:53 (UTC)
committer zecke <zecke>2002-06-25 19:55:53 (UTC)
commitaf4a3940dd672423da28b54e5d955cc5d33cecda (patch) (side-by-side diff)
treecb5fcfe4835c86353e9d54b1050c7dfb23898bf1 /core
parent8635f264c15b05152fc1a44f798c154472a4b227 (diff)
downloadopie-af4a3940dd672423da28b54e5d955cc5d33cecda.zip
opie-af4a3940dd672423da28b54e5d955cc5d33cecda.tar.gz
opie-af4a3940dd672423da28b54e5d955cc5d33cecda.tar.bz2
All day events are not from 00:00 to 23:59 they're all day now.
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebookday.cpp52
-rw-r--r--core/pim/datebook/datebookday.h11
-rw-r--r--core/pim/datebook/datebookweek.cpp48
-rw-r--r--core/pim/datebook/datebookweek.h16
-rw-r--r--core/pim/datebook/datebookweeklst.cpp3
5 files changed, 94 insertions, 36 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
@@ -566,7 +566,7 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e,
DateBookDay *db )
: QWidget( db->dayView()->viewport() ), ev( e ), dateBook( db )
{
- bool whichClock = db->dayView()->whichClock();
+
// why would someone use "<"? Oh well, fix it up...
// I wonder what other things may be messed up...
@@ -597,27 +597,14 @@ 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 );
QTime start = ev.start();
@@ -635,6 +622,30 @@ DateBookDayWidget::DateBookDayWidget( const EffectiveEvent &e,
geom.setWidth(dateBook->dayView()->columnWidth(0)-1);
}
+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()
{
@@ -689,6 +700,7 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e )
if ( ev.event().hasRepeat() ) {
p.drawPixmap( width() - 16, y, Resource::loadPixmap( "repeat" ) );
d = 20;
+ y += 20;
}
QSimpleRichText rt( text, font() );
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
@@ -87,6 +87,17 @@ protected:
void mousePressEvent( QMouseEvent *e );
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;
QString text;
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
@@ -461,6 +461,33 @@ void DateBookWeek::getEvents()
view->moveToHour( startTime );
}
+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 )
{
if ( tHide->isActive() )
@@ -497,24 +524,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>: ";
+ + "<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;
lblDesc->setText( str );
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
@@ -133,6 +133,22 @@ 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;
int dow;
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
@@ -154,7 +154,10 @@ DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
strcpy(s, " |---");
}
} else {
+ if(ev.event().type() == Event::Normal )
sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
+ else
+ sprintf(s," ");
}
setText(QString(s) + " " + ev.description());
connect(this, SIGNAL(clicked()), this, SLOT(editMe()));