KPeople

global.cpp
1/*
2 SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#include "global.h"
8
9#include "backends/abstractcontact.h"
10#include "personmanager_p.h"
11#include "personpluginmanager.h"
12
13// these namespace members expose the useful bits of PersonManager
14// global.h should be included from every exported header file so namespace members are always visible
15
16QString KPeople::mergeContacts(const QStringList &uris)
17{
18 return PersonManager::instance()->mergeContacts(uris);
19}
20
21bool KPeople::unmergeContact(const QString &uri)
22{
23 return PersonManager::instance()->unmergeContact(uri);
24}
25
26QString KPeople::iconNameForPresenceString(const QString &presenceName)
27{
28 if (presenceName == QLatin1String("available")) {
29 return QStringLiteral("user-online");
30 }
31
32 if (presenceName == QLatin1String("away")) {
33 return QStringLiteral("user-away");
34 }
35
36 if (presenceName == QLatin1String("busy") || presenceName == QLatin1String("dnd")) {
37 return QStringLiteral("user-busy");
38 }
39
40 if (presenceName == QLatin1String("xa")) {
41 return QStringLiteral("user-away-extended");
42 }
43
44 if (presenceName == QLatin1String("hidden")) {
45 return QStringLiteral("user-invisible");
46 }
47
48 return QStringLiteral("user-offline");
49}
50
51int KPeople::presenceSortPriority(const QString &presenceName)
52{
53 if (presenceName == QLatin1String("available")) {
54 return 0;
55 }
56
57 if (presenceName == QLatin1String("busy") || presenceName == QLatin1String("dnd")) {
58 return 1;
59 }
60
61 if (presenceName == QLatin1String("hidden")) {
62 return 2;
63 }
64
65 if (presenceName == QLatin1String("away")) {
66 return 3;
67 }
68
69 if (presenceName == QLatin1String("xa")) {
70 return 4;
71 }
72
73 if (presenceName == QLatin1String("unknown")) {
74 return 5;
75 }
76
77 if (presenceName == QLatin1String("offline")) {
78 return 6;
79 }
80
81 return 7;
82}
83
84void initResources()
85{
86 Q_INIT_RESOURCE(resources);
87}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:45 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.