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
100 Account(
Manager *manager,
const QString &provider, QObject *parent = 0);
103 static Account *fromId(
Manager *manager, AccountId
id,
104 QObject *parent = 0);
106 AccountId id()
const;
110 bool supportsService(
const QString &serviceType)
const;
112 ServiceList services(
const QString &serviceType = QString())
const;
113 ServiceList enabledServices()
const;
115 bool enabled()
const;
116 bool isEnabled()
const;
117 void setEnabled(
bool);
126 uint credentialsId();
135 setValue(ACCOUNTS_KEY_CREDENTIALS_ID,
id);
138 QString displayName()
const;
139 void setDisplayName(
const QString &displayName);
141 QString providerName()
const;
145 Service selectedService()
const;
148 QStringList allKeys()
const;
149 void beginGroup(
const QString &prefix);
150 QStringList childGroups()
const;
151 QStringList childKeys()
const;
153 bool contains(
const QString &key)
const;
155 QString group()
const;
156 bool isWritable()
const;
157 void remove(
const QString &key);
159 void setValue(
const QString &key,
const QVariant &value);
160 QVariant value(
const QString &key,
161 const QVariant &defaultValue = QVariant(),
162 SettingSource *source = 0)
const;
163 SettingSource value(
const QString &key, QVariant &value)
const;
164 QString valueAsString(
const QString &key,
165 QString default_value = QString::null,
166 SettingSource *source = 0)
const;
167 int valueAsInt(
const QString &key,
168 int default_value = 0,
169 SettingSource *source = 0)
const;
170 quint64 valueAsUInt64(
const QString &key,
171 quint64 default_value = 0,
172 SettingSource *source = 0)
const;
173 bool valueAsBool(
const QString &key,
174 bool default_value =
false,
175 SettingSource *source = 0)
const;
177 Watch *watchKey(
const QString &key = QString());
184 void sign(
const QString &key,
const char *token);
185 bool verify(
const QString &key,
const char **token);
186 bool verifyWithTokens(
const QString &key, QList<const char*> tokens);
189 void displayNameChanged(
const QString &displayName);
190 void enabledChanged(
const QString &serviceName,
bool enabled);
198 AgAccount *account();
201 Account(Private *d, QObject *parent = 0);
203 friend class Account::Private;
206 friend class AccountServicePrivate;
215 #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.