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