accounts-qt 1.16
service.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) 2009-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_H
32#define ACCOUNTS_SERVICE_H
33
34#include "Accounts/accountscommon.h"
35
36#include <QString>
37#include <QSet>
38#include <QDomDocument>
39#include <QStringList>
40
41extern "C"
42{
43 typedef struct _AgService AgService;
44}
45
46namespace Accounts
47{
48class ACCOUNTS_EXPORT Service
49{
50public:
51 Service();
52 Service(const Service &other);
53 Service &operator=(const Service &other);
54 ~Service();
55
56 bool isValid() const;
57
58 QString name() const;
59 QString description() const;
60 QString displayName() const;
61 QString trCatalog() const;
62 QString serviceType() const;
63 QString provider() const;
64 QString iconName() const;
65 bool hasTag(const QString &tag) const;
66 QSet<QString> tags() const;
67
68 const QDomDocument domDocument() const;
69
70 friend inline bool operator==(const Accounts::Service &s1,
71 const Accounts::Service &s2) {
72 return s1.m_service == s2.m_service || s1.name() == s2.name();
73 }
74
75private:
76 // \cond
77 friend class Account;
78 friend class AccountService;
79 friend class AccountServicePrivate;
80 friend class Application;
81 friend class Manager;
82 Service(AgService *service, ReferenceMode mode = AddReference);
83 AgService *service() const;
84 AgService *m_service;
85 mutable QSet<QString> *m_tags;
86 // \endcond
87};
88
89typedef QList<Service> ServiceList;
90
91} //namespace Accounts
92
93#endif // ACCOUNTS_SERVICE_H
Account settings for a specific service.
Information on the client applications of libaccounts.
Definition application.h:42
Manager of accounts, services and providers.
Definition manager.h:52
Representation of an account service.
Definition service.h:49
QSet< QString > tags() const
Return all tags of the service as a set.
Definition service.cpp:190
Service()
Construct an invalid service.
Definition service.cpp:59
QString serviceType() const
Get the service type ID of the service.
Definition service.cpp:142
bool isValid() const
Check whether this object represents a Service.
Definition service.cpp:104
QString name() const
Get the name of the service.
Definition service.cpp:114
QString iconName() const
Get the icon name for this service.
Definition service.cpp:168
QString displayName() const
Get the display name of the service, untranslated.
Definition service.cpp:133
QString description() const
Get the description of the service.
Definition service.cpp:124
QString provider() const
Get the provider ID of the service.
Definition service.cpp:159
bool hasTag(const QString &tag) const
Check if this service has a tag.
Definition service.cpp:180
QString trCatalog() const
Definition service.cpp:150
const QDomDocument domDocument() const
Get the contents of the service XML file.
Definition service.cpp:210