| 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 <QObject> |
| 13 | #include <QUrl> |
| 14 | |
| 15 | #include "connectionbackend_p.h" |
| 16 | |
| 17 | namespace KIO |
| 18 | { |
| 19 | class ConnectionServerPrivate; |
| 20 | class Connection; |
| 21 | |
| 22 | /* |
| 23 | * This class provides a way to obtaining KIO::Connection connections. |
| 24 | */ |
| 25 | class ConnectionServer : public QObject |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | public: |
| 29 | explicit ConnectionServer(QObject *parent = nullptr); |
| 30 | ~ConnectionServer() override; |
| 31 | |
| 32 | /*! |
| 33 | * Sets this connection to listen mode. Use address() to obtain the |
| 34 | * address this is listening on. |
| 35 | */ |
| 36 | void listenForRemote(); |
| 37 | bool isListening() const; |
| 38 | |
| 39 | /*! |
| 40 | * Returns the address for this connection if it is listening, an empty |
| 41 | * address if not. |
| 42 | */ |
| 43 | QUrl address() const; |
| 44 | |
| 45 | void setNextPendingConnection(Connection *conn); |
| 46 | |
| 47 | Q_SIGNALS: |
| 48 | void newConnection(); |
| 49 | |
| 50 | private: |
| 51 | ConnectionBackend *backend = nullptr; |
| 52 | }; |
| 53 | |
| 54 | } // namespace KIO |
| 55 | |
| 56 | #endif |
| 57 | |