Akonadi

changenotificationdependenciesfactory.cpp
1 /*
2  SPDX-FileCopyrightText: 2011 Stephen Kelly <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "akonadicore_debug.h"
8 #include "changemediator_p.h"
9 #include "changenotificationdependenciesfactory_p.h"
10 #include "connection_p.h"
11 #include "servermanager.h"
12 #include "session_p.h"
13 #include "sessionthread_p.h"
14 
15 #include <qdbusextratypes.h>
16 
17 using namespace Akonadi;
18 
19 Connection *ChangeNotificationDependenciesFactory::createNotificationConnection(Session *session, CommandBuffer *commandBuffer)
20 {
21  if (!Akonadi::ServerManager::self()->isRunning()) {
22  return nullptr;
23  }
24 
25  auto connection = new Connection(Connection::NotificationConnection, session->sessionId(), commandBuffer);
26  addConnection(session, connection);
27  return connection;
28 }
29 
30 void ChangeNotificationDependenciesFactory::addConnection(Session *session, Connection *connection)
31 {
32  session->d->sessionThread()->addConnection(connection);
33 }
34 
35 void ChangeNotificationDependenciesFactory::destroyNotificationConnection(Session *session, Connection *connection)
36 {
37  session->d->sessionThread()->destroyConnection(connection);
38 }
39 
40 QObject *ChangeNotificationDependenciesFactory::createChangeMediator(QObject *parent)
41 {
42  Q_UNUSED(parent)
43  return ChangeMediator::instance();
44 }
45 
46 CollectionCache *ChangeNotificationDependenciesFactory::createCollectionCache(int maxCapacity, Session *session)
47 {
48  return new CollectionCache(maxCapacity, session);
49 }
50 
51 ItemCache *ChangeNotificationDependenciesFactory::createItemCache(int maxCapacity, Session *session)
52 {
53  return new ItemCache(maxCapacity, session);
54 }
55 
56 ItemListCache *ChangeNotificationDependenciesFactory::createItemListCache(int maxCapacity, Session *session)
57 {
58  return new ItemListCache(maxCapacity, session);
59 }
60 
61 TagListCache *ChangeNotificationDependenciesFactory::createTagListCache(int maxCapacity, Session *session)
62 {
63  return new TagListCache(maxCapacity, session);
64 }
static ServerManager * self()
Returns the singleton instance of this class, for connecting to its signals.
NETWORKMANAGERQT_EXPORT QDBusPendingReply< QDBusObjectPath > addConnection(const NMVariantMapMap &settings)
QByteArray sessionId() const
Returns the session identifier.
A communication session with the Akonadi storage.
Definition: core/session.h:55
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Jun 25 2022 06:00:31 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.