File indexing completed on 2025-01-19 04:46:48
0001 /* 0002 This file is part of kdepim. 0003 0004 SPDX-FileCopyrightText: 2013 Sérgio Martins <iamsergio@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include "syncitiphandler.h" 0010 #include "text_calendar_debug.h" 0011 #include <CalendarSupport/CalendarSingleton> 0012 0013 using namespace Akonadi; 0014 0015 SyncItipHandler::SyncItipHandler(const QString &receiver, const QString &iCal, const QString &type, const Akonadi::CalendarBase::Ptr &calendar, QObject *parent) 0016 : QObject(parent) 0017 , m_counterProposalEditorDelegate(new IncidenceEditorNG::GroupwareUiDelegate()) 0018 { 0019 Q_ASSERT(calendar); 0020 qCDebug(TEXT_CALENDAR_LOG) << "SyncItipHandler::SyncItipHandler: " << this; 0021 auto handler = new Akonadi::ITIPHandler(this); 0022 QObject::connect(handler, &Akonadi::ITIPHandler::iTipMessageProcessed, this, &SyncItipHandler::onITipMessageProcessed, Qt::QueuedConnection); 0023 0024 handler->setGroupwareUiDelegate(m_counterProposalEditorDelegate); 0025 handler->setCalendar(calendar); 0026 0027 handler->processiTIPMessage(receiver, iCal, type); 0028 0029 m_eventLoop.exec(); 0030 } 0031 0032 SyncItipHandler::~SyncItipHandler() 0033 { 0034 qCDebug(TEXT_CALENDAR_LOG) << "SyncItipHandler::~SyncItipHandler: " << this; 0035 } 0036 0037 void SyncItipHandler::onITipMessageProcessed(Akonadi::ITIPHandler::Result result, const QString &errorMessage) 0038 { 0039 m_result = result; 0040 m_errorMessage = errorMessage; 0041 m_eventLoop.exit(); 0042 deleteLater(); 0043 delete m_counterProposalEditorDelegate; 0044 } 0045 0046 QString SyncItipHandler::errorMessage() const 0047 { 0048 return m_errorMessage; 0049 } 0050 0051 Akonadi::ITIPHandler::Result SyncItipHandler::result() const 0052 { 0053 return m_result; 0054 } 0055 0056 #include "moc_syncitiphandler.cpp"