File indexing completed on 2024-05-12 05:21:21

0001 /*
0002   This file is part of KOrganizer.
0003 
0004   SPDX-FileCopyrightText: 2000, 2001, 2003, 2004 Cornelius Schumacher <schumacher@kde.org>
0005   SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0006   SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
0007 
0008   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0009 */
0010 
0011 #pragma once
0012 
0013 #include "korganizerprivate_export.h"
0014 
0015 #include "interfaces/korganizer/calendarviewbase.h"
0016 
0017 #include <KCalendarCore/Incidence>
0018 #include <KCalendarCore/ScheduleMessage>
0019 #include <KCalendarCore/Visitor>
0020 
0021 #include <Akonadi/ITIPHandler>
0022 #include <Akonadi/SearchCollectionHelper>
0023 
0024 #include <CalendarSupport/MessageWidget>
0025 
0026 #include <list>
0027 
0028 class DateChecker;
0029 class DateNavigator;
0030 class DateNavigatorContainer;
0031 class KODialogManager;
0032 class KOTodoView;
0033 class KOViewManager;
0034 class NavigatorBar;
0035 class AkonadiCollectionView;
0036 
0037 namespace CalendarSupport
0038 {
0039 class CalPrinter;
0040 class IncidenceViewer;
0041 }
0042 
0043 namespace IncidenceEditorNG
0044 {
0045 class IncidenceDialog;
0046 }
0047 
0048 namespace Akonadi
0049 {
0050 class History;
0051 class IncidenceChanger;
0052 class CalendarClipboard;
0053 class TodoPurger;
0054 }
0055 
0056 class QSplitter;
0057 class QStackedWidget;
0058 
0059 using namespace KOrg;
0060 
0061 class CalendarViewExtension : public QWidget
0062 {
0063     Q_OBJECT
0064 public:
0065     explicit CalendarViewExtension(QWidget *parent)
0066         : QWidget(parent)
0067     {
0068     }
0069 
0070     class Factory
0071     {
0072     public:
0073         virtual ~Factory() = default;
0074 
0075         virtual CalendarViewExtension *create(QWidget *parent) = 0;
0076     };
0077 };
0078 
0079 /**
0080   This is the main calendar widget. It provides the different views on the
0081   calendar data as well as the date navigator. It also handles synchronization
0082   of the different views and controls the different dialogs like preferences,
0083   event editor, search dialog etc.
0084 
0085   @short main calendar view widget
0086   @author Cornelius Schumacher
0087 */
0088 class KORGANIZERPRIVATE_EXPORT CalendarView : public KOrg::CalendarViewBase, public KCalendarCore::Calendar::CalendarObserver
0089 {
0090     Q_OBJECT
0091 public:
0092     /**
0093       Constructs a new calendar view widget.
0094       @param parent   parent window
0095     */
0096     explicit CalendarView(QWidget *parent = nullptr);
0097     ~CalendarView() override;
0098 
0099     class CalendarViewVisitor : public KCalendarCore::Visitor
0100     {
0101     public:
0102         CalendarViewVisitor() = default;
0103 
0104         bool act(KCalendarCore::IncidenceBase::Ptr &incidence, CalendarView *view)
0105         {
0106             mView = view;
0107             return incidence->accept(*this, incidence);
0108         }
0109 
0110     protected:
0111         CalendarView *mView = nullptr;
0112     };
0113 
0114     void setCalendar(const Akonadi::ETMCalendar::Ptr &);
0115     Akonadi::ETMCalendar::Ptr calendar() const override;
0116 
0117     QList<Akonadi::CollectionCalendar::Ptr> enabledCalendars() const;
0118 
0119     Akonadi::CollectionCalendar::Ptr calendarForCollection(const Akonadi::Collection &collection) override;
0120 
0121     void showMessage(const QString &message, KMessageWidget::MessageType);
0122 
0123     Akonadi::History *history() const;
0124 
0125     KOViewManager *viewManager() const
0126     {
0127         return mViewManager;
0128     }
0129 
0130     KODialogManager *dialogManager() const
0131     {
0132         return mDialogManager;
0133     }
0134 
0135     QStackedWidget *viewStack() const
0136     {
0137         return mRightFrame;
0138     }
0139 
0140     QWidget *leftFrame() const
0141     {
0142         return mLeftFrame;
0143     }
0144 
0145     NavigatorBar *navigatorBar() const
0146     {
0147         return mNavigatorBar;
0148     }
0149 
0150     DateNavigator *dateNavigator() const
0151     {
0152         return mDateNavigator;
0153     }
0154 
0155     Akonadi::IncidenceChanger *incidenceChanger() const override
0156     {
0157         return mChanger;
0158     }
0159 
0160     /**
0161      * Informs the date navigator which incidence types should be used
0162      * to embolden days, this function is mainly called when the view changes
0163      * or when the config changes.
0164      */
0165     void updateHighlightModes();
0166 
0167     [[nodiscard]] QDate startDate() override;
0168     [[nodiscard]] QDate endDate() override;
0169 
0170     KOrg::BaseView *currentView() const;
0171     void addView(KOrg::BaseView *) override;
0172     void showView(KOrg::BaseView *) override;
0173 
0174     /**
0175      * Adds a calendar view extension widget. CalendarView takes ownership of the
0176      * objects created by the factory.
0177      */
0178     void addExtension(CalendarViewExtension::Factory *);
0179 
0180     /**
0181      * Returns the item selected in the current view (or an invalid one if none selected)
0182      * @reimp
0183      */
0184     [[nodiscard]] Akonadi::Item currentSelection() override;
0185 
0186     /**
0187      * Returns a pointer to the incidence selected in the current view. If there
0188      * is no selection, return the selected todo from the todo list on the left.
0189      */
0190     [[nodiscard]] Akonadi::Item selectedIncidence();
0191 
0192     /**
0193      * Returns true if there's a filter applied.
0194      */
0195     [[nodiscard]] bool isFiltered() const;
0196 
0197     /**
0198      * Returns the name of the current filter.
0199      */
0200     [[nodiscard]] QString currentFilterName() const;
0201 
0202     /** query if the calendar is read-only. */
0203     [[nodiscard]] bool isReadOnly() const;
0204 
0205 Q_SIGNALS:
0206     /** when change is made to options dialog, the topwidget will catch this
0207      *  and Q_EMIT this signal which notifies all widgets which have registered
0208      *  for notification to update their settings. */
0209     void configChanged();
0210 
0211     /** Emitted when state of modified flag changes */
0212     void modifiedChanged(bool);
0213 
0214     /** Emitted when state of read-only flag changes */
0215     void readOnlyChanged(bool);
0216 
0217     /** Emitted when state of events selection has changed and user is organizer*/
0218     void organizerEventsSelected(bool);
0219     /** Emitted when state of events selection has changed and user is attendee*/
0220     void groupEventsSelected(bool);
0221     /**
0222       Emitted when an incidence gets selected. If the selection is cleared the
0223       signal is emitted with 0 as argument.
0224     */
0225     void incidenceSelected(const Akonadi::Item &incidence, const QDate &date);
0226     /** Emitted, when a todoitem is selected or deselected.
0227         the connected slots enables/disables the corresponding menu items */
0228     void todoSelected(bool);
0229     void subtodoSelected(bool);
0230 
0231     /** Emitted, when a day changed (i.e. korganizer was running at midnight).
0232         The argument is the new date */
0233     void dayPassed(const QDate &);
0234 
0235     /**
0236       Emitted, when clipboard content changes. Parameter indicates if paste
0237       is possible or not.
0238     */
0239     void pasteEnabled(bool);
0240     /** Send status message, which can e.g. be displayed in the status bar. */
0241     void statusMessage(const QString &);
0242 
0243     void calendarViewExpanded(bool);
0244 
0245     /** Emitted when auto-archiving options were modified */
0246     void autoArchivingSettingsModified();
0247 
0248     void newIncidenceChanger(Akonadi::IncidenceChanger *) override;
0249 
0250     void filtersUpdated(const QStringList &, int);
0251     void filterChanged();
0252 
0253     void calendarAdded(const Akonadi::CollectionCalendar::Ptr &calendar);
0254     void calendarRemoved(const Akonadi::CollectionCalendar::Ptr &calendar);
0255 
0256 public Q_SLOTS:
0257     /** options dialog made a changed to the configuration. we catch this
0258      *  and notify all widgets which need to update their configuration. */
0259     void updateConfig();
0260 
0261     void handleIncidenceCreated(const Akonadi::Item &item);
0262 
0263     /**
0264       Save calendar data to file. Return true if calendar could be
0265       successfully saved.
0266         @param filename The file name to save the calendar to
0267     */
0268     bool saveCalendar(const QString &filename);
0269 
0270     /** Archive old events of calendar */
0271     void archiveCalendar();
0272 
0273     void newEvent(const QDate &);
0274 
0275     /**
0276        Create an event editor dialog for a new event without having a date hint.
0277        Uses the current date/time as defaults.
0278     */
0279     void newEvent();
0280 
0281     void newEvent(const QDateTime &startDt);
0282 
0283     /**
0284        Create an event editor dialog for a new event with supplied date/times,
0285        and if bool is true, make the event take all day.
0286     */
0287     void newEvent(const QDateTime &startDt, const QDateTime &EndDt, bool allDay = false);
0288 
0289     /**
0290       Create an event editor dialog for a new event from given summary,
0291       description, attachment list and attendees list
0292     */
0293     void newEvent(const QString &summary,
0294                   const QString &description = QString(),
0295                   const QStringList &attachment = QStringList(),
0296                   const QStringList &attendees = QStringList(),
0297                   const QStringList &attachmentMimetypes = QStringList(),
0298                   bool inlineAttachment = false);
0299     void newFloatingEvent();
0300 
0301     /** Create a read-only viewer dialog for the supplied incidence.
0302         It calls the correct showXXX method */
0303     void showIncidence(const Akonadi::Item &item);
0304     bool showIncidence(Akonadi::Item::Id id);
0305     void showIncidence();
0306 
0307     /**
0308       Show an incidence in context. This means showing the todo, agenda or
0309       journal view (as appropriate) and scrolling it to show the incidence.
0310       @param incidence The incidence to show.
0311     */
0312     void showIncidenceContext(const Akonadi::Item &incidence);
0313     bool showIncidenceContext(Akonadi::Item::Id id);
0314 
0315     /**
0316       Show an incidence in context, given its uid.
0317       @param uid the iCal uid of the incidence to show.
0318       @param activeDate The active date is used to calculate the actual date of
0319                         the selected incidence in case of recurring incidences.
0320     */
0321     void showIncidenceByUid(const QString &uid, QDate activeDate = {});
0322 
0323     /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
0324     bool editIncidence(const Akonadi::Item &item, bool isCounter = false) override;
0325     bool editIncidence(Akonadi::Item::Id id);
0326     void editIncidence();
0327 
0328     /**
0329       Delete the supplied incidence, optionally after asking the user for confirmation.
0330       If it recurs, the user can choose to delete a single recurrence, the recurrence
0331       and all subsequent recurrences, or all recurrences.
0332       If all recurrences are deleted, all dissociated instances will also be deleted.
0333       If it has children (e.g. sub-todos) the children will be deleted or made
0334       independent as the user chooses.
0335       @param force If true, the incidence, instances, and children will be
0336                    deleted without prompting for confirmation.
0337     */
0338     bool deleteIncidence(const Akonadi::Item &item, bool force = false);
0339     bool deleteIncidence(Akonadi::Item::Id id, bool force = false);
0340     void deleteIncidence();
0341 
0342     /**
0343      Add an incidence to the active calendar.
0344      @param ical A calendar in iCalendar format containing the incidence. The
0345                  calendar must consist of a VCALENDAR component which contains
0346                  the incidence (VEVENT, VTODO, VJOURNAL or VFREEBUSY) and
0347                  optionally a VTIMEZONE component. If there is more than one
0348                  incidence, only the first is added to KOrganizer's calendar.
0349     */
0350     bool addIncidence(const QString &ical);
0351     bool addIncidence(const KCalendarCore::Incidence::Ptr &incidence);
0352 
0353     /**
0354       Cuts the selected incidence using the edit_cut() method
0355     */
0356     void cutIncidence(const Akonadi::Item &);
0357 
0358     /**
0359       Copies the selected incidence using the edit_copy() method
0360     */
0361     void copyIncidence(const Akonadi::Item &);
0362 
0363     /**
0364       Pastes the current incidence using the edit_paste() method
0365     */
0366     void pasteIncidence();
0367 
0368     /**
0369       Delete the supplied incidence, including any dissociated instances, and
0370       all children (e.g. sub-todos).
0371       */
0372     void deleteIncidenceFamily(const Akonadi::Item &todo);
0373 
0374     /** create new todo */
0375     void newTodo();
0376 
0377     /** create new todo, due on date */
0378     void newTodo(const QDate &date);
0379 
0380     /** create new todo **/
0381     void newTodo(const Akonadi::Collection &collection);
0382 
0383     /** create new todo with a parent todo */
0384     void newSubTodo();
0385 
0386     /** create new todo with a parent todo */
0387     void newSubTodo(const Akonadi::Item &todo);
0388 
0389     /** create new todo with parent todo */
0390     void newSubTodo(const Akonadi::Collection &collection);
0391 
0392     void newTodo(const QString &summary,
0393                  const QString &description = QString(),
0394                  const QStringList &attachments = QStringList(),
0395                  const QStringList &attendees = QStringList(),
0396                  const QStringList &attachmentMimetypes = QStringList(),
0397                  bool inlineAttachment = false);
0398 
0399     void newJournal();
0400     void newJournal(const QDate &date);
0401     void newJournal(const QString &text, QDate date = QDate());
0402     void newJournal(const Akonadi::Collection &collection);
0403 
0404     void configureCurrentView();
0405 
0406     void toggleAlarm(const Akonadi::Item &incidence);
0407     void toggleTodoCompleted(const Akonadi::Item &incidence);
0408     void toggleOccurrenceCompleted(const Akonadi::Item &, const QDate &);
0409     void copyIncidenceToResource(const Akonadi::Item &incidence, const Akonadi::Collection &col);
0410     void moveIncidenceToResource(const Akonadi::Item &incidence, const Akonadi::Collection &col);
0411     void dissociateOccurrences(const Akonadi::Item &incidence, QDate date);
0412 
0413     /**
0414       Check if clipboard contains vCalendar event. The signal pasteEnabled() is
0415       emitted as result.
0416     */
0417     void checkClipboard();
0418 
0419     /**
0420       Using the KConfig associated with the kapp variable, read in the
0421       settings from the config file.
0422 
0423       You have to call setCalendar before calling readSettings.
0424     */
0425     void readSettings();
0426 
0427     /** write current state to config file. */
0428     void writeSettings();
0429 
0430     /** read settings for calendar filters */
0431     void readFilterSettings(KConfig *config);
0432 
0433     /** write settings for calendar filters */
0434     void writeFilterSettings(KConfig *config);
0435 
0436     /** passes on the message that an event has changed to the currently
0437      * activated view so that it can make appropriate display changes. */
0438     void changeIncidenceDisplay(const Akonadi::Item &incidence, Akonadi::IncidenceChanger::ChangeType);
0439 
0440     void slotCreateFinished(int changeId, const Akonadi::Item &item, Akonadi::IncidenceChanger::ResultCode resultCode, const QString &errorString);
0441 
0442     void slotModifyFinished(int changeId, const Akonadi::Item &item, Akonadi::IncidenceChanger::ResultCode resultCode, const QString &errorString);
0443 
0444     void
0445     slotDeleteFinished(int changeId, const QList<Akonadi::Item::Id> &itemIdList, Akonadi::IncidenceChanger::ResultCode resultCode, const QString &errorString);
0446 
0447     void startMultiModify(const QString &text);
0448     void endMultiModify();
0449 
0450     void updateView(const QDate &start, const QDate &end, const QDate &preferredMonth, const bool updateTodos = true);
0451     void updateView() override;
0452 
0453     void updateUnmanagedViews();
0454 
0455     /** cut the current appointment to the clipboard */
0456     void edit_cut();
0457 
0458     /** copy the current appointment(s) to the clipboard */
0459     void edit_copy();
0460 
0461     /** paste the current vobject(s) in the clipboard buffer into calendar */
0462     void edit_paste();
0463 
0464     void onCutFinished();
0465 
0466     /** edit viewing and configuration options. */
0467     void edit_options();
0468 
0469     /**
0470       Functions for printing, previewing a print, and setting up printing
0471       parameters.
0472     */
0473     void print();
0474     void printPreview();
0475 
0476     /** Export as iCalendar file */
0477     void exportICalendar();
0478 
0479     /** pop up a dialog to show an existing appointment. */
0480     void appointment_show();
0481     /**
0482      * pop up an Appointment Dialog to edit an existing appointment. Get
0483      * information on the appointment from the list of unique IDs that is
0484      * currently in the View, called currIds.
0485      */
0486     void appointment_edit();
0487 
0488     /**
0489      * pop up dialog confirming deletion of currently selected event in the
0490      * View.
0491      */
0492     void appointment_delete();
0493 
0494     /** Frees a subtodo from it's relation, update the view */
0495     void todo_unsub();
0496 
0497     /* Frees an incidence's children from it's relation, without the view update
0498        Works with any incidence type, although currently we only pass to-dos
0499     */
0500     bool incidence_unsub(const Akonadi::Item &item);
0501 
0502     /** Make all sub-to-dos of the selected todo independent, update the view */
0503     bool makeSubTodosIndependent();
0504 
0505     /** Make all children of incidence independent, not update the view
0506         Works with any incidence type, although currently we only pass to-dos
0507     */
0508     bool makeChildrenIndependent(const Akonadi::Item &item);
0509 
0510     /** Take ownership of selected event. */
0511     void takeOverEvent();
0512 
0513     /** set state of calendar to read-only
0514         @param readOnly whether the calendar view should be set read-only or not
0515     */
0516     void setReadOnly(bool readOnly = true);
0517 
0518     void eventUpdated(const Akonadi::Item &incidence);
0519 
0520     /* iTIP scheduling actions */
0521     void schedule_publish(const Akonadi::Item &incidence = Akonadi::Item());
0522     void schedule_request(const Akonadi::Item &incidence = Akonadi::Item());
0523     void schedule_refresh(const Akonadi::Item &incidence = Akonadi::Item());
0524     void schedule_cancel(const Akonadi::Item &incidence = Akonadi::Item());
0525     void schedule_add(const Akonadi::Item &incidence = Akonadi::Item());
0526     void schedule_reply(const Akonadi::Item &incidence = Akonadi::Item());
0527     void schedule_counter(const Akonadi::Item &incidence = Akonadi::Item());
0528     void schedule_declinecounter(const Akonadi::Item &incidence = Akonadi::Item());
0529     void schedule_forward(const Akonadi::Item &incidence = Akonadi::Item());
0530     void mailFreeBusy(int daysToPublish = 30);
0531     void uploadFreeBusy();
0532 
0533     void openAddressbook();
0534 
0535     void editFilters();
0536 
0537     void updateFilter();
0538 
0539     void showIntro();
0540 
0541     void showDateNavigator(bool);
0542     void showTodoView(bool);
0543     void showEventViewer(bool);
0544 
0545     /** Move the current view date to the specified date */
0546     void goDate(QDate date);
0547 
0548     /** Show the given date without changing date selection length. */
0549     void showDate(QDate date);
0550 
0551     /** Move the current view date to today */
0552     void goToday();
0553 
0554     /** Move to the next date(s) in the current view */
0555     void goNext();
0556 
0557     /** Move to the previous date(s) in the current view */
0558     void goPrevious();
0559 
0560     void showLeftFrame(bool show = true);
0561 
0562     void dialogClosing(const Akonadi::Item &incidence);
0563 
0564     void processMainViewSelection(const Akonadi::Item &incidence, const QDate &date);
0565     void processTodoListSelection(const Akonadi::Item &incidence, const QDate &date);
0566 
0567     void processIncidenceSelection(const Akonadi::Item &incidence, const QDate &date);
0568 
0569     void purgeCompleted();
0570 
0571     void slotAutoArchivingSettingsModified()
0572     {
0573         Q_EMIT autoArchivingSettingsModified();
0574     }
0575 
0576     void showErrorMessage(const QString &);
0577     void schedule(KCalendarCore::iTIPMethod, const Akonadi::Item &incidence);
0578     void addIncidenceOn(const Akonadi::Item &incidence, const QDate &);
0579     void moveIncidenceTo(const Akonadi::Item &incidence, QDate);
0580     void filterActivated(int filterNum);
0581 
0582     void resourcesChanged();
0583 
0584     /**
0585      * The user clicked on a week number in the date navigator
0586      *
0587      * Select a week or a work week depending on the user's config option.
0588      *
0589      * @param preferredMonth Holds the month that should be selected when
0590      * the week crosses months.  It's a QDate instead of uint so it can be
0591      * easily fed to KCalendarSystem's functions.
0592      */
0593     void selectWeek(const QDate &week, const QDate &preferredMonth);
0594 
0595     /**
0596      * Use as much of the full window as possible for the view.
0597      *
0598      * @param fullView if true, expand the view as much as possible within the
0599      * main view (hiding the sidebar for example); else put back the normal view.
0600      */
0601     void changeFullView(bool fullView);
0602 
0603     void collectionSelected(const Akonadi::Collection &collection);
0604     void collectionDeselected(const Akonadi::Collection &collection);
0605 
0606 protected Q_SLOTS:
0607     /**
0608      * Select a view or adapt the current view to display the specified dates.
0609      * @p preferredMonth is useful when the datelist crosses months, if valid,
0610      * any month-like component should honour this
0611      */
0612     void showDates(const KCalendarCore::DateList &, const QDate &preferredMonth = QDate());
0613 
0614 public:
0615     /**
0616      * Returns the date of the selected incidence.
0617      *
0618      * If the selected incidence is recurring, it will return the date
0619      * of the selected occurrence.
0620      */
0621     QDate activeIncidenceDate();
0622 
0623     /**
0624       Returns the best guess at the current active date in the view.
0625       This has nothing to do with selected incidences, use activeIncidenceDate()
0626       for that, for example, agenda supports time selection and incidence selection
0627       and they can have different dates.
0628 
0629       @param fallbackToToday If guessing doesn't work, some views will prefer
0630       today to be returned instead of the first select date in the day matrix,
0631       Journal view for example.
0632     */
0633     QDate activeDate(bool fallbackToToday = false);
0634 
0635     static void toggleCompleted(KCalendarCore::Todo::Ptr, const QDate &);
0636 
0637 protected:
0638     int msgItemDelete(const Akonadi::Item &incidence);
0639 
0640     Akonadi::Item selectedTodo();
0641     IncidenceEditorNG::IncidenceDialog *incidenceDialog(const Akonadi::Item &);
0642 
0643     void warningChangeFailed(const Akonadi::Item &);
0644     void checkForFilteredChange(const Akonadi::Item &incidence);
0645 
0646     /**
0647       Adjust the given date/times by valid defaults (selection or configured
0648       defaults, if invalid values are given) and allow the view to adjust the type.
0649     */
0650     void dateTimesForNewEvent(QDateTime &startDt, QDateTime &endDt, bool &allDay);
0651     IncidenceEditorNG::IncidenceDialog *newEventEditor(const KCalendarCore::Event::Ptr &event);
0652 
0653     bool eventFilter(QObject *watched, QEvent *event) override;
0654 
0655     /** Delete the given incidence and, if it is recurring, its instances. */
0656     void deleteRecurringIncidence(const Akonadi::Item &todoItem);
0657 
0658     /** Delete the child incidences of the given incidence. */
0659     void deleteChildren(const Akonadi::Item &);
0660 
0661 private Q_SLOTS:
0662     void onCheckableProxyAboutToToggle(bool newState);
0663     void onCheckableProxyToggled(bool newState);
0664     void onTodosPurged(bool success, int numDeleted, int numIgnored);
0665 
0666 private:
0667     Akonadi::Collection selectedCollection() const;
0668     Akonadi::Collection::List checkedCollections() const;
0669 
0670     int questionIndependentChildren(const Akonadi::Item &item);
0671 
0672     void createPrinter();
0673 
0674     /**
0675      * Return the recurrence ID of  the occurrence of @p incidence displayed on @displayDate.
0676      */
0677     static QDateTime recurrenceOnDate(KCalendarCore::Incidence::Ptr incidence, QDate displayDate);
0678 
0679     void dissociateOccurrence(const Akonadi::Item &item, const QDateTime &recurrenceId, bool thisAndFuture);
0680 
0681     /**
0682      * Returns the default collection.
0683      * The view's collection takes precedence, only then the config one is used.
0684      * If mimeType is set, the collection to return will have to support that mime type.
0685      * If no valid collection is found, an invalid one is returned.
0686      */
0687     Akonadi::Collection defaultCollection(const QLatin1StringView &mimeType = QLatin1StringView("")) const;
0688 
0689     /**
0690      * Creates a new incidence editor and chooses a decent default for the collection
0691      * in the collection combo.
0692      */
0693     IncidenceEditorNG::IncidenceDialog *createIncidenceEditor(const Akonadi::Item &item, const Akonadi::Collection &collection = Akonadi::Collection());
0694 
0695     CalendarSupport::CalPrinter *mCalPrinter = nullptr;
0696     Akonadi::TodoPurger *mTodoPurger = nullptr;
0697 
0698     QSplitter *mPanner = nullptr;
0699     QSplitter *mLeftSplitter = nullptr;
0700     QWidget *mLeftFrame = nullptr;
0701     QStackedWidget *mRightFrame = nullptr;
0702     CalendarSupport::MessageWidget *mMessageWidget = nullptr;
0703 
0704     // This navigator bar is used when in full window month view
0705     // It has nothing to do with the date navigator
0706     NavigatorBar *mNavigatorBar = nullptr;
0707 
0708     DateNavigatorContainer *mDateNavigatorContainer = nullptr;
0709 
0710     QList<CalendarViewExtension *> mExtensions;
0711 
0712     Akonadi::ETMCalendar::Ptr mCalendar;
0713     QList<Akonadi::CollectionCalendar::Ptr> mEnabledCalendars;
0714     // Actual linked-list implementation - we don't expect to ever have that many calendars
0715     // enabled that e.g. QMap/QHash would be substantially faster over looping over the list.
0716     // The advantage of the list is that on each iteration we can quickly remove and stale
0717     // weak pointers.
0718     std::list<QWeakPointer<Akonadi::CollectionCalendar>> mCalendars;
0719 
0720     DateNavigator *mDateNavigator = nullptr;
0721     DateChecker *mDateChecker = nullptr;
0722 
0723     QWidget *mEventViewerBox = nullptr;
0724     CalendarSupport::IncidenceViewer *mEventViewer = nullptr;
0725     KOViewManager *mViewManager = nullptr;
0726     KODialogManager *mDialogManager = nullptr;
0727 
0728     // Calendar filters
0729     QList<KCalendarCore::CalFilter *> mFilters;
0730     KCalendarCore::CalFilter *mCurrentFilter = nullptr;
0731 
0732     // various housekeeping variables.
0733     bool mReadOnly; // flag indicating if calendar is read-only
0734 
0735     Akonadi::Item mSelectedIncidence;
0736     QDate mSaveDate;
0737 
0738     KOTodoView *mTodoList = nullptr;
0739     Akonadi::IncidenceChanger *mChanger = nullptr;
0740     Akonadi::ITIPHandler *mITIPHandler = nullptr;
0741     QList<int> mMainSplitterSizes; // temp store for main splitter sizes while left frame is hidden
0742     bool mSplitterSizesValid;
0743 
0744     Akonadi::CalendarClipboard *mCalendarClipboard = nullptr;
0745     AkonadiCollectionView *mETMCollectionView = nullptr;
0746 
0747     Akonadi::SearchCollectionHelper mSearchCollectionHelper;
0748 };