1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
4 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KIO_CONNECTIONSERVER_H
10#define KIO_CONNECTIONSERVER_H
11
12#include "kiocore_export.h"
13
14#include <QObject>
15#include <QUrl>
16#include <memory>
17
18namespace KIO
19{
20class ConnectionServerPrivate;
21class Connection;
22
23/*
24 * This class provides a way to obtaining KIO::Connection connections.
25 */
26class ConnectionServer : public QObject
27{
28 Q_OBJECT
29public:
30 explicit ConnectionServer(QObject *parent = nullptr);
31 ~ConnectionServer() override;
32
33 /**
34 * Sets this connection to listen mode. Use address() to obtain the
35 * address this is listening on.
36 */
37 void listenForRemote();
38 bool isListening() const;
39 /// Closes the connection.
40 void close();
41
42 /**
43 * Returns the address for this connection if it is listening, an empty
44 * address if not.
45 */
46 QUrl address() const;
47
48 Connection *nextPendingConnection();
49 void setNextPendingConnection(Connection *conn);
50
51Q_SIGNALS:
52 void newConnection();
53
54private:
55 friend class ConnectionServerPrivate;
56 std::unique_ptr<ConnectionServerPrivate> const d;
57};
58
59} // namespace KIO
60
61#endif
62

source code of kio/src/core/connectionserver.h