• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Solid

  • solid
  • solid
networking_win.cpp
Go to the documentation of this file.
1/*
2 Copyright 2013 Patrick von Reth <vonreth@kde.org>
3 Copyright 2006-2007 Will Stephenson <wstephenson@kde.org>
4 Copyright 2006-2007 Kevin Ottens <ervin@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) version 3, or any
10 later version accepted by the membership of KDE e.V. (or its
11 successor approved by the membership of KDE e.V.), which shall
12 act as a proxy defined in Section 6 of version 3 of the license.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23//#include <KDebug>
24
25#include "networking.h"
26#include "networking_p.h"
27
28#include "soliddefs_p.h"
29#include "org_kde_solid_networking_client.h"
30
31
32
33SOLID_GLOBAL_STATIC(Solid::NetworkingPrivate, globalNetworkManager)
34
35Solid::NetworkingPrivate::NetworkingPrivate()
36 : netStatus(Solid::Networking::Unknown),
37 connectPolicy(Solid::Networking::Managed),
38 disconnectPolicy(Solid::Networking::Managed),
39 m_manager(new QNetworkConfigurationManager())
40{
41 initialize();
42}
43
44Solid::NetworkingPrivate::~NetworkingPrivate()
45{
46 m_manager->deleteLater();
47}
48
49Solid::Networking::Notifier::Notifier()
50{
51}
52
53void Solid::NetworkingPrivate::initialize()
54{
55
56 netStatus = m_manager->isOnline()?Solid::Networking::Connected:Solid::Networking::Unconnected;
57
58 connect(m_manager,SIGNAL(onlineStateChanged(bool)),this,SLOT(serviceStatusChanged(bool)));
59}
60
61uint Solid::NetworkingPrivate::status() const
62{
63 return netStatus;
64}
65
66/*=========================================================================*/
67
68Solid::Networking::Status Solid::Networking::status()
69{
70 return static_cast<Solid::Networking::Status>( globalNetworkManager->status() );
71}
72
73Solid::Networking::Notifier *Solid::Networking::notifier()
74{
75 return globalNetworkManager;
76}
77
78void Solid::NetworkingPrivate::serviceStatusChanged( bool status )
79{
80// kDebug( 921 ) ;
81 netStatus = status?Solid::Networking::Connected:Solid::Networking::Unconnected;
82 switch ( netStatus ) {
83 case Solid::Networking::Unknown:
84 break;
85 case Solid::Networking::Unconnected:
86 emit globalNetworkManager->shouldDisconnect();
87 break;
88 case Solid::Networking::Connected:
89 emit globalNetworkManager->shouldConnect();
90 break;
91 default:
92 break;
93// kDebug( 921 ) << "Unrecognised status code!";
94 }
95 emit globalNetworkManager->statusChanged( netStatus );
96}
97
98Solid::Networking::ManagementPolicy Solid::Networking::connectPolicy()
99{
100 return globalNetworkManager->connectPolicy;
101}
102
103void Solid::Networking::setConnectPolicy( Solid::Networking::ManagementPolicy policy )
104{
105 globalNetworkManager->connectPolicy = policy;
106}
107
108Solid::Networking::ManagementPolicy Solid::Networking::disconnectPolicy()
109{
110 return globalNetworkManager->disconnectPolicy;
111}
112
113void Solid::Networking::setDisconnectPolicy( Solid::Networking::ManagementPolicy policy )
114{
115 globalNetworkManager->disconnectPolicy = policy;
116}
117
118#include "networking_p.moc"
119#include "networking.moc"
Solid::NetworkingPrivate
Definition: networking_p.h:39
Solid::NetworkingPrivate::status
uint status() const
Definition: networking.cpp:73
Solid::NetworkingPrivate::~NetworkingPrivate
~NetworkingPrivate()
Definition: networking.cpp:46
Solid::NetworkingPrivate::serviceStatusChanged
void serviceStatusChanged(bool status)
Definition: networking.cpp:90
Solid::NetworkingPrivate::NetworkingPrivate
NetworkingPrivate()
Definition: networking.cpp:32
Solid::Networking::Notifier
This object emits signals, for use if your application requires notification of changes to networking...
Definition: networking.h:98
Solid::Networking::Notifier::Notifier
Notifier()
Definition: networking.cpp:50
Solid::Networking::ManagementPolicy
ManagementPolicy
This defines application policy in response to networking connect/disconnect events.
Definition: networking.h:56
Solid::Networking::Managed
@ Managed
the app should connect or disconnect whenever the KConnectionManager reports a state change
Definition: networking.h:59
Solid::Networking::connectPolicy
SOLID_EXPORT ManagementPolicy connectPolicy()
Retrieve a policy managing the application's connect behaviour.
Definition: networking.cpp:138
Solid::Networking::disconnectPolicy
SOLID_EXPORT ManagementPolicy disconnectPolicy()
Retrieve a policy managing the application's disconnect behaviour.
Definition: networking.cpp:148
Solid::Networking::status
SOLID_EXPORT Status status()
Get the current networking status If the result is Unknown, the backend may be unconfigured or otherw...
Definition: networking.cpp:80
Solid::Networking::setConnectPolicy
SOLID_EXPORT void setConnectPolicy(ManagementPolicy policy)
Set a policy to manage the application's connect behaviour.
Definition: networking.cpp:143
Solid::Networking::notifier
SOLID_EXPORT Notifier * notifier()
Definition: networking.cpp:85
Solid::Networking::Status
Status
Describes the state of the networking system.
Definition: networking.h:45
Solid::Networking::Unconnected
@ Unconnected
the system is not connected to any network
Definition: networking.h:47
Solid::Networking::Connected
@ Connected
the system is currently connected to a network
Definition: networking.h:50
Solid::Networking::Unknown
@ Unknown
the networking system is not active or unable to report its status - proceed with caution
Definition: networking.h:46
Solid::Networking::setDisconnectPolicy
SOLID_EXPORT void setDisconnectPolicy(ManagementPolicy policy)
Set a policy to manage the application's disconnect behaviour.
Definition: networking.cpp:153
Solid
Definition: acadapter.h:29
networking.h
networking_p.h
soliddefs_p.h
SOLID_GLOBAL_STATIC
#define SOLID_GLOBAL_STATIC(TYPE, NAME)
Definition: soliddefs_p.h:77
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Solid

Skip menu "Solid"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal