summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-19 10:19:59 (UTC)
committer zautrix <zautrix>2005-02-19 10:19:59 (UTC)
commitd2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3 (patch) (unidiff)
treed57e0a39b6c15b9108c260359fa19986e4823741
parent59a00e603e2ba14885e81c09daf3bb89859ff176 (diff)
downloadkdepimpi-d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3.zip
kdepimpi-d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3.tar.gz
kdepimpi-d2ed2aaddb88f39f8b2ced18a4ea7f06a63237d3.tar.bz2
duration fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt2
-rw-r--r--libkcal/icalformatimpl.cpp31
-rw-r--r--libkcal/incidencebase.cpp11
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
@@ -1,37 +1,39 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.8 ************ 3********** VERSION 2.0.8 ************
4 4
5Fixed a problem in dependency info in the ipk files for the Zaurus. 5Fixed a problem in dependency info in the ipk files for the Zaurus.
6 6
7Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. 7Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar.
8 8
9Added a "go today" button to the datepicker. 9Added a "go today" button to the datepicker.
10 10
11Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) 11Added "created" and "last modified" to event/todo viewer (and What'sThis viewer)
12and made it configureable to show these values. 12and made it configureable to show these values.
13 13
14Fixed 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
17Added global application font settings 19Added global application font settings
18(for all KDE-Pim/Pi apps) to the general settings. 20(for all KDE-Pim/Pi apps) to the general settings.
19 21
20Fixed a problem in OM/Pi when trying to login to some IMAP servers 22Fixed a problem in OM/Pi when trying to login to some IMAP servers
21(like the IMAP server of Apple: mail.mac.com ) 23(like the IMAP server of Apple: mail.mac.com )
22 24
23Added recurring todos to KO/Pi. 25Added recurring todos to KO/Pi.
24 26
25 27
26********** VERSION 2.0.6 ************ 28********** VERSION 2.0.6 ************
27 29
28Some bugfixes in the pi-sync mode. 30Some bugfixes in the pi-sync mode.
29Added German translation for pi-sync mode. 31Added German translation for pi-sync mode.
30 32
31KO/Pi: 33KO/Pi:
32Made the todolist using alternate background. 34Made the todolist using alternate background.
33 35
34Other minor fixes in KO/Pi. 36Other minor fixes in KO/Pi.
35 37
36 38
37********** VERSION 2.0.5 ************ 39********** VERSION 2.0.5 ************
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index 2e38ae3..eae41aa 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -387,53 +387,53 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
387 } 387 }
388 388
389 // attachments 389 // attachments
390 QPtrList<Attachment> attachments = incidence->attachments(); 390 QPtrList<Attachment> attachments = incidence->attachments();
391 for (Attachment *at = attachments.first(); at; at = attachments.next()) 391 for (Attachment *at = attachments.first(); at; at = attachments.next())
392 icalcomponent_add_property(parent,writeAttachment(at)); 392 icalcomponent_add_property(parent,writeAttachment(at));
393 393
394 // alarms 394 // alarms
395 QPtrList<Alarm> alarms = incidence->alarms(); 395 QPtrList<Alarm> alarms = incidence->alarms();
396 Alarm* alarm; 396 Alarm* alarm;
397 for (alarm = alarms.first(); alarm; alarm = alarms.next()) { 397 for (alarm = alarms.first(); alarm; alarm = alarms.next()) {
398 if (alarm->enabled()) { 398 if (alarm->enabled()) {
399 kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; 399 kdDebug(5800) << "Write alarm for " << incidence->summary() << endl;
400 icalcomponent_add_component(parent,writeAlarm(alarm)); 400 icalcomponent_add_component(parent,writeAlarm(alarm));
401 } 401 }
402 } 402 }
403 if( incidence->hasRecurrenceID() ) { 403 if( incidence->hasRecurrenceID() ) {
404 icalcomponent_add_property(parent, 404 icalcomponent_add_property(parent,
405 icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); 405 icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID())));
406 } 406 }
407 // duration 407 // duration
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
418void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) 418void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase)
419{ 419{
420 icalcomponent_add_property(parent,icalproperty_new_dtstamp( 420 icalcomponent_add_property(parent,icalproperty_new_dtstamp(
421 writeICalDateTime(QDateTime::currentDateTime()))); 421 writeICalDateTime(QDateTime::currentDateTime())));
422 422
423 // organizer stuff 423 // organizer stuff
424 icalcomponent_add_property(parent,icalproperty_new_organizer( 424 icalcomponent_add_property(parent,icalproperty_new_organizer(
425 ("MAILTO:" + incidenceBase->organizer()).utf8())); 425 ("MAILTO:" + incidenceBase->organizer()).utf8()));
426 426
427 // attendees 427 // attendees
428 if (incidenceBase->attendeeCount() != 0) { 428 if (incidenceBase->attendeeCount() != 0) {
429 QPtrList<Attendee> al = incidenceBase->attendees(); 429 QPtrList<Attendee> al = incidenceBase->attendees();
430 QPtrListIterator<Attendee> ai(al); 430 QPtrListIterator<Attendee> ai(al);
431 for (; ai.current(); ++ai) { 431 for (; ai.current(); ++ai) {
432 icalcomponent_add_property(parent,writeAttendee(ai.current())); 432 icalcomponent_add_property(parent,writeAttendee(ai.current()));
433 } 433 }
434 } 434 }
435 435
436 // custom properties 436 // custom properties
437 writeCustomProperties(parent, incidenceBase); 437 writeCustomProperties(parent, incidenceBase);
438} 438}
439 439
@@ -1748,59 +1748,60 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const QDateTime &dt )
1748} 1748}
1749 1749
1750QDateTime ICalFormatImpl::readICalDateTime(icaltimetype t) 1750QDateTime ICalFormatImpl::readICalDateTime(icaltimetype t)
1751{ 1751{
1752 QDateTime dt (QDate(t.year,t.month,t.day), 1752 QDateTime dt (QDate(t.year,t.month,t.day),
1753 QTime(t.hour,t.minute,t.second) ); 1753 QTime(t.hour,t.minute,t.second) );
1754 1754
1755 if (t.is_utc) { 1755 if (t.is_utc) {
1756 int offset = KGlobal::locale()->localTimeOffset( dt ); 1756 int offset = KGlobal::locale()->localTimeOffset( dt );
1757 dt = dt.addSecs ( offset*60); 1757 dt = dt.addSecs ( offset*60);
1758 } 1758 }
1759 1759
1760 return dt; 1760 return dt;
1761} 1761}
1762 1762
1763QDate ICalFormatImpl::readICalDate(icaltimetype t) 1763QDate ICalFormatImpl::readICalDate(icaltimetype t)
1764{ 1764{
1765 return QDate(t.year,t.month,t.day); 1765 return QDate(t.year,t.month,t.day);
1766} 1766}
1767 1767
1768icaldurationtype ICalFormatImpl::writeICalDuration(int seconds) 1768icaldurationtype 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
1786int ICalFormatImpl::readICalDuration(icaldurationtype d) 1787int ICalFormatImpl::readICalDuration(icaldurationtype d)
1787{ 1788{
1788 int result = 0; 1789 int result = 0;
1789 1790
1790 result += d.weeks * gSecondsPerWeek; 1791 result += d.weeks * gSecondsPerWeek;
1791 result += d.days * gSecondsPerDay; 1792 result += d.days * gSecondsPerDay;
1792 result += d.hours * gSecondsPerHour; 1793 result += d.hours * gSecondsPerHour;
1793 result += d.minutes * gSecondsPerMinute; 1794 result += d.minutes * gSecondsPerMinute;
1794 result += d.seconds; 1795 result += d.seconds;
1795 1796
1796 if (d.is_neg) result *= -1; 1797 if (d.is_neg) result *= -1;
1797 1798
1798 return result; 1799 return result;
1799} 1800}
1800 1801
1801icalcomponent *ICalFormatImpl::createCalendarComponent(Calendar *cal) 1802icalcomponent *ICalFormatImpl::createCalendarComponent(Calendar *cal)
1802{ 1803{
1803 icalcomponent *calendar; 1804 icalcomponent *calendar;
1804 1805
1805 // Root component 1806 // Root component
1806 calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); 1807 calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 51f2e9d..1e99082 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -85,55 +85,62 @@ bool KCal::operator==( const IncidenceBase& i1, const IncidenceBase& i2 )
85 } 85 }
86 if ( i1.attendees().count() > 0 ) { 86 if ( i1.attendees().count() > 0 ) {
87 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ; 87 Attendee * a1 = i1.attendees().first(), *a2 =i2.attendees().first() ;
88 while ( a1 ) { 88 while ( a1 ) {
89 if ( !( (*a1) == (*a2)) ) 89 if ( !( (*a1) == (*a2)) )
90 { 90 {
91 //qDebug("Attendee not equal "); 91 //qDebug("Attendee not equal ");
92 return false; 92 return false;
93 } 93 }
94 a1 = i1.attendees().next(); 94 a1 = i1.attendees().next();
95 a2 = i2.attendees().next(); 95 a2 = i2.attendees().next();
96 } 96 }
97 } 97 }
98 //if ( i1.dtStart() != i2.dtStart() ) 98 //if ( i1.dtStart() != i2.dtStart() )
99 // return false; 99 // return false;
100#if 0 100#if 0
101 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() ); 101 qDebug("1 %d ",i1.doesFloat() == i2.doesFloat() );
102 qDebug("1 %d ",i1.duration() == i2.duration() ); 102 qDebug("1 %d ",i1.duration() == i2.duration() );
103 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() ); 103 qDebug("3 %d ",i1.hasDuration() == i2.hasDuration() );
104 qDebug("1 %d ",i1.pilotId() == i2.pilotId() ); 104 qDebug("1 %d ",i1.pilotId() == i2.pilotId() );
105 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() ); 105 qDebug("1 %d %d %d",i1.syncStatus() == i2.syncStatus() , i1.syncStatus(),i2.syncStatus() );
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}
119 126
120 127
121QDateTime IncidenceBase::getEvenTime( QDateTime dt ) 128QDateTime IncidenceBase::getEvenTime( QDateTime dt )
122{ 129{
123 QTime t = dt.time(); 130 QTime t = dt.time();
124 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 131 dt.setTime( QTime (t.hour (), t.minute (), t.second () ) );
125 return dt; 132 return dt;
126} 133}
127 134
128 135
129void IncidenceBase::setUid(const QString &uid) 136void IncidenceBase::setUid(const QString &uid)
130{ 137{
131 mUid = uid; 138 mUid = uid;
132 updated(); 139 updated();
133} 140}
134 141
135QString IncidenceBase::uid() const 142QString IncidenceBase::uid() const
136{ 143{
137 return mUid; 144 return mUid;
138} 145}
139 146