File indexing completed on 2024-05-19 05:14:37

0001 /*
0002   This file is part of KAddressBook.
0003 
0004   SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
0005 
0006   SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 namespace Akonadi
0012 {
0013 class ChangeRecorder;
0014 class ContactsTreeModel;
0015 class Monitor;
0016 class Session;
0017 }
0018 
0019 /**
0020  * @short Provides the global model for all contacts
0021  *
0022  * This model provides the EntityTreeModel for all contacts.
0023  * The model is accessible via the static instance() method.
0024  */
0025 class GlobalContactModel
0026 {
0027 public:
0028     /**
0029      * Destroys the global contact model.
0030      */
0031     ~GlobalContactModel();
0032 
0033     /**
0034      * Returns the global contact model instance.
0035      */
0036     static GlobalContactModel *instance();
0037 
0038     /**
0039      * Returns the item model of the global instance.
0040      */
0041     Akonadi::ContactsTreeModel *model() const;
0042 
0043 private:
0044     GlobalContactModel();
0045 
0046     static GlobalContactModel *mInstance;
0047 
0048     Akonadi::Session *const mSession;
0049     Akonadi::ChangeRecorder *const mMonitor;
0050     Akonadi::ContactsTreeModel *mModel = nullptr;
0051 };