accounts-qml-module-0.6+16.04.20151106/0000755000015300001610000000000012617075042017605 5ustar pbuserpbgroup00000000000000accounts-qml-module-0.6+16.04.20151106/.gitignore0000644000015300001610000000023012617074451021573 0ustar pbuserpbgroup00000000000000/coverage-html /coverage.info *.gcda *.gcno *.moc *.o Makefile.* Makefile moc_* /src/qmldir /src/Ubuntu /tests/mock/libsignon-qt5.so* /tests/tst_plugin accounts-qml-module-0.6+16.04.20151106/src/0000755000015300001610000000000012617075042020374 5ustar pbuserpbgroup00000000000000accounts-qml-module-0.6+16.04.20151106/src/account.cpp0000644000015300001610000001720012617074451022537 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "account.h" #include "debug.h" #include #include #include #include using namespace OnlineAccounts; /*! * \qmltype Account * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief Represents an instance of an online account. * * The Account element represents an online account. It is functional only if * its \a objectHandle property is set to a valid account, which can be * obtained with Manager.loadAccount() or Manager.createAccount(). */ Account::Account(QObject *parent): QObject(parent), account(0), accountService(0) { } Account::~Account() { } /*! * \qmlproperty object Account::objectHandle * An opaque handle to the underlying C++ object. Until the property is set, * the Account element is uninitialized. Similarly, if the C++ object is * destroyed, expect the Account to become invalid. */ void Account::setObjectHandle(QObject *object) { DEBUG() << object; Accounts::Account *a = qobject_cast(object); if (Q_UNLIKELY(a == 0)) return; if (a == account) return; account = a; QObject::connect(account, SIGNAL(displayNameChanged(const QString &)), this, SIGNAL(displayNameChanged())); QObject::connect(account, SIGNAL(synced()), this, SIGNAL(synced())); QObject::connect(account, SIGNAL(removed()), this, SLOT(onRemoved())); /* Setup an AccountService object to monitor the settings of the global * account. */ delete accountService; accountService = new Accounts::AccountService(account, Accounts::Service(), account); QObject::connect(accountService, SIGNAL(enabled(bool)), this, SIGNAL(enabledChanged())); Q_EMIT objectHandleChanged(); /* Emit the changed signals for all other properties, to make sure * that all bindings are updated. */ Q_EMIT accountIdChanged(); Q_EMIT enabledChanged(); Q_EMIT displayNameChanged(); } QObject *Account::objectHandle() const { return account; } /*! * \qmlproperty bool Account::enabled * This read-only property tells whether the Account is enabled. An * application shouldn't use an Account which is disabled. */ bool Account::enabled() const { if (Q_UNLIKELY(accountService == 0)) return false; return accountService->enabled(); } /*! * \qmlproperty jsobject Account::provider * An immutable object representing the provider which provides the account. * The returned object will have at least these members: * \list * \li \c id is the unique identified for this provider * \li \c displayName * \li \c iconName * \endlist */ QVariantMap Account::provider() const { QVariantMap map; if (Q_UNLIKELY(account == 0)) return map; Accounts::Provider provider = account->provider(); map.insert("id", provider.name()); map.insert("displayName", provider.displayName()); map.insert("iconName", provider.iconName()); return map; } /*! * \qmlproperty string Account::displayName * The account's display name (usually the user's login or ID). */ QString Account::displayName() const { if (Q_UNLIKELY(account == 0)) return QString(); return account->displayName(); } /*! * \qmlproperty string Account::accountId * The account's numeric ID. This is 0 until the account has been stored into the DB. */ uint Account::accountId() const { if (Q_UNLIKELY(account == 0)) return 0; return account->id(); } /*! * \qmlproperty object Account::accountServiceHandle * A C++ object which can be used to instantiate an AccountService by setting * it as the value for the \l AccountService::objectHandle property. */ QObject *Account::accountServiceHandle() const { return accountService; } /*! * \qmlmethod void Account::updateDisplayName(string displayName) * * Changes the display name of the account. * * \sa sync() */ void Account::updateDisplayName(const QString &displayName) { if (Q_UNLIKELY(account == 0)) return; account->setDisplayName(displayName); } /*! * \qmlmethod void Account::updateEnabled(bool enabled) * * Enables or disables the account. * * \sa sync() */ void Account::updateEnabled(bool enabled) { if (Q_UNLIKELY(account == 0)) return; account->selectService(); account->setEnabled(enabled); } /*! * \qmlmethod void Account::sync() * * Writes the changes to the permanent account storage. */ void Account::sync() { if (Q_UNLIKELY(account == 0)) return; account->sync(); } /*! * \qmlmethod void Account::remove() * * Deletes the account from the permanent storage. This method accepts an * optional parameter, which tells whether the credentials associated with * the account should also be removed: * \list * \li \c Account.RemoveAccountOnly * \li \c Account.RemoveCredentials - the default * \endlist */ void Account::remove(RemovalOptions options) { if (Q_UNLIKELY(account == 0)) return; if (options & RemoveCredentials) { /* Get all the IDs of the credentials used by this account */ QList credentialIds; account->selectService(); uint credentialsId = account->value("CredentialsId").toUInt(); if (credentialsId != 0) credentialIds.append(credentialsId); Q_FOREACH (const Accounts::Service &service, account->services()) { account->selectService(service); credentialsId = account->value("CredentialsId").toUInt(); if (credentialsId != 0) credentialIds.append(credentialsId); } /* Instantiate an Identity object for each of them */ Q_FOREACH (uint credentialsId, credentialIds) { SignOn::Identity *identity = SignOn::Identity::existingIdentity(credentialsId, this); QObject::connect(identity, SIGNAL(removed()), this, SLOT(onIdentityRemoved())); /* Since we don't do any error handling in case the removal of the * identity failed, we connect to the same slot. */ QObject::connect(identity, SIGNAL(error(const SignOn::Error&)), this, SLOT(onIdentityRemoved())); identities.append(identity); } } account->remove(); account->sync(); } /*! * \qmlsignal Account::synced() * * Emitted when the account changes have been stored into the permanent storage. */ void Account::onRemoved() { Q_FOREACH (SignOn::Identity *identity, identities) { /* Remove the associated credentials */ identity->remove(); } /* Don't emit the removed() signal until all associated Identity objects * have been removed */ if (identities.isEmpty()) { Q_EMIT removed(); } } void Account::onIdentityRemoved() { SignOn::Identity *identity = qobject_cast(sender()); identities.removeAll(identity); identity->deleteLater(); if (identities.isEmpty()) { Q_EMIT removed(); } } accounts-qml-module-0.6+16.04.20151106/src/plugin.h0000644000015300001610000000206512617074451022051 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_PLUGIN_H #define ONLINE_ACCOUNTS_PLUGIN_H #include namespace OnlineAccounts { class Plugin: public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); }; }; // namespace #endif // ONLINE_ACCOUNTS_PLUGIN_H accounts-qml-module-0.6+16.04.20151106/src/account-service.h0000644000015300001610000001003412617074451023640 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_ACCOUNT_SERVICE_H #define ONLINE_ACCOUNTS_ACCOUNT_SERVICE_H #include #include #include #include #include namespace Accounts { class AccountService; }; namespace SignOn { class AuthSession; class Error; class Identity; class SessionData; }; namespace OnlineAccounts { class AccountService: public QObject, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_ENUMS(ErrorCode) Q_PROPERTY(QObject *objectHandle READ objectHandle \ WRITE setObjectHandle NOTIFY objectHandleChanged) Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged) Q_PROPERTY(bool serviceEnabled READ serviceEnabled NOTIFY settingsChanged) Q_PROPERTY(QVariantMap provider READ provider NOTIFY objectHandleChanged) Q_PROPERTY(QVariantMap service READ service NOTIFY objectHandleChanged) Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged) Q_PROPERTY(uint accountId READ accountId NOTIFY objectHandleChanged) Q_PROPERTY(QVariantMap settings READ settings NOTIFY settingsChanged) Q_PROPERTY(QVariantMap authData READ authData NOTIFY settingsChanged) Q_PROPERTY(bool autoSync READ autoSync WRITE setAutoSync \ NOTIFY autoSyncChanged) Q_PROPERTY(QObject *credentials READ credentials WRITE setCredentials \ NOTIFY credentialsChanged) public: enum ErrorCode { NoError = 0, NoAccountError, UserCanceledError, PermissionDeniedError, NetworkError, SslError, InteractionRequiredError, }; AccountService(QObject *parent = 0); ~AccountService(); void setObjectHandle(QObject *object); QObject *objectHandle() const; bool enabled() const; bool serviceEnabled() const; QVariantMap provider() const; QVariantMap service() const; QString displayName() const; uint accountId() const; QVariantMap settings() const; QVariantMap authData() const; void setAutoSync(bool autoSync); bool autoSync() const; void setCredentials(QObject *credentials); QObject *credentials() const; Q_INVOKABLE void authenticate(const QVariantMap &sessionData = QVariantMap()); Q_INVOKABLE void cancelAuthentication(); Q_INVOKABLE void updateServiceEnabled(bool enabled); Q_INVOKABLE void updateSettings(const QVariantMap &settings); // reimplemented virtual methods void classBegin(); void componentComplete(); Q_SIGNALS: void objectHandleChanged(); void enabledChanged(); void displayNameChanged(); void settingsChanged(); void autoSyncChanged(); void credentialsChanged(); void authenticated(const QVariantMap &reply); void authenticationError(const QVariantMap &error); private Q_SLOTS: void onAuthSessionResponse(const SignOn::SessionData &sessionData); void onAuthSessionError(const SignOn::Error &error); void onCredentialsIdChanged(); private: void syncIfDesired(); private: QPointer accountService; SignOn::Identity *identity; QPointer authSession; QPointer m_credentials; QQmlProperty credentialsIdProperty; bool constructed; bool m_autoSync; }; }; // namespace #endif // ONLINE_ACCOUNTS_ACCOUNT_SERVICE_H accounts-qml-module-0.6+16.04.20151106/src/plugin.cpp0000644000015300001610000000353612617074455022414 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "account-service-model.h" #include "account-service.h" #include "account.h" #include "application-model.h" #include "credentials.h" #include "debug.h" #include "manager.h" #include "plugin.h" #include "provider-model.h" #include #include using namespace OnlineAccounts; static QObject *createManager(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine); Q_UNUSED(scriptEngine); return new Manager(); } void Plugin::registerTypes(const char *uri) { QByteArray loggingLevelVar = qgetenv("OAQ_LOGGING_LEVEL"); if (!loggingLevelVar.isEmpty()) { setLoggingLevel(loggingLevelVar.toInt()); } DEBUG() << Q_FUNC_INFO << uri; qmlRegisterType(uri, 0, 1, "AccountServiceModel"); qmlRegisterType(uri, 0, 1, "AccountService"); qmlRegisterType(uri, 0, 1, "Account"); qmlRegisterType(uri, 0, 1, "ApplicationModel"); qmlRegisterType(uri, 0, 1, "Credentials"); qmlRegisterType(uri, 0, 1, "ProviderModel"); qmlRegisterSingletonType(uri, 0, 1, "Manager", createManager); } accounts-qml-module-0.6+16.04.20151106/src/manager.h0000644000015300001610000000247212617074451022167 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_MANAGER_H #define ONLINE_ACCOUNTS_MANAGER_H #include #include namespace Accounts { class Manager; }; namespace OnlineAccounts { class SharedManager { public: static QSharedPointer instance(); }; class Manager: public QObject { Q_OBJECT public: Manager(QObject *parent = 0); ~Manager(); Q_INVOKABLE QObject *loadAccount(uint accountId); Q_INVOKABLE QObject *createAccount(const QString &providerName); private: QSharedPointer manager; }; }; // namespace #endif // ONLINE_ACCOUNTS_MANAGER_H accounts-qml-module-0.6+16.04.20151106/src/qmldir.in0000644000015300001610000000007612617074451022222 0ustar pbuserpbgroup00000000000000module $${API_URI} plugin $${TARGET} typeinfo plugin.qmltypes accounts-qml-module-0.6+16.04.20151106/src/debug.cpp0000644000015300001610000000160012617074455022172 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2015 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "debug.h" int accounts_qml_module_logging_level = 1; namespace OnlineAccounts { void setLoggingLevel(int level) { accounts_qml_module_logging_level = level; } } accounts-qml-module-0.6+16.04.20151106/src/account-service-model.h0000644000015300001610000000710412617074451024742 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_ACCOUNT_SERVICE_MODEL_H #define ONLINE_ACCOUNTS_ACCOUNT_SERVICE_MODEL_H #include #include #include namespace OnlineAccounts { class AccountServiceModelPrivate; class AccountServiceModel: public QAbstractListModel, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(int count READ rowCount NOTIFY countChanged) Q_PROPERTY(bool includeDisabled READ includeDisabled \ WRITE setIncludeDisabled NOTIFY includeDisabledChanged) Q_PROPERTY(quint32 accountId READ accountId WRITE setAccountId \ NOTIFY accountIdChanged) Q_PROPERTY(QObject *account READ account WRITE setAccount \ NOTIFY accountChanged) Q_PROPERTY(QString applicationId READ applicationId \ WRITE setApplicationId NOTIFY applicationIdChanged) Q_PROPERTY(QString provider READ provider WRITE setProvider \ NOTIFY providerChanged) Q_PROPERTY(QString serviceType READ serviceType WRITE setServiceType \ NOTIFY serviceTypeChanged) Q_PROPERTY(QString service READ service WRITE setService \ NOTIFY serviceChanged) public: AccountServiceModel(QObject *parent = 0); ~AccountServiceModel(); enum Roles { DisplayNameRole = Qt::UserRole + 1, ProviderNameRole, ServiceNameRole, EnabledRole, AccountServiceHandleRole, AccountServiceRole, // deprecated AccountIdRole, AccountHandleRole, AccountRole, // deprecated }; void setIncludeDisabled(bool includeDisabled); bool includeDisabled() const; void setAccountId(quint32 accountId); quint32 accountId() const; void setAccount(QObject *account); QObject *account() const; void setApplicationId(const QString &applicationId); QString applicationId() const; void setProvider(const QString &providerId); QString provider() const; void setServiceType(const QString &serviceTypeId); QString serviceType() const; void setService(const QString &serviceId); QString service() const; Q_INVOKABLE QVariant get(int row, const QString &roleName) const; // reimplemented virtual methods int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QHash roleNames() const; void classBegin(); void componentComplete(); Q_SIGNALS: void countChanged(); void includeDisabledChanged(); void accountIdChanged(); void accountChanged(); void applicationIdChanged(); void providerChanged(); void serviceTypeChanged(); void serviceChanged(); private: AccountServiceModelPrivate *d_ptr; Q_DECLARE_PRIVATE(AccountServiceModel) }; }; // namespace #endif // ONLINE_ACCOUNTS_ACCOUNT_SERVICE_MODEL_H accounts-qml-module-0.6+16.04.20151106/src/application-model.h0000644000015300001610000000415612617074451024157 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_APPLICATION_MODEL_H #define ONLINE_ACCOUNTS_APPLICATION_MODEL_H #include "manager.h" #include #include #include #include namespace OnlineAccounts { class Application; class ApplicationModel: public QAbstractListModel { Q_OBJECT Q_PROPERTY(int count READ rowCount NOTIFY countChanged) Q_PROPERTY(QString service READ service WRITE setService \ NOTIFY serviceChanged) public: ApplicationModel(QObject *parent = 0); ~ApplicationModel(); enum Roles { ApplicationIdRole = Qt::UserRole + 1, DisplayNameRole, IconNameRole, ServiceUsageRole, ApplicationRole, TranslationsRole, }; void setService(const QString &serviceId); QString service() const; Q_INVOKABLE QVariant get(int row, const QString &roleName) const; // reimplemented virtual methods int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QHash roleNames() const; Q_SIGNALS: void countChanged(); void serviceChanged(); private: void computeApplicationList(); private: QSharedPointer manager; QList applications; Accounts::Service m_service; }; }; // namespace #endif // ONLINE_ACCOUNTS_APPLICATION_MODEL_H accounts-qml-module-0.6+16.04.20151106/src/application-model.cpp0000644000015300001610000001117712617074451024513 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "debug.h" #include "application-model.h" #include "application.h" #include #include using namespace OnlineAccounts; /*! * \qmltype ApplicationModel * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief A model of the applications using online accounts. * * The ApplicationModel is a model representing the applications using online * accounts installed on the system. * * In the current implementation, the model is valid only if its \l * ApplicationModel::service property is set to a valid service ID. * * The model defines the following roles: * \list * \li \c applicationId is the unique identifier of the application * \li \c displayName is the application display name * \li \c iconName is the name of the application icon * \li \c serviceUsage is a description of how the application uses the * service; this is set to a valid value only if the \l * ApplicationModel::service property is set to a valid service ID. * \li \c application is the Application object * \li \c translations, the localization domain for translating the * \c serviceUsage field * \endlist */ ApplicationModel::ApplicationModel(QObject *parent): QAbstractListModel(parent), manager(SharedManager::instance()) { } ApplicationModel::~ApplicationModel() { } /*! * \qmlproperty int ApplicationModel::count * The number of items in the model. */ int ApplicationModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); return applications.count(); } /*! * \qmlproperty string ApplicationModel::service * If set, the model will list only those applications which can use this * specific service. */ void ApplicationModel::setService(const QString &serviceId) { if (serviceId == m_service.name()) return; m_service = manager->service(serviceId); beginResetModel(); qDeleteAll(applications); applications.clear(); computeApplicationList(); endResetModel(); Q_EMIT serviceChanged(); } QString ApplicationModel::service() const { return m_service.name(); } /*! * \qmlmethod variant ApplicationModel::get(int row, string roleName) * * Returns the data at \a row for the role \a roleName. */ QVariant ApplicationModel::get(int row, const QString &roleName) const { int role = roleNames().key(roleName.toLatin1(), -1); return data(index(row), role); } QVariant ApplicationModel::data(const QModelIndex &index, int role) const { if (index.row() < 0 || index.row() >= applications.count()) return QVariant(); Application *application = applications.at(index.row()); QVariant ret; switch (role) { case Qt::DisplayRole: case ApplicationIdRole: ret = application->name(); break; case DisplayNameRole: ret = application->displayName(); break; case IconNameRole: ret = application->iconName(); break; case ServiceUsageRole: ret = application->serviceUsage(m_service); break; case ApplicationRole: QQmlEngine::setObjectOwnership(application, QQmlEngine::CppOwnership); ret = QVariant::fromValue(application); break; case TranslationsRole: ret = application->trCatalog(); break; } return ret; } QHash ApplicationModel::roleNames() const { static QHash roles; if (roles.isEmpty()) { roles[ApplicationIdRole] = "applicationId"; roles[DisplayNameRole] = "displayName"; roles[IconNameRole] = "iconName"; roles[ServiceUsageRole] = "serviceUsage"; roles[ApplicationRole] = "application"; roles[TranslationsRole] = "translations"; } return roles; } void ApplicationModel::computeApplicationList() { if (!m_service.isValid()) return; Q_FOREACH(const Accounts::Application &app, manager->applicationList(m_service)) { applications.append(new Application(app, this)); } } accounts-qml-module-0.6+16.04.20151106/src/application.cpp0000644000015300001610000000347612617074451023420 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "application.h" #include "debug.h" using namespace OnlineAccounts; /*! * \qmltype Application * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief Represents a client application of Online Accounts. * * The Application element represents an application using online accounts. * Currently, instances of this object cannot be created directly, but are * instantiated by the \l ApplicationModel element. */ Application::Application(const Accounts::Application &application, QObject *parent): QObject(parent), Accounts::Application(application) { } Application::~Application() { } /*! * \qmlproperty string Application::applicationId * Unique identifier for this application. */ /*! * \qmlproperty string Application::description * Description of the application. */ /*! * \qmlmethod string Application::serviceUsage(Service service) * * Returns a textual description of how the application can make use of \a * service. */ QString Application::serviceUsage(const Accounts::Service &service) { return Accounts::Application::serviceUsage(service); } accounts-qml-module-0.6+16.04.20151106/src/account-service-model.cpp0000644000015300001610000006051312617074451025300 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "account-service-model.h" #include "debug.h" #include "manager.h" #include #include #include #include #include #include using namespace OnlineAccounts; static const QLatin1String globalService("global"); static bool sortByProviderAndDisplayName(const Accounts::AccountService *as1, const Accounts::AccountService *as2) { const Accounts::Account *a1 = as1->account(); const Accounts::Account *a2 = as2->account(); int diff = QString::compare(a1->providerName(), a2->providerName()); if (diff < 0) return true; if (diff > 0) return false; diff = QString::compare(a1->displayName(), a2->displayName()); if (diff < 0) return true; if (diff > 0) return false; // last, sort by service return as1->service().name() < as2->service().name(); } namespace OnlineAccounts { typedef QList AccountServices; class AccountServiceModelPrivate: public QObject { Q_OBJECT Q_DECLARE_PUBLIC(AccountServiceModel) public: AccountServiceModelPrivate(AccountServiceModel *model); ~AccountServiceModelPrivate(); void queueUpdate(); AccountServices listAccountServices(Accounts::Account *account) const; AccountServices watchAccount(Accounts::Account *account); void addServicesFromAccount(Accounts::Account *account); void watchItems(const AccountServices &items); void addItems(const AccountServices &added); void removeItems(const AccountServices &removed); void sortItems(); public Q_SLOTS: void update(); void onAccountCreated(Accounts::AccountId id); void onAccountRemoved(Accounts::AccountId id); void onAccountDisplayNameChanged(); void onAccountServiceEnabled(bool enabled); private: mutable AccountServiceModel *q_ptr; QHash roleNames; bool componentCompleted; bool updateQueued; bool accountIdChanged; bool accountChanged; bool applicationIdChanged; bool providerChanged; bool serviceTypeChanged; bool serviceChanged; bool includeDisabled; Accounts::AccountId accountId; QPointer account; Accounts::Application application; QString providerId; QString serviceTypeId; QString serviceId; QSharedPointer manager; AccountServices allItems; AccountServices modelItems; bool (*sortFunction)(const Accounts::AccountService *as1, const Accounts::AccountService *as2); }; }; // namespace AccountServiceModelPrivate::AccountServiceModelPrivate(AccountServiceModel *model): QObject(model), q_ptr(model), componentCompleted(false), updateQueued(true), accountIdChanged(false), accountChanged(false), providerChanged(false), serviceTypeChanged(false), serviceChanged(false), includeDisabled(false), accountId(0), sortFunction(sortByProviderAndDisplayName) { } AccountServiceModelPrivate::~AccountServiceModelPrivate() { qDeleteAll(allItems); } void AccountServiceModelPrivate::queueUpdate() { if (updateQueued) return; updateQueued = true; QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection); } AccountServices AccountServiceModelPrivate::listAccountServices(Accounts::Account *account) const { AccountServices ret; if (Q_UNLIKELY(account == 0)) return ret; if (!providerId.isEmpty() && account->providerName() != providerId) return ret; if (serviceId == globalService) { ret.append(new Accounts::AccountService(account, Accounts::Service())); } else { foreach (Accounts::Service service, account->services()) { if (!serviceId.isEmpty() && service.name() != serviceId) continue; if (application.isValid() && application.serviceUsage(service).isEmpty()) continue; ret.append(new Accounts::AccountService(account, service)); } } return ret; } AccountServices AccountServiceModelPrivate::watchAccount(Accounts::Account *account) { AccountServices accountServices = listAccountServices(account); watchItems(accountServices); QObject::connect(account, SIGNAL(displayNameChanged(const QString &)), this, SLOT(onAccountDisplayNameChanged()), Qt::UniqueConnection); return accountServices; } void AccountServiceModelPrivate::addServicesFromAccount(Accounts::Account *account) { AccountServices accountServices = watchAccount(account); AccountServices newModelItems; foreach (Accounts::AccountService *accountService, accountServices) { if (includeDisabled || accountService->enabled()) newModelItems.append(accountService); } qSort(newModelItems.begin(), newModelItems.end(), sortFunction); addItems(newModelItems); } void AccountServiceModelPrivate::watchItems(const AccountServices &items) { foreach (Accounts::AccountService *accountService, items) { QObject::connect(accountService, SIGNAL(enabled(bool)), this, SLOT(onAccountServiceEnabled(bool))); } allItems.append(items); } /* * NOTE: @added must be already sorted! */ void AccountServiceModelPrivate::addItems(const AccountServices &added) { Q_Q(AccountServiceModel); AccountServices newModelItems = modelItems; QModelIndex root; QMap addedIndexes; foreach (Accounts::AccountService *accountService, added) { // Find where the item should be inserted AccountServices::iterator i = qLowerBound(modelItems.begin(), modelItems.end(), accountService, sortFunction); int index = i - modelItems.begin(); addedIndexes[index]++; } // update the list int inserted = 0; for (QMap::const_iterator i = addedIndexes.constBegin(); i != addedIndexes.constEnd(); i++) { int start = i.key(); int count = i.value(); q->beginInsertRows(root, start + inserted, start + inserted + count - 1); for (int j = 0; j < count; j++) { Accounts::AccountService *accountService = added.at(inserted + j); modelItems.insert(start + inserted + j, accountService); } q->endInsertRows(); inserted += count; } } void AccountServiceModelPrivate::removeItems(const AccountServices &removed) { Q_Q(AccountServiceModel); QModelIndex root; QList removedIndexes; foreach (Accounts::AccountService *accountService, removed) { int index = modelItems.indexOf(accountService); if (Q_UNLIKELY(index < 0)) { qWarning() << "Item already deleted!" << accountService; continue; } removedIndexes.append(index); } // sort the indexes from highest to lower, and start updating the list qSort(removedIndexes.begin(), removedIndexes.end(), qGreater()); int first = -1; int last = -1; foreach (int index, removedIndexes) { // Check whether the indexes are contiguous if (index != first - 1) { // if we have a valid range, update the list for that range if (first != -1) { q->beginRemoveRows(root, first, last); for (int i = last; i >= first; i--) modelItems.removeAt(i); q->endRemoveRows(); } // a new range starts last = index; } first = index; } if (first != -1) { q->beginRemoveRows(root, first, last); for (int i = last; i >= first; i--) modelItems.removeAt(i); q->endRemoveRows(); } } void AccountServiceModelPrivate::sortItems() { qSort(modelItems.begin(), modelItems.end(), sortFunction); } void AccountServiceModelPrivate::update() { Q_Q(AccountServiceModel); updateQueued = false; DEBUG(); if (!modelItems.isEmpty()) { q->beginRemoveRows(QModelIndex(), 0, modelItems.count() - 1); modelItems.clear(); q->endRemoveRows(); } qDeleteAll(allItems); allItems.clear(); if (serviceTypeChanged) { if (!manager.isNull()) { QObject::disconnect(manager.data(), 0, this, 0); manager.clear(); } } /* Instantiate a manager, if needed. If the account property is set to a * valid account, we don't need a manager object. */ if (manager.isNull() && account == 0) { if (serviceTypeId.isEmpty()) { manager = SharedManager::instance(); } else { manager = QSharedPointer( new Accounts::Manager(serviceTypeId)); } QObject::connect(manager.data(), SIGNAL(accountCreated(Accounts::AccountId)), this, SLOT(onAccountCreated(Accounts::AccountId))); QObject::connect(manager.data(), SIGNAL(accountRemoved(Accounts::AccountId)), this, SLOT(onAccountRemoved(Accounts::AccountId))); } QList accounts; if (account != 0) { accounts.append(account); } else if (accountId != 0) { Accounts::Account *account = manager->account(accountId); accounts.append(account); } else { foreach (Accounts::AccountId accountId, manager->accountList()) { Accounts::Account *account = manager->account(accountId); accounts.append(account); } } foreach (Accounts::Account *account, accounts) { watchAccount(account); } AccountServices newModelItems; if (includeDisabled) { newModelItems = allItems; } else { foreach (Accounts::AccountService *accountService, allItems) { if (accountService->enabled()) newModelItems.append(accountService); } } if (!newModelItems.isEmpty()) { q->beginInsertRows(QModelIndex(), 0, newModelItems.count() - 1); modelItems = newModelItems; sortItems(); q->endInsertRows(); } accountIdChanged = false; providerChanged = false; serviceTypeChanged = false; serviceChanged = false; } void AccountServiceModelPrivate::onAccountCreated(Accounts::AccountId id) { DEBUG() << id; Accounts::Account *account = manager->account(id); addServicesFromAccount(account); } void AccountServiceModelPrivate::onAccountRemoved(Accounts::AccountId id) { DEBUG() << id; AccountServices removed; foreach (Accounts::AccountService *accountService, allItems) { if (accountService->account()->id() == id) { removed.append(accountService); } } /* Remove the items from the model */ removeItems(removed); /* Last, delete the items */ foreach (Accounts::AccountService *accountService, removed) { allItems.removeOne(accountService); delete accountService; } } void AccountServiceModelPrivate::onAccountDisplayNameChanged() { Q_Q(AccountServiceModel); Accounts::Account *account = qobject_cast(sender()); for (int row = 0; row < modelItems.count(); row++) { Accounts::AccountService *accountService = modelItems[row]; if (accountService->account() == account) { QModelIndex index = q->index(row); q->dataChanged(index, index); } } } void AccountServiceModelPrivate::onAccountServiceEnabled(bool enabled) { Q_Q(AccountServiceModel); Accounts::AccountService *accountService = qobject_cast(sender()); DEBUG() << enabled; int row = modelItems.indexOf(accountService); if (row > 0) { QModelIndex index = q->index(row); q->dataChanged(index, index); } if (!includeDisabled) { /* The item might need to be added or removed from the model */ AccountServices accountServices; accountServices.append(accountService); if (row < 0 && enabled) { addItems(accountServices); } else if (row >= 0 && !enabled) { removeItems(accountServices); } } } /*! * \qmltype AccountServiceModel * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief A model of the user's Online Accounts * * The AccountServiceModel is a model representing the user's Online Accounts * services. * Please note that an Online Account can offer several different services * (chat, e-mail, micro-blogging, etc.); these are the items represented by * this model, and not the user accounts as a whole. * Since most applications are interested on a small subset of the user's * accounts, AccountServiceModel offers some filtering functionalities: it is * possible to restrict it to only one account provider, to a specific service * type (for instance, an e-mail application will probably be interested in * only those accounts which offer an e-mail service), or to a specific service * (e.g., picasa; this is often equivalent to filtering by provider and by * service-type, because it's rare for a provider to offer two different * services of the same type). * By default, only enabled accounts are returned. Use the \l includeDisabled * property to list also disabled accounts; keep in mind, though, that an * application should never use an account which has been disabled by the user. * * The model defines the following roles: * \list * \li \c displayName is the name of the account (usually the user's login) * \li \c providerName is the name of the account provider (e.g., "Google") * \li \c serviceName is the name of the service (e.g., "Picasa") * \li \c enabled * \li \c accountServiceHandle is a handle to the underlying Qt object which * can be used to instantiate an \l AccountService from QML * \li \c accountId is the numeric ID of the account * \li \c accountHandle is a handle to the underlying Qt object which can be * used to instantiate an \l Account from QML * \endlist * * Examples of use: * * 1. Model of all enabled microblogging accounts: * \qml * Item { * AccountServiceModel { * id: accounts * serviceType: "microblogging" * } * * ListView { * model: accounts * delegate: Text { text: model.displayName + " by " + model.providerName } * } * } * \endqml * * 2. List all Facebook account services: * \qml * Item { * AccountServiceModel { * id: accounts * provider: "facebook" * includeDisabled: true * } * * ListView { * model: accounts * delegate: Text { text: model.serviceName + " on " + model.displayName } * } * } * \endqml * * 3. List all Flickr accounts enabled for uploading: * \qml * Item { * AccountServiceModel { * id: accounts * service: "flickr-sharing" * } * * ListView { * model: accounts * delegate: Rectangle { * id: rect * * Text { text: rect.model.displayName } * * AccountService { * id: accountService * objectHandle: rect.model.accountServiceHandle * * onAuthenticated: { console.log("Access token is " + reply.AccessToken) } * onAuthenticationError: { console.log("Authentication failed, code " + error.code) } * } * * MouseArea { * anchors.fill: parent * onClicked: accountService.authenticate() * } * } * } * } * \endqml * * 4. List all the online accounts, without their services: * \qml * Item { * AccountServiceModel { * id: accounts * service: "global" * } * * ListView { * model: accounts * delegate: Rectangle { * id: rect * * Text { text: account.displayName } * * Account { * id: account * objectHandle: rect.model.accountHandle * } * } * } * } * \endqml */ AccountServiceModel::AccountServiceModel(QObject *parent): QAbstractListModel(parent), d_ptr(new AccountServiceModelPrivate(this)) { Q_D(AccountServiceModel); d->roleNames[DisplayNameRole] = "displayName"; d->roleNames[ProviderNameRole] = "providerName"; d->roleNames[ServiceNameRole] = "serviceName"; d->roleNames[EnabledRole] = "enabled"; d->roleNames[AccountServiceHandleRole] = "accountServiceHandle"; d->roleNames[AccountServiceRole] = "accountService"; d->roleNames[AccountIdRole] = "accountId"; d->roleNames[AccountHandleRole] = "accountHandle"; d->roleNames[AccountRole] = "account"; QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &,int,int)), this, SIGNAL(countChanged())); QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &,int,int)), this, SIGNAL(countChanged())); } AccountServiceModel::~AccountServiceModel() { delete d_ptr; } void AccountServiceModel::classBegin() { } void AccountServiceModel::componentComplete() { Q_D(AccountServiceModel); d->componentCompleted = true; d->update(); } /*! * \qmlproperty quint32 AccountServiceModel::accountId * If set, the model will list only those accounts services available in the * given account. */ void AccountServiceModel::setAccountId(quint32 accountId) { Q_D(AccountServiceModel); if (accountId == d->accountId) return; d->accountId = accountId; d->accountIdChanged = true; d->queueUpdate(); Q_EMIT accountIdChanged(); } quint32 AccountServiceModel::accountId() const { Q_D(const AccountServiceModel); return d->accountId; } /*! * \qmlproperty Account AccountServiceModel::account * If set, the model will list only those accounts services available in the * given account. */ void AccountServiceModel::setAccount(QObject *object) { Q_D(AccountServiceModel); Accounts::Account *account = qobject_cast(object); if (account == d->account) return; d->account = account; d->accountChanged = true; d->queueUpdate(); Q_EMIT accountChanged(); } QObject *AccountServiceModel::account() const { Q_D(const AccountServiceModel); return d->account; } /*! * \qmlproperty string AccountServiceModel::applicationId * If set, the model will only show those account services which are relevant * for the given \a applicationId. This means that an account service will only * be shown if it can be used by the application, as described in the * application's manifest file. */ void AccountServiceModel::setApplicationId(const QString &applicationId) { Q_D(AccountServiceModel); if (applicationId == d->application.name()) return; if (applicationId.isEmpty()) { d->application = Accounts::Application(); } else { d->application = SharedManager::instance()->application(applicationId); } d->applicationIdChanged = true; d->queueUpdate(); Q_EMIT applicationIdChanged(); } QString AccountServiceModel::applicationId() const { Q_D(const AccountServiceModel); return d->application.name(); } /*! * \qmlproperty string AccountServiceModel::provider * If set, the model will list only those accounts services provided by this provider. */ void AccountServiceModel::setProvider(const QString &providerId) { Q_D(AccountServiceModel); if (providerId == d->providerId) return; d->providerId = providerId; d->providerChanged = true; d->queueUpdate(); Q_EMIT providerChanged(); } QString AccountServiceModel::provider() const { Q_D(const AccountServiceModel); return d->providerId; } /*! * \qmlproperty string AccountServiceModel::serviceType * If set, the model will list only those accounts services supporting this * service type. Each provider-specific service is an instance of a generic * service type (such as "e-mail", "IM", etc.) which identifies the main * functionality provided by the service. */ void AccountServiceModel::setServiceType(const QString &serviceTypeId) { Q_D(AccountServiceModel); if (serviceTypeId == d->serviceTypeId) return; d->serviceTypeId = serviceTypeId; d->serviceTypeChanged = true; d->queueUpdate(); Q_EMIT serviceTypeChanged(); } QString AccountServiceModel::serviceType() const { Q_D(const AccountServiceModel); return d->serviceTypeId; } /*! * \qmlproperty string AccountServiceModel::service * If set, the model will list only those accounts services for this * specific service. */ void AccountServiceModel::setService(const QString &serviceId) { Q_D(AccountServiceModel); if (serviceId == d->serviceId) return; d->serviceId = serviceId; d->serviceChanged = true; d->queueUpdate(); Q_EMIT serviceChanged(); } QString AccountServiceModel::service() const { Q_D(const AccountServiceModel); return d->serviceId; } /*! * \qmlproperty bool AccountServiceModel::includeDisabled * If true, even disabled account services will be listed. Note that an * application should never use a disabled account. * * By default, this property is false. */ void AccountServiceModel::setIncludeDisabled(bool includeDisabled) { Q_D(AccountServiceModel); if (includeDisabled == d->includeDisabled) return; d->includeDisabled = includeDisabled; d->queueUpdate(); Q_EMIT includeDisabledChanged(); } bool AccountServiceModel::includeDisabled() const { Q_D(const AccountServiceModel); return d->includeDisabled; } /*! * \qmlmethod variant AccountServiceModel::get(int row, string roleName) * * Returns the data at \a row for the role \a roleName. */ QVariant AccountServiceModel::get(int row, const QString &roleName) const { int role = roleNames().key(roleName.toLatin1(), -1); return data(index(row), role); } int AccountServiceModel::rowCount(const QModelIndex &parent) const { Q_D(const AccountServiceModel); Q_UNUSED(parent); return d->modelItems.count(); } QVariant AccountServiceModel::data(const QModelIndex &index, int role) const { Q_D(const AccountServiceModel); if (index.row() >= d->modelItems.count()) return QVariant(); Accounts::AccountService *accountService = d->modelItems.at(index.row()); QVariant ret; QObject *object = 0; switch (role) { case Qt::DisplayRole: ret = QString("%1 - %2"). arg(accountService->account()->displayName()). arg(accountService->service().displayName()); break; case DisplayNameRole: ret = accountService->account()->displayName(); break; case ProviderNameRole: { Accounts::Provider provider = accountService->account()->provider(); ret = provider.displayName(); } break; case ServiceNameRole: ret = accountService->service().displayName(); break; case EnabledRole: ret = accountService->enabled(); break; case AccountServiceRole: qWarning("accountService role is deprecated, use accountServiceHandle"); case AccountServiceHandleRole: object = accountService; break; case AccountIdRole: ret = accountService->account()->id(); break; case AccountRole: qWarning("account role is deprecated, use accountHandle"); case AccountHandleRole: object = accountService->account(); break; } if (object) { QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership); ret = QVariant::fromValue(object); } return ret; } QHash AccountServiceModel::roleNames() const { Q_D(const AccountServiceModel); return d->roleNames; } #include "account-service-model.moc" accounts-qml-module-0.6+16.04.20151106/src/debug.h0000644000015300001610000000254112617074455021644 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013-2015 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_DEBUG_H #define ONLINE_ACCOUNTS_DEBUG_H #include #ifdef DEBUG_ENABLED extern int accounts_qml_module_logging_level; static inline bool debugEnabled() { return accounts_qml_module_logging_level >= 2; } static inline bool criticalsEnabled() { return accounts_qml_module_logging_level >= 1; } #define DEBUG() \ if (debugEnabled()) qDebug() #define BLAME() \ if (criticalsEnabled()) qCritical() #else // DEBUG_ENABLED #define DEBUG() while (0) qDebug() #define WARNING() while (0) qDebug() #endif namespace OnlineAccounts { void setLoggingLevel(int level); } #endif // ONLINE_ACCOUNTS_DEBUG_H accounts-qml-module-0.6+16.04.20151106/src/credentials.cpp0000644000015300001610000001716412617074451023411 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "credentials.h" #include "debug.h" using namespace OnlineAccounts; /*! * \qmltype Credentials * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief Holds the account's credentials * * The Credentials element contains the information about an account's * credentials. Informations like user name and password are stored into the * account's secret storage via this object. * If the \l credentialsId property is set to a valid credentials ID (which can * be obtained via the AccountService's \l * {AccountService::authData}{authData.credentialsId} property) the Credentials * element will load the informations stored in the secrets database, with the * notable exception of the \l secret field, which cannot be read back via this * interface (but only via the \l AccountService::authenticate method); if the * \l credentialsId field is not set, then this interface can be used to create * a new record in the secrets storage, by calling the \l sync() method once * all the desired fields have been set. */ Credentials::Credentials(QObject *parent): QObject(parent), m_credentialsId(0), identity(0) { } Credentials::~Credentials() { } /*! * \qmlproperty quint32 Credentials::credentialsId * Numeric identifier of the credentials record in the secret storage database. * A value of \a 0 means that this object has not been stored into the database * yet. * \sa sync */ void Credentials::setCredentialsId(quint32 credentialsId) { if (credentialsId == m_credentialsId) return; delete identity; if (credentialsId != 0) { identity = SignOn::Identity::existingIdentity(credentialsId, this); if (identity != 0) { setupIdentity(); identity->queryInfo(); } } else { identity = 0; /* We'll instantiate it if/when needed */ } m_credentialsId = credentialsId; Q_EMIT credentialsIdChanged(); } quint32 Credentials::credentialsId() const { return m_credentialsId; } /*! * \qmlproperty string Credentials::caption * A description of the credentials. This could be set to the name of the * account provider, for instance. */ void Credentials::setCaption(const QString &caption) { if (caption == info.caption()) return; info.setCaption(caption); Q_EMIT captionChanged(); } QString Credentials::caption() const { return info.caption(); } /*! * \qmlproperty string Credentials::userName * The user name. */ void Credentials::setUserName(const QString &userName) { if (userName == info.userName()) return; info.setUserName(userName); Q_EMIT userNameChanged(); } QString Credentials::userName() const { return info.userName(); } /*! * \qmlproperty string Credentials::secret * The secret information for this credentials; usually this is the user's password. * Note that when retrieving a Credentials object from the secrets database, * this field will not be retrieved. See the detailed description of the * Credentials element for a full explanation of this. * * \sa credentialsId */ void Credentials::setSecret(const QString &secret) { info.setSecret(secret); Q_EMIT secretChanged(); } QString Credentials::secret() const { return info.secret(); } /*! * \qmlproperty bool Credentials::storeSecret * Whether the secret should be stored in the secrets storage. */ void Credentials::setStoreSecret(bool storeSecret) { if (storeSecret == info.isStoringSecret()) return; info.setStoreSecret(storeSecret); Q_EMIT storeSecretChanged(); } bool Credentials::storeSecret() const { return info.isStoringSecret(); } /*! * \qmlproperty list Credentials::acl * The ACL (Access Control List) for the credentials. The string \a "*" should * be used when no access control needs to be performed. */ void Credentials::setAcl(const QStringList &acl) { info.setAccessControlList(acl); Q_EMIT aclChanged(); } QStringList Credentials::acl() const { return info.accessControlList(); } /*! * \qmlproperty jsobject Credentials::methods * A dictionary describing the authentication methods and mechanisms which are * allowed on the credentials. The keys of the dictionary should be the * authentication methods, and the values should be lists of mechanisms. * \qml * Credentials { * methods: { "oauth2": [ "web_server", "user_agent"], "password": [ "password" ] } * } * \endqml */ void Credentials::setMethods(const QVariantMap &methods) { /* To keep things simple, always delete all existing methods, and then add * the new ones. */ Q_FOREACH (const QString &method, info.methods()) { info.removeMethod(method); } QMapIterator it(methods); while (it.hasNext()) { it.next(); info.setMethod(it.key(), it.value().toStringList()); } } QVariantMap Credentials::methods() const { QVariantMap methods; Q_FOREACH (const QString &method, info.methods()) { QStringList mechanisms = info.mechanisms(method); methods.insert(method, mechanisms); } return methods; } /*! * \qmlmethod void Credentials::sync() * * Writes the changes to the secrets storage. * * \sa synced */ void Credentials::sync() { ensureIdentity(); identity->storeCredentials(info); } /*! * \qmlmethod void Credentials::remove() * * Deletes the credentials from the secrets storage. * * \sa removed */ void Credentials::remove() { /* If we don't have an identity object, this means that this object was * never stored; we have nothing to do in this case. */ if (Q_UNLIKELY(identity == 0)) return; identity->remove(); } /*! * \qmlsignal Credentials::synced() * * Emitted when the changes have been stored into the permanent secrets storage. */ /*! * \qmlsignal Credentials::removed() * * Emitted when the credentials have been deleted from the secrets storage. */ void Credentials::ensureIdentity() { if (identity == 0) { identity = SignOn::Identity::newIdentity(info, this); setupIdentity(); } } void Credentials::setupIdentity() { QObject::connect(identity, SIGNAL(info(const SignOn::IdentityInfo&)), this, SLOT(onInfo(const SignOn::IdentityInfo&))); QObject::connect(identity, SIGNAL(credentialsStored(const quint32)), this, SLOT(onStored(const quint32))); QObject::connect(identity, SIGNAL(removed()), this, SIGNAL(removed())); } void Credentials::onInfo(const SignOn::IdentityInfo &info) { this->info = info; /* Emit the notification signals for all the properties; if this turns out * to be an issue, we could just emit the signals for those properties * whose value actually changed. */ Q_EMIT credentialsIdChanged(); Q_EMIT captionChanged(); Q_EMIT userNameChanged(); Q_EMIT secretChanged(); Q_EMIT storeSecretChanged(); Q_EMIT aclChanged(); Q_EMIT methodsChanged(); Q_EMIT synced(); } void Credentials::onStored(const quint32 id) { m_credentialsId = id; identity->queryInfo(); } accounts-qml-module-0.6+16.04.20151106/src/provider-model.h0000644000015300001610000000432712617074451023506 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_PROVIDER_MODEL_H #define ONLINE_ACCOUNTS_PROVIDER_MODEL_H #include "manager.h" #include #include #include namespace Accounts { class Provider; }; namespace OnlineAccounts { class ProviderModel: public QAbstractListModel, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QString applicationId READ applicationId \ WRITE setApplicationId NOTIFY applicationIdChanged) Q_PROPERTY(int count READ rowCount NOTIFY countChanged) public: ProviderModel(QObject *parent = 0); ~ProviderModel(); enum Roles { ProviderIdRole = Qt::UserRole + 1, IconNameRole, IsSingleAccountRole, TranslationsRole, }; void setApplicationId(const QString &applicationId); QString applicationId() const; Q_INVOKABLE QVariant get(int row, const QString &roleName) const; // reimplemented virtual methods int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QHash roleNames() const; void classBegin(); void componentComplete(); Q_SIGNALS: void applicationIdChanged(); void countChanged(); private: void update(); private: QSharedPointer manager; QList providers; QString m_applicationId; bool m_componentCompleted; }; }; // namespace #endif // ONLINE_ACCOUNTS_PROVIDER_MODEL_H accounts-qml-module-0.6+16.04.20151106/src/manager.cpp0000644000015300001610000000423012617074451022514 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "manager.h" #include "debug.h" #include #include using namespace OnlineAccounts; static QWeakPointer sharedManager; QSharedPointer SharedManager::instance() { QSharedPointer manager = sharedManager.toStrongRef(); if (manager.isNull()) { manager = QSharedPointer(new Accounts::Manager); sharedManager = manager; } return manager; } /*! * \qmltype Manager * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief The account manager * * The Manager element is a singleton class which can be used to create new * online accounts or load existing ones. */ Manager::Manager(QObject *parent): QObject(parent), manager(SharedManager::instance()) { } Manager::~Manager() { } /*! * \qmlmethod object Manager::loadAccount(uint accountId) * * Loads the account identified by \a accountId. The returned object can be * used to instantiate an \l Account. * * \sa createAccount() */ QObject *Manager::loadAccount(uint accountId) { DEBUG() << accountId; return manager->account(accountId); } /*! * \qmlmethod object Manager::createAccount(string providerName) * * Create a new account interfacing to the provider identified by \a * providerName. * * \sa loadAccount() */ QObject *Manager::createAccount(const QString &providerName) { return manager->createAccount(providerName); } accounts-qml-module-0.6+16.04.20151106/src/src.pro0000644000015300001610000000352112617074455021715 0ustar pbuserpbgroup00000000000000include(../common-project-config.pri) TEMPLATE = lib TARGET = Accounts API_URI = "Ubuntu.OnlineAccounts" DESTDIR = $$replace(API_URI, \\., /) CONFIG += \ link_pkgconfig \ plugin \ qt QT += qml # Error on undefined symbols QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF PKGCONFIG += \ accounts-qt5 \ libsignon-qt5 CONFIG(debug) { DEFINES += \ DEBUG_ENABLED } SOURCES += \ account-service-model.cpp \ account-service.cpp \ account.cpp \ application-model.cpp \ application.cpp \ credentials.cpp \ debug.cpp \ manager.cpp \ plugin.cpp \ provider-model.cpp HEADERS += \ account-service-model.h \ account-service.h \ account.h \ application-model.h \ application.h \ credentials.h \ debug.h \ manager.h \ plugin.h \ provider-model.h DEFINES += API_URI=\\\"$${API_URI}\\\" qmldir_gen.input = qmldir.in qmldir_gen.output = $${DESTDIR}/qmldir QMAKE_SUBSTITUTES += qmldir_gen OTHER_FILES += qmldir.in PLUGIN_INSTALL_BASE = $$[QT_INSTALL_QML]/$$replace(API_URI, \\., /) target.path = $${PLUGIN_INSTALL_BASE} INSTALLS += target qmldir.files = $${DESTDIR}/qmldir qmldir.path = $${PLUGIN_INSTALL_BASE} INSTALLS += qmldir generateQmlTypes.output = $${DESTDIR}/plugin.qmltypes generateQmlTypes.input = QML_PLUGINS generateQmlTypes.commands = export LD_PRELOAD=${QMAKE_FILE_IN}; $$[QT_INSTALL_BINS]/qmlplugindump -notrelocatable $${API_URI} 0.1 . > ${QMAKE_FILE_OUT} generateQmlTypes.name = Generate ${QMAKE_FILE_OUT} generateQmlTypes.CONFIG += no_link generateQmlTypes.variable_out = QML_TYPES QMAKE_EXTRA_COMPILERS += generateQmlTypes QML_PLUGINS += $${DESTDIR}/lib$${TARGET}.so qmltypes.path = $${PLUGIN_INSTALL_BASE} qmltypes.files = $${DESTDIR}/plugin.qmltypes qmltypes.depends = $${DESTDIR}/plugin.qmltypes qmltypes.CONFIG += no_check_exist INSTALLS += qmltypes accounts-qml-module-0.6+16.04.20151106/src/credentials.h0000644000015300001610000000554512617074451023056 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_CREDENTIALS_H #define ONLINE_ACCOUNTS_CREDENTIALS_H #include #include #include #include #include namespace OnlineAccounts { class Credentials: public QObject { Q_OBJECT Q_PROPERTY(quint32 credentialsId READ credentialsId WRITE setCredentialsId \ NOTIFY credentialsIdChanged) Q_PROPERTY(QString caption READ caption WRITE setCaption \ NOTIFY captionChanged) Q_PROPERTY(QString userName READ userName WRITE setUserName \ NOTIFY userNameChanged) Q_PROPERTY(QString secret READ secret WRITE setSecret NOTIFY secretChanged) Q_PROPERTY(bool storeSecret READ storeSecret WRITE setStoreSecret \ NOTIFY storeSecretChanged) Q_PROPERTY(QStringList acl READ acl WRITE setAcl NOTIFY aclChanged) Q_PROPERTY(QVariantMap methods READ methods WRITE setMethods NOTIFY methodsChanged) public: Credentials(QObject *parent = 0); ~Credentials(); void setCredentialsId(quint32 credentialsId); quint32 credentialsId() const; void setCaption(const QString &caption); QString caption() const; void setUserName(const QString &userName); QString userName() const; void setSecret(const QString &secret); QString secret() const; void setStoreSecret(bool storeSecret); bool storeSecret() const; void setAcl(const QStringList &acl); QStringList acl() const; void setMethods(const QVariantMap &methods); QVariantMap methods() const; Q_INVOKABLE void sync(); Q_INVOKABLE void remove(); Q_SIGNALS: void credentialsIdChanged(); void captionChanged(); void userNameChanged(); void secretChanged(); void storeSecretChanged(); void aclChanged(); void methodsChanged(); void synced(); void removed(); private: void ensureIdentity(); void setupIdentity(); private Q_SLOTS: void onInfo(const SignOn::IdentityInfo &info); void onStored(const quint32 id); private: quint32 m_credentialsId; SignOn::Identity *identity; SignOn::IdentityInfo info; }; }; // namespace #endif // ONLINE_ACCOUNTS_CREDENTIALS_H accounts-qml-module-0.6+16.04.20151106/src/accounts.qdoc0000644000015300001610000000133112617074451023064 0ustar pbuserpbgroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ /*! \qmlmodule Ubuntu.OnlineAccounts 0.1 \title Ubuntu OnlineAccounts */ accounts-qml-module-0.6+16.04.20151106/src/account.h0000644000015300001610000000537712617074451022220 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_ACCOUNT_H #define ONLINE_ACCOUNTS_ACCOUNT_H #include #include #include #include namespace Accounts { class Account; class AccountService; }; namespace SignOn { class Identity; }; namespace OnlineAccounts { class Account: public QObject { Q_OBJECT Q_PROPERTY(QObject *objectHandle READ objectHandle \ WRITE setObjectHandle NOTIFY objectHandleChanged) Q_PROPERTY(bool enabled READ enabled NOTIFY enabledChanged) Q_PROPERTY(QVariantMap provider READ provider NOTIFY objectHandleChanged) Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged) Q_PROPERTY(uint accountId READ accountId NOTIFY accountIdChanged) Q_PROPERTY(QObject *accountServiceHandle READ accountServiceHandle \ NOTIFY objectHandleChanged) public: enum RemovalOption { RemoveAccountOnly = 0x0, RemoveCredentials = 0x1, }; Q_DECLARE_FLAGS(RemovalOptions, RemovalOption) Q_FLAGS(RemovalOption RemovalOptions) Account(QObject *parent = 0); ~Account(); void setObjectHandle(QObject *object); QObject *objectHandle() const; bool enabled() const; QVariantMap provider() const; QString displayName() const; uint accountId() const; QObject *accountServiceHandle() const; Q_INVOKABLE void updateDisplayName(const QString &displayName); Q_INVOKABLE void updateEnabled(bool enabled); Q_INVOKABLE void sync(); Q_INVOKABLE void remove(RemovalOptions options = RemoveCredentials); Q_SIGNALS: void objectHandleChanged(); void accountIdChanged(); void enabledChanged(); void displayNameChanged(); void synced(); void removed(); private Q_SLOTS: void onRemoved(); void onIdentityRemoved(); private: QPointer account; QPointer accountService; QList identities; }; }; // namespace Q_DECLARE_OPERATORS_FOR_FLAGS(OnlineAccounts::Account::RemovalOptions) #endif // ONLINE_ACCOUNTS_ACCOUNT_H accounts-qml-module-0.6+16.04.20151106/src/account-service.cpp0000644000015300001610000004020012617074451024171 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "account-service.h" #include "credentials.h" #include "debug.h" #include #include #include #include #include using namespace OnlineAccounts; static QVariantMap mergeMaps(const QVariantMap &map1, const QVariantMap &map2) { if (map1.isEmpty()) return map2; if (map2.isEmpty()) return map1; QVariantMap map = map1; //map2 values will overwrite map1 values for the same keys. QMapIterator it(map2); while (it.hasNext()) { it.next(); map.insert(it.key(), it.value()); } return map; } AccountService::ErrorCode errorCodeFromSignOn(int type) { if (type <= 0) return AccountService::NoError; switch (type) { case SignOn::Error::SessionCanceled: case SignOn::Error::TOSNotAccepted: return AccountService::UserCanceledError; case SignOn::Error::PermissionDenied: case SignOn::Error::InvalidCredentials: case SignOn::Error::NotAuthorized: case SignOn::Error::MethodOrMechanismNotAllowed: return AccountService::PermissionDeniedError; case SignOn::Error::NoConnection: case SignOn::Error::Network: return AccountService::NetworkError; case SignOn::Error::Ssl: return AccountService::SslError; case SignOn::Error::UserInteraction: return AccountService::InteractionRequiredError; default: return AccountService::NoAccountError; } } void AccountService::syncIfDesired() { if (m_autoSync) { Accounts::Account *account = accountService->account(); if (Q_UNLIKELY(account == 0)) return; /* If needed, we could optimize this to call account->sync() when * re-entering the main loop, in order to reduce the number or writes. * But this would be better done in the Account class itself (and even * better, in libaccounts-glib). */ account->sync(); } } /*! * \qmltype AccountService * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief Represents an instance of a service in an Online Accounts * * The AccountService element represents a service within an existing online account. * It can be used to obtain an authentication token to use the service it refers to. * * Currently, an AccountService is valid only if its \a objectHandle property * is set to a value obtained from an AccountServiceModel or an Account. * * See AccountServiceModel's documentation for usage examples. */ AccountService::AccountService(QObject *parent): QObject(parent), accountService(0), identity(0), m_credentials(0), constructed(false), m_autoSync(true) { } AccountService::~AccountService() { } /*! * \qmlproperty object AccountService::objectHandle * An opaque handle to the underlying C++ object. Until the property is set, * the AccountService element is uninitialized. Similarly, if the C++ object is * destroyed (for instance, because the AccountServiceModel which owns it is * destroyed or if the account is deleted), expect the AccountService to become * invalid. */ void AccountService::setObjectHandle(QObject *object) { DEBUG() << object; Accounts::AccountService *as = qobject_cast(object); if (Q_UNLIKELY(as == 0)) return; if (as == accountService) return; accountService = as; QObject::connect(accountService, SIGNAL(changed()), this, SIGNAL(settingsChanged())); QObject::connect(accountService, SIGNAL(enabled(bool)), this, SIGNAL(enabledChanged())); delete identity; identity = 0; Q_EMIT objectHandleChanged(); /* Emit the changed signals for all other properties, to make sure * that all bindings are updated. */ Q_EMIT enabledChanged(); Q_EMIT displayNameChanged(); Q_EMIT settingsChanged(); } QObject *AccountService::objectHandle() const { return accountService; } /*! * \qmlproperty bool AccountService::enabled * This read-only property tells whether the AccountService is enabled. An * application shouldn't use an AccountService which is disabled. */ bool AccountService::enabled() const { if (Q_UNLIKELY(accountService == 0)) return false; return accountService->enabled(); } /*! * \qmlproperty bool AccountService::serviceEnabled * This read-only property tells whether the service is enabled within the * account. This property differs from the \l enabled property in that the * \l enabled property also considers whether the account is enabled, while * this one only reflects the status of the service. Applications shouldn't * rely on the value on this property to decide whether to use the account or * not. * * \sa enabled */ bool AccountService::serviceEnabled() const { if (Q_UNLIKELY(accountService == 0)) return false; return accountService->value("enabled").toBool(); } /*! * \qmlproperty jsobject AccountService::provider * An immutable object representing the provider which provides the account. * The returned object will have at least these members: * \list * \li \c id is the unique identifier for this provider * \li \c displayName * \li \c iconName * \li \c isSingleAccount, \a true if this provider supports creating one * account at most * \li \c translations, the localization domain for translating the provider's * display name * \endlist */ QVariantMap AccountService::provider() const { QVariantMap map; if (Q_UNLIKELY(accountService == 0)) return map; Accounts::Account *account = accountService->account(); if (account == 0) return map; Accounts::Provider provider = account->provider(); map.insert("id", provider.name()); map.insert("displayName", provider.displayName()); map.insert("iconName", provider.iconName()); map.insert("isSingleAccount", provider.isSingleAccount()); map.insert("translations", provider.trCatalog()); return map; } /*! * \qmlproperty jsobject AccountService::service * An immutable object representing the service which this AccountService * instantiates. * The returned object will have at least these members: * \list * \li \c id is the unique identified for this service * \li \c displayName * \li \c iconName * \li \c serviceTypeId identifies the provided service type * \li \c translations, the localization domain for translating the provider's * display name * \endlist */ QVariantMap AccountService::service() const { QVariantMap map; if (Q_UNLIKELY(accountService == 0)) return map; Accounts::Service service = accountService->service(); map.insert("id", service.name()); map.insert("displayName", service.displayName()); map.insert("iconName", service.iconName()); map.insert("serviceTypeId", service.serviceType()); map.insert("translations", service.trCatalog()); return map; } /*! * \qmlproperty string AccountService::displayName * The account's display name (usually the user's login or ID); note that all * AccountService objects which work on the same online account will share the * same display name. */ QString AccountService::displayName() const { if (Q_UNLIKELY(accountService == 0)) return QString(); return accountService->account()->displayName(); } /*! * \qmlproperty string AccountService::accountId * The account's numeric ID; note that all AccountService objects which work on * the same online account will have the same ID. */ uint AccountService::accountId() const { if (Q_UNLIKELY(accountService == 0)) return 0; return accountService->account()->id(); } /*! * \qmlproperty jsobject AccountService::settings * A dictionary of all the account service's settings. This does not * include the authentication settings, which are available from the * AccountService::authData property. */ QVariantMap AccountService::settings() const { QVariantMap map; if (Q_UNLIKELY(accountService == 0)) return map; foreach (const QString &key, accountService->allKeys()) { if (key.startsWith("auth") || key == "enabled") continue; map.insert(key, accountService->value(key)); } return map; } /*! * \qmlproperty jsobject AccountService::authData * An object providing information about the authentication. * The returned object will have at least these members: * \list * \li \c method is the authentication method * \li \c mechanism is the authentication mechanism (a sub-specification of the * method) * \li \c parameters is a dictionary of authentication parameters * \li \c credentialsId is the numeric identified of the credentials in the * secrets storage. See the \l Credentials element for more info. * \endlist */ QVariantMap AccountService::authData() const { QVariantMap map; if (Q_UNLIKELY(accountService == 0)) return map; Accounts::AuthData data = accountService->authData(); map.insert("method", data.method()); map.insert("mechanism", data.mechanism()); map.insert("credentialsId", data.credentialsId()); map.insert("parameters", data.parameters()); return map; } /*! * \qmlproperty bool AccountService::autoSync * This property tells whether the AccountService should invoke the * Account::sync() method whenever updateSettings(), updateDisplayName() or * updateServiceEnabled() are called. * By default, this property is true. */ void AccountService::setAutoSync(bool autoSync) { if (autoSync == m_autoSync) return; m_autoSync = autoSync; Q_EMIT autoSyncChanged(); } bool AccountService::autoSync() const { return m_autoSync; } /*! * \qmlproperty Credentials AccountService::credentials * The credentials used by this account service. This property is meant to be * used only when creating or editing the account, and serves to bind a * credentials record to the account: when the value of the \l * Credentials::credentialsId changes, an update of \l * {authData}{authData.credentialsId} will be queued (and immediately executed * if \l autoSync is \c true). * By default, reading this property returns a null object. */ void AccountService::setCredentials(QObject *credentials) { if (credentials == m_credentials) return; m_credentials = credentials; if (m_credentials != 0) { credentialsIdProperty = QQmlProperty(m_credentials, "credentialsId"); credentialsIdProperty.connectNotifySignal(this, SLOT(onCredentialsIdChanged())); onCredentialsIdChanged(); } else { credentialsIdProperty = QQmlProperty(); } Q_EMIT credentialsChanged(); } QObject *AccountService::credentials() const { return m_credentials; } /*! * \qmlmethod void AccountService::updateServiceEnabled(bool enabled) * * Enables or disables the service within the account configuration. * Since the \l enabled property is the combination of the global account's * enabledness status and the specific service's status, its value might not * change after this method is called. * * \sa enabled, serviceEnabled, autoSync */ void AccountService::updateServiceEnabled(bool enabled) { if (Q_UNLIKELY(accountService == 0)) return; Accounts::Account *account = accountService->account(); if (Q_UNLIKELY(account == 0)) return; account->selectService(accountService->service()); account->setEnabled(enabled); syncIfDesired(); } /*! * \qmlmethod void AccountService::updateSettings(jsobject settings) * * Change some settings. Only the settings which are present in the \a settings * dictionary will be changed; all others settings will not be affected. * To remove a settings, set its value to null. * * \sa autoSync */ void AccountService::updateSettings(const QVariantMap &settings) { if (Q_UNLIKELY(accountService == 0)) return; QMapIterator it(settings); while (it.hasNext()) { it.next(); if (it.value().isNull()) { accountService->remove(it.key()); } else { accountService->setValue(it.key(), it.value()); } } syncIfDesired(); } /*! * \qmlmethod void AccountService::authenticate(jsobject sessionData) * * Perform the authentication on this account. The \a sessionData dictionary is * optional and if not given the value of \l {authData}{authData::parameters} will be used. * * Each call to this method will cause either of \l authenticated or * \l authenticationError signals to be emitted at some time later. Note that * the authentication might involve interactions with the network or with the * end-user, so don't expect these signals to be emitted immediately. * * \sa authenticated, authenticationError */ void AccountService::authenticate(const QVariantMap &sessionData) { DEBUG() << sessionData; if (Q_UNLIKELY(accountService == 0)) { QVariantMap error; error.insert("code", NoAccountError); error.insert("message", QLatin1String("Invalid AccountService")); Q_EMIT authenticationError(error); return; } Accounts::AuthData authData = accountService->authData(); if (identity == 0) { quint32 credentialsId = credentialsIdProperty.read().toUInt(); if (credentialsId == 0) credentialsId = authData.credentialsId(); identity = SignOn::Identity::existingIdentity(credentialsId, this); } if (authSession == 0) { authSession = identity->createSession(authData.method()); QObject::connect(authSession, SIGNAL(response(const SignOn::SessionData&)), this, SLOT(onAuthSessionResponse(const SignOn::SessionData&))); QObject::connect(authSession, SIGNAL(error(const SignOn::Error&)), this, SLOT(onAuthSessionError(const SignOn::Error&))); } QVariantMap allSessionData = mergeMaps(authData.parameters(), sessionData); authSession->process(allSessionData, authData.mechanism()); } /*! * \qmlmethod void AccountService::cancelAuthentication() * * Cancel an ongoing authentication on this account. This method does nothing * if there isn't any authentication process going on. * * \sa authenticate */ void AccountService::cancelAuthentication() { DEBUG(); if (authSession != 0) { authSession->cancel(); } } /*! * \qmlsignal AccountService::authenticated(jsobject reply) * * Emitted when the authentication has been successfully completed. The \a * reply object will contain the authentication data, which depends on the * authentication method used. */ /*! * \qmlsignal AccountService::authenticationError(jsobject error) * * Emitted when the authentication fails. The \a error object will contain the * following fields: * \list * \li \c code is a numeric error code (see Signon::Error for the meaning) * \li \c message is a textual description of the error, not meant for the end-user * \endlist */ void AccountService::classBegin() { } void AccountService::componentComplete() { constructed = true; } void AccountService::onAuthSessionResponse(const SignOn::SessionData &sessionData) { Q_EMIT authenticated(sessionData.toMap()); } void AccountService::onAuthSessionError(const SignOn::Error &error) { QVariantMap e; e.insert("code", errorCodeFromSignOn(error.type())); e.insert("message", error.message()); Q_EMIT authenticationError(e); } void AccountService::onCredentialsIdChanged() { if (accountService) { QVariant value = credentialsIdProperty.read(); accountService->setValue("CredentialsId", value); syncIfDesired(); } } accounts-qml-module-0.6+16.04.20151106/src/application.h0000644000015300001610000000244512617074451023060 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef ONLINE_ACCOUNTS_APPLICATION_H #define ONLINE_ACCOUNTS_APPLICATION_H #include #include namespace OnlineAccounts { class Application: public QObject, public Accounts::Application { Q_OBJECT Q_PROPERTY(QString applicationId READ name CONSTANT) Q_PROPERTY(QString description READ description CONSTANT) public: Application(const Accounts::Application &application, QObject *parent = 0); ~Application(); Q_INVOKABLE QString serviceUsage(const Accounts::Service &service); }; }; // namespace #endif // ONLINE_ACCOUNTS_APPLICATION_H accounts-qml-module-0.6+16.04.20151106/src/provider-model.cpp0000644000015300001610000001251012617074451024032 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2013 Canonical Ltd. * * Contact: Alberto Mardegan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "debug.h" #include "provider-model.h" #include #include #include #include using namespace OnlineAccounts; /*! * \qmltype ProviderModel * \inqmlmodule Ubuntu.OnlineAccounts 0.1 * \ingroup Ubuntu * * \brief A model of the account providers * * The ProviderModel is a model representing the account providers installed on * the system. * * The model defines the following roles: * \list * \li \c displayName, the user-visible name of this provider * \li \c providerId, the unique identifier of the account provider * \li \c iconName, the name of the icon representing this provider * \li \c isSingleAccount, \a true if this provider supports creating one * account at most * \li \c translations, the localization domain for translating the provider's * display name * \endlist */ ProviderModel::ProviderModel(QObject *parent): QAbstractListModel(parent), manager(SharedManager::instance()), m_componentCompleted(false) { QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged())); } ProviderModel::~ProviderModel() { } /*! * \qmlproperty string ProviderModel::applicationId * If set, the model will only show those providers which are relevant for the * given \a applicationId. This means that a provider will only be shown if at * least one of its services can be used by the application, as described in * the application's manifest file. */ void ProviderModel::setApplicationId(const QString &applicationId) { if (m_applicationId == applicationId) return; m_applicationId = applicationId; if (m_componentCompleted) update(); Q_EMIT applicationIdChanged(); } QString ProviderModel::applicationId() const { return m_applicationId; } /*! * \qmlproperty int ProviderModel::count * The number of items in the model. */ int ProviderModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); return providers.count(); } /*! * \qmlmethod variant ProviderModel::get(int row, string roleName) * * Returns the data at \a row for the role \a roleName. */ QVariant ProviderModel::get(int row, const QString &roleName) const { int role = roleNames().key(roleName.toLatin1(), -1); return data(index(row), role); } QVariant ProviderModel::data(const QModelIndex &index, int role) const { if (index.row() < 0 || index.row() >= providers.count()) return QVariant(); const Accounts::Provider &provider = providers.at(index.row()); QVariant ret; switch (role) { case Qt::DisplayRole: ret = provider.displayName(); break; case ProviderIdRole: ret = provider.name(); break; case IconNameRole: ret = provider.iconName(); break; case IsSingleAccountRole: ret = provider.isSingleAccount(); break; case TranslationsRole: ret = provider.trCatalog(); break; } return ret; } QHash ProviderModel::roleNames() const { static QHash roles; if (roles.isEmpty()) { roles[Qt::DisplayRole] = "displayName"; roles[ProviderIdRole] = "providerId"; roles[IconNameRole] = "iconName"; roles[IsSingleAccountRole] = "isSingleAccount"; roles[TranslationsRole] = "translations"; } return roles; } void ProviderModel::classBegin() { } void ProviderModel::componentComplete() { update(); m_componentCompleted = true; } void ProviderModel::update() { beginResetModel(); Accounts::ProviderList allProviders = manager->providerList(); if (m_applicationId.isEmpty()) { providers = allProviders; } else { providers.clear(); /* This will be slightly simpler once * http://code.google.com/p/accounts-sso/issues/detail?id=214 is fixed. */ Accounts::Application application = manager->application(m_applicationId); Accounts::ServiceList supportedServices; Q_FOREACH(const Accounts::Service &service, manager->serviceList()) { if (!application.serviceUsage(service).isEmpty()) { supportedServices.append(service); } } Q_FOREACH(const Accounts::Provider &provider, allProviders) { bool hasSupportedServices = false; Q_FOREACH(const Accounts::Service &service, supportedServices) { if (service.provider() == provider.name()) { hasSupportedServices = true; break; } } if (hasSupportedServices) { providers.append(provider); } } } endResetModel(); } accounts-qml-module-0.6+16.04.20151106/common-project-config.pri0000644000015300001610000000065412617074451024530 0ustar pbuserpbgroup00000000000000#----------------------------------------------------------------------------- # Common configuration for all projects. #----------------------------------------------------------------------------- # we don't like warnings... QMAKE_CXXFLAGS += -Werror -Wno-write-strings # Disable RTTI QMAKE_CXXFLAGS += -fno-exceptions -fno-rtti TOP_SRC_DIR = $$PWD TOP_BUILD_DIR = $${TOP_SRC_DIR}/$${BUILD_DIR} include(coverage.pri) accounts-qml-module-0.6+16.04.20151106/common-installs-config.pri0000644000015300001610000000420212617074451024704 0ustar pbuserpbgroup00000000000000#----------------------------------------------------------------------------- # Common installation configuration for all projects. #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # setup the installation prefix #----------------------------------------------------------------------------- INSTALL_PREFIX = /usr # default installation prefix # default prefix can be overriden by defining PREFIX when running qmake isEmpty( PREFIX ) { message("====") message("==== NOTE: To override the installation path run: `qmake PREFIX=/custom/path'") message("==== (current installation path is `$${INSTALL_PREFIX}')") } else { INSTALL_PREFIX = $${PREFIX} message("====") message("==== install prefix set to `$${INSTALL_PREFIX}'") } #----------------------------------------------------------------------------- # default installation target for applications #----------------------------------------------------------------------------- contains( TEMPLATE, app ) { target.path = $${INSTALL_PREFIX}/bin INSTALLS += target message("====") message("==== INSTALLS += target") } #----------------------------------------------------------------------------- # default installation target for libraries #----------------------------------------------------------------------------- contains( TEMPLATE, lib ) { target.path = $${INSTALL_PREFIX}/lib INSTALLS += target message("====") message("==== INSTALLS += target") # reset the .pc file's `prefix' variable #include( tools/fix-pc-prefix.pri ) } #----------------------------------------------------------------------------- # target for header files #----------------------------------------------------------------------------- !isEmpty( headers.files ) { headers.path = $${INSTALL_PREFIX}/include/$${TARGET} INSTALLS += headers message("====") message("==== INSTALLS += headers") } else { message("====") message("==== NOTE: Remember to add your API headers into `headers.files' for installation!") } # End of File accounts-qml-module-0.6+16.04.20151106/doc/0000755000015300001610000000000012617075042020352 5ustar pbuserpbgroup00000000000000accounts-qml-module-0.6+16.04.20151106/doc/qtquick.css0000644000015300001610000003175112617074451022557 0ustar pbuserpbgroup00000000000000@media screen { /* basic elements */ html { color: #000000; background: #FFFFFF; } table { border-collapse: collapse; border-spacing: 0; } fieldset, img { border: 0; max-width:100%; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { font-style: inherit; font-weight: inherit; } del, ins { text-decoration: none; } ol li { list-style: decimal; } ul li { list-style: none; } caption, th { text-align: left; } h1.title { font-weight: bold; font-size: 150%; } h0 { font-weight: bold; font-size: 130%; } h1, h2, h3, h4, h5, h6 { font-size: 100%; } q:before, q:after { content: ''; } abbr, acronym { border: 0; font-variant: normal; } sup, sub { vertical-align: baseline; } tt, .qmlreadonly span, .qmldefault span { word-spacing:0.5em; } legend { color: #000000; } strong { font-weight: bold; } em { font-style: italic; } body { margin: 0 1.5em 0 1.5em; font-family: ubuntu; line-height: normal } a { color: #00732F; text-decoration: none; } hr { background-color: #E6E6E6; border: 1px solid #E6E6E6; height: 1px; width: 100%; text-align: left; margin: 1.5em 0 1.5em 0; } pre { border: 1px solid #DDDDDD; -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; border-radius: 0.7em 0.7em 0.7em 0.7em; padding: 1em 1em 1em 1em; overflow-x: auto; } table, pre { -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; border-radius: 0.7em 0.7em 0.7em 0.7em; background-color: #F6F6F6; border: 1px solid #E6E6E6; border-collapse: separate; margin-bottom: 2.5em; } pre { font-size: 90%; display: block; overflow:hidden; } thead { margin-top: 0.5em; font-weight: bold } th { padding: 0.5em 1.5em 0.5em 1em; background-color: #E1E1E1; border-left: 1px solid #E6E6E6; } td { padding: 0.25em 1.5em 0.25em 1em; } td.rightAlign { padding: 0.25em 0.5em 0.25em 1em; } table tr.odd { border-left: 1px solid #E6E6E6; background-color: #F6F6F6; color: black; } table tr.even { border-left: 1px solid #E6E6E6; background-color: #ffffff; color: #202020; } div.float-left { float: left; margin-right: 2em } div.float-right { float: right; margin-left: 2em } span.comment { color: #008B00; } span.string, span.char { color: #000084; } span.number { color: #a46200; } span.operator { color: #202020; } span.keyword { color: #840000; } span.name { color: black } span.type { font-weight: bold } span.type a:visited { color: #0F5300; } span.preprocessor { color: #404040 } /* end basic elements */ /* font style elements */ .heading { font-weight: bold; font-size: 125%; } .subtitle { font-size: 110% } .small-subtitle { font-size: 100% } .red { color:red; } /* end font style elements */ /* global settings*/ .header, .footer { display: block; clear: both; overflow: hidden; } /* end global settings*/ /* header elements */ .header .qtref { color: #00732F; font-weight: bold; font-size: 130%; } .header .content { margin-left: 5px; margin-top: 5px; margin-bottom: 0.5em; } .header .breadcrumb { font-size: 90%; padding: 0.5em 0 0.5em 1em; margin: 0; background-color: #fafafa; height: 1.35em; border-bottom: 1px solid #d1d1d1; } .header .breadcrumb ul { margin: 0; padding: 0; } .header .content { word-wrap: break-word; } .header .breadcrumb ul li { float: left; background: url(../images/breadcrumb.png) no-repeat 0 3px; padding-left: 1.5em; margin-left: 1.5em; } .header .breadcrumb ul li.last { font-weight: normal; } .header .breadcrumb ul li a { color: #00732F; } .header .breadcrumb ul li.first { background-image: none; padding-left: 0; margin-left: 0; } .header .content ol li { background: none; margin-bottom: 1.0em; margin-left: 1.2em; padding-left: 0 } .header .content li { background: url(../images/bullet_sq.png) no-repeat 0 5px; margin-bottom: 1em; padding-left: 1.2em; } /* end header elements */ /* content elements */ .content h1 { font-weight: bold; font-size: 130% } .content h2 { font-weight: bold; font-size: 120%; width: 100%; } .content h3 { font-weight: bold; font-size: 110%; width: 100%; } .content table p { margin: 0 } .content ul { padding-left: 2.5em; } .content li { padding-top: 0.25em; padding-bottom: 0.25em; } .content ul img { vertical-align: middle; } .content a:visited { color: #4c0033; text-decoration: none; } .content a:visited:hover { color: #4c0033; text-decoration: underline; } a:hover { color: #4c0033; text-decoration: underline; } descr p a { text-decoration: underline; } .descr p a:visited { text-decoration: underline; } .alphaChar{ width:95%; background-color:#F6F6F6; border:1px solid #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; font-size:12pt; padding-left:10px; margin-top:10px; margin-bottom:10px; } .flowList{ /*vertical-align:top;*/ /*margin:20px auto;*/ column-count:3; -webkit-column-count:3; -moz-column-count:3; /* column-width:100%; -webkit-column-width:200px; -col-column-width:200px; */ column-gap:41px; -webkit-column-gap:41px; -moz-column-gap:41px; column-rule: 1px dashed #ccc; -webkit-column-rule: 1px dashed #ccc; -moz-column-rule: 1px dashed #ccc; } .flowList dl{ } .flowList dd{ /*display:inline-block;*/ margin-left:10px; min-width:250px; line-height: 1.5; min-width:100%; min-height:15px; } .flowList dd a{ } .mainContent { padding-left:5px; } .content .flowList p{ padding:0px; } .content .alignedsummary { margin: 15px; } .qmltype { text-align: center; font-size: 120%; } .qmlreadonly { padding-left: 5px; float: right; color: #254117; } .qmldefault { padding-left: 5px; float: right; color: red; } .qmldoc { } .generic .alphaChar{ margin-top:5px; } .generic .odd .alphaChar{ background-color: #F6F6F6; } .generic .even .alphaChar{ background-color: #FFFFFF; } .memItemRight{ padding: 0.25em 1.5em 0.25em 0; } .highlightedCode { margin: 1.0em; } .annotated td { padding: 0.25em 0.5em 0.25em 0.5em; } .toc { font-size: 80% } .header .content .toc ul { padding-left: 0px; } .content .toc h3 { border-bottom: 0px; margin-top: 0px; } .content .toc h3 a:hover { color: #00732F; text-decoration: none; } .content .toc .level2 { margin-left: 1.5em; } .content .toc .level3 { margin-left: 3.0em; } .content ul li { background: url(../images/bullet_sq.png) no-repeat 0 0.7em; padding-left: 1em } .content .toc li { background: url(../images/bullet_dn.png) no-repeat 0 5px; padding-left: 1em } .relpage { -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; border: 1px solid #DDDDDD; padding: 25px 25px; clear: both; } .relpage ul { float: none; padding: 1.5em; } h3.fn, span.fn { -moz-border-radius:7px 7px 7px 7px; -webkit-border-radius:7px 7px 7px 7px; border-radius:7px 7px 7px 7px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; font-weight: bold; word-spacing:3px; padding:3px 5px; } .functionIndex { font-size:12pt; word-spacing:10px; margin-bottom:10px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; width:100%; } .centerAlign { text-align:center; } .rightAlign { text-align:right; } .leftAlign { text-align:left; } .topAlign{ vertical-align:top } .functionIndex a{ display:inline-block; } /* end content elements */ /* footer elements */ .footer { color: #393735; font-size: 0.75em; text-align: center; padding-top: 1.5em; padding-bottom: 1em; background-color: #E6E7E8; margin: 0; } .footer p { margin: 0.25em } .small { font-size: 0.5em; } /* end footer elements */ .item { float: left; position: relative; width: 100%; overflow: hidden; } .item .primary { margin-right: 220px; position: relative; } .item hr { margin-left: -220px; } .item .secondary { float: right; width: 200px; position: relative; } .item .cols { clear: both; display: block; } .item .cols .col { float: left; margin-left: 1.5%; } .item .cols .col.first { margin-left: 0; } .item .cols.two .col { width: 45%; } .item .box { margin: 0 0 10px 0; } .item .box h3 { margin: 0 0 10px 0; } .cols.unclear { clear:none; } } /* end of screen media */ /* start of print media */ @media print { input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult { display: none; background: none; } .content { background: none; display: block; width: 100%; margin: 0; float: none; } } /* end of print media */ /* modify the TOC layouts */ div.toc ul { padding-left: 20px; } div.toc li { padding-left: 4px; } /* Remove the border around images*/ a img { border:none; } /*Add styling to the front pages*/ .threecolumn_area { padding-top: 20px; padding-bottom: 20px; } .threecolumn_piece { display: inline-block; margin-left: 78px; margin-top: 8px; padding: 0; vertical-align: top; width: 25.5%; } div.threecolumn_piece ul { list-style-type: none; padding-left: 0px; margin-top: 2px; } div.threecolumn_piece p { margin-bottom: 7px; color: #5C626E; text-decoration: none; font-weight: bold; } div.threecolumn_piece li { padding-left: 0px; margin-bottom: 5px; } div.threecolumn_piece a { font-weight: normal; } /* Add style to guide page*/ .fourcolumn_area { padding-top: 20px; padding-bottom: 20px; } .fourcolumn_piece { display: inline-block; margin-left: 35px; margin-top: 8px; padding: 0; vertical-align: top; width: 21.3%; } div.fourcolumn_piece ul { list-style-type: none; padding-left: 0px; margin-top: 2px; } div.fourcolumn_piece p { margin-bottom: 7px; color: #40444D; text-decoration: none; font-weight: bold; } div.fourcolumn_piece li { padding-left: 0px; margin-bottom: 5px; } div.fourcolumn_piece a { font-weight: normal; } accounts-qml-module-0.6+16.04.20151106/doc/ubuntu-appdev-site-header.qdocconf0000644000015300001610000000340012617074451027057 0ustar pbuserpbgroup00000000000000HTML.postheader = \ "
\n" \ "
\n" \ " \n" \ "
\n" \ "
\n" \ "
\n" \ " \n" \ " \"Ubuntu\n" \ "

App Developer

\n" \ "
\n" \ "
\n" \ " \n" \ "
\n" \ "
\n" \ "
\n" accounts-qml-module-0.6+16.04.20151106/doc/css/0000755000015300001610000000000012617075042021142 5ustar pbuserpbgroup00000000000000accounts-qml-module-0.6+16.04.20151106/doc/css/qtquick.css0000644000015300001610000003175112617074451023347 0ustar pbuserpbgroup00000000000000@media screen { /* basic elements */ html { color: #000000; background: #FFFFFF; } table { border-collapse: collapse; border-spacing: 0; } fieldset, img { border: 0; max-width:100%; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { font-style: inherit; font-weight: inherit; } del, ins { text-decoration: none; } ol li { list-style: decimal; } ul li { list-style: none; } caption, th { text-align: left; } h1.title { font-weight: bold; font-size: 150%; } h0 { font-weight: bold; font-size: 130%; } h1, h2, h3, h4, h5, h6 { font-size: 100%; } q:before, q:after { content: ''; } abbr, acronym { border: 0; font-variant: normal; } sup, sub { vertical-align: baseline; } tt, .qmlreadonly span, .qmldefault span { word-spacing:0.5em; } legend { color: #000000; } strong { font-weight: bold; } em { font-style: italic; } body { margin: 0 1.5em 0 1.5em; font-family: ubuntu; line-height: normal } a { color: #00732F; text-decoration: none; } hr { background-color: #E6E6E6; border: 1px solid #E6E6E6; height: 1px; width: 100%; text-align: left; margin: 1.5em 0 1.5em 0; } pre { border: 1px solid #DDDDDD; -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; border-radius: 0.7em 0.7em 0.7em 0.7em; padding: 1em 1em 1em 1em; overflow-x: auto; } table, pre { -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; border-radius: 0.7em 0.7em 0.7em 0.7em; background-color: #F6F6F6; border: 1px solid #E6E6E6; border-collapse: separate; margin-bottom: 2.5em; } pre { font-size: 90%; display: block; overflow:hidden; } thead { margin-top: 0.5em; font-weight: bold } th { padding: 0.5em 1.5em 0.5em 1em; background-color: #E1E1E1; border-left: 1px solid #E6E6E6; } td { padding: 0.25em 1.5em 0.25em 1em; } td.rightAlign { padding: 0.25em 0.5em 0.25em 1em; } table tr.odd { border-left: 1px solid #E6E6E6; background-color: #F6F6F6; color: black; } table tr.even { border-left: 1px solid #E6E6E6; background-color: #ffffff; color: #202020; } div.float-left { float: left; margin-right: 2em } div.float-right { float: right; margin-left: 2em } span.comment { color: #008B00; } span.string, span.char { color: #000084; } span.number { color: #a46200; } span.operator { color: #202020; } span.keyword { color: #840000; } span.name { color: black } span.type { font-weight: bold } span.type a:visited { color: #0F5300; } span.preprocessor { color: #404040 } /* end basic elements */ /* font style elements */ .heading { font-weight: bold; font-size: 125%; } .subtitle { font-size: 110% } .small-subtitle { font-size: 100% } .red { color:red; } /* end font style elements */ /* global settings*/ .header, .footer { display: block; clear: both; overflow: hidden; } /* end global settings*/ /* header elements */ .header .qtref { color: #00732F; font-weight: bold; font-size: 130%; } .header .content { margin-left: 5px; margin-top: 5px; margin-bottom: 0.5em; } .header .breadcrumb { font-size: 90%; padding: 0.5em 0 0.5em 1em; margin: 0; background-color: #fafafa; height: 1.35em; border-bottom: 1px solid #d1d1d1; } .header .breadcrumb ul { margin: 0; padding: 0; } .header .content { word-wrap: break-word; } .header .breadcrumb ul li { float: left; background: url(../images/breadcrumb.png) no-repeat 0 3px; padding-left: 1.5em; margin-left: 1.5em; } .header .breadcrumb ul li.last { font-weight: normal; } .header .breadcrumb ul li a { color: #00732F; } .header .breadcrumb ul li.first { background-image: none; padding-left: 0; margin-left: 0; } .header .content ol li { background: none; margin-bottom: 1.0em; margin-left: 1.2em; padding-left: 0 } .header .content li { background: url(../images/bullet_sq.png) no-repeat 0 5px; margin-bottom: 1em; padding-left: 1.2em; } /* end header elements */ /* content elements */ .content h1 { font-weight: bold; font-size: 130% } .content h2 { font-weight: bold; font-size: 120%; width: 100%; } .content h3 { font-weight: bold; font-size: 110%; width: 100%; } .content table p { margin: 0 } .content ul { padding-left: 2.5em; } .content li { padding-top: 0.25em; padding-bottom: 0.25em; } .content ul img { vertical-align: middle; } .content a:visited { color: #4c0033; text-decoration: none; } .content a:visited:hover { color: #4c0033; text-decoration: underline; } a:hover { color: #4c0033; text-decoration: underline; } descr p a { text-decoration: underline; } .descr p a:visited { text-decoration: underline; } .alphaChar{ width:95%; background-color:#F6F6F6; border:1px solid #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; font-size:12pt; padding-left:10px; margin-top:10px; margin-bottom:10px; } .flowList{ /*vertical-align:top;*/ /*margin:20px auto;*/ column-count:3; -webkit-column-count:3; -moz-column-count:3; /* column-width:100%; -webkit-column-width:200px; -col-column-width:200px; */ column-gap:41px; -webkit-column-gap:41px; -moz-column-gap:41px; column-rule: 1px dashed #ccc; -webkit-column-rule: 1px dashed #ccc; -moz-column-rule: 1px dashed #ccc; } .flowList dl{ } .flowList dd{ /*display:inline-block;*/ margin-left:10px; min-width:250px; line-height: 1.5; min-width:100%; min-height:15px; } .flowList dd a{ } .mainContent { padding-left:5px; } .content .flowList p{ padding:0px; } .content .alignedsummary { margin: 15px; } .qmltype { text-align: center; font-size: 120%; } .qmlreadonly { padding-left: 5px; float: right; color: #254117; } .qmldefault { padding-left: 5px; float: right; color: red; } .qmldoc { } .generic .alphaChar{ margin-top:5px; } .generic .odd .alphaChar{ background-color: #F6F6F6; } .generic .even .alphaChar{ background-color: #FFFFFF; } .memItemRight{ padding: 0.25em 1.5em 0.25em 0; } .highlightedCode { margin: 1.0em; } .annotated td { padding: 0.25em 0.5em 0.25em 0.5em; } .toc { font-size: 80% } .header .content .toc ul { padding-left: 0px; } .content .toc h3 { border-bottom: 0px; margin-top: 0px; } .content .toc h3 a:hover { color: #00732F; text-decoration: none; } .content .toc .level2 { margin-left: 1.5em; } .content .toc .level3 { margin-left: 3.0em; } .content ul li { background: url(../images/bullet_sq.png) no-repeat 0 0.7em; padding-left: 1em } .content .toc li { background: url(../images/bullet_dn.png) no-repeat 0 5px; padding-left: 1em } .relpage { -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; border: 1px solid #DDDDDD; padding: 25px 25px; clear: both; } .relpage ul { float: none; padding: 1.5em; } h3.fn, span.fn { -moz-border-radius:7px 7px 7px 7px; -webkit-border-radius:7px 7px 7px 7px; border-radius:7px 7px 7px 7px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; font-weight: bold; word-spacing:3px; padding:3px 5px; } .functionIndex { font-size:12pt; word-spacing:10px; margin-bottom:10px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; width:100%; } .centerAlign { text-align:center; } .rightAlign { text-align:right; } .leftAlign { text-align:left; } .topAlign{ vertical-align:top } .functionIndex a{ display:inline-block; } /* end content elements */ /* footer elements */ .footer { color: #393735; font-size: 0.75em; text-align: center; padding-top: 1.5em; padding-bottom: 1em; background-color: #E6E7E8; margin: 0; } .footer p { margin: 0.25em } .small { font-size: 0.5em; } /* end footer elements */ .item { float: left; position: relative; width: 100%; overflow: hidden; } .item .primary { margin-right: 220px; position: relative; } .item hr { margin-left: -220px; } .item .secondary { float: right; width: 200px; position: relative; } .item .cols { clear: both; display: block; } .item .cols .col { float: left; margin-left: 1.5%; } .item .cols .col.first { margin-left: 0; } .item .cols.two .col { width: 45%; } .item .box { margin: 0 0 10px 0; } .item .box h3 { margin: 0 0 10px 0; } .cols.unclear { clear:none; } } /* end of screen media */ /* start of print media */ @media print { input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult { display: none; background: none; } .content { background: none; display: block; width: 100%; margin: 0; float: none; } } /* end of print media */ /* modify the TOC layouts */ div.toc ul { padding-left: 20px; } div.toc li { padding-left: 4px; } /* Remove the border around images*/ a img { border:none; } /*Add styling to the front pages*/ .threecolumn_area { padding-top: 20px; padding-bottom: 20px; } .threecolumn_piece { display: inline-block; margin-left: 78px; margin-top: 8px; padding: 0; vertical-align: top; width: 25.5%; } div.threecolumn_piece ul { list-style-type: none; padding-left: 0px; margin-top: 2px; } div.threecolumn_piece p { margin-bottom: 7px; color: #5C626E; text-decoration: none; font-weight: bold; } div.threecolumn_piece li { padding-left: 0px; margin-bottom: 5px; } div.threecolumn_piece a { font-weight: normal; } /* Add style to guide page*/ .fourcolumn_area { padding-top: 20px; padding-bottom: 20px; } .fourcolumn_piece { display: inline-block; margin-left: 35px; margin-top: 8px; padding: 0; vertical-align: top; width: 21.3%; } div.fourcolumn_piece ul { list-style-type: none; padding-left: 0px; margin-top: 2px; } div.fourcolumn_piece p { margin-bottom: 7px; color: #40444D; text-decoration: none; font-weight: bold; } div.fourcolumn_piece li { padding-left: 0px; margin-bottom: 5px; } div.fourcolumn_piece a { font-weight: normal; } accounts-qml-module-0.6+16.04.20151106/doc/css/scratch.css0000644000015300001610000000137412617074451023313 0ustar pbuserpbgroup00000000000000body { margin: 0; } div.toc ul { padding: 0; } div.toc li { margin-bottom: 3px; } h1.title { font-size: 36px; line-height: 1.1; font-weight: normal; } h0, h2 { font-size: 24px; line-height: 1.2; margin: 14px 0; font-weight: normal; display: block; } a:hover { color: #dd4814; text-decoration: underline; outline: 0; } table, pre { border-radius: 0; } .annotated td { padding: 0.8em 1em 0.3em; } .wrapper { width: 940px; margin: 0 auto; } .main-content { width: 668px; position: relative; left: 270px; } .title { margin-left: -270px; margin-top: 30px; margin-bottom: 50px; } .toc { margin-left: -270px; font-size: 100%; margin-bottom: 40px; padding: 0; z-index: 2; position: absolute; top: 100px; width: 250px; } accounts-qml-module-0.6+16.04.20151106/doc/css/base.css0000644000015300001610000002706712617074451022605 0ustar pbuserpbgroup00000000000000/** * Ubuntu Developer base stylesheet * * A base stylesheet containing site-wide styles * * @project Ubuntu Developer * @version 1.0 * @author Canonical Web Team: Steve Edwards * @copyright 2011 Canonical Ltd. */ /** * @section Global */ body { font-family: 'Ubuntu', 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.4; color: #333; } a { color: #dd4814; text-decoration: none; outline: 0; } p, dl { margin-bottom: 10px; } strong { font-weight: bold; } em { font-style: italic; } code{ padding: 10px; font-family: 'Ubuntu Mono', 'Consolas', 'Monaco', 'DejaVu Sans Mono', Courier, monospace; background-color: #fdf6f2; display: block; margin-bottom: 10px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } h1 { font-size: 36px; line-height: 1.1; margin-bottom: 20px; } article h1, h2 { font-size: 24px; line-height: 1.2; margin-bottom: 14px; } h3 { font-size: 16px; line-height: 1.3; margin-bottom: 8px; } h4 { font-weight: bold; } time { color:#999; } /** * @section Structure */ .header-login, .header-navigation div, .header-content div { margin: 0 auto; width: 940px; } .header-content h1{ background-color:#ffffff; display:inline-block; } .header-content h2{ background-color:#ffffff; display:table; } .header-login ul { margin: 4px 0; float: right; } .header-login li { margin-right: 10px; float: left; } .header-login a { color: #333; } .header-navigation { border-top: 2px solid #dd4814; border-bottom: 2px solid #dd4814; background-color: #fff; height: 54px; clear: right; overflow: hidden; } .header-navigation nav ul { border-right: 1px solid #dd4814; float: right; } .header-navigation nav li { border-left: 1px solid #dd4814; float: left; height: 54px; } .header-navigation nav a { padding: 18px 14px 0; font-size: 14px; display: block; height: 36px; } .header-navigation nav a:hover { background-color: #fcece7; } .header-navigation nav .current_page_item a, .header-navigation nav .current_page_parent a, .header-navigation nav .current_page_ancestor a { background-color: #dd4814; color: #fff; } .header-navigation input { margin: 12px 10px 0 10px; padding: 5px; border-top: 1px solid #a1a1a1; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #fff; border-left: 1px solid #e0e0e0; width: 90px; font-style: italic; color: #ccc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; -moz-box-shadow: inset 0 1px 1px #e0e0e0; -webkit-box-shadow: inset 0 1px 1px #e0e0e0; box-shadow: inset 0 1px 1px #e0e0e0; } .header-navigation h2 { margin: 18px 0 0 6px; text-transform: lowercase; font-size: 22px; color: #dd4814; float: left; } .header-navigation .logo-ubuntu { margin-top: 12px; float: left; } .header-content .header-navigation-secondary { margin-bottom: 40px; padding: 0; position: relative; z-index: 2; } .header-navigation-secondary div { padding: 0; border: 2px solid #dd4814; -moz-border-radius: 0px 0px 4px 4px; -webkit-border-radius: 0px 0px 4px 4px; border-radius: 0px 0px 4px 4px; background: #fff; border-top: 0px; width: 936px; } .header-navigation-secondary nav li { float: left; } .header-navigation-secondary nav li a { color: #333; display: block; height: 25px; padding: 8px 8px 0; } .header-navigation-secondary nav li:hover, .header-navigation-secondary nav .current_page_item a { background: url("../img/sec-nav-hover.gif"); } .header-content { padding-bottom: 30px; border-bottom: 1px solid #e0e0e0; -moz-box-shadow: 0 1px 3px #e0e0e0; -webkit-box-shadow: 0 1px 3px #e0e0e0; box-shadow: 0 1px 3px #e0e0e0; margin-bottom: 3px; position: relative; overflow: hidden; } footer { padding: 10px 10px 40px 10px; position: relative; -moz-border-radius: 0 0 4px 4px; -webkit-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; font-size: 12px; background: url("../img/background-footer.png") repeat scroll 0 0 #f7f6f5; } footer div { margin: 0 auto; padding: 0 10px; width: 940px; } footer a { color: #000; } footer nav ul { margin: 10px 17px 30px 0; width: 172px; display: inline-block; vertical-align: top; height: auto; zoom: 1; *display: inline; } footer nav ul.last { margin-right: 0; } footer nav li { margin-bottom: 8px; } footer nav li:first-child { font-weight: bold; } footer p { margin-bottom: 0; } #content { padding-top: 35px; } .arrow-nav { display: none; position: absolute; top: -1px; z-index: 3; } .shadow { margin: 30px 0 3px 0; border-bottom: 1px solid #e0e0e0; -moz-box-shadow: 0 2px 3px #e0e0e0; -webkit-box-shadow: 0 2px 3px #e0e0e0; box-shadow: 0 2px 3px #e0e0e0; height: 3px; } /** * @section Site-wide */ #content h2{ font-size:24px; } .box-orange { padding: 10px; border: 3px solid #dd4814; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .box-orange .link-action-small { float: right; margin: 0 0 0 20px; } .link-bug { margin-left: 10px; color: #999; } .link-action { float: left; margin-bottom: 20px; padding: 8px 12px; display: block; background-color: #dd4814; color: #fff; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; font-size: 16px; line-height: 1.3; border-top: 3px solid #e6633a; border-bottom: 3px solid #c03d14; } .link-action2 { float: left; display: block; color: #fff; font-size: 16px; line-height: 1.3; } .link-action2 span{ display:block; float:left; } .link-action2 .cta-left{ background:url(../img/button-cta-left.png) no-repeat; width:22px; height:48px; } .link-action2 .cta-center{ background:url(../img/button-cta-slice.png) repeat-x; line-height:45px; height:48px; } .link-action2 .cta-right{ background:url(../img/button-cta-right.png) no-repeat; width:22px; height:48px; } .link-action-small { float: left; display: block; color: #fff; font-size: 16px; } .link-action-small span{ display:block; float:left; height:42px; } .link-action-small .cta-left{ background:url(../img/button-cta-left-small.png) no-repeat; width:19px; } .link-action-small .cta-center{ background:url(../img/button-cta-slice-small.png) repeat-x; line-height:42px; } .link-action-small .cta-right{ background:url(../img/button-cta-right-small.png) no-repeat; width:19px; } .link-action:active { position: relative; top: 1px; } .link-action2:active { position: relative; top: 1px; } .link-action-small:active { position: relative; top: 1px; } .list-bullets li { margin-bottom: 10px; list-style: disc; list-style-position: inside; } .box { margin-bottom: 30px; padding: 15px; border: 1px solid #aea79f; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .box-padded { margin-bottom: 30px; padding: 5px; border: 2px solid #aea79f; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; background: url("../img/pattern-featured.gif") repeat scroll 0 0 #ebe9e7; overflow: hidden; } .box-padded h3 { margin: 5px 0 10px 5px; } .box-padded div { padding: 10px; border: 1px solid #aea79f; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; background-color: #fff; overflow: hidden; } .box-padded li { padding: 0 10px; float: left; width: 211px; border-right: 1px dotted #aea79f; } .box-padded li.first { padding: 0; margin-bottom: 0; } .box-padded li.last { border: 0; width: 217px; } .box-padded img { margin: 0 10px 50px 0; float: left; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; } .box-clear { margin-bottom: 40px; } .box-clear .grid-4.first { margin-right: 15px; padding-right: 15px; } .box-clear .grid-4 { margin-left: 0; margin-right: 10px; padding-right: 10px; width: 298px; } .box-clear time { display: block; border-bottom: 1px dotted #aea79f; padding-bottom: 10px; margin-bottom: 10px; } .box-clear div.first { border-right: 1px dotted #aea79f; } .box-clear a { display: block; } .box-clear .rss { background: url("../img/rss.jpg") no-repeat scroll 0 center; padding-left: 20px; } .box-clear .location { display: block; margin-bottom: 1px; } .box-clear .last { margin: 0; padding-right: 0; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; width: 293px; } /* Widgets */ .ui-state-focus { outline: none; } .ui-accordion { border-bottom: 1px dotted #aea79f; } .ui-accordion a { display: block; } .ui-accordion h3 { margin-bottom: 0; border-top: 1px dotted #aea79f; position: relative; font-size: 13px; font-weight: bold; } .ui-accordion h3 a { padding: 10px 0; color: #333; } .ui-accordion h4 { margin-bottom: 5px; } .ui-accordion div fieldset { padding-bottom: 5px; } .ui-accordion div li, .ui-accordion div input { margin-bottom: 10px; } .ui-accordion .ui-icon { position: absolute; top: 15px; right: 0; display: block; width: 8px; height: 8px; background: url("../img/icon-accordion-inactive.png") 0 0 no-repeat transparent; } .ui-accordion .ui-state-active .ui-icon { background-image: url("../img/icon-accordion-active.png"); } .ui-accordion .current_page_item a { color: #333; } .container-tweet { -moz-border-radius: 4px 4px 4px 4px; -webkit-border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px; padding: 10px 10px 10px; background-color: #f7f7f7; } .container-tweet .tweet-follow { margin-top: 10px; margin-bottom: -10px; padding-left: 55px; padding-bottom: 6px; background: url("../img/tweet-follow.png") 0 5px no-repeat; display: block; } .container-tweet .tweet-follow span { font-size: 16px; font-weight: bold; line-height: 1.2; display: block; } .tweet a { display: inline; } .tweet .tweet_text { padding: 10px; background-color: #fff; -moz-border-radius: 4px 4px 4px 4px; -webkit-border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px; border: 1px solid #dd4814; font-size: 16px; display: block; clear: both; } .tweet.tweet-small .tweet_text { font-size: inherit; } .tweet .tweet_text a { color: #333; } .tweet .tweet_time, .tweet .tweet_user_and_time { padding: 15px 0 10px 0; position: relative; top: -2px; background: url("../img/tweet-arrow.png") no-repeat; display: block; } .tweet .tweet_odd .tweet_time, .tweet .tweet_odd .tweet_user_and_time { background-position: right 0; float: right; } .tweet .tweet_even .tweet_time, .tweet .tweet_even .tweet_user_and_time { background-position: left 0; float: left; } /* Search */ #content .list-search li { list-style-type:none; border:0px; margin-bottom: 15px; padding-top: 15px; } /* Blog */ .blog-article #nav-single { margin-top: 30px; margin-bottom: 30px; } .blog-article #nav-single .nav-next { float: right; } .blog-article article header .entry-meta { margin-bottom: 20px; } .blog-article article .entry-meta { color: #999; } .blog-article #respond form input[type="submit"] { float: left; cursor: pointer; margin-bottom: 20px; padding: 8px 12px; display: block; background-color: #dd4814; color: #fff; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; font-size: 16px; line-height: 1.3; border-top: 3px solid #e6633a; border-left: 3px solid #e6633a; border-right: 3px solid #e6633a; border-bottom: 3px solid #c03d14; } .blog-article #respond form input[type="submit"]:active { position: relative; top: 1px; } .alignnone{ float:left; margin:10px 20px 10px 0; } .alignleft{ float:left; margin:10px 20px 10px 0; } .alignright{ float:right; margin:10px 0 10px 20px; } .aligncenter{ float:left; margin:10px 20px 10px 0; } .entry-content h2, .entry-content h3{ margin-top:20px; } .entry-content ul li{ list-style-type: circle; margin-left:16px; } .entry-content hr{ border:none; border-top: 1px dotted #AEA79F; } accounts-qml-module-0.6+16.04.20151106/doc/css/reset.css0000644000015300001610000000153312617074451023003 0ustar pbuserpbgroup00000000000000/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.3.0 build: 3167 */ html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}accounts-qml-module-0.6+16.04.20151106/doc/accounts-qml-module.qdocconf0000644000015300001610000000051612617074451025766 0ustar pbuserpbgroup00000000000000include(accounts-qml-module-common.qdocconf) HTML.templatedir = . HTML.nobreadcrumbs = "true" HTML.stylesheets = qtquick.css HTML.headerstyles = " \n" HTML.endheader = "\n" HTML.footer = "
Copyright (C) 2013 Canonical Ltd.
\n" accounts-qml-module-0.6+16.04.20151106/doc/accounts-qml-module-ubuntu.qdocconf0000644000015300001610000000147512617074451027313 0ustar pbuserpbgroup00000000000000include(accounts-qml-module-common.qdocconf) include(ubuntu-appdev-site-header.qdocconf) include(ubuntu-appdev-site-footer.qdocconf) HTML.stylesheets = \ doc/css/reset.css \ doc/css/qtquick.css \ doc/css/base.css \ doc/css/scratch.css HTML.headerstyles = \ "\n" \ "\n" \ "\n" \ "\n" \ "\n" \ "\n" accounts-qml-module-0.6+16.04.20151106/doc/manifest-files.qdoc0000644000015300001610000003143312617074451024137 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ /*! \page manifest-files.html manifest-files \title Manifest files In order to integrate with the Online Accounts framework, one needs to ship a couple of manifest files which describe the online services being used or provided. Account plugins must ship a \l{The provider files}{provider file} which can contain account settings readable by applications. Applications must ship an \l{The application files}{application file} which tells which online services the application is able to use, and \l{The service files}{service files} which describes the online services and their settings. \section1 The provider files A \c .provider file describes an online accounts provider. It's a XML file, typically installed in \c /usr/share/accounts/providers/ or \c ~/.local/share/accounts/providers/ which looks like this: \code Facebook facebook account-plugins .*facebook\.com generic-oauth true \endcode This file name must match the value of the \c id tag in the root \c element, plus the \c ".provider" suffix. The only mandatory element is \c , and that's the display name of the provider. Other optional elements are: \list \li \c : an icon for the account provider. \li \c : a translation domain for the \c element. \li \c : a regular expression matching the domain(s) where this account is used. \li \c : the ID of the account plugin which must be used to create or edit the accounts for this provider. \li \c : whether the account editing UI should prevent the user to create multiple accounts for this provider. \li \c