[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 16:59:10
Message-ID: 1219078750.324124.1633.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 848887 by vkrause:

First round of counter proposal fixes with minor changes to comply with the string \
freeze. All added strings should already be present elsewhere in the same module.

Merged revisions 791184-791440,791443-792201,792203-792957 via svnmerge from 
https://vkrause@svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim

........
  r791184 | vkrause | 2008-03-28 17:52:23 +0100 (Fri, 28 Mar 2008) | 4 lines
  
  Add the proposed new event into the calendar.
  
  Kolab issue 2148
........
  r791200 | vkrause | 2008-03-28 19:02:57 +0100 (Fri, 28 Mar 2008) | 2 lines
  
  Improve display of iTIP counter proposals.
........
  r791414 | vkrause | 2008-03-29 15:00:41 +0100 (Sat, 29 Mar 2008) | 2 lines
  
  Implement declining of counter proposals.
........
  r791430 | vkrause | 2008-03-29 15:43:58 +0100 (Sat, 29 Mar 2008) | 6 lines
  
  - allow to accept counter proposals
  - send real iTIP counter proposals by default but keep the Outlook
    compat ones as an option
  
  Kolab issue 2147, 2149
........
  r792230 | vkrause | 2008-03-31 19:35:35 +0200 (Mon, 31 Mar 2008) | 4 lines
  
  Send declined counter proposals back to the sender instead of to myself.
  
  Kolab issue 2581
........
  r792231 | vkrause | 2008-03-31 19:39:22 +0200 (Mon, 31 Mar 2008) | 5 lines
  
  Don't delete invitations after a counter proposal in any case, eg. after a
  rejection it might be needed again.
  
  Kolab issue 2580
........
  r792950 | vkrause | 2008-04-02 18:39:22 +0200 (Wed, 02 Apr 2008) | 7 lines
  
  - don't add the original event to the calendar when creating a counter
    proposal
  - hide the invitation bar when editing a counter proposal to avoid
    confusion
  
  Kolab issue 2582
........
  r792957 | vkrause | 2008-04-02 19:06:52 +0200 (Wed, 02 Apr 2008) | 7 lines
  
   don't send cancel notifications to the organizer on event deletion if
    I happen to be the organizer myself
  - create standard conform cancel notifications on event deletion
    (they must contain exactly one attendee entry)
  
  Kolab issue 2578
........


 _M            . (directory)  
 M  +5 -0      kmail/callback.cpp  
 M  +3 -0      kmail/callback.h  
 M  +2 -2      korganizer/calendarview.cpp  
 M  +1 -1      korganizer/calendarview.h  
 M  +35 -6     korganizer/incidencechanger.cpp  
 M  +1 -1      korganizer/koeventeditor.cpp  
 M  +13 -6     korganizer/kogroupware.cpp  
 M  +1 -1      korganizer/koincidenceeditor.h  
 M  +4 -3      korganizer/komailclient.cpp  
 M  +2 -2      korganizer/komailclient.h  
 M  +5 -0      korganizer/korganizer.kcfg  
 M  +6 -1      korganizer/mailscheduler.cpp  
 M  +6 -0      libkcal/incidenceformatter.cpp  
 M  +41 -5     plugins/kmail/bodypartformatter/text_calendar.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,793296, \
794734,800441,817568,817604,817710-818288,818312-819076,819078-820073,820075-821035,82 \
1037-821124,821126-821378,821380-821648,821650-821813,821815-821835,821837-822268,8222 \
70-823864,823866-824217,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,800441,817568,817604,817710-818288,818 \
312-819076,819078-820073,820075-821035,821037-821124,821126-821378,821380-821648,82165 \
0-821813,821815-821835,821837-822268,822270-823864,823866-824217,824219-824277,824279- \
824285,824287-824288,824290-824805,824807-825075,825077-825083,825085-826354,826356-827491,830100,830443
                
--- branches/KDE/3.5/kdepim/kmail/callback.cpp #848886:848887
@@ -211,3 +211,8 @@
 {
     return GlobalSettings::self()->deleteInvitationEmailsAfterSendingReply();
 }
+
+QString Callback::sender() const
+{
+  return mMsg->from();
+}
--- branches/KDE/3.5/kdepim/kmail/callback.h #848886:848887
@@ -69,6 +69,9 @@
   /** Get the receiver of the mail */
   QString receiver() const;
 
+  /** Returns the sender of the mail. */
+  QString sender() const;
+
   /** Close the main window showing this message, if it's a secondary window. */
   void closeIfSecondaryWindow() const;
 
--- branches/KDE/3.5/kdepim/korganizer/calendarview.cpp #848886:848887
@@ -1895,7 +1895,7 @@
   eventViewer->show();
 }
 
-bool CalendarView::editIncidence( Incidence *incidence )
+bool CalendarView::editIncidence( Incidence *incidence, bool isCounter )
 {
   kdDebug(5850) << "CalendarView::editEvent()" << endl;
 
@@ -1917,7 +1917,7 @@
     return true;
   }
 
-  if ( !mChanger->beginChange( incidence ) ) {
+  if ( !isCounter && !mChanger->beginChange( incidence ) ) {
     warningChangeFailed( incidence );
     showIncidence( incidence );
     return false;
--- branches/KDE/3.5/kdepim/korganizer/calendarview.h #848886:848887
@@ -287,7 +287,7 @@
     /** Create a read-only viewer dialog for the supplied incidence. It calls the \
correct showXXX method*/  void showIncidence( Incidence * );
     /** Create an editor for the supplied incidence. It calls the correct editXXX \
                method*/
-    bool editIncidence( Incidence * );
+    bool editIncidence( Incidence *incidence, bool isCounter = false );
     /**
       Delete the supplied incidence. It calls the correct deleteXXX method
       @param force If true, all recurrences and sub-todos (if applicable) will be
--- branches/KDE/3.5/kdepim/korganizer/incidencechanger.cpp #848886:848887
@@ -93,8 +93,31 @@
   bool doDelete = sendGroupwareMessage( incidence, KCal::Scheduler::Cancel );
   if( doDelete ) {
     // @TODO: let Calendar::deleteIncidence do the locking...
+    Incidence* tmp = incidence->clone();
     emit incidenceToBeDeleted( incidence );
     doDelete = mCalendar->deleteIncidence( incidence );
+    if ( !KOPrefs::instance()->thatIsMe( tmp->organizer().email() ) ) {
+      const QStringList myEmails = KOPrefs::instance()->allEmails();
+      bool notifyOrganizer = false;
+      for ( QStringList::ConstIterator it = myEmails.begin(); it != myEmails.end(); \
++it ) { +        QString email = *it;
+        Attendee *me = tmp->attendeeByMail(email);
+        if ( me ) {
+          if ( me->status() == KCal::Attendee::Accepted || me->status() == \
KCal::Attendee::Delegated ) +            notifyOrganizer = true;
+          Attendee *newMe = new Attendee( *me );
+          newMe->setStatus( KCal::Attendee::Declined );
+          tmp->clearAttendees();
+          tmp->addAttendee( newMe );
+          break;
+        }
+      }
+
+      if ( notifyOrganizer ) {
+          KCal::MailScheduler scheduler( mCalendar );
+          scheduler.performTransaction( tmp, Scheduler::Reply );
+      }
+    }
     emit incidenceDeleted( incidence );
   }
   return doDelete;
@@ -290,12 +313,18 @@
       // pseudo counter as done by outlook
       Event *e = dynamic_cast<Event*>( newinc );
       if ( e ) {
-        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 );
+        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;  }
--- branches/KDE/3.5/kdepim/korganizer/koeventeditor.cpp #848886:848887
@@ -289,7 +289,7 @@
         Event *event = mEvent->clone();
         event->clearAttendees();
         event->setSummary( i18n("My counter proposal for: %1").arg( \
                mEvent->summary() ) );
-        mChanger->changeIncidence( oldEvent, event, -1, mIsCounter );
+        mChanger->addIncidence( event );
       } else {
         mChanger->changeIncidence( oldEvent, mEvent, -1, mIsCounter );
       }
--- branches/KDE/3.5/kdepim/korganizer/kogroupware.cpp #848886:848887
@@ -190,24 +190,31 @@
       if( (*it)->email() == receiver ) {
         if ( action.startsWith( "accepted" ) )
           (*it)->setStatus( KCal::Attendee::Accepted );
-        else if ( action.startsWith( "tentative" ) || action.startsWith( "counter" ) \
) +        else if ( action.startsWith( "tentative" ) )
           (*it)->setStatus( KCal::Attendee::Tentative );
+        else if ( KOPrefs::instance()->outlookCompatCounterProposals() && \
action.startsWith( "counter" ) ) +          (*it)->setStatus( \
KCal::Attendee::Tentative );  else if ( action.startsWith( "delegated" ) )
           (*it)->setStatus( KCal::Attendee::Delegated );
         break;
       }
     }
-    scheduler.acceptTransaction( incidence, method, status );
+    if ( KOPrefs::instance()->outlookCompatCounterProposals() || !action.startsWith( \
"counter" ) ) +      scheduler.acceptTransaction( incidence, method, status );
   } else if ( action.startsWith( "cancel" ) )
     // Delete the old incidence, if one is present
     scheduler.acceptTransaction( incidence, KCal::Scheduler::Cancel, status );
-  else if ( action.startsWith( "reply" ) )
-    scheduler.acceptTransaction( incidence, method, status );
-  else
+  else if ( action.startsWith( "reply" ) ) {
+    scheduler.acceptTransaction( incidence, method == Scheduler::Counter ? \
Scheduler::Request : method, status ); +    if ( method == Scheduler::Counter ) {
+      // send update to all attendees
+      sendICalMessage( mView, Scheduler::Request, incidence );
+    }
+  } else
     kdError(5850) << "Unknown incoming action " << action << endl;
 
   if ( action.startsWith( "counter" ) ) {
-    mView->editIncidence( incidence );
+    mView->editIncidence( incidence, true );
     KOIncidenceEditor *tmp = mView->editorDialog( incidence );
     tmp->selectInvitationCounterProposal( true );
   }
--- branches/KDE/3.5/kdepim/korganizer/koincidenceeditor.h #848886:848887
@@ -68,7 +68,7 @@
 
     virtual void reload() = 0;
 
-    void selectInvitationCounterProposal( bool enable );
+    virtual void selectInvitationCounterProposal( bool enable );
 
   public slots:
     /** Edit an existing todo. */
--- branches/KDE/3.5/kdepim/korganizer/komailclient.cpp #848886:848887
@@ -87,16 +87,17 @@
   return send(from,to,subject,body,bcc,attachment);
 }
 
-bool KOMailClient::mailOrganizer(IncidenceBase *incidence,const QString &attachment)
+bool KOMailClient::mailOrganizer(IncidenceBase *incidence,const QString &attachment, \
const QString &sub)  {
   QString to = incidence->organizer().fullName();
 
   QString from = KOPrefs::instance()->email();
 
-  QString subject;
+  QString subject = sub;
   if(incidence->type()!="FreeBusy") {
     Incidence *inc = static_cast<Incidence *>(incidence);
-    subject = inc->summary();
+    if ( subject.isEmpty() )
+      subject = inc->summary();
   } else {
     subject = "Free Busy Message";
   }
--- branches/KDE/3.5/kdepim/korganizer/komailclient.h #848886:848887
@@ -37,9 +37,9 @@
   public:
     KOMailClient();
     virtual ~KOMailClient();
-    
+
     bool mailAttendees(IncidenceBase *,const QString &attachment=QString::null);
-    bool mailOrganizer(IncidenceBase *,const QString &attachment=QString::null);
+    bool mailOrganizer(IncidenceBase *,const QString &attachment=QString::null, \
                const QString &sub = QString::null);
     bool mailTo(IncidenceBase *,const QString &recipients,const QString \
&attachment=QString::null);  
   protected:
--- branches/KDE/3.5/kdepim/korganizer/korganizer.kcfg #848886:848887
@@ -353,6 +353,11 @@
     <entry type="StringList" name="AdditionalMails">
     </entry>
 
+    <entry name="OutlookCompatCounterProposals" type="Bool">
+      <label>Send Outlook-like pseudo counter proposals</label>
+      <default>false</default>
+    </entry>
+
   </group>
 
   <group name="Colors">
--- branches/KDE/3.5/kdepim/korganizer/mailscheduler.cpp #848886:848887
@@ -26,6 +26,7 @@
 #include <qfile.h>
 #include <qregexp.h>
 
+#include <klocale.h>
 #include <kstandarddirs.h>
 #include <kdebug.h>
 
@@ -80,7 +81,11 @@
        method == Declinecounter ) {
     status = mailer.mailAttendees( incidence, messageText );
   } else {
-    status = mailer.mailOrganizer( incidence, messageText );
+    QString subject;
+    Incidence *inc = dynamic_cast<Incidence*>( incidence );
+    if ( inc && method == Counter )
+      subject = i18n( "Counter proposal: %1" ).arg( inc->summary() );
+    status = mailer.mailOrganizer( incidence, messageText, subject );
   }
   return status;
 }
