File indexing completed on 2025-01-19 04:51:28
0001 /* 0002 This file is part of Kontact. 0003 0004 SPDX-FileCopyrightText: 2003 Tobias Koenig <tokoe@kde.org> 0005 SPDX-FileCopyrightText: 2004, 2009 Allen Winter <winter@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0008 */ 0009 0010 #pragma once 0011 0012 #include <KCalendarCore/Event> 0013 0014 #include <Akonadi/ETMCalendar> 0015 #include <KontactInterface/Summary> 0016 0017 namespace KHolidays 0018 { 0019 class HolidayRegion; 0020 } 0021 0022 namespace KontactInterface 0023 { 0024 class Plugin; 0025 } 0026 0027 class QDate; 0028 class QGridLayout; 0029 class QLabel; 0030 class SDEntry; 0031 class KJob; 0032 0033 class SDSummaryWidget : public KontactInterface::Summary 0034 { 0035 Q_OBJECT 0036 0037 public: 0038 SDSummaryWidget(KontactInterface::Plugin *plugin, QWidget *parent); 0039 ~SDSummaryWidget() override; 0040 0041 void configUpdated(); 0042 void updateSummary(bool force = false) override 0043 { 0044 Q_UNUSED(force) 0045 updateView(); 0046 } 0047 0048 protected: 0049 bool eventFilter(QObject *obj, QEvent *e) override; 0050 0051 private: 0052 void updateView(); 0053 void popupMenu(const QString &url); 0054 void mailContact(const QString &url); 0055 void viewContact(const QString &url); 0056 void slotBirthdayJobFinished(KJob *job); 0057 void slotItemFetchJobDone(KJob *job); 0058 0059 int span(const KCalendarCore::Event::Ptr &event) const; 0060 int dayof(const KCalendarCore::Event::Ptr &event, const QDate &date) const; 0061 [[nodiscard]] bool initHolidays(); 0062 void dateDiff(const QDate &date, int &days, int &years) const; 0063 void createLabels(); 0064 0065 Akonadi::ETMCalendar::Ptr mCalendar; 0066 0067 QGridLayout *mLayout = nullptr; 0068 QList<QLabel *> mLabels; 0069 KontactInterface::Plugin *const mPlugin; 0070 0071 int mDaysAhead; 0072 bool mShowBirthdaysFromKAB = false; 0073 bool mShowBirthdaysFromCal = false; 0074 bool mShowAnniversariesFromKAB = false; 0075 bool mShowAnniversariesFromCal = false; 0076 bool mShowHolidays = false; 0077 bool mShowSpecialsFromCal = false; 0078 bool mShowMineOnly = false; 0079 bool mJobRunning = false; 0080 QList<SDEntry> mDates; 0081 0082 KHolidays::HolidayRegion *mHolidays = nullptr; 0083 };