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

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim
From:       Volker Krause <vkrause () kde ! org>
Date:       2008-08-18 17:21:56
Message-ID: 1219080116.112027.12596.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 848894 by vkrause:

Second part of the counter proposal fixes.

Merged revisions 800615-802138,802140-802148,802150-802151,802153-803256,803258-803259 \
,803261-803299,803301-803308,803310-803338,803340-803380,803383-803397,803399-804108,8 \
04110-804615,804617-804641,804643-804990,804992-804993,804995-805347,805349-805427,805429-805459,805461-805670,805672-805702 \
via svnmerge from  https://vkrause@svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim


........
  r800615 | ervin | 2008-04-24 16:19:46 +0200 (Thu, 24 Apr 2008) | 7 lines
  
  In the case of a counter proposal we're actually changing the incidence,
  not simply adding it. Now it correctly triggers a notification mail for
  the organizer.
  
  That fixes kolab/issue2608.
........
  r805191 | vkrause | 2008-05-07 22:14:26 +0200 (Wed, 07 May 2008) | 10 lines
  
  - fix creation of the placeholder event for the counter proposal
  - fix wrong event title in counter proposal mails
  - fix memory leak
  - notify the user that no counter proposal is sent if there are no
    changes
  - make counter proposal sending more explicit and clean up the code to
    reduce the risk for further breakage in this area
  
  Kolab issues 2148, 2678, 2681, 2683
........
  r805430 | vkrause | 2008-05-08 17:44:58 +0200 (Thu, 08 May 2008) | 2 lines
  
  Don't crash when no calendar resource is activated.
........
  r805701 | vkrause | 2008-05-09 10:26:34 +0200 (Fri, 09 May 2008) | 5 lines
  
  Don't remove the observers in the assignment operator, this only makes
  sense in the copy ctor where this code was copied from. This fixes
  various issues when using the assignment operator, such as wrongly
  updated views and most notably the non-persistence of the changes.
........
  r805702 | vkrause | 2008-05-09 10:37:19 +0200 (Fri, 09 May 2008) | 6 lines
  
  Do the counter proposal acceptance explicitly as well instead of trying
  to handle them as event updates. Fixes updating the local event and
  sending updates to all attendees.
  
  Kolab issue 2680
........


 _M            . (directory)  
 M  +2 -26     korganizer/incidencechanger.cpp  
 M  +1 -1      korganizer/incidencechanger.h  
 M  +1 -1      korganizer/interfaces/korganizer/incidencechangerbase.h  
 M  +7 -3      korganizer/koeventeditor.cpp  
 M  +22 -2     korganizer/kogroupware.cpp  
 M  +7 -0      korganizer/kogroupware.h  
 M  +27 -0     korganizer/mailscheduler.cpp  
 M  +4 -1      korganizer/mailscheduler.h  
 M  +5 -0      korganizer/multiagendaview.cpp  
 M  +0 -3      libkcal/incidencebase.cpp  


** branches/KDE/3.5/kdepim #property svnmerge-integrated
   - /branches/kdepim/enterprise/kdepim:1-767022,767033,767233-767554,767556,767558-76 \
7946,767948-769318,769320-769354,769356-771105,771107-771251,771253-772311,772313-7723 \
16,772318-775194,775196-775202,775204,775207-775211,775213-778001,778003-778004,778007 \
,778010-778011,778013-778029,778031-778727,778729-779448,779450-779482,779484-779505,7 \
79507-779852,779854-779994,780211,780250-780452,780454-780495,780497,780499-780529,780 \
531-782028,782030-783127,783129-783243,783245,783248-783477,783479-784380,784382-78442 \
6,784428-784691,784693-785478,785480-785558,787827,788634,789925,790349-790352,791184- \
791440,791443-792201,792203-792957,793296,794734,795745-795763,795765,795767-798445,79 \
8447-798448,798450-798495,798497-800070,800072-800167,800169-800614,800616-802138,8021 \
40-802148,802150-802151,802153-803259,803261-803299,803301-803308,803310-803380,803383 \
-803397,803399-804615,804617-804642,817568,817604,817710-818288,818312-819076,819078-820073,820075-821035,821037-821124,821126-821
  378,821380-821648,821650-821813,821815-821835,821837-822268,822270-823864,823866-824 \
217,824219-824277,824279-824285,824287-824288,824290-824805,824807-825075,825077-825083,825085-826354,826356-827491,830100,830443
  + /branches/kdepim/enterprise/kdepim:1-767022,767033,767233-767554,767556,767558-767 \
946,767948-769318,769320-769354,769356-771105,771107-771251,771253-772311,772313-77231 \
6,772318-775194,775196-775202,775204,775207-775211,775213-778001,778003-778004,778007, \
778010-778011,778013-778029,778031-778727,778729-779448,779450-779482,779484-779505,77 \
9507-779852,779854-779994,780211,780250-780452,780454-780495,780497,780499-780529,7805 \
31-782028,782030-783127,783129-783243,783245,783248-783477,783479-784380,784382-784426 \
,784428-784691,784693-785478,785480-785558,787827,788634,789925,790349-790352,791184-7 \
91440,791443-792201,792203-792957,793296,794734,795745-795763,795765,795767-798445,798 \
447-798448,798450-798495,798497-800070,800072-800167,800169-802138,802140-802148,80215 \
0-802151,802153-803259,803261-803299,803301-803308,803310-803380,803383-803397,803399- \
804615,804617-804993,804995-805347,805349-805427,805429-805459,805461-805702,817568,817604,817710-818288,818312-819076,819078-820
  073,820075-821035,821037-821124,821126-821378,821380-821648,821650-821813,821815-821 \
835,821837-822268,822270-823864,823866-824217,824219-824277,824279-824285,824287-82428 \
                8,824290-824805,824807-825075,825077-825083,825085-826354,826356-827491,830100,830443
                
--- branches/KDE/3.5/kdepim/korganizer/incidencechanger.cpp #848893:848894
@@ -277,16 +277,12 @@
 }
 
 bool IncidenceChanger::changeIncidence( Incidence *oldinc, Incidence *newinc,
-                                        int action, bool counter )
+                                        int action )
 {
 kdDebug(5850)<<"IncidenceChanger::changeIncidence for incidence \
\""<<newinc->summary()<<"\" ( old one was \""<<oldinc->summary()<<"\")"<<endl;  if( \
incidencesEqual( newinc, oldinc ) ) {  // Don't do anything
     kdDebug(5850) << "Incidence not changed\n";
-    if ( counter ) {
-      KCal::MailScheduler scheduler( mCalendar );
-      scheduler.performTransaction( newinc, Scheduler::Reply );
-    }
   } else {
     kdDebug(5850) << "Incidence changed\n";
     bool statusChanged = myAttendeeStatusChanged( oldinc, newinc );
@@ -297,7 +293,7 @@
     //        it wants with the event. If no groupware is used,use the null
     //        pattern...
     bool revert = KOPrefs::instance()->mUseGroupwareCommunication;
-    if ( !counter && revert &&
+    if ( revert &&
         KOGroupware::instance()->sendICalMessage( 0,
                                                   KCal::Scheduler::Request,
                                                   newinc, false, statusChanged ) ) {
@@ -309,26 +305,6 @@
       }
       revert = false;
     }
-    if ( counter && revert ) {
-      // pseudo counter as done by outlook
-      Event *e = dynamic_cast<Event*>( newinc );
-      if ( e ) {
-        if ( KOPrefs::instance()->outlookCompatCounterProposals() ) {
-          Incidence* tmp = oldinc->clone();
-          tmp->setSummary( i18n("Counter proposal: %1").arg( e->summary() ) );
-          tmp->setDescription( e->description() );
-          tmp->addComment( i18n("Proposed new meeting time: %1 - %2").arg( \
                e->dtStartStr() ).arg( e->dtEndStr() ) );
-          KCal::MailScheduler scheduler( mCalendar );
-          scheduler.performTransaction( tmp, Scheduler::Reply );
-        } else {
-          Incidence *tmp = newinc->clone();
-          KCal::MailScheduler scheduler( mCalendar );
-          scheduler.performTransaction( tmp, Scheduler::Counter );
-        }
-      } else {
-        kdWarning(5850) << k_funcinfo << "Counter proposals only supported for \
                events" << endl;
-      }
-    }
 
     if ( revert ) {
       assignIncidence( newinc, oldinc );
--- branches/KDE/3.5/kdepim/korganizer/incidencechanger.h #848893:848894
@@ -38,7 +38,7 @@
   bool endChange( Incidence *incidence );
 
   bool addIncidence( Incidence *incidence, QWidget *parent = 0 );
-  bool changeIncidence( Incidence *oldinc, Incidence *newinc, int action = -1, bool \
counter = false ); +  bool changeIncidence( Incidence *oldinc, Incidence *newinc, int \
action = -1 );  bool deleteIncidence( Incidence *incidence );
 
   bool cutIncidence( Incidence *incidence );
--- branches/KDE/3.5/kdepim/korganizer/interfaces/korganizer/incidencechangerbase.h \
#848893:848894 @@ -49,7 +49,7 @@
 
   virtual bool addIncidence( Incidence *incidence, QWidget *parent = 0 ) = 0;
   virtual bool changeIncidence( Incidence *newinc, Incidence *oldinc,
-                                int action = -1, bool counter = false ) = 0;
+                                int action = -1 ) = 0;
   virtual bool deleteIncidence( Incidence *incidence ) = 0;
   virtual bool cutIncidence( Incidence *incidence ) = 0;
 
--- branches/KDE/3.5/kdepim/korganizer/koeventeditor.cpp #848893:848894
@@ -278,20 +278,24 @@
     writeEvent( event );
     kdDebug(5850) << "KOEventEditor::processInput() event written." << endl;
 
-    if( *event == *mEvent )
+    if( *event == *mEvent ) {
       // Don't do anything
       kdDebug(5850) << "Event not changed\n";
-    else {
+      if ( mIsCounter )
+        KMessageBox::information( this, i18n("You didn't change the event, thus no \
counter proposal has been sent to the organizer."), i18n("No changes") ); +    } else \
{  kdDebug(5850) << "Event changed\n";
       //IncidenceChanger::assignIncidence( mEvent, event );
       writeEvent( mEvent );
       if ( mIsCounter ) {
+        KOGroupware::instance()->sendCounterProposal( mCalendar, oldEvent, mEvent );
+        // add dummy event at the position of the counter proposal
         Event *event = mEvent->clone();
         event->clearAttendees();
         event->setSummary( i18n("My counter proposal for: %1").arg( \
mEvent->summary() ) );  mChanger->addIncidence( event );
       } else {
-        mChanger->changeIncidence( oldEvent, mEvent, -1, mIsCounter );
+        mChanger->changeIncidence( oldEvent, mEvent );
       }
     }
     delete event;
--- branches/KDE/3.5/kdepim/korganizer/kogroupware.cpp #848893:848894
@@ -205,8 +205,11 @@
     // Delete the old incidence, if one is present
     scheduler.acceptTransaction( incidence, KCal::Scheduler::Cancel, status );
   else if ( action.startsWith( "reply" ) ) {
-    scheduler.acceptTransaction( incidence, method == Scheduler::Counter ? \
                Scheduler::Request : method, status );
-    if ( method == Scheduler::Counter ) {
+    if ( method != Scheduler::Counter ) {
+      scheduler.acceptTransaction( incidence, method, status );
+    } else {
+      // accept counter proposal
+      scheduler.acceptCounterProposal( incidence );
       // send update to all attendees
       sendICalMessage( mView, Scheduler::Request, incidence );
     }
@@ -330,5 +333,22 @@
     return false;
 }
 
+void KOGroupware::sendCounterProposal(KCal::Calendar *calendar, KCal::Event * \
oldEvent, KCal::Event * newEvent) const +{
+  if ( !oldEvent || !newEvent || *oldEvent == *newEvent || \
!KOPrefs::instance()->mUseGroupwareCommunication ) +    return;
+  if ( KOPrefs::instance()->outlookCompatCounterProposals() ) {
+    Incidence* tmp = oldEvent->clone();
+    tmp->setSummary( i18n("Counter proposal: %1").arg( newEvent->summary() ) );
+    tmp->setDescription( newEvent->description() );
+    tmp->addComment( i18n("Proposed new meeting time: %1 - %2").arg( \
newEvent->dtStartStr(), newEvent->dtEndStr() ) ); +    KCal::MailScheduler scheduler( \
calendar ); +    scheduler.performTransaction( tmp, Scheduler::Reply );
+    delete tmp;
+  } else {
+    KCal::MailScheduler scheduler( calendar );
+    scheduler.performTransaction( newEvent, Scheduler::Counter );
+  }
+}
 
 #include "kogroupware.moc"
--- branches/KDE/3.5/kdepim/korganizer/kogroupware.h #848893:848894
@@ -76,6 +76,13 @@
                           Incidence* incidence, bool isDeleting = false,
                           bool statusChanged = false );
 
+    /**
+      Send counter proposal message.
+      @param oldEvent The original event provided in the invitations.
+      @param newEvent The new event as edited by the user.
+    */
+    void sendCounterProposal( KCal::Calendar* calendar, KCal::Event* oldEvent, \
KCal::Event *newEvent ) const; +
     // THIS IS THE ACTUAL KM/KO API
     enum EventState { Accepted, ConditionallyAccepted, Declined, Request };
 
--- branches/KDE/3.5/kdepim/korganizer/mailscheduler.cpp #848893:848894
@@ -30,10 +30,12 @@
 #include <kstandarddirs.h>
 #include <kdebug.h>
 
+#include <libkcal/calendar.h>
 #include <libkcal/event.h>
 #include <libkcal/icalformat.h>
 
 #include "komailclient.h"
+#include "incidencechanger.h"
 
 #include "mailscheduler.h"
 
@@ -163,3 +165,28 @@
 {
   return locateLocal( "data", "korganizer/freebusy" );
 }
+
+bool MailScheduler::acceptCounterProposal( Incidence *incidence )
+{
+  if ( !incidence )
+    return false;
+
+  Incidence *exInc = mCalendar->incidence( incidence->uid() );
+  if ( !exInc )
+    exInc = mCalendar->incidenceFromSchedulingID( incidence->uid() );
+  incidence->setRevision( incidence->revision() + 1 );
+  if ( exInc ) {
+    incidence->setRevision( QMAX( incidence->revision(), exInc->revision() + 1 ) );
+    // some stuff we don't want to change, just to be safe
+    incidence->setSchedulingID( exInc->schedulingID() );
+    incidence->setUid( exInc->uid() );
+
+    mCalendar->beginChange( exInc );
+    IncidenceChanger::assignIncidence( exInc, incidence );
+    exInc->updated();
+    mCalendar->endChange( exInc );
+  } else {
+    mCalendar->addIncidence( incidence );
+  }
+  return true;
+}
--- branches/KDE/3.5/kdepim/korganizer/mailscheduler.h #848893:848894
@@ -52,7 +52,10 @@
 
     /** Returns the directory where the free-busy information is stored */
     virtual QString freeBusyDir();
-  
+
+    /** Accepts a counter proposal */
+    bool acceptCounterProposal( Incidence *incidence );
+
   private:
     QMap<IncidenceBase *, QString> mEventMap;
 };
--- branches/KDE/3.5/kdepim/korganizer/multiagendaview.cpp #848893:848894
@@ -120,6 +120,11 @@
       }
     }
   }
+
+  // no resources activated, so stop here to avoid crashing somewhere down the line, \
TODO: show a nice message instead +  if ( mAgendaViews.isEmpty() )
+    return;
+
   setupViews();
   QTimer::singleShot( 0, this, SLOT(slotResizeScrollView()) );
   mTimeLabels->updateConfig();
--- branches/KDE/3.5/kdepim/libkcal/incidencebase.cpp #848893:848894
@@ -87,9 +87,6 @@
   mSyncStatus = i.mSyncStatus;
   mComments = i.mComments;
 
-  // The copied object is a new one, so it isn't observed by the observer
-  // of the original object.
-  mObservers.clear();
   return *this;
 }
 


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

Configure | About | News | Add a list | Sponsored by KoreLogic