libaccounts-qt  1.1
account-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) 2012 Nokia Corporation.
00006 *
00007 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
00008 *
00009 * This library is free software; you can redistribute it and/or
00010 * modify it under the terms of the GNU Lesser General Public License
00011 * version 2.1 as published by the Free Software Foundation.
00012 *
00013 * This library is distributed in the hope that it will be useful, but
00014 * WITHOUT ANY WARRANTY; without even the implied warranty of
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016 * Lesser General Public License for more details.
00017 *
00018 * You should have received a copy of the GNU Lesser General Public
00019 * License along with this library; if not, write to the Free Software
00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021 * 02110-1301 USA
00022 */
00023 
00024 #ifndef ACCOUNTS_ACCOUNT_SERVICE_H
00025 #define ACCOUNTS_ACCOUNT_SERVICE_H
00026 
00027 #include <QObject>
00028 #include <QStringList>
00029 
00030 #include "Accounts/account.h"
00031 #include "Accounts/auth-data.h"
00032 
00033 namespace Accounts
00034 {
00035 class Manager;
00036 class Service;
00037 
00038 class AccountServicePrivate;
00039 class ACCOUNTS_EXPORT AccountService: public QObject
00040 {
00041     Q_OBJECT
00042 
00043 public:
00044     explicit AccountService(Account *account, Service *service);
00045     virtual ~AccountService();
00046 
00047     Account *account() const;
00048     Service *service() const;
00049 
00050     bool enabled() const;
00051 
00052     QStringList allKeys() const;
00053 
00054     void beginGroup(const QString &prefix);
00055 
00056     QStringList childGroups() const;
00057     QStringList childKeys() const;
00058 
00059     void clear();
00060 
00061     bool contains(const QString &key) const;
00062 
00063     void endGroup();
00064 
00065     QString group() const;
00066 
00067     void remove(const QString &key);
00068 
00069     void setValue(const char *key, const QVariant &value);
00070     void setValue(const QString &key, const QVariant &value);
00071 
00072     QVariant value(const QString &key, SettingSource *source = 0) const;
00073     QVariant value(const char *key, SettingSource *source = 0) const;
00074 
00075     QStringList changedFields() const;
00076 
00077     AuthData authData() const;
00078 
00079 signals:
00080     void enabled(bool isEnabled);
00081     void changed();
00082 
00083 private:
00084     // Don't include private data in docs: \cond
00085     AccountServicePrivate *d_ptr;
00086     Q_DECLARE_PRIVATE(AccountService)
00087     // \endcond
00088 };
00089 
00090 typedef QList<AccountService*> AccountServiceList;
00091 
00092 } //namespace
00093 
00094 #endif // ACCOUNTS_ACCOUNT_SERVICE_H