author | zautrix <zautrix> | 2005-02-19 10:19:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-19 10:19:59 (UTC) |
commit | d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3 (patch) (unidiff) | |
tree | d57e0a39b6c15b9108c260359fa19986e4823741 | |
parent | 59a00e603e2ba14885e81c09daf3bb89859ff176 (diff) | |
download | kdepimpi-d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3.zip kdepimpi-d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3.tar.gz kdepimpi-d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3.tar.bz2 |
duration fix
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 31 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 11 |
3 files changed, 27 insertions, 17 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 06aa5f6..01d9e27 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -11,6 +11,8 @@ Added a "go today" button to the datepicker. | |||
11 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) | 11 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) |
12 | and made it configureable to show these values. | 12 | and made it configureable to show these values. |
13 | 13 | ||
14 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. | ||
15 | |||
14 | 16 | ||
15 | ********** VERSION 2.0.7 ************ | 17 | ********** VERSION 2.0.7 ************ |
16 | 18 | ||
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 2e38ae3..eae41aa 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -408,11 +408,11 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
408 | 408 | ||
409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND | 409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND |
410 | 410 | ||
411 | // if (incidence->hasDuration()) { | 411 | if (incidence->hasDuration()) { |
412 | // icaldurationtype duration; | 412 | icaldurationtype duration; |
413 | // duration = writeICalDuration(incidence->duration()); | 413 | duration = writeICalDuration(incidence->duration()); |
414 | // icalcomponent_add_property(parent,icalproperty_new_duration(duration)); | 414 | icalcomponent_add_property(parent,icalproperty_new_duration(duration)); |
415 | // } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
@@ -1769,17 +1769,18 @@ icaldurationtype ICalFormatImpl::writeICalDuration(int seconds) | |||
1769 | { | 1769 | { |
1770 | icaldurationtype d; | 1770 | icaldurationtype d; |
1771 | 1771 | ||
1772 | d.weeks = seconds % gSecondsPerWeek; | 1772 | d.is_neg = (seconds<0)?1:0; |
1773 | seconds -= d.weeks * gSecondsPerWeek; | 1773 | if (seconds<0) seconds = -seconds; |
1774 | d.days = seconds % gSecondsPerDay; | 1774 | |
1775 | seconds -= d.days * gSecondsPerDay; | 1775 | d.weeks = seconds / gSecondsPerWeek; |
1776 | d.hours = seconds % gSecondsPerHour; | 1776 | seconds %= gSecondsPerWeek; |
1777 | seconds -= d.hours * gSecondsPerHour; | 1777 | d.days = seconds / gSecondsPerDay; |
1778 | d.minutes = seconds % gSecondsPerMinute; | 1778 | seconds %= gSecondsPerDay; |
1779 | seconds -= d.minutes * gSecondsPerMinute; | 1779 | d.hours = seconds / gSecondsPerHour; |
1780 | seconds %= gSecondsPerHour; | ||
1781 | d.minutes = seconds / gSecondsPerMinute; | ||
1782 | seconds %= gSecondsPerMinute; | ||
1780 | d.seconds = seconds; | 1783 | d.seconds = seconds; |
1781 | d.is_neg = 0; | ||
1782 | |||
1783 | return d; | 1784 | return d; |
1784 | } | 1785 | } |
1785 | 1786 | ||
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 51f2e9d..1e99082 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp | |||
@@ -106,13 +106,20 @@ bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 ) | |||
106 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); | 106 | qDebug("6 %d ",i1.organizer() == i2.organizer() ); |
107 | 107 | ||
108 | #endif | 108 | #endif |
109 | if ( i1.hasDuration() == i2.hasDuration() ) { | ||
110 | if ( i1.hasDuration() ) { | ||
111 | if ( i1.duration() != i2.duration() ) | ||
112 | return false; | ||
113 | } | ||
114 | } else { | ||
115 | return false; | ||
116 | } | ||
117 | |||
109 | return ( i1.organizer() == i2.organizer() && | 118 | return ( i1.organizer() == i2.organizer() && |
110 | // i1.uid() == i2.uid() && | 119 | // i1.uid() == i2.uid() && |
111 | // Don't compare lastModified, otherwise the operator is not | 120 | // Don't compare lastModified, otherwise the operator is not |
112 | // of much use. We are not comparing for identity, after all. | 121 | // of much use. We are not comparing for identity, after all. |
113 | i1.doesFloat() == i2.doesFloat() && | 122 | i1.doesFloat() == i2.doesFloat() && |
114 | i1.duration() == i2.duration() && | ||
115 | i1.hasDuration() == i2.hasDuration() && | ||
116 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); | 123 | i1.pilotId() == i2.pilotId() );// && i1.syncStatus() == i2.syncStatus() ); |
117 | // no need to compare mObserver | 124 | // no need to compare mObserver |
118 | } | 125 | } |