KIO

workerconfig.h
1// -*- c++ -*-
2/*
3 This file is part of the KDE libraries
4 SPDX-FileCopyrightText: 2001 Waldo Bastian <bastian@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-only
7*/
8
9#ifndef KIO_WORKER_CONFIG_H
10#define KIO_WORKER_CONFIG_H
11
12#include "metadata.h"
13#include <QObject>
14
15#include <memory>
16
17namespace KIO
18{
19class WorkerConfigPrivate;
20/**
21 * This class manages the configuration for KIO workers based on protocol
22 * and host. The Scheduler makes use of this class to configure the worker
23 * whenever it has to connect to a new host.
24 *
25 * You only need to use this class if you want to override specific
26 * configuration items of an KIO worker when the worker is used by
27 * your application.
28 *
29 * Normally KIO workers are being configured by "kio_<protocol>rc"
30 * configuration files. Groups defined in such files are treated as host
31 * or domain specification. Configuration items defined in a group are
32 * only applied when the worker is connecting with a host that matches with
33 * the host and/or domain specified by the group.
34 */
35class WorkerConfig : public QObject
36{
38
39public:
40 static WorkerConfig *self();
41 ~WorkerConfig() override;
42 /**
43 * Configure workers of type @p protocol by setting @p key to @p value.
44 * If @p host is specified the configuration only applies when dealing
45 * with @p host.
46 *
47 * Changes made to the worker configuration only apply to workers
48 * used by the current process.
49 */
50 void setConfigData(const QString &protocol, const QString &host, const QString &key, const QString &value);
51
52 /**
53 * Configure workers of type @p protocol with @p config.
54 * If @p host is specified the configuration only applies when dealing
55 * with @p host.
56 *
57 * Changes made to the worker configuration only apply to workers
58 * used by the current process.
59 */
60 void setConfigData(const QString &protocol, const QString &host, const MetaData &config);
61
62 /**
63 * Query worker configuration for workers of type @p protocol when
64 * dealing with @p host.
65 */
66 MetaData configData(const QString &protocol, const QString &host);
67
68 /**
69 * Query a specific configuration key for workers of type @p protocol when
70 * dealing with @p host.
71 */
72 QString configData(const QString &protocol, const QString &host, const QString &key);
73
74 /**
75 * Undo any changes made by calls to setConfigData.
76 */
77 void reset();
78
80 /**
81 * This signal is raised when a worker of type @p protocol deals
82 * with @p host for the first time.
83 *
84 * Your application can use this signal to make some last minute
85 * configuration changes with setConfigData based on the
86 * host.
87 */
88 void configNeeded(const QString &protocol, const QString &host);
89
90protected:
92
93private:
94 std::unique_ptr<WorkerConfigPrivate> const d;
95 friend class WorkerConfigSingleton;
96};
97}
98
99#endif
MetaData is a simple map of key/value strings.
Definition metadata.h:23
This class manages the configuration for KIO workers based on protocol and host.
void reset()
Undo any changes made by calls to setConfigData.
void setConfigData(const QString &protocol, const QString &host, const QString &key, const QString &value)
Configure workers of type protocol by setting key to value.
void configNeeded(const QString &protocol, const QString &host)
This signal is raised when a worker of type protocol deals with host for the first time.
MetaData configData(const QString &protocol, const QString &host)
Query worker configuration for workers of type protocol when dealing with host.
A namespace for KIO globals.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:52 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.