• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

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

#include <tdefileview.h>

Inheritance diagram for KFileView:
KCombiView KFileDetailView KFileIconView KFilePreview

Public Types

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

Public Member Functions

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

Static Public Member Functions

static TQString sortingKey (const TQString &value, bool isDir, int sortSpec)
 
static TQString sortingKey (TDEIO::filesize_t value, bool isDir, int sortSpec)
 
static int autoOpenDelay ()
 

Protected Types

enum  { VIRTUAL_SET_DROP_OPTIONS = 1 }
 

Protected Member Functions

virtual void virtual_hook (int id, void *data)
 
void setDropOptions_impl (int options)
 

Protected Attributes

KFileViewSignaler * 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 97 of file tdefileview.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Definition at line 436 of file tdefileview.h.

◆ DropOptions

enum KFileView::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.
    Since
    3.2

Definition at line 358 of file tdefileview.h.

◆ ViewMode

enum KFileView::ViewMode

Definition at line 220 of file tdefileview.h.

Constructor & Destructor Documentation

◆ KFileView()

KFileView::KFileView ( )

Definition at line 63 of file tdefileview.cpp.

◆ ~KFileView()

KFileView::~KFileView ( )
virtual

Destructor.

Definition at line 83 of file tdefileview.cpp.

Member Function Documentation

◆ actionCollection()

TDEActionCollection * KFileView::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.

Reimplemented in KCombiView, and KFilePreview.

Definition at line 365 of file tdefileview.cpp.

◆ addItemList()

void KFileView::addItemList ( const KFileItemList &  list)

inserts a list of items.

Definition at line 130 of file tdefileview.cpp.

◆ autoOpenDelay()

int KFileView::autoOpenDelay ( )
static

Definition at line 412 of file tdefileview.cpp.

◆ clear()

void KFileView::clear ( )
virtual

Clears the view and all item lists.

Reimplemented in KCombiView, and KFilePreview.

Definition at line 156 of file tdefileview.cpp.

◆ clearSelection()

virtual void KFileView::clearSelection ( )
pure virtual

Clears any selection, unhighlights everything.

Must be implemented by the view.

Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

◆ clearView()

virtual void KFileView::clearView ( )
pure virtual

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

At this moment the list is already empty

Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

◆ count()

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

Definition at line 205 of file tdefileview.h.

◆ currentFileItem()

virtual KFileItem * KFileView::currentFileItem ( ) const
pure 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.

Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

◆ dropOptions()

int KFileView::dropOptions ( )

Returns the DND options in effect.

See DropOptions for details.

Since
3.2

Definition at line 407 of file tdefileview.cpp.

◆ ensureItemVisible()

virtual void KFileView::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.

Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

◆ insertItem()

void KFileView::insertItem ( 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. KFileView::insertItem( i );

Reimplemented in KFilePreview, KCombiView, KFileDetailView, and KFileIconView.

Definition at line 147 of file tdefileview.cpp.

◆ invertSelection()

void KFileView::invertSelection ( )
virtual

Inverts the current selection, i.e.

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

Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

Definition at line 323 of file tdefileview.cpp.

◆ isReversed()

bool KFileView::isReversed ( ) const
inline

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

Definition at line 198 of file tdefileview.h.

◆ isSelected()

virtual bool KFileView::isSelected ( const KFileItem *  ) const
pure virtual
Returns
whether the given item is currently selected. Must be implemented by the view.

Implemented in KCombiView, KFilePreview, KFileDetailView, and KFileIconView.

◆ items()

const KFileItemList * KFileView::items ( ) const
Returns
all items currently available in the current sort-order

Definition at line 283 of file tdefileview.cpp.

◆ listingCompleted()

void KFileView::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 in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

Definition at line 360 of file tdefileview.cpp.

◆ numDirs()

uint KFileView::numDirs ( ) const
inline
Returns
the number of directories

Definition at line 215 of file tdefileview.h.

◆ numFiles()

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

Definition at line 210 of file tdefileview.h.

◆ onlyDoubleClickSelectsFiles()

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

Definition at line 329 of file tdefileview.h.

◆ readConfig()

void KFileView::readConfig ( TDEConfig *  ,
const TQString &  group = TQString::null 
)
virtual

Definition at line 372 of file tdefileview.cpp.

◆ removeItem()

void KFileView::removeItem ( const KFileItem *  item)
virtual

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

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

Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

Definition at line 346 of file tdefileview.cpp.

◆ selectAll()

void KFileView::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 in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

Definition at line 312 of file tdefileview.cpp.

◆ selectedItems()

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

Definition at line 296 of file tdefileview.cpp.

◆ selectionMode()

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

Definition at line 336 of file tdefileview.cpp.

◆ setCurrentItem() [1/2]

virtual void KFileView::setCurrentItem ( const KFileItem *  item)
pure virtual

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

the item having focus.

Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

◆ setCurrentItem() [2/2]

void KFileView::setCurrentItem ( const TQString &  filename)

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

Definition at line 268 of file tdefileview.cpp.

◆ setDropOptions()

void KFileView::setDropOptions ( int  options)

Specify DND options.

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

Since
3.2

Definition at line 397 of file tdefileview.cpp.

◆ setDropOptions_impl()

void KFileView::setDropOptions_impl ( int  options)
protected

Definition at line 402 of file tdefileview.cpp.

◆ setOnlyDoubleClickSelectsFiles()

void KFileView::setOnlyDoubleClickSelectsFiles ( bool  enable)
inline

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 320 of file tdefileview.h.

◆ setParentView()

void KFileView::setParentView ( KFileView *  parent)
virtual

Definition at line 90 of file tdefileview.cpp.

◆ setSelected()

virtual void KFileView::setSelected ( const KFileItem *  ,
bool  enable 
)
pure virtual

Tells the view that it should highlight the item.

This function must be implemented by the view.

Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

◆ setSelectionMode()

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

Definition at line 331 of file tdefileview.cpp.

◆ setSorting()

void KFileView::setSorting ( TQDir::SortSpec  sort)
virtual

Sets the sorting order of the view.

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

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

See also
sortingKey

Reimplemented in KCombiView, KFileIconView, KFilePreview, and KFileDetailView.

Definition at line 151 of file tdefileview.cpp.

◆ setViewMode()

void KFileView::setViewMode ( ViewMode  vm)
virtual

Definition at line 341 of file tdefileview.cpp.

◆ setViewName()

void KFileView::setViewName ( const TQString &  name)
inline

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

E.g. "Image Preview".

Definition at line 239 of file tdefileview.h.

◆ signaler()

KFileViewSignaler * KFileView::signaler ( ) const
inline

Definition at line 346 of file tdefileview.h.

◆ sorting()

TQDir::SortSpec KFileView::sorting ( ) const
inline

Returns the sorting order of the internal list.

Newly added files are added through this sorting.

Definition at line 176 of file tdefileview.h.

◆ sortingKey() [1/2]

TQString KFileView::sortingKey ( const TQString &  value,
bool  isDir,
int  sortSpec 
)
static

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

TQIconView or TQListView. Their Item-classes usually have a setKey( const TQString& ) method or a virtual method TQString 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)
sortSpecAn ORed combination of TQDir::SortSpec flags. Currently, the values IgnoreCase, Reversed and DirsFirst are taken into account.

Definition at line 380 of file tdefileview.cpp.

◆ sortingKey() [2/2]

TQString KFileView::sortingKey ( TDEIO::filesize_t  value,
bool  isDir,
int  sortSpec 
)
static

An overloaded method that takes not a TQString, 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 TDEIO::filesize_t because of ambiguity problems.

Definition at line 389 of file tdefileview.cpp.

◆ sortReversed()

void KFileView::sortReversed ( )

Definition at line 164 of file tdefileview.cpp.

◆ updateNumbers()

bool KFileView::updateNumbers ( const KFileItem *  i)

increases the number of dirs and files.

Returns
true if the item fits the view mode

Definition at line 110 of file tdefileview.cpp.

◆ updateView() [1/2]

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

does a repaint of the view.

The default implementation calls

widget()->repaint(f)
KFileView::widget
virtual TQWidget * widget()=0
a pure virtual function to get a TQWidget, that can be added to other widgets.

Reimplemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

Definition at line 259 of file tdefileview.cpp.

◆ updateView() [2/2]

void KFileView::updateView ( const KFileItem *  )
virtual

Definition at line 264 of file tdefileview.cpp.

◆ viewMode()

virtual ViewMode KFileView::viewMode ( ) const
inlinevirtual

Definition at line 226 of file tdefileview.h.

◆ viewName()

TQString KFileView::viewName ( ) const
inline
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 233 of file tdefileview.h.

◆ virtual_hook()

void KFileView::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 417 of file tdefileview.cpp.

◆ widget() [1/2]

TQWidget * KFileView::widget ( ) const
inline

As const-method, to be fixed in 3.0

Definition at line 122 of file tdefileview.h.

◆ widget() [2/2]

virtual TQWidget * KFileView::widget ( )
pure virtual

a pure virtual function to get a TQWidget, that can be added to other widgets.

This function is needed to make it possible for derived classes to derive from other widgets.

Implemented in KCombiView, KFileDetailView, KFileIconView, and KFilePreview.

◆ writeConfig()

void KFileView::writeConfig ( TDEConfig *  ,
const TQString &  group = TQString::null 
)
virtual

Definition at line 376 of file tdefileview.cpp.

Member Data Documentation

◆ sig

KFileViewSignaler* KFileView::sig
protected

Definition at line 410 of file tdefileview.h.


The documentation for this class was generated from the following files:
  • tdefileview.h
  • tdefileview.cpp

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.4
This website is maintained by Timothy Pearson.