Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory:ARM:Rings:1-MinimalX
libaccounts-qt
libaccounts-qt-1.16git.20231124T162152~18557f7....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libaccounts-qt-1.16git.20231124T162152~18557f7.obscpio of Package libaccounts-qt
07070100000000000081A40000000000000000000000016560BF90000000E1000000000000000000000000000000000000003A00000000libaccounts-qt-1.16git.20231124T162152~18557f7/.gitignore.*.swp .cproject .project Makefile* debian /Accounts/AccountsQt*Config.cmake /Accounts/AccountsQt*ConfigVersion.cmake /coverage-html/ /coverage.info /doc/accounts-qt.tags /doc/html /doc/qch moc_* *~ *.gcda *.gcno *.o *.tar.* 07070100000001000081A40000000000000000000000016560BF9000001418000000000000000000000000000000000000003E00000000libaccounts-qt-1.16git.20231124T162152~18557f7/.gitlab-ci.ymlcache: key: apt-cache paths: - apt-cache/ # for build_dependencies - libaccounts-glib stages: - deps - build - test - deploy build_dependencies: image: ubuntu:bionic stage: deps artifacts: paths: - staging before_script: - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR - PACKAGES+=" wget" # for downloading dependencies - PACKAGES+=" libglib2.0-dev libsqlite3-dev libxml2-dev gtk-doc-tools libgirepository1.0-dev gobject-introspection libxml2-utils python3-gi python-gi-dev valac check python3-pip" # for libaccounts-glib - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y $PACKAGES - pip3 install meson ninja script: - STAGING="$PWD/staging" # Build libaccounts-glib - LIBACCOUNTS_VERSION="master" - LIBACCOUNTS_ARCHIVE="libaccounts-glib-${LIBACCOUNTS_VERSION}.tar.bz2" - mkdir libaccounts-glib && cd libaccounts-glib - if [ ! -d "libaccounts-glib-${LIBACCOUNTS_VERSION}" ]; then - if [ ! -f "$LIBACCOUNTS_ARCHIVE" ]; then - wget -c -nv "https://gitlab.com/accounts-sso/libaccounts-glib/-/archive/master/$LIBACCOUNTS_ARCHIVE" - fi - tar xjf "$LIBACCOUNTS_ARCHIVE" - fi - cd "libaccounts-glib-${LIBACCOUNTS_VERSION}" - mkdir build - meson build --prefix $STAGING --libdir lib - cd build - ninja - ninja install || true # This currently fails on gtkdoc, but the important bits get done build_amd64: image: ubuntu:bionic stage: build before_script: - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR - | apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y \ qt5-qmake qttools5-dev-tools qtbase5-dev qtchooser pkg-config doxygen wget libglib2.0-dev libsqlite3-dev libxml2-dev gtk-doc-tools libgirepository1.0-dev gobject-introspection libxml2-utils python3-gi python-gi-dev valac check python3-pip - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y dbus-test-runner lcov gcovr script: - STAGING="$PWD/staging" - export PKG_CONFIG_PATH="$STAGING/lib/pkgconfig:$PKG_CONFIG_PATH" - export LD_LIBRARY_PATH="$STAGING/lib:$LD_LIBRARY_PATH" - export QT_SELECT=qt5 - mkdir build - cd build - qmake CONFIG+=debug CONFIG+=coverage .. - make -j 4 dependencies: - build_dependencies artifacts: paths: - build/ test_amd64: image: ubuntu:bionic stage: test before_script: - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR - PACKAGES+=" wget" # for downloading dependencies - | apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y \ qt5-qmake qttools5-dev-tools qtbase5-dev qtchooser pkg-config doxygen \ $PACKAGES - apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y dbus-test-runner lcov gcovr script: - STAGING="$PWD/staging" - export LD_LIBRARY_PATH="$STAGING/lib:$LD_LIBRARY_PATH" - find build | xargs touch # Avoid rebuilding - cd build - make coverage-html dependencies: - build_dependencies - build_amd64 artifacts: paths: - build/ build_amd64_qt6: stage: build image: ubuntu:jammy before_script: - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y qmake6 qt6-base-dev pkg-config libqt6sql6-sqlite doxygen libdbus-1-dev g++ make libglib2.0-dev gtk-doc-tools libgirepository1.0-dev gobject-introspection libxml2-utils python3-gi python-gi-dev valac check python3-pip libsqlite3-dev libxml2-dev script: - STAGING="$PWD/staging" - find $STAGING - export PKG_CONFIG_PATH="$STAGING/lib/pkgconfig:$PKG_CONFIG_PATH" - export LD_LIBRARY_PATH="$STAGING/lib:$LD_LIBRARY_PATH" - mkdir build - cd build - qmake6 CONFIG+=debug CONFIG+=coverage .. - make -j 4 dependencies: - build_dependencies artifacts: paths: - build/ test_amd64_qt6: stage: test image: ubuntu:jammy before_script: - export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR - export DEBIAN_FRONTEND=noninteractive - apt-get update -yq && apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y dbus-test-runner libqtdbusmock1-dev libqtdbustest1-dev lcov gcovr make qmake6 qt6-base-dev pkg-config libqt6sql6-sqlite doxygen libdbus-1-dev g++ make libsqlite3-dev libxml2-dev libglib2.0-dev script: - STAGING="$PWD/staging" - export LD_LIBRARY_PATH="$STAGING/lib:$LD_LIBRARY_PATH" - find build | xargs touch # Avoid rebuilding - cd build - make coverage-html dependencies: - build_dependencies - build_amd64_qt6 artifacts: paths: - ./ pages: stage: deploy script: - find build | xargs touch # Avoid rebuilding - cd build - make docs - cd .. - mkdir public - cp -a build/coverage-html public/coverage - cp -a build/doc/html/* public/ dependencies: - test_amd64 artifacts: paths: - public only: - master 07070100000002000081A40000000000000000000000016560BF9000000036000000000000000000000000000000000000003B00000000libaccounts-qt-1.16git.20231124T162152~18557f7/.qmake.confTOP_SRC_DIR = $$PWD TOP_BUILD_DIR = $$shadowed($$PWD) 07070100000003000041ED0000000000000000000000026560BF9000000000000000000000000000000000000000000000003800000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts07070100000004000081A40000000000000000000000016560BF9000000025000000000000000000000000000000000000004300000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/.gitignorelibaccounts-qt*.so* /accounts-qt*.pc 07070100000005000081A40000000000000000000000016560BF900000001E000000000000000000000000000000000000004000000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/Account#include <Accounts/account.h> 07070100000006000081A40000000000000000000000016560BF9000000026000000000000000000000000000000000000004700000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/AccountService#include <Accounts/account-service.h> 07070100000007000081A40000000000000000000000016560BF9000000602000000000000000000000000000000000000004500000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/Accounts.pro include( ../common-project-config.pri ) include( ../common-vars.pri ) TEMPLATE = lib TARGET = accounts-qt$${QT_MAJOR_VERSION} # Input public_headers = \ accountscommon.h \ Manager manager.h \ Account account.h \ AccountService account-service.h \ Application application.h \ AuthData auth-data.h \ Error error.h \ Provider provider.h \ Service service.h \ ServiceType service-type.h private_headers = \ manager_p.h \ utils.h HEADERS += \ $$public_headers \ $$private_headers SOURCES += manager.cpp \ account.cpp \ account-service.cpp \ application.cpp \ auth-data.cpp \ error.cpp \ provider.cpp \ service.cpp \ service-type.cpp \ utils.cpp CONFIG += link_pkgconfig DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII QT_NO_KEYWORDS QT += core xml QT -= gui INCLUDEPATH += $${TOP_SRC_DIR} CMAKE_BASENAME = AccountsQt$${QT_MAJOR_VERSION} PKGCONFIG += \ glib-2.0 \ gobject-2.0 \ libaccounts-glib QMAKE_CXXFLAGS += \ -fno-exceptions \ -fvisibility=hidden headers.files = $$HEADERS include( ../common-installs-config.pri ) pkgconfig.files = $${TARGET}.pc include($${TOP_SRC_DIR}/common-pkgconfig.pri) INSTALLS += pkgconfig QMAKE_SUBSTITUTES += \ $${CMAKE_BASENAME}Config.cmake.in \ $${CMAKE_BASENAME}ConfigVersion.cmake.in cmake_modules.files = \ $${CMAKE_BASENAME}Config.cmake \ $${CMAKE_BASENAME}ConfigVersion.cmake cmake_modules.path = $${CMAKE_CONFIG_PATH}/$${CMAKE_BASENAME} INSTALLS += cmake_modules 07070100000008000081A40000000000000000000000016560BF900000010C000000000000000000000000000000000000005300000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/AccountsQt5Config.cmake.in# ACCOUNTSQT_INCLUDE_DIRS - The libaccounts-qt include directories # ACCOUNTSQT_LIBRARIES - The libraries needed to use libaccounts-qt set(ACCOUNTSQT_LIBRARIES $${INSTALL_LIBDIR}/lib$${TARGET}.so) set(ACCOUNTSQT_INCLUDE_DIRS $${INSTALL_PREFIX}/include/$${TARGET}/) 07070100000009000081A40000000000000000000000016560BF9000000200000000000000000000000000000000000000005A00000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/AccountsQt5ConfigVersion.cmake.inset(PACKAGE_VERSION $${PROJECT_VERSION}) if(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) else(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) set(PACKAGE_VERSION_COMPATIBLE TRUE) if( \"${PACKAGE_FIND_VERSION}\" STREQUAL \"${PACKAGE_VERSION}\") set(PACKAGE_VERSION_EXACT TRUE) endif( \"${PACKAGE_FIND_VERSION}\" STREQUAL \"${PACKAGE_VERSION}\") endif(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) 0707010000000A000081A40000000000000000000000016560BF900000010B000000000000000000000000000000000000005300000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/AccountsQt6Config.cmake.in# ACCOUNTSQT_INCLUDE_DIRS - The libaccounts-qt include directories # ACCOUNTSQT_LIBRARIES - The libraries needed to use libaccounts-qt set(ACCOUNTSQT_LIBRARIES $${INSTALL_LIBDIR}/lib$${TARGET}.so) set(ACCOUNTSQT_INCLUDE_DIRS $${INSTALL_PREFIX}/include/$${TARGET}/)0707010000000B000081A40000000000000000000000016560BF9000000200000000000000000000000000000000000000005A00000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/AccountsQt6ConfigVersion.cmake.inset(PACKAGE_VERSION $${PROJECT_VERSION}) if(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) else(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) set(PACKAGE_VERSION_COMPATIBLE TRUE) if( \"${PACKAGE_FIND_VERSION}\" STREQUAL \"${PACKAGE_VERSION}\") set(PACKAGE_VERSION_EXACT TRUE) endif( \"${PACKAGE_FIND_VERSION}\" STREQUAL \"${PACKAGE_VERSION}\") endif(\"${PACKAGE_VERSION}\" VERSION_LESS \"${PACKAGE_FIND_VERSION}\" ) 0707010000000C000081A40000000000000000000000016560BF9000000022000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/Application#include <Accounts/application.h> 0707010000000D000081A40000000000000000000000016560BF9000000020000000000000000000000000000000000000004100000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/AuthData#include <Accounts/auth-data.h> 0707010000000E000081A40000000000000000000000016560BF900000001C000000000000000000000000000000000000003E00000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/Error#include <Accounts/error.h> 0707010000000F000081A40000000000000000000000016560BF900000001E000000000000000000000000000000000000004000000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/Manager#include <Accounts/manager.h> 07070100000010000081A40000000000000000000000016560BF900000001F000000000000000000000000000000000000004100000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/Provider#include <Accounts/provider.h> 07070100000011000081A40000000000000000000000016560BF900000001F000000000000000000000000000000000000004000000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/Service#include <Accounts/service.h> 07070100000012000081A40000000000000000000000016560BF9000000024000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/ServiceType#include <Accounts/service-type.h> 07070100000013000081A40000000000000000000000016560BF90000039BC000000000000000000000000000000000000004C00000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/account-service.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2010 Nokia Corporation. * Copyright (C) 2013-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "account-service.h" #include "manager.h" #include "utils.h" #include <QPointer> #include <libaccounts-glib.h> namespace Accounts { /*! * @class AccountService * @headerfile account-service.h Accounts/AccountService * * @brief Account settings for a specific service * * @details The AccountService class provides access to the account settings * for a specific service type. It is meant to be easier to use than the * Account class because it hides the complexity of the account structure and * gives access to only the limited subset of account settings which are * relevant to a service. * * To get an AccountService one can use the Manager methods accountServices() * or enabledAccountServices(), which both return a QList of account services. * Note that if the Manager was instantiated for a specific service type, these * lists will contain only those account services matching that service type. * The AccountService can also be instantiated with its AccountService(Account * *account, Service *service) constructor: this is useful if one already has * an Account instance. * * This is intended to be a convenient wrapper over the accounts settings * specific for a service; as such, it doesn't offer all the editing * possibilities offered by the Account class, such as enabling the service * itself: these operations should ideally not be performed by consumer * applications, but by the account editing UI only. * * Example code: * @code * // Instantiate an account manager interested in e-mail services only. * Accounts::Manager *manager = new Accounts::Manager("e-mail"); * * // Get the list of enabled AccountService objects of type e-mail. * Accounts::AccountServiceList services = manager->enabledAccountServices(); * * // Loop through the account services and do something useful with them. * foreach (Accounts::AccountService service, services) { * QString server = service.value("pop3/hostname").toString(); * int port = service.value("pop3/port").toInt(); * * // Suppose that the e-mail address is stored in the global account * // settings; let's get it from there: * QString fromAddress = service.account()->valueAsString("username"); * * ... * } * @endcode * * @note User applications (with the notable exception of the accounts editing * application) should never use account services which are not enabled, and * should stop using an account when the account service becomes disabled. The * latter can be done by connecting to the changed() signal and checking if * isEnabled() still returns true. * @note Note that if the account gets deleted, it will always get disabled * first; so, there is no need to connect to the Account::removed() signal; one * can just monitor the changed() signal from the AccountService objects. */ /*! * @fn AccountService::enabled(bool isEnabled) * * Emitted when the enabledness state of the account service has changed. */ /*! * @fn AccountService::changed() * Emitted when some setting has changed on the account service. * You can use the changedFields() method to retrieve the list of the * settings which have changed. */ class AccountServicePrivate { Q_DECLARE_PUBLIC(AccountService) public: AccountServicePrivate(Account *account, const Service &service, AccountService *accountService); ~AccountServicePrivate(); private: static void onEnabled(AccountService *accountService, gboolean isEnabled); static void onChanged(AccountService *accountService); ServiceList m_serviceList; AgAccountService *m_accountService; QPointer<Account> m_account; QString prefix; mutable AccountService *q_ptr; }; } // namespace using namespace Accounts; static QChar slash = QChar::fromLatin1('/'); AccountServicePrivate::AccountServicePrivate(Account *account, const Service &service, AccountService *accountService): m_account(account), q_ptr(accountService) { m_accountService = ag_account_service_new(account->account(), service.service()); g_signal_connect_swapped(m_accountService, "enabled", G_CALLBACK(&onEnabled), accountService); g_signal_connect_swapped(m_accountService, "changed", G_CALLBACK(&onChanged), accountService); } AccountServicePrivate::~AccountServicePrivate() { Q_Q(AccountService); g_signal_handlers_disconnect_by_func(m_accountService, (void *)&onEnabled, q); g_signal_handlers_disconnect_by_func(m_accountService, (void *)&onChanged, q); g_object_unref(m_accountService); m_accountService = nullptr; } void AccountServicePrivate::onEnabled(AccountService *accountService, gboolean isEnabled) { Q_EMIT accountService->enabled(isEnabled); } void AccountServicePrivate::onChanged(AccountService *accountService) { Q_EMIT accountService->changed(); } /*! * Constructor. * @param account An Account. * @param service A Service supported by the account. */ AccountService::AccountService(Account *account, const Service &service): QObject(nullptr), d_ptr(new AccountServicePrivate(account, service, this)) { } /*! * Constructor. * @param account An Account. * @param service A Service supported by the account. * @param parent The parent object. */ AccountService::AccountService(Account *account, const Service &service, QObject *parent): QObject(parent), d_ptr(new AccountServicePrivate(account, service, this)) { } /*! * Destructor. */ AccountService::~AccountService() { delete d_ptr; } /*! * Return the Account. Do not delete this object explicitly. */ Account *AccountService::account() const { Q_D(const AccountService); return d->m_account; } /*! * Return the Service. */ Service AccountService::service() const { Q_D(const AccountService); AgService *service = ag_account_service_get_service(d->m_accountService); return Service(service); } /*! * Check whether the account service is enabled. * @note this is just a wrapper of isEnabled * @see isEnabled() * @deprecated use isEnabled instead */ bool AccountService::enabled() const { return isEnabled(); } /*! * Check whether the account service is enabled. */ bool AccountService::isEnabled() const { Q_D(const AccountService); return ag_account_service_get_enabled(d->m_accountService); } /*! * Return all the keys in the current group. */ QStringList AccountService::allKeys() const { Q_D(const AccountService); QStringList allKeys; AgAccountSettingIter iter; const gchar *key; GVariant *val; /* iterate the settings */ QByteArray tmp = d->prefix.toLatin1(); ag_account_service_settings_iter_init(d->m_accountService, &iter, tmp.constData()); while (ag_account_settings_iter_get_next(&iter, &key, &val)) { allKeys.append(ASCII(key)); } return allKeys; } /*! * Enter a group. This method never fails. * @param prefix */ void AccountService::beginGroup(const QString &prefix) { Q_D(AccountService); d->prefix += prefix + slash; } /*! * Return all the groups which are direct children of the current group. */ QStringList AccountService::childGroups() const { QStringList groups, all_keys; all_keys = allKeys(); Q_FOREACH (const QString &key, all_keys) { if (key.contains(slash)) { QString group = key.section(slash, 0, 0); if (!groups.contains(group)) groups.append(group); } } return groups; } /*! * Return all the keys which are direct children of the current group. */ QStringList AccountService::childKeys() const { QStringList keys, all_keys; all_keys = allKeys(); Q_FOREACH (const QString &key, all_keys) { if (!key.contains(slash)) keys.append(key); } return keys; } /*! * Remove all the keys. * @see remove(const QString &key) */ void AccountService::clear() { Q_D(AccountService); /* clear() must ignore the group: so, temporarily reset it and call * remove("") */ QString saved_prefix = d->prefix; d->prefix = QString(); remove(QString()); d->prefix = saved_prefix; } /*! * Check whether the given key is in the current group. * @param key The key name of the setting. */ bool AccountService::contains(const QString &key) const { return childKeys().contains(key); } /*! * Exit a group. */ void AccountService::endGroup() { Q_D(AccountService); d->prefix = d->prefix.section(slash, 0, -3, QString::SectionIncludeTrailingSep); if (!d->prefix.isEmpty() && d->prefix[0] == slash) d->prefix.remove(0, 1); } /*! * Return the name of the current group. */ QString AccountService::group() const { Q_D(const AccountService); if (d->prefix.endsWith(slash)) return d->prefix.left(d->prefix.size() - 1); return d->prefix; } /*! * Remove the given key. If the key is the empty string, all keys in the * current group are removed. * @param key The key name of the setting. */ void AccountService::remove(const QString &key) { Q_D(AccountService); if (key.isEmpty()) { /* delete all keys in the group */ QStringList keys = allKeys(); Q_FOREACH (const QString &key, keys) { if (!key.isEmpty()) remove(key); } } else { QString full_key = d->prefix + key; QByteArray tmpkey = full_key.toLatin1(); ag_account_service_set_variant(d->m_accountService, tmpkey.constData(), NULL); } } /*! * Change the value of an account setting. * @param key The name of the setting. * @param value The new value of the setting. */ void AccountService::setValue(const QString &key, const QVariant &value) { Q_D(AccountService); GVariant *variant = qVariantToGVariant(value); if (variant == nullptr) { return; } QString full_key = d->prefix + key; QByteArray tmpkey = full_key.toLatin1(); ag_account_service_set_variant(d->m_accountService, tmpkey.constData(), variant); } void AccountService::setValue(const char *key, const QVariant &value) { setValue(ASCII(key), value); } /*! * Retrieves the value of an account setting, as a QVariant. * @param key The key whose value must be retrieved. * @param defaultValue Value returned if the key is unset. * @param source Indicates whether the value comes from the account, the * service template or was unset. * * @return The value associated to \a key. * * This method operates on the currently selected service. */ QVariant AccountService::value(const QString &key, const QVariant &defaultValue, SettingSource *source) const { Q_D(const AccountService); QString full_key = d->prefix + key; QByteArray ba = full_key.toLatin1(); AgSettingSource settingSource; GVariant *variant = ag_account_service_get_variant(d->m_accountService, ba.constData(), &settingSource); if (source != nullptr) { switch (settingSource) { case AG_SETTING_SOURCE_ACCOUNT: *source = ACCOUNT; break; case AG_SETTING_SOURCE_PROFILE: *source = TEMPLATE; break; default: *source = NONE; break; } } return (variant != nullptr) ? gVariantToQVariant(variant) : defaultValue; } /*! * Retrieves the value of an account setting. * @param key The key whose value must be retrieved * @param source Indicates whether the value comes from the account, the * service template or was unset. * * Returns the value of the setting, or an invalid QVariant if unset. */ QVariant AccountService::value(const QString &key, SettingSource *source) const { return value(key, QVariant(), source); } QVariant AccountService::value(const char *key, SettingSource *source) const { return value(ASCII(key), source); } /*! * This method should be called only in the context of a handler of the * AccountService::changed() signal, and can be used to retrieve the set of * changes. * * @return a QStringList of the keys which have changed. */ QStringList AccountService::changedFields() const { Q_D(const AccountService); gchar **changedFields = ag_account_service_get_changed_fields(d->m_accountService); QStringList keyList; if (changedFields == nullptr) return keyList; gchar **keys = changedFields; while (*keys != nullptr) { keyList.append(QString(ASCII(*keys))); keys++; } g_strfreev(changedFields); return keyList; } /*! * Read the authentication data stored in the account (merging the * service-specific settings with the global account settings). * The method and mechanism are read from the "auth/method" and * "auth/mechanism" keys, respectively. The authentication parameters are * found under the "auth/<method>/<mechanism>/" group. * * @return an AuthData object, describing the authentication settings. */ AuthData AccountService::authData() const { Q_D(const AccountService); AgAuthData *agAuthData = ag_account_service_get_auth_data(d->m_accountService); AuthData authData(agAuthData); ag_auth_data_unref(agAuthData); return authData; } 07070100000014000081A40000000000000000000000016560BF9000000A52000000000000000000000000000000000000004A00000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/account-service.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef ACCOUNTS_ACCOUNT_SERVICE_H #define ACCOUNTS_ACCOUNT_SERVICE_H #include <QObject> #include <QStringList> #include "Accounts/account.h" #include "Accounts/auth-data.h" namespace Accounts { class Manager; class Service; class AccountServicePrivate; class ACCOUNTS_EXPORT AccountService: public QObject { Q_OBJECT public: explicit AccountService(Account *account, const Service &service); explicit AccountService(Account *account, const Service &service, QObject *parent); virtual ~AccountService(); Account *account() const; Service service() const; bool enabled() const; bool isEnabled() const; QStringList allKeys() const; void beginGroup(const QString &prefix); QStringList childGroups() const; QStringList childKeys() const; void clear(); bool contains(const QString &key) const; void endGroup(); QString group() const; void remove(const QString &key); void setValue(const char *key, const QVariant &value); void setValue(const QString &key, const QVariant &value); QVariant value(const QString &key, const QVariant &defaultValue, SettingSource *source = nullptr) const; QVariant value(const QString &key, SettingSource *source = nullptr) const; QVariant value(const char *key, SettingSource *source = nullptr) const; QStringList changedFields() const; AuthData authData() const; Q_SIGNALS: void enabled(bool isEnabled); void changed(); private: // Don't include private data in docs: \cond AccountServicePrivate *d_ptr; Q_DECLARE_PRIVATE(AccountService) // \endcond }; typedef QList<AccountService*> AccountServiceList; } //namespace #endif // ACCOUNTS_ACCOUNT_SERVICE_H 07070100000015000081A40000000000000000000000016560BF90000067DA000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/account.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "account.h" #include "manager.h" #include "manager_p.h" #include "utils.h" #include <QPointer> #include <libaccounts-glib.h> namespace Accounts { /*! * @class Watch * @headerfile account.h Accounts/Account * * @brief Monitors an account key or group of keys. * * @details A watch is created via the Account::watch method and is a simple * object which will emit the notify() signal when the value of the key (or * group) that it is monitoring is changed. */ /*! * @class Account * @headerfile account.h Accounts/Account * * @brief The Account class provides an interface to account settings. * * @details The Account class is used to access the account and service settings. * This class has no constructor, therefore to instantiate one Account object * one has to either use the Manager::createAccount method (to create a new * empty account) or Manager::account (to load an existing account). * * @attention Do not call setParent() on an account object; the Account class * assumes that the parent is always the Manager, and changing it will have * unpredictable results. * * Most of the methods in the Account class act on the selected service: for * example, calling setEnabled(false) on the NULL service (this is the service * to be used for changing settings globally on the account) will disable the * account, while the code * \code * account->selectService(myService); * account->setEnabled(false); * \endcode * will disable the "myService" service. * * All changes made on an account (including deletion) are not stored until * sync() is called. */ class Account::Private { public: Private(Manager *manager, const QString &providerName, Account *account); Private(Manager *manager, AgAccount *agAccount); ~Private() { g_cancellable_cancel(m_cancellable); g_object_unref(m_cancellable); m_cancellable = NULL; } void init(Account *account); QPointer<Manager> m_manager; AgAccount *m_account; //real account GCancellable *m_cancellable; QString prefix; static void on_display_name_changed(Account *self); static void on_enabled(Account *self, const gchar *service_name, gboolean enabled); static void account_store_cb(AgAccount *account, GAsyncResult *res, Account *self); static void on_deleted(Account *self); }; class Watch::Private { public: static void account_notify_cb(AgAccount *account, const gchar *key, Watch *self); }; } //namespace Accounts using namespace Accounts; static QChar slash = QChar::fromLatin1('/'); /*! * @fn Watch::notify(const char *key) * * Emitted when the value of the keys monitored by this watch change. * @param key The string that was used to create this watch. Note that if * this watch is monitor multiple keys this param only identifies their * common prefix, and not the actual key being changed. */ Watch::Watch(QObject *parent): QObject(parent) { } Watch::~Watch() { Account *account = qobject_cast<Account *>(QObject::parent()); /* The destructor of Account deletes the child Watches before detaching * them, so here account should always be not NULL */ Q_ASSERT(account != NULL); ag_account_remove_watch(account->d->m_account, watch); } Account::Private::Private(Manager *manager, const QString &providerName, Account *account): m_manager(manager), m_cancellable(g_cancellable_new()) { m_account = ag_manager_create_account(manager->d->m_manager, providerName.toUtf8().constData()); init(account); } Account::Private::Private(Manager *manager, AgAccount *agAccount): m_manager(manager), m_account(agAccount), m_cancellable(g_cancellable_new()) { } void Account::Private::init(Account *account) { if (m_account == nullptr) return; g_signal_connect_swapped(m_account, "display-name-changed", G_CALLBACK(&Private::on_display_name_changed), account); g_signal_connect_swapped(m_account, "enabled", G_CALLBACK(&Private::on_enabled), account); g_signal_connect_swapped(m_account, "deleted", G_CALLBACK(&Private::on_deleted), account); } void Account::Private::on_display_name_changed(Account *self) { const gchar *name = ag_account_get_display_name(self->d->m_account); Q_EMIT self->displayNameChanged(UTF8(name)); } void Account::Private::on_enabled(Account *self, const gchar *service_name, gboolean enabled) { Q_EMIT self->enabledChanged(UTF8(service_name), enabled); } void Account::Private::on_deleted(Account *self) { Q_EMIT self->removed(); } /*! * @fn Account::error(Accounts::Error error) * * Emitted when an error occurs. */ /*! * Constructs a new Account. The account exists only in memory and is not * visible to other applications (or Manager instances) until sync() has been * called. * @param manager The account manager. Do not destroy it while the account * object is in use. * @param providerName Name of the provider for the account. * @param parent Parent object. */ Account::Account(Manager *manager, const QString &providerName, QObject *parent): QObject(parent), d(new Private(manager, providerName, this)) { } Account::Account(Private *d, QObject *parent): QObject(parent), d(d) { d->init(this); } /*! * Constructs an Account object representing an account stored in the database. * @param manager The account manager. Do not destroy it while the account * object is in use. * @param id The numeric identifier of the account. * @param parent Parent object. * * @return A new account object, or 0 if an error occurred. */ Account *Account::fromId(Manager *manager, AccountId id, QObject *parent) { GError *error = nullptr; AgAccount *account = ag_manager_load_account(manager->d->m_manager, id, &error); if (account == nullptr) { Q_ASSERT(error != nullptr); manager->d->lastError = Error(error); g_error_free(error); return 0; } Q_ASSERT(error == nullptr); return new Account(new Private(manager, account), parent); } /*! * Destroys the current account object and free all resources. */ Account::~Account() { QObjectList list = children(); for (int i = 0; i < list.count(); i++) { QObject *o = list.at(i); if (qobject_cast<Watch *>(o)) delete o; } g_signal_handlers_disconnect_by_func (d->m_account, (void *)&Private::on_display_name_changed, this); g_signal_handlers_disconnect_by_func (d->m_account, (void *)&Private::on_enabled, this); g_signal_handlers_disconnect_by_func (d->m_account, (void *)&Private::on_deleted, this); g_object_unref(d->m_account); delete d; d = nullptr; } /*! * Returns the AccountId of this account (0 if the account has not yet been * stored into the database). */ AccountId Account::id() const { return d->m_account ? d->m_account->id : 0; } /*! * Returns the Manager. */ Manager *Account::manager() const { return d->m_manager; } /*! * Checks whether the account supports the given service. */ bool Account::supportsService(const QString &serviceType) const { return ag_account_supports_service(d->m_account, serviceType.toUtf8().constData()); } /*! * Returns a list of services supported by this account. If the manager was * constructed with given service type only the services which supports the * service type will be returned. * * This is currently computed by returning all services having the same * provider as the account. */ ServiceList Account::services(const QString &serviceType) const { GList *list; if (serviceType.isEmpty()) { list = ag_account_list_services(d->m_account); } else { list = ag_account_list_services_by_type(d->m_account, serviceType.toUtf8().constData()); } /* convert glist -> ServiceList */ ServiceList servList; GList *iter; for (iter = list; iter; iter = iter->next) { AgService *service = (AgService*)iter->data; servList.append(Service(service, StealReference)); } g_list_free(list); return servList; } /*! * Returns a list of enabled services supported by this account. If the manager * was constructed with given service type only the services which supports the * service type will be returned. */ ServiceList Account::enabledServices() const { GList *list; list = ag_account_list_enabled_services(d->m_account); /* convert glist -> ServiceList */ ServiceList servList; GList *iter; for (iter = list; iter; iter = g_list_next(iter)) { AgService *service = (AgService*)iter->data; servList.append(Service(service, StealReference)); } g_list_free(list); return servList; } /*! * Checks whether the account or selected service is enabled. * * This method operates on the currently selected service or * globally, if none selected. * * @note this is just a wrapper of isEnabled * @see isEnabled() * @deprecated use isEnabled instead */ bool Account::enabled() const { return isEnabled(); } /*! * Checks whether the account or selected service is enabled. * * This method operates on the currently selected service or * globally, if none selected. */ bool Account::isEnabled() const { return ag_account_get_enabled(d->m_account); } /*! * Enables/disables the account or selected service. * The change will be written only when sync() is called. * * This method operates on the currently selected service or * globally, if none selected. */ void Account::setEnabled(bool enabled) { ag_account_set_enabled(d->m_account, enabled); } /*! * Returns the display name of the account. * * This method operates on the currently selected service. */ QString Account::displayName() const { return UTF8(ag_account_get_display_name(d->m_account)); } /*! * Changes the display name of the account. * The change will be written only when sync() is called. */ void Account::setDisplayName(const QString &displayName) { ag_account_set_display_name(d->m_account, displayName.toUtf8().constData()); } /*! * Returns the name of the provider of the account. */ QString Account::providerName() const { return UTF8(ag_account_get_provider_name(d->m_account)); } /*! * Returns the provider of the account. */ Provider Account::provider() const { return manager()->provider(providerName()); } /*! * Select the Service for the subsequent operations. * @param service The Service to select. If this is invalid, the global * account settings will be selected. */ void Account::selectService(const Service &service) { AgService *agService = NULL; if (service.isValid()) agService = service.service(); ag_account_select_service(d->m_account, agService); d->prefix = QString(); } /*! * @return The currently selected service. */ Service Account::selectedService() const { AgService *agService = ag_account_get_selected_service(d->m_account); return Service(agService); } /*! * Returns all keys in the current group. * * This method operates on the currently selected service. */ QStringList Account::allKeys() const { QStringList allKeys; AgAccountSettingIter iter; const gchar *key; GVariant *val; /* iterate the settings */ QByteArray tmp = d->prefix.toLatin1(); ag_account_settings_iter_init(d->m_account, &iter, tmp.constData()); while (ag_account_settings_iter_get_next(&iter, &key, &val)) { allKeys.append(QString(ASCII(key))); } return allKeys; } /*! * Enters a group. This method never fails. * @param prefix * * This method operates on the currently selected service. */ void Account::beginGroup(const QString &prefix) { d->prefix += prefix + slash; } /*! * Returns all the groups which are direct children of the current group. * * This method operates on the currently selected service. */ QStringList Account::childGroups() const { QStringList groups, all_keys; all_keys = allKeys(); Q_FOREACH (const QString &key, all_keys) { if (key.contains(slash)) { QString group = key.section(slash, 0, 0); if (!groups.contains(group)) groups.append(group); } } return groups; } /*! * Return all the keys which are direct children of the current group. * * This method operates on the currently selected service. */ QStringList Account::childKeys() const { QStringList keys, all_keys; all_keys = allKeys(); Q_FOREACH (const QString &key, all_keys) { if (!key.contains(slash)) keys.append(key); } return keys; } /*! * Removes all the keys in the currently selected service. * @see remove(const QString &key) */ void Account::clear() { /* clear() must ignore the group: so, temporarily reset it and call * remove("") */ QString saved_prefix = d->prefix; d->prefix = QString(); remove(QString()); d->prefix = saved_prefix; } /*! * Checks whether the given key is in the current group. * @param key The key name of the settings. * * This method operates on the currently selected service. */ bool Account::contains(const QString &key) const { return childKeys().contains(key); } /*! * Exits a group. * * This method operates on the currently selected service. */ void Account::endGroup() { d->prefix = d->prefix.section(slash, 0, -3, QString::SectionIncludeTrailingSep); if (!d->prefix.isEmpty() && d->prefix[0] == slash) d->prefix.remove(0, 1); } /*! * Returns the name of the current group. * * This method operates on the currently selected service. */ QString Account::group() const { if (d->prefix.endsWith(slash)) return d->prefix.left(d->prefix.size() - 1); return d->prefix; } /*! * Checks whether the account is writable. This always returns true. */ bool Account::isWritable() const { return true; } /*! * Removes the given key. If the key is the empty string, all keys in the * current group are removed. * @param key The key name of the settings. * * This method operates on the currently selected service. */ void Account::remove(const QString &key) { if (key.isEmpty()) { /* delete all keys in the group */ QStringList keys = allKeys(); Q_FOREACH (const QString &key, keys) { if (!key.isEmpty()) remove(key); } } else { QString full_key = d->prefix + key; QByteArray tmpkey = full_key.toLatin1(); ag_account_set_variant(d->m_account, tmpkey.constData(), NULL); } } /*! * Changes the value of an account setting. * @param key The key name of the setting. * @param value The new value. * * This method operates on the currently selected service. */ void Account::setValue(const QString &key, const QVariant &value) { GVariant *variant = qVariantToGVariant(value); if (variant == nullptr) { return; } QString full_key = d->prefix + key; QByteArray tmpkey = full_key.toLatin1(); ag_account_set_variant(d->m_account, tmpkey.constData(), variant); } void Account::Private::account_store_cb(AgAccount *account, GAsyncResult *res, Account *self) { GError *error = NULL; ag_account_store_finish(account, res, &error); if (error) { if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED) { } else { Q_EMIT self->error(Error(error)); } g_error_free(error); } else { Q_EMIT self->synced(); } } /*! * Retrieves the value of an account setting, as a QVariant. * @param key The key whose value must be retrieved. * @param defaultValue Value returned if the key is unset. * @param source Indicates whether the value comes from the account, the * service template or was unset. * @see valueAsString * @see valueAsInt * @see valueAsBool * * @return The value associated to \a key. * * This method operates on the currently selected service. */ QVariant Account::value(const QString &key, const QVariant &defaultValue, SettingSource *source) const { QString full_key = d->prefix + key; QByteArray ba = full_key.toLatin1(); AgSettingSource settingSource; GVariant *variant = ag_account_get_variant(d->m_account, ba.constData(), &settingSource); if (source != nullptr) { switch (settingSource) { case AG_SETTING_SOURCE_ACCOUNT: *source = ACCOUNT; break; case AG_SETTING_SOURCE_PROFILE: *source = TEMPLATE; break; default: *source = NONE; break; } } return (variant != nullptr) ? gVariantToQVariant(variant) : defaultValue; } /*! * Retrieves the value of an account setting, as a QVariant. * @param key The key whose value must be retrieved. * @param value A QVariant initialized to the expected type of the value. * @see valueAsString * @see valueAsInt * @see valueAsBool * * @return Whether the value comes from the account, the service template * or was unset. * * This method operates on the currently selected service. * @deprecated Use value(const QString &key, const QVariant &defaultValue, * SettingSource *source) const instead. */ SettingSource Account::value(const QString &key, QVariant &value) const { SettingSource source; QVariant variant = this->value(key, QVariant(), &source); if (variant.isValid()) { if (value.type() != variant.type()) { if (!variant.convert(value.type())) source = NONE; } value = variant; } return source; } /*! * Gets an account setting as a string. * @param key The key whose value must be retrieved. * @param default_value Value returned if the key is unset. * @param source Indicates whether the value comes from the account, the * service template or was unset. * * This method operates on the currently selected service. */ QString Account::valueAsString(const QString &key, QString default_value, SettingSource *source) const { QVariant var = default_value; SettingSource src = value(key, var); if (source) *source = src; return var.toString(); } /*! * Gets an account setting as an integer. * @param key The key whose value must be retrieved. * @param default_value Value returned if the key is unset. * @param source Indicates whether the value comes from the account, the * service template or was unset. * * This method operates on the currently selected service. */ int Account::valueAsInt(const QString &key, int default_value, SettingSource *source) const { QVariant var = default_value; SettingSource src = value(key, var); if (source) *source = src; return var.toInt(); } /*! * Gets an account setting as an unsigned long integer. * @param key The key of which value must be retrieved. * @param default_value Value returned if the key is unset. * @param source Indicates whether the value comes from the account, the * service template or was unset. * * This method operates on the currently selected service. */ quint64 Account::valueAsUInt64(const QString &key, quint64 default_value, SettingSource *source) const { QVariant var = default_value; SettingSource src = value(key, var); if (source) *source = src; return var.toULongLong(); } /*! * Gets an account setting as a boolean. * @param key The key whose value must be retrieved. * @param default_value Value returned if the key is unset. * @param source Indicates whether the value comes from the account, the * service template or was unset. * * This method operates on the currently selected service. */ bool Account::valueAsBool(const QString &key, bool default_value, SettingSource *source) const { QVariant var = default_value; SettingSource src = value(key, var); if (source) *source = src; return var.toBool(); } void Watch::Private::account_notify_cb(AgAccount *account, const gchar *key, Watch *watch) { Q_EMIT watch->notify(key); Q_UNUSED(account); } /*! * Installs a key or group watch. * * @param key The key to watch; if %NULL, watches the currently selected * group. * * @return A watch object. * * This method operates on the currently selected service. */ Watch *Account::watchKey(const QString &key) { AgAccountWatch ag_watch; Watch *watch = new Watch(this); if (!key.isEmpty()) { QString full_key = d->prefix + key; ag_watch = ag_account_watch_key (d->m_account, full_key.toLatin1().constData(), (AgAccountNotifyCb)&Watch::Private::account_notify_cb, watch); } else { ag_watch = ag_account_watch_dir (d->m_account, d->prefix.toLatin1().constData(), (AgAccountNotifyCb)&Watch::Private::account_notify_cb, watch); } if (!ag_watch) { delete watch; return NULL; } watch->setWatch(ag_watch); return watch; } /*! * Stores all account settings into the database. * The signal synced() will be emitted in case of success, or * error() in case of failure. No assumption must be made about when these * signals will be emitted: if the database is locked, the signals might * be emitted asynchronously, whereas if the operation can happen * synchronously then the signals can be emitted before this method * returns. * If for some reason one would want to process the signals asynchronously * from the event loop, one can use the Qt::QueuedConnection connection * type as last parameter of the QObject::connect call. */ void Account::sync() { ag_account_store_async(d->m_account, d->m_cancellable, (GAsyncReadyCallback)&Private::account_store_cb, this); } /*! * Blocking version of the sync() method: execution of the current thread * will block until the operation has completed. * Usage of this method is discouraged, especially for UI applications. * * @return True on success, false otherwise. */ bool Account::syncAndBlock() { GError *error = NULL; bool ret; ret = ag_account_store_blocking(d->m_account, &error); if (error) { qWarning() << "Store operation failed: " << error->message; g_error_free(error); } return ret; } /*! * Marks the account for removal. * The account will be deleted only when the sync() method is called. */ void Account::remove() { ag_account_delete(d->m_account); } /*! * Creates signature of key with given aegis token. The calling application * must possess (request) the given aegis token. The account needs to be * stored prior to executing this method. * @param key The key or the prefix of set of the keys to be signed. * @param token The aegis token to be used for signing the key. * * This method operates on the currently selected service. */ void Account::sign(const QString &key, const char *token) { ag_account_sign (d->m_account, key.toUtf8().constData(), token); } /*! * Verifies if the key is signed and the signature matches the value * and provides the aegis token which was used for signing the key. * * @param key The name of the key or prefix of the keys to be verified. * @param token Aegis token to be retrieved. * * @return True if the key is signed and the signature matches the value. * * This method operates on the currently selected service. */ bool Account::verify(const QString &key, const char **token) { return ag_account_verify(d->m_account, key.toUtf8().constData(), token); } /*! * Verifies if the key is signed with any of the aegis tokens and the * signature is valid. * * @param key The name of the key or prefix of the keys to be verified. * @param tokens Array of aegis tokens. * * @return True if the key is signed with any of the aegis tokens and * the signature is valid. * * This method operates on the currently selected service. */ bool Account::verifyWithTokens(const QString &key, QList<const char*> tokens) { int tokensCount = tokens.count(); const char *tmp[tokensCount + 1]; for (int i = 0; i < tokensCount; ++i) { tmp[i] = tokens.at(i); } tmp[tokensCount] = NULL; return ag_account_verify_with_tokens(d->m_account, key.toUtf8().constData(), tmp); } uint Account::credentialsId() { QString key = ACCOUNTS_KEY_CREDENTIALS_ID; QVariant val(QVariant::Int); if (value(key, val) != NONE) return val.toUInt(); uint id = 0; Service service = selectedService(); if (service.isValid()) { selectService(); if (value(key, val) != NONE) id = val.toUInt(); selectService(service); } return id; } AgAccount *Account::account() { return d->m_account; } 07070100000016000081A40000000000000000000000016560BF90000016F4000000000000000000000000000000000000004200000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/account.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /*! * @copyright Copyright (C) 2009-2011 Nokia Corporation. * @license LGPL */ #ifndef ACCOUNTS_ACCOUNT_H #define ACCOUNTS_ACCOUNT_H #include "Accounts/accountscommon.h" #include "Accounts/error.h" #include "Accounts/service.h" #define ACCOUNTS_KEY_CREDENTIALS_ID QStringLiteral("CredentialsId") #include <QObject> #include <QStringList> #include <QVariant> extern "C" { typedef struct _AgAccount AgAccount; typedef struct _AgAccountWatch *AgAccountWatch; } /*! * @namespace Accounts */ namespace Accounts { typedef quint32 AccountId; typedef QList<AccountId> AccountIdList; class Manager; class Provider; class AccountServicePrivate; /*! * Tells the origin of an account setting: whether it was set on the account, * or is it a default value in the service template, or whether it is unset. */ enum SettingSource { NONE, ACCOUNT, TEMPLATE }; class ACCOUNTS_EXPORT Watch: public QObject { Q_OBJECT public: /* We don't want to document these. * \cond */ Watch(QObject *parent = nullptr); ~Watch(); void setWatch(AgAccountWatch w) { watch = w; }; class Private; // \endcond Q_SIGNALS: void notify(const char *key); // \cond private: AgAccountWatch watch; friend class Private; // \endcond }; class ACCOUNTS_EXPORT Account: public QObject { Q_OBJECT public: Account(Manager *manager, const QString &provider, QObject *parent = nullptr); virtual ~Account(); static Account *fromId(Manager *manager, AccountId id, QObject *parent = nullptr); AccountId id() const; Manager *manager() const; bool supportsService(const QString &serviceType) const; ServiceList services(const QString &serviceType = QString()) const; ServiceList enabledServices() const; bool enabled() const; bool isEnabled() const; void setEnabled(bool); /*! * Gets the account's credentials ID in Signon database. * * The credentials ID is first read from the currently selected service; * if it is not found, then it is ready from the global account settings. * In any case, the currently selected service is not altered. */ uint credentialsId(); /*! * Sets the accounts credentials ID. * The change will be written only when sync() is called. * * This method operates on the currently selected service. */ void setCredentialsId(const uint id) { setValue(ACCOUNTS_KEY_CREDENTIALS_ID, id); } QString displayName() const; void setDisplayName(const QString &displayName); QString providerName() const; Provider provider() const; void selectService(const Service &service = Service()); Service selectedService() const; /* QSettings-like methods */ QStringList allKeys() const; void beginGroup(const QString &prefix); QStringList childGroups() const; QStringList childKeys() const; void clear(); bool contains(const QString &key) const; void endGroup(); QString group() const; bool isWritable() const; void remove(const QString &key); void setValue(const QString &key, const QVariant &value); QVariant value(const QString &key, const QVariant &defaultValue = QVariant(), SettingSource *source = nullptr) const; SettingSource value(const QString &key, QVariant &value) const; QString valueAsString(const QString &key, QString default_value = QString(), SettingSource *source = nullptr) const; int valueAsInt(const QString &key, int default_value = 0, SettingSource *source = nullptr) const; quint64 valueAsUInt64(const QString &key, quint64 default_value = 0, SettingSource *source = nullptr) const; bool valueAsBool(const QString &key, bool default_value = false, SettingSource *source = nullptr) const; Watch *watchKey(const QString &key = QString()); void sync(); bool syncAndBlock(); void remove(); void sign(const QString &key, const char *token); bool verify(const QString &key, const char **token); bool verifyWithTokens(const QString &key, QList<const char*> tokens); Q_SIGNALS: void displayNameChanged(const QString &displayName); void enabledChanged(const QString &serviceName, bool enabled); void error(Accounts::Error error); void synced(); void removed(); private: AgAccount *account(); // Don't include private data in docs: \cond class Private; Account(Private *d, QObject *parent = nullptr); friend class Manager; friend class Account::Private; friend class Watch; friend class AccountService; friend class AccountServicePrivate; Private *d; // \endcond }; } //namespace Accounts #endif // ACCOUNTS_ACCOUNT_H 07070100000017000081A40000000000000000000000016560BF90000001B5000000000000000000000000000000000000004B00000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/accounts-qt5.pc.inprefix=$$INSTALL_PREFIX exec_prefix=${prefix} libdir=$$INSTALL_LIBDIR includedir=${prefix}/include/accounts-qt5 servicefilesdir=${prefix}/share/accounts/services servicetypefilesdir=${prefix}/share/accounts/service-types providerfilesdir=${prefix}/share/accounts/providers Name: libaccounts-qt5 Description: Accounts Library Version: $$PROJECT_VERSION Libs: -L${libdir} -laccounts-qt5 Requires: Qt5Core Qt5Xml Cflags: -I${includedir} 07070100000018000081A40000000000000000000000016560BF90000001B5000000000000000000000000000000000000004B00000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/accounts-qt6.pc.inprefix=$$INSTALL_PREFIX exec_prefix=${prefix} libdir=$$INSTALL_LIBDIR includedir=${prefix}/include/accounts-qt6 servicefilesdir=${prefix}/share/accounts/services servicetypefilesdir=${prefix}/share/accounts/service-types providerfilesdir=${prefix}/share/accounts/providers Name: libaccounts-qt6 Description: Accounts Library Version: $$PROJECT_VERSION Libs: -L${libdir} -laccounts-qt6 Requires: Qt6Core Qt6Xml Cflags: -I${includedir} 07070100000019000081A40000000000000000000000016560BF9000000649000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/accountscommon.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /*! * @copyright Copyright (C) 2009-2011 Nokia Corporation. * @license LGPL */ #ifndef ACCOUNTSCOMMON_H_ #define ACCOUNTSCOMMON_H_ #ifdef BUILDING_ACCOUNTS_QT #include <QDebug> // String conversion #ifdef ASCII #undef ASCII #endif #define ASCII(s) QLatin1String(s) #ifdef UTF8 #undef UTF8 #endif #define UTF8(s) QString::fromUtf8(s) // Symbol visibility #if __GNUC__ >= 4 #define ACCOUNTS_EXPORT __attribute__ ((visibility("default"))) #endif #endif // BUILDING_ACCOUNTS_QT #ifndef ACCOUNTS_EXPORT #define ACCOUNTS_EXPORT #endif namespace Accounts { enum ReferenceMode { AddReference = 0, StealReference, }; } // namespace #endif /* ACCOUNTSCOMMON_H_ */ 0707010000001A000081A40000000000000000000000016560BF900000156F000000000000000000000000000000000000004800000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/application.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "application.h" #include "service.h" #undef signals #include <libaccounts-glib.h> using namespace Accounts; namespace Accounts { /*! * @class Application * @headerfile application.h Accounts/Application * * @brief Information on the client applications of libaccounts. * * @details The Application structure holds information on the client * applications registered with libaccounts. * It is instantiated by Manager::application() and Manager::applicationList(). */ }; // namespace Application::Application(AgApplication *application): m_application(application) { } /*! * Construct an invalid application. */ Application::Application(): m_application(nullptr) { } /*! * Copy constructor. Copying an Application object is very cheap, because the * data is shared among copies. */ Application::Application(const Application &other): m_application(other.m_application) { if (m_application != nullptr) ag_application_ref(m_application); } Application &Application::operator=(const Application &other) { if (m_application == other.m_application) return *this; if (m_application != nullptr) ag_application_unref(m_application); m_application = other.m_application; if (m_application != nullptr) ag_application_ref(m_application); return *this; } /*! * Destructor. */ Application::~Application() { if (m_application != nullptr) { ag_application_unref(m_application); m_application = nullptr; } } /*! * Check whether this object represents an Application. * @return true if the Application is a valid one. */ bool Application::isValid() const { return m_application != nullptr; } /*! * Get the unique ID of the application. This is the name of the .application * file minus the .application suffix. * @return The application unique ID. */ QString Application::name() const { if (Q_UNLIKELY(!isValid())) return QString(); return UTF8(ag_application_get_name(m_application)); } /*! * Get the display name of the application. * @return The application display name. */ QString Application::displayName() const { QString name; GDesktopAppInfo *info = ag_application_get_desktop_app_info(m_application); if (Q_LIKELY(info)) { name = UTF8(g_app_info_get_display_name(G_APP_INFO(info))); g_object_unref(info); } return name; } /*! * Get the description of the application. * @return The application description. */ QString Application::description() const { return UTF8(ag_application_get_description(m_application)); } /*! * Get the icon name of the application. * @return The application icon name. */ QString Application::iconName() const { QString iconName; GDesktopAppInfo *info = ag_application_get_desktop_app_info(m_application); if (Q_LIKELY(info)) { gchar *gIconName = g_desktop_app_info_get_string(info, "Icon"); if (Q_LIKELY(gIconName)) { iconName = UTF8(gIconName); g_free(gIconName); } g_object_unref(info); } return iconName; } /*! * Get the .desktop file associated with this application. * @return The full path to the .desktop file. */ QString Application::desktopFilePath() const { QString filePath; GDesktopAppInfo *info = ag_application_get_desktop_app_info(m_application); if (Q_LIKELY(info)) { filePath = UTF8(g_desktop_app_info_get_filename(info)); g_object_unref(info); } return filePath; } /*! * Get the translation catalog for the texts returned by the methods of this * class. * @return The translation catalog name. */ QString Application::trCatalog() const { return UTF8(ag_application_get_i18n_domain(m_application)); } /*! * Check whether the application supports the given service. * @param service Instance of a Service. * @return whether the service is supported by this application. */ bool Application::supportsService(const Service &service) const { return ag_application_supports_service(m_application, service.service()); } /*! * Get the description from the application XML file, for the specified * service; if not found, get the service-type description instead. * @return Usage description of the service. */ QString Application::serviceUsage(const Service &service) const { return UTF8(ag_application_get_service_usage(m_application, service.service())); } AgApplication *Application::application() const { return m_application; } 0707010000001B000081A40000000000000000000000016560BF900000077F000000000000000000000000000000000000004600000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/application.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2012 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef ACCOUNTS_APPLICATION_H #define ACCOUNTS_APPLICATION_H #include "Accounts/accountscommon.h" #include <QString> extern "C" { typedef struct _AgApplication AgApplication; } namespace Accounts { class Service; class ACCOUNTS_EXPORT Application { public: Application(); Application(const Application &other); Application &operator=(const Application &other); ~Application(); bool isValid() const; QString name() const; QString displayName() const; QString description() const; QString iconName() const; QString desktopFilePath() const; QString trCatalog() const; bool supportsService(const Service &service) const; QString serviceUsage(const Service &service) const; private: // Don't include private data in docs: \cond friend class Manager; Application(AgApplication *application); AgApplication *application() const; AgApplication *m_application; // \endcond }; } //namespace #endif // ACCOUNTS_APPLICATION_H 0707010000001C000081A40000000000000000000000016560BF9000000BB4000000000000000000000000000000000000004600000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/auth-data.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "auth-data.h" #include "utils.h" #undef signals #include <libaccounts-glib.h> #include <QtDebug> #include <QtGlobal> using namespace Accounts; namespace Accounts { /*! * @class AuthData * @headerfile auth-data.h Accounts/AuthData * * @brief Information for account authentication. * * @details The AuthData class holds information on the authentication * parameters used by an account. It is an implicitly shared object which can * be created with the AccountService::authData method. */ }; // namespace AuthData::AuthData(AgAuthData *authData): m_authData(ag_auth_data_ref(authData)) { } /*! * Copy constructor. Copying an AuthData object is very cheap, because the data * is shared among copies. */ AuthData::AuthData(const AuthData &other): m_authData(ag_auth_data_ref(other.m_authData)) { } /*! * Destructor. */ AuthData::~AuthData() { ag_auth_data_unref(m_authData); m_authData = nullptr; } /*! * @return The ID of the credentials associated with this account. */ uint AuthData::credentialsId() const { return ag_auth_data_get_credentials_id(m_authData); } /*! * Get the authentication method which must be used when logging in with this * account. * @return The authentication method. */ QString AuthData::method() const { return UTF8(ag_auth_data_get_method(m_authData)); } /*! * Get the authentication mechanism which must be used when logging in with * this account. * @return The authentication mechanism. */ QString AuthData::mechanism() const { return UTF8(ag_auth_data_get_mechanism(m_authData)); } /*! * Get the dictionary of authentication parameters which must be used when * logging in with this account. * @return The authentication parameters. */ QVariantMap AuthData::parameters() const { GVariant *glibParameters; glibParameters = ag_auth_data_get_login_parameters(m_authData, NULL); if (glibParameters == nullptr) return QVariantMap(); QVariant variant = gVariantToQVariant(glibParameters); g_variant_unref(glibParameters); if (!variant.isValid()) return QVariantMap(); return variant.toMap(); } 0707010000001D000081A40000000000000000000000016560BF900000068D000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/auth-data.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /*! * @copyright Copyright (C) 2012 Canonical Ltd. * @license LGPL */ #ifndef ACCOUNTS_AUTH_DATA_H #define ACCOUNTS_AUTH_DATA_H #include "Accounts/accountscommon.h" #include <QString> #include <QVariantMap> extern "C" { typedef struct _AgAuthData AgAuthData; } /*! * @namespace Accounts */ namespace Accounts { class AccountService; class ACCOUNTS_EXPORT AuthData { public: AuthData(const AuthData &other); virtual ~AuthData(); uint credentialsId() const; QString method() const; QString mechanism() const; QVariantMap parameters() const; private: // Don't include private data in docs: \cond friend class AccountService; AuthData(AgAuthData *authData); AgAuthData *m_authData; // \endcond }; } // namespace #endif // ACCOUNTS_AUTH_DATA_H 0707010000001E000081A40000000000000000000000016560BF9000000946000000000000000000000000000000000000004200000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/error.cpp/* * This file is part of libaccounts-qt * * Copyright (C) 2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "error.h" #include <libaccounts-glib.h> namespace Accounts { /*! * @class Error * @headerfile error.h Accounts/Error * @brief Base object definition for accounts error handling. */ Error::Error(const GError *error) { registerType(); if (error == NULL) { m_type = NoError; m_message = QString(); } else { if (error->domain == AG_ERRORS) { switch (error->code) { case AG_ERROR_DB: m_type = Database; break; case AG_ERROR_DELETED: m_type = Deleted; break; case AG_ERROR_DISPOSED: // Should never happen here! qCritical() << Q_FUNC_INFO << "Account object is disposed!"; m_type = Unknown; break; case AG_ERROR_DB_LOCKED: m_type = DatabaseLocked; break; case AG_ERROR_ACCOUNT_NOT_FOUND: m_type = AccountNotFound; break; default: qWarning() << Q_FUNC_INFO << "Unknown error:" << error->code; m_type = Unknown; break; } } else { // The error is coming from another domain; this shouldn't happen qCritical() << Q_FUNC_INFO << "Error is coming from unknown domain"; m_type = Unknown; } m_message = QString::fromUtf8(error->message); } } }; // namespace 0707010000001F000081A40000000000000000000000016560BF9000000C7D000000000000000000000000000000000000004000000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/error.h/* * This file is part of libaccounts-qt * * Copyright (C) 2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /*! * @copyright Copyright (C) 2009-2011 Nokia Corporation. * @license LGPL */ #ifndef ACCOUNTS_ERROR_H #define ACCOUNTS_ERROR_H #include <QMetaType> #include <QString> #include <Accounts/accountscommon.h> extern "C" { typedef struct _GError GError; } namespace Accounts { class ACCOUNTS_EXPORT Error { public: /*! * @enum ErrorType Error codes for all the accounts errors. */ enum ErrorType { NoError = 0, Unknown, Database, /**< Generic database error */ Deleted, /**< The account object refers to an account which has been deleted */ DatabaseLocked, /**< The database is locked */ AccountNotFound, /**< The account couldn't be found */ }; /*! * Basic constructor. */ Error(): m_type(NoError), m_message(QString()) { registerType(); } /*! * Copy constructor * @param src Error object to be copied. */ Error(const Error &src): m_type(src.type()), m_message(src.message()) {} /*! * Constructor. * @param type The error's type. * @param message The error's message. */ Error(ErrorType type, const QString &message = QString()): m_type(type), m_message(message) { registerType(); } /*! * Assignment operator. * @param src The error object to be assigned to this instance. */ Error &operator=(const Error &src) { m_type = src.type(); m_message = src.message(); return *this; } /*! * Destructor. */ virtual ~Error() {} /*! * @return The error's type. */ ErrorType type() const { return m_type; } /*! * @return The error's message. */ QString message() const { return m_message; } private: // Don't include in docs: \cond friend class Account; friend class Manager; Error(const GError *error); inline void registerType(); // \endcond private: // Don't include private data in docs: \cond ErrorType m_type; QString m_message; // \endcond }; } //namespace Q_DECLARE_METATYPE(Accounts::Error) void Accounts::Error::registerType() { qRegisterMetaType<Accounts::Error>("Accounts::Error"); } #endif // ACCOUNTS_ERROR_H 07070100000020000081A40000000000000000000000016560BF900000407C000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/manager.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "application.h" #include "service.h" #include "manager.h" #include "manager_p.h" #include <libaccounts-glib.h> namespace Accounts { /*! * @class Manager * @headerfile manager.h Accounts/Manager * * @brief Manager of accounts, services and providers. * * @details The Manager offers ways to create accounts, list accounts, services * and providers. It also emits signals when accounts are created and removed. */ /*! * @fn Manager::accountCreated(Accounts::AccountId id) * * The signal is emitted when new account is created. * * @param id Identifier of the Account */ /*! * @fn Manager::accountRemoved(Accounts::AccountId id) * * The signal is emitted when existing account is removed. * * @param id Identifier of the Account */ /*! * @fn Manager::accountUpdated(Accounts::AccountId id) * * The signal is emitted when any account property for a particular service is * updated. * * To receive this notification user has to create accounts manager using * Manager(const QString &serviceType, QObject *parent) constructor. * Update notification is only emitted when manager is created for particular * type of service. * * @param id Identifier of the Account */ /*! * @fn Manager::enabledEvent(Accounts::AccountId id) * * If the manager has been created with serviceType, this * signal will be emitted when an account (identified by AccountId) has been * modified in such a way that the application might be interested to * start/stop using it: the "enabled" flag on the account or in some service * supported by the account and matching the AgManager::serviceType have * changed. * @note In practice, this signal might be emitted more often than when * strictly needed; applications must call Account::enabledServices() to get * the current state. * * @param id identifier of the Account */ } //namespace Accounts using namespace Accounts; void Manager::Private::init(Manager *q, AgManager *manager) { Q_ASSERT(q_ptr == nullptr); Q_ASSERT(m_manager == nullptr); q_ptr = q; m_manager = manager; if (manager) { g_signal_connect_swapped (manager, "account-created", G_CALLBACK(&Private::on_account_created), q); g_signal_connect_swapped (manager, "account-deleted", G_CALLBACK(&Private::on_account_deleted), q); g_signal_connect_swapped (manager, "account-updated", G_CALLBACK(&Private::on_account_updated), q); g_signal_connect_swapped (manager, "enabled-event", G_CALLBACK(&Private::on_enabled_event), q); } else { qWarning() << Q_FUNC_INFO << "Initializing with NULL AgManager!"; } } void Manager::Private::on_account_created(Manager *self, AgAccountId id) { Q_EMIT self->accountCreated(id); } void Manager::Private::on_account_deleted(Manager *self, AgAccountId id) { Q_EMIT self->accountRemoved(id); } void Manager::Private::on_account_updated(Manager *self, AgAccountId id) { Q_EMIT self->accountUpdated(id); } void Manager::Private::on_enabled_event(Manager *self, AgAccountId id) { Q_EMIT self->enabledEvent(id); } /*! * Constructor. * Users should check for manager->lastError() to check if manager construction * was fully succesful. */ Manager::Manager(QObject *parent): QObject(parent), d(new Private) { AgManager *manager = ag_manager_new(); if (manager != nullptr) { d->init(this, manager); } else { qWarning() << "Manager could not be created. DB is locked"; d->lastError = Error::DatabaseLocked; } } /*! * Constructs a manager initialized with service type. This constructor * should be used when there is an interest for just one service type. * Such a manager has influence on some class methods. When listing the * accounts and services only the ones supporting the given service type * will be returned. Also the creating account with this manager will * affect the acccount class method for listing services in same manner. * The signal enabledEvent() will be emitted only when manager is created * with this constructor. * Users should check for manager->lastError() to check if manager construction * was fully succesful. */ Manager::Manager(const QString &serviceType, QObject *parent): QObject(parent), d(new Private) { AgManager *manager = ag_manager_new_for_service_type(serviceType.toUtf8().constData()); if (manager != nullptr) { d->init(this, manager); } else { qWarning() << "Manager could not be created, DB is locked"; d->lastError = Error::DatabaseLocked; } } /*! * Constructor, allowing option flags to be specified. * Users should check for lastError() to check if manager construction * was fully succesful. */ Manager::Manager(Options options, QObject *parent): QObject(parent), d(new Private) { bool disableNotifications = options.testFlag(DisableNotifications); GError *error = NULL; AgManager *manager = (AgManager *)g_initable_new(AG_TYPE_MANAGER, NULL, &error, "use-dbus", !disableNotifications, NULL); if (Q_LIKELY(manager)) { d->init(this, manager); } else { qWarning() << "Manager could not be created." << error->message; d->lastError = Error(error); g_error_free(error); } } /*! * Destructor. */ Manager::~Manager() { g_signal_handlers_disconnect_by_func (d->m_manager, (void *)&Private::on_enabled_event, this); g_signal_handlers_disconnect_by_func (d->m_manager, (void *)&Private::on_account_updated, this); g_signal_handlers_disconnect_by_func (d->m_manager, (void *)&Private::on_account_deleted, this); g_signal_handlers_disconnect_by_func (d->m_manager, (void *)&Private::on_account_created, this); g_object_unref(d->m_manager); delete d; d = nullptr; } /*! * Loads an account from the database. * @param id Id of the account to be retrieved. * * @return Requested account or 0 if not found. If 0 is returned, * call lastError() to find out why. * @attention The objects returned by this method are shared, meaning that * calling this method twice with the same id will return the same object. It * is recommended that clients do not destroy the objects returned by this * method, if there's the possibility that they are still being used in other * parts of the application. */ Account *Manager::account(const AccountId &id) const { Account *account = d->m_accounts.value(id, 0); if (account == nullptr) { /* Create a new account object */ account = Account::fromId(const_cast<Manager*>(this), id, const_cast<Manager*>(this)); d->m_accounts[id] = account; } return account; } /*! * Lists the accounts which support the requested service. * * @param serviceType Type of service that returned accounts must support. * If not given and the manager is not constructed with service type, * all accounts are returned. * * @return List of account IDs. */ AccountIdList Manager::accountList(const QString &serviceType) const { GList *list = NULL; if (serviceType.isEmpty()) { list = ag_manager_list(d->m_manager); } else { list = ag_manager_list_by_service_type(d->m_manager, serviceType.toUtf8().constData()); } /* convert glist -> AccountIdList */ AccountIdList idList; GList *iter; for (iter = list; iter; iter = g_list_next(iter)) { idList.append((AccountId)GPOINTER_TO_INT(iter->data)); } ag_manager_list_free(list); return idList; } /*! * Lists the enabled accounts which support the requested service that also * must be enabled. * * @param serviceType Type of service that returned accounts must support. * If not given and the manager is not constructed with service type, * all enabled accounts are returned. * * @return List of account IDs. */ AccountIdList Manager::accountListEnabled(const QString &serviceType) const { GList *list = NULL; if (serviceType.isEmpty()) { list = ag_manager_list_enabled(d->m_manager); } else { list = ag_manager_list_enabled_by_service_type(d->m_manager, serviceType.toUtf8().constData()); } /* convert glist -> AccountIdList */ AccountIdList idList; GList *iter; for (iter = list; iter; iter = g_list_next(iter)) { idList.append((AccountId)GPOINTER_TO_INT(iter->data)); } ag_manager_list_free(list); return idList; } /*! * Creates a new account. * @param providerName Name of account provider. * * @return Created account or NULL if some error occurs. */ Account *Manager::createAccount(const QString &providerName) { return new Account(this, providerName, this); } /*! * Gets an object representing a service. * @param serviceName Name of service to get. * * @return The requested service or an invalid service if not found. */ Service Manager::service(const QString &serviceName) const { AgService *service = ag_manager_get_service(d->m_manager, serviceName.toUtf8().constData()); return Service(service, StealReference); } /*! * Gets the service list. If the manager is constructed with given service type * only the services which supports the service type will be returned. * * @param serviceType Type of services to be listed. If not given and * the manager is not constructed with service type, all * services are listed. * * @return List of Service objects. */ ServiceList Manager::serviceList(const QString &serviceType) const { GList *list; if (serviceType.isEmpty()) { list = ag_manager_list_services(d->m_manager); } else { list = ag_manager_list_services_by_type(d->m_manager, serviceType.toUtf8().constData()); } /* convert glist -> ServiceList */ ServiceList servList; GList *iter; for (iter = list; iter; iter = g_list_next(iter)) { AgService *service = (AgService*)iter->data; servList.append(Service(service, StealReference)); } g_list_free(list); return servList; } /*! * Get the list of services supported by the given application. * * @param application Application whose services are to be retrieved. * * @return List of Service objects. */ ServiceList Manager::serviceList(const Application &application) const { GList *list; list = ag_manager_list_services_by_application(d->m_manager, application.application()); /* convert glist -> ServiceList */ ServiceList servList; GList *iter; for (iter = list; iter; iter = g_list_next(iter)) { AgService *service = (AgService*)iter->data; servList.append(Service(service, StealReference)); } g_list_free(list); return servList; } /*! * Gets an object representing a provider. * @param providerName Name of provider to get. * * @return Requested provider or NULL if not found. */ Provider Manager::provider(const QString &providerName) const { AgProvider *provider; provider = ag_manager_get_provider(d->m_manager, providerName.toUtf8().constData()); return Provider(provider, StealReference); } /*! * Gets a provider list. * * @return List of registered providers. */ ProviderList Manager::providerList() const { GList *list; list = ag_manager_list_providers(d->m_manager); /* convert glist -> ProviderList */ ProviderList provList; GList *iter; for (iter = list; iter; iter = g_list_next(iter)) { AgProvider *provider = (AgProvider*)iter->data; provList.append(Provider(provider, StealReference)); } g_list_free(list); return provList; } /*! * Gets an object representing a service type. * @param name Name of service type to load. * * @return Requested service type or NULL if not found. */ ServiceType Manager::serviceType(const QString &name) const { AgServiceType *type; type = ag_manager_load_service_type(d->m_manager, name.toUtf8().constData()); return ServiceType(type, StealReference); } /*! * Get an object representing an application. * @param applicationName Name of the application to load. * * @return The requested Application, or an invalid Application object if not * found. */ Application Manager::application(const QString &applicationName) const { QByteArray ba = applicationName.toUtf8(); AgApplication *application = ag_manager_get_application(d->m_manager, ba.constData()); return Application(application); } /*! * List the registered applications which support the given service. * @param service The service to be supported. * * @return A list of Application objects. */ ApplicationList Manager::applicationList(const Service &service) const { ApplicationList ret; GList *applications, *list; applications = ag_manager_list_applications_by_service(d->m_manager, service.service()); for (list = applications; list != NULL; list = list->next) { AgApplication *application = (AgApplication *)list->data; ret.append(Application(application)); } g_list_free (applications); return ret; } /*! * Gets the service type if given in manager constructor. * * @return Service type or NULL if not given. */ QString Manager::serviceType() const { return UTF8(ag_manager_get_service_type (d->m_manager)); } /*! * Sets the timeout for database operations. * @param timeout The new timeout in milliseconds. * * This tells the library how long it is allowed to block while waiting * for a locked DB to become accessible. Higher values mean a higher * chance of successful reads, but also mean that the execution might be * blocked for a longer time. The default is 5 seconds. */ void Manager::setTimeout(quint32 timeout) { ag_manager_set_db_timeout(d->m_manager, timeout); } /*! * Gets the database timeout. * @return The timeout (in milliseconds) for database operations. */ quint32 Manager::timeout() { return ag_manager_get_db_timeout(d->m_manager); } /*! * Sets whether to abort the application when a database timeout occurs. * By default the library does not abort the application. */ void Manager::setAbortOnTimeout(bool abort) { ag_manager_set_abort_on_db_timeout(d->m_manager, abort); } /*! * @return Whether the application will be aborted when a database timeout * occurs. */ bool Manager::abortOnTimeout() const { return ag_manager_get_abort_on_db_timeout(d->m_manager); } /*! * @return Configuration options for this object. */ Manager::Options Manager::options() const { gboolean useDBus = true; g_object_get(d->m_manager, "use-dbus", &useDBus, NULL); Options opts; if (!useDBus) { opts |= DisableNotifications; } return opts; } /*! * Gets the last error. Not all operations set/reset the error; see the * individual methods' documentation to see if they set the last error or * not. Call this method right after an account operation * has failed; if no error occurred, the result of this method are * undefined. * * @return The last error. */ Error Manager::lastError() const { return d->lastError; } 07070100000021000081A40000000000000000000000016560BF9000000D21000000000000000000000000000000000000004200000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/manager.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef ACCOUNTS_MANAGER_H #define ACCOUNTS_MANAGER_H #include <QObject> #include <QSettings> #include <QString> #include <QStringList> #include "Accounts/accountscommon.h" #include "Accounts/account.h" #include "Accounts/error.h" #include "Accounts/provider.h" #include "Accounts/service.h" #include "Accounts/service-type.h" /*! * @namespace Accounts */ namespace Accounts { class AccountService; class Application; typedef QList<Application> ApplicationList; class ACCOUNTS_EXPORT Manager: public QObject { Q_OBJECT public: /*! * @enum Option * @brief Specifies options for the object. */ enum Option { DisableNotifications = 0x1, /**< Disable all inter-process notifications */ }; Q_DECLARE_FLAGS(Options, Option) Manager(QObject *parent = nullptr); Manager(const QString &serviceType, QObject *parent = nullptr); Manager(Options options, QObject *parent = nullptr); ~Manager(); Account *account(const AccountId &id) const; AccountIdList accountList(const QString &serviceType = QString()) const; AccountIdList accountListEnabled(const QString &serviceType = QString()) const; Account *createAccount(const QString &providerName); Service service(const QString &serviceName) const; ServiceList serviceList(const QString &serviceType = QString()) const; ServiceList serviceList(const Application &application) const; Provider provider(const QString &providerName) const; ProviderList providerList() const; ServiceType serviceType(const QString &name) const; Application application(const QString &applicationName) const; ApplicationList applicationList(const Service &service) const; QString serviceType() const; void setTimeout(quint32 timeout); quint32 timeout(); void setAbortOnTimeout(bool abort); bool abortOnTimeout() const; Options options() const; Error lastError() const; Q_SIGNALS: void accountCreated(Accounts::AccountId id); void accountRemoved(Accounts::AccountId id); void accountUpdated(Accounts::AccountId id); void enabledEvent(Accounts::AccountId id); private: // \cond class Private; friend class Private; Private *d; // Owned. friend class Account; friend class AccountService; // \endcond }; // Manager } //namespace Accounts Q_DECLARE_OPERATORS_FOR_FLAGS(Accounts::Manager::Options) #endif // ACCOUNTS_MANAGER_H 07070100000022000081A40000000000000000000000016560BF9000000699000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/manager_p.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "account.h" #include "manager.h" #include <QHash> #include <QPointer> #include <libaccounts-glib.h> namespace Accounts { class Manager::Private { Q_DECLARE_PUBLIC(Manager) public: Private(): q_ptr(0), m_manager(0) { } ~Private() { } void init(Manager *q, AgManager *manager); mutable Manager *q_ptr; AgManager *m_manager; //real manager Error lastError; QHash<AccountId,QPointer<Account> > m_accounts; static void on_account_created(Manager *self, AgAccountId id); static void on_account_deleted(Manager *self, AgAccountId id); static void on_account_updated(Manager *self, AgAccountId id); static void on_enabled_event(Manager *self, AgAccountId id); }; } //namespace Accounts 07070100000023000081A40000000000000000000000016560BF900000177D000000000000000000000000000000000000004500000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/provider.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "provider.h" #undef signals #include <libaccounts-glib.h> using namespace Accounts; namespace Accounts { /*! * @class Provider * @headerfile provider.h Accounts/Provider * * @brief Representation of an account provider. * * @details The Provider object represents an account provider. It can be used * to retrieve some basic properties of the provider (such as the name) and to * get access to the contents of the XML file which defines it. */ }; // namespace Provider::Provider(AgProvider *provider, ReferenceMode mode): m_provider(provider), m_tags(nullptr) { if (m_provider != nullptr && mode == AddReference) ag_provider_ref(m_provider); } /*! * Construct an invalid provider. */ Provider::Provider(): m_provider(nullptr), m_tags(nullptr) { } /*! * Copy constructor. Copying a Provider object is very cheap, because the * data is shared among copies. */ Provider::Provider(const Provider &other): m_provider(other.m_provider), m_tags(nullptr) { if (m_provider != nullptr) ag_provider_ref(m_provider); } Provider &Provider::operator=(const Provider &other) { if (m_provider == other.m_provider) return *this; if (m_provider != nullptr) ag_provider_unref(m_provider); m_provider = other.m_provider; if (m_provider != nullptr) ag_provider_ref(m_provider); return *this; } Provider::~Provider() { if (m_provider != nullptr) { ag_provider_unref(m_provider); m_provider = nullptr; } if (m_tags != nullptr) { delete m_tags; m_tags = nullptr; } } /*! * Check whether this object represents a Provider. * @return true if the Provider is a valid one. */ bool Provider::isValid() const { return m_provider != nullptr; } /*! * Get the name of the provider. This can be used as a unique identifier for * this provider. * @return The unique name of the provider. */ QString Provider::name() const { if (Q_UNLIKELY(!isValid())) return QString(); return UTF8(ag_provider_get_name(m_provider)); } /*! * Get the display name of the provider, untranslated. * @return The display name of the provider. */ QString Provider::displayName() const { return UTF8(ag_provider_get_display_name(m_provider)); } /*! * Get the description of the provider, untranslated. * @return The description of the provider. */ QString Provider::description() const { return UTF8(ag_provider_get_description(m_provider)); } /*! * Get the name of the account plugin associated with the provider. * Some platforms might find it useful to store plugin names in the provider * XML files, especially when the same plugin can work for different providers. * @return The plugin name. */ QString Provider::pluginName() const { return UTF8(ag_provider_get_plugin_name(m_provider)); } /*! * @return The name of the translation catalog, which can be used to * translate the displayName(). */ QString Provider::trCatalog() const { return ASCII(ag_provider_get_i18n_domain(m_provider)); } /*! * @return The provider icon name. */ QString Provider::iconName() const { return ASCII(ag_provider_get_icon_name(m_provider)); } /*! * @return A regular expression pattern which matches all the internet domains * in which this type of account can be used. */ QString Provider::domainsRegExp() const { return UTF8(ag_provider_get_domains_regex(m_provider)); } /*! * @return Whether the provider supports creating one account at most. */ bool Provider::isSingleAccount() const { return ag_provider_get_single_account(m_provider); } /*! * Check if this provider has a tag. * * @param tag Tag to look for * * @return Provider has the tag? */ bool Provider::hasTag(const QString &tag) const { if (!m_tags) { // Retrieve the tags tags(); } return m_tags->contains(tag); } /*! * Return all tags of the provider as a set. * * @return Set of tags */ QSet<QString> Provider::tags() const { if (m_tags) return *m_tags; m_tags = new QSet<QString>; GList *list = ag_provider_get_tags(m_provider); GList *iter = list; while (iter != NULL) { m_tags->insert(UTF8(reinterpret_cast<const gchar *> (iter->data))); iter = g_list_next(iter); } g_list_free(list); return *m_tags; } /*! * @return The DOM of the whole XML provider file. */ const QDomDocument Provider::domDocument() const { const gchar *data; ag_provider_get_file_contents(m_provider, &data); QDomDocument doc; QString errorStr; int errorLine; int errorColumn; if (!doc.setContent(QByteArray(data), true, &errorStr, &errorLine, &errorColumn)) { QString message(QStringLiteral("Parse error reading account provider file " "at line %1, column %2:\n%3")); message = message.arg(errorLine).arg(errorColumn).arg(errorStr); qWarning() << __PRETTY_FUNCTION__ << message; } return doc; } AgProvider *Provider::provider() const { return m_provider; } 07070100000024000081A40000000000000000000000016560BF9000000923000000000000000000000000000000000000004300000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/provider.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /*! * @copyright Copyright (C) 2009-2011 Nokia Corporation. * @license LGPL */ #ifndef ACCOUNTS_PROVIDER_H #define ACCOUNTS_PROVIDER_H #include "Accounts/accountscommon.h" #include <QStringList> #include <QDomDocument> extern "C" { typedef struct _AgProvider AgProvider; } namespace Accounts { class Provider; typedef QList<Provider> ProviderList; class ACCOUNTS_EXPORT Provider { public: Provider(); Provider(const Provider &other); Provider &operator=(const Provider &other); ~Provider(); bool isValid() const; QString name() const; QString displayName() const; QString description() const; QString pluginName() const; QString trCatalog() const; QString iconName() const; QString domainsRegExp() const; bool isSingleAccount() const; bool hasTag(const QString &tag) const; QSet<QString> tags() const; const QDomDocument domDocument() const; friend inline bool operator==(const Accounts::Provider &p1, const Accounts::Provider &p2) { return p1.m_provider == p2.m_provider || p1.name() == p2.name(); } private: // \cond friend class Manager; Provider(AgProvider *provider, ReferenceMode mode = AddReference); AgProvider *provider() const; AgProvider *m_provider; mutable QSet<QString> *m_tags; // \endcond }; } //namespace Accounts #endif // ACCOUNTS_PROVIDER_H 07070100000025000081A40000000000000000000000016560BF9000001696000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/service-type.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * Copyright (C) 2012 Intel Corporation. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * Contact: Jussi Laako <jussi.laako@linux.intel.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "service-type.h" #undef signals #include <libaccounts-glib.h> using namespace Accounts; namespace Accounts { /*! * @class ServiceType * @headerfile service-type.h Accounts/ServiceType * * @brief Representation of an account service type. * * @details The ServiceType object represents an account service type. It can * be used to retrieve some basic properties of the service type (such as * name and icon) and to get access to the contents of the XML file which * defines it. */ }; // namespace ServiceType::ServiceType(AgServiceType *serviceType, ReferenceMode mode): m_serviceType(serviceType), m_tags(nullptr) { if (m_serviceType != nullptr && mode == AddReference) ag_service_type_ref(m_serviceType); } /*! * Construct an invalid serviceType. */ ServiceType::ServiceType(): m_serviceType(nullptr), m_tags(nullptr) { } /*! * Copy constructor. Copying a ServiceType object is very cheap, because the * data is shared among copies. */ ServiceType::ServiceType(const ServiceType &other): m_serviceType(other.m_serviceType), m_tags(nullptr) { if (m_serviceType != nullptr) ag_service_type_ref(m_serviceType); } ServiceType &ServiceType::operator=(const ServiceType &other) { if (m_serviceType == other.m_serviceType) return *this; if (m_serviceType != nullptr) ag_service_type_unref(m_serviceType); m_serviceType = other.m_serviceType; if (m_serviceType != nullptr) ag_service_type_ref(m_serviceType); return *this; } ServiceType::~ServiceType() { if (m_serviceType != nullptr) { ag_service_type_unref(m_serviceType); m_serviceType = nullptr; } if (m_tags != nullptr) { delete m_tags; m_tags = nullptr; } } /*! * Check whether this object represents a ServiceType. * @return true if the ServiceType is a valid one. */ bool ServiceType::isValid() const { return m_serviceType != nullptr; } /*! * Returns the name (ID) of the service type. */ QString ServiceType::name() const { if (Q_UNLIKELY(!isValid())) return QString(); return UTF8(ag_service_type_get_name(m_serviceType)); } /*! * @return The description of the service type. */ QString ServiceType::description() const { return UTF8(ag_service_type_get_description(m_serviceType)); } /*! * @return The display name of the service type; this is a string that * could be shown in the UI to describe the service type to the user. * * The library attempts to translate this string by passing it to the * qtTrId() function; in order for this to work you must make sure that * the translation catalogue has been loaded before, if needed. */ QString ServiceType::displayName() const { const gchar *id; /* libaccounts-glib returns the display name untranslated. */ id = ag_service_type_get_display_name(m_serviceType); if (id != NULL) { return qtTrId(id); } else { return QString(); } } /*! * @return The name of the translation catalog, which can be used to * translate the displayName() */ QString ServiceType::trCatalog() const { return ASCII(ag_service_type_get_i18n_domain(m_serviceType)); } /*! * @return The icon name */ QString ServiceType::iconName() const { return ASCII(ag_service_type_get_icon_name(m_serviceType)); } /*! * Check if this service type has a tag. * * @param tag Tag to look for * * @return Service type has the tag? */ bool ServiceType::hasTag(const QString &tag) const { return ag_service_type_has_tag(m_serviceType, tag.toUtf8().constData()); } /*! * Return all tags of the service type as a set. * * @return Set of tags */ QSet<QString> ServiceType::tags() const { if (m_tags) return *m_tags; m_tags = new QSet<QString>; GList *list = ag_service_type_get_tags(m_serviceType); GList *iter = list; while (iter != NULL) { m_tags->insert(UTF8(reinterpret_cast<const gchar *> (iter->data))); iter = g_list_next(iter); } g_list_free(list); return *m_tags; } /*! * @return The DOM of the whole XML service file */ const QDomDocument ServiceType::domDocument() const { const gchar *data; gsize len; ag_service_type_get_file_contents(m_serviceType, &data, &len); QDomDocument doc; QString errorStr; int errorLine; int errorColumn; if (!doc.setContent(QByteArray(data, len), true, &errorStr, &errorLine, &errorColumn)) { QString message(QStringLiteral("Parse error reading serviceType file " "at line %1, column %2:\n%3")); message = message.arg(errorLine).arg(errorColumn).arg(errorStr); qWarning() << __PRETTY_FUNCTION__ << message; } return doc; } 07070100000026000081A40000000000000000000000016560BF9000000921000000000000000000000000000000000000004700000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/service-type.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * Copyright (C) 2012 Intel Corporation. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * Contact: Jussi Laako <jussi.laako@linux.intel.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /*! * @copyright Copyright (C) 2009-2011 Nokia Corporation. * @license LGPL */ #ifndef ACCOUNTS_SERVICE_TYPE_H #define ACCOUNTS_SERVICE_TYPE_H #include "Accounts/accountscommon.h" #include <QObject> #include <QSet> #include <QString> #include <QDomDocument> extern "C" { typedef struct _AgServiceType AgServiceType; } namespace Accounts { class ACCOUNTS_EXPORT ServiceType { public: ServiceType(); ServiceType(const ServiceType &other); ServiceType &operator=(const ServiceType &other); ~ServiceType(); bool isValid() const; QString name() const; QString description() const; QString displayName() const; QString trCatalog() const; QString iconName() const; bool hasTag(const QString &tag) const; QSet<QString> tags() const; const QDomDocument domDocument() const; friend inline bool operator==(const Accounts::ServiceType &s1, const Accounts::ServiceType &s2) { return s1.m_serviceType == s2.m_serviceType || s1.name() == s2.name(); } private: // \cond friend class Manager; ServiceType(AgServiceType *serviceType, ReferenceMode mode = AddReference); AgServiceType *m_serviceType; mutable QSet<QString> *m_tags; // \endcond }; } //namespace Accounts #endif // ACCOUNTS_SERVICE_TYPE_H 07070100000027000081A40000000000000000000000016560BF90000015E9000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/service.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * Copyright (C) 2012 Intel Corporation. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * Contact: Jussi Laako <jussi.laako@linux.intel.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "service.h" #undef signals #include <libaccounts-glib.h> using namespace Accounts; namespace Accounts { /*! * @class Service * @headerfile service.h Accounts/Service * * @brief Representation of an account service. * * @details The Service object represents an account service. It can be used to * retrieve some basic properties of the service (such as name, type and * provider) and to get access to the contents of the XML file which defines * it. */ }; // namespace Service::Service(AgService *service, ReferenceMode mode): m_service(service), m_tags(nullptr) { if (m_service != nullptr && mode == AddReference) ag_service_ref(m_service); } /*! * Construct an invalid service. */ Service::Service(): m_service(nullptr), m_tags(nullptr) { } /*! * Copy constructor. Copying a Service object is very cheap, because the * data is shared among copies. */ Service::Service(const Service &other): m_service(other.m_service), m_tags(nullptr) { if (m_service != nullptr) ag_service_ref(m_service); } Service &Service::operator=(const Service &other) { if (m_service == other.m_service) return *this; if (m_service != nullptr) ag_service_unref(m_service); m_service = other.m_service; if (m_service != nullptr) ag_service_ref(m_service); return *this; } Service::~Service() { if (m_service != nullptr) { ag_service_unref(m_service); m_service = nullptr; } if (m_tags != nullptr) { delete m_tags; m_tags = nullptr; } } /*! * Check whether this object represents a Service. * @return true if the Service is a valid one. */ bool Service::isValid() const { return m_service != nullptr; } /*! * Get the name of the service. This can be used as a unique identifier for * this service. * @return The unique name of the service. */ QString Service::name() const { if (Q_UNLIKELY(!isValid())) return QString(); return UTF8(ag_service_get_name(m_service)); } /*! * Get the description of the service. * @return The description of the service. */ QString Service::description() const { return UTF8(ag_service_get_description(m_service)); } /*! * Get the display name of the service, untranslated. * @return The display name of the service. */ QString Service::displayName() const { return UTF8(ag_service_get_display_name(m_service)); } /*! * Get the service type ID of the service. * @return The service type of the service. */ QString Service::serviceType() const { return ASCII(ag_service_get_service_type(m_service)); } /*! * @return The translation catalog of the service. */ QString Service::trCatalog() const { return ASCII(ag_service_get_i18n_domain(m_service)); } /*! * Get the provider ID of the service. * @return The provider of the service. */ QString Service::provider() const { return UTF8(ag_service_get_provider(m_service)); } /*! * Get the icon name for this service. * @return The icon name. */ QString Service::iconName() const { return ASCII(ag_service_get_icon_name(m_service)); } /*! * Check if this service has a tag. * * @param tag Tag to look for * * @return Service has the tag? */ bool Service::hasTag(const QString &tag) const { return ag_service_has_tag(m_service, tag.toUtf8().constData()); } /*! * Return all tags of the service as a set. * * @return Set of tags */ QSet<QString> Service::tags() const { if (m_tags) return *m_tags; m_tags = new QSet<QString>; GList *list = ag_service_get_tags(m_service); GList *iter = list; while (iter != NULL) { m_tags->insert(UTF8(reinterpret_cast<const gchar *> (iter->data))); iter = g_list_next(iter); } g_list_free(list); return *m_tags; } /*! * Get the contents of the service XML file. * @return The DOM of the whole XML service file */ const QDomDocument Service::domDocument() const { const gchar *data; ag_service_get_file_contents(m_service, &data, NULL); QDomDocument doc; QString errorStr; int errorLine; int errorColumn; if (!doc.setContent(QByteArray(data), true, &errorStr, &errorLine, &errorColumn)) { QString message(QStringLiteral("Parse error reading account service file " "at line %1, column %2:\n%3")); message = message.arg(errorLine).arg(errorColumn).arg(errorStr); qWarning() << __PRETTY_FUNCTION__ << message; } return doc; } AgService *Service::service() const { return m_service; } 07070100000028000081A40000000000000000000000016560BF90000009D7000000000000000000000000000000000000004200000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/service.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2012-2016 Canonical Ltd. * Copyright (C) 2012 Intel Corporation. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * Contact: Jussi Laako <jussi.laako@linux.intel.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ /*! * @copyright Copyright (C) 2009-2011 Nokia Corporation. * @license LGPL */ #ifndef ACCOUNTS_SERVICE_H #define ACCOUNTS_SERVICE_H #include "Accounts/accountscommon.h" #include <QString> #include <QSet> #include <QDomDocument> #include <QStringList> extern "C" { typedef struct _AgService AgService; } namespace Accounts { class ACCOUNTS_EXPORT Service { public: Service(); Service(const Service &other); Service &operator=(const Service &other); ~Service(); bool isValid() const; QString name() const; QString description() const; QString displayName() const; QString trCatalog() const; QString serviceType() const; QString provider() const; QString iconName() const; bool hasTag(const QString &tag) const; QSet<QString> tags() const; const QDomDocument domDocument() const; friend inline bool operator==(const Accounts::Service &s1, const Accounts::Service &s2) { return s1.m_service == s2.m_service || s1.name() == s2.name(); } private: // \cond friend class Account; friend class AccountService; friend class AccountServicePrivate; friend class Application; friend class Manager; Service(AgService *service, ReferenceMode mode = AddReference); AgService *service() const; AgService *m_service; mutable QSet<QString> *m_tags; // \endcond }; typedef QList<Service> ServiceList; } //namespace Accounts #endif // ACCOUNTS_SERVICE_H 07070100000029000081A40000000000000000000000016560BF90000010C2000000000000000000000000000000000000004200000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/utils.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "accountscommon.h" #include "utils.h" #include <QStringList> namespace Accounts { static QVariantMap gVariantToQVariantMap(GVariant *variant) { QVariantMap ret; GVariantIter iter; gchar *key; GVariant *value; g_variant_iter_init (&iter, variant); while (g_variant_iter_next (&iter, "{sv}", &key, &value)) { ret.insert(UTF8(key), gVariantToQVariant(value)); g_variant_unref(value); g_free(key); } return ret; } static GVariant *qStringListToGVariant(const QStringList &stringList) { GVariantBuilder builder; g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY); Q_FOREACH (const QString &string, stringList) { g_variant_builder_add(&builder, "s", string.toUtf8().constData()); } return g_variant_builder_end(&builder); } static QStringList gVariantToQStringList(GVariant *variant) { QStringList ret; gsize length; const gchar **strings = g_variant_get_strv(variant, &length); ret.reserve(length); for (gsize i = 0; i < length; i++) { ret.append(UTF8(strings[i])); } g_free(strings); return ret; } QVariant gVariantToQVariant(GVariant *value) { GVariantClass variantClass = g_variant_classify(value); QVariant variant; switch (variantClass) { case G_VARIANT_CLASS_STRING: variant = UTF8(g_variant_get_string(value, NULL)); break; case G_VARIANT_CLASS_INT32: variant = g_variant_get_int32(value); break; case G_VARIANT_CLASS_UINT32: variant = g_variant_get_uint32(value); break; case G_VARIANT_CLASS_INT64: variant = qint64(g_variant_get_int64(value)); break; case G_VARIANT_CLASS_UINT64: variant = quint64(g_variant_get_uint64(value)); break; case G_VARIANT_CLASS_BOOLEAN: variant = bool(g_variant_get_boolean(value)); break; case G_VARIANT_CLASS_ARRAY: if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARDICT)) { variant = gVariantToQVariantMap(value); break; } else if (g_variant_is_of_type(value, G_VARIANT_TYPE_STRING_ARRAY)) { variant = gVariantToQStringList(value); break; } // fall through default: qWarning() << "Unsupported type" << UTF8(g_variant_get_type_string(value)); break; } return variant; } GVariant *qVariantToGVariant(const QVariant &variant) { GVariant *ret = nullptr; QByteArray tmpvalue; switch (variant.type()) { case QVariant::String: tmpvalue = variant.toString().toUtf8(); ret = g_variant_new_string(tmpvalue.constData()); break; case QVariant::Int: ret = g_variant_new_int32(variant.toInt()); break; case QVariant::UInt: ret = g_variant_new_uint32(variant.toUInt()); break; case QVariant::LongLong: ret = g_variant_new_int64(variant.toLongLong()); break; case QVariant::ULongLong: ret = g_variant_new_uint64(variant.toULongLong()); break; case QVariant::Bool: ret = g_variant_new_boolean(variant.toBool()); break; case QVariant::StringList: ret = qStringListToGVariant(variant.toStringList()); break; default: qWarning() << "Unsupported datatype" << variant.typeName(); } return ret; } }; // namespace 0707010000002A000081A40000000000000000000000016560BF900000047E000000000000000000000000000000000000004000000000libaccounts-qt-1.16git.20231124T162152~18557f7/Accounts/utils.h/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2012-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef ACCOUNTS_UTILS_H #define ACCOUNTS_UTILS_H #include <QVariant> #undef signals #include <glib-object.h> namespace Accounts { QVariant gVariantToQVariant(GVariant *value); GVariant *qVariantToGVariant(const QVariant &variant); } // namespace #endif // ACCOUNTS_UTILS_H 0707010000002B000081A40000000000000000000000016560BF9000006742000000000000000000000000000000000000003700000000libaccounts-qt-1.16git.20231124T162152~18557f7/COPYING GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the library's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This library 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; either version 2.1 of the License, or (at your option) any later version. This library 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 library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice That's all there is to it! 0707010000002C000081A40000000000000000000000016560BF9000000001000000000000000000000000000000000000003700000000libaccounts-qt-1.16git.20231124T162152~18557f7/INSTALL 0707010000002D000081A40000000000000000000000016560BF9000000001000000000000000000000000000000000000003500000000libaccounts-qt-1.16git.20231124T162152~18557f7/NOTES 0707010000002E000081A40000000000000000000000016560BF900000027F000000000000000000000000000000000000003900000000libaccounts-qt-1.16git.20231124T162152~18557f7/README.mdAccounts management library for Qt applications ================================================= This project is a library for managing accounts which can be used from Qt applications. It is part of the @accounts-sso project. License ------- See COPYING file. Build instructions ------------------ The project depends on Qt 5 and [libaccounts-glib](https://gitlab.com/accounts-sso/libaccounts-glib). To build it, run: ``` qmake make make install ``` Resources --------- [API reference documentation](http://accounts-sso.gitlab.io/libaccounts-qt/) [Official source code repository](https://gitlab.com/accounts-sso/libaccounts-qt)0707010000002F000081A40000000000000000000000016560BF9000000001000000000000000000000000000000000000003400000000libaccounts-qt-1.16git.20231124T162152~18557f7/TODO 07070100000030000081A40000000000000000000000016560BF90000001D7000000000000000000000000000000000000003F00000000libaccounts-qt-1.16git.20231124T162152~18557f7/accounts-qt.proinclude( common-vars.pri ) TEMPLATE = subdirs CONFIG += ordered SUBDIRS += Accounts tests include( common-project-config.pri ) include( doc/doc.pri ) DISTNAME = $${PROJECT_NAME}-$${PROJECT_VERSION} EXCLUDES = \ --exclude-vcs \ --exclude=.* \ --exclude=$${DISTNAME}.tar.bz2 \ --exclude-from .gitignore dist.commands = "tar -cvjf $${DISTNAME}.tar.bz2 $$EXCLUDES --transform='s,^,$$DISTNAME/,' *" dist.depends = distclean QMAKE_EXTRA_TARGETS += dist 07070100000031000081A40000000000000000000000016560BF90000005FD000000000000000000000000000000000000004A00000000libaccounts-qt-1.16git.20231124T162152~18557f7/common-installs-config.pri#----------------------------------------------------------------------------- # Common installation configuration for all projects. #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # 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_LIBDIR} 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}/Accounts/ INSTALLS += headers message("====") message("==== INSTALLS += headers") } else { message("====") message("==== NOTE: Remember to add your API headers into `headers.files' for installation!") } # End of File 07070100000032000081A40000000000000000000000016560BF9000000135000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/common-pkgconfig.pri# Include this file after defining the pkgconfig.files variable !isEmpty(pkgconfig.files) { QMAKE_SUBSTITUTES += $${pkgconfig.files}.in pkgconfig.CONFIG = no_check_exist pkgconfig.path = $${INSTALL_LIBDIR}/pkgconfig QMAKE_EXTRA_TARGETS += pkgconfig QMAKE_CLEAN += $${pkgconfig.files} } 07070100000033000081A40000000000000000000000016560BF9000000860000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/common-project-config.pri#----------------------------------------------------------------------------- # Common configuration for all projects. #----------------------------------------------------------------------------- QT -= gui CONFIG += link_pkgconfig MOC_DIR = .moc OBJECTS_DIR = .obj RCC_DIR = resources UI_DIR = ui UI_HEADERS_DIR = ui/include UI_SOURCES_DIR = ui/src !defined(TOP_SRC_DIR, var) { TOP_SRC_DIR = $$PWD TOP_BUILD_DIR = $${TOP_SRC_DIR}/$(BUILD_DIR) } # we don't like warnings... #QMAKE_CXXFLAGS *= -Werror CONFIG += c++11 #----------------------------------------------------------------------------- # 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}'") } INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib # default library directory can be overriden by defining LIBDIR when # running qmake isEmpty( LIBDIR ) { message("====") message("==== NOTE: To override the library installation path run: `qmake LIBDIR=/custom/path'") message("==== (current installation path is `$${INSTALL_LIBDIR}')") } else { INSTALL_LIBDIR = $${LIBDIR} message("====") message("==== library install path set to `$${INSTALL_LIBDIR}'") } isEmpty ( CMAKE_CONFIG_PATH ) { CMAKE_CONFIG_PATH = $${INSTALL_LIBDIR}/cmake message("====") message("==== NOTE: To override the cmake module installation path run: `qmake CMAKE_CONFIG_PATH=/custom/path'") message("==== (current installation path is `$${CMAKE_CONFIG_PATH}')") } else { message("====") message("==== cmake module install path set to `$${CMAKE_CONFIG_PATH}'") } include( coverage.pri ) # End of File 07070100000034000081A40000000000000000000000016560BF9000000378000000000000000000000000000000000000003F00000000libaccounts-qt-1.16git.20231124T162152~18557f7/common-vars.pri#----------------------------------------------------------------------------- # Common variables for all projects. #----------------------------------------------------------------------------- DEFINES += BUILDING_ACCOUNTS_QT #----------------------------------------------------------------------------- # Project name (used e.g. in include file and doc install path). #----------------------------------------------------------------------------- PROJECT_NAME = accounts-qt #----------------------------------------------------------------------------- # Project version #----------------------------------------------------------------------------- PROJECT_VERSION = 1.16 #----------------------------------------------------------------------------- # Library version #----------------------------------------------------------------------------- VERSION = 1.4 # End of File 07070100000035000081A40000000000000000000000016560BF9000000772000000000000000000000000000000000000003C00000000libaccounts-qt-1.16git.20231124T162152~18557f7/coverage.pri# Coverage CONFIG(coverage) { OBJECTS_DIR = MOC_DIR = TOP_SRC_DIR = $$PWD LIBS += -lgcov QMAKE_CXXFLAGS += --coverage QMAKE_LDFLAGS += --coverage QMAKE_EXTRA_TARGETS += coverage cov QMAKE_EXTRA_TARGETS += clean-gcno clean-gcda coverage-html \ generate-coverage-html clean-coverage-html coverage-gcovr \ generate-gcovr generate-coverage-gcovr clean-coverage-gcovr clean-gcno.commands = \ "@echo Removing old coverage instrumentation"; \ "find -name '*.gcno' -print | xargs -r rm" clean-gcda.commands = \ "@echo Removing old coverage results"; \ "find -name '*.gcda' -print | xargs -r rm" coverage-html.depends = clean-gcda check generate-coverage-html generate-coverage-html.commands = \ "@echo Collecting coverage data"; \ "lcov --directory $${TOP_SRC_DIR} --capture --output-file coverage.info --no-checksum --compat-libtool"; \ "lcov --extract coverage.info \"*/Accounts/*.cpp\" -o coverage.info"; \ "lcov --remove coverage.info \"moc_*.cpp\" -o coverage.info"; \ "LANG=C genhtml --prefix $${TOP_SRC_DIR} --output-directory coverage-html --title \"Code Coverage\" --legend --show-details coverage.info" clean-coverage-html.depends = clean-gcda clean-coverage-html.commands = \ "lcov --directory $${TOP_SRC_DIR} -z"; \ "rm -rf coverage.info coverage-html" coverage-gcovr.depends = clean-gcda check generate-coverage-gcovr generate-coverage-gcovr.commands = \ "@echo Generating coverage GCOVR report"; \ "gcovr -x -r $${TOP_SRC_DIR} -o $${TOP_SRC_DIR}/coverage.xml -e \".*/moc_.*\" -e \"tests/.*\" -e \".*\\.h\"" clean-coverage-gcovr.depends = clean-gcda clean-coverage-gcovr.commands = \ "rm -rf $${TOP_SRC_DIR}/coverage.xml" QMAKE_CLEAN += *.gcda *.gcno coverage.info coverage.xml } 07070100000036000041ED0000000000000000000000026560BF9000000000000000000000000000000000000000000000003300000000libaccounts-qt-1.16git.20231124T162152~18557f7/doc07070100000037000081A40000000000000000000000016560BF9000000ACC000000000000000000000000000000000000003B00000000libaccounts-qt-1.16git.20231124T162152~18557f7/doc/doc.pri#----------------------------------------------------------------------------- # doc.pri #----------------------------------------------------------------------------- # list of documentation folders to install DOC_FOLDERS = doc/html \ doc/qch # files and folders listed in the installation target's .files section # must exist _before_ qmake generates the Makefile...so, make sure our # documentation target folders exist in the current build folder for( folder, DOC_FOLDERS ) { system( mkdir -p $${TOP_BUILD_DIR}/$${folder} ) } #----------------------------------------------------------------------------- # extra build targets for generating and cleaning documentation #----------------------------------------------------------------------------- for( subdir, SUBDIRS) { DOC_INPUT += $${_PRO_FILE_PWD_}/$${subdir} } DOC_INPUT += doc/src # target for generating documentation doctarget.target = docs doctarget.commands = OUTPUT_DIRECTORY=doc \ PROJECT_NAME=\"$${PROJECT_NAME}\" \ PROJECT_NUMBER=\"$${PROJECT_VERSION}\" \ STRIP_FROM_PATH=\"$${_PRO_FILE_PWD_}\" \ INPUT=\"$${DOC_INPUT}\" \ QHP_NAMESPACE=\"com.nokia.example.$${TARGET}\" \ QHP_VIRTUAL_FOLDER=\"$${TARGET}\" \ TAGFILES=\"$$system(pwd)/qt.tags\" \ TAGFILE=\"doc/$${TARGET}.tags\" \ doxygen $$system(pwd)/doxy.conf doctarget.depends = FORCE QMAKE_EXTRA_TARGETS += doctarget # target for cleaning generated documentation doccleantarget.target = cleandocs for( folder, DOC_FOLDERS ) { doccleantarget.commands += rm -r -f $${folder}; } doccleantarget.commands += rm -r -f doc/accounts.tags; doccleantarget.depends = FORCE QMAKE_EXTRA_TARGETS += doccleantarget #----------------------------------------------------------------------------- # installation setup # NOTE: remember to set headers.files before this include to have the headers # properly setup. #----------------------------------------------------------------------------- include( ../common-installs-config.pri ) #----------------------------------------------------------------------------- # Installation target setup for documentation #----------------------------------------------------------------------------- documentation.path = $${INSTALL_PREFIX}/share/doc/$${PROJECT_NAME} for( folder, DOC_FOLDERS ) { documentation.files += $${TOP_BUILD_DIR}/$${folder} } # make sure docs are generated before trying to install anything documentation.depends = docs INSTALLS += documentation message("====") message("==== INSTALLS += documentation") # End of File 07070100000038000081A40000000000000000000000016560BF900000F68B000000000000000000000000000000000000003D00000000libaccounts-qt-1.16git.20231124T162152~18557f7/doc/doxy.conf# Doxyfile 1.5.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = $(PROJECT_NAME) # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = $(PROJECT_NUMBER) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = $(OUTPUT_DIRECTORY) # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, # Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = $(STRIP_FROM_PATH) # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = YES # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = YES # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command <command> <input-file>, where <command> is the value of # the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = $(INPUT) # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.h \ *.cpp \ *.dox # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.moc/* \ */.obj/* \ */.git/* \ */tests/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command <filter> <input-file>, where <filter> # is the value of the INPUT_FILTER tag, and <input-file> is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = YES # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = ../qch/accounts.qch # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = $(QHP_NAMESPACE) # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = $(QHP_VIRTUAL_FOLDER) # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = qhelpgenerator # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to FRAME, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. Other possible values # for this tag are: HIERARCHIES, which will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list; # ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which # disables this behavior completely. For backwards compatibility with previous # releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE # respectively. GENERATE_TREEVIEW = ALL # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = $(TAGFILES) # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = $(TAGFILE) # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = NO # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Options related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO # End of File 07070100000039000041ED0000000000000000000000026560BF9000000000000000000000000000000000000000000000003700000000libaccounts-qt-1.16git.20231124T162152~18557f7/doc/src0707010000003A000081A40000000000000000000000016560BF9000000C09000000000000000000000000000000000000004400000000libaccounts-qt-1.16git.20231124T162152~18557f7/doc/src/mainpage.dox/*! @mainpage Accounts-Qt library @section intro Introduction <p>The Accounts library provides a storage solution for user accounts. The API provides access to the account storage: retrieval, editing and creation of accounts, as well as enumeration of the currently installed account providers and services. A change notification mechanism is implemented in order to let different processes operate on the same data simultaneously.</p> @section terminology Terminology and basic concepts <p>Common terms such as accounts, provider, services are familiar to most people, but not everyone associates the same meaning to them. Therefore, since these terms are commonly used in this library APIs, please spend some time to get familiar with our naming convention:</p> <ul> <li><b>Account</b>: This is a user account on a server. With the same term we also refer to the local object which represents a remote account. An account has one provider, and zero or more services.</li> <li><b>Provider</b>: The organization which provides the account.</li> <li><b>Service</b>: the actual service that the end user accesses by means of the account; on the same account there could be more than one service.</li> <li><b>Service type</b>: The protocol or application of a service. Every service has a service type, and there might be many services having the same type (possibly even on the same account).</li> </ul> <p>Accounts are stored in the DB provided by this library; providers, services and service types are defined by XML files which should be installed in well-defined filesystem paths (the Accounts-Qt library defaults to <code> /usr/share/accounts/{providers,services,service-types}/</code>) and which the library will allow applications to enumerate and read.</p> <p>Note that the library doesn't come with any pre-installed provider, service or service type: it's expected that provider and service files will be installed by the applications (or account plugins, if a centralized account-editing application is installed on the system) written by the service providers; service types should be defined by the applications or frameworks which are going to use the account information.</p> @section classlist List of classes in Accounts-Qt <table> <tr><td>Accounts::Manager</td><td>Main object in Accounts-Qt: instantiate an Accounts::Manager to list and instantiate accounts, providers, services.</td></tr> <tr><td>Accounts::Account</td><td>Interface to account settings and data.</td></tr> <tr><td>Accounts::AccountService</td><td>Service settings of an account.</td></tr> <tr><td>Accounts::Provider</td><td>Representation of an installed account provider.</td></tr> <tr><td>Accounts::Service</td><td>Representation of an installed account service.</td></tr> <tr><td>Accounts::ServiceType</td><td>Representation of an account service type.</td></tr> <tr><td>Accounts::Watch</td><td>Monitors an account key or group of keys.</td></tr> <tr><td>Accounts::Error</td><td>Base object definition for errors emitted by the library.</td></tr> </table> */ 0707010000003B000041ED0000000000000000000000026560BF9000000000000000000000000000000000000000000000003500000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests0707010000003C000081A40000000000000000000000016560BF900000000D000000000000000000000000000000000000004000000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/.gitignoreaccountstest 0707010000003D000081A40000000000000000000000016560BF900000019A000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/Gallery.application<?xml version="1.0" encoding="UTF-8" ?> <application id="Gallery"> <description>Image gallery</description> <services> <service id="OtherService"> <description>Publish images on OtherService</description> </service> </services> <service-types> <service-type id="sharing"> <description>Share your images with your friends</description> </service-type> </service-types> </application> 0707010000003E000081A40000000000000000000000016560BF9000000174000000000000000000000000000000000000004800000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/Mailer.application<?xml version="1.0" encoding="UTF-8" ?> <application id="Mailer"> <description>Mailer application</description> <translations>mailer-catalog</translations> <desktop-entry>mailer.desktop</desktop-entry> <service-types> <service-type id="e-mail"> <description>Mailer can retrieve your e-mails</description> </service-type> </service-types> </application> 0707010000003F000081A40000000000000000000000016560BF9000000297000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/MyProvider.provider<?xml version="1.0" encoding="UTF-8" ?> <provider id="MyProvider"> <name>My Provider</name> <icon>general_myprovider</icon> <description>fast & furious</description> <translations>accounts</translations> <plugin>generic-oauth</plugin> <domains>.*example.net</domains> <single-account>true</single-account> <tags> <tag>user-group:mygroup</tag> </tags> <template> <group name="auth"> <setting name="method">oauth2</setting> <setting name="mechanism">user_agent</setting> <group name="oauth2/user_agent"> <setting name="Host">myserver.example</setting> </group> </group> </template> </provider> 07070100000040000081A40000000000000000000000016560BF9000000963000000000000000000000000000000000000004700000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/MyService.service<?xml version="1.0" encoding="UTF-8" ?> <service id="MyService"> <type>e-mail</type> <name>My Service</name> <description>Test description</description> <icon>general_myservice</icon> <provider>MyProvider</provider> <translations>accounts</translations> <tags> <tag>email</tag> <tag>e-mail</tag> </tags> <!-- default settings (account settings have precedence over these) --> <template> <group name="parameters"> <setting name="server">talk.google.com</setting> <setting name="port" type="i">5223</setting> <setting name="old-ssl" type="b">true</setting> <setting name="fallback-conference-server">conference.jabber.org</setting> </group> <setting name="enabled" type="b">true</setting> </template> <!-- preview account --> <preview> <group name="parameters"> <setting name="server">talkdemo.google.com</setting> <setting name="account">googledemo@gmail.com</setting> <setting name="password">demo</setting> </group> <setting name="display_name">GTalk demo</setting> </preview> <!-- type-specific data --> <type_data> <capabilities>chat-p2p, voice-p2p, video-p2p, chat-room, chat-room-list, avatars, alias, roster</capabilities> <vcard_field>X-JABBER</vcard_field> <presences> <presence name="available"> <name>pres_bd_gtalk_available</name> <icon>general_presence_online</icon> <type>available</type> </presence> <presence name="away"> <name>pres_bd_gtalk_busy</name> <icon>general_presence_busy</icon> <type>away</type> </presence> </presences> <actions> <action name="chat"> <name>addr_bd_cont_starter_im_service_chat</name> <icon>general_sms</icon> <vcard_field>X-JABBER</vcard_field> <properties> <prop name="org.freedesktop.Telepathy.Channel.ChannelType" type="s">org.freedesktop.Telepathy.Channel.Type.Text</prop> </properties> </action> <action name="call"> <name>addr_bd_cont_starter_im_service_call</name> <icon>general_call</icon> <vcard_field>X-JABBER</vcard_field> <properties> <prop name="org.freedesktop.Telepathy.Channel.ChannelType" type="s">org.freedesktop.Telepathy.Channel.Type.StreamedMedia</prop> </properties> </action> </actions> </type_data> </service> 07070100000041000081A40000000000000000000000016560BF90000008B1000000000000000000000000000000000000004A00000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/OtherService.service<?xml version="1.0" encoding="UTF-8" ?> <service id="OtherService"> <type>sharing</type> <name>Other Service</name> <icon>general_otherservice</icon> <tags> <tag>sharing</tag> <tag>uploads</tag> </tags> <!-- default settings (account settings have precedence over these) --> <template> <group name="parameters"> <setting name="server">talk.google.com</setting> <setting name="port" type="i">5223</setting> <setting name="old-ssl">1</setting> <setting name="fallback-conference-server">conference.jabber.org</setting> </group> </template> <!-- preview account --> <preview> <group name="parameters"> <setting name="server">talkdemo.google.com</setting> <setting name="account">googledemo@gmail.com</setting> <setting name="password">demo</setting> </group> <setting name="display_name">GTalk demo</setting> </preview> <!-- type-specific data --> <type_data> <capabilities>chat-p2p, voice-p2p, video-p2p, chat-room, chat-room-list, avatars, alias, roster</capabilities> <vcard_field>X-JABBER</vcard_field> <presences> <presence name="available"> <name>pres_bd_gtalk_available</name> <icon>general_presence_online</icon> <type>available</type> </presence> <presence name="away"> <name>pres_bd_gtalk_busy</name> <icon>general_presence_busy</icon> <type>away</type> </presence> </presences> <actions> <action name="chat"> <name>addr_bd_cont_starter_im_service_chat</name> <icon>general_sms</icon> <vcard_field>X-JABBER</vcard_field> <properties> <prop name="org.freedesktop.Telepathy.Channel.ChannelType" type="s">org.freedesktop.Telepathy.Channel.Type.Text</prop> </properties> </action> <action name="call"> <name>addr_bd_cont_starter_im_service_call</name> <icon>general_call</icon> <vcard_field>X-JABBER</vcard_field> <properties> <prop name="org.freedesktop.Telepathy.Channel.ChannelType" type="s">org.freedesktop.Telepathy.Channel.Type.StreamedMedia</prop> </properties> </action> </actions> </type_data> </service> 07070100000042000081ED0000000000000000000000016560BF9000000028000000000000000000000000000000000000004D00000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/accountstest-wrapper.sh#!/bin/sh exec $WRAPPER ./accountstest 07070100000043000081ED0000000000000000000000016560BF9000000144000000000000000000000000000000000000004500000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/accountstest.sh#!/bin/sh # If dbus-test-runner exists, use it to run the tests in a separate D-Bus # session if command -v dbus-test-runner > /dev/null ; then echo "Using dbus-test-runner" dbus-test-runner -m 180 -t "${TESTDIR}/accountstest-wrapper.sh" else echo "Using existing D-Bus session" "${TESTDIR}/accountstest-wrapper.sh" fi 07070100000044000041ED0000000000000000000000026560BF9000000000000000000000000000000000000000000000004200000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/applications07070100000045000081A40000000000000000000000016560BF90000000A3000000000000000000000000000000000000005100000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/applications/mailer.desktop[Desktop Entry] Name=Easy Mailer Comment=Send and receive mail Exec=/bin/sh Icon=mailer-icon Terminal=false Type=Application Categories=Application;Network;Email; 07070100000046000081A40000000000000000000000016560BF9000000131000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/e-mail.service-type<?xml version="1.0" encoding="UTF-8" ?> <service-type id="e-mail"> <translations>translation_file</translations> <name>Electronic mail</name> <description>Email test description</description> <icon>email_icon</icon> <tags> <tag>email</tag> <tag>messaging</tag> </tags> </service-type> 07070100000047000081A40000000000000000000000016560BF9000000078000000000000000000000000000000000000003F00000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/tests.proinclude( ../common-project-config.pri ) include( ../common-vars.pri ) TEMPLATE = subdirs SUBDIRS = tst_libaccounts.pro 07070100000048000081A40000000000000000000000016560BF900000A240000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/tst_libaccounts.cpp/* vi: set et sw=4 ts=4 cino=t0,(0: */ /* * This file is part of libaccounts-qt * * Copyright (C) 2009-2011 Nokia Corporation. * Copyright (C) 2015-2016 Canonical Ltd. * * Contact: Alberto Mardegan <alberto.mardegan@canonical.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation. * * This library 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 library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA */ #include <QtTest/QtTest> #include <QSignalSpy> #include "Accounts/Account" #include "Accounts/Application" #include "Accounts/Manager" #include "Accounts/AccountService" using namespace Accounts; #define PROVIDER QStringLiteral("dummyprovider") #define SERVICE QStringLiteral("dummyservice") #define MYSERVICE QStringLiteral("MyService") #define OTHERSERVICE QStringLiteral("OtherService") #define EMAIL_SERVICE_TYPE QStringLiteral("e-mail") Q_DECLARE_METATYPE(Accounts::AccountId) Q_DECLARE_METATYPE(const char *) class AccountsTest: public QObject { Q_OBJECT public: AccountsTest() { qRegisterMetaType<AccountId>("Accounts::AccountId"); qRegisterMetaType<const char *>("const char *"); } private Q_SLOTS: void initTestCase(); void cleanupTestCase(); void testManager(); void testCreateAccount(); void testAccount(); void testObjectsLifetime(); void testAccountList(); void testProvider(); void testService(); void testServiceList(); void testServiceConst(); void testAccountConst(); void testAccountProvider(); void testAccountServices(); void testAccountEnabled(); void testAccountDisplayName(); void testAccountValue(); void testAccountSync(); void testCreated(); void testRemove(); void testAccountService(); void testWatches(); void testServiceData(); void testSettings(); void testKeySignVerify(); void testIncrementalAccountIds(); void testSelectGlobalAccountSettings(); void testCredentialsId(); void testAuthData(); void testGlobalAuthData(); void testListEnabledServices(); void testListEnabledByServiceType(); void testEnabledEvent(); void testServiceType(); void testUpdateAccount(); void testApplication(); void testApplicationListServices(); public Q_SLOTS: void onAccountServiceChanged(); private: QStringList m_accountServiceChangedFields; }; void clearDb() { QDir dbroot(QString(getenv("ACCOUNTS"))); dbroot.remove(QString("accounts.db")); } void AccountsTest::initTestCase() { //init setenv("ACCOUNTS", "/tmp/", false); setenv("AG_APPLICATIONS", DATA_PATH, false); setenv("AG_SERVICES", DATA_PATH, false); setenv("AG_SERVICE_TYPES", DATA_PATH, false); setenv("AG_PROVIDERS", DATA_PATH, false); setenv("XDG_DATA_HOME", DATA_PATH, false); //clear database clearDb(); } void AccountsTest::cleanupTestCase() { } void AccountsTest::testManager() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); QCOMPARE(mgr->serviceType(), QString()); mgr->setAbortOnTimeout(true); QCOMPARE(mgr->abortOnTimeout(), true); mgr->setTimeout(123); QCOMPARE(mgr->timeout(), quint32(123)); QCOMPARE(mgr->options().testFlag(Manager::DisableNotifications), false); delete mgr; mgr = new Manager(Manager::DisableNotifications); QCOMPARE(mgr->options().testFlag(Manager::DisableNotifications), true); delete mgr; } void AccountsTest::testCreateAccount() { clearDb(); Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); QVERIFY(account->manager() == mgr); delete account; account = mgr->createAccount(PROVIDER); QVERIFY(account != 0); delete account; delete mgr; } void AccountsTest::testAccount() { clearDb(); Manager *mgr = new Manager(); QVERIFY(mgr != 0); //this should not exist Account *account2 = mgr->account(1); QVERIFY(!account2); Error error = mgr->lastError(); QCOMPARE(error.type(), Error::AccountNotFound); // make sure there is account Account *account = mgr->createAccount(NULL); account->sync(); //now we get account account2 = mgr->account(1); QVERIFY(account2 != 0); delete account2; delete account; delete mgr; } void AccountsTest::testObjectsLifetime() { clearDb(); Manager *manager = new Manager(); // this should not exist Account *account = Account::fromId(manager, 1); QVERIFY(account == 0); Error error = manager->lastError(); QCOMPARE(error.type(), Error::AccountNotFound); // create an account account = new Account(manager, PROVIDER); account->setDisplayName("hi!"); account->syncAndBlock(); AccountId accountId = account->id(); delete account; // Now load it, in two different ways QPointer<Account> sharedAccount = manager->account(accountId); QVERIFY(sharedAccount != 0); QCOMPARE(sharedAccount->displayName(), QString("hi!")); QPointer<Account> ownedAccount = Account::fromId(manager, accountId); QVERIFY(ownedAccount != 0); QCOMPARE(ownedAccount->displayName(), QString("hi!")); /* Load it once more from the shared interface, and see that we get the * same object */ QCOMPARE(manager->account(accountId), sharedAccount.data()); /* Delete the manager; the owned account should survive, the shared * shouldn't */ delete manager; QVERIFY(sharedAccount == 0); QVERIFY(ownedAccount != 0); QVERIFY(ownedAccount->manager() == 0); delete ownedAccount; } void AccountsTest::testAccountList() { clearDb(); Manager *mgr = new Manager(); QVERIFY(mgr != 0); // make sure there is account Account *account = mgr->createAccount(NULL); account->sync(); AccountIdList list = mgr->accountList(NULL); QVERIFY(!list.isEmpty()); QCOMPARE(list.size(), 1); list = mgr->accountList("e-mail"); QVERIFY(list.isEmpty()); delete account; delete mgr; } void AccountsTest::testProvider() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(PROVIDER); QVERIFY(account != 0); QString provider_name = account->providerName(); QCOMPARE(provider_name, PROVIDER); delete account; /* Test invalid provider */ Provider invalid; QVERIFY(!invalid.isValid()); /* Check listing and loading of XML files */ Provider provider = mgr->provider("MyProvider"); QVERIFY(provider.isValid()); QCOMPARE(provider.displayName(), QString("My Provider")); QCOMPARE(provider.iconName(), QString("general_myprovider")); QCOMPARE(provider.description(), QString("fast & furious")); QCOMPARE(provider.trCatalog(), QString("accounts")); QCOMPARE(provider.pluginName(), QString("generic-oauth")); QCOMPARE(provider.domainsRegExp(), QString(".*example.net")); QCOMPARE(provider.isSingleAccount(), true); QCOMPARE(provider.tags().contains("user-group:mygroup"), true); QDomDocument dom = provider.domDocument(); QDomElement root = dom.documentElement(); QCOMPARE(root.tagName(), QString("provider")); /* Test copy constructor */ Provider copy(provider); QCOMPARE(copy.displayName(), QString("My Provider")); /* Test assignment */ copy = provider; QCOMPARE(copy.displayName(), QString("My Provider")); copy = invalid; QVERIFY(!copy.isValid()); copy = provider; QCOMPARE(copy.displayName(), QString("My Provider")); ProviderList providers = mgr->providerList(); QVERIFY(!providers.isEmpty()); QVERIFY(providers.size() == 1); QCOMPARE(providers[0].displayName(), QString("My Provider")); delete mgr; } void AccountsTest::testService() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); QCOMPARE(service.name(), MYSERVICE); QCOMPARE(service.description(), QStringLiteral("Test description")); QCOMPARE(service.iconName(), QString("general_myservice")); QCOMPARE(service.trCatalog(), QString("accounts")); QSet<QString> tags; tags << "email" << "e-mail"; QCOMPARE(service.tags(), tags); // Called twice, because the second time it returns a cached result QCOMPARE(service.tags(), tags); QVERIFY(service.hasTag("email")); QVERIFY(!service.hasTag("chat")); service = mgr->service(SERVICE); QVERIFY(!service.isValid()); delete mgr; } void AccountsTest::testServiceList() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); ServiceList list = mgr->serviceList(); QVERIFY(!list.isEmpty()); QCOMPARE(list.count(), 2); list = mgr->serviceList("e-mail"); QCOMPARE(list.count(), 1); list = mgr->serviceList("sharing"); QCOMPARE(list.count(), 1); delete mgr; } void AccountsTest::testServiceConst() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); QCOMPARE(service.name(), MYSERVICE); QCOMPARE(service.displayName(), QString("My Service")); QCOMPARE(service.serviceType(), QString("e-mail")); QCOMPARE(service.provider(), QString("MyProvider")); QVERIFY(service.hasTag(QString("email"))); delete mgr; } /* account */ void AccountsTest::testAccountConst() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(PROVIDER); QVERIFY(account != 0); QVERIFY(account->isWritable()); delete account; delete mgr; } void AccountsTest::testAccountProvider() { Manager *manager = new Manager(); QVERIFY(manager != 0); Account *account = manager->createAccount("MyProvider"); QVERIFY(account != 0); QCOMPARE(account->providerName(), QString("MyProvider")); Provider provider = account->provider(); QCOMPARE(provider.name(), QString("MyProvider")); delete account; delete manager; } void AccountsTest::testAccountServices() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount("MyProvider"); QVERIFY(account != 0); QVERIFY(!account->supportsService(QString("unsupported"))); QVERIFY(account->supportsService(QString("e-mail"))); ServiceList list = account->services(); QVERIFY(!list.isEmpty()); QCOMPARE(list.count(), 1); list = account->services("e-mail"); QCOMPARE(list.count(), 1); list = account->services("unsupported"); QVERIFY(list.isEmpty()); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); /* Test default settings */ account->selectService(service); QCOMPARE(account->value("parameters/server").toString(), QString("talk.google.com")); QCOMPARE(account->valueAsInt("parameters/port"), 5223); SettingSource source; QCOMPARE(account->valueAsInt("parameters/port", 0, &source), 5223); QCOMPARE(source, TEMPLATE); delete account; delete mgr; } void AccountsTest::testAccountEnabled() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(PROVIDER); QVERIFY(account != 0); QSignalSpy enabled(account, SIGNAL(enabledChanged(const QString&,bool))); account->setEnabled(true); account->sync(); QVERIFY(account->enabled()); QTRY_COMPARE(enabled.count(), 1); QCOMPARE(enabled.at(0).at(1).toBool(), true); enabled.clear(); account->setEnabled(false); account->sync(); QVERIFY(!account->enabled()); QTRY_COMPARE(enabled.count(), 1); QCOMPARE(enabled.at(0).at(1).toBool(), false); delete account; delete mgr; } void AccountsTest::testAccountDisplayName() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(PROVIDER); QVERIFY(account != 0); QSignalSpy displayNameChanged(account, SIGNAL(displayNameChanged(const QString&))); account->setDisplayName(PROVIDER); account->sync(); QCOMPARE(account->displayName(),PROVIDER); QTRY_COMPARE(displayNameChanged.count(), 1); QCOMPARE(displayNameChanged.at(0).at(0).toString(), PROVIDER); delete account; delete mgr; } void AccountsTest::testAccountValue() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(PROVIDER); QVERIFY(account != 0); QSignalSpy synced(account, SIGNAL(synced())); account->setValue(QString("test"),QString("value")); int int_value = 666; account->setValue("testint", int_value); QStringList names; names << "Tom" << "Dick" << "Harry"; account->setValue("names", names); account->setValue("big distance", quint64(3)); account->setValue("big difference", qint64(-300)); account->setValue("boolean", false); account->sync(); QTRY_COMPARE(synced.count(), 1); /* check that the values we wrote are retrieved successfully */ QVariant val = account->value(QString("test")); QCOMPARE(val.toString(), QString("value")); SettingSource source; source = account->value(QString("test"), val); QCOMPARE(val.toString(), QString("value")); QVariant intval = QVariant::Int; account->value("testint", intval); qDebug("Val: %d", intval.toInt()); QVERIFY(intval.toInt() == int_value); QVERIFY(source == ACCOUNT); QCOMPARE(account->value("names").toStringList(), names); QCOMPARE(account->value("big distance").toULongLong(), quint64(3)); QCOMPARE(account->value("big difference").toLongLong(), qint64(-300)); /* test the convenience methods */ QString strval = account->valueAsString("test"); QCOMPARE (strval, QString("value")); QCOMPARE(account->valueAsString("test", "Hi", &source), QString("value")); QCOMPARE(source, ACCOUNT); QCOMPARE(account->valueAsBool("boolean"), false); QCOMPARE(account->valueAsBool("boolean", true, &source), false); QCOMPARE(source, ACCOUNT); QCOMPARE(account->valueAsUInt64("big distance"), quint64(3)); QCOMPARE(account->valueAsUInt64("big distance", 10, &source), quint64(3)); QCOMPARE(source, ACCOUNT); strval = account->valueAsString("test_unexisting", "hello"); QCOMPARE (strval, QString("hello")); delete account; delete mgr; } void AccountsTest::testAccountSync() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(PROVIDER); QVERIFY(account != 0); QString provider = account->providerName(); QCOMPARE(provider, PROVIDER); QSignalSpy synced(account, SIGNAL(synced())); account->sync(); QTRY_COMPARE(synced.count(), 1); delete account; delete mgr; } void AccountsTest::testCreated() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); QSignalSpy created(mgr, SIGNAL(accountCreated(Accounts::AccountId))); Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); /* store the account: this will emit accountCreated */ account->sync(); QTRY_COMPARE(created.count(), 1); uint accountId = created.at(0).at(0).toUInt(); QVERIFY(accountId != 0); QCOMPARE(accountId, account->id()); delete account; delete mgr; } void AccountsTest::testRemove() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); /* store the account */ account->sync(); QVERIFY(account->id() != 0); QSignalSpy removed(account, SIGNAL(removed())); /* mark the account for deletion -- and make sure it's not deleted * immediately */ account->remove (); QCOMPARE(removed.count(), 0); /* store the changes */ account->sync(); QCOMPARE(removed.count(), 1); delete account; delete mgr; } void AccountsTest::onAccountServiceChanged() { AccountService *accountService = qobject_cast<AccountService*>(sender()); m_accountServiceChangedFields = accountService->changedFields(); } void AccountsTest::testAccountService() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); QObject *parent = new QObject(); QPointer<AccountService> shortLivedAccountService = new AccountService(account, service, parent); QVERIFY(shortLivedAccountService != 0); delete parent; QVERIFY(shortLivedAccountService == 0); AccountService *accountService = new AccountService(account, service); QVERIFY(accountService != 0); QCOMPARE(accountService->account(), account); QCOMPARE(accountService->account()->providerName(), account->providerName()); Service copy = accountService->service(); QVERIFY(copy.isValid()); QCOMPARE(copy.name(), service.name()); QObject::connect(accountService, SIGNAL(changed()), this, SLOT(onAccountServiceChanged())); QSignalSpy spyChanged(accountService, SIGNAL(changed())); QSignalSpy spyEnabled(accountService, SIGNAL(enabled(bool))); accountService->beginGroup("parameters"); QVERIFY(accountService->group() == "parameters"); /* test values from the template */ QCOMPARE(accountService->value("server").toString(), UTF8("talk.google.com")); QCOMPARE(accountService->value("port").toInt(), 5223); QCOMPARE(accountService->value("old-ssl").toBool(), true); /* now, change some values */ accountService->setValue("server", QString("www.example.com")); account->selectService(); account->setEnabled(true); account->selectService(service); account->setEnabled(true); /* write the data */ account->sync(); /* ensure that the callbacks have been called the correct number of times */ QCOMPARE(spyChanged.count(), 1); spyChanged.clear(); spyEnabled.clear(); QSet<QString> expectedChanges; expectedChanges << "parameters/server"; expectedChanges << "enabled"; #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QSet<QString> changedFields(m_accountServiceChangedFields.begin(), m_accountServiceChangedFields.end()); #else QSet<QString> changedFields = m_accountServiceChangedFields.toSet(); #endif QCOMPARE(changedFields, expectedChanges); QCOMPARE(accountService->value("server").toString(), UTF8("www.example.com")); QCOMPARE(accountService->enabled(), true); /* check the enabled status */ account->selectService(); account->setEnabled(false); account->sync(); QCOMPARE(spyChanged.count(), 0); QCOMPARE(spyEnabled.count(), 1); QCOMPARE(accountService->enabled(), false); QCOMPARE(spyEnabled.at(0).at(0).toBool(), accountService->enabled()); spyEnabled.clear(); /* enable the account, but disable the service */ account->selectService(); account->setEnabled(true); account->selectService(service); account->setEnabled(false); account->sync(); QCOMPARE(spyEnabled.count(), 0); QCOMPARE(accountService->enabled(), false); /* re-enable the service */ account->selectService(service); account->setEnabled(true); account->sync(); QCOMPARE(spyEnabled.count(), 1); QCOMPARE(accountService->enabled(), true); QCOMPARE(spyEnabled.at(0).at(0).toBool(), accountService->enabled()); spyEnabled.clear(); spyChanged.clear(); /* test some more APIs */ QSet<QString> expectedList; expectedList << "server" << "fallback-conference-server" << "port" << "old-ssl"; #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QStringList childKeysList = accountService->childKeys(); QSet<QString> childKeys(childKeysList.begin(), childKeysList.end()); QStringList childGroupsList = accountService->childGroups(); QSet<QString> childGroups(childGroupsList.begin(), childGroupsList.end()); #else QSet<QString> childKeys = accountService->childKeys().toSet(); QSet<QString> childGroups = accountService->childGroups().toSet(); #endif QCOMPARE(childKeys, expectedList); QCOMPARE(childGroups, QSet<QString>()); QCOMPARE(accountService->contains("port"), true); accountService->endGroup(); QSet<QString> expectedList2; expectedList2 << "parameters"; #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QStringList childGroupsList2 = accountService->childGroups(); QSet<QString> childGroups2(childGroupsList2.begin(), childGroupsList2.end()); #else QSet<QString> childGroups2 = accountService->childGroups().toSet(); #endif QCOMPARE(childGroups2, expectedList2); /* Remove one key */ accountService->remove("parameters/port"); account->sync(); QCOMPARE(spyChanged.count(), 1); QCOMPARE(m_accountServiceChangedFields, QStringList("parameters/port")); spyChanged.clear(); /* remove all keys */ accountService->clear(); account->sync(); QCOMPARE(spyChanged.count(), 1); QVERIFY(m_accountServiceChangedFields.contains("parameters/server")); QVERIFY(m_accountServiceChangedFields.contains("parameters/old-ssl")); spyChanged.clear(); delete accountService; delete account; delete mgr; } void AccountsTest::testWatches() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); /* create an account and some watches */ Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); account->selectService(service); Watch *w_server = account->watchKey("parameters/server"); QSignalSpy serverNotify(w_server, SIGNAL(notify(const char *))); /* test also beginGroup() */ account->beginGroup("parameters"); QVERIFY(account->group() == "parameters"); Watch *w_parameters = account->watchKey(); /* watch the whole group */ QSignalSpy parametersNotify(w_parameters, SIGNAL(notify(const char *))); Watch *w_port = account->watchKey("port"); QSignalSpy portNotify(w_port, SIGNAL(notify(const char *))); /* now, change some values */ account->setValue("server", QString("xxx.nokia.com")); /* write the data */ account->sync(); /* ensure that the callbacks have been called the correct number of times */ QCOMPARE(serverNotify.count(), 1); QCOMPARE(parametersNotify.count(), 1); QCOMPARE(portNotify.count(), 0); /* now change the port and another parameter not being watched */ account->setValue("port", 45); account->endGroup(); /* exit from the "parameters/" prefix */ account->setValue("username", QString("h4ck3r@nokia.com")); /* reset the counters */ serverNotify.clear(); parametersNotify.clear(); portNotify.clear(); /* write the data */ account->sync(); /* ensure that the callbacks have been called the correct number of times */ QCOMPARE(serverNotify.count(), 0); QCOMPARE(parametersNotify.count(), 1); QCOMPARE(portNotify.count(), 1); /* change port and server, but delete the w_port watch */ delete w_port; account->beginGroup("parameters"); account->setValue("port", 56); account->setValue("server", QString("warez.nokia.com")); /* reset the counters */ serverNotify.clear(); parametersNotify.clear(); portNotify.clear(); /* write the data */ account->sync(); /* ensure that the callbacks have been called the correct number of times */ QCOMPARE(serverNotify.count(), 1); QCOMPARE(parametersNotify.count(), 1); QCOMPARE(portNotify.count(), 0); delete account; delete mgr; } void AccountsTest::testServiceData() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); QDomDocument doc = service.domDocument(); QVERIFY(!doc.isNull()); delete mgr; } void AccountsTest::testSettings() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); /* create an account and some watches */ Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); /* create a few keys/groups */ account->setValue("username", QString("fool")); account->setValue("email", QString("fool@domain.com")); account->beginGroup("parameters"); account->setValue("server", QString("xxx.nokia.com")); account->setValue("port", 80); account->beginGroup("proxy"); /* this is a subgroup of "parameters" */ account->setValue("use", true); account->setValue("address", QString("proxy.nokia.com")); QCOMPARE(account->group(), QString("parameters/proxy")); account->endGroup(); QCOMPARE(account->group(), QString("parameters")); account->endGroup(); /* write another top-level key */ account->setValue("verified", false); /* re-enter a group */ account->beginGroup("preferences"); account->setValue("maximized", true); account->setValue("initial_directory", QString("xxx")); QCOMPARE(account->group(), QString("preferences")); account->endGroup(); /* write the data */ account->sync(); /* now check if the groups and keys are layed out as expected */ QStringList expected; QStringList result; /* check allKeys() */ expected << "username" << "email" << "verified" << "parameters/server" << "parameters/port" << "parameters/proxy/use" << "parameters/proxy/address" << "preferences/maximized" << "preferences/initial_directory"; result = account->allKeys(); expected.sort(); result.sort(); QCOMPARE(result, expected); /* check childGroups() */ expected.clear(); expected << "parameters" << "preferences"; result = account->childGroups(); expected.sort(); result.sort(); QCOMPARE(result, expected); /* check childKeys() */ expected.clear(); expected << "username" << "email" << "verified"; result = account->childKeys(); expected.sort(); result.sort(); QCOMPARE(result, expected); /* now enter a group and test the same methods as above */ account->beginGroup("parameters"); /* allKeys */ expected.clear(); expected << "server" << "port" << "proxy/use" << "proxy/address"; result = account->allKeys(); expected.sort(); result.sort(); QCOMPARE(result, expected); /* childGroups */ expected.clear(); expected << "proxy"; result = account->childGroups(); expected.sort(); result.sort(); QCOMPARE(result, expected); /* childKeys() */ expected.clear(); expected << "server" << "port"; result = account->childKeys(); expected.sort(); result.sort(); QCOMPARE(result, expected); /* contains() */ QVERIFY(account->contains("server") == true); QVERIFY(account->contains("unexisting") == false); /* test remove() */ account->remove(""); /* remove all the parameters/ group */ account->endGroup(); account->remove("verified"); /* we need to sync, for the changes to take effect */ account->sync(); expected.clear(); expected << "username" << "email" << "preferences/maximized" << "preferences/initial_directory"; result = account->allKeys(); expected.sort(); result.sort(); QCOMPARE(result, expected); /* Test clear(): call it from inside the preferences/ group */ account->beginGroup("preferences"); account->clear(); account->sync(); expected.clear(); /* all keys should have been deleted */ result = account->allKeys(); expected.sort(); result.sort(); QCOMPARE(result, expected); delete account; delete mgr; } void AccountsTest::testKeySignVerify() { #ifndef HAVE_AEGISCRYPTO QSKIP("aegis-crypto not detected."); #endif const QString key = "key"; const char *token; QList<const char*> listOfTokens; listOfTokens << "libaccounts-glib0::accounts-glib-access" << "libaccounts-glib0::dummy" << "libaccounts-glib0::idiotic"; bool ok; Manager *mgr = new Manager(); QVERIFY (mgr != 0); Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); account->setValue(key, QString("the key value")); account->syncAndBlock(); account->sign(key, listOfTokens.at(0)); account->syncAndBlock(); ok = account->verify(key, &token); QVERIFY(ok == true); ok = account->verifyWithTokens(key, listOfTokens); QVERIFY(ok == true); delete mgr; } void AccountsTest::testIncrementalAccountIds() { clearDb(); Manager *mgr = new Manager; QVERIFY(mgr != 0); Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); QVERIFY(account->manager() == mgr); account->syncAndBlock(); AccountId lastId = account->id(); account->remove(); account->syncAndBlock(); delete account; account = mgr->createAccount(NULL); QVERIFY(account != 0); QVERIFY(account->manager() == mgr); account->syncAndBlock(); QCOMPARE(account->id(), lastId + 1); delete account; delete mgr; } void AccountsTest::testSelectGlobalAccountSettings() { Manager *mgr = new Manager; QVERIFY(mgr != 0); Account *account = mgr->createAccount("MyProvider"); QVERIFY(account != 0); QVERIFY(account->manager() == mgr); account->syncAndBlock(); QVERIFY(account->id() > 0); account->selectService(); Service selectedService = account->selectedService(); QVERIFY(!selectedService.isValid()); delete mgr; } void AccountsTest::testCredentialsId() { Manager *mgr = new Manager; QVERIFY(mgr != 0); Account *account = mgr->createAccount("MyProvider"); QVERIFY(account != 0); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); uint globalId = 69, myServiceId = 0xDEAD; account->setCredentialsId(globalId); account->selectService(service); account->setCredentialsId(myServiceId); account->syncAndBlock(); QVERIFY(account->id() != 0); QCOMPARE(account->credentialsId(), myServiceId); /* select a service with no credentials: we should get the global * credentials ID, but the selected service shouldn't change */ service = mgr->service(OTHERSERVICE); QVERIFY(service.isValid()); account->selectService(service); QCOMPARE(account->credentialsId(), globalId); QCOMPARE(account->selectedService(), service); /* now make sure that we can get the ID from the global accounts settings */ account->selectService(); QCOMPARE(account->credentialsId(), globalId); delete mgr; } void AccountsTest::testAuthData() { Manager *manager = new Manager; QVERIFY(manager != 0); Account *account = manager->createAccount("MyProvider"); QVERIFY(account != 0); Service service = manager->service(MYSERVICE); QVERIFY(service.isValid()); const uint credentialsId = 69; const QString method = "mymethod"; const QString mechanism = "mymechanism"; QString prefix = QString::fromLatin1("auth/%1/%2/").arg(method).arg(mechanism); QVariantMap globalParameters; globalParameters["server"] = UTF8("myserver.com"); globalParameters["port"] = 8080; globalParameters["other"] = UTF8("overriden parameter"); globalParameters["scopes"] = QStringList() << "read" << "write" << "edit"; QVariantMap serviceParameters; serviceParameters["other"] = UTF8("better parameter"); serviceParameters["boolean"] = true; account->setCredentialsId(credentialsId); account->setValue("auth/method", method); account->setValue("auth/mechanism", UTF8("overriden mechanism")); QMapIterator<QString,QVariant> i(globalParameters); while (i.hasNext()) { i.next(); account->setValue(prefix + i.key(), i.value()); } account->selectService(service); account->setValue("auth/mechanism", mechanism); i = QMapIterator<QString,QVariant>(serviceParameters); while (i.hasNext()) { i.next(); account->setValue(prefix + i.key(), i.value()); } account->syncAndBlock(); QVERIFY(account->id() != 0); AccountService *accountService = new AccountService(account, service); QVERIFY(accountService != 0); AuthData authData = accountService->authData(); QCOMPARE(authData.method(), method); QCOMPARE(authData.mechanism(), mechanism); QCOMPARE(authData.credentialsId(), credentialsId); QVariantMap expectedParameters = globalParameters; i = QMapIterator<QString,QVariant>(serviceParameters); while (i.hasNext()) { i.next(); expectedParameters.insert(i.key(), i.value()); } QCOMPARE(authData.parameters(), expectedParameters); /* Test copy constructor */ AuthData copy(authData); QCOMPARE(copy.parameters(), expectedParameters); /* And delete destructor */ AuthData *copy2 = new AuthData(authData); QCOMPARE(copy2->parameters(), expectedParameters); delete copy2; delete accountService; delete account; delete manager; QVERIFY(service.isValid()); } void AccountsTest::testGlobalAuthData() { Manager *manager = new Manager; QVERIFY(manager != 0); Account *account = manager->createAccount("MyProvider"); QVERIFY(account != 0); Service service; // global account QVERIFY(!service.isValid()); AccountService *accountService = new AccountService(account, service); QVERIFY(accountService != 0); AuthData authData = accountService->authData(); QCOMPARE(authData.method(), QString("oauth2")); QCOMPARE(authData.mechanism(), QString("user_agent")); QCOMPARE(authData.credentialsId(), uint(0)); QVariantMap expectedParameters; expectedParameters.insert("Host", QString("myserver.example")); QCOMPARE(authData.parameters(), expectedParameters); delete accountService; delete account; delete manager; } void AccountsTest::testListEnabledServices() { clearDb(); Manager *mgr = new Manager(); QVERIFY(mgr != 0); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); Account* account = mgr->createAccount("MyProvider"); QVERIFY(account != 0); account->selectService(service); account->setEnabled(true); account->sync(); ServiceList list = account->enabledServices(); QVERIFY(!list.isEmpty()); QCOMPARE(list.size(), 1); account->selectService(service); account->setEnabled(false); account->sync(); list = account->enabledServices(); QVERIFY(list.isEmpty()); delete account; delete mgr; } void AccountsTest::testListEnabledByServiceType() { clearDb(); Manager *mgr = new Manager("e-mail"); QVERIFY(mgr != 0); QCOMPARE(mgr->serviceType(), QString("e-mail")); Account *account = mgr->createAccount("MyProvider"); QVERIFY(account != 0); account->setEnabled(true); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); account->selectService(service); account->setEnabled(true); account->sync(); AccountIdList list = mgr->accountListEnabled("e-mail"); QVERIFY(!list.isEmpty()); QCOMPARE(list.size(), 1); list = mgr->accountListEnabled(); QCOMPARE(list.count(), 1); account->setEnabled(false); account->sync(); list = mgr->accountListEnabled("e-mail"); QVERIFY(list.isEmpty()); delete account; delete mgr; } void AccountsTest::testEnabledEvent() { Manager *mgr = new Manager("e-mail"); QVERIFY(mgr != 0); QSignalSpy enabledEvent1(mgr, SIGNAL(enabledEvent(Accounts::AccountId))); Account *account = mgr->createAccount(NULL); QVERIFY(account != 0); account->setEnabled(true); account->sync(); QTRY_COMPARE(enabledEvent1.count(), 1); QCOMPARE(enabledEvent1.at(0).at(0).toUInt(), account->id()); //if we create manager without service type the signal should not be emitted Manager *mgr2 = new Manager(); QVERIFY(mgr2 != 0); QSignalSpy enabledEvent2(mgr2, SIGNAL(enabledEvent(Accounts::AccountId))); Account *account2 = mgr2->createAccount(NULL); QVERIFY(account2 != 0); account2->setEnabled(true); account2->sync(); QCOMPARE(enabledEvent2.count(), 0); delete account; delete account2; delete mgr; delete mgr2; } void AccountsTest::testServiceType() { Manager *mgr = new Manager(); QVERIFY(mgr != 0); ServiceType serviceType; serviceType = mgr->serviceType("unexisting-type"); QVERIFY(!serviceType.isValid()); serviceType = mgr->serviceType(EMAIL_SERVICE_TYPE); QVERIFY(serviceType.isValid()); QCOMPARE(serviceType.name(), EMAIL_SERVICE_TYPE); QCOMPARE(serviceType.description(), QStringLiteral("Email test description")); QCOMPARE(serviceType.displayName(), QStringLiteral("Electronic mail")); QCOMPARE(serviceType.trCatalog(), QStringLiteral("translation_file")); QCOMPARE(serviceType.iconName(), QStringLiteral("email_icon")); QVERIFY(serviceType.tags().contains(QString("email"))); // called twice, because the second time it returns a cached result QVERIFY(serviceType.tags().contains(QString("email"))); QVERIFY(serviceType.hasTag(QString("email"))); QVERIFY(!serviceType.hasTag(QString("fake-email"))); QDomDocument dom = serviceType.domDocument(); QDomElement root = dom.documentElement(); QCOMPARE(root.tagName(), QString("service-type")); ServiceType copy(serviceType); QCOMPARE(copy.displayName(), QStringLiteral("Electronic mail")); delete mgr; } void AccountsTest::testUpdateAccount() { clearDb(); Manager *mgr = new Manager("e-mail"); QVERIFY(mgr != 0); QSignalSpy accountUpdated(mgr, SIGNAL(accountUpdated(Accounts::AccountId))); Account *account = mgr->createAccount("MyProvider"); QVERIFY(account != 0); account->syncAndBlock(); Service service = mgr->service(MYSERVICE); QVERIFY(service.isValid()); account->selectService(service); account->setValue("key", QVariant("value")); account->syncAndBlock(); QTRY_COMPARE(accountUpdated.count(), 1); QCOMPARE(accountUpdated.at(0).at(0).toUInt(), account->id()); //if we create manager without service type the signal shoudl not be emitted Manager *mgr2 = new Manager(); QVERIFY(mgr2 != 0); QSignalSpy accountUpdated2(mgr2, SIGNAL(accountUpdated(Accounts::AccountId))); Account *account2 = mgr2->createAccount(NULL); QVERIFY(account2 != 0); account2->setValue("key", QVariant("value")); account2->syncAndBlock(); QCOMPARE(accountUpdated2.count(), 0); delete account; delete account2; delete mgr; delete mgr2; } void AccountsTest::testApplication() { Manager *manager = new Manager(); QVERIFY(manager != 0); Application application = manager->application("Mailer"); QVERIFY(application.isValid()); Service email = manager->service("MyService"); QVERIFY(email.isValid()); Service sharing = manager->service("OtherService"); QVERIFY(sharing.isValid()); QCOMPARE(application.name(), UTF8("Mailer")); QCOMPARE(application.displayName(), UTF8("Easy Mailer")); QCOMPARE(application.description(), UTF8("Mailer application")); QCOMPARE(application.trCatalog(), UTF8("mailer-catalog")); QCOMPARE(application.iconName(), UTF8("mailer-icon")); QCOMPARE(application.desktopFilePath(), UTF8(qgetenv("AG_APPLICATIONS") + "/applications/mailer.desktop")); QVERIFY(application.supportsService(email)); QCOMPARE(application.serviceUsage(email), UTF8("Mailer can retrieve your e-mails")); ApplicationList apps = manager->applicationList(email); QCOMPARE(apps.count(), 1); QCOMPARE(apps[0].name(), UTF8("Mailer")); apps = manager->applicationList(sharing); QCOMPARE(apps.count(), 1); application = apps[0]; QCOMPARE(application.name(), UTF8("Gallery")); QCOMPARE(application.description(), UTF8("Image gallery")); QVERIFY(application.supportsService(sharing)); QCOMPARE(application.serviceUsage(sharing), UTF8("Publish images on OtherService")); /* Test an invalid application */ Application app2; QVERIFY(!app2.isValid()); Application app3(app2); QVERIFY(!app3.isValid()); delete manager; } void AccountsTest::testApplicationListServices() { Manager *manager = new Manager(); QVERIFY(manager != 0); Application application = manager->application("Mailer"); QVERIFY(application.isValid()); ServiceList services = manager->serviceList(application); QCOMPARE(services.count(), 1); Service service = services.first(); QCOMPARE(service.name(), QString("MyService")); delete manager; } QTEST_GUILESS_MAIN(AccountsTest) #include "tst_libaccounts.moc" 07070100000049000081A40000000000000000000000016560BF900000032A000000000000000000000000000000000000004900000000libaccounts-qt-1.16git.20231124T162152~18557f7/tests/tst_libaccounts.proinclude( ../common-project-config.pri ) include( ../common-vars.pri ) TARGET = accountstest SOURCES += \ tst_libaccounts.cpp QT = \ core \ testlib \ xml LIBS += -laccounts-qt$${QT_MAJOR_VERSION} INCLUDEPATH += $${TOP_SRC_DIR} QMAKE_LIBDIR += \ $${TOP_BUILD_DIR}/Accounts QMAKE_RPATHDIR = $${QMAKE_LIBDIR} #Check for the existence of aegis-crypto system(pkg-config --exists aegis-crypto) :HAVE_AEGISCRYPTO=YES contains(HAVE_AEGISCRYPTO, YES) { message("aegis-crypto detected...") DEFINES += HAVE_AEGISCRYPTO } include( ../common-installs-config.pri ) DATA_PATH = $${TOP_SRC_DIR}/tests DEFINES += \ DATA_PATH=\\\"$$DATA_PATH\\\" QMAKE_EXTRA_TARGETS += check check.depends = $${TARGET} check.commands = "TESTDIR=$${TOP_SRC_DIR}/tests $${TOP_SRC_DIR}/tests/accountstest.sh" 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!580 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor