Akonadi Contacts

emailaddressselectionmodel.cpp
1/*
2 This file is part of Akonadi Contact.
3
4 SPDX-FileCopyrightText: 2017-2020 Laurent Montel <montel.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "emailaddressselectionmodel.h"
10#include <Akonadi/ChangeRecorder>
11#include <Akonadi/ContactsTreeModel>
12#include <Akonadi/EntityDisplayAttribute>
13#include <Akonadi/ItemFetchScope>
14#include <Akonadi/Session>
15#include <KContacts/Addressee>
16#include <KContacts/ContactGroup>
17
18using namespace Akonadi;
19
20EmailAddressSelectionModel::EmailAddressSelectionModel(QObject *parent)
21 : QObject(parent)
22{
23 auto session = new Akonadi::Session("InternalEmailAddressSelectionWidgetModel", this);
24
26 scope.fetchFullPayload(true);
28
29 auto changeRecorder = new Akonadi::ChangeRecorder(this);
30 changeRecorder->setSession(session);
31 changeRecorder->fetchCollection(true);
32 changeRecorder->setItemFetchScope(scope);
33 changeRecorder->setCollectionMonitored(Akonadi::Collection::root());
34 changeRecorder->setMimeTypeMonitored(KContacts::Addressee::mimeType(), true);
35 changeRecorder->setMimeTypeMonitored(KContacts::ContactGroup::mimeType(), true);
36
37 mModel = new Akonadi::ContactsTreeModel(changeRecorder, this);
38}
39
40EmailAddressSelectionModel::~EmailAddressSelectionModel() = default;
41
42Akonadi::ContactsTreeModel *EmailAddressSelectionModel::model() const
43{
44 return mModel;
45}
46
47#include "moc_emailaddressselectionmodel.cpp"
static Collection root()
A model for contacts and contact groups as available in Akonadi.
void fetchAttribute(bool fetch=true)
void fetchFullPayload(bool fetch=true)
static QString mimeType()
static QString mimeType()
A widget for editing the display name of a contact.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.