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

KAlarm Library

  • 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
28static KPIMIdentities::IdentityManager* mIdentityManager = 0;
29
30namespace KAlarmCal
31{
32namespace Identities
33{
34
35KPIMIdentities::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*/
45bool 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*/
54uint 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::identitiesExist
bool identitiesExist()
Return whether any identities exist.
Definition: identities.cpp:45
KAlarmCal::Identities::identityUoid
uint identityUoid(const QString &identityUoidOrName)
Fetch the uoid of an identity name or uoid string.
Definition: identities.cpp:54
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-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 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.14.10 API Reference

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