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

KAlarm Library

identities.cpp
00001 /*
00002  *  identities.cpp  -  email identity functions
00003  *  This file is part of kalarmcal library, which provides access to KAlarm
00004  *  calendar data.
00005  *  Copyright © 2004-2011 by David Jarvie <djarvie@kde.org>
00006  *
00007  *  This library is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU Library General Public License as published
00009  *  by the Free Software Foundation; either version 2 of the License, or (at
00010  *  your 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,
00020  *  MA 02110-1301, USA.
00021  */
00022 
00023 #include "identities.h"
00024 
00025 #include <kpimidentities/identitymanager.h>
00026 #include <kpimidentities/identity.h>
00027 
00028 
00029 static KPIMIdentities::IdentityManager* mIdentityManager = 0;
00030 
00031 namespace KAlarmCal
00032 {
00033 namespace Identities
00034 {
00035 
00036 KPIMIdentities::IdentityManager* identityManager()
00037 {
00038     if (!mIdentityManager)
00039         mIdentityManager = new KPIMIdentities::IdentityManager(true);   // create a read-only kmail identity manager
00040     return mIdentityManager;
00041 }
00042 
00043 /******************************************************************************
00044 * Return whether any email identities exist.
00045 */
00046 bool identitiesExist()
00047 {
00048     identityManager();    // create identity manager if not already done
00049     return mIdentityManager->begin() != mIdentityManager->end();
00050 }
00051 
00052 /******************************************************************************
00053 * Fetch the uoid of an email identity name or uoid string.
00054 */
00055 uint identityUoid(const QString& identityUoidOrName)
00056 {
00057     bool ok;
00058     uint id = identityUoidOrName.toUInt(&ok);
00059     if (!ok  ||  identityManager()->identityForUoid(id).isNull())
00060     {
00061         identityManager();   // fetch it if not already done
00062         for (KPIMIdentities::IdentityManager::ConstIterator it = mIdentityManager->begin();
00063              it != mIdentityManager->end();  ++it)
00064         {
00065             if ((*it).identityName() == identityUoidOrName)
00066             {
00067                 id = (*it).uoid();
00068                 break;
00069             }
00070         }
00071     }
00072     return id;
00073 }
00074 
00075 } // namespace Identities
00076 
00077 } // namespace KAlarmCal
00078 
00079 // vim: et sw=4:
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 22:20:53 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KAlarm Library

Skip menu "KAlarm Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.8.3 API Reference

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