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

kget

TransferHandler Class Reference

#include <transferhandler.h>

Inheritance diagram for TransferHandler:

Inheritance graph
[legend]

List of all members.


Detailed Description

Class TransferHandler:.

--- Overview --- This class is the rapresentation of a Transfer object from the views' perspective (proxy pattern). In fact the views never handle directly the Transfer objects themselves (because this would break the model/view policy). As a general rule, all the code strictly related to the views should placed here (and not in the transfer implementation). Here we provide the same api available in the transfer class, but we change the implementation of some methods. Let's give an example about this: The start() function of a specific Transfer (let's say TransferKio) is a low level command that really makes the transfer start and should therefore be executed only by the scheduler. The start() function in this class is implemented in another way, since it requests the scheduler to execute the start command to this specific transfer. At this point the scheduler will evaluate this request and execute, if possible, the start() function directly in the TransferKio.

--- Notifies about the transfer changes --- When a view is interested in receiving notifies about the specific transfer rapresented by this TransferHandler object, it should add itself to the list of observers calling the addObserver(TransferObserver *) function. On the contrary call the delObserver(TransferObserver *) function to remove it.

--- Interrogation about what has changed in the transfer --- When a TransferObserver receives a notify about a change in the Transfer, it can ask to the TransferHandler for the ChangesFlags.

Definition at line 57 of file transferhandler.h.


Public Types

typedef Transfer::ChangesFlags ChangesFlags

Public Member Functions

 TransferHandler (Transfer *transfer, Scheduler *scheduler)
virtual ~TransferHandler ()
void addObserver (TransferObserver *observer)
void delObserver (TransferObserver *observer)
void start ()
void stop ()
void setDelay (int seconds)
Job::Status status () const
int elapsedTime () const
int remainingTime () const
bool isResumable () const
TransferGroupHandler * group () const
const KUrl & source () const
const KUrl & dest () const
KIO::filesize_t totalSize () const
KIO::filesize_t processedSize () const
int percent () const
int speed () const
QString statusText () const
QPixmap statusPixmap () const
QVariant data (int column)
int columnCount () const
KMenu * popupMenu (QList< TransferHandler * > transfers)
void setSelected (bool select)
bool isSelected () const
ChangesFlags changesFlags (TransferObserver *observer) const
void resetChangesFlags (TransferObserver *observer)

Friends

class KGet
class TransferTreeModel
class Transfer
class TransferFactory
class TransferGroupHandler

Member Typedef Documentation

typedef Transfer::ChangesFlags TransferHandler::ChangesFlags

Definition at line 67 of file transferhandler.h.


Constructor & Destructor Documentation

TransferHandler::TransferHandler ( Transfer *  transfer,
Scheduler *  scheduler 
)

Definition at line 26 of file transferhandler.cpp.

TransferHandler::~TransferHandler (  )  [virtual]

Definition at line 32 of file transferhandler.cpp.


Member Function Documentation

void TransferHandler::addObserver ( TransferObserver *  observer  ) 

Adds an observer to this Transfer.

Parameters:
observer Tthe new observer that should be added

Definition at line 36 of file transferhandler.cpp.

void TransferHandler::delObserver ( TransferObserver *  observer  ) 

Removes an observer from this Transfer.

Parameters:
observer The observer that should be removed

Definition at line 43 of file transferhandler.cpp.

void TransferHandler::start (  ) 

These are all Job-related functions.

Definition at line 50 of file transferhandler.cpp.

void TransferHandler::stop (  ) 

Definition at line 63 of file transferhandler.cpp.

void TransferHandler::setDelay ( int  seconds  ) 

Job::Status TransferHandler::status (  )  const [inline]

Definition at line 93 of file transferhandler.h.

int TransferHandler::elapsedTime (  )  const

Definition at line 75 of file transferhandler.cpp.

int TransferHandler::remainingTime (  )  const

Definition at line 80 of file transferhandler.cpp.

bool TransferHandler::isResumable (  )  const

Definition at line 85 of file transferhandler.cpp.

TransferGroupHandler* TransferHandler::group (  )  const [inline]

Returns:
the transfer's group handler

Definition at line 101 of file transferhandler.h.

const KUrl& TransferHandler::source (  )  const [inline]

Returns:
the source url

Definition at line 106 of file transferhandler.h.

const KUrl& TransferHandler::dest (  )  const [inline]

Returns:
the dest url

Definition at line 111 of file transferhandler.h.

KIO::filesize_t TransferHandler::totalSize (  )  const

Returns:
the total size of the transfer in bytes

Definition at line 90 of file transferhandler.cpp.

KIO::filesize_t TransferHandler::processedSize (  )  const

Returns:
the downloaded size of the transfer in bytes

Definition at line 95 of file transferhandler.cpp.

int TransferHandler::percent (  )  const

Returns:
the progress percentage of the transfer

Definition at line 100 of file transferhandler.cpp.

int TransferHandler::speed (  )  const

Returns:
the download speed of the transfer in bytes/sec

Definition at line 105 of file transferhandler.cpp.

QString TransferHandler::statusText (  )  const [inline]

Returns:
a string describing the current transfer status

Definition at line 136 of file transferhandler.h.

QPixmap TransferHandler::statusPixmap (  )  const [inline]

Returns:
a pixmap associated with the current transfer status

Definition at line 141 of file transferhandler.h.

QVariant TransferHandler::data ( int  column  ) 

Returns:
the data associated to this Transfer item.

This is necessary to make the interview model/view work

Definition at line 110 of file transferhandler.cpp.

int TransferHandler::columnCount (  )  const [inline]

Returns:
the number of columns associated to the transfer's data

Definition at line 152 of file transferhandler.h.

KMenu * TransferHandler::popupMenu ( QList< TransferHandler * >  transfers  ) 

Returns a KMenu for the given list of transfers, populated with the actions that can be executed on each transfer in the list.

If the list is null, it returns the KMenu associated with the this transfer.

Parameters:
transfers the transfer list
Returns:
a KMenu for the given transfers

Definition at line 143 of file transferhandler.cpp.

void TransferHandler::setSelected ( bool  select  ) 

Selects the current transfer.

Selecting transfers means that all the actions executed from the gui will apply also to the current transfer.

Parameters:
select if true the current transfer is selected if false the current transfer is deselected

Definition at line 148 of file transferhandler.cpp.

bool TransferHandler::isSelected (  )  const

Returns:
true if the current transfer is selected

Returns:
false otherwise

Definition at line 157 of file transferhandler.cpp.

Transfer::ChangesFlags TransferHandler::changesFlags ( TransferObserver *  observer  )  const

Returns the changes flags.

Parameters:
observer The observer that makes this request

Definition at line 162 of file transferhandler.cpp.

void TransferHandler::resetChangesFlags ( TransferObserver *  observer  ) 

Resets the changes flags for a given TransferObserver.

Parameters:
observer The observer that makes this request

Definition at line 174 of file transferhandler.cpp.


Friends And Related Function Documentation

friend class KGet [friend]

Definition at line 59 of file transferhandler.h.

friend class TransferTreeModel [friend]

Definition at line 60 of file transferhandler.h.

friend class Transfer [friend]

Definition at line 61 of file transferhandler.h.

friend class TransferFactory [friend]

Definition at line 62 of file transferhandler.h.

friend class TransferGroupHandler [friend]

Definition at line 63 of file transferhandler.h.


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

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

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