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

List:       kde-commits
Subject:    [kdepim-addons] plugins/messageviewer/bodypartformatter/calendar: Fix displaying ITIP invitations
From:       Daniel_Vrátil <dvratil () kde ! org>
Date:       2016-04-30 13:06:41
Message-ID: E1awUbZ-0001Wj-PW () scm ! kde ! org
[Download RAW message or body]

Git commit e47b6c67bf9ff7c00780dd637de0a72e77e814d1 by Daniel Vrátil.
Committed on 30/04/2016 at 13:05.
Pushed by dvratil into branch 'master'.

Fix displaying ITIP invitations

Probably some OTP refactoring broke displaying of ITIP invitation.
This patch fixes the problem. It may not fix the root cause of the
problem, but at least it makes ITIP invitations work again.

What happens is that OTP::parseObjectTreeInternal() first calls
Formatter::format() without the asyncResultObserver. Without this
patch it still creates the new memento, but does not connect it to
the observer. Then OTP calls the Formatter again immediatelly after,
but this time with a valid asyncResultObserver. Because the memento
already exists, this only triggers the codepath that checks whether
the memento is finished (which it is not) and exists. When the memento
is finished nothing happens, because it wasn't initially connected
to the observer to force update of the Viewer.

With this patch we don't create the memento if there is no
asyncResultObserver. That means that the next time the Formatter is
called with a valid asyncResultObserver we create the memento and
connect it to the observer. Once the memento is finished, the Viewer
is updated and the invitation is displayed correctly.

Differential Revision: https://phabricator.kde.org/D1512

M  +6    -5    plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp

http://commits.kde.org/kdepim-addons/e47b6c67bf9ff7c00780dd637de0a72e77e814d1

diff --git a/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp \
b/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp index 1889e8d..92b4668 100644
--- a/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp
+++ b/plugins/messageviewer/bodypartformatter/calendar/text_calendar.cpp
@@ -187,6 +187,10 @@ public:
             return Ok;
         }
 
+        if (!asyncResultObserver) {
+            return Ok;
+        }
+
         /** Formating is async now because we need to fetch incidences from akonadi.
             Basically this method (format()) will be called twice. The first time
             it creates the memento that fetches incidences and returns.
@@ -230,11 +234,8 @@ public:
         } else {
             MemoryCalendarMemento *memento = new MemoryCalendarMemento();
             bodyPart->setBodyPartMemento(memento);
-
-            if (asyncResultObserver) {
-                QObject::connect(memento, SIGNAL(update(MimeTreeParser::UpdateMode)),
-                                 asyncResultObserver, SLOT(update(MimeTreeParser::UpdateMode)));
-            }
+            QObject::connect(memento, SIGNAL(update(MimeTreeParser::UpdateMode)),
+                             asyncResultObserver, SLOT(update(MimeTreeParser::UpdateMode)));
         }
 
         return Ok;


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

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