[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-pim
Subject:    [Kde-pim] PATCH: addIncidence() DCOP call for KOrganizer
From:       David Jarvie <lists () astrojar ! org ! uk>
Date:       2005-06-27 0:14:25
Message-ID: 200506270114.26831.lists () astrojar ! org ! uk
[Download RAW message or body]

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.

The purpose is to enable KAlarm to add events to KOrganizer, as per bug 
wishlist number 90315. I have written it in a general form to allow any 
incidence to be added.

Please review.

Cheers,
David Jarvie.
KAlarm author.

["korg-3.5.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-26 20:35:55.000000000 +0100
@@ -144,6 +144,9 @@
 
     bool editIncidence( const QString& uid );
 
+    /** Add an incidence to the current calendar. */
+    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-26 20:35:55.000000000 +0100
@@ -1058,6 +1058,18 @@
             QDateTime( date, QTime( 12, 0, 0 ) ), true );
 }
 
+bool CalendarView::addIncidence( const QString& ical )
+{
+kdDebug(5850)<<"addIncidence:\n"<<ical<<endl;
+  ICalFormat format;
+  Incidence* incidence = format.fromString(ical);
+  if ( !mChanger->addIncidence( incidence ) ) {
+kdDebug(5850)<<"addIncidence failed\n";
+    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-26 20:35:55.000000000 +0100
@@ -254,6 +254,7 @@
     void editIncidence();
     bool editIncidence( const QString& uid );
     void deleteIncidence();
+    bool addIncidence( const QString& ical );
 
     void connectIncidenceEditor( KOIncidenceEditor * );
 
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-26 20:35:55.000000000 +0100
@@ -35,6 +35,7 @@
     virtual QString getCurrentURLasString() const = 0;
     virtual bool editIncidence(const QString &uid) = 0;
     virtual bool deleteIncidence(const QString &uid) = 0;
+    virtual bool addIncidence(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-26 20:35:55.000000000 +0100
@@ -84,3 +84,8 @@
 {
   return mActionManager->editIncidence( uid );
 }
+
+bool KOrganizerIfaceImpl::addIncidence( 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-26 20:35:55.000000000 +0100
@@ -55,6 +55,8 @@
   bool editIncidence( const QString &uid );
   bool deleteIncidence( const QString &uid );
 
+  bool addIncidence( 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