Changeset View
Changeset View
Standalone View
Standalone View
src/freebusymodel/freebusyitem.cpp
Show All 20 Lines | |||||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "freebusyitem.h" | 23 | #include "freebusyitem.h" | ||
24 | 24 | | |||
25 | #include <Akonadi/Calendar/FreeBusyManager> | 25 | #include <Akonadi/Calendar/FreeBusyManager> | ||
26 | 26 | | |||
27 | using namespace CalendarSupport; | 27 | using namespace CalendarSupport; | ||
28 | 28 | | |||
29 | FreeBusyItem::FreeBusyItem(const KCalCore::Attendee::Ptr &attendee, QWidget *parentWidget) | 29 | FreeBusyItem::FreeBusyItem(const KCalCore::Attendee &attendee, QWidget *parentWidget) | ||
30 | : mAttendee(attendee) | 30 | : mAttendee(attendee) | ||
31 | , mTimerID(0) | 31 | , mTimerID(0) | ||
32 | , mIsDownloading(false) | 32 | , mIsDownloading(false) | ||
33 | , mParentWidget(parentWidget) | 33 | , mParentWidget(parentWidget) | ||
34 | { | 34 | { | ||
35 | Q_ASSERT(attendee); | 35 | Q_ASSERT(!attendee.isNull()); | ||
36 | setFreeBusy(KCalCore::FreeBusy::Ptr()); | 36 | setFreeBusy(KCalCore::FreeBusy::Ptr()); | ||
37 | } | 37 | } | ||
38 | 38 | | |||
39 | KCalCore::Attendee::Ptr FreeBusyItem::attendee() const | 39 | KCalCore::Attendee FreeBusyItem::attendee() const | ||
40 | { | 40 | { | ||
41 | return mAttendee; | 41 | return mAttendee; | ||
42 | } | 42 | } | ||
43 | 43 | | |||
44 | void FreeBusyItem::setFreeBusy(const KCalCore::FreeBusy::Ptr &fb) | 44 | void FreeBusyItem::setFreeBusy(const KCalCore::FreeBusy::Ptr &fb) | ||
45 | { | 45 | { | ||
46 | mFreeBusy = fb; | 46 | mFreeBusy = fb; | ||
47 | mIsDownloading = false; | 47 | mIsDownloading = false; | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | KCalCore::FreeBusy::Ptr FreeBusyItem::freeBusy() const | 50 | KCalCore::FreeBusy::Ptr FreeBusyItem::freeBusy() const | ||
51 | { | 51 | { | ||
52 | return mFreeBusy; | 52 | return mFreeBusy; | ||
53 | } | 53 | } | ||
54 | 54 | | |||
55 | QString FreeBusyItem::email() const | 55 | QString FreeBusyItem::email() const | ||
56 | { | 56 | { | ||
57 | return mAttendee->email(); | 57 | return mAttendee.email(); | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | void FreeBusyItem::setUpdateTimerID(int id) | 60 | void FreeBusyItem::setUpdateTimerID(int id) | ||
61 | { | 61 | { | ||
62 | mTimerID = id; | 62 | mTimerID = id; | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | int FreeBusyItem::updateTimerID() const | 65 | int FreeBusyItem::updateTimerID() const | ||
66 | { | 66 | { | ||
67 | return mTimerID; | 67 | return mTimerID; | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | void FreeBusyItem::startDownload(bool forceDownload) | 70 | void FreeBusyItem::startDownload(bool forceDownload) | ||
71 | { | 71 | { | ||
72 | mIsDownloading = true; | 72 | mIsDownloading = true; | ||
73 | Akonadi::FreeBusyManager *m = Akonadi::FreeBusyManager::self(); | 73 | Akonadi::FreeBusyManager *m = Akonadi::FreeBusyManager::self(); | ||
74 | if (!m->retrieveFreeBusy(attendee()->email(), forceDownload, mParentWidget)) { | 74 | if (!m->retrieveFreeBusy(attendee().email(), forceDownload, mParentWidget)) { | ||
75 | mIsDownloading = false; | 75 | mIsDownloading = false; | ||
76 | } | 76 | } | ||
77 | } | 77 | } | ||
78 | 78 | | |||
79 | void FreeBusyItem::setIsDownloading(bool d) | 79 | void FreeBusyItem::setIsDownloading(bool d) | ||
80 | { | 80 | { | ||
81 | mIsDownloading = d; | 81 | mIsDownloading = d; | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | bool FreeBusyItem::isDownloading() const | 84 | bool FreeBusyItem::isDownloading() const | ||
85 | { | 85 | { | ||
86 | return mIsDownloading; | 86 | return mIsDownloading; | ||
87 | } | 87 | } |