accounts-qt  1.6
provider.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 Canonical Ltd.
7  *
8  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public License
12  * version 2.1 as published by the Free Software Foundation.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23  */
29 #ifndef ACCOUNTS_PROVIDER_H
30 #define ACCOUNTS_PROVIDER_H
31 
32 #include "Accounts/accountscommon.h"
33 
34 #include <QStringList>
35 #include <QDomDocument>
36 
37 extern "C"
38 {
39  typedef struct _AgProvider AgProvider;
40 }
41 
42 namespace Accounts
43 {
44 class Provider;
45 
46 typedef QList<Provider> ProviderList;
47 
48 class ACCOUNTS_EXPORT Provider
49 {
50 public:
51  Provider();
52  Provider(const Provider &other);
53  Provider &operator=(const Provider &other);
54  ~Provider();
55 
56  bool isValid() const;
57 
58  QString name() const;
59  QString displayName() const;
60  QString trCatalog() const;
61  QString iconName() const;
62  const QDomDocument domDocument() const;
63 
64  friend inline bool operator==(const Accounts::Provider &p1,
65  const Accounts::Provider &p2) {
66  return p1.m_provider == p2.m_provider || p1.name() == p2.name();
67  }
68 
69 private:
70  // \cond
71  friend class Manager;
72  Provider(AgProvider *provider, ReferenceMode mode = AddReference);
73  AgProvider *provider() const;
74  AgProvider *m_provider;
75  // \endcond
76 };
77 
78 } //namespace Accounts
79 
80 #endif // ACCOUNTS_PROVIDER_H