# kio Library API Documentation

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

# KIO::PreviewJob Class Reference

KIO Job to get a thumbnail picture. More...

`#include <previewjob.h>`

Inheritance diagram for KIO::PreviewJob:

[legend]
Collaboration diagram for KIO::PreviewJob:

[legend]
List of all members.

## Signals

void | gotPreview (const KFileItem *item, const QPixmap &preview)
void | failed (const KFileItem *item)

## Public Member Functions

| PreviewJob (const KFileItemList &items, int width, int height, int iconSize, int iconAlpha, bool scale, bool save, const QStringList *enabledPlugins, bool deleteItems=false)
void | removeItem (const KFileItem *item)
void | setIgnoreMaximumSize (bool ignoreSize=true)

## Static Public Member Functions

static QStringList | availablePlugins ()
static QStringList | supportedMimeTypes ()

## Protected Slots

virtual void | slotResult (KIO::Job *job)

## Protected Member Functions

void | getOrCreateThumbnail ()
bool | statResultThumbnail ()
void | createThumbnail (QString)
virtual void | virtual_hook (int id, void *data)

## Detailed Description

KIO Job to get a thumbnail picture.

This class catches a preview (thumbnail) for files.

Definition at line 37 of file previewjob.h.

## Constructor & Destructor Documentation

PreviewJob::PreviewJob | ( | const KFileItemList & | items,
|  | int | width,
|  | int | height,
|  | int | iconSize,
|  | int | iconAlpha,
|  | bool | scale,
|  | bool | save,
|  | const QStringList * | enabledPlugins,
|  | bool | deleteItems = `false`
| ) |

Creates a new PreviewJob.

Parameters:

  | items | a list of files to create previews for
  | width | the desired width
  | height | the desired height, 0 to use the `width`
  | iconSize | the size of the mimetype icon to overlay over the preview or zero to not overlay an icon. This has no effect if the preview plugin that will be used doesn't use icon overlays.
  | iconAlpha | transparency to use for the icon overlay
  | scale | if the image is to be scaled to the requested size or returned in its original size
  | save | if the image should be cached for later use
  | enabledPlugins | if non-zero, this points to a list containing the names of the plugins that may be used.
  | deleteItems | true to delete the items when done

Definition at line 117 of file previewjob.cpp.

References QDir::homeDirPath(), and QTimer::singleShot().

## Member Function Documentation

void PreviewJob::removeItem | ( | const KFileItem * | item | ) |

Removes an item from preview processing.

Use this if you passed an item to filePreview and want to delete it now.

Parameters:

  | item | the item that should be removed from the preview queue

Definition at line 218 of file previewjob.cpp.

References QPtrList::first(), QMap::remove(), and QPtrList::removeFirst().

void PreviewJob::setIgnoreMaximumSize | ( | bool | ignoreSize = `true` | ) |

If `ignoreSize` is true, then the preview is always generated regardless of the settings.

Since:
  KDE 3.4

Definition at line 235 of file previewjob.cpp.

QStringList PreviewJob::availablePlugins | ( |  | ) | `[static]`

Returns a list of all available preview plugins.

The list contains the basenames of the plugins' .desktop files (no path, no .desktop).

Returns:
  the list of plugins

Definition at line 504 of file previewjob.cpp.

References QValueList::begin(), QValueList::end(), KTrader::query(), and KTrader::self().

QStringList PreviewJob::supportedMimeTypes | ( |  | ) | `[static]`

Returns a list of all supported MIME types.

The list can contain entries like text/ * (without the space).

Returns:
  the list of mime types

Definition at line 514 of file previewjob.cpp.

References QValueList::begin(), QValueList::end(), KTrader::query(), and KTrader::self().

Referenced by KFileIconView::showPreviews().

void KIO::PreviewJob::gotPreview | ( | const KFileItem * | item,
|  | const QPixmap & | preview
| ) | `[signal]`

Emitted when a thumbnail picture for `item` has been successfully retrieved.

Parameters:

  | item | the file of the preview
  | preview | the preview image

void KIO::PreviewJob::failed | ( | const KFileItem * | item | ) | `[signal]`

Emitted when a thumbnail for `item` could not be created, either because a ThumbCreator for its MIME type does not exist, or because something went wrong.

Parameters:

  | item | the file that failed

void PreviewJob::slotResult | ( | KIO::Job * | job | ) | `[protected, virtual, slot]`

Called whenever a subjob finishes.

Default implementation checks for errors and propagates to parent job, then calls removeSubjob. Override if you don't want subjobs errors to be propagated.

Parameters:

  | job | the subjob

See also:
  result()

Reimplemented from KIO::Job.

Definition at line 270 of file previewjob.cpp.

References QValueList::begin(), QValueList::end(), QPtrList::isEmpty(), QFile::remove(), and QPtrList::remove().

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

- previewjob.h
- previewjob.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:26:39 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003