[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] Re: PATCH: addIncidence() DCOP call for KOrganizer
From: David Jarvie <lists () astrojar ! org ! uk>
Date: 2005-06-27 19:29:41
Message-ID: 200506272029.42696.lists () astrojar ! org ! uk
[Download RAW message or body]
On Monday 27 Jun 2005 09:03, Reinhold Kainhofer wrote:
> Am Montag, 27. Juni 2005 09:54 schrieb David Jarvie:
> > +bool CalendarView::addIncidence( const QString& ical )
> > +{
> > + kdDebug(5850) << "CalendarView::addIncidence:\n" << ical << endl;
> > + ICalFormat format;
> > + Incidence* incidence = format.fromString(ical);
>
> Uh oh, this is wrong, since it completely ignores the time zone. You need
> to pass the time zone (of the active calendar?) to the ICalFormat
> constructor.
I've added in a statement
format.setTimeZone( mCalendar->timeZoneId(), true );
after the ICalFormat constructor, which should fix it.
> You also need to check the code whether fromString correctly uses a
> VTIMEZONE, if given in the ical string.
ICalFormat::fromString() calls exactly the same method ( another signature of
ICalFormat::fromString() ) as when a calendar is loaded from a file, so it
should work with time zones in just the same way as would any other calendar
load. I tried it out, and it certainly made the times different, as you would
expect.
Cheers,
David.
["korg-3.5-3.patch" (text/x-diff)]
diff -u /home/david/src/svn/kdepim/korganizer/actionmanager.cpp ./actionmanager.cpp
--- /home/david/src/svn/kdepim/korganizer/actionmanager.cpp 2005-06-26 20:35:45.000000000 +0100
+++ ./actionmanager.cpp 2005-06-26 20:35:55.000000000 +0100
@@ -1330,6 +1330,11 @@
return mCalendarView->deleteIncidence( uid );
}
+bool ActionManager::addIncidence( const QString& ical )
+{
+ return mCalendarView->addIncidence( ical );
+}
+
void ActionManager::configureDateTimeFinished( KProcess *proc )
{
delete proc;
diff -u /home/david/src/svn/kdepim/korganizer/actionmanager.h ./actionmanager.h
--- /home/david/src/svn/kdepim/korganizer/actionmanager.h 2005-06-26 20:35:45.000000000 +0100
+++ ./actionmanager.h 2005-06-27 08:49:03.000000000 +0100
@@ -144,6 +144,14 @@
bool editIncidence( const QString& uid );
+ /**
+ Add an incidence to the current calendar.
+ @param ical The incidence in iCalendar text format, enclosed in a
+ VCALENDAR component.
+ */
+
+ bool addIncidence( const QString& ical );
+
//// Implementation of the DCOP interface
virtual ResourceRequestReply resourceRequest( const QValueList<QPair<QDateTime, QDateTime> >& busy,
const QCString& resource,
diff -u /home/david/src/svn/kdepim/korganizer/calendarview.cpp ./calendarview.cpp
--- /home/david/src/svn/kdepim/korganizer/calendarview.cpp 2005-06-26 20:35:46.000000000 +0100
+++ ./calendarview.cpp 2005-06-27 18:05:54.000000000 +0100
@@ -1058,6 +1058,19 @@
QDateTime( date, QTime( 12, 0, 0 ) ), true );
}
+bool CalendarView::addIncidence( const QString &ical )
+{
+ kdDebug(5850) << "CalendarView::addIncidence:\n" << ical << endl;
+ ICalFormat format;
+ format.setTimeZone( mCalendar->timeZoneId(), true );
+ Incidence *incidence = format.fromString( ical );
+ if ( !incidence ) return false;
+ if ( !mChanger->addIncidence( incidence ) ) {
+ delete incidence;
+ return false;
+ }
+ return true;
+}
void CalendarView::appointment_show()
{
diff -u /home/david/src/svn/kdepim/korganizer/calendarview.h ./calendarview.h
--- /home/david/src/svn/kdepim/korganizer/calendarview.h 2005-06-26 20:35:46.000000000 +0100
+++ ./calendarview.h 2005-06-27 18:16:45.000000000 +0100
@@ -255,6 +255,13 @@
bool editIncidence( const QString& uid );
void deleteIncidence();
+ /**
+ Add an incidence to the active calendar.
+ @param ical The incidence in iCalendar text format, enclosed in a
+ VCALENDAR component, optionally with a VTIMEZONE.
+ */
+ bool addIncidence( const QString &ical );
+
void connectIncidenceEditor( KOIncidenceEditor * );
/** create an editeventwin with supplied date/time, and if bool is true,
diff -u /home/david/src/svn/kdepim/korganizer/korganizeriface.h ./korganizeriface.h
--- /home/david/src/svn/kdepim/korganizer/korganizeriface.h 2005-06-26 20:35:46.000000000 +0100
+++ ./korganizeriface.h 2005-06-27 18:15:14.000000000 +0100
@@ -35,6 +35,15 @@
virtual QString getCurrentURLasString() const = 0;
virtual bool editIncidence(const QString &uid) = 0;
virtual bool deleteIncidence(const QString &uid) = 0;
+ /**
+ Add an incidence to the active calendar.
+ @param ical A calendar in iCalendar format containing the incidence. The
+ incidence (VEVENT, VTODO or VJOURNAL) must be contained within
+ a VCALENDAR component. If there is more than one incidence,
+ only the first one is added to KOrganizer's calendar. The
+ VCALENDAR may optionally also contain a VTIMEZONE component.
+ */
+ virtual bool addIncidence(const QString &iCal) = 0;
};
#endif
diff -u /home/david/src/svn/kdepim/korganizer/korganizerifaceimpl.cpp ./korganizerifaceimpl.cpp
--- /home/david/src/svn/kdepim/korganizer/korganizerifaceimpl.cpp 2005-06-26 20:35:45.000000000 +0100
+++ ./korganizerifaceimpl.cpp 2005-06-27 08:37:43.000000000 +0100
@@ -84,3 +84,8 @@
{
return mActionManager->editIncidence( uid );
}
+
+bool KOrganizerIfaceImpl::addIncidence( const QString &ical )
+{
+ return mActionManager->addIncidence( ical );
+}
diff -u /home/david/src/svn/kdepim/korganizer/korganizerifaceimpl.h ./korganizerifaceimpl.h
--- /home/david/src/svn/kdepim/korganizer/korganizerifaceimpl.h 2005-06-26 20:35:46.000000000 +0100
+++ ./korganizerifaceimpl.h 2005-06-27 08:37:30.000000000 +0100
@@ -55,6 +55,9 @@
bool editIncidence( const QString &uid );
bool deleteIncidence( const QString &uid );
+ /** @reimp from KOrganizerIface::addIncidence() */
+ bool addIncidence( const QString &iCal );
+
private:
ActionManager* mActionManager;
};
_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic