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

KDE3Support

Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
K3FileView Class Referenceabstract

#include <k3fileview.h>

Public Types

enum  DropOptions { AutoOpenDirs = 1 }
 
enum  ViewMode { Files = 1, Directories = 2, All = Files | Directories }
 

Public Member Functions

 K3FileView ()
 
virtual ~K3FileView ()
 
virtual KActionCollection * actionCollection () const
 
void addItemList (const KFileItemList &list)
 
virtual void clear ()
 
virtual void clearSelection ()=0
 
virtual void clearView ()=0
 
uint count () const
 
virtual KFileItem currentFileItem () const =0
 
int dropOptions ()
 
virtual void ensureItemVisible (const KFileItem &i)=0
 
virtual KFileItem firstFileItem () const =0
 
virtual void insertItem (const KFileItem &i)
 
virtual void invertSelection ()
 
bool isReversed () const
 
virtual bool isSelected (const KFileItem &) const =0
 
KFileItemList items () const
 
virtual void listingCompleted ()
 
virtual KFileItem nextItem (const KFileItem &) const =0
 
uint numDirs () const
 
uint numFiles () const
 
bool onlyDoubleClickSelectsFiles () const
 
virtual KFileItem prevItem (const KFileItem &) const =0
 
virtual void readConfig (KConfigGroup *)
 
virtual void removeItem (const KFileItem &item)
 
virtual void selectAll ()
 
KFileItemList selectedItems () const
 
virtual KFile::SelectionMode selectionMode () const
 
void setCurrentItem (const QString &filename)
 
virtual void setCurrentItem (const KFileItem &item)=0
 
virtual void setDropOptions (int options)
 
void setOnlyDoubleClickSelectsFiles (bool enable)
 
virtual void setParentView (K3FileView *parent)
 
virtual void setSelected (const KFileItem &, bool enable)=0
 
virtual void setSelectionMode (KFile::SelectionMode sm)
 
virtual void setSorting (QDir::SortFlags sort)
 
virtual void setViewMode (ViewMode vm)
 
void setViewName (const QString &name)
 
K3FileViewSignaler * signaler () const
 
QDir::SortFlags sorting () const
 
void sortReversed ()
 
bool updateNumbers (const KFileItem &i)
 
virtual void updateView (bool f=true)
 
virtual void updateView (const KFileItem &)
 
virtual ViewMode viewMode () const
 
QString viewName () const
 
virtual QWidget * widget ()=0
 
QWidget * widget () const
 
virtual void writeConfig (KConfigGroup *)
 

Static Public Member Functions

static int autoOpenDelay ()
 
static QString sortingKey (const QString &value, bool isDir, QDir::SortFlags SortFlags)
 
static QString sortingKey (KIO::filesize_t value, bool isDir, QDir::SortFlags SortFlags)
 

Protected Attributes

K3FileViewSignaler * sig
 

Detailed Description

This class defines an interface to all file views.

Its intent is to allow to switch the view of the files in the selector very easily. It defines some pure virtual functions, that must be implemented to make a file view working.

Since this class is not a widget, but it's meant to be added to other widgets, its most important function is widget. This should return a pointer to the implemented widget.

A base class for views of the KDE file selector

Author
Stephan Kulow coolo.nosp@m.@kde.nosp@m..org

Definition at line 89 of file k3fileview.h.

Member Enumeration Documentation

enum K3FileView::DropOptions

Various options for drag and drop support.

These values can be or'd together.

  • AutoOpenDirs Automatically open directory after hovering above it for a short while while dragging.
Enumerator
AutoOpenDirs 

Definition at line 348 of file k3fileview.h.

enum K3FileView::ViewMode
Enumerator
Files 
Directories 
All 

Definition at line 215 of file k3fileview.h.

Constructor & Destructor Documentation

K3FileView::K3FileView ( )

Creates a new file view.

Definition at line 110 of file k3fileview.cpp.

K3FileView::~K3FileView ( )
virtual

Destroys the file view.

Definition at line 128 of file k3fileview.cpp.

Member Function Documentation

KActionCollection * K3FileView::actionCollection ( ) const
virtual
Returns
the view-specific action-collection. Every view should add its actions here (if it has any) to make them available to e.g. the KDirOperator's popup-menu.

Definition at line 443 of file k3fileview.cpp.

void K3FileView::addItemList ( const KFileItemList &  list)

Inserts a list of items.

Definition at line 172 of file k3fileview.cpp.

int K3FileView::autoOpenDelay ( )
static

delay before auto opening a directory

Definition at line 492 of file k3fileview.cpp.

void K3FileView::clear ( )
virtual

Clears the view and all item lists.

Definition at line 203 of file k3fileview.cpp.

virtual void K3FileView::clearSelection ( )
pure virtual

Clears any selection, unhighlights everything.

Must be implemented by the view.

virtual void K3FileView::clearView ( )
pure virtual

pure virtual function, that should be implemented to clear the view.

At this moment the list is already empty

uint K3FileView::count ( ) const
Returns
the number of dirs and files

Definition at line 222 of file k3fileview.cpp.

virtual KFileItem K3FileView::currentFileItem ( ) const
pure virtual
Returns
the "current" KFileItem, e.g. where the cursor is. Returns an null file item when there is no current item (e.g. in an empty view). Subclasses have to implement this.
int K3FileView::dropOptions ( )

Returns the DND options in effect.

See DropOptions for details.

Definition at line 487 of file k3fileview.cpp.

virtual void K3FileView::ensureItemVisible ( const KFileItem &  i)
pure virtual

pure virtual function, that should be implemented to make item i visible, i.e.

by scrolling the view appropriately.

virtual KFileItem K3FileView::firstFileItem ( ) const
pure virtual
void K3FileView::insertItem ( const KFileItem &  i)
virtual

The derived view must implement this function to add the file in the widget.

Make sure to call this implementation, i.e. K3FileView::insertItem( i );

Definition at line 184 of file k3fileview.cpp.

void K3FileView::invertSelection ( )
virtual

Inverts the current selection, i.e.

selects all items, that were up to now not selected and deselects the other.

Definition at line 390 of file k3fileview.cpp.

bool K3FileView::isReversed ( ) const

Tells whether the current items are in reversed order (shortcut to sorting() & QDir::Reversed).

Definition at line 210 of file k3fileview.cpp.

virtual bool K3FileView::isSelected ( const KFileItem &  ) const
pure virtual
Returns
whether the given item is currently selected. Must be implemented by the view.
KFileItemList K3FileView::items ( ) const
Returns
all items currently available in the current sort-order

Definition at line 349 of file k3fileview.cpp.

void K3FileView::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.

Definition at line 438 of file k3fileview.cpp.

virtual KFileItem K3FileView::nextItem ( const KFileItem &  ) const
pure virtual
uint K3FileView::numDirs ( ) const
Returns
the number of directories

Definition at line 232 of file k3fileview.cpp.

uint K3FileView::numFiles ( ) const
Returns
the number of files.

Definition at line 227 of file k3fileview.cpp.

bool K3FileView::onlyDoubleClickSelectsFiles ( ) const
Returns
whether files (not directories) should only be select()ed by double-clicks.
See also
setOnlyDoubleClickSelectsFiles

Definition at line 363 of file k3fileview.cpp.

virtual KFileItem K3FileView::prevItem ( const KFileItem &  ) const
pure virtual
void K3FileView::readConfig ( KConfigGroup *  )
virtual

Definition at line 457 of file k3fileview.cpp.

void K3FileView::removeItem ( const KFileItem &  item)
virtual

Removes an item from the list; has to be implemented by the view.

Call K3FileView::removeItem( item ) after removing it.

Definition at line 427 of file k3fileview.cpp.

void K3FileView::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.

Definition at line 380 of file k3fileview.cpp.

KFileItemList K3FileView::selectedItems ( ) const
Returns
all currently highlighted items.

Definition at line 368 of file k3fileview.cpp.

KFile::SelectionMode K3FileView::selectionMode ( ) const
virtual

Definition at line 402 of file k3fileview.cpp.

void K3FileView::setCurrentItem ( const QString &  filename)

Sets filename the current item in the view, if available.

Definition at line 334 of file k3fileview.cpp.

virtual void K3FileView::setCurrentItem ( const KFileItem &  item)
pure virtual

Reimplement this to set item the current item in the view, e.g.

the item having focus.

void K3FileView::setDropOptions ( int  options)
virtual

Specify DND options.

