• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/protocols/messenger/libpapillon

Papillon::Task

Papillon::Task Class Reference

#include <Papillon/Task>

Inheritance diagram for Papillon::Task:

Inheritance graph
[legend]

List of all members.


Detailed Description

Task is the base class for all Task accros Papillon.

Derived class must implement these following methods:
take() - Used to listen and proceed incoming NetworkMessage.
onGo() - Called by go(), start the task.

Devired class may implement these following methods:
forMe() - Used to check if the incoming NetworkMessage is for us.
onDisconnect() - If you need to do something special when a Connection disconnect.

Author:
Michaël Larouche <larouche@kde.org>

Matt Rogers <mattr@kde.org>

SuSE Linux AG <http://www.suse.com>

Justin Karneges

Definition at line 51 of file task.h.


Public Types

enum  StatusCode { ErrorDisconnected }
enum  GoParameter { GoNothing, AutoDelete }

Signals

void finished (Papillon::Task *task)

Public Member Functions

 Task (Task *parent)
 Task (Connection *connection, bool isRoot)
virtual ~Task ()
Task * parent () const
Connection * connection () const
NetworkMessage * networkMessage () const
void setNetworkMessage (NetworkMessage *transfer)
bool success () const
int statusCode () const
const QString & statusString () const
void go (GoParameters args=GoNothing)
virtual bool take (NetworkMessage *transfer)
void safeDelete ()

Protected Member Functions

virtual void onGo ()
virtual void onDisconnect ()
void send (NetworkMessage *request)
void setSuccess (int code=0, const QString &str=QLatin1String(""))
void setError (int code=0, const QString &str=QLatin1String(""))
void debug (const QString &)
virtual bool forMe (NetworkMessage *transfer) const

Member Enumeration Documentation

enum Papillon::Task::StatusCode

Enum for status code.

Enumerator:
ErrorDisconnected  Task failed because it was disconnected.

Definition at line 58 of file task.h.

enum Papillon::Task::GoParameter

This enum is the parameters that the go() method accepts.

Enumerator:
GoNothing  Do nothing.
AutoDelete  Auto delete the task after completion.

Definition at line 69 of file task.h.


Constructor & Destructor Documentation

Papillon::Task::Task ( Task *  parent  ) 

Create a new task.

Parameters:
parent root Task for this Task

Definition at line 47 of file task.cpp.

Papillon::Task::Task ( Connection *  connection,
bool  isRoot 
)

Create a root task.

Parameters:
connection Connection pointer for this task
isRoot if the Task is a root one or not.

Definition at line 55 of file task.cpp.

Papillon::Task::~Task (  )  [virtual]

Task d-tor.

Definition at line 63 of file task.cpp.


Member Function Documentation

Task * Papillon::Task::parent (  )  const

Return the parent Task.

Returns:
the parent Task.

Definition at line 79 of file task.cpp.

Connection * Papillon::Task::connection (  )  const

Return a reference to the connection used by this task.

Returns:
Connection pointer.

Definition at line 84 of file task.cpp.

NetworkMessage * Papillon::Task::networkMessage (  )  const

Get the current transfer if any.

Need to be set with setNetworkMessage().

Returns:
the current NetworkMessage or 0 if this Task do not store any NetworkMessage. TODO: Remove ?

Definition at line 89 of file task.cpp.

void Papillon::Task::setNetworkMessage ( NetworkMessage *  transfer  ) 

Direct setter for Tasks which don't have any fields.

Parameters:
transfer NetworkMessage to set. TODO: Remove ?

Definition at line 94 of file task.cpp.

bool Papillon::Task::success (  )  const

Call this the resulting slot of finished() signal.

Check if the Task was successful or not.

Returns:
true if the Task was a success.

Definition at line 99 of file task.cpp.

int Papillon::Task::statusCode (  )  const

Return the statusCode for this Task.

Returns:
the status code.

Definition at line 104 of file task.cpp.

const QString & Papillon::Task::statusString (  )  const

Get a human readable string of the current status of the Task.

Returns:
status description.

Definition at line 109 of file task.cpp.

void Papillon::Task::go ( GoParameters  args = GoNothing  ) 

Start the Task.

Parameters:
args See GoParameters for details

Definition at line 114 of file task.cpp.

bool Papillon::Task::take ( NetworkMessage *  transfer  )  [virtual]

Allows a task to examine an incoming NetworkMessage and decide whether to 'take' it for further processing.

Reimplemented in Papillon::ChallengeTask, Papillon::LoginTask, Papillon::NotifyMessageTask, Papillon::NotifyPresenceTask, Papillon::NotifyStatusMessageTask, Papillon::SetPersonalInformationTask, Papillon::SetPresenceTask, and Papillon::SetStatusMessageTask.

Definition at line 121 of file task.cpp.

void Papillon::Task::safeDelete (  ) 

Delete safetely this Task.

Definition at line 135 of file task.cpp.

void Papillon::Task::finished ( Papillon::Task *  task  )  [signal]

Emmited when the Task has finished.

Check if the task was successful with success().

Parameters:
task Pointer to the current Task.

void Papillon::Task::onGo (  )  [protected, virtual]

Derived classes should implement this method.

Implements "start" of the Task.

Reimplemented in Papillon::LoginTask, Papillon::SetPersonalInformationTask, Papillon::SetPresenceTask, and Papillon::SetStatusMessageTask.

Definition at line 145 of file task.cpp.

void Papillon::Task::onDisconnect (  )  [protected, virtual]

Derived classes should implement this method.

Called when a disconnection occurs.

Definition at line 150 of file task.cpp.

void Papillon::Task::send ( NetworkMessage *  request  )  [protected]

Helper method for derived Task to send a NetworkMessage through the Connection.

Definition at line 163 of file task.cpp.

void Papillon::Task::setSuccess ( int  code = 0,
const QString &  str = QLatin1String("") 
) [protected]

Helper method to terminate this Task successfully.

Parameters:
code status code.
str status string

Definition at line 168 of file task.cpp.

void Papillon::Task::setError ( int  code = 0,
const QString &  str = QLatin1String("") 
) [protected]

Helper method to terminate this Task with an error.

Parameters:
code status code.
str status string.

Definition at line 179 of file task.cpp.

void Papillon::Task::debug ( const QString &  str  )  [protected]

Debug helper.

TODO: Remove ?

Definition at line 213 of file task.cpp.

bool Papillon::Task::forMe ( NetworkMessage *  transfer  )  const [protected, virtual]

Used in take() to check if the offered transfer is for this Task.

Returns:
true if this Task should take the NetworkMessage. Default impl always returns false.

Reimplemented in Papillon::LoginTask, and Papillon::NotifyPresenceTask.

Definition at line 220 of file task.cpp.


The documentation for this class was generated from the following files:
  • task.h
  • task.cpp

kopete/protocols/messenger/libpapillon

Skip menu "kopete/protocols/messenger/libpapillon"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal