diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-04 17:56:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-04 17:56:02 +0000 |
commit | a00e1eb8e17855b3fb9288dd43bde66ffce14069 (patch) | |
tree | 872bd0f3ad90616e0e638ab791a1f6ca1deeb631 /networkstatus | |
parent | b35cd0e8350babc091667a5070f8ff6e359e5750 (diff) | |
download | tdepim-a00e1eb8e17855b3fb9288dd43bde66ffce14069.tar.gz tdepim-a00e1eb8e17855b3fb9288dd43bde66ffce14069.zip |
Removed networkstatus from pim as it is now a core library
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1171620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'networkstatus')
-rw-r--r-- | networkstatus/Makefile.am | 37 | ||||
-rw-r--r-- | networkstatus/README.statetransition | 29 | ||||
-rw-r--r-- | networkstatus/clientiface.h | 77 | ||||
-rw-r--r-- | networkstatus/clientifaceimpl.cpp | 51 | ||||
-rw-r--r-- | networkstatus/clientifaceimpl.h | 43 | ||||
-rw-r--r-- | networkstatus/connectionmanager.cpp | 156 | ||||
-rw-r--r-- | networkstatus/connectionmanager.h | 57 | ||||
-rw-r--r-- | networkstatus/network.cpp | 93 | ||||
-rw-r--r-- | networkstatus/network.h | 67 | ||||
-rw-r--r-- | networkstatus/networkstatus.cpp | 307 | ||||
-rw-r--r-- | networkstatus/networkstatus.desktop | 100 | ||||
-rw-r--r-- | networkstatus/networkstatus.h | 80 | ||||
-rw-r--r-- | networkstatus/networkstatus.kdevelop | 108 | ||||
-rw-r--r-- | networkstatus/networkstatuscommon.cpp | 53 | ||||
-rw-r--r-- | networkstatus/networkstatuscommon.h | 54 | ||||
-rw-r--r-- | networkstatus/provideriface.h | 42 | ||||
-rw-r--r-- | networkstatus/serviceiface.h | 51 | ||||
-rw-r--r-- | networkstatus/serviceifaceimpl.cpp | 46 | ||||
-rw-r--r-- | networkstatus/serviceifaceimpl.h | 43 | ||||
-rw-r--r-- | networkstatus/testservice.cpp | 101 | ||||
-rw-r--r-- | networkstatus/testservice.h | 49 |
21 files changed, 0 insertions, 1644 deletions
diff --git a/networkstatus/Makefile.am b/networkstatus/Makefile.am deleted file mode 100644 index c59aa55c6..000000000 --- a/networkstatus/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -#SUBDIRS = networkstatustray - -METASOURCES = AUTO - -kde_module_LTLIBRARIES = kded_networkstatus.la -lib_LTLIBRARIES = libnetworkstatus.la libconnectionmanager.la - -libnetworkstatus_la_LIBADD = $(LIB_KDECORE) -libnetworkstatus_la_LDFLAGS = $(all_libraries) -libnetworkstatus_la_SOURCES = networkstatuscommon.cpp - -libconnectionmanager_la_LIBADD = $(LIB_KDECORE) -libconnectionmanager_la_LDFLAGS = $(all_libraries) -libconnectionmanager_la_SOURCES = connectionmanager.cpp connectionmanager.skel clientiface.stub - -INCLUDES = $(all_includes) - -kded_networkstatus_la_SOURCES = networkstatus.cpp networkstatus.skel \ - clientiface.skel serviceiface.skel network.cpp -#kclientiface.skel serviceiface.skel -kded_networkstatus_la_LIBADD = $(LIB_KDECORE) $(LIB_KIO) ./libnetworkstatus.la -kded_networkstatus_la_LDFLAGS = $(all_libraries) -module -avoid-version - -servicesdir = $(kde_servicesdir)/kded -services_DATA = networkstatus.desktop - -noinst_HEADERS = serviceifaceimpl.h \ - network.h clientifaceimpl.h testservice.h connectionmanager.h - -include_HEADERS = serviceiface.h provideriface.h networkstatuscommon.h - -bin_PROGRAMS = networkstatustestservice - -networkstatustestservice_LDFLAGS = $(all_libraries) -networkstatustestservice_LDADD = libnetworkstatus.la - -networkstatustestservice_SOURCES = testservice.cpp provideriface.skel serviceiface.stub diff --git a/networkstatus/README.statetransition b/networkstatus/README.statetransition deleted file mode 100644 index ac075ea77..000000000 --- a/networkstatus/README.statetransition +++ /dev/null @@ -1,29 +0,0 @@ -This table defines the actions to be taken on state transition. - -TODO: potentially add extra states OnlineReading and OnlineWriting - - NEW - |Offline | Online | ----+---+----------------+---------------+ - | | |N|set online | - | | |L|reload | - | O | |C|resources | - | F | +---------------+ - | F | |L|set online | -O | | |C|reload res. | -L | | | |write res. | -D +---+----------------+---------------+ - | |N|set offline | | - | |C| | | - | | | | | - | O +---------------+| | - | N |U|set offline | | - | |W|write locally | | - | |C|(subject to | | - | | | save policy)| | ----+---+----------------+---------------+ -LC = Local changes exist -NLC = No local changes exist -UWC = Unsaved changes exist -NC = no changes exist - diff --git a/networkstatus/clientiface.h b/networkstatus/clientiface.h deleted file mode 100644 index 9fcef57a3..000000000 --- a/networkstatus/clientiface.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KDED_NETWORKSTATUS_CLIENTIFACE_H -#define KDED_NETWORKSTATUS_CLIENTIFACE_H - -#include "networkstatuscommon.h" - -#include <dcopobject.h> - -class ClientIface : virtual public DCOPObject -{ -K_DCOP -k_dcop: - /** Get the set of networks that the daemon is aware of. Mostly for debug */ - virtual TQStringList networks() = 0; - /** - * Get the status of the connection to the given host. - * @param host - * @return a NetworkStatus::EnumStatus representing the state of the connection to the given host - */ - virtual int status( const TQString & host) = 0; - /** - * Request a connection to the named host, registering the application's usage of this connection - * @param host The hostname the client wants to connect to. - * @param userInitiated Indicates whether the connection is a direct result of a user action or is a background task. Used by the daemon to decide whether to create an on-demand connection. - * @return An NetworkStatus::EnumRequestResult indicating whether the request was accepted - */ - virtual int request( const TQString & host, bool userInitiated ) = 0; - /** - * Indicate that a previously registered connection to the given host is no longer needed by this client - * @param host The hostname being relinquished. - */ - virtual void relinquish( const TQString & host ) = 0; - /** - * Indicate that a communication failure has occurred for a given host - * @param host The hostname for which the failure occurred. - * @return True indicates the caller should try again to lookup the host, as the daemon has another IP address available. - */ - virtual bool reportFailure( const TQString & host ) = 0; - /** - * Utility method to check the daemon's status - */ -k_dcop_signals: - /** - * A status change occurred for the network(s) used to connect to the given host. - * @param host The host which the application has indicated it is using - * @param status The new status of the network used to reach host. - */ - void statusChange( TQString host, int status ); - /** - * The network would like to shut down - any clients using this host are to finish using it immediately and call - * relinquish() when done. - * @param host The host, registered as in use by applications, which is about to be disconnected. - */ - void shutdownRequested( TQString host ); -}; - -#endif diff --git a/networkstatus/clientifaceimpl.cpp b/networkstatus/clientifaceimpl.cpp deleted file mode 100644 index f20957e73..000000000 --- a/networkstatus/clientifaceimpl.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "clientifaceimpl.h" - -ClientIfaceImpl::ClientIfaceImpl( NetworkStatusModule * module ) : m_module ( module ) -{ -} - -int ClientIfaceImpl::status( TQString host ) -{ - return m_module->status( host ); -} - -int ClientIfaceImpl::request( TQString host, bool userInitiated ) -{ - return m_module->request( host, userInitiated ); -} - -void ClientIfaceImpl::relinquish( TQString host ) -{ - m_module->relinquish( host ); -} - -bool ClientIfaceImpl::reportFailure( TQString host ) -{ - return m_module->reportFailure( host ); -} - -// TQString ClientIfaceImpl::statusAsString() -// { -// -// } diff --git a/networkstatus/clientifaceimpl.h b/networkstatus/clientifaceimpl.h deleted file mode 100644 index bdc99a19f..000000000 --- a/networkstatus/clientifaceimpl.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef NETWORKSTATUS_CLIENTIFACEIMPL_H -#define NETWORKSTATUS_CLIENTIFACEIMPL_H - -#include <tqstring.h> - -#include "clientiface.h" -#include "networkstatus.h" - -class ClientIfaceImpl : virtual public ClientIface -{ -public: - ClientIfaceImpl( NetworkStatusModule * module ); - int status( TQString host ); - int request( TQString host, bool userInitiated ); - void relinquish( TQString host ); - bool reportFailure( TQString host ); -/* TQString statusAsString();*/ -private: - NetworkStatusModule * m_module; -}; - -#endif diff --git a/networkstatus/connectionmanager.cpp b/networkstatus/connectionmanager.cpp deleted file mode 100644 index a28c6a124..000000000 --- a/networkstatus/connectionmanager.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <kapplication.h> -#include <klocale.h> -#include <kmessagebox.h> -#include <kstaticdeleter.h> - -#include "clientiface_stub.h" -#include "networkstatuscommon.h" - -#include "connectionmanager.h" - -// ConnectionManager's private parts -class ConnectionManagerPrivate -{ - public: - // this holds the currently active state - ConnectionManager::State m_state; - ClientIface_stub * m_stub; - bool m_userInitiatedOnly; -}; - -// Connection manager itself -ConnectionManager::ConnectionManager( TQObject * parent, const char * name ) : DCOPObject( "ConnectionManager" ),TQObject( parent, name ) -{ - d = new ConnectionManagerPrivate; - - d->m_stub = new ClientIface_stub( kapp->dcopClient(), "kded", "networkstatus" ); - - connectDCOPSignal( "kded", "networkstatus", "statusChange(TQString,int)", "slotStatusChanged(TQString,int)", false ); - d->m_userInitiatedOnly = false; - initialise(); -} - -ConnectionManager *ConnectionManager::s_self = 0L; - -ConnectionManager *ConnectionManager::self() -{ - static KStaticDeleter<ConnectionManager> deleter; - if(!s_self) - deleter.setObject( s_self, new ConnectionManager( 0, "connection_manager" ) ); - return s_self; -} - -void ConnectionManager::initialise() -{ - // determine initial state and set the state object accordingly. - d->m_state = Offline; - updateStatus(); -} - -void ConnectionManager::updateStatus() -{ - /*NetworkStatus::EnumStatus daemonStatus = (NetworkStatus::EnumStatus)d->m_stub->status( TQString::null ); - switch ( daemonStatus ) - { - case Offline: - case OfflineFailed: - case OfflineDisconnected: - case ShuttingDown: - if ( d->m_state == Online ) - d->m_state = Pending; - else - d->m_state = Offline; - break; - case Establishing: - case Online: - d->m_state = Online; - break; - case NoNetworks: - case Unreachable: - d->m_state = Inactive; - break; - }*/ -} - -ConnectionManager::~ConnectionManager() -{ - delete d; -} - -NetworkStatus::EnumStatus ConnectionManager::status( const TQString & host ) -{ - if ( d->m_state == Inactive ) - return NetworkStatus::NoNetworks; - else - return NetworkStatus::Offline; -} -NetworkStatus::EnumRequestResult ConnectionManager::requestConnection( TQWidget * mainWidget, const TQString & host, bool userInitiated ) -{ - NetworkStatus::EnumRequestResult result; - // if offline and the user has previously indicated they didn't want any new connections, suppress it - if ( d->m_state == Offline && !userInitiated && d->m_userInitiatedOnly ) - result = NetworkStatus::UserRefused; - // if offline, ask the user whether this connection should be allowed - if ( d->m_state == Offline ) - { - if ( askToConnect( mainWidget ) ) - result = (NetworkStatus::EnumRequestResult)d->m_stub->request( host, userInitiated ); - else - result = NetworkStatus::UserRefused; - } - // otherwise, just ask for the connection - else - result = (NetworkStatus::EnumRequestResult)d->m_stub->request( host, userInitiated ); - - return result; -} - -void ConnectionManager::relinquishConnection( const TQString & host ) -{ - d->m_stub->relinquish( host ); -} - -void ConnectionManager::slotStatusChanged( TQString host, int status ) -{ - updateStatus(); - // reset user initiated only flag if we are now online - if ( d->m_state == Online ) - d->m_userInitiatedOnly = false; - - emit statusChanged( host, (NetworkStatus::EnumStatus)status ); -} - -bool ConnectionManager::askToConnect( TQWidget * mainWidget ) -{ - i18n( "A network connection was disconnected. The application is now in offline mode. Do you want the application to resume network operations when the network is available again?" ); - i18n( "This application is currently in offline mode. Do you want to connect?" ); - i18n( "Message shown when a network connection failed. The placeholder contains the concrete description of the operation eg 'while performing this operation", "A network connection failed %1. Do you want to place the application in offline mode?" ); - return ( KMessageBox::questionYesNo( mainWidget, - i18n("This application is currently in offline mode. Do you want to connect in order to carry out this operation?"), - i18n("Leave Offline Mode?"), - i18n("Connect"), i18n("Do Not Connect"), - TQString::fromLatin1("OfflineModeAlwaysGoOnline") ) == KMessageBox::Yes ); -} - -#include "connectionmanager.moc" diff --git a/networkstatus/connectionmanager.h b/networkstatus/connectionmanager.h deleted file mode 100644 index 00ca4e35c..000000000 --- a/networkstatus/connectionmanager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - connectionmanager.h - Provides the client side interface to the kde networkstatus daemon - - Copyright (c) 2004 by Will Stephenson <lists@stevello.free-online.co.uk> - - ************************************************************************* - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - ************************************************************************* -*/ - -#ifndef KDE_CONNECTION_MANAGER_H -#define KDE_CONNECTION_MANAGER_H - -#include <dcopobject.h> - -#include "networkstatuscommon.h" - -class ConnectionManagerPrivate; - -class ConnectionManager : public TQObject, virtual public DCOPObject -{ - Q_OBJECT - K_DCOP - public: - static ConnectionManager* self(); - enum State { Inactive, Online, Offline, Pending }; - virtual ~ConnectionManager(); - NetworkStatus::EnumStatus status( const TQString & host ); - // check if a hostname is available. Ask user if offline. Request host - NetworkStatus::EnumRequestResult requestConnection( TQWidget* mainWidget, const TQString & host, bool userInitiated ); - // method to relinquish a connection - void relinquishConnection( const TQString & host ); - signals: - // signal that the network for a hostname is up/down - void statusChanged( const TQString & host, NetworkStatus::EnumStatus status ); - protected: - // sets up internal state - void initialise(); - // reread the desktop status from the daemon and update internal state - void updateStatus(); - // ask if the user would like to reconnect - bool askToConnect( TQWidget * mainWidget ); - k_dcop: - void slotStatusChanged( TQString host, int status ); - private: - ConnectionManager( TQObject *parent, const char * name ); - ConnectionManagerPrivate *d; - static ConnectionManager * s_self; -}; - -#endif - diff --git a/networkstatus/network.cpp b/networkstatus/network.cpp deleted file mode 100644 index fcb4a6f51..000000000 --- a/networkstatus/network.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <kdebug.h> - -#include "network.h" - -Network::Network( const TQString name, NetworkStatus::Properties properties ) - : m_name( name ) -{ - kdDebug() << k_funcinfo << "constructing network '" << name << "', status: " << properties.status << endl; - m_status = properties.status; - m_netmasks = properties.netmasks; - m_internet = properties.internet; - m_service = properties.service; - m_onDemandPolicy = properties.onDemandPolicy; -} - -NetworkStatus::EnumStatus Network::reachabilityFor( const TQString & host ) -{ - // initially assume all networks are internet - // TODO: compute reachability properly - Q_UNUSED( host ); - if ( true /*nss.properties.internet && notPrivateNetwork( host )*/ ) - { - NetworkStatus::EnumStatus status; - if ( m_status == NetworkStatus::Establishing || m_status == NetworkStatus::Online ) - status = NetworkStatus::Online; - else if ( m_status == NetworkStatus::ShuttingDown || m_status == NetworkStatus::Offline ) - status = NetworkStatus::Offline; - else - status = m_status; - - return status; - } -} - -void Network::registerUsage( const TQCString appId, const TQString host ) -{ - NetworkUsageStruct nus; - nus.appId = appId; - nus.host = host; - NetworkUsageList::iterator end = m_usage.end(); - for ( NetworkUsageList::iterator it = m_usage.begin(); it != end; ++it ) - { - if ( (*it).appId == appId && (*it).host == host ) - return; - } - kdDebug() << k_funcinfo << "registering " << appId << " as using network " << m_name << " for " << host << endl; - m_usage.append( nus ); -} - -void Network::unregisterUsage( const TQCString appId, const TQString host ) -{ - NetworkUsageList::iterator end = m_usage.end(); - for ( NetworkUsageList::iterator it = m_usage.begin(); it != end; ++it ) - { - if ( (*it).appId == appId && (*it).host == host ) - { - kdDebug() << k_funcinfo << "unregistering " << appId << "'s usage of " << m_name << " for " << host << endl; - m_usage.remove( it ); - break; - } - } -} - -void Network::setStatus( NetworkStatus::EnumStatus status ) -{ - m_status = status; -} - -void Network::removeAllUsage() -{ - m_usage.clear(); -} diff --git a/networkstatus/network.h b/networkstatus/network.h deleted file mode 100644 index dcd2cd339..000000000 --- a/networkstatus/network.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef NETWORKSTATUS_NETWORK_H -#define NETWORKSTATUS_NETWORK_H - -#include <tqstringlist.h> -#include <ksharedptr.h> -#include "networkstatuscommon.h" - -struct NetworkUsageStruct -{ - TQCString appId; - TQString host; -}; - -typedef TQValueList< NetworkUsageStruct > NetworkUsageList; - -class Network -{ -public: - Network( const TQString name, NetworkStatus::Properties properties ); - Network( const Network & other ); - NetworkStatus::EnumStatus reachabilityFor( const TQString & host ); - void registerUsage( const TQCString appId, const TQString host ); - void unregisterUsage( const TQCString appId, const TQString host ); - void setStatus( NetworkStatus::EnumStatus status ); - - void removeAllUsage(); - - NetworkStatus::EnumStatus status() { return m_status; } - TQString name() { return m_name; } - bool internet() { return m_internet; } - TQStringList netmasks() { return m_netmasks; } - TQCString service() { return m_service; } - NetworkStatus::EnumOnDemandPolicy onDemandPolicy() { return m_onDemandPolicy; } - NetworkUsageList usage() { return m_usage; } - -private: - NetworkStatus::EnumStatus m_status; - TQString m_name; - bool m_internet; - TQStringList m_netmasks; - TQCString m_service; - NetworkStatus::EnumOnDemandPolicy m_onDemandPolicy; - NetworkUsageList m_usage; -}; - -#endif diff --git a/networkstatus/networkstatus.cpp b/networkstatus/networkstatus.cpp deleted file mode 100644 index 092f2b392..000000000 --- a/networkstatus/networkstatus.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "networkstatus.h" - -#include <tqdict.h> -#include <tqtimer.h> -#include <tqvaluelist.h> - -#include <dcopclient.h> -#include <kapplication.h> -#include <kdebug.h> - -#include "clientifaceimpl.h" -#include "serviceifaceimpl.h" -#include "network.h" -#include <kdepimmacros.h> - -extern "C" { - KDE_EXPORT KDEDModule* create_networkstatus( const TQCString& obj ) - { - return new NetworkStatusModule( obj ); - } -} - -// INTERNALLY USED STRUCTS AND TYPEDEFS - -//typedef TQDict< Network > NetworkList; -typedef TQValueList< Network * > NetworkList; - -class NetworkStatusModule::Private -{ -public: - NetworkList networks; -/* ClientIface * clientIface; - ServiceIface * serviceIface;*/ -}; - -// CTORS/DTORS - -NetworkStatusModule::NetworkStatusModule( const TQCString & obj ) : KDEDModule( obj ) -{ - d = new Private; -/* d->clientIface = new ClientIfaceImpl( this ); - d->serviceIface = new ServiceIfaceImpl( this );*/ - connect( kapp->dcopClient(), TQT_SIGNAL( applicationRemoved( const TQCString& ) ) , this, TQT_SLOT( unregisteredFromDCOP( const TQCString& ) ) ); - connect( kapp->dcopClient(), TQT_SIGNAL( applicationRegistered( const TQCString& ) ) , this, TQT_SLOT( registeredToDCOP( const TQCString& ) ) ); -} - -NetworkStatusModule::~NetworkStatusModule() -{ -/* delete d->clientIface; - delete d->serviceIface;*/ - delete d; -} - -// CLIENT INTERFACE - -TQStringList NetworkStatusModule::networks() -{ - kdDebug() << k_funcinfo << " contains " << d->networks.count() << " networks" << endl; - TQStringList networks; - NetworkList::iterator end = d->networks.end(); - NetworkList::iterator it = d->networks.begin(); - for ( ; it != end; ++it ) - networks.append( (*it)->name() ); - return networks; -} - -int NetworkStatusModule::status( const TQString & host ) -{ - if ( host == "127.0.0.1" || host == "localhost" ) - return NetworkStatus::Online; - Network * p = networkForHost( host ); - if ( !p ) - { - //kdDebug() << k_funcinfo << " no networks have status for host '" << host << "'" << endl; - return (int)NetworkStatus::NoNetworks; - } - else - { - kdDebug() << k_funcinfo << " got status for host '" << host << "' : " << (int)(p->status()) << endl; - return (int)(p->status()); - } -} - -int NetworkStatusModule::request( const TQString & host, bool userInitiated ) -{ - // identify most suitable network for host - Network * p = networkForHost( host ); - if ( !p ) - return NetworkStatus::Unavailable; - - NetworkStatus::EnumStatus status = p->status(); - TQCString appId = kapp->dcopClient()->senderId(); - if ( status == NetworkStatus::Online ) - { - p->registerUsage( appId, host ); - return NetworkStatus::Connected; - } - // if online - // register usage - // return Available - else if ( status == NetworkStatus::Establishing ) - { - p->registerUsage( appId, host ); - return NetworkStatus::RequestAccepted; - } - // if establishing - // register usage - // return Accepted - else if ( status == NetworkStatus::Offline || status == NetworkStatus::ShuttingDown ) - { - // TODO: check on demand policy - - p->registerUsage( appId, host ); - return NetworkStatus::RequestAccepted; - } - // if offline or ShuttingDown - // check ODP:: - // always or Permanent: register, return accepted - // user: check userInitiated, register, return Accepted or UserRefused - // never: return UserRefused - else if ( status == NetworkStatus::OfflineFailed ) - { - // TODO: check user's preference for dealing with failed networks - p->registerUsage( appId, host ); - return NetworkStatus::RequestAccepted; - } - // if OfflineFailed - // check user's preference - else if ( status == NetworkStatus::OfflineDisconnected ) - { - return NetworkStatus::Unavailable; - } - else - return NetworkStatus::Unavailable; - // if OfflineDisconnected or NoNetworks - // return Unavailable -} - -void NetworkStatusModule::relinquish( const TQString & host ) -{ - TQCString appId = kapp->dcopClient()->senderId(); - // find network currently used by app for host... - NetworkList::iterator end = d->networks.end(); - NetworkList::iterator it = d->networks.begin(); - for ( ; it != end; ++it ) - { - Network * net = *it; - NetworkUsageList usage = net->usage(); - NetworkUsageList::iterator end2 = usage.end(); - for ( NetworkUsageList::iterator usageIt = usage.begin(); usageIt != end2; ++usageIt ) - { - if ( (*usageIt).appId == appId && (*usageIt).host == host ) - { - // remove host usage record - usage.remove( usageIt ); - // if requested shutdown flagged for network - // check if all hosts have relinquished - // call confirmShutDown on Service - //checkShutdownOk(); - } - } - } -} - -bool NetworkStatusModule::reportFailure( const TQString & host ) -{ - // find network for host - // check IP record. remove IP usage record. if other IP exists, return true. - Q_UNUSED( host ); - kdDebug() << k_funcinfo << "NOT IMPLEMENTED" << endl; - return false; -} - -// PROTECTED UTILITY FUNCTIONS -/* - * Determine the network to use for the supplied host - */ -Network * NetworkStatusModule::networkForHost( const TQString & host ) const -{ - // return a null pointer if no networks are registered - if ( d->networks.isEmpty() ) - return 0; - - NetworkList::const_iterator it = d->networks.begin(); - Network * bestNetwork = *(it++); - NetworkList::const_iterator end = d->networks.end(); - for ( ; it != end; ++it ) - { - if ( (*it)->reachabilityFor( host ) > bestNetwork->reachabilityFor( host ) ) - { - bestNetwork = (*it); - } - } - return bestNetwork; -} - - -void NetworkStatusModule::registeredToDCOP( const TQCString & appId ) -{ -} - -void NetworkStatusModule::unregisteredFromDCOP( const TQCString & appId ) -{ - // unregister any networks owned by a service that has just unregistered - NetworkList::iterator it = d->networks.begin(); - NetworkList::iterator end = d->networks.end(); - for ( ; it != end; ++it ) - { - if ( (*it)->service() == appId) - { - kdDebug() << k_funcinfo << "removing '" << (*it)->name() << "', registered by " << appId << endl; - d->networks.remove( it ); - break; - } - } -} - -// SERVICE INTERFACE // -void NetworkStatusModule::setNetworkStatus( const TQString & networkName, int st ) -{ - kdDebug() << k_funcinfo << endl; - NetworkStatus::EnumStatus status = (NetworkStatus::EnumStatus)st; - Network * net = 0; - NetworkList::iterator it = d->networks.begin(); - NetworkList::iterator end = d->networks.end(); - for ( ; it != end; ++it ) - { - if ( (*it)->name() == networkName ) - { - net = (*it); - break; - } - } - if ( net ) - { - if ( net->status() == status ) - return; - - // update the status of the network - net->setStatus( status ); - - // notify for each host in use on that network - NetworkUsageList usage = net->usage(); - NetworkUsageList::iterator end = usage.end(); - TQStringList notified; - for ( NetworkUsageList::iterator it = usage.begin(); it != end; ++it ) - { - // only notify once per host - if ( !notified.contains( (*it).host ) ) - { - kdDebug() << "notifying statusChange of " << networkName << " to " << (int)status << - " because " << (*it).appId << " is using " << (*it).host << endl; - /*d->clientIface->*/statusChange( (*it).host, (int)status ); - notified.append( (*it).host ); - } - } - - // if we are now anything but Establishing or Online, reset the usage records for that network - if ( !( net->status() == NetworkStatus::Establishing || net->status() == NetworkStatus::Establishing ) ) - net->removeAllUsage(); - } - else - kdDebug() << k_funcinfo << "No network found by this name" << endl; -} - -void NetworkStatusModule::registerNetwork( const TQString & networkName, const NetworkStatus::Properties properties ) -{ - kdDebug() << k_funcinfo << "registering '" << networkName << "', with status " << properties.status << endl; - // TODO: check for re-registration, checking appid matches - - d->networks.append( new Network( networkName, properties ) ); -} - -void NetworkStatusModule::unregisterNetwork( const TQString & networkName ) -{ - // TODO: check appid - //d->networks.remove( networkName ); -} - -void NetworkStatusModule::requestShutdown( const TQString & networkName ) -{ - Q_UNUSED( networkName ); - kdDebug() << k_funcinfo << "NOT IMPLEMENTED" << endl; -} - -#include "networkstatus.moc" diff --git a/networkstatus/networkstatus.desktop b/networkstatus/networkstatus.desktop deleted file mode 100644 index 4d66b8c51..000000000 --- a/networkstatus/networkstatus.desktop +++ /dev/null @@ -1,100 +0,0 @@ -[Desktop Entry] -Name=Network Status Daemon -Name[af]=Netwerk status bediener -Name[ar]=مراقب القرص و التنفيذ لحالة الشبكة -Name[bg]=Демон за състояние на мрежата -Name[ca]=Dimoni de l'estat de la xarxa -Name[cs]=Démon stavu sítě -Name[da]=Netværkstatusdæmon -Name[de]=Überwachung des Netzwerkstatus -Name[el]=Δαίμονας κατάστασης δικτύου -Name[eo]=Retstat-demono -Name[es]=Daemon de estado de la red -Name[et]=Võrguoleku deemon -Name[eu]=Sarearen egoera deabrua -Name[fa]=شبح وضعیت شبکه -Name[fi]=Verkkotilan tarkkailija -Name[fr]=Suivi de l'état du réseau -Name[fy]=Netwurktastândaemon -Name[gl]=Daemon do Estado da Rede -Name[hu]=Hálózati állapotjelző szolgáltatás -Name[is]=Netstöðupúki -Name[it]=Demone dello stato della rete -Name[ja]=ネットワークステータスデーモン -Name[kk]=Желі күйінің қызметі -Name[km]=ដេមិនស្ថានភាពបណ្ដាញ -Name[ko]=네트워크 상태 데몬 -Name[lt]=Tinklo statuso tarnyba -Name[mk]=Даемон за мрежен статус -Name[ms]=Daemon Berstatus Rangkaian -Name[nb]=Statusnisse for nettverket -Name[nds]=Nettwarkstatus-Dämoon -Name[ne]=सञ्जाल स्थिति डेइमन -Name[nl]=Netwerkstatusdaemon -Name[nn]=Statusnisse for nettverket -Name[pl]=Usługa stanu sieci -Name[pt]=Servidor de Estado de Rede -Name[pt_BR]=Daemon de Status da Rede -Name[ru]=Служба состояния сети -Name[sk]=Daemon stavu siete -Name[sl]=Demon za omrežno stanje -Name[sr]=Демон за статус мреже -Name[sr@Latn]=Demon za status mreže -Name[sv]=Nätverksstatusdemon -Name[ta]=வலைப்பின்னல் நிலை டெமான் -Name[tr]=Ağ Durum İzleyici -Name[uk]=Демон стану мережі -Name[zh_CN]=网络状态守护程序 -Name[zh_TW]=網路狀態守護程式 -Comment=Tracks status of network interfaces and provides notification to applications using the network. -Comment[af]=Hou tred van die status van netwerk intervlakke en verskaf kennisgewings na programme wat die netwerk gebruik. -Comment[bg]=Следене на състоянието на мрежата и предаване на информацията на програмите, които имат нужда -Comment[ca]=Controla l'estat de les interfícies de xarxa i proporciona notificacions a les aplicacions que usen la xarxa. -Comment[cs]=Zjiš'tuje stav síťových rozhraní a upozorňuje v případě přístupu aplikací k síti. -Comment[da]=Sporer status af netværksgrænseflade og sørger for meddelelser til programmer der bruger netværket. -Comment[de]=Überprüft den Netzwerk-Status und benachrichtigt anfragende Anwendungen -Comment[el]=Παρακολουθεί την κατάσταση του δικτύου και παρέχει ειδοποιήσεις σε εφαρμογές που χρησιμοποιούν το δίκτυο. -Comment[es]=Sigue la pista de las interfaces de red y proporciona notificaciones a las aplicaciones que están usando la red. -Comment[et]=Jälgib võrguliideste olekut ja annab sellest võrgu vahendusel rakendustele teada. -Comment[eu]=Sare interfazeen egoera jarraitzen du eta sarea darabilten aplikazioei jakinarazten die. -Comment[fa]=وضعیت واسطهای شبکه را شیار داده و با استفاده از شبکه، برای کاربردها اخطار فراهم میکند. -Comment[fi]=Tarkkailee verkkoliitäntöjen tilaa ja varoittaa verkkoa käyttäviä sovelluksia. -Comment[fr]=Surveille l'état des interfaces réseaux et fournit des notifications aux applications qui utilisent le réseau -Comment[fy]=Hâldt de tastân by fan de Netwurkynterfaces en hâldt dêr de tapassings fan op de hichte. -Comment[gl]=Monitoriza o estado das interfaces de rede e fornece notificacións ás aplicacións que usen a rede. -Comment[hu]=Figyeli a hálózati csatolók állapotát és értesítési lehetőséget biztosít hálózati alkalmazások számára. -Comment[is]=Fylgist með stöðu netkorta og sendir tilkynningar til forrita sem nota netið. -Comment[it]=Controlla lo stato delle interfacce di rete e fornisce notifiche alle applicazioni che usano al rete. -Comment[ja]=ネットワークインターフェースの状態を追跡し、ネットワークを用いるアプリケーションに通知します -Comment[kk]=Желі интерфейстерінің күйін бақылап, желіні қолданатын бағдарламаларын құлақтандыру қызметі. -Comment[km]=តាមដានស្ថានភាពរបស់ចំណុចប្រទាក់បណ្ដាញ ព្រមទាំងផ្ដល់នូវការជូនដំណឹងទៅកម្មវិធី ដែលប្រើបណ្ដាញ ។ -Comment[lt]=Seka tinklo sąsajų būseną ir informuoja apie jas programas, naudojančias tinklą -Comment[mk]=Го следи статусот на мрежните интерфејси и дава известувања на апликациите што ја користат мрежата. -Comment[ms]=Menjejak status antara muka rangkaian dan memberitahu aplikasi yang menggunakan rangkaian tersebut. -Comment[nb]=Overvåker status for nettverksgrensesnitt og varsler programmer som bruker nettverket. -Comment[nds]=Överwacht den Tostand vun Nettwark-Koppelsteden un sendt Narichten na Programmen, de dat Nettwark bruukt. -Comment[ne]=सञ्जाल इन्टरफेसको स्थिति ट्र्याक गर्दछ र सञ्जाल प्रयोग गरेर अनुप्रयोगमा जानकारी उपलब्ध गराउछ । -Comment[nl]=Houdt de status bij van de netwerkinterfaces en houdt daar de toepassingen van op de hoogte. -Comment[nn]=Overvakar status for nettverksgrensesnitt og varslar program som brukar nettverket. -Comment[pl]=Śledzi stan interfejsów sieciowych i powiadamia programy używające sieci. -Comment[pt]=Vigia o estado das interfaces de rede e avisa as aplicações que utilizam a rede. -Comment[pt_BR]=Controla o status das interfaces de rede e fornece notificações para aplicativos utilizando a rede. -Comment[ru]=Служба отслеживания состояния сетевых интерфейсов и обращения приложений к сети. -Comment[sk]=Sleduje stav sieťových rozhraní a poskytuje upozornenia aplikáciám používajúcim sieť. -Comment[sl]=Sledi stanju omrežnim vmesnikom in omogoča obvestila programom, ki uporabljajo omrežje -Comment[sr]=Прати статус мрежних интерфејса и пружа обавештења програмима који користе мрежу. -Comment[sr@Latn]=Prati status mrežnih interfejsa i pruža obaveštenja programima koji koriste mrežu. -Comment[sv]=Bevakar status för nätverksgränssnitt och tillhandahåller underrättelser till program som använder nätverket. -Comment[ta]=வலைப்பின்னலைப் பயன்படுத்தி வலைப்பின்னல் இடைமுகங்களின் நிலையை கண்காணிக்கிறது மற்றும் பயன்பாடுகளுக்கு அறிவிப்பை வழங்குகிறது. -Comment[tr]=Ağ arayüzlerinin durmunu izler ve ağı kullanan uygulamalar için gereken uyarıları sağlar. -Comment[uk]=Слідкує за станом інтерфейсів мережі і сповіщає програми, які користуються мережею. -Comment[zh_CN]=跟踪网卡的状态并为应用程序提供使用网络的通知。 -Comment[zh_TW]=追蹤網路介面的狀態,並提供使用網路的應用程式的通知。 -Type=Service -ServiceTypes=KDEDModule -X-KDE-ModuleType=Library -X-KDE-Library=networkstatus -X-KDE-FactoryName=networkstatus -X-KDE-Kded-autoload=true -X-KDE-Kded-load-on-demand=true - diff --git a/networkstatus/networkstatus.h b/networkstatus/networkstatus.h deleted file mode 100644 index 710afd79a..000000000 --- a/networkstatus/networkstatus.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KDED_NETWORKSTATUS_H -#define KDED_NETWORKSTATUS_H - -#include "networkstatuscommon.h" - -#include <kdedmodule.h> - -#include "clientiface.h" -#include "network.h" -#include "serviceiface.h" - -struct NetworkStatusStruct; - -class NetworkStatusModule : virtual public KDEDModule/*, public ClientIface, ServiceIface*/ // <-spot the multiple inheritance pb -{ -Q_OBJECT -K_DCOP -public: - NetworkStatusModule( const TQCString & obj ); - ~NetworkStatusModule(); -k_dcop: - // Client interface - TQStringList networks(); - int status( const TQString & host ); - int request( const TQString & host, bool userInitiated ); - void relinquish( const TQString & host ); - bool reportFailure( const TQString & host ); -// TQString statusAsString(); - // Service interface - void setNetworkStatus( const TQString & networkName, int status ); - void registerNetwork( const TQString & networkName, NetworkStatus::Properties properties ); - void unregisterNetwork( const TQString & networkName ); - void requestShutdown( const TQString & networkName ); -k_dcop_signals: - /** - * A status change occurred for the network(s) used to connect to the given host. - * @param host The host which the application has indicated it is using - * @param status The new status of the network used to reach host. - */ - void statusChange( TQString host, int status ); - /** - * The network would like to shut down - any clients using this host are to finish using it immediately and call - * relinquish() when done. - * @param host The host, registered as in use by applications, which is about to be disconnected. - */ - void shutdownRequested( TQString host ); -protected slots: - void registeredToDCOP( const TQCString& appId ); - void unregisteredFromDCOP( const TQCString& appId ); - -protected: - // TQStringList networkUsers( const TQString & networkName ); - Network * networkForHost( const TQString & host ) const; - -private: - class Private; - Private *d; -}; -#endif diff --git a/networkstatus/networkstatus.kdevelop b/networkstatus/networkstatus.kdevelop deleted file mode 100644 index 29168abf7..000000000 --- a/networkstatus/networkstatus.kdevelop +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version = '1.0'?> -<kdevelop> - <general> - <author>Will Stephenson</author> - <email>wstephenson@suse.de</email> - <version>$VERSION$</version> - <projectmanagement>KDevKDEAutoProject</projectmanagement> - <primarylanguage>C++</primarylanguage> - <keywords> - <keyword>Qt</keyword> - <keyword>KDE</keyword> - </keywords> - </general> - <kdevfileview> - <groups> - <group pattern="*.cpp;*.cxx;*.h" name="Sources" /> - <group pattern="*.ui" name="User Interface" /> - <group pattern="*.png" name="Icons" /> - <group pattern="*.po;*.ts" name="Translations" /> - <group pattern="*" name="Others" /> - <hidenonprojectfiles>false</hidenonprojectfiles> - <hidenonlocation>false</hidenonlocation> - </groups> - <tree> - <hidepatterns>*.o,*.lo,CVS</hidepatterns> - <hidenonprojectfiles>false</hidenonprojectfiles> - </tree> - </kdevfileview> - <kdevdoctreeview> - <ignoretocs> - <toc>ada</toc> - <toc>ada_bugs_gcc</toc> - <toc>bash</toc> - <toc>bash_bugs</toc> - <toc>clanlib</toc> - <toc>fortran_bugs_gcc</toc> - <toc>gnome1</toc> - <toc>gnustep</toc> - <toc>gtk</toc> - <toc>gtk_bugs</toc> - <toc>haskell</toc> - <toc>haskell_bugs_ghc</toc> - <toc>java_bugs_gcc</toc> - <toc>java_bugs_sun</toc> - <toc>opengl</toc> - <toc>pascal_bugs_fp</toc> - <toc>php</toc> - <toc>php_bugs</toc> - <toc>perl</toc> - <toc>perl_bugs</toc> - <toc>python</toc> - <toc>python_bugs</toc> - <toc>ruby</toc> - <toc>ruby_bugs</toc> - <toc>sdl</toc> - <toc>stl</toc> - <toc>sw</toc> - <toc>w3c-dom-level2-html</toc> - <toc>w3c-svg</toc> - <toc>w3c-uaag10</toc> - <toc>wxwidgets_bugs</toc> - </ignoretocs> - <ignoreqt_xml> - <toc>qmake User Guide</toc> - </ignoreqt_xml> - </kdevdoctreeview> - <kdevdebugger> - <general> - <dbgshell>libtool</dbgshell> - </general> - </kdevdebugger> - <kdevfilecreate> - <useglobaltypes> - <type ext="ui" /> - <type ext="cpp" /> - <type ext="h" /> - </useglobaltypes> - </kdevfilecreate> - <kdevautoproject> - <make> - <envvars> - <envvar value="1" name="WANT_AUTOCONF_2_5" /> - <envvar value="1" name="WANT_AUTOMAKE_1_6" /> - </envvars> - </make> - <run> - <directoryradio>executable</directoryradio> - </run> - <general> - <activetarget>kded_networkstatus.la</activetarget> - </general> - </kdevautoproject> - <kdevcppsupport> - <references/> - <codecompletion> - <includeGlobalFunctions>true</includeGlobalFunctions> - <includeTypes>true</includeTypes> - <includeEnums>true</includeEnums> - <includeTypedefs>false</includeTypedefs> - <automaticCodeCompletion>true</automaticCodeCompletion> - <automaticArgumentsHint>true</automaticArgumentsHint> - <automaticHeaderCompletion>true</automaticHeaderCompletion> - <codeCompletionDelay>250</codeCompletionDelay> - <argumentsHintDelay>400</argumentsHintDelay> - <headerCompletionDelay>250</headerCompletionDelay> - </codecompletion> - </kdevcppsupport> -</kdevelop> diff --git a/networkstatus/networkstatuscommon.cpp b/networkstatus/networkstatuscommon.cpp deleted file mode 100644 index 574862929..000000000 --- a/networkstatus/networkstatuscommon.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "networkstatuscommon.h" -#include <kdebug.h> - -TQDataStream & operator<< ( TQDataStream & s, const NetworkStatus::Properties p ) -{ - kdDebug() << k_funcinfo << "status is: " << (int)p.status << endl; - s << (int)p.status; - s << (int)p.onDemandPolicy; - s << p.service; - s << ( p.internet ? 1 : 0 ); - s << p.netmasks; - return s; -} - -TQDataStream & operator>> ( TQDataStream & s, NetworkStatus::Properties &p ) -{ - int status, onDemandPolicy, internet; - s >> status; - kdDebug() << k_funcinfo << "status is: " << status << endl; - p.status = ( NetworkStatus::EnumStatus )status; - s >> onDemandPolicy; - p.onDemandPolicy = ( NetworkStatus::EnumOnDemandPolicy )onDemandPolicy; - s >> p.service; - s >> internet; - if ( internet ) - p.internet = true; - else - p.internet = false; - s >> p.netmasks; - kdDebug() << k_funcinfo << "enum converted status is: " << p.status << endl; - return s; -} diff --git a/networkstatus/networkstatuscommon.h b/networkstatus/networkstatuscommon.h deleted file mode 100644 index 63c388c3f..000000000 --- a/networkstatus/networkstatuscommon.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef NETWORKSTATUS_COMMON_H -#define NETWORKSTATUS_COMMON_H - -#include <tqstringlist.h> - -namespace NetworkStatus -{ - enum EnumStatus { NoNetworks = 1, Unreachable, OfflineDisconnected, OfflineFailed, ShuttingDown, Offline, Establishing, Online }; - enum EnumRequestResult { RequestAccepted = 1, Connected, UserRefused, Unavailable }; - enum EnumOnDemandPolicy { All, User, None, Permanent }; - struct Properties - { - TQString name; - // status of the network - EnumStatus status; - // policy for on-demand usage as defined by the service - EnumOnDemandPolicy onDemandPolicy; - // identifier for the service - TQCString service; - // indicate that the connection is to 'the internet' - similar to default gateway in routing - bool internet; - // list of netmasks that the network connects to - overridden by above internet - TQStringList netmasks; - // for future expansion consider - // EnumChargingModel - FlatRate, TimeCharge, VolumeCharged - // EnumLinkStatus - for WLANs - VPOOR, POOR, AVERAGE, GOOD, EXCELLENT - }; -} - -TQDataStream & operator>> ( TQDataStream & s, NetworkStatus::Properties &p ); -TQDataStream & operator<< ( TQDataStream & s, const NetworkStatus::Properties p ); - -#endif diff --git a/networkstatus/provideriface.h b/networkstatus/provideriface.h deleted file mode 100644 index 93f23103d..000000000 --- a/networkstatus/provideriface.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef NETWORKSTATUS_PROVIDERIFACE_H -#define NETWORKSTATUS_PROVIDERIFACE_H - -#include <dcopobject.h> -class ProviderIface : virtual public DCOPObject -{ -K_DCOP -k_dcop: - /** @return NetworkStatus::EnumOnlineStatus */ - virtual int status( const TQString & network ) = 0; - /** @return NetworkStatus::EnumRequestResult */ - virtual int establish( const TQString & network ) = 0; - /** @return NetworkStatus::EnumRequestResult */ - virtual int shutdown( const TQString & network ) = 0; - /** fake a failure - go directly to failed */ - virtual void simulateFailure() = 0; - /** fake a network disconnect - go directly to offlinedisconnected */ - virtual void simulateDisconnect() = 0; -}; - -#endif diff --git a/networkstatus/serviceiface.h b/networkstatus/serviceiface.h deleted file mode 100644 index 1e6b423ff..000000000 --- a/networkstatus/serviceiface.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KDED_NETWORKSTATUS_SERVICEIFACE_H -#define KDED_NETWORKSTATUS_SERVICEIFACE_H - -#include "networkstatuscommon.h" - -#include <dcopobject.h> - -class ServiceIface : virtual public DCOPObject -{ -K_DCOP -k_dcop: - /** Change the status for the given network */ - virtual void setNetworkStatus( const TQString & networkName, int status ) = 0; - /** Register or update the properties for a network - NB Check that people don't use this to change status */ - virtual void registerNetwork( const TQString & networkName, NetworkStatus::Properties properties ) = 0; - /** - * Indicate that this service is no longer administering the named network - * TODO: Work out the implications to clients of unregistering a network - * - maybe this method needs more parameters to give them a clue. - */ - virtual void unregisterNetwork( const TQString & networkName ) = 0; - /** - * Tell the daemon that the service would like to shut down this network connection, - * and to notify clients using it so they can stop using it in a controlled manner - */ - virtual void requestShutdown( const TQString & networkName ) = 0; -}; - -#endif diff --git a/networkstatus/serviceifaceimpl.cpp b/networkstatus/serviceifaceimpl.cpp deleted file mode 100644 index cf5c0df99..000000000 --- a/networkstatus/serviceifaceimpl.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "serviceifaceimpl.h" - -ServiceIfaceImpl::ServiceIfaceImpl( NetworkStatusModule * module ) : m_module ( module ) -{ -} - -void ServiceIfaceImpl::setStatus( TQString networkName, int status ) -{ - m_module->setStatus( networkName, (NetworkStatus::EnumStatus)status ); -} - -void ServiceIfaceImpl::registerNetwork( TQString networkName, NetworkStatus::Properties properties ) -{ - m_module->registerNetwork( networkName, properties ); -} - -void ServiceIfaceImpl::unregisterNetwork( TQString networkName ) -{ - m_module->unregisterNetwork( networkName ); -} - -void ServiceIfaceImpl::requestShutdown( TQString networkName ) -{ - m_module->requestShutdown( networkName ); -} diff --git a/networkstatus/serviceifaceimpl.h b/networkstatus/serviceifaceimpl.h deleted file mode 100644 index 6ffba3609..000000000 --- a/networkstatus/serviceifaceimpl.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef NETWORKSTATUS_SERVICEIFACEIMPL_H -#define NETWORKSTATUS_SERVICEIFACEIMPL_H - -#include "networkstatus.h" -#include "serviceiface.h" - -/** - * Glue class linking DCOP skeleton to daemon - */ -class ServiceIfaceImpl : virtual public ServiceIface -{ -public: - ServiceIfaceImpl( NetworkStatusModule * module ); - void setStatus( TQString networkName, int status ); - void registerNetwork( TQString networkName, NetworkStatus::Properties properties ); - void unregisterNetwork( TQString networkName ); - void requestShutdown( TQString networkName ); -private: - NetworkStatusModule * m_module; -}; - -#endif diff --git a/networkstatus/testservice.cpp b/networkstatus/testservice.cpp deleted file mode 100644 index 46b19109f..000000000 --- a/networkstatus/testservice.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <tqtimer.h> -#include <dcopclient.h> -#include <kapplication.h> -#include "provideriface.h" - -#include "testservice.h" -#include "serviceiface_stub.h" - -TestService::TestService() : TQObject(), DCOPObject("ProviderIface") -{ - kapp->dcopClient()->registerAs("testservice" ); - m_service = new ServiceIface_stub( "kded", "networkstatus" ); - m_status = NetworkStatus::Offline; - NetworkStatus::Properties nsp; - nsp.internet = true; - nsp.name = "test_net"; - nsp.onDemandPolicy = NetworkStatus::All; - nsp.service = kapp->dcopClient()->appId(); - nsp.status = m_status; - m_service->registerNetwork( "test_net", nsp ); -} - -TestService::~TestService() -{ - delete m_service; -} - -int TestService::status( const TQString & network ) -{ - Q_UNUSED( network ); - return (int)m_status; -} - -int TestService::establish( const TQString & network ) -{ - Q_UNUSED( network ); - m_status = NetworkStatus::Establishing; - m_service->setNetworkStatus( "test_net", (int)m_status ); - m_nextStatus = NetworkStatus::Online; - TQTimer::singleShot( 5000, this, TQT_SLOT( slotStatusChange() ) ); - return (int)NetworkStatus::RequestAccepted; -} - -int TestService::shutdown( const TQString & network ) -{ - Q_UNUSED( network ); - m_status = NetworkStatus::ShuttingDown; - m_service->setNetworkStatus( "test_net", (int)m_status ); - m_nextStatus = NetworkStatus::Offline; - TQTimer::singleShot( 5000, this, TQT_SLOT( slotStatusChange() ) ); - return (int)NetworkStatus::RequestAccepted; -} - -void TestService::simulateFailure() -{ - m_status = NetworkStatus::OfflineFailed; - m_service->setNetworkStatus( "test_net", (int)m_status ); -} - -void TestService::simulateDisconnect() -{ - m_status = NetworkStatus::OfflineDisconnected; - m_service->setNetworkStatus( "test_net", (int)m_status ); -} - -void TestService::slotStatusChange() -{ - m_status = m_nextStatus; - m_service->setNetworkStatus( "test_net", (int)m_status ); -} - -int main( int argc, char** argv ) -{ - KApplication app(argc, argv, "testdcop"); - TestService * test = new TestService; - Q_UNUSED( test ); - return app.exec(); -} - -#include "testservice.moc" diff --git a/networkstatus/testservice.h b/networkstatus/testservice.h deleted file mode 100644 index 65febdca9..000000000 --- a/networkstatus/testservice.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - This file is part of kdepim. - - Copyright (c) 2005 Will Stephenson <lists@stevello.free-online.co.uk> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef _TEST_NETWORKSTATUS_SERVICE_H -#define _TEST_NETWORKSTATUS_SERVICE_H - -#include "networkstatuscommon.h" -#include "provideriface.h" - -class ServiceIface_stub; - -class TestService : virtual public TQObject, ProviderIface -{ -Q_OBJECT -public: - TestService(); - virtual ~TestService(); - int status( const TQString & network ); - int establish( const TQString & network ); - int shutdown( const TQString & network ); - void simulateFailure(); - void simulateDisconnect(); -protected slots: - void slotStatusChange(); -private: - ServiceIface_stub * m_service; - NetworkStatus::EnumStatus m_status; - NetworkStatus::EnumStatus m_nextStatus; -}; - -#endif |