• Skip to content
  • Skip to link menu
KDE API Documentation - global.cpp Source File (KPeople)
  • KDE Home
  • Contact Us
 

KPeople

  • frameworks
  • kpeople
  • src
global.cpp
1 /*
2  Copyright (C) 2013 David Edmundson <davidedmundson@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #include "global.h"
20 
21 #include "personmanager_p.h"
22 #include "personpluginmanager_p.h"
23 #include "backends/abstractcontact.h"
24 
25 //these namespace members expose the useful bits of PersonManager
26 //global.h should be included from every exported header file so namespace members are always visible
27 
28 QString KPeople::mergeContacts(const QStringList &uris)
29 {
30  return PersonManager::instance()->mergeContacts(uris);
31 }
32 
33 bool KPeople::unmergeContact(const QString &uri)
34 {
35  return PersonManager::instance()->unmergeContact(uri);
36 }
37 
38 QString KPeople::iconNameForPresenceString(const QString &presenceName)
39 {
40  if (presenceName == QLatin1String("available")) {
41  return QStringLiteral("user-online");
42  }
43 
44  if (presenceName == QLatin1String("away")) {
45  return QStringLiteral("user-away");
46  }
47 
48  if (presenceName == QLatin1String("busy") || presenceName == QLatin1String("dnd")) {
49  return QStringLiteral("user-busy");
50  }
51 
52  if (presenceName == QLatin1String("xa")) {
53  return QStringLiteral("user-away-extended");
54  }
55 
56  if (presenceName == QLatin1String("hidden")) {
57  return QStringLiteral("user-invisible");
58  }
59 
60  return QStringLiteral("user-offline");
61 }
62 
63 int KPeople::presenceSortPriority(const QString &presenceName)
64 {
65  if (presenceName == QLatin1String("available")) {
66  return 0;
67  }
68 
69  if (presenceName == QLatin1String("busy") || presenceName == QLatin1String("dnd")) {
70  return 1;
71  }
72 
73  if (presenceName == QLatin1String("hidden")) {
74  return 2;
75  }
76 
77  if (presenceName == QLatin1String("away")) {
78  return 3;
79  }
80 
81  if (presenceName == QLatin1String("xa")) {
82  return 4;
83  }
84 
85  if (presenceName == QLatin1String("unknown")) {
86  return 5;
87  }
88 
89  if (presenceName == QLatin1String("offline")) {
90  return 6;
91  }
92 
93  return 7;
94 }
KPeople::mergeContacts
KPEOPLE_EXPORT QString mergeContacts(const QStringList &uris)
Merge all uris into a single person.
Definition: global.cpp:28
KPeople::iconNameForPresenceString
KPEOPLE_EXPORT QString iconNameForPresenceString(const QString &presenceName)
Return a QPixmap for a TP presence string.
Definition: global.cpp:38
KPeople::presenceSortPriority
KPEOPLE_EXPORT int presenceSortPriority(const QString &presenceName)
Returns a sort priority for the given presenceName.
Definition: global.cpp:63
KPeople::unmergeContact
KPEOPLE_EXPORT bool unmergeContact(const QString &uri)
Unmerge a contact.
Definition: global.cpp:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Fri Feb 13 2015 15:16:39 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KPeople

Skip menu "KPeople"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List

Class Picker

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