File indexing completed on 2024-04-14 03:52:48
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org> 0004 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KIO_CONNECTIONSERVER_H 0010 #define KIO_CONNECTIONSERVER_H 0011 0012 #include "kiocore_export.h" 0013 0014 #include <QObject> 0015 #include <QUrl> 0016 #include <memory> 0017 0018 namespace KIO 0019 { 0020 class ConnectionServerPrivate; 0021 class Connection; 0022 0023 /* 0024 * This class provides a way to obtaining KIO::Connection connections. 0025 */ 0026 class ConnectionServer : public QObject 0027 { 0028 Q_OBJECT 0029 public: 0030 explicit ConnectionServer(QObject *parent = nullptr); 0031 ~ConnectionServer() override; 0032 0033 /** 0034 * Sets this connection to listen mode. Use address() to obtain the 0035 * address this is listening on. 0036 */ 0037 void listenForRemote(); 0038 bool isListening() const; 0039 /// Closes the connection. 0040 void close(); 0041 0042 /** 0043 * Returns the address for this connection if it is listening, an empty 0044 * address if not. 0045 */ 0046 QUrl address() const; 0047 0048 Connection *nextPendingConnection(); 0049 void setNextPendingConnection(Connection *conn); 0050 0051 Q_SIGNALS: 0052 void newConnection(); 0053 0054 private: 0055 friend class ConnectionServerPrivate; 0056 std::unique_ptr<ConnectionServerPrivate> const d; 0057 }; 0058 0059 } // namespace KIO 0060 0061 #endif