QList <QSharedPointer<Account> > SystemPrivate::loadAccounts (
    const QString & serviceType, bool includeCustomUI) {

    qDebug() << "PERF: LoadAccounts START";

    QList <QSharedPointer<Account> > retList;
    Accounts::AccountIdList idList =
        m_accountsManager->accountList (serviceType);

    for (int i = 0; i < idList.size (); ++i) {
        Accounts::Account * aAccount = m_accountsManager->account (idList [i]);

        if (aAccount == 0) {
            qWarning() << "Null account received" << i + 1;
            continue;
        }

        Accounts::ServiceList sList = aAccount->services (serviceType);

        for (int j = 0; j < sList.size (); ++j) {
            Accounts::Service aService = sList [j];

            aAccount->selectService (aService);
            qDebug() << "Service" << aService.displayName() << "found for"
                << "account" << aAccount->displayName();

            QSharedPointer <Account> sAccount = QSharedPointer <Account> (
                new Account);

            if (sAccount->init (idList [i], aService.name())) {
                bool append = true;

                if (includeCustomUI == false) {
                    if (sAccount->service()->publishCustom() ==
                        Service::PUBLISH_CUSTOM_TOTAL) {
                        append = false;
                    }
                }

                if (append == true) {
                    retList.append (sAccount);
                }
            }
        }

        delete aAccount;
        aAccount = 0;

    }

    qDebug() << "PERF: LoadAccounts END";

    return retList;
}
/*!
 * \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;
}