git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171617 283d02a7-25f6-0310-bc7c-ecb5cbfe19dav3.5.13-sru
parent
84ae8923df
commit
af20635a2b
@ -0,0 +1,77 @@
|
||||
/*
|
||||
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
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
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()
|
||||
// {
|
||||
//
|
||||
// }
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
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
|
@ -1,13 +0,0 @@
|
||||
#include "connectionmanager_p.h"
|
||||
|
||||
ConnectionManagerPrivate::ConnectionManagerPrivate(TQObject * parent, const char * name ) : TQObject( parent, name ), service( 0 ), connectPolicy( ConnectionManager::Managed ),
|
||||
disconnectPolicy( ConnectionManager::Managed ), connectReceiver( 0 ), connectSlot( 0 ),
|
||||
disconnectReceiver( 0 ), disconnectSlot( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
ConnectionManagerPrivate::~ConnectionManagerPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
#include "connectionmanager_p.moc"
|
@ -1,55 +0,0 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
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. If not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this library
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#ifndef CONNECTIONMANAGERPRIVATE_H
|
||||
#define CONNECTIONMANAGERPRIVATE_H
|
||||
|
||||
#include <tqobject.h>
|
||||
|
||||
#include "connectionmanager.h"
|
||||
#include "networkstatuscommon.h"
|
||||
#include "networkstatusiface_stub.h"
|
||||
|
||||
|
||||
// ConnectionManager's private parts
|
||||
class ConnectionManagerPrivate : public TQObject
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class ConnectionManager;
|
||||
public:
|
||||
ConnectionManagerPrivate( TQObject * parent = 0, const char * name = 0);
|
||||
~ConnectionManagerPrivate();
|
||||
// this holds the currently active state
|
||||
NetworkStatus::Status status;
|
||||
NetworkStatusIface_stub * service;
|
||||
ConnectionManager::ConnectionPolicy connectPolicy;
|
||||
ConnectionManager::ConnectionPolicy disconnectPolicy;
|
||||
TQObject * connectReceiver;
|
||||
const char * connectSlot;
|
||||
TQObject * disconnectReceiver;
|
||||
const char * disconnectSlot;
|
||||
signals:
|
||||
void connected();
|
||||
void disconnected();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,50 +0,0 @@
|
||||
/* This file is part of kdepim.
|
||||
Copyright (C) 2005,2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
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. If not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this library
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#ifndef KDED_NETWORKSTATUSIFACE_H
|
||||
#define KDED_NETWORKSTATUSIFACE_H
|
||||
|
||||
#include <dcopobject.h>
|
||||
#include <tqstringlist.h>
|
||||
|
||||
#include "networkstatuscommon.h"
|
||||
|
||||
class NetworkStatusIface : virtual public DCOPObject
|
||||
{
|
||||
K_DCOP
|
||||
k_dcop:
|
||||
// Client interface
|
||||
virtual TQStringList networks() = 0;
|
||||
virtual int status() = 0;
|
||||
// Service interface
|
||||
virtual void setNetworkStatus( const TQString & networkName, int status ) = 0;
|
||||
virtual void registerNetwork( NetworkStatus::Properties properties ) = 0;
|
||||
virtual void unregisterNetwork( const TQString & networkName ) = 0 ;
|
||||
k_dcop_signals:
|
||||
/**
|
||||
* A status change occurred affecting the overall connectivity
|
||||
* @param status The new status
|
||||
*/
|
||||
virtual void statusChange( int status ) = 0;
|
||||
};
|
||||
#endif
|
||||
// vim: sw=4 ts=4
|
@ -1,64 +0,0 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
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. If not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this library
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#include <tqlabel.h>
|
||||
#include <tqtooltip.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include "connectionmanager.h"
|
||||
|
||||
#include "networkstatusindicator.h"
|
||||
|
||||
StatusBarNetworkStatusIndicator::StatusBarNetworkStatusIndicator(
|
||||
TQWidget * parent, const char * name ) : TQHBox( parent, name )/*, d( new StatusBarNetworkStatusIndicatorPrivate )*/
|
||||
{
|
||||
setMargin( 2 );
|
||||
setSpacing( 1 );
|
||||
TQLabel * label = new TQLabel( this, "offlinemodelabel" );
|
||||
label->setPixmap( SmallIcon("connect_no") );
|
||||
TQToolTip::add( label, i18n( "The desktop is offline" ) );
|
||||
|
||||
connect( ConnectionManager::self(), TQT_SIGNAL( statusChanged( NetworkStatus::Status ) ),
|
||||
TQT_SLOT( networkStatusChanged( NetworkStatus::Status) ) );
|
||||
|
||||
}
|
||||
|
||||
void StatusBarNetworkStatusIndicator::init()
|
||||
{
|
||||
networkStatusChanged( ConnectionManager::self()->status());
|
||||
}
|
||||
|
||||
StatusBarNetworkStatusIndicator::~StatusBarNetworkStatusIndicator()
|
||||
{
|
||||
}
|
||||
|
||||
void StatusBarNetworkStatusIndicator::networkStatusChanged( NetworkStatus::Status status )
|
||||
{
|
||||
if ( status == NetworkStatus::Online || status == NetworkStatus::NoNetworks ) {
|
||||
hide();
|
||||
} else {
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
#include "networkstatusindicator.moc"
|
@ -1,42 +0,0 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
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. If not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this library
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#ifndef KDE_NETWORKSTATUS_INDICATOR_H
|
||||
#define KDE_NETWORKSTATUS_INDICATOR_H
|
||||
|
||||
#include <tqhbox.h>
|
||||
#include <kdemacros.h>
|
||||
#include <networkstatuscommon.h>
|
||||
|
||||
class StatusBarNetworkStatusIndicator : public TQHBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StatusBarNetworkStatusIndicator( TQWidget * parent, const char * name );
|
||||
virtual ~StatusBarNetworkStatusIndicator();
|
||||
void init();
|
||||
protected slots:
|
||||
void networkStatusChanged( NetworkStatus::Status status );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
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
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
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
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
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 );
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
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
|
@ -1,234 +0,0 @@
|
||||
/* This file is part of kdepim.
|
||||
Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#include <tqlabel.h>
|
||||
#include <tqpushbutton.h>
|
||||
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kdeversion.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <kiconloader.h>
|
||||
|
||||
#include "connectionmanager.h"
|
||||
#include "testclientview.h"
|
||||
#include "testclient.h"
|
||||
|
||||
TestClient::TestClient()
|
||||
: KMainWindow( 0, "ktestnetworkstatus" ),
|
||||
m_view(new TestClientView(this)),
|
||||
m_status( AppDisconnected )
|
||||
{
|
||||
// tell the KMainWindow that this is indeed the main widget
|
||||
setCentralWidget(m_view);
|
||||
|
||||
networkStatusChanged( ConnectionManager::self()->status() );
|
||||
appDisconnected();
|
||||
|
||||
connect( ConnectionManager::self(), TQT_SIGNAL( statusChanged( NetworkStatus::Status ) ), TQT_SLOT( networkStatusChanged( NetworkStatus::Status ) ) );
|
||||
|
||||
connect( m_view->connectButton, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( connectButtonToggled( bool ) ) );
|
||||
}
|
||||
|
||||
TestClient::~TestClient()
|
||||
{
|
||||
}
|
||||
|
||||
void TestClient::networkStatusChanged( NetworkStatus::Status status )
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
//enum EnumStatus { NoNetworks = 1, Unreachable, OfflineDisconnected, OfflineFailed, ShuttingDown
|
||||
// , Offline, Establishing, Online };
|
||||
kdDebug() << "Networking is now: " << NetworkStatus::toString( status ) << " (" << status << ")" << endl;
|
||||
m_view->netStatusLabel->setText( NetworkStatus::toString( status ) );
|
||||
m_view->netStatusLabel->setPaletteBackgroundColor( toQColor( status ) );
|
||||
switch ( status ) {
|
||||
case NetworkStatus::NoNetworks:
|
||||
break;
|
||||
case NetworkStatus::Unreachable:
|
||||
break;
|
||||
case NetworkStatus::OfflineDisconnected:
|
||||
break;
|
||||
case NetworkStatus::OfflineFailed:
|
||||
break;
|
||||
case NetworkStatus::ShuttingDown:
|
||||
if ( m_status == AppConnected ) {
|
||||
appDisestablishing();
|
||||
}
|
||||
break;
|
||||
case NetworkStatus::Offline:
|
||||
if ( m_status == AppConnected ) {
|
||||
appDisconnected();
|
||||
}
|
||||
break;
|
||||
case NetworkStatus::Establishing:
|
||||
if ( m_status == AppWaitingForConnect )
|
||||
appEstablishing();
|
||||
else if ( m_status == AppConnected )
|
||||
appDisconnected();
|
||||
break;
|
||||
case NetworkStatus::Online:
|
||||
if ( m_status == AppWaitingForConnect )
|
||||
appIsConnected();
|
||||
break;
|
||||
default:
|
||||
m_view->netStatusLabel->setText( "Unrecognised status code!" );
|
||||
}
|
||||
}
|
||||
|
||||
void TestClient::connectButtonToggled( bool on )
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
if ( on && m_status == AppDisconnected ) {
|
||||
switch ( ConnectionManager::self()->status() )
|
||||
{
|
||||
case NetworkStatus::NoNetworks:
|
||||
case NetworkStatus::Online:
|
||||
appIsConnected();
|
||||
break;
|
||||
default:
|
||||
appWaiting();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( !on && m_status == AppConnected ) {
|
||||
appDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
void TestClient::appWaiting()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_status = AppWaitingForConnect;
|
||||
m_view->appStatusLabel->setText( "Waiting" );
|
||||
}
|
||||
|
||||
void TestClient::appIsConnected()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->connectButton->setEnabled( true );
|
||||
m_view->connectButton->setText( "Disconnect" );
|
||||
m_view->appStatusLabel->setText( "Connected" );
|
||||
m_status = AppConnected;
|
||||
}
|
||||
|
||||
void TestClient::appEstablishing()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->netStatusLabel->setText( "Establishing" );
|
||||
m_view->connectButton->setEnabled( false );
|
||||
}
|
||||
|
||||
void TestClient::appDisestablishing( )
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->connectButton->setEnabled( false );
|
||||
m_view->appStatusLabel->setText( "Disconnected" );
|
||||
}
|
||||
|
||||
void TestClient::appDisconnected( )
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->connectButton->setEnabled( true );
|
||||
m_view->connectButton->setText( "Start Connect" );
|
||||
m_view->appStatusLabel->setText( "Disconnected" );
|
||||
m_status = AppDisconnected;
|
||||
}
|
||||
|
||||
TQColor TestClient::toQColor( NetworkStatus::Status st )
|
||||
{
|
||||
TQColor col;
|
||||
switch ( st ) {
|
||||
case NetworkStatus::NoNetworks:
|
||||
col = Qt::darkGray;
|
||||
break;
|
||||
case NetworkStatus::Unreachable:
|
||||
col = Qt::darkMagenta;
|
||||
break;
|
||||
case NetworkStatus::OfflineDisconnected:
|
||||
col = Qt::blue;
|
||||
break;
|
||||
case NetworkStatus::OfflineFailed:
|
||||
col = Qt::darkRed;
|
||||
break;
|
||||
case NetworkStatus::ShuttingDown:
|
||||
col = Qt::darkYellow;
|
||||
break;
|
||||
case NetworkStatus::Offline:
|
||||
col = Qt::blue;
|
||||
break;
|
||||
case NetworkStatus::Establishing:
|
||||
col = Qt::yellow;
|
||||
break;
|
||||
case NetworkStatus::Online:
|
||||
col = Qt::green;
|
||||
break;
|
||||
}
|
||||
return col;
|
||||
}
|
||||
//main
|
||||
static const char description[] =
|
||||
I18N_NOOP("Test Client for Network Status kded module");
|
||||
|
||||
static const char version[] = "v0.1";
|
||||
|
||||
static KCmdLineOptions options[] =
|
||||
{
|
||||
KCmdLineLastOption
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
KAboutData about("KNetworkStatusTestClient", I18N_NOOP("knetworkstatustestclient"), version, description, KAboutData::License_GPL, "(C) 2007 Will Stephenson", 0, 0, "wstephenson@kde.org");
|
||||
about.addAuthor( "Will Stephenson", 0, "wstephenson@kde.org" );
|
||||
KCmdLineArgs::init(argc, argv, &about);
|
||||
KCmdLineArgs::addCmdLineOptions(options);
|
||||
KApplication app;
|
||||
|
||||
// register ourselves as a dcop client
|
||||
app.dcopClient()->registerAs(app.name(), false);
|
||||
|
||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||
if (args->count() == 0)
|
||||
{
|
||||
TestClient *widget = new TestClient;
|
||||
widget->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
for (; i < args->count(); i++)
|
||||
{
|
||||
TestClient *widget = new TestClient;
|
||||
widget->show();
|
||||
}
|
||||
}
|
||||
args->clear();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
#include "testclient.moc"
|
||||
|
@ -1,80 +0,0 @@
|
||||
/* This file is part of kdepim.
|
||||
|
||||
Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#ifndef KTESTNETWORKSTATUS_H
|
||||
#define KTESTNETWORKSTATUS_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dcopclient.h>
|
||||
#include <kapplication.h>
|
||||
#include <kmainwindow.h>
|
||||
#include <networkstatuscommon.h>
|
||||
|
||||
#include "networkstatusiface_stub.h"
|
||||
|
||||
class TestClientView;
|
||||
|
||||
/**
|
||||
* This class serves as the main window for ktestnetworkstatus. It handles the
|
||||
* menus, toolbars, and status bars.
|
||||
*
|
||||
* @short Main window class
|
||||
* @author Will Stephenson <wstephenson@kde.org>
|
||||
* @version 0.1
|
||||
*/
|
||||
class TestClient : public KMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum AppStatus{ AppDisconnected, AppWaitingForConnect, AppConnected };
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
TestClient();
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~TestClient();
|
||||
|
||||
private slots:
|
||||
void networkStatusChanged( NetworkStatus::Status status );
|
||||
void connectButtonToggled( bool on );
|
||||
private:
|
||||
void appWaiting();
|
||||
void appEstablishing();
|
||||
void appIsConnected();
|
||||
void appDisestablishing();
|
||||
void appDisconnected();
|
||||
static TQColor toQColor( NetworkStatus::Status );
|
||||
private:
|
||||
NetworkStatusIface_stub *m_service;
|
||||
TestClientView *m_view;
|
||||
AppStatus m_status; // this represents the app's status not the network's status
|
||||
};
|
||||
|
||||
#endif // KTESTNETWORKSTATUS_H
|
||||
|
@ -1,222 +0,0 @@
|
||||
/* This file is part of kdepim.
|
||||
Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#include <tqlabel.h>
|
||||
#include <tqpushbutton.h>
|
||||
#include <tqvbox.h>
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
#include <kdeversion.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <kiconloader.h>
|
||||
|
||||
#include <connectionmanager.h>
|
||||
#include <networkstatusindicator.h>
|
||||
|
||||
#include "testclientview.h"
|
||||
#include "testclient2.h"
|
||||
|
||||
TestClient::TestClient()
|
||||
: KMainWindow( 0, "ktestnetworkstatus" ),
|
||||
m_layout( new TQVBox( 0, "layout" ) ),
|
||||
m_status( AppDisconnected )
|
||||
{
|
||||
m_view = new TestClientView( this );
|
||||
new StatusBarNetworkStatusIndicator( m_view, "statusindicator" );
|
||||
// tell the KMainWindow that this is indeed the main widget
|
||||
setCentralWidget(m_view);
|
||||
|
||||
networkStatusChanged( ConnectionManager::self()->status() );
|
||||
appDisconnected();
|
||||
|
||||
connect( ConnectionManager::self(), TQT_SIGNAL( statusChanged( NetworkStatus::Status ) ), TQT_SLOT( networkStatusChanged( NetworkStatus::Status ) ) );
|
||||
ConnectionManager::self()->registerConnectSlot( this, TQT_SLOT( doConnect() ) );
|
||||
ConnectionManager::self()->registerDisconnectSlot( this, TQT_SLOT( doDisconnect() ) );
|
||||
|
||||
connect( m_view->connectButton, TQT_SIGNAL( clicked() ), TQT_SLOT( connectButtonClicked() ) );
|
||||
}
|
||||
|
||||
TestClient::~TestClient()
|
||||
{
|
||||
}
|
||||
|
||||
void TestClient::networkStatusChanged( NetworkStatus::Status status )
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
kdDebug() << "Networking is now: " << NetworkStatus::toString( status ) << " (" << status << ")" << endl;
|
||||
m_view->netStatusLabel->setText( NetworkStatus::toString( status ) );
|
||||
m_view->netStatusLabel->setPaletteBackgroundColor( toQColor( status ) );
|
||||
}
|
||||
|
||||
void TestClient::doConnect()
|
||||
{
|
||||
Q_ASSERT( ConnectionManager::self()->status() == NetworkStatus::Online );
|
||||
if ( m_status != AppConnected ) {
|
||||
appIsConnected();
|
||||
}
|
||||
}
|
||||
|
||||
void TestClient::doDisconnect()
|
||||
{
|
||||
Q_ASSERT( ConnectionManager::self()->status() != NetworkStatus::Online );
|
||||
if ( m_status == AppConnected ) {
|
||||
appDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
void TestClient::connectButtonClicked()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
if ( m_status == AppDisconnected ) {
|
||||
switch ( ConnectionManager::self()->status() )
|
||||
{
|
||||
case NetworkStatus::NoNetworks:
|
||||
case NetworkStatus::Online:
|
||||
appIsConnected();
|
||||
break;
|
||||
default:
|
||||
appWaiting();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ( m_status == AppConnected || m_status == AppWaitingForConnect ) {
|
||||
appDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
void TestClient::appWaiting()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
//m_status = AppWaitingForConnect;
|
||||
m_view->appStatusLabel->setText( "Waiting" );
|
||||
}
|
||||
|
||||
void TestClient::appIsConnected()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->connectButton->setEnabled( true );
|
||||
m_view->connectButton->setText( "Disconnect" );
|
||||
m_view->appStatusLabel->setText( "Connected" );
|
||||
m_status = AppConnected;
|
||||
}
|
||||
|
||||
void TestClient::appEstablishing()
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->netStatusLabel->setText( "Establishing" );
|
||||
m_view->connectButton->setEnabled( false );
|
||||
}
|
||||
|
||||
void TestClient::appDisestablishing( )
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->connectButton->setEnabled( false );
|
||||
m_view->appStatusLabel->setText( "Disconnected" );
|
||||
}
|
||||
|
||||
void TestClient::appDisconnected( )
|
||||
{
|
||||
kdDebug() << k_funcinfo << endl;
|
||||
m_view->connectButton->setEnabled( true );
|
||||
m_view->connectButton->setText( "Start Connect" );
|
||||
m_view->appStatusLabel->setText( "Disconnected" );
|
||||
m_status = AppDisconnected;
|
||||
}
|
||||
|
||||
TQColor TestClient::toQColor( NetworkStatus::Status st )
|
||||
{
|
||||
TQColor col;
|
||||
switch ( st ) {
|
||||
case NetworkStatus::NoNetworks:
|
||||
col = Qt::darkGray;
|
||||
break;
|
||||
case NetworkStatus::Unreachable:
|
||||
col = Qt::darkMagenta;
|
||||
break;
|
||||
case NetworkStatus::OfflineDisconnected:
|
||||
col = Qt::blue;
|
||||
break;
|
||||
case NetworkStatus::OfflineFailed:
|
||||
col = Qt::darkRed;
|
||||
break;
|
||||
case NetworkStatus::ShuttingDown:
|
||||
col = Qt::darkYellow;
|
||||
break;
|
||||
case NetworkStatus::Offline:
|
||||
col = Qt::blue;
|
||||
break;
|
||||
case NetworkStatus::Establishing:
|
||||
col = Qt::yellow;
|
||||
break;
|
||||
case NetworkStatus::Online:
|
||||
col = Qt::green;
|
||||
break;
|
||||
}
|
||||
return col;
|
||||
}
|
||||
//main
|
||||
static const char description[] =
|
||||
I18N_NOOP("Test Client for Network Status kded module");
|
||||
|
||||
static const char version[] = "v0.1";
|
||||
|
||||
static KCmdLineOptions options[] =
|
||||
{
|
||||
KCmdLineLastOption
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
KAboutData about("KNetworkStatusTestClient", I18N_NOOP("knetworkstatustestclient"), version, description, KAboutData::License_GPL, "(C) 2007 Will Stephenson", 0, 0, "wstephenson@kde.org");
|
||||
about.addAuthor( "Will Stephenson", 0, "wstephenson@kde.org" );
|
||||
KCmdLineArgs::init(argc, argv, &about);
|
||||
KCmdLineArgs::addCmdLineOptions(options);
|
||||
KApplication app;
|
||||
|
||||
// register ourselves as a dcop client
|
||||
app.dcopClient()->registerAs(app.name(), false);
|
||||
|
||||
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||
if (args->count() == 0)
|
||||
{
|
||||
TestClient *widget = new TestClient;
|
||||
widget->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = 0;
|
||||
for (; i < args->count(); i++)
|
||||
{
|
||||
TestClient *widget = new TestClient;
|
||||
widget->show();
|
||||
}
|
||||
}
|
||||
args->clear();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
#include "testclient2.moc"
|
||||
|
@ -1,82 +0,0 @@
|
||||
/* This file is part of kdepim.
|
||||
|
||||
Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#ifndef KTESTNETWORKSTATUS_H
|
||||
#define KTESTNETWORKSTATUS_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <dcopclient.h>
|
||||
#include <kapplication.h>
|
||||
#include <kmainwindow.h>
|
||||
#include <networkstatuscommon.h>
|
||||
|
||||
#include "networkstatusiface_stub.h"
|
||||
|
||||
class TestClientView;
|
||||
|
||||
/**
|
||||
* Test client that uses a ConnectionManager to change its state
|
||||
*
|
||||
* @short Main window class
|
||||
* @author Will Stephenson <wstephenson@kde.org>
|
||||
* @version 0.1
|
||||
*/
|
||||
class TestClient : public KMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum AppStatus{ AppDisconnected, AppWaitingForConnect, AppConnected };
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
TestClient();
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~TestClient();
|
||||
|
||||
private slots:
|
||||
void networkStatusChanged( NetworkStatus::Status status );
|
||||
void connectButtonClicked();
|
||||
void doConnect();
|
||||
void doDisconnect();
|
||||
private:
|
||||
void appWaiting();
|
||||
void appEstablishing();
|
||||
void appIsConnected();
|
||||
void appDisestablishing();
|
||||
void appDisconnected();
|
||||
static TQColor toQColor( NetworkStatus::Status );
|
||||
private:
|
||||
TQHBox * m_layout;
|
||||
NetworkStatusIface_stub *m_service;
|
||||
TestClientView *m_view;
|
||||
AppStatus m_status; // this represents the app's status not the network's status
|
||||
};
|
||||
|
||||
#endif // KTESTNETWORKSTATUS_H
|
||||
|
@ -1,177 +0,0 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>TestClientView</class>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>TestClientView</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>356</width>
|
||||
<height>127</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Form1</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel4</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><font size="+2"><b>Client for KDE 3 Offline Mode</b></font></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout1</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Network status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>netStatusLabel</cstring>
|
||||
</property>
|
||||
<property name="paletteBackgroundColor">
|
||||
<color>
|
||||
<red>0</red>
|
||||
<green>255</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>Panel</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>STATUS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout1_2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel1_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>App status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>appStatusLabel</cstring>
|
||||
</property>
|
||||
<property name="paletteBackgroundColor">
|
||||
<color>
|
||||
<red>0</red>
|
||||
<green>255</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>Panel</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>STATUS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer1</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>31</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>connectButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start Connect</string>
|
||||
</property>
|
||||
<property name="toggleButton">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -1,181 +0,0 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>TestServiceView</class>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>TestServiceView</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>367</width>
|
||||
<height>132</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Form1</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel4</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><font size="+2"><b>Service for KDE 3 Offline Mode</b></font></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout2</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>statusLabel</cstring>
|
||||
</property>
|
||||
<property name="paletteBackgroundColor">
|
||||
<color>
|
||||
<red>0</red>
|
||||
<green>255</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>StyledPanel</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>STATUS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout3</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>textLabel3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change to:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Offline Disconnected</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Offline Failed</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Shutting Down</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Offline</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Establishing</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Online</string>
|
||||
</property>
|
||||
</item>
|
||||
<property name="name">
|
||||
<cstring>changeCombo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
<widget class="QLayoutWidget">
|
||||
<property name="name">
|
||||
<cstring>layout1</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer1</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>51</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>changeButton</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do change</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>41</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
||||
|
Loading…
Reference in new issue