File indexing completed on 2024-05-05 16:13:26

0001 // -*- c++ -*-
0002 /*
0003     This file is part of the KDE libraries
0004     SPDX-FileCopyrightText: 2001 Waldo Bastian <bastian@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-only
0007 */
0008 
0009 #ifndef KIO_SLAVE_CONFIG_H
0010 #define KIO_SLAVE_CONFIG_H
0011 
0012 #include "kiocore_export.h"
0013 #include "metadata.h"
0014 #include <QObject>
0015 
0016 #include <memory>
0017 
0018 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 102)
0019 
0020 namespace KIO
0021 {
0022 class SlaveConfigPrivate;
0023 /**
0024  * @class KIO::SlaveConfig slaveconfig.h <KIO/SlaveConfig>
0025  *
0026  * SlaveConfig
0027  *
0028  * This class manages the configuration for io-slaves based on protocol
0029  * and host. The Scheduler makes use of this class to configure the slave
0030  * whenever it has to connect to a new host.
0031  *
0032  * You only need to use this class if you want to override specific
0033  * configuration items of an io-slave when the io-slave is used by
0034  * your application.
0035  *
0036  * Normally io-slaves are being configured by "kio_<protocol>rc"
0037  * configuration files. Groups defined in such files are treated as host
0038  * or domain specification. Configuration items defined in a group are
0039  * only applied when the slave is connecting with a host that matches with
0040  * the host and/or domain specified by the group.
0041  *
0042  * @deprecated Since 5.102, no known external users.
0043  */
0044 class KIOCORE_EXPORT SlaveConfig : public QObject
0045 {
0046     Q_OBJECT
0047 public:
0048     KIOCORE_DEPRECATED_VERSION(5, 102, "No known external users")
0049     static SlaveConfig *self();
0050     ~SlaveConfig() override;
0051     /**
0052      * Configure slaves of type @p protocol by setting @p key to @p value.
0053      * If @p host is specified the configuration only applies when dealing
0054      * with @p host.
0055      *
0056      * Changes made to the slave configuration only apply to slaves
0057      * used by the current process.
0058      */
0059     void setConfigData(const QString &protocol, const QString &host, const QString &key, const QString &value);
0060 
0061     /**
0062      * Configure slaves of type @p protocol with @p config.
0063      * If @p host is specified the configuration only applies when dealing
0064      * with @p host.
0065      *
0066      * Changes made to the slave configuration only apply to slaves
0067      * used by the current process.
0068      */
0069     void setConfigData(const QString &protocol, const QString &host, const MetaData &config);
0070 
0071     /**
0072      * Query slave configuration for slaves of type @p protocol when
0073      * dealing with @p host.
0074      */
0075     MetaData configData(const QString &protocol, const QString &host);
0076 
0077     /**
0078      * Query a specific configuration key for slaves of type @p protocol when
0079      * dealing with @p host.
0080      */
0081     QString configData(const QString &protocol, const QString &host, const QString &key);
0082 
0083     /**
0084      * Undo any changes made by calls to setConfigData.
0085      */
0086     void reset();
0087 Q_SIGNALS:
0088     /**
0089      * This signal is raised when a slave of type @p protocol deals
0090      * with @p host for the first time.
0091      *
0092      * Your application can use this signal to make some last minute
0093      * configuration changes with setConfigData based on the
0094      * host.
0095      */
0096     void configNeeded(const QString &protocol, const QString &host);
0097 
0098 protected:
0099     SlaveConfig();
0100 
0101 private:
0102     std::unique_ptr<SlaveConfigPrivate> const d;
0103     friend class SlaveConfigSingleton;
0104 };
0105 }
0106 
0107 #endif
0108 
0109 #endif