File indexing completed on 2025-01-05 04:47:39
0001 /* 0002 SPDX-FileCopyrightText: 2000, 2001, 2004 Cornelius Schumacher <schumacher@kde.org> 0003 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> 0004 SPDX-FileCopyrightText: 2010 Andras Mantia <andras@kdab.com> 0005 SPDX-FileCopyrightText: 2010 Casey Link <casey@kdab.com> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #include "freebusyitem.h" 0011 0012 #include <Akonadi/FreeBusyManager> 0013 0014 using namespace CalendarSupport; 0015 0016 FreeBusyItem::FreeBusyItem(const KCalendarCore::Attendee &attendee, QWidget *parentWidget) 0017 : mAttendee(attendee) 0018 , mParentWidget(parentWidget) 0019 { 0020 Q_ASSERT(!attendee.isNull()); 0021 setFreeBusy(KCalendarCore::FreeBusy::Ptr()); 0022 } 0023 0024 KCalendarCore::Attendee FreeBusyItem::attendee() const 0025 { 0026 return mAttendee; 0027 } 0028 0029 void FreeBusyItem::setFreeBusy(const KCalendarCore::FreeBusy::Ptr &fb) 0030 { 0031 mFreeBusy = fb; 0032 mIsDownloading = false; 0033 } 0034 0035 KCalendarCore::FreeBusy::Ptr FreeBusyItem::freeBusy() const 0036 { 0037 return mFreeBusy; 0038 } 0039 0040 QString FreeBusyItem::email() const 0041 { 0042 return mAttendee.email(); 0043 } 0044 0045 void FreeBusyItem::setUpdateTimerID(int id) 0046 { 0047 mTimerID = id; 0048 } 0049 0050 int FreeBusyItem::updateTimerID() const 0051 { 0052 return mTimerID; 0053 } 0054 0055 void FreeBusyItem::startDownload(bool forceDownload) 0056 { 0057 mIsDownloading = true; 0058 Akonadi::FreeBusyManager *m = Akonadi::FreeBusyManager::self(); 0059 if (!m->retrieveFreeBusy(attendee().email(), forceDownload, mParentWidget)) { 0060 mIsDownloading = false; 0061 } 0062 } 0063 0064 void FreeBusyItem::setIsDownloading(bool d) 0065 { 0066 mIsDownloading = d; 0067 } 0068 0069 bool FreeBusyItem::isDownloading() const 0070 { 0071 return mIsDownloading; 0072 }