--- branches/KDE/3.5/kdepim/libkcal/incidenceformatter.cpp #848886:848887
@@ -1354,6 +1354,12 @@
         break;
 
     case Scheduler::Counter:
+        html += helper->makeLink( "accept_counter", i18n("[Accept]") );
+        html += "&nbsp;";
+        html += helper->makeLink( "decline_counter", i18n("[Decline]") );
+        html += "&nbsp;";
+        html += helper->makeLink( "check_calendar", i18n("[Check my calendar]" ) );
+        break;
     case Scheduler::Declinecounter:
     case Scheduler::NoMethod:
         break;
--- branches/KDE/3.5/kdepim/plugins/kmail/bodypartformatter/text_calendar.cpp \
#848886:848887 @@ -309,7 +309,8 @@
     enum MailType {
       Answer,
       Delegation,
-      Forward
+      Forward,
+      DeclineCounter
     };
 
     bool mail( Incidence* incidence, KMail::Callback& callback,
@@ -334,6 +335,11 @@
         case Forward:
           subject = i18n( "Forwarded: %1" ).arg( summary );
           break;
+        case DeclineCounter:
+          // ### string freeze
+          //subject = i18n( "Declined Counter Proposal: %1" ).arg( summary );
+          subject = i18n( "Answer: %1" ).arg( summary );
+          break;
       }
 
       QString recv = to;
