diff -urN knetworkmanager-orig/src/Makefile.am knetworkmanager/src/Makefile.am --- knetworkmanager-orig/src/Makefile.am 2006-05-22 17:53:17.000000000 +0600 +++ knetworkmanager/src/Makefile.am 2006-05-24 22:05:11.000000000 +0600 @@ -8,7 +8,7 @@ knetworkmanager-nminfo_dbus.h knetworkmanager-nminfo.h knetworkmanager-notify.h \ knetworkmanager-tray.h knetworkmanager-state.h knetworkmanager-state_dbus.h \ knetworkmanager-storage.h knetworkmanager-encryption.h knetworkmanager-ui-networklistview.h \ - knetworkmanager-vpn.h knetworkmanager-vpn_dbus.h + knetworkmanager-vpn.h knetworkmanager-vpn_dbus.h networkstatuscommon.h # let automoc handle all of the meta source files (moc) METASOURCES = AUTO @@ -36,16 +36,14 @@ knetworkmanager-dialup.cpp settings.kcfgc knetworkmanager-encryption.cpp knetworkmanager-tray.cpp \ activation.ui cryptowidget.ui networkchoicewidget.ui networklabelwidget.ui \ knetworkmanager-ui-networklistview.cpp \ - knetworkmanager-vpn.cpp knetworkmanager-vpn_dbus.cpp serviceiface.stub - -serviceiface_DIR = /opt/kde3/include + knetworkmanager-vpn.cpp knetworkmanager-vpn_dbus.cpp serviceiface.stub networkstatuscommon.cpp kde_kcfg_DATA = knetworkmanager.kcfg knetworkmanager_la_LDFLAGS = -module $(KDE_RPATH) $(all_libraries) \ $(KDE_PLUGIN) -knetworkmanager_la_LIBADD = -lnetworkstatus -ldbus-qt-1 $(PACKAGE_LIBS) \ +knetworkmanager_la_LIBADD = -ldbus-qt-1 $(PACKAGE_LIBS) \ $(LIB_KDEUI) -lkwalletclient -lkdeui -lkio # this is where the desktop file will go diff -urN knetworkmanager-orig/src/networkstatuscommon.cpp knetworkmanager/src/networkstatuscommon.cpp --- knetworkmanager-orig/src/networkstatuscommon.cpp 1970-01-01 05:00:00.000000000 +0500 +++ knetworkmanager/src/networkstatuscommon.cpp 2005-09-10 14:24:02.000000000 +0600 @@ -0,0 +1,53 @@ +/* + This file is part of kdepim. + + Copyright (c) 2005 Will Stephenson + + 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 + +QDataStream & operator<< ( QDataStream & 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; +} + +QDataStream & operator>> ( QDataStream & 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 -urN knetworkmanager-orig/src/networkstatuscommon.h knetworkmanager/src/networkstatuscommon.h --- knetworkmanager-orig/src/networkstatuscommon.h 1970-01-01 05:00:00.000000000 +0500 +++ knetworkmanager/src/networkstatuscommon.h 2005-09-10 14:24:02.000000000 +0600 @@ -0,0 +1,54 @@ +/* + This file is part of kdepim. + + Copyright (c) 2005 Will Stephenson + + 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 + +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 + { + QString name; + // status of the network + EnumStatus status; + // policy for on-demand usage as defined by the service + EnumOnDemandPolicy onDemandPolicy; + // identifier for the service + QCString 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 + QStringList netmasks; + // for future expansion consider + // EnumChargingModel - FlatRate, TimeCharge, VolumeCharged + // EnumLinkStatus - for WLANs - VPOOR, POOR, AVERAGE, GOOD, EXCELLENT + }; +} + +QDataStream & operator>> ( QDataStream & s, NetworkStatus::Properties &p ); +QDataStream & operator<< ( QDataStream & s, const NetworkStatus::Properties p ); + +#endif diff -urN knetworkmanager-orig/src/serviceiface.h knetworkmanager/src/serviceiface.h --- knetworkmanager-orig/src/serviceiface.h 1970-01-01 05:00:00.000000000 +0500 +++ knetworkmanager/src/serviceiface.h 2005-09-10 14:24:02.000000000 +0600 @@ -0,0 +1,51 @@ +/* + This file is part of kdepim. + + Copyright (c) 2005 Will Stephenson + + 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 + +class ServiceIface : virtual public DCOPObject +{ +K_DCOP +k_dcop: + /** Change the status for the given network */ + virtual void setNetworkStatus( const QString & 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 QString & 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 QString & 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 QString & networkName ) = 0; +}; + +#endif