File indexing completed on 2024-04-21 14:56:10

0001 /*
0002     Copyright 2006-2007 Will Stephenson <wstephenson@kde.org>
0003     Copyright 2006-2007 Kevin Ottens <ervin@kde.org>
0004 
0005     This library is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU Lesser General Public
0007     License as published by the Free Software Foundation; either
0008     version 2.1 of the License, or (at your option) version 3, or any
0009     later version accepted by the membership of KDE e.V. (or its
0010     successor approved by the membership of KDE e.V.), which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library is distributed in the hope that it will be useful,
0014     but WITHOUT ANY WARRANTY; without even the implied warranty of
0015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library. If not, see <http://www.gnu.org/licenses/>.
0020 */
0021 #ifndef SOLID_NETWORKING_P_H
0022 #define SOLID_NETWORKING_P_H
0023 
0024 #include <QMap>
0025 #include <QtNetwork/QNetworkConfigurationManager>
0026 
0027 #include "networking.h"
0028 
0029 class OrgKdeSolidNetworkingClientInterface;
0030 class QAbstractSocket;
0031 class QTimer;
0032 
0033 namespace Solid
0034 {
0035 class ManagedSocketContainer;
0036 
0037 class NetworkingPrivate : public Networking::Notifier
0038 {
0039     Q_OBJECT
0040     Q_PROPERTY(uint Status  READ status)
0041     Q_CLASSINFO("D-Bus Interface", "org.kde.Solid.Networking.Client")
0042 public:
0043     NetworkingPrivate();
0044     ~NetworkingPrivate() override;
0045     void shouldConnect()
0046     {
0047         Networking::Notifier::shouldConnect();
0048     }
0049     void shouldDisconnect()
0050     {
0051         Networking::Notifier::shouldDisconnect();
0052     }
0053     Networking::Status netStatus;
0054     Networking::ManagementPolicy connectPolicy;
0055     Networking::ManagementPolicy disconnectPolicy;
0056 public Q_SLOTS:
0057     uint status() const;
0058 #ifndef Q_OS_WIN
0059     /**
0060      * Called on DBus signal from the network status service
0061      */
0062     void serviceStatusChanged(uint status);
0063 #else
0064     void serviceStatusChanged(bool status);
0065 #endif
0066     /**
0067      * Detects when kded restarts, and sets status to NoNetworks so that apps
0068      * may proceed
0069      */
0070     void serviceOwnerChanged(const QString &, const QString &, const QString &);
0071 private:
0072     void initialize();
0073 #ifndef Q_OS_WIN
0074     OrgKdeSolidNetworkingClientInterface *iface;
0075 #else
0076     QNetworkConfigurationManager *m_manager;
0077 #endif
0078 };
0079 } // namespace Solid
0080 #endif