@@ -538,14 +544,34 @@
       return true;
     }
 
+    bool handleDeclineCounter( const QString &iCal, KMail::Callback &callback ) \
const +    {
+      const QString receiver = callback.receiver();
+      if ( receiver.isEmpty() )
+        return true;
+      Incidence* incidence = icalToString( iCal );
+      if ( callback.askForComment( Attendee::Declined ) ) {
+        bool ok = false;
+        // ### string freeze
+        QString comment = KInputDialog::getMultiLineText( i18n("Reaction to \
Invitation") /* i18n("Decline Counter Proposal") */, +            i18n("Comment:"), \
QString(), &ok ); +        if ( !ok )
+          return true;
+        if ( !comment.isEmpty() )
+          incidence->addComment( comment );
+      }
+      return mail( incidence, callback, Attendee::NeedsAction, \
Scheduler::Declinecounter, +                   callback.sender(), DeclineCounter );
+    }
+
     bool counterProposal( const QString &iCal, KMail::Callback &callback ) const
     {
       const QString receiver = callback.receiver();
       if ( receiver.isEmpty() )
         return true;
       saveFile( receiver, iCal, "counter" );
-      if ( callback.deleteInvitationAfterReply() )
-        ( new KMDeleteMsgCommand( callback.getMsg()->getMsgSerNum() ) )->start();
+      // Don't delete the invitation here in any case, if the counter proposal
+      // is declined you might need it again.
       return true;
     }
 
@@ -573,6 +599,9 @@
         result = handleIgnore( iCal, c );
       if ( path == "decline" )
         result = handleInvitation( iCal, Attendee::Declined, c );
+      if ( path == "decline_counter" ) {
+        result = handleDeclineCounter( iCal, c );
+      }
       if ( path == "delegate" )
         result = handleInvitation( iCal, Attendee::Delegated, c );
       if ( path == "forward" ) {
@@ -590,9 +619,10 @@
         Incidence* incidence = icalToString( iCal );
         showCalendar( incidence->dtStart().date() );
       }
-      if ( path == "reply" || path == "cancel" ) {
+      if ( path == "reply" || path == "cancel" || path == "accept_counter" ) {
         // These should just be saved with their type as the dir
-        if ( saveFile( "Receiver Not Searched", iCal, path ) ) {
+        const QString p = (path == "accept_counter" ? QString("reply") : path);
+        if ( saveFile( "Receiver Not Searched", iCal, p ) ) {
           if ( c.deleteInvitationAfterReply() )
             ( new KMDeleteMsgCommand( c.getMsg()->getMsgSerNum() ) )->start();
           result = true;
@@ -618,12 +648,18 @@
           return i18n("Accept incidence");
         if ( path == "accept_conditionally" )
           return i18n( "Accept incidence conditionally" );
+// ### string freeze
+//        if ( path == "accept_counter" )
+//          return i18n( "Accept counter proposal" );
         if ( path == "counter" )
           return i18n( "Create a counter proposal..." );
         if ( path == "ignore" )
           return i18n( "Throw mail away" );
         if ( path == "decline" )
           return i18n( "Decline incidence" );
+// ### string freeze
+//        if ( path == "decline_counter" )
+//          return i18n( "Decline counter proposal" );
         if ( path == "check_calendar" )
           return i18n("Check my calendar..." );
         if ( path == "reply" )


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

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