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

akonadi

  • akonadi
agentfactory.cpp
1 /*
2  This file is part of akonadiresources.
3 
4  Copyright (c) 2006 Till Adam <adam@kde.org>
5  Copyright (c) 2007 Volker Krause <vkrause@kde.org>
6 
7  This library is free software; you can redistribute it and/or modify it
8  under the terms of the GNU Library General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version.
11 
12  This library is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15  License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to the
19  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301, USA.
21 */
22 
23 #include "agentfactory.h"
24 #include "servermanager.h"
25 #include "servermanager_p.h"
26 
27 #include <klocale.h>
28 
29 #include <QtCore/QThread>
30 #include <QtCore/QThreadStorage>
31 
32 QThreadStorage<KComponentData*> s_agentComponentDatas;
33 
34 using namespace Akonadi;
35 
36 class Akonadi::AgentFactoryBasePrivate
37 {
38  public:
39  QString catalogName;
40 };
41 
42 AgentFactoryBase::AgentFactoryBase( const char *catalogName, QObject *parent)
43  : QObject( parent ), d( new AgentFactoryBasePrivate )
44 {
45  d->catalogName = QString::fromLatin1( catalogName );
46  if ( !KGlobal::hasMainComponent() ) {
47  new KComponentData( "AkonadiAgentServer", "libakonadi", KComponentData::RegisterAsMainComponent );
48  }
49 
50  KGlobal::locale()->insertCatalog( d->catalogName );
51 
52  Internal::setClientType( Internal::Agent );
53  ServerManager::self(); // make sure it's created in the main thread
54 }
55 
56 AgentFactoryBase::~AgentFactoryBase()
57 {
58  delete d;
59 }
60 
61 void AgentFactoryBase::createComponentData( const QString& identifier ) const
62 {
63  Q_ASSERT( !s_agentComponentDatas.hasLocalData() );
64 
65  if ( QThread::currentThread() != QCoreApplication::instance()->thread() ) {
66  s_agentComponentDatas.setLocalData( new KComponentData( ServerManager::addNamespace( identifier ).toLatin1(), d->catalogName.toLatin1(),
67  KComponentData::SkipMainComponentRegistration ) );
68  } else {
69  s_agentComponentDatas.setLocalData( new KComponentData( ServerManager::addNamespace( identifier ).toLatin1(), d->catalogName.toLatin1() ) );
70  }
71 }
72 
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:31 by doxygen 1.8.3.1 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.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 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