• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.11.3 API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • akonadi
changenotificationdependenciesfactory.cpp
1 /*
2  Copyright (c) 2011 Stephen Kelly <steveire@gmail.com>
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 "dbusconnectionpool.h"
22 #include "notificationsourceinterface.h"
23 #include "notificationmanagerinterface.h"
24 #include "changemediator_p.h"
25 #include "servermanager.h"
26 
27 #include <KComponentData>
28 #include <KGlobal>
29 #include <qdbusextratypes.h>
30 
31 using namespace Akonadi;
32 
33 QObject* ChangeNotificationDependenciesFactory::createNotificationSource(QObject *parent)
34 {
35  org::freedesktop::Akonadi::NotificationManager *manager =
36  new org::freedesktop::Akonadi::NotificationManager(
37  ServerManager::serviceName( Akonadi::ServerManager::Server ),
38  QLatin1String( "/notifications" ),
39  DBusConnectionPool::threadConnection() );
40 
41  if ( !manager ) {
42  // :TODO: error handling
43  return 0;
44  }
45 
46  QDBusObjectPath p = manager->subscribe( KGlobal::mainComponent().componentName() );
47  const bool validError = manager->lastError().isValid();
48  delete manager;
49  if ( validError ) {
50  // :TODO: What to do?
51  return 0;
52  }
53 
54  org::freedesktop::Akonadi::NotificationSource *notificationSource =
55  new org::freedesktop::Akonadi::NotificationSource(
56  ServerManager::serviceName( Akonadi::ServerManager::Server ),
57  p.path(),
58  DBusConnectionPool::threadConnection(), parent );
59 
60  if ( !notificationSource ) {
61  // :TODO: error handling
62  return 0;
63  }
64  return notificationSource;
65 }
66 
67 QObject* ChangeNotificationDependenciesFactory::createChangeMediator(QObject* parent)
68 {
69  Q_UNUSED( parent );
70  return ChangeMediator::instance();
71 }
72 
73 CollectionCache* ChangeNotificationDependenciesFactory::createCollectionCache(int maxCapacity, Session *session)
74 {
75  return new CollectionCache( maxCapacity, session );
76 }
77 
78 ItemCache* ChangeNotificationDependenciesFactory::createItemCache(int maxCapacity, Session* session)
79 {
80  return new ItemCache( maxCapacity, session );
81 }
82 
83 ItemListCache* ChangeNotificationDependenciesFactory::createItemListCache(int maxCapacity, Session *session)
84 {
85  return new ItemListCache( maxCapacity, session );
86 }
Akonadi::ServerManager::serviceName
static QString serviceName(ServiceType serviceType)
Returns the namespaced D-Bus service name for serviceType.
Definition: servermanager.cpp:295
Akonadi::Session
A communication session with the Akonadi storage.
Definition: session.h:59
Akonadi::EntityCache
Definition: entitycache_p.h:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:03:16 by doxygen 1.8.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal