libaccounts-qt  1.15
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  */
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 displayName() const;
61  QString trCatalog() const;
62  QString iconName() const;
63  bool hasTag(const QString &tag) const;
64  QSet<QString> tags() const;
65 
66  const QDomDocument domDocument() const;
67 
68  friend inline bool operator==(const Accounts::ServiceType &s1,
69  const Accounts::ServiceType &s2) {
70  return s1.m_serviceType == s2.m_serviceType || s1.name() == s2.name();
71  }
72 
73 private:
74  // \cond
75  friend class Manager;
76  ServiceType(AgServiceType *serviceType, ReferenceMode mode = AddReference);
77  AgServiceType *m_serviceType;
78  mutable QSet<QString> *m_tags;
79  // \endcond
80 };
81 
82 } //namespace Accounts
83 
84 #endif // ACCOUNTS_SERVICE_TYPE_H
Accounts::ServiceType
Representation of an account service type.
Definition: service-type.h:49
Accounts::Manager
Manager of accounts, services and providers.
Definition: manager.h:51
Accounts::ServiceType::name
QString name() const
Returns the name (ID) of the service type.
Definition: service-type.cpp:112