accounts-qt  1.13
service.h
00001 /* vi: set et sw=4 ts=4 cino=t0,(0: */
00002 /*
00003  * This file is part of libaccounts-qt
00004  *
00005  * Copyright (C) 2009-2011 Nokia Corporation.
00006  * Copyright (C) 2012 Canonical Ltd.
00007  * Copyright (C) 2012 Intel Corporation.
00008  *
00009  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
00010  * Contact: Jussi Laako <jussi.laako@linux.intel.com>
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public License
00014  * version 2.1 as published by the Free Software Foundation.
00015  *
00016  * This library is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the Free Software
00023  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00024  * 02110-1301 USA
00025  */
00031 #ifndef ACCOUNTS_SERVICE_H
00032 #define ACCOUNTS_SERVICE_H
00033 
00034 #include "Accounts/accountscommon.h"
00035 
00036 #include <QString>
00037 #include <QSet>
00038 #include <QDomDocument>
00039 #include <QStringList>
00040 
00041 extern "C"
00042 {
00043     typedef struct _AgService AgService;
00044 }
00045 
00046 namespace Accounts
00047 {
00048 class ACCOUNTS_EXPORT Service
00049 {
00050 public:
00051     Service();
00052     Service(const Service &other);
00053     Service &operator=(const Service &other);
00054     ~Service();
00055 
00056     bool isValid() const;
00057 
00058     QString name() const;
00059     QString displayName() const;
00060     QString trCatalog() const;
00061     QString serviceType() const;
00062     QString provider() const;
00063     QString iconName() const;
00064     bool hasTag(const QString &tag) const;
00065     QSet<QString> tags() const;
00066 
00067     const QDomDocument domDocument() const;
00068 
00069     friend inline bool operator==(const Accounts::Service &s1,
00070                                   const Accounts::Service &s2) {
00071         return s1.m_service == s2.m_service || s1.name() == s2.name();
00072     }
00073 
00074 private:
00075     // \cond
00076     friend class Account;
00077     friend class AccountService;
00078     friend class AccountServicePrivate;
00079     friend class Application;
00080     friend class Manager;
00081     Service(AgService *service, ReferenceMode mode = AddReference);
00082     AgService *service() const;
00083     AgService *m_service;
00084     mutable QSet<QString> *m_tags;
00085     // \endcond
00086 };
00087 
00088 typedef QList<Service> ServiceList;
00089 
00090 } //namespace Accounts
00091 
00092 #endif // ACCOUNTS_SERVICE_H