accounts-qt 1.17

service-type.h
1/* vi: set et sw=4 ts=4 cino=t0,(0: */
2/*
3 * This file is part of libaccounts-qt
4 *
5 * Copyright (C) 2011 Nokia Corporation.
6 * Copyright (C) 2012-2016 Canonical Ltd.
7 * Copyright (C) 2012 Intel Corporation.
8 *
9 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
10 * Contact: Jussi Laako <jussi.laako@linux.intel.com>
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * version 2.1 as published by the Free Software Foundation.
15 *
16 * This library is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 * 02110-1301 USA
25 */
30
31#ifndef ACCOUNTS_SERVICE_TYPE_H
32#define ACCOUNTS_SERVICE_TYPE_H
33
34#include "Accounts/accountscommon.h"
35
36#include <QObject>
37#include <QSet>
38#include <QString>
39#include <QDomDocument>
40
41 extern "C"
42{
43 typedef struct _AgServiceType AgServiceType;
44}
45
46 namespace Accounts
47{
48
49 class ACCOUNTS_EXPORT ServiceType
50{
51 public:
52 ServiceType();
53 ServiceType(const ServiceType &other);
54 ServiceType &operator=(const ServiceType &other);
55 ~ServiceType();
56
57 bool isValid() const;
58
59 QString name() const;
60 QString description() const;
61 QString displayName() const;
62 QString trCatalog() const;
63 QString iconName() const;
64 bool hasTag(const QString &tag) const;
65 QSet<QString> tags() const;
66
67 const QDomDocument domDocument() const;
68
69 friend inline bool operator==(const Accounts::ServiceType &s1,
70 const Accounts::ServiceType &s2) {
71 return s1.m_serviceType == s2.m_serviceType || s1.name() == s2.name();
72 }
73
74 private:
75 // \cond
76 friend class Manager;
77 ServiceType(AgServiceType *serviceType, ReferenceMode mode = AddReference);
78 AgServiceType *m_serviceType;
79 mutable QSet<QString> *m_tags;
80 // \endcond
81};
82
83} //namespace Accounts
84
85#endif // ACCOUNTS_SERVICE_TYPE_H
Accounts::Manager
Manager of accounts, services and providers.
Definition manager.h:52
Accounts::ServiceType
Representation of an account service type.
Definition service-type.h:50
Accounts::ServiceType::tags
QSet< QString > tags() const
Return all tags of the service type as a set.
Definition service-type.cpp:181
Accounts::ServiceType::ServiceType
ServiceType()
Construct an invalid serviceType.
Definition service-type.cpp:59
Accounts::ServiceType::isValid
bool isValid() const
Check whether this object represents a ServiceType.
Definition service-type.cpp:104
Accounts::ServiceType::name
QString name() const
Returns the name (ID) of the service type.
Definition service-type.cpp:112
Accounts::ServiceType::iconName
QString iconName() const
Definition service-type.cpp:159
Accounts::ServiceType::displayName
QString displayName() const
Definition service-type.cpp:134
Accounts::ServiceType::description
QString description() const
Definition service-type.cpp:121
Accounts::ServiceType::hasTag
bool hasTag(const QString &tag) const
Check if this service type has a tag.
Definition service-type.cpp:171
Accounts::ServiceType::trCatalog
QString trCatalog() const
Definition service-type.cpp:151
Accounts::ServiceType::domDocument
const QDomDocument domDocument() const
Definition service-type.cpp:200