• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.9.5 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 
26 #include <KComponentData>
27 #include <KGlobal>
28 #include <qdbusextratypes.h>
29 
30 using namespace Akonadi;
31 
32 QObject* ChangeNotificationDependenciesFactory::createNotificationSource(QObject *parent)
33 {
34  org::freedesktop::Akonadi::NotificationManager manager(
35  QLatin1String( "org.freedesktop.Akonadi" ),
36  QLatin1String( "/notifications" ),
37  DBusConnectionPool::threadConnection() );
38 
39  QDBusObjectPath p = manager.subscribe( KGlobal::mainComponent().componentName() );
40  if ( manager.lastError().isValid() ) {
41  // :TODO: What to do?
42  return 0;
43  }
44 
45  org::freedesktop::Akonadi::NotificationSource *notificationSource = new org::freedesktop::Akonadi::NotificationSource(
46  QLatin1String( "org.freedesktop.Akonadi" ),
47  p.path(),
48  DBusConnectionPool::threadConnection(), parent );
49 
50  if ( !notificationSource ) {
51  // :TODO: error handling
52  return 0;
53  }
54  return notificationSource;
55 }
56 
57 QObject* ChangeNotificationDependenciesFactory::createChangeMediator(QObject* parent)
58 {
59  Q_UNUSED( parent );
60  return ChangeMediator::instance();
61 }
62 
63 CollectionCache* ChangeNotificationDependenciesFactory::createCollectionCache(int maxCapacity, Session *session)
64 {
65  return new CollectionCache(maxCapacity, session);
66 }
67 
68 ItemCache* ChangeNotificationDependenciesFactory::createItemCache(int maxCapacity, Session* session)
69 {
70  return new ItemCache(maxCapacity, session);
71 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jan 5 2013 19:46:01 by doxygen 1.8.1.2 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.9.5 API Reference

Skip menu "kdepimlibs-4.9.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • 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