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

KAlarm Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kalarmcal
identities.cpp
1 /*
2  * identities.cpp - email identity functions
3  * This file is part of kalarmcal library, which provides access to KAlarm
4  * calendar data.
5  * Copyright © 2004-2011 by David Jarvie <djarvie@kde.org>
6  *
7  * This library is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Library General Public License as published
9  * by the Free Software Foundation; either version 2 of the License, or (at
10  * your 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,
20  * MA 02110-1301, USA.
21  */
22 
23 #include "identities.h"
24 
25 #include <kpimidentities/identitymanager.h>
26 #include <kpimidentities/identity.h>
27 
28 static KPIMIdentities::IdentityManager* mIdentityManager = 0;
29 
30 namespace KAlarmCal
31 {
32 namespace Identities
33 {
34 
35 KPIMIdentities::IdentityManager* identityManager()
36 {
37  if (!mIdentityManager)
38  mIdentityManager = new KPIMIdentities::IdentityManager(true); // create a read-only kmail identity manager
39  return mIdentityManager;
40 }
41 
42 /******************************************************************************
43 * Return whether any email identities exist.
44 */
45 bool identitiesExist()
46 {
47  identityManager(); // create identity manager if not already done
48  return mIdentityManager->begin() != mIdentityManager->end();
49 }
50 
51 /******************************************************************************
52 * Fetch the uoid of an email identity name or uoid string.
53 */
54 uint identityUoid(const QString& identityUoidOrName)
55 {
56  bool ok;
57  uint id = identityUoidOrName.toUInt(&ok);
58  if (!ok || identityManager()->identityForUoid(id).isNull())
59  {
60  identityManager(); // fetch it if not already done
61  for (KPIMIdentities::IdentityManager::ConstIterator it = mIdentityManager->begin();
62  it != mIdentityManager->end(); ++it)
63  {
64  if ((*it).identityName() == identityUoidOrName)
65  {
66  id = (*it).uoid();
67  break;
68  }
69  }
70  }
71  return id;
72 }
73 
74 } // namespace Identities
75 
76 } // namespace KAlarmCal
77 
78 // vim: et sw=4:
KPIMIdentities::IdentityManager
KAlarmCal::Identities::identityUoid
uint identityUoid(const QString &identityUoidOrName)
Fetch the uoid of an identity name or uoid string.
Definition: identities.cpp:54
KAlarmCal::Identities::identitiesExist
bool identitiesExist()
Return whether any identities exist.
Definition: identities.cpp:45
KAlarmCal::Identities::identityManager
KPIMIdentities::IdentityManager * identityManager()
Return the unique identity manager instance.
Definition: identities.cpp:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:14 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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