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

kget

Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Transfer Class Reference

#include <transfer.h>

Inheritance diagram for Transfer:
Inheritance graph
[legend]

Public Types

enum  Capability {
  Cap_SpeedLimit = 0x00000001, Cap_MultipleMirrors = 0x00000002, Cap_Resuming = 0x00000004, Cap_Renaming = 0x00000008,
  Cap_Moving = 0x00000010, Cap_FindFilesize = 0x00000020
}
 
typedef int ChangesFlags
 
enum  DeleteOption { DeleteTemporaryFiles = 0x00000001, DeleteFiles = 0x00000002 }
 
enum  LogLevel { Log_Info, Log_Warning, Log_Error }
 
enum  SpeedLimit { VisibleSpeedLimit = 0x01, InvisibleSpeedLimit = 0x02 }
 
enum  TransferChange {
  Tc_None = 0x00000000, Tc_Source = 0x00000001, Tc_FileName = 0x00000002, Tc_Status = 0x00000004,
  Tc_TotalSize = 0x00000008, Tc_Percent = 0x00000010, Tc_DownloadSpeed = 0x00000020, Tc_RemainingTime = 0x00000040,
  Tc_UploadSpeed = 0x00000100, Tc_UploadLimit = 0x00000200, Tc_DownloadLimit = 0x00000400, Tc_CanResume = 0x00000800,
  Tc_DownloadedSize = 0x00001000, Tc_UploadedSize = 0x00002000, Tc_Log = 0x00004000, Tc_Group = 0x00008000,
  Tc_Selection = 0x00010000
}
 
- Public Types inherited from Job
enum  ErrorType { AutomaticRetry, ManualSolve, NotSolveable }
 
enum  Policy { Start, Stop, None }
 
enum  Status {
  Running = 0, Stopped = 2, Aborted = 3, Finished = 4,
  FinishedKeepAlive = 5, Moving = 6
}
 

Public Slots

void setLog (const QString &message, Transfer::LogLevel level=Log_Info)
 

Signals

void capabilitiesChanged ()
 

Public Member Functions

 Transfer (TransferGroup *parent, TransferFactory *factory, Scheduler *scheduler, const KUrl &src, const KUrl &dest, const QDomElement *e=0)
 
virtual ~Transfer ()
 
virtual QHash< KUrl, QPair
< bool, int > > 
availableMirrors (const KUrl &file) const
 
int averageDownloadSpeed () const
 
Capabilities capabilities () const
 
void checkShareRatio ()
 
void create ()
 
virtual void deinit (DeleteOptions options)
 
const KUrl & dest () const
 
void destroy (DeleteOptions options)
 
virtual KUrl directory () const
 
KIO::filesize_t downloadedSize () const
 
int downloadLimit (SpeedLimit limit) const
 
int downloadSpeed () const
 
virtual int elapsedTime () const
 
TransferFactory * factory () const
 
virtual FileModel * fileModel ()
 
virtual QList< KUrl > files () const
 
TransferGroup * group () const
 
TransferHandler * handler ()
 
virtual void init ()
 
bool isSelected () const
 
virtual bool isStalled () const
 
virtual bool isWorking () const
 
virtual void load (const QDomElement *element)
 
const QStringList log () const
 
double maximumShareRatio ()
 
TransferTreeModel * model ()
 
bool operator< (const Transfer &t2) const
 
int percent () const
 
virtual int remainingTime () const
 
virtual bool repair (const KUrl &file=KUrl())
 
virtual void save (const QDomElement &element)
 
virtual void setAvailableMirrors (const KUrl &file, const QHash< KUrl, QPair< bool, int > > &mirrors)
 
virtual bool setDirectory (const KUrl &newDirectory)
 
void setDownloadLimit (int dlLimit, SpeedLimit limit)
 
void setMaximumShareRatio (double ratio)
 
void setUploadLimit (int ulLimit, SpeedLimit limit)
 
virtual Signature * signature (const KUrl &file)
 
const KUrl & source () const
 
QPixmap statusPixmap () const
 
QString statusText () const
 
KIO::filesize_t totalSize () const
 
KIO::filesize_t uploadedSize () const
 
int uploadLimit (SpeedLimit limit) const
 
int uploadSpeed () const
 
virtual Verifier * verifier (const KUrl &file)
 
- Public Member Functions inherited from Job
 Job (Scheduler *scheduler, JobQueue *parent)
 
virtual ~Job ()
 
Error error () const
 
JobQueue * jobQueue ()
 
Policy policy () const
 
virtual void resolveError (int errorId)
 
void setError (const QString &text, const QPixmap &pixmap, ErrorType type=AutomaticRetry, int errorId=-1)
 
void setPolicy (Policy jobPolicy)
 
void setStatus (Status jobStatus)
 
virtual void start ()=0
 
Status startStatus () const
 
Status status () const
 
virtual void stop ()=0
 

Static Public Member Functions

static QPixmap statusPixmap (Job::Status status)
 
static QString statusText (Job::Status status)
 

Protected Member Functions

void setCapabilities (Capabilities capabilities)
 
virtual void setSpeedLimits (int uploadLimit, int downloadLimit)
 
void setStatus (Job::Status jobStatus, const QString &text=QString(), const QPixmap &pix=QPixmap())
 
virtual void setTransferChange (ChangesFlags change, bool postEvent=false)
 
- Protected Member Functions inherited from Job
void postJobEvent (Status)
 
void read (QDomNode *n)
 
Scheduler * scheduler () const
 
void setStartStatus (Status jobStatus)
 
void write (QDomNode *n)
 

Protected Attributes

KUrl m_dest
 
KIO::filesize_t m_downloadedSize
 
int m_downloadLimit
 
int m_downloadSpeed
 
bool m_isSelected
 
QStringList m_log
 
int m_percent
 
KUrl m_source
 
KIO::filesize_t m_totalSize
 
KIO::filesize_t m_uploadedSize
 
int m_uploadLimit
 
int m_uploadSpeed
 
- Protected Attributes inherited from Job
JobQueue * m_jobQueue
 
Scheduler * m_scheduler
 

Detailed Description

Definition at line 36 of file transfer.h.

Member Typedef Documentation

typedef int Transfer::ChangesFlags

Definition at line 100 of file transfer.h.

Member Enumeration Documentation

enum Transfer::Capability
Enumerator
Cap_SpeedLimit 
Cap_MultipleMirrors 
Cap_Resuming 
Cap_Renaming 
Cap_Moving 
Cap_FindFilesize 

Definition at line 70 of file transfer.h.

enum Transfer::DeleteOption
Enumerator
DeleteTemporaryFiles 
DeleteFiles 

Definition at line 94 of file transfer.h.

enum Transfer::LogLevel
Enumerator
Log_Info 
Log_Warning 
Log_Error 

Definition at line 81 of file transfer.h.

enum Transfer::SpeedLimit
Enumerator
VisibleSpeedLimit 
InvisibleSpeedLimit 

Definition at line 88 of file transfer.h.

enum Transfer::TransferChange

Here we define the flags that should be shared by all the transfers.

A transfer should also be able to define additional flags, in the future.

Enumerator
Tc_None 
Tc_Source 
Tc_FileName 
Tc_Status 
Tc_TotalSize 
Tc_Percent 
Tc_DownloadSpeed 
Tc_RemainingTime 
Tc_UploadSpeed 
Tc_UploadLimit 
Tc_DownloadLimit 
Tc_CanResume 
Tc_DownloadedSize 
Tc_UploadedSize 
Tc_Log 
Tc_Group 
Tc_Selection 

Definition at line 47 of file transfer.h.

Constructor & Destructor Documentation

Transfer::Transfer ( TransferGroup *  parent,
TransferFactory *  factory,
Scheduler *  scheduler,
const KUrl &  src,
const KUrl &  dest,
const QDomElement *  e = 0 
)

Definition at line 47 of file transfer.cpp.

Transfer::~Transfer ( )
virtual

Definition at line 64 of file transfer.cpp.

Member Function Documentation

QHash< KUrl, QPair< bool, int > > Transfer::availableMirrors ( const KUrl &  file) const
virtual

The mirrors that are available bool if it is used, int how many paralell connections are allowed to the mirror.

Parameters
filethe file for which the availableMirrors should be get

Reimplemented in Metalink, TransferMultiSegKio, and AbstractMetalink.

Definition at line 135 of file transfer.cpp.

int Transfer::averageDownloadSpeed ( ) const

Definition at line 124 of file transfer.cpp.

Capabilities Transfer::capabilities ( ) const
inline

Returns the capabilities this Transfer supports.

Definition at line 111 of file transfer.h.

void Transfer::capabilitiesChanged ( )
signal

Emitted when the capabilities of the Transfer change.

void Transfer::checkShareRatio ( )

Recalculate the share ratio.

Definition at line 190 of file transfer.cpp.

void Transfer::create ( )

This functions gets called whenever a Transfer gets created.

As opposed to init(), this isn't a virtual function and is not meant to be used in transfer plugins

Definition at line 76 of file transfer.cpp.

virtual void Transfer::deinit ( DeleteOptions  options)
inlinevirtual

This function is called before the deletion of a Transfer In transfer plugins you can put here whatever needs to be deinitialized.

Definition at line 138 of file transfer.h.

const KUrl& Transfer::dest ( ) const
inline

Definition at line 149 of file transfer.h.

void Transfer::destroy ( DeleteOptions  options)

This functions gets called whenever a Transfer is going to be deleted.

As opposed to deinit(), this isn't a virtual function and is not meant to be used in transfer plugins

Definition at line 86 of file transfer.cpp.

virtual KUrl Transfer::directory ( ) const
inlinevirtual
Returns
the directory the Transfer will be stored to

Reimplemented in BTTransfer.

Definition at line 159 of file transfer.h.

KIO::filesize_t Transfer::downloadedSize ( ) const
inline

Definition at line 170 of file transfer.h.

int Transfer::downloadLimit ( SpeedLimit  limit) const
Returns
the DownloadLimit, which is invisible in the GUI

Definition at line 176 of file transfer.cpp.

int Transfer::downloadSpeed ( ) const
inline

Definition at line 179 of file transfer.h.

int Transfer::elapsedTime ( ) const
virtual

Implements Job.

Reimplemented in BTTransfer.

Definition at line 116 of file transfer.cpp.

TransferFactory* Transfer::factory ( ) const
inline
Returns
a pointer to the TransferFactory object

Definition at line 272 of file transfer.h.

virtual FileModel* Transfer::fileModel ( )
inlinevirtual
Returns
a pointer to the FileModel containing all files of this download

Reimplemented in BTTransfer, Metalink, TransferMultiSegKio, and AbstractMetalink.

Definition at line 277 of file transfer.h.

virtual QList<KUrl> Transfer::files ( ) const
inlinevirtual
Returns
all files of this transfer

Reimplemented in BTTransfer, Metalink, and AbstractMetalink.

Definition at line 154 of file transfer.h.

TransferGroup* Transfer::group ( ) const
inline

The owner group.

Definition at line 257 of file transfer.h.

TransferHandler * Transfer::handler ( )
Returns
the associated TransferHandler

Definition at line 217 of file transfer.cpp.

void Transfer::init ( )
virtual

This function is called after the creation of a Transfer In transfer plugins you can put here whatever needs to be initialized.

Note
this function creates a NepomukHandler

Reimplemented in TransferMultiSegKio.

Definition at line 95 of file transfer.cpp.

bool Transfer::isSelected ( ) const
inline

Definition at line 242 of file transfer.h.

virtual bool Transfer::isStalled ( ) const
inlinevirtual

Implements Job.

Reimplemented in BTTransfer.

Definition at line 184 of file transfer.h.

virtual bool Transfer::isWorking ( ) const
inlinevirtual

Implements Job.

Reimplemented in BTTransfer.

Definition at line 185 of file transfer.h.

void Transfer::load ( const QDomElement *  element)
virtual

Loads the transfer's info from the QDomElement.

Parameters
elementThe pointer to the QDomNode where info will be loaded from

Reimplemented in BTTransfer, MetalinkXml, and Metalink.

Definition at line 244 of file transfer.cpp.

const QStringList Transfer::log ( ) const

Transfer history.

double Transfer::maximumShareRatio ( )
inline
Returns
the maximum share-ratio

Definition at line 235 of file transfer.h.

TransferTreeModel * Transfer::model ( )
Returns
the TransferTreeModel that owns this group

Definition at line 225 of file transfer.cpp.

bool Transfer::operator< ( const Transfer &  t2) const

Defines the order between transfers.

int Transfer::percent ( ) const
inline

Definition at line 178 of file transfer.h.

virtual int Transfer::remainingTime ( ) const
inlinevirtual

Implements Job.

Reimplemented in BTTransfer, Metalink, and AbstractMetalink.

Definition at line 182 of file transfer.h.

virtual bool Transfer::repair ( const KUrl &  file = KUrl())
inlinevirtual

Tries to repair file.

Parameters
filethe file of a download that should be repaired, if not defined all files of a download are going to be repaird
Returns
true if a repair started, false if it was not nescessary

Reimplemented in TransferKio, Metalink, TransferMultiSegKio, and AbstractMetalink.

Definition at line 146 of file transfer.h.

void Transfer::save ( const QDomElement &  element)
virtual

Saves this transfer to the given QDomNode.

Parameters
elementThe pointer to the QDomNode where the transfer will be saved

Reimplemented in MetalinkXml, and Metalink.

Definition at line 230 of file transfer.cpp.

virtual void Transfer::setAvailableMirrors ( const KUrl &  file,
const QHash< KUrl, QPair< bool, int > > &  mirrors 
)
inlinevirtual

Set the mirrors, int the number of paralell connections to the mirror bool if the mirror should be used.

Parameters
filethe file for which the availableMirrors should be set

Reimplemented in Metalink, TransferMultiSegKio, and AbstractMetalink.

Definition at line 200 of file transfer.h.

void Transfer::setCapabilities ( Capabilities  capabilities)
protected

Sets the capabilities and automatically emits capabilitiesChanged.

Definition at line 68 of file transfer.cpp.

bool Transfer::setDirectory ( const KUrl &  newDirectory)
virtual

Move the download to the new destination.

Parameters
newDirectoryis a directory where the download should be stored
Returns
true if newDestination can be used

Reimplemented in BTTransfer, Metalink, TransferMultiSegKio, TransferKio, and AbstractMetalink.

Definition at line 108 of file transfer.cpp.

void Transfer::setDownloadLimit ( int  dlLimit,
SpeedLimit  limit 
)

Set the Transfer's UploadLimit, which are displayed in the GUI.

Note
this is not displayed in any GUI, use setVisibleDownloadLimit(int) instead
Parameters
visibleUlLimitupload Limit

Definition at line 156 of file transfer.cpp.

void Transfer::setLog ( const QString &  message,
Transfer::LogLevel  level = Log_Info 
)
slot

Set Transfer history.

Definition at line 201 of file transfer.cpp.

void Transfer::setMaximumShareRatio ( double  ratio)

Set the maximum share-ratio.

Parameters
ratiothe new maximum share-ratio

Definition at line 184 of file transfer.cpp.

virtual void Transfer::setSpeedLimits ( int  uploadLimit,
int  downloadLimit 
)
inlineprotectedvirtual

Function used to set the SpeedLimits to the transfer.

Reimplemented in BTTransfer.

Definition at line 353 of file transfer.h.

void Transfer::setStatus ( Job::Status  jobStatus,
const QString &  text = QString(),
const QPixmap &  pix = QPixmap() 
)
protected

Sets the Job status to jobStatus, the status text to text and the status pixmap to pix.

It's important to call job::setStatus AFTER having changed the icon or the text or whatever. This because this function also notifies about this change the scheduler which could also decide to change it another time as well. For example if a job status is set to Aborted, the scheduler could mark it to Delayed. This could trigger another icon or text change which would be the right one since the status of the Job has changed. If we set the icon or text after calling setStatus(), we can overwrite the last icon or text change.

Definition at line 292 of file transfer.cpp.

void Transfer::setTransferChange ( ChangesFlags  change,
bool  postEvent = false 
)
protectedvirtual

Makes the TransferHandler associated with this transfer know that a change in this transfer has occurred.

Parameters
changethe TransferChange flags to be set

Definition at line 338 of file transfer.cpp.

void Transfer::setUploadLimit ( int  ulLimit,
SpeedLimit  limit 
)

Set the Transfer's UploadLimit.

Note
this is not displayed in any GUI, use setVisibleUploadLimit(int) instead
Parameters
visibleUlLimitupload Limit

Definition at line 144 of file transfer.cpp.

virtual Signature* Transfer::signature ( const KUrl &  file)
inlinevirtual
Parameters
filefor which to get the signature
Returns
Signature that allows you to add signatures and verify them

Reimplemented in Metalink, TransferMultiSegKio, AbstractMetalink, and TransferKio.

Definition at line 289 of file transfer.h.

const KUrl& Transfer::source ( ) const
inline

Definition at line 148 of file transfer.h.

QPixmap Transfer::statusPixmap ( ) const
inline

Definition at line 173 of file transfer.h.

QPixmap Transfer::statusPixmap ( Job::Status  status)
static

Definition at line 351 of file transfer.cpp.

QString Transfer::statusText ( ) const
inline

Definition at line 172 of file transfer.h.

QString Transfer::statusText ( Job::Status  status)
static

Definition at line 346 of file transfer.cpp.

KIO::filesize_t Transfer::totalSize ( ) const
inline

Definition at line 169 of file transfer.h.

KIO::filesize_t Transfer::uploadedSize ( ) const
inline

Definition at line 171 of file transfer.h.

int Transfer::uploadLimit ( SpeedLimit  limit) const
Returns
the UploadLimit, which is invisible in the GUI

Definition at line 168 of file transfer.cpp.

int Transfer::uploadSpeed ( ) const
inline

Definition at line 181 of file transfer.h.

virtual Verifier* Transfer::verifier ( const KUrl &  file)
inlinevirtual
Parameters
filefor which to get the verifier
Returns
Verifier that allows you to add checksums manually verify a file etc.

Reimplemented in Metalink, TransferMultiSegKio, AbstractMetalink, and TransferKio.

Definition at line 283 of file transfer.h.

Member Data Documentation

KUrl Transfer::m_dest
protected

Definition at line 357 of file transfer.h.

KIO::filesize_t Transfer::m_downloadedSize
protected

Definition at line 361 of file transfer.h.

int Transfer::m_downloadLimit
protected

Definition at line 368 of file transfer.h.

int Transfer::m_downloadSpeed
protected

Definition at line 364 of file transfer.h.

bool Transfer::m_isSelected
protected

Definition at line 370 of file transfer.h.

QStringList Transfer::m_log
protected

Definition at line 359 of file transfer.h.

int Transfer::m_percent
protected

Definition at line 363 of file transfer.h.

KUrl Transfer::m_source
protected

Definition at line 356 of file transfer.h.

KIO::filesize_t Transfer::m_totalSize
protected

Definition at line 360 of file transfer.h.

KIO::filesize_t Transfer::m_uploadedSize
protected

Definition at line 362 of file transfer.h.

int Transfer::m_uploadLimit
protected

Definition at line 367 of file transfer.h.

int Transfer::m_uploadSpeed
protected

Definition at line 365 of file transfer.h.


The documentation for this class was generated from the following files:
  • transfer.h
  • transfer.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

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

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal