diff --git a/src/lib/accountservicetogglejob.h b/src/lib/accountservicetogglejob.h index 618ef72..e4fa226 100644 --- a/src/lib/accountservicetogglejob.h +++ b/src/lib/accountservicetogglejob.h @@ -1,55 +1,58 @@ /************************************************************************************* * Copyright (C) 2020 by Dan Leinir Turthra Jensen * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as published by the Free Software Foundation; either version 2 * * of the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * *************************************************************************************/ #ifndef ACCOUNTSERVICETOGGLE_H #define ACCOUNTSERVICETOGGLE_H #include "kaccounts_export.h" #include #include +/** + * @brief A job used to change the enabled state of a specific service on a specific account + */ class KACCOUNTS_EXPORT AccountServiceToggleJob : public KJob { Q_OBJECT Q_PROPERTY(QString accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged) Q_PROPERTY(QString serviceId READ serviceId WRITE setServiceId NOTIFY serviceIdChanged) Q_PROPERTY(bool serviceEnabled READ serviceEnabled WRITE setServiceEnabled NOTIFY serviceEnabledChanged) public: explicit AccountServiceToggleJob(QObject* parent = nullptr); virtual ~AccountServiceToggleJob(); void start() override; QString accountId() const; void setAccountId(const QString& accountId); Q_SIGNAL void accountIdChanged(); QString serviceId() const; void setServiceId(const QString& serviceId); Q_SIGNAL void serviceIdChanged(); bool serviceEnabled() const; void setServiceEnabled(bool serviceEnabled); Q_SIGNAL void serviceEnabledChanged(); private: class Private; Private* d; }; #endif//ACCOUNTSERVICETOGGLE_H diff --git a/src/lib/changeaccountdisplaynamejob.h b/src/lib/changeaccountdisplaynamejob.h index 1663ff1..a1f2634 100644 --- a/src/lib/changeaccountdisplaynamejob.h +++ b/src/lib/changeaccountdisplaynamejob.h @@ -1,50 +1,56 @@ /************************************************************************************* * Copyright (C) 2020 by Dan Leinir Turthra Jensen * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as published by the Free Software Foundation; either version 2 * * of the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * *************************************************************************************/ #ifndef CHANGEACCOUNTDISPLAYNAMEJOB_H #define CHANGEACCOUNTDISPLAYNAMEJOB_H #include "kaccounts_export.h" #include #include +/** + * @brief A job used to change the human-readable name of a specified account + * + * This job will refuse to change the name to something empty (while it is technically + * possible to do so for an account, it is highly undesirable) + */ class KACCOUNTS_EXPORT ChangeAccountDisplayNameJob : public KJob { Q_OBJECT Q_PROPERTY(QString accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged) Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged) public: explicit ChangeAccountDisplayNameJob(QObject* parent = nullptr); virtual ~ChangeAccountDisplayNameJob(); void start() override; QString accountId() const; void setAccountId(const QString& accountId); Q_SIGNAL void accountIdChanged(); QString displayName() const; void setDisplayName(const QString& displayName); Q_SIGNAL void displayNameChanged(); private: class Private; Private* d; }; #endif//CHANGEACCOUNTDISPLAYNAMEJOB_H diff --git a/src/lib/createaccountjob.h b/src/lib/createaccountjob.h index a86635b..a827069 100644 --- a/src/lib/createaccountjob.h +++ b/src/lib/createaccountjob.h @@ -1,76 +1,79 @@ /************************************************************************************* * Copyright (C) 2013 by Alejandro Fiestas Olivares * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as published by the Free Software Foundation; either version 2 * * of the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * *************************************************************************************/ #ifndef CREATE_ACCOUNT_JOB_H #define CREATE_ACCOUNT_JOB_H #include "kaccounts_export.h" #include #include namespace Accounts { class Account; class Manager; class AccountService; } namespace SignOn { class Error; class Identity; class SessionData; class IdentityInfo; } +/** + * @brief Create a new account for the specified provider + */ class KACCOUNTS_EXPORT CreateAccountJob : public KJob { Q_OBJECT Q_PROPERTY(QString providerName READ providerName WRITE setProviderName NOTIFY providerNameChanged) public: explicit CreateAccountJob(QObject* parent = nullptr); explicit CreateAccountJob(const QString &providerName, QObject* parent = nullptr); QString providerName() const { return m_providerName; } void setProviderName(const QString &name); void start() override; private Q_SLOTS: void processSession(); void sessionError(const SignOn::Error &signOnError); void sessionResponse(const SignOn::SessionData &data); void info(const SignOn::IdentityInfo &info); void pluginFinished(const QString &screenName, const QString &secret, const QVariantMap &map); void pluginError(const QString &error); Q_SIGNALS: void providerNameChanged(); private: void loadPluginAndShowDialog(const QString &pluginName); QString m_providerName; QStringList m_disabledServices; Accounts::Manager *m_manager; Accounts::Account *m_account; Accounts::AccountService *m_accInfo; SignOn::Identity *m_identity; bool m_done; }; #endif //CREATE_ACCOUNT_JOB_H diff --git a/src/lib/getcredentialsjob.h b/src/lib/getcredentialsjob.h index 7de5a33..195641e 100644 --- a/src/lib/getcredentialsjob.h +++ b/src/lib/getcredentialsjob.h @@ -1,94 +1,94 @@ /************************************************************************************* * Copyright (C) 2013 by Alejandro Fiestas Olivares * * * * 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 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 * * Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public License * * along with this library; see the file COPYING.LIB. If not, write to * * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301, USA. * *************************************************************************************/ #ifndef GET_CREDENTIALS_JOB_H #define GET_CREDENTIALS_JOB_H #include "kaccounts_export.h" #include #include namespace Accounts { class Manager; } /** - * A KJob for obtaining user's credentials for the given Accounts::AccountId + * @brief A KJob for obtaining user's credentials for the given Accounts::AccountId */ class KACCOUNTS_EXPORT GetCredentialsJob : public KJob { Q_OBJECT public: /** * Constructs the job with auth method and mechanism coming from the service * type. If no service type is specified, the default will be used * * @param id AccountId for which the credentials will be obtained */ explicit GetCredentialsJob(const Accounts::AccountId &id, QObject *parent = nullptr); /** * This version of the constructor allow passing specific auth method and mechanism * for which we want the credentials * * For example some account has OAuth token and username-password credentials, * by setting both method and mechanism to "password", only the password will be * retrieved. Otherwise it depends on the passed serviceType - if there's no serviceType * set, it will use the default service for the given AccountId and will obtain * the credentials needed for that service * * @param id AccountId for which the credentials will be obtained * @param authMethod Auth method for which the credentials will be obtained * @param authMechanism Auth mechanism for which the credentials will be obtained */ GetCredentialsJob(const Accounts::AccountId &id, const QString &authMethod = QString(), const QString &authMechanism = QString(), QObject *parent = nullptr); /** * Starts the credentials job */ void start() override; /** * Set service for which the auth method and mechanism will be selected * * @param serviceType Account's service type */ void setServiceType(const QString &serviceType); /** * The obtained credentials data * * This will be valid only after the job has finished * * @returns Map with the credentials */ QVariantMap credentialsData() const; /** * @returns Account id for which the credentials are obtained */ Accounts::AccountId accountId() const; private: class Private; Private * const d; Q_PRIVATE_SLOT(d, void getCredentials()) }; #endif //GET_CREDENTIALS_JOB_H diff --git a/src/lib/removeaccountjob.h b/src/lib/removeaccountjob.h index 561562a..2597848 100644 --- a/src/lib/removeaccountjob.h +++ b/src/lib/removeaccountjob.h @@ -1,45 +1,48 @@ /************************************************************************************* * Copyright (C) 2020 by Dan Leinir Turthra Jensen * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as published by the Free Software Foundation; either version 2 * * of the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * *************************************************************************************/ #ifndef REMOVEACCOUNT_H #define REMOVEACCOUNT_H #include "kaccounts_export.h" #include #include +/** + * @brief A job which will attempt to remove the specified account + */ class KACCOUNTS_EXPORT RemoveAccountJob : public KJob { Q_OBJECT Q_PROPERTY(QString accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged) public: explicit RemoveAccountJob(QObject* parent = nullptr); virtual ~RemoveAccountJob(); void start() override; QString accountId() const; void setAccountId(const QString& accountId); Q_SIGNAL void accountIdChanged(); private: class Private; Private* d; }; #endif//REMOVEACCOUNT_H