• Skip to content
  • Skip to link menu
KDE 4.7 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

akonadi

agentfactory.cpp
00001 /*
00002     This file is part of akonadiresources.
00003 
00004     Copyright (c) 2006 Till Adam <adam@kde.org>
00005     Copyright (c) 2007 Volker Krause <vkrause@kde.org>
00006 
00007     This library is free software; you can redistribute it and/or modify it
00008     under the terms of the GNU Library General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or (at your
00010     option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful, but WITHOUT
00013     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015     License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to the
00019     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020     02110-1301, USA.
00021 */
00022 
00023 #include "agentfactory.h"
00024 #include "servermanager.h"
00025 #include "servermanager_p.h"
00026 
00027 #include <klocale.h>
00028 
00029 #include <QtCore/QThread>
00030 #include <QtCore/QThreadStorage>
00031 
00032 QThreadStorage<KComponentData*> s_agentComponentDatas;
00033 
00034 using namespace Akonadi;
00035 
00036 class Akonadi::AgentFactoryBasePrivate
00037 {
00038   public:
00039     QString catalogName;
00040 };
00041 
00042 AgentFactoryBase::AgentFactoryBase( const char *catalogName, QObject *parent)
00043   : QObject( parent ), d( new AgentFactoryBasePrivate )
00044 {
00045   d->catalogName = QString::fromLatin1( catalogName );
00046   if ( !KGlobal::hasMainComponent() )
00047     new KComponentData( "AkonadiAgentServer", "libakonadi", KComponentData::RegisterAsMainComponent );
00048 
00049   KGlobal::locale()->insertCatalog( d->catalogName );
00050 
00051   Internal::setClientType( Internal::Agent );
00052   ServerManager::self(); // make sure it's created in the main thread
00053 }
00054 
00055 void AgentFactoryBase::createComponentData( const QString& identifier ) const
00056 {
00057   Q_ASSERT( !s_agentComponentDatas.hasLocalData() );
00058 
00059   if ( QThread::currentThread() != QCoreApplication::instance()->thread() ) {
00060     s_agentComponentDatas.setLocalData( new KComponentData( identifier.toLatin1(), d->catalogName.toLatin1(),
00061                                                             KComponentData::SkipMainComponentRegistration ) );
00062   } else {
00063     s_agentComponentDatas.setLocalData( new KComponentData( identifier.toLatin1(), d->catalogName.toLatin1() ) );
00064   }
00065 }
00066 
00067 #include "agentfactory.moc"

akonadi

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • 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
Generated for KDE-PIM Libraries by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal