File indexing completed on 2024-04-28 04:56:50

0001 /*
0002  *  SPDX-FileCopyrightText: 2013 Alejandro Fiestas Olivares <afiestas@kde.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIO_SERVICES_H
0008 #define KIO_SERVICES_H
0009 
0010 #include "kaccountsdplugin.h"
0011 
0012 #include <QMap>
0013 #include <QObject>
0014 #include <QString>
0015 
0016 #include <Accounts/Account>
0017 #include <Accounts/Service>
0018 
0019 #include <QCoroCore>
0020 
0021 class KJob;
0022 class AkonadiAccounts;
0023 
0024 namespace Accounts
0025 {
0026 class Manager;
0027 }
0028 
0029 class KIOServices : public KAccounts::KAccountsDPlugin
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     KIOServices(QObject *parent, const QVariantList &args);
0035     ~KIOServices() override;
0036 
0037 public Q_SLOTS:
0038     void onAccountCreated(const Accounts::AccountId accId, const Accounts::ServiceList &serviceList) override;
0039     void onAccountRemoved(const Accounts::AccountId accId) override;
0040     void onServiceEnabled(const Accounts::AccountId accId, const Accounts::Service &service) override;
0041     void onServiceDisabled(const Accounts::AccountId accId, const Accounts::Service &service) override;
0042 
0043 private:
0044     void enableService(const Accounts::AccountId accId, const Accounts::Service &service);
0045     void disableService(const Accounts::AccountId accId, const QString &serviceName);
0046     QCoro::Task<void> createNetAttach(const Accounts::AccountId accId, const Accounts::Service &service);
0047     QCoro::Task<QString> getRealm(const QUrl &url);
0048     QCoro::Task<void> removeNetAttach(const QString &id);
0049     bool isEnabled(const Accounts::AccountId accId, const QString &serviceName);
0050 };
0051 
0052 #endif // KIO_SERVICES_H