# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# Observer Class Reference

Observer for KIO::Job progress information. Observer for KIO::Job progress information. More...

`#include <observer.h>`

Inheritance diagram for Observer:

[legend]
Collaboration diagram for Observer:

[legend]
List of all members.

## Public Slots

void | slotTotalSize (KIO::Job *, KIO::filesize_t size)
void | slotTotalFiles (KIO::Job *, unsigned long files)
void | slotTotalDirs (KIO::Job *, unsigned long dirs)
void | slotProcessedSize (KIO::Job *, KIO::filesize_t size)
void | slotProcessedFiles (KIO::Job *, unsigned long files)
void | slotProcessedDirs (KIO::Job *, unsigned long dirs)
void | slotSpeed (KIO::Job *, unsigned long bytes_per_second)
void | slotPercent (KIO::Job *, unsigned long percent)
void | slotInfoMessage (KIO::Job *, const QString &msg)
void | slotCopying (KIO::Job *, const KURL &from, const KURL &to)
void | slotMoving (KIO::Job *, const KURL &from, const KURL &to)
void | slotDeleting (KIO::Job *, const KURL &url)
void | slotTransferring (KIO::Job *, const KURL &url)
void | slotCreatingDir (KIO::Job *, const KURL &dir)
void | slotCanResume (KIO::Job *, KIO::filesize_t offset)

## DCOP Member Functions

void | killJob (int progressId)
KIO::MetaData | metadata (int progressId)

## Public Member Functions

int | newJob (KIO::Job *job, bool showProgress)
void | jobFinished (int progressId)
bool | openPassDlg (const QString &prompt, QString &user, QString &pass, bool readOnly)
bool | openPassDlg (KIO::AuthInfo &info)
KIO::RenameDlg_Result | open_RenameDlg (KIO::Job *job, const QString &caption, const QString &src, const QString &dest, KIO::RenameDlg_Mode mode, QString &newDest, KIO::filesize_t sizeSrc=(KIO::filesize_t)-1, KIO::filesize_t sizeDest=(KIO::filesize_t)-1, time_t ctimeSrc=(time_t)-1, time_t ctimeDest=(time_t)-1, time_t mtimeSrc=(time_t)-1, time_t mtimeDest=(time_t)-1)
KIO::SkipDlg_Result | open_SkipDlg (KIO::Job *job, bool multi, const QString &error_text)
void | stating (KIO::Job *, const KURL &url)
void | mounting (KIO::Job *, const QString &dev, const QString &point)
void | unmounting (KIO::Job *, const QString &point)

## Static Public Member Functions

static Observer * | self ()
static int | messageBox (int progressId, int type, const QString &text, const QString &caption, const QString &buttonYes, const QString &buttonNo)
static int | messageBox (int progressId, int type, const QString &text, const QString &caption, const QString &buttonYes, const QString &buttonNo, const QString &dontAskAgainName)

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)

## Protected Attributes

UIServer_stub * | m_uiserver
QIntDict< KIO::Job > | m_dctJobs

## Static Protected Attributes

static Observer * | s_pObserver = 0L

## Detailed Description

Observer for KIO::Job progress information. Observer for KIO::Job progress information.

This class, of which there is always only one instance, "observes" what jobs do and forwards this information to the progress-info server.

It is a DCOP object so that the UI server can call the kill method when the user presses Cancel.

Usually jobs are automatically registered by the KIO::Scheduler, so you do not have to care about that.

Author:
  David Faure <faure@kde.org>

Definition at line 55 of file observer.h.

## Member Function Documentation

static Observer* Observer::self | ( |  | ) | `[inline, static]`

Returns the unique observer object.

Returns:
  the observer object

Definition at line 66 of file observer.h.

Referenced by KIO::mimetype(), KIO::mount(), KIO::SlaveInterface::openPassDlg(), KIO::stat(), KIO::TransferJob::TransferJob(), and KIO::unmount().

int Observer::newJob | ( | KIO::Job * | job,
|  | bool | showProgress
| ) |

Called by the job constructor, to signal its presence to the UI Server.

Parameters:

  | job | the new job
  | showProgress | true to show progress, false otherwise

Returns:
  the progress ID assigned by the UI Server to the Job.

Definition at line 81 of file observer.cpp.

References QIntDict::insert().

void Observer::jobFinished | ( | int | progressId | ) |

Called by the job destructor, to tell the UI Server that the job ended.

Parameters:

  | progressId | the progress ID of the job, as returned by newJob()

Definition at line 93 of file observer.cpp.

References QIntDict::remove().

bool Observer::openPassDlg | ( | const QString & | prompt,
|  | QString & | user,
|  | QString & | pass,
|  | bool | readOnly
| ) |

Deprecated:
  use KIO::AutoInfo

Definition at line 227 of file observer.cpp.

References KIO::AuthInfo::password, KIO::AuthInfo::prompt, KIO::AuthInfo::readOnly, and KIO::AuthInfo::username.

Referenced by KIO::SlaveInterface::openPassDlg().

bool Observer::openPassDlg | ( | KIO::AuthInfo & | info | ) |

Opens a password dialog.

Parameters:

  | info | the authentication information

Returns:
  true if successful ("ok" clicked), false otherwise

Definition at line 244 of file observer.cpp.

References endl(), KIO::PasswordDialog::getNameAndPassword(), and kdDebug().

int Observer::messageBox | ( | int | progressId,
|  | int | type,
|  | const QString & | text,
|  | const QString & | caption,
|  | const QString & | buttonYes,
|  | const QString & | buttonNo
| ) | `[static]`

Popup a message box.

See KIO::SlaveBase. This doesn't use DCOP anymore, it shows the dialog in the application's process. Otherwise, other apps would block when trying to communicate with UIServer.

Parameters:

  | progressId | the progress ID of the job, as returned by newJob()
  | type | the type of the message box
  | text | the text to show
  | caption | the window caption
  | buttonYes | the text of the "Yes" button
  | buttonNo | the text of the "No button

Definition at line 260 of file observer.cpp.

int Observer::messageBox | ( | int | progressId,
|  | int | type,
|  | const QString & | text,
|  | const QString & | caption,
|  | const QString & | buttonYes,
|  | const QString & | buttonNo,
|  | const QString & | dontAskAgainName
| ) | `[static]`

Popup a message box.

See KIO::SlaveBase. This doesn't use DCOP anymore, it shows the dialog in the application's process. Otherwise, other apps would block when trying to communicate with UIServer.

Parameters:

  | progressId | the progress ID of the job, as returned by newJob()
  | type | the type of the message box
  | text | the text to show
  | caption | the window caption
  | buttonYes | the text of the "Yes" button
  | buttonNo | the text of the "No button
  | dontAskAgainName | A checkbox is added with which further confirmation can be turned off. The string is used to lookup and store the setting in kioslaverc.

Since:
  3.3

Definition at line 267 of file observer.cpp.

References QPtrList::append(), KSSLCertificate::chain(), QPtrList::count(), endl(), QDialog::exec(), KSSLCertificate::fromString(), KMessageBox::information(), kdDebug(), kdWarning(), KMessageBox::questionYesNo(), QPtrList::setAutoDelete(), KSSLCertChain::setChain(), KMessageBox::setDontShowAskAgainConfig(), KSSLInfoDlg::setup(), QStringList::split(), KMessageBox::warningContinueCancel(), KMessageBox::warningYesNo(), and KMessageBox::warningYesNoCancel().

void Observer::killJob | ( | int | progressId | ) |

Called by the UI Server (using DCOP) if the user presses cancel.

Parameters:

  | progressId | the progress ID of the job, as returned by newJob()

Definition at line 99 of file observer.cpp.

MetaData Observer::metadata | ( | int | progressId | ) |

Called by the UI Server (using DCOP) to get all the metadata of the job.

Parameters:

  | progressId | the progress IDof the job, as returned by newJob()

Definition at line 110 of file observer.cpp.

void Observer::slotTransferring | ( | KIO::Job * | ,
|  | const KURL & | url
| ) | `[slot]`

Since:
  3.1

Definition at line 194 of file observer.cpp.

Referenced by KIO::TransferJob::TransferJob().

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

- observer.h
- observer.cpp

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:25:04 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003