[Bug 258700] cannot full accept/decline a condional accepted invitation.

Tobias Koenig tokoe at kde.org
Tue Dec 28 12:08:45 GMT 2010


https://bugs.kde.org/show_bug.cgi?id=258700


Tobias Koenig <tokoe at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Tobias Koenig <tokoe kde org>  2010-12-28 13:08:44 ---
commit e3edc761de969fe511c5761d4ecd0d4e800bc62d
branch master
Author: Tobias Koenig <tokoe at kde.org>
Date:   Tue Dec 28 13:10:41 2010 +0100

    Make Invitation Bar available in mobile UI

    The accept/decline functionality seems to be broken in master
    right now though, have to cross-check with other developers...

    BUG: 258700

diff --git a/incidenceeditor-ng/eventortodomobile.ui
b/incidenceeditor-ng/eventortodomobile.ui
index b30d49e..c5e5fb8 100644
--- a/incidenceeditor-ng/eventortodomobile.ui
+++ b/incidenceeditor-ng/eventortodomobile.ui
@@ -11,7 +11,56 @@
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <item row="0" column="0">
+   <item row="0" column="1" colspan="3">
+    <widget class="QWidget" name="mInvitationBar" native="true">
+     <layout class="QHBoxLayout" name="horizontalLayout_10">
+      <property name="margin">
+       <number>0</number>
+      </property>
+      <item>
+       <widget class="QLabel" name="label_7">
+        <property name="text">
+         <string comment="@info">You are Invited, what do you want to
do?</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mAcceptInvitationButton">
+        <property name="toolTip">
+         <string comment="@info:tooltip">Accept the invitation</string>
+        </property>
+        <property name="whatsThis">
+         <string comment="@info:whatsthis">Click this button to accept the
invitation.</string>
+        </property>
+        <property name="text">
+         <string comment="@action:button Accept an invitation">Accept</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="mDeclineInvitationButton">
+        <property name="text">
+         <string comment="@action:button decline an
invitation">Decline</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_13">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0">
     <widget class="QLabel" name="label_3">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -42,7 +91,7 @@
      </property>
     </widget>
    </item>
-   <item row="0" column="1" colspan="3">
+   <item row="1" column="1" colspan="3">
     <widget class="KLineEdit" name="mSummaryEdit">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -64,7 +113,7 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="0">
+   <item row="2" column="0">
     <widget class="QLabel" name="label_4">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -83,7 +132,7 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="1" colspan="3">
+   <item row="2" column="1" colspan="3">
     <widget class="KLineEdit" name="mLocationEdit">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -105,7 +154,7 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="0">
+   <item row="4" column="0">
     <widget class="QLabel" name="mStartLabel">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -121,7 +170,7 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="1">
+   <item row="4" column="1">
     <widget class="QCheckBox" name="mStartCheck">
      <property name="whatsThis">
       <string comment="@info:whatsthis">Sets the start date for this
to-do</string>
@@ -131,7 +180,7 @@
      </property>
     </widget>
    </item>
-   <item row="4" column="1" colspan="2">
+   <item row="5" column="1" colspan="2">
     <widget class="IncidenceEditorNG::KTimeZoneComboBox"
name="mTimeZoneComboStart">
      <property name="enabled">
       <bool>false</bool>
@@ -147,7 +196,7 @@
      </property>
     </widget>
    </item>
-   <item row="5" column="0">
+   <item row="6" column="0">
     <widget class="QLabel" name="mEndLabel">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -163,7 +212,7 @@
      </property>
     </widget>
    </item>
-   <item row="5" column="1">
+   <item row="6" column="1">
     <widget class="QCheckBox" name="mEndCheck">
      <property name="whatsThis">
       <string comment="@info:whatsthis">Sets the due date for this
to-do.</string>
@@ -173,7 +222,7 @@
      </property>
     </widget>
    </item>
-   <item row="6" column="1" colspan="2">
+   <item row="7" column="1" colspan="2">
     <widget class="IncidenceEditorNG::KTimeZoneComboBox"
name="mTimeZoneComboEnd">
      <property name="enabled">
       <bool>false</bool>
@@ -189,7 +238,7 @@
      </property>
     </widget>
    </item>
-   <item row="7" column="1" colspan="3">
+   <item row="8" column="1" colspan="3">
     <widget class="QCheckBox" name="mWholeDayCheck">
      <property name="whatsThis">
       <string comment="@info:whatsthis">Set if this to-do's start and due
dates have times associated with them.</string>
@@ -202,7 +251,7 @@
      </property>
     </widget>
    </item>
-   <item row="2" column="1" colspan="3">
+   <item row="3" column="1" colspan="3">
     <widget class="QWidget" name="mCompletionPriorityWidget" native="true">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -320,7 +369,7 @@
      </layout>
     </widget>
    </item>
-   <item row="9" column="0" colspan="4">
+   <item row="10" column="0" colspan="4">
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
@@ -333,7 +382,7 @@
      </property>
     </spacer>
    </item>
-   <item row="2" column="0">
+   <item row="3" column="0">
     <widget class="QLabel" name="mTaskLabel">
      <property name="text">
       <string comment="@label Task specific line in the dialog containing
progress and priority">Progress:</string>
@@ -343,14 +392,14 @@
      </property>
     </widget>
    </item>
-   <item row="8" column="1" colspan="3">
+   <item row="9" column="1" colspan="3">
     <widget class="QCheckBox" name="mFreeBusyCheck">
      <property name="text">
       <string comment="@option:check">Blocks me for other events</string>
      </property>
     </widget>
    </item>
-   <item row="3" column="2">
+   <item row="4" column="2">
     <widget class="KPIM::KDateEdit" name="mStartDateEdit">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -381,7 +430,7 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="3">
+   <item row="4" column="3">
     <widget class="KPIM::KTimeEdit" name="mStartTimeEdit">
      <property name="enabled">
       <bool>false</bool>
@@ -412,7 +461,7 @@
      </property>
     </widget>
    </item>
-   <item row="5" column="2">
+   <item row="6" column="2">
     <widget class="KPIM::KDateEdit" name="mEndDateEdit">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -440,7 +489,7 @@
      </property>
     </widget>
    </item>
-   <item row="5" column="3">
+   <item row="6" column="3">
     <widget class="KPIM::KTimeEdit" name="mEndTimeEdit">
      <property name="enabled">
       <bool>false</bool>
diff --git a/mobile/lib/calendar/incidenceview.cpp
b/mobile/lib/calendar/incidenceview.cpp
index 7af9bb5..b5aa92d 100644
--- a/mobile/lib/calendar/incidenceview.cpp
+++ b/mobile/lib/calendar/incidenceview.cpp
@@ -21,6 +21,8 @@
 #include "calendarhelper.h"
 #include "clockhelper.h"

+#include "ui_eventortodomobile.h"
+
 #include <calendarsupport/utils.h>
 #include <calendarsupport/kcalprefs.h>

@@ -41,6 +43,7 @@
 #include <qdeclarativeengine.h>
 #include <qdeclarativecontext.h>

+#include <incidenceeditor-ng/editorconfig.h>
 #include <incidenceeditor-ng/incidencealarm.h>
 #include <incidenceeditor-ng/incidenceattachment.h>
 #include <incidenceeditor-ng/incidenceattendee.h>
@@ -67,9 +70,11 @@ IncidenceView::IncidenceView( QWidget* parent )
   , mEditor( new CombinedIncidenceEditor( parent ) )
   , mEditorDateTime( 0 )
   , mIncidenceMore( 0 )
+  , mIncidenceGeneral( 0 )
   , mDateWidget( 0 )
   , mTimeWidget( 0 )
   , mInvitationDispatcher( 0 )
+  , mIncidenceAttendee( 0 )
 {
   setAttribute(Qt::WA_DeleteOnClose);
   QDeclarativeContext *context = engine()->rootContext();
@@ -128,6 +133,8 @@ void IncidenceView::setCollectionCombo(
Akonadi::CollectionComboBox *combo )

 void IncidenceView::setGeneralEditor( MobileIncidenceGeneral *editorWidget )
 {
+  mIncidenceGeneral = editorWidget;
+
   Q_ASSERT( mItem.hasPayload<Incidence::Ptr>() );
   Incidence::Ptr incidencePtr = CalendarSupport::incidence( mItem );

@@ -147,8 +154,31 @@ void IncidenceView::setGeneralEditor(
MobileIncidenceGeneral *editorWidget )
   mEditor->combine( editor );
   mEditor->load( incidencePtr );

-  if ( mIncidenceMore != 0 ) // IncidenceMore was set *before* general.
+  const QStringList allEmails =
IncidenceEditorNG::EditorConfig::instance()->allEmails();
+  const KCalCore::Attendee::Ptr me = incidencePtr->attendeeByMails( allEmails
);
+
+  if ( incidencePtr->attendeeCount() > 1 &&
+       me && ( me->status() == KCalCore::Attendee::NeedsAction ||
+               me->status() == KCalCore::Attendee::Tentative ||
+               me->status() == KCalCore::Attendee::InProcess ) ) {
+    editorWidget->mUi->mInvitationBar->show();
+  } else {
+    editorWidget->mUi->mInvitationBar->hide();
+  }
+
+  if ( mIncidenceMore != 0 ) { // IncidenceMore was set *before* general.
     initIncidenceMore();
+
+    connect( editorWidget->mUi->mAcceptInvitationButton, SIGNAL( clicked() ),
+             mIncidenceAttendee, SLOT( acceptForMe() ), Qt::UniqueConnection
);
+    connect( editorWidget->mUi->mDeclineInvitationButton, SIGNAL( clicked() ),
+             mIncidenceAttendee, SLOT( declineForMe() ), Qt::UniqueConnection 
);
+  }
+
+  connect( editorWidget->mUi->mAcceptInvitationButton, SIGNAL( clicked() ),
+           editorWidget->mUi->mInvitationBar, SLOT( hide() ) );
+  connect( editorWidget->mUi->mDeclineInvitationButton, SIGNAL( clicked() ),
+           editorWidget->mUi->mInvitationBar, SLOT( hide() ) );
 }

 void IncidenceView::showCalendar( QObject *obj )
@@ -205,8 +235,8 @@ void IncidenceView::initIncidenceMore()
   editor = new IncidenceEditorNG::IncidenceDescription( mIncidenceMore->mUi );
   mEditor->combine( editor );

-  editor = new IncidenceEditorNG::IncidenceAttendee( 0, mEditorDateTime,
mIncidenceMore->mUi );
-  mEditor->combine( editor );
+  mIncidenceAttendee = new IncidenceEditorNG::IncidenceAttendee( 0,
mEditorDateTime, mIncidenceMore->mUi );
+  mEditor->combine( mIncidenceAttendee );

   editor = new IncidenceEditorNG::IncidenceAlarm( mEditorDateTime,
mIncidenceMore->mUi );
   mEditor->combine( editor );
@@ -226,8 +256,16 @@ void IncidenceView::initIncidenceMore()
 void IncidenceView::setMoreEditor( MobileIncidenceMore *editorWidget )
 {
   mIncidenceMore = editorWidget;
+
   if ( mEditorDateTime != 0 ) // IncidenceGeneral was not set yet.
     initIncidenceMore();
+
+  if ( mIncidenceGeneral ) {
+    connect( mIncidenceGeneral->mUi->mAcceptInvitationButton, SIGNAL(
clicked() ),
+             mIncidenceAttendee, SLOT( acceptForMe() ), Qt::UniqueConnection
);
+    connect( mIncidenceGeneral->mUi->mDeclineInvitationButton, SIGNAL(
clicked() ),
+             mIncidenceAttendee, SLOT( declineForMe() ), Qt::UniqueConnection 
);
+  }
 }

 void IncidenceView::setDefaultCollection( const Akonadi::Collection
&collection )
diff --git a/mobile/lib/calendar/incidenceview.h
b/mobile/lib/calendar/incidenceview.h
index 85836fb..eb325e1 100644
--- a/mobile/lib/calendar/incidenceview.h
+++ b/mobile/lib/calendar/incidenceview.h
@@ -38,6 +38,7 @@ class CollectionComboBox;
 }

 namespace IncidenceEditorNG {
+class IncidenceAttendee;
 class IncidenceDateTime;
 class InvitationDispatcher;
 }
@@ -107,11 +108,13 @@ class IncidenceView : public KDeclarativeFullScreenView,
public IncidenceEditorN

     /// We need this because we can't rely on the order in which those two are
added.
     MobileIncidenceMore *mIncidenceMore;
+    MobileIncidenceGeneral *mIncidenceGeneral;

     KPIM::KDateEdit *mDateWidget;
     KPIM::KTimeEdit *mTimeWidget;

     IncidenceEditorNG::InvitationDispatcher *mInvitationDispatcher;
+    IncidenceEditorNG::IncidenceAttendee *mIncidenceAttendee;
 };

 #endif // INCIDENCEVIEW_H

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list