29 #ifndef ACCOUNTS_ACCOUNT_H
30 #define ACCOUNTS_ACCOUNT_H
32 #include "Accounts/accountscommon.h"
33 #include "Accounts/error.h"
34 #include "Accounts/service.h"
36 #define ACCOUNTS_KEY_CREDENTIALS_ID QLatin1String("CredentialsId")
38 #include <QStringList>
43 typedef struct _AgAccount AgAccount;
44 typedef struct _AgAccountWatch *AgAccountWatch;
53 typedef quint32 AccountId;
54 typedef QList<AccountId> AccountIdList;
57 class AccountServicePrivate;
70 class ACCOUNTS_EXPORT
Watch:
public QObject
78 Watch(QObject *parent = 0);
81 void setWatch(AgAccountWatch w) { watch = w; };
86 void notify(
const char *key);
95 class ACCOUNTS_EXPORT Account:
public QObject
102 AccountId id()
const;
106 bool supportsService(
const QString &serviceType)
const;
108 ServiceList services(
const QString &serviceType = QString())
const;
109 ServiceList enabledServices()
const;
111 bool enabled()
const;
112 void setEnabled(
bool);
121 uint credentialsId();
130 setValue(ACCOUNTS_KEY_CREDENTIALS_ID,
id);
133 QString displayName()
const;
134 void setDisplayName(
const QString &displayName);
136 QString providerName()
const;
140 Service selectedService()
const;
143 QStringList allKeys()
const;
144 void beginGroup(
const QString &prefix);
145 QStringList childGroups()
const;
146 QStringList childKeys()
const;
148 bool contains(
const QString &key)
const;
150 QString group()
const;
151 bool isWritable()
const;
152 void remove(
const QString &key);
154 void setValue(
const QString &key,
const QVariant &value);
155 QVariant value(
const QString &key,
156 const QVariant &defaultValue = QVariant(),
157 SettingSource *source = 0)
const;
158 SettingSource value(
const QString &key, QVariant &value)
const;
159 QString valueAsString(
const QString &key,
160 QString default_value = QString::null,
161 SettingSource *source = 0)
const;
162 int valueAsInt(
const QString &key,
163 int default_value = 0,
164 SettingSource *source = 0)
const;
165 quint64 valueAsUInt64(
const QString &key,
166 quint64 default_value = 0,
167 SettingSource *source = 0)
const;
168 bool valueAsBool(
const QString &key,
169 bool default_value =
false,
170 SettingSource *source = 0)
const;
172 Watch *watchKey(
const QString &key = QString());
179 void sign(
const QString &key,
const char *token);
180 bool verify(
const QString &key,
const char **token);
181 bool verifyWithTokens(
const QString &key, QList<const char*> tokens);
184 void displayNameChanged(
const QString &displayName);
185 void enabledChanged(
const QString &serviceName,
bool enabled);
194 Account(AgAccount *account, QObject *parent = 0);
198 AgAccount *account();
202 friend class Account::Private;
205 friend class AccountServicePrivate;
214 #endif // ACCOUNTS_ACCOUNT_H