[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 7:54:19
Message-ID: 200506270854.20751.lists () astrojar ! org ! uk
[Download RAW message or body]

On Monday 27 Jun 2005 01:22, Allen Winter wrote:
> On Sunday 26 June 2005 08:14 pm, David Jarvie wrote:
> > Here is a patch to add a new DCOP call to KOrganizer. The new method in
> > korganizeriface.h,  addIncidence(QString& ical), allows another
> > application to send KOrganizer an iCalendar incidence in string format,
> > which KOrganizer adds to its default calendar without showing any dialog.
>
> David,
> I'd like to see you check the return value of ICalFormat.fromString() and
> do the appropriate thing upon failure.

Quite right. I don't know why I didn't do that.

On Monday 27 Jun 2005 01:55, Adriaan de Groot wrote:
> <doxpatrol>Please document what the format is for that QString. Its name
> "ical" suggests that it is an ical-encoded VEVENT, so
>
> addIncidence( QString::fromLatin1(
> "BEGIN:VEVENT\n"
> "DTSTAMP:20050511T171945Z\n"
> "ORGANIZER;CN=Adriaan de Groot:MAILTO:groot@kde.org\n"
> "CREATED:20050511T171829Z\n"
> "SUMMARY:Complain about Dox\n"
> "DTSTART:20050511T110000Z\n"
> "DTEND:20050511T120000Z\n"
> "TRANSP:OPAQUE\n"
> "END:VEVENT\n"
> ) ) ;
>
> is a correct call -- or do you need the VCALENDAR stuff surrounding it as
> well? An example would be very useful here. Also, in the re-iplementations
> in classes inheriting the DCOP interface, please add /** @reimp from
> -name-of-superclass-method- */ . If it's not a reimplementation, use /**
> Add an incidence to the calendar. @see -name-of-method-elsewhere- . */

Here's a revised patch. Is it OK to commit?

Cheers,
David.

["korg-3.5-1.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.429497744 +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 08:52:19.126747240 +0100
@@ -1058,6 +1058,18 @@
             QDateTime( date, QTime( 12, 0, 0 ) ), true );
 }
 
+bool CalendarView::addIncidence( const QString& ical )
+{
+  kdDebug(5850) << "CalendarView::addIncidence:\n" << ical << endl;
+  ICalFormat format;
+  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 08:47:53.896068432 +0100
@@ -255,6 +255,13 @@
     bool editIncidence( const QString& uid );
     void deleteIncidence();
 
+    /**
+      Add an incidence to the default calendar.
+      @param ical The incidence in iCalendar text format, enclosed in a
+                  VCALENDAR component.
+    */
+    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 08:46:12.797437760 +0100
@@ -35,6 +35,12 @@
     virtual QString getCurrentURLasString() const = 0;
     virtual bool editIncidence(const QString &uid) = 0;
     virtual bool deleteIncidence(const QString &uid) = 0;
+    /**
+      Add an incidence to the default calendar.
+      @param ical The incidence (VEVENT, VTODO or VJOURNAL) in iCalendar format,
+                  enclosed in a VCALENDAR 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