Akonadi

changenotificationdependenciesfactory.cpp
1 /*
2  Copyright (c) 2011 Stephen Kelly <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "changenotificationdependenciesfactory_p.h"
21 #include "sessionthread_p.h"
22 #include "connection_p.h"
23 #include "changemediator_p.h"
24 #include "servermanager.h"
25 #include "akonadicore_debug.h"
26 #include "session_p.h"
27 
28 #include <qdbusextratypes.h>
29 
30 using namespace Akonadi;
31 
32 Connection *ChangeNotificationDependenciesFactory::createNotificationConnection(Session *session,
33  CommandBuffer *commandBuffer)
34 {
35  if (!Akonadi::ServerManager::self()->isRunning()) {
36  return nullptr;
37  }
38 
39  auto connection = new Connection(Connection::NotificationConnection, session->sessionId(), commandBuffer);
40  addConnection(session, connection);
41  return connection;
42 }
43 
44 void ChangeNotificationDependenciesFactory::addConnection(Session *session, Connection *connection)
45 {
46  session->d->sessionThread()->addConnection(connection);
47 }
48 
49 void ChangeNotificationDependenciesFactory::destroyNotificationConnection(Session *session, Connection *connection)
50 {
51  session->d->sessionThread()->destroyConnection(connection);
52 }
53 
54 QObject *ChangeNotificationDependenciesFactory::createChangeMediator(QObject *parent)
55 {
56  Q_UNUSED(parent);
57  return ChangeMediator::instance();
58 }
59 
60 CollectionCache *ChangeNotificationDependenciesFactory::createCollectionCache(int maxCapacity, Session *session)
61 {
62  return new CollectionCache(maxCapacity, session);
63 }
64 
65 ItemCache *ChangeNotificationDependenciesFactory::createItemCache(int maxCapacity, Session *session)
66 {
67  return new ItemCache(maxCapacity, session);
68 }
69 
70 ItemListCache *ChangeNotificationDependenciesFactory::createItemListCache(int maxCapacity, Session *session)
71 {
72  return new ItemListCache(maxCapacity, session);
73 }
74 
75 TagListCache *ChangeNotificationDependenciesFactory::createTagListCache(int maxCapacity, Session *session)
76 {
77  return new TagListCache(maxCapacity, session);
78 }
static ServerManager * self()
Returns the singleton instance of this class, for connecting to its signals.
QByteArray sessionId() const
Returns the session identifier.
A communication session with the Akonadi storage.
Definition: core/session.h:67
NETWORKMANAGERQT_EXPORT QDBusPendingReply< QDBusObjectPath > addConnection(const NMVariantMapMap &settings)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:08:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.