# kio Library API Documentation

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

# KFilePreview Class Reference

`#include <kfilepreview.h>`

Inheritance diagram for KFilePreview:

[legend]
Collaboration diagram for KFilePreview:

[legend]
List of all members.

## Signals

void | showPreview (const KURL &)
void | clearPreview ()

## Public Member Functions

| KFilePreview (QWidget *parent, const char *name)
| KFilePreview (KFileView *view, QWidget *parent, const char *name)
virtual QWidget * | widget ()
| a pure virtual function to get a QWidget, that can be added to other widgets.
virtual void | clearView ()
| pure virtual function, that should be implemented to clear the view.
void | setFileView (KFileView *view)
| Delets the current view and sets the view to the given `view`.
KFileView * | fileView () const
virtual void | updateView (bool)
| does a repaint of the view.
virtual void | updateView (const KFileItem *)
virtual void | removeItem (const KFileItem *)
| Removes an item from the list; has to be implemented by the view.
virtual void | listingCompleted ()
| This hook is called when all items of the currently listed directory are listed and inserted into the view, i.e.
virtual void | setSelectionMode (KFile::SelectionMode sm)
virtual void | setSelected (const KFileItem *, bool)
| Tells the view that it should highlight the item.
virtual bool | isSelected (const KFileItem *) const
virtual void | clearSelection ()
| Clears any selection, unhighlights everything.
virtual void | selectAll ()
| Selects all items.
virtual void | invertSelection ()
| Inverts the current selection, i.e.
virtual void | insertItem (KFileItem *)
| The derived view must implement this function to add the file in the widget.
virtual void | clear ()
| Clears the view and all item lists.
virtual void | setCurrentItem (const KFileItem *)
| Reimplement this to set `item` the current item in the view, e.g.
virtual KFileItem * | currentFileItem () const
virtual KFileItem * | firstFileItem () const
virtual KFileItem * | nextItem (const KFileItem *) const
virtual KFileItem * | prevItem (const KFileItem *) const
virtual void | setSorting (QDir::SortSpec sort)
| Sets the sorting order of the view.
virtual void | readConfig (KConfig *, const QString &group=QString::null)
virtual void | writeConfig (KConfig *, const QString &group=QString::null)
virtual KActionCollection * | actionCollection () const
| This overrides KFileView::actionCollection() by returning the actionCollection() of the KFileView (member left) it contains.
void | ensureItemVisible (const KFileItem *)
| pure virtual function, that should be implemented to make item i visible, i.e.
void | setPreviewWidget (const QWidget *w, const KURL &u)

## Protected Slots

virtual void | slotHighlighted (const KFileItem *)

## Protected Member Functions

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

## Detailed Description

This KFileView is an empbedded preview for some file types.

Definition at line 46 of file kfilepreview.h.

## Member Function Documentation

virtual QWidget* KFilePreview::widget | ( |  | ) | `[inline, virtual]`

| a pure virtual function to get a QWidget, that can be added to other widgets. This function is needed to make it possible for derived classes to derive from other widgets. Implements KFileView. Definition at line 55 of file kfilepreview.h.

void KFilePreview::clearView | ( |  | ) | `[virtual]`

| pure virtual function, that should be implemented to clear the view. At this moment the list is already empty Implements KFileView. Definition at line 139 of file kfilepreview.cpp. References KFileView::clearView().

void KFilePreview::setFileView | ( | KFileView * | view | ) |

| Delets the current view and sets the view to the given `view`. The view is reparented to have this as parent, if necessary. Definition at line 78 of file kfilepreview.cpp. References QWidget::reparent(), KFileView::setParentView(), KFileView::setSorting(), KFileView::signaler(), KFileView::sorting(), and KFileView::widget().

KFileView* KFilePreview::fileView | ( |  | ) | const`[inline]`

Returns:
  the current fileview

Definition at line 67 of file kfilepreview.h.

void KFilePreview::updateView | ( | bool |  | ) | `[virtual]`

does a repaint of the view.

The default implementation calls

    widget()->repaint(f)

Reimplemented from KFileView.

Definition at line 145 of file kfilepreview.cpp.

References QWidget::repaint(), and KFileView::updateView().

void KFilePreview::removeItem | ( | const KFileItem * |  | ) | `[virtual]`

| Removes an item from the list; has to be implemented by the view. Call KFileView::removeItem( item ) after removing it. Reimplemented from KFileView. Definition at line 157 of file kfilepreview.cpp. References KFileView::isSelected(), and KFileView::removeItem().

void KFilePreview::listingCompleted | ( |  | ) | `[virtual]`

| This hook is called when all items of the currently listed directory are listed and inserted into the view, i.e. there won't come any new items anymore. Reimplemented from KFileView. Definition at line 166 of file kfilepreview.cpp. References KFileView::listingCompleted().

void KFilePreview::setSelected | ( | const KFileItem * | ,
|  | bool |
| ) | `[virtual]`

| Tells the view that it should highlight the item. This function must be implemented by the view. Implements KFileView. Definition at line 202 of file kfilepreview.cpp. References KFileView::setSelected().

bool KFilePreview::isSelected | ( | const KFileItem * |  | ) | const`[virtual]`

Returns:
  whether the given item is currently selected. Must be implemented by the view.

Implements KFileView.

Definition at line 193 of file kfilepreview.cpp.

References KFileView::isSelected().

void KFilePreview::clearSelection | ( |  | ) | `[virtual]`

| Clears any selection, unhighlights everything. Must be implemented by the view. Implements KFileView. Definition at line 177 of file kfilepreview.cpp. References KFileView::clearSelection().

void KFilePreview::selectAll | ( |  | ) | `[virtual]`

| Selects all items. You may want to override this, if you can implement it more efficiently than calling setSelected() with every item. This works only in Multiselection mode of course. Reimplemented from KFileView. Definition at line 183 of file kfilepreview.cpp. References KFileView::selectAll().

void KFilePreview::invertSelection | ( |  | ) | `[virtual]`

| Inverts the current selection, i.e. selects all items, that were up to now not selected and deselects the other. Reimplemented from KFileView. Definition at line 188 of file kfilepreview.cpp. References KFileView::invertSelection().

void KFilePreview::insertItem | ( | KFileItem * |  | ) | `[virtual]`

| The derived view must implement this function to add the file in the widget. Make sure to call this implementation, i.e. KFileView::insertItem( i ); Reimplemented from KFileView. Definition at line 127 of file kfilepreview.cpp. References KFileView::insertItem().

void KFilePreview::clear | ( |  | ) | `[virtual]`

| Clears the view and all item lists. Reimplemented from KFileView. Definition at line 171 of file kfilepreview.cpp. References KFileView::clear().

void KFilePreview::setCurrentItem | ( | const KFileItem * |  | ) | `[virtual]`

| Reimplement this to set `item` the current item in the view, e.g. the item having focus. Implements KFileView. Definition at line 206 of file kfilepreview.cpp. References KFileView::setCurrentItem().

KFileItem * KFilePreview::currentFileItem | ( |  | ) | const`[virtual]`

Returns:
  the "current" KFileItem, e.g. where the cursor is. Returns 0L when there is no current item (e.g. in an empty view). Subclasses have to implement this.

Implements KFileView.

Definition at line 211 of file kfilepreview.cpp.

References KFileView::currentFileItem().

void KFilePreview::setSorting | ( | QDir::SortSpec | sort | ) | `[virtual]`

Sets the sorting order of the view.

Default is QDir::Name | QDir::IgnoreCase | QDir::DirsFirst Override this in your subclass and sort accordingly (usually by setting the sorting-key for every item and telling QIconView or QListView to sort.

A view may choose to use a different sorting than QDir::Name, Time or Size. E.g. to sort by mimetype or any possible string. Set the sorting to QDir::Unsorted for that and do the rest internally.

See also:
  sortingKey

Reimplemented from KFileView.

Definition at line 133 of file kfilepreview.cpp.

References KFileView::setSorting(), and KFileView::sorting().

KActionCollection * KFilePreview::actionCollection | ( |  | ) | const`[virtual]`

| This overrides KFileView::actionCollection() by returning the actionCollection() of the KFileView (member left) it contains. This means that KFilePreview will never create a KActionCollection object of its own. Reimplemented from KFileView. Definition at line 254 of file kfilepreview.cpp. References KFileView::actionCollection().

void KFilePreview::ensureItemVisible | ( | const KFileItem * |  | ) | `[virtual]`

| pure virtual function, that should be implemented to make item i visible, i.e. by scrolling the view appropriately. Implements KFileView. Definition at line 234 of file kfilepreview.cpp. References KFileView::ensureItemVisible().

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

- kfilepreview.h
- kfilepreview.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:18:17 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001