See DropOptions for details. All options are disabled by default.

Definition at line 482 of file k3fileview.cpp.

void K3FileView::setOnlyDoubleClickSelectsFiles ( bool  enable)

This is a KFileDialog specific hack: we want to select directories with single click, but not files.

But as a generic class, we have to be able to select files on single click as well.

This gives us the opportunity to do both.

Every view has to decide when to call select( item ) when a file was single-clicked, based on onlyDoubleClickSelectsFiles().

Definition at line 359 of file k3fileview.cpp.

void K3FileView::setParentView ( K3FileView *  parent)
virtual

Definition at line 134 of file k3fileview.cpp.

virtual void K3FileView::setSelected ( const KFileItem &  ,
bool  enable 
)
pure virtual

Tells the view that it should highlight the item.

This function must be implemented by the view.

void K3FileView::setSelectionMode ( KFile::SelectionMode  sm)
virtual

Definition at line 397 of file k3fileview.cpp.

void K3FileView::setSorting ( QDir::SortFlags  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

Definition at line 198 of file k3fileview.cpp.

void K3FileView::setViewMode ( K3FileView::ViewMode  vm)
virtual

Definition at line 407 of file k3fileview.cpp.

void K3FileView::setViewName ( const QString &  name)

Sets the name of the view, which could be displayed somewhere.

E.g. "Image Preview".

Definition at line 422 of file k3fileview.cpp.

K3FileViewSignaler * K3FileView::signaler ( ) const

Definition at line 452 of file k3fileview.cpp.

QDir::SortFlags K3FileView::sorting ( ) const

Returns the sorting order of the internal list.

Newly added files are added through this sorting.

Definition at line 193 of file k3fileview.cpp.

QString K3FileView::sortingKey ( const QString &  value,
bool  isDir,
QDir::SortFlags  SortFlags 
)
static

This method calculates a QString from the given parameters, that is suitable for sorting with e.g.

QIconView or QListView. Their Item-classes usually have a setKey( const QString& ) method or a virtual method QString key() that is used for sorting.

Parameters
valueAny string that should be used as sort criterion
isDirTells whether the key is computed for an item representing a directory (directories are usually sorted before files)
SortFlagsAn ORed combination of QDir::SortFlag flags. Currently, the values IgnoreCase, Reversed and DirsFirst are taken into account.

Definition at line 465 of file k3fileview.cpp.

QString K3FileView::sortingKey ( KIO::filesize_t  value,
bool  isDir,
QDir::SortFlags  SortFlags 
)
static

An overloaded method that takes not a QString, but a number as sort criterion.

You can use this for file-sizes or dates/times for example. If you use a time_t, you need to cast that to KIO::filesize_t because of ambiguity problems.

Definition at line 474 of file k3fileview.cpp.

void K3FileView::sortReversed ( )

Definition at line 215 of file k3fileview.cpp.

bool K3FileView::updateNumbers ( const KFileItem &  i)

increases the number of dirs and files.

Returns
true if the item fits the view mode

Definition at line 154 of file k3fileview.cpp.

void K3FileView::updateView ( bool  f = true)
virtual

does a repaint of the view.

The default implementation calls

widget()->repaint(f)

Definition at line 325 of file k3fileview.cpp.

void K3FileView::updateView ( const KFileItem &  )
virtual

Definition at line 330 of file k3fileview.cpp.

K3FileView::ViewMode K3FileView::viewMode ( ) const
virtual

Definition at line 412 of file k3fileview.cpp.

QString K3FileView::viewName ( ) const
Returns
the localized name of the view, which could be displayed somewhere, e.g. in a menu, where the user can choose between views.
See also
setViewName

Definition at line 417 of file k3fileview.cpp.

virtual QWidget* K3FileView::widget ( )
pure 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.

QWidget * K3FileView::widget ( ) const

Returns the widget.

Definition at line 188 of file k3fileview.cpp.

void K3FileView::writeConfig ( KConfigGroup *  )
virtual

Definition at line 461 of file k3fileview.cpp.

Member Data Documentation

K3FileViewSignaler* K3FileView::sig
protected

class to distribute the signals

Definition at line 397 of file k3fileview.h.


The documentation for this class was generated from the following files:
  • k3fileview.h
  • k3fileview.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

Skip menu "KDE3Support"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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