Buteo Synchronization Framework
Public Slots | Signals | Public Member Functions | List of all members
Buteo::ServerActivator Class Reference

Keeps track of which server plug-ins should be enabled. More...

#include <ServerActivator.h>

Inheritance diagram for Buteo::ServerActivator:

Public Slots

void onConnectivityStateChanged (Sync::ConnectivityType aType, bool aState)
 Called when transport state changes.
 

Signals

void serverEnabled (const QString &aServerName)
 Signal emitted when a server should be enabled.
 
void serverDisabled (const QString &aServerName)
 Signal emitted when a server should be disabled.
 

Public Member Functions

 ServerActivator (ProfileManager &aProfileManager, TransportTracker &aTransportTracker, QObject *aParent=0)
 Constructor.
 
virtual ~ServerActivator ()
 Destructor.
 
int addRef (const QString &aServerName, bool emitSignal=true)
 Adds a reference to the given server.
 
int removeRef (const QString &aServerName, bool emitSignal=true)
 Removes a reference from the given server.
 
QStringList enabledServers () const
 Gets the list of enabled server.
 

Detailed Description

Keeps track of which server plug-ins should be enabled.

Finds out from server profiles which transports each server plug-in uses and concludes the enabled/disabled state based on the transport states. A server is enabled if any of the transports it uses is enabled or if there are any references left to the server. Each matching and enabled transport creates one reference to the server. References can be added and removed also externally, so that a server won't become disabled if it is still in use but all its transports are disabled. A signal is emitted when a server is enabled or disabled. This class does not control the actual server plug-ins, it only gives information about when a server plug-in should be enabled or disabled.

Constructor & Destructor Documentation

◆ ServerActivator()

ServerActivator::ServerActivator ( ProfileManager & aProfileManager,
TransportTracker & aTransportTracker,
QObject * aParent = 0 )

Constructor.

Parameters
aProfileManagerProfile manager for accessing server profiles
aTransportTrackerTransport tracker
aParentParent object

Member Function Documentation

◆ addRef()

int ServerActivator::addRef ( const QString & aServerName,
bool emitSignal = true )

Adds a reference to the given server.

If the reference count was zero, emits the serverEnabled signal, if the emit signal paramater is true

Parameters
aServerNameServer profile name
emitSignalControls the emission of the serverEnabled signal
Returns
Number of references after the addition

◆ enabledServers()

QStringList ServerActivator::enabledServers ( ) const

Gets the list of enabled server.

Returns
Server profile names

◆ onConnectivityStateChanged

void ServerActivator::onConnectivityStateChanged ( Sync::ConnectivityType aType,
bool aState )
slot

Called when transport state changes.

Parameters
aTypeConnectivity type
aStateNew state

◆ removeRef()

int ServerActivator::removeRef ( const QString & aServerName,
bool emitSignal = true )

Removes a reference from the given server.

If the reference count reaches zero, emits the serverDisabled signal, if the emitSignal parameter is true

Parameters
aServerNameServer profile name
emitSignalControls the emission of the serverDisabled signal
Returns
Number of references after the remove

◆ serverDisabled

void Buteo::ServerActivator::serverDisabled ( const QString & aServerName)
signal

Signal emitted when a server should be disabled.

Parameters
aServerNameServer profile name

◆ serverEnabled

void Buteo::ServerActivator::serverEnabled ( const QString & aServerName)
signal

Signal emitted when a server should be enabled.

Parameters
aServerNameServer profile name

The documentation for this class was generated from the following files: