Buteo Synchronization Framework: Buteo::ServerActivator Class Reference

Buteo Synchronization Framework

Classes | 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. More...

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

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

## 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

  aProfileManager | Profile manager for accessing server profiles
  aTransportTracker | Transport tracker
  aParent | Parent 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

  aServerName | Server profile name
  emitSignal | Controls 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

  aType | Connectivity type
  aState | New 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

  aServerName | Server profile name
  emitSignal | Controls 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

  aServerName | Server profile name

## ◆ serverEnabled

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

Signal emitted when a server should be enabled.

Parameters

  aServerName | Server profile name

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

- ServerActivator.h
- moc_ServerActivator.cpp
- ServerActivator.cpp