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 #if QT_VERSION < QT_VERSION_CHECK(5 ,0 ,0)
37 #define ACCOUNTS_KEY_CREDENTIALS_ID QString::fromUtf8("CredentialsId")
39 #define ACCOUNTS_KEY_CREDENTIALS_ID QStringLiteral("CredentialsId")
42 #include <QStringList>
47 typedef struct _AgAccount AgAccount;
48 typedef struct _AgAccountWatch *AgAccountWatch;
57 typedef quint32 AccountId;
58 typedef QList<AccountId> AccountIdList;
61 class AccountServicePrivate;
74 class ACCOUNTS_EXPORT
Watch:
public QObject
82 Watch(QObject *parent = 0);
85 void setWatch(AgAccountWatch w) { watch = w; };
90 void notify(
const char *key);
99 class ACCOUNTS_EXPORT Account:
public QObject
104 Account(
Manager *manager,
const QString &provider, QObject *parent = 0);
107 static Account *fromId(
Manager *manager, AccountId
id,
108 QObject *parent = 0);
110 AccountId id()
const;
114 bool supportsService(
const QString &serviceType)
const;
116 ServiceList services(
const QString &serviceType = QString())
const;
117 ServiceList enabledServices()
const;
119 bool enabled()
const;
120 bool isEnabled()
const;
121 void setEnabled(
bool);
130 uint credentialsId();
139 setValue(ACCOUNTS_KEY_CREDENTIALS_ID,
id);
142 QString displayName()
const;
143 void setDisplayName(
const QString &displayName);
145 QString providerName()
const;
149 Service selectedService()
const;
152 QStringList allKeys()
const;
153 void beginGroup(
const QString &prefix);
154 QStringList childGroups()
const;
155 QStringList childKeys()
const;
157 bool contains(
const QString &key)
const;
159 QString group()
const;
160 bool isWritable()
const;
161 void remove(
const QString &key);
163 void setValue(
const QString &key,
const QVariant &value);
164 QVariant value(
const QString &key,
165 const QVariant &defaultValue = QVariant(),
166 SettingSource *source = 0)
const;
167 SettingSource value(
const QString &key, QVariant &value)
const;
168 QString valueAsString(
const QString &key,
169 QString default_value = QString::null,
170 SettingSource *source = 0)
const;
171 int valueAsInt(
const QString &key,
172 int default_value = 0,
173 SettingSource *source = 0)
const;
174 quint64 valueAsUInt64(
const QString &key,
175 quint64 default_value = 0,
176 SettingSource *source = 0)
const;
177 bool valueAsBool(
const QString &key,
178 bool default_value =
false,
179 SettingSource *source = 0)
const;
181 Watch *watchKey(
const QString &key = QString());
188 void sign(
const QString &key,
const char *token);
189 bool verify(
const QString &key,
const char **token);
190 bool verifyWithTokens(
const QString &key, QList<const char*> tokens);
193 void displayNameChanged(
const QString &displayName);
194 void enabledChanged(
const QString &serviceName,
bool enabled);
202 AgAccount *account();
205 Account(Private *d, QObject *parent = 0);
207 friend class Account::Private;
210 friend class AccountServicePrivate;
219 #endif // ACCOUNTS_ACCOUNT_H
Manager of accounts, services and providers.
Account settings for a specific service.
Monitors an account key or group of keys.
Representation of an account provider.
Representation of an account service.
Base object definition for accounts error handling.
void setCredentialsId(const uint id)
Sets the accounts credentials ID.