CalendarSupport

calendarsingleton.cpp
1/*
2 SPDX-FileCopyrightText: 2013 Sérgio Martins <iamsergio@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
5*/
6
7#include "calendarsingleton.h"
8#include "kcalprefs.h"
9
10#include <KCalendarCore/Person>
11
12/**
13 * Singleton is implemented through qApp parenting because we can't rely on K_GLOBAL_STATIC.
14 *
15 * QWidgets and QAbstractItemModels can't be global because their dtor depends on other globals
16 * and the order of global destruction is undefined.
17 */
18Akonadi::ETMCalendar::Ptr CalendarSupport::calendarSingleton(bool createIfNull)
19{
20 static Akonadi::ETMCalendar::Ptr calendar;
21
22 if (!calendar && createIfNull) {
24 calendar->setCollectionFilteringEnabled(false);
25 calendar->setOwner(KCalendarCore::Person(KCalPrefs::instance()->fullName(), KCalPrefs::instance()->email()));
26 }
27
28 return calendar;
29}
QSharedPointer< Calendar > Ptr
QString fullName(const PartType &type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.