# class KDirOperator |
Definition | `#include <kdiroperator.h>`
Inherits | QWidget (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KDirOperator (const KURL& urlName = KURL(), QWidget *parent = 0, const char* name = 0)
- virtual ~KDirOperator ()
- void setShowHiddenFiles ( bool s )
- bool showHiddenFiles () const
- void close ()
- void setNameFilter (const QString& filter)
- const QString& nameFilter () const
- KURL url () const
- void setURL (const KURL& url, bool clearforward)
- void setCurrentItem ( const QString& filename )
- void setView (KFileView *view)
- const KFileView * view () const
- QWidget * viewWidget () const
- void setView (KFile::FileView view)
- void setSorting ( QDir::SortSpec )
- QDir::SortSpec sorting () const
- bool isRoot () const
- KFileReader * fileReader () const
- KProgress * progressBar () const
- void setMode ( KFile::Mode m )
- KFile::Mode mode () const
- void setPreviewWidget (const QWidget *w)
- const KFileViewItemList * selectedItems () const
- inline bool isSelected ( const KFileViewItem *item ) const
- int numDirs () const
- int numFiles () const
- KCompletion * completionObject () const
- KCompletion * dirCompletionObject () const
- KActionCollection * actionCollection () const
- virtual void readConfig ( KConfig *, const QString& group = QString::null )
- virtual void saveConfig ( KConfig *, const QString& group = QString::null )
- void setOnlyDoubleClickSelectsFiles ( bool enable )
- bool onlyDoubleClickSelectsFiles () const
- bool mkdir ( const QString& directory, bool enterDirectory=true )
- void clearHistory ()

#### Public Slots

- void back ()
- void forward ()
- void home ()
- void cdUp ()
- void rereadDir ()
- void mkdir ()
- QString makeCompletion (const QString&)
- QString makeDirCompletion (const QString&)

#### Signals

- void urlEntered (const KURL& )
- void updateInformation (int files, int dirs)
- void completion (const QString&)
- void finishedLoading ()
- void viewChanged ( KFileView * newView )
- void fileHighlighted (const KFileViewItem*)
- void dirActivated (const KFileViewItem*)
- void fileSelected (const KFileViewItem*)

#### Protected Methods

- void setFileReader ( KFileReader *reader )
- void resizeEvent ( QResizeEvent * )
- void setupActions ()
- void updateSortActions ()
- void updateViewActions ()
- void setupMenu ()
- void prepareCompletionObjects ()

#### Protected Slots

- void resetCursor ()
- void readNextMimeType ()
- void pathChanged ()
- void filterChanged ()
- void insertNewFiles (const KFileItemList &newone)
- void itemDeleted (KFileItem *)
- void selectDir (const KFileViewItem*)
- void selectFile (const KFileViewItem*)
- void highlightFile (const KFileViewItem* i)
- virtual void activatedMenu ( const KFileViewItem * )
- void sortByName ()
- void sortBySize ()
- void sortByDate ()
- void sortReversed ()
- void toggleDirsFirst ()
- void toggleIgnoreCase ()
- void deleteOldView ()
- void slotCompletionMatch (const QString&)

## Detailed Description

KDirOperator (const KURL& urlName = KURL(), QWidget *parent = 0, const char* name = 0) | ### KDirOperator

You need to call listDirectory() to actually load the directory, this constructor only initializes and doesn't start loading.

~KDirOperator () | ### ~KDirOperator

[virtual]

void setShowHiddenFiles ( bool s ) | ### setShowHiddenFiles

bool showHiddenFiles () | ### showHiddenFiles

[const]

void close () | ### close

Reimplemented from QWidget.

void setNameFilter (const QString& filter) | ### setNameFilter

Set a filter like "*.cpp *.h *.o". Call rereadDir() to apply it.

const QString& nameFilter () | ### nameFilter

[const]

Returns: the current namefilter.

KURL url () | ### url

[const]

local URLs (i.e. directories) always have file: prepended.

void setURL (const KURL& url, bool clearforward) | ### setURL

void setCurrentItem ( const QString& filename ) | ### setCurrentItem

Clears the current selection and attempts to set `filename` the current file. filename is just the name, no path or url.

void setView (KFileView *view) | ### setView

const KFileView * view () | ### view

[const]

QWidget * viewWidget () | ### viewWidget

[const]

Returns the widget of the current view. 0L if there is no view/widget.

void setView (KFile::FileView view) | ### setView

void setSorting ( QDir::SortSpec ) | ### setSorting

QDir::SortSpec sorting () | ### sorting

[const]

bool isRoot () | ### isRoot

[const]

KFileReader * fileReader () | ### fileReader

[const]

KProgress * progressBar () | ### progressBar

[const]

Returns: the progress widget, that is shown during directory listing. You can for example reparent() it to put it into a statusbar.

void setMode ( KFile::Mode m ) | ### setMode

Sets the listing/selection mode for the views, an OR'ed combination of

- File
- Directory
- Files
- ExistingOnly
- LocalOnly

You cannot mix File and Files of course.

KFile::Mode mode () | ### mode

[const]

void setPreviewWidget (const QWidget *w) | ### setPreviewWidget

const KFileViewItemList * selectedItems () | ### selectedItems

[const]

Returns: a list of all currently selected items. If there is no view, then 0L is returned.

inline bool isSelected ( const KFileViewItem *item ) | ### isSelected

[const]

int numDirs () | ### numDirs

[const]

int numFiles () | ### numFiles

[const]

KCompletion * completionObject () | ### completionObject

[const]

Returns: a KCompletion object, containing all filenames and directories of the current directory/URL. You can use it to insert it into a KLineEdit or KComboBox Note: it will only contain files, after prepareCompletionObjects() has been called. It will be implicitly called from makeCompletion() or makeDirCompletion()

KCompletion * dirCompletionObject () | ### dirCompletionObject

[const]

Returns: a KCompletion object, containing only all directories of the current directory/URL. You can use it to insert it into a KLineEdit or KComboBox Note: it will only contain directories, after prepareCompletionObjects() has been called. It will be implicitly called from makeCompletion() or makeDirCompletion()

KActionCollection * actionCollection () | ### actionCollection

[const]

an accessor to a collection of all available Actions. The actions are static, they will be there all the time (no need to connect to the signals KActionCollection::inserted() or removed().

There are the following actions:

- popupMenu : an ActionMenu presenting a popupmenu with all actions
- up : changes to the parent directory
- back : goes back to the previous directory
- forward : goes forward in the history
- home : changes to the user's home directory
- reload : reloads the current directory
- separator : a separator
- mkdir : opens a dialog box to create a directory
- sorting menu : an ActionMenu containing all sort-options
- by name : sorts by name
- by date : sorts by date
- by size : sorts by size
- reversed : reverses the sort order
- dirs first : sorts directories before files
- case insensitive : sorts case insensitively
- view menu : an ActionMenu containing all actions concerning the view
- short view : shows a simple fileview
- detailed view : shows a detailed fileview (dates, permissions ,...)
- show hidden : shows hidden files
- separate dirs : shows directories in a separate pane

The short and detailed view are in an exclusive group. The sort-by actions are in an exclusive group as well.

You can e.g. use

    actionCollection()->action( "up" )->plug( someToolBar );</pre>
     to add a button into a toolbar, which makes the dirOperator change to
     its parent directory.

     @returns all available Actions

void readConfig ( KConfig *, const QString& group = QString::null ) | ### readConfig

[virtual]

Reads the default settings for a view, i.e. the default KFile::FileView. Also reads the sorting and whether hidden files should be shown. Note: the default view will not be set - you have to call

    @ref setView( KFile::Default )</pre> to apply it.

void saveConfig ( KConfig *, const QString& group = QString::null ) | ### saveConfig

[virtual]

void setOnlyDoubleClickSelectsFiles ( bool enable ) | ### setOnlyDoubleClickSelectsFiles

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.

The default is false, set it to true if you don't want files selected with single click.

bool onlyDoubleClickSelectsFiles () | ### onlyDoubleClickSelectsFiles

[const]

Returns: whether files (not directories) should only be select()ed by double-clicks.

See also: setOnlyDoubleClickSelectsFiles

bool mkdir ( const QString& directory, bool enterDirectory=true ) | ### mkdir

Creates the given directory/url. If it is a relative path, it will be completed with the current directory. If enterDirectory is true, the directory will be entered after a successful operation. If unsuccessful, a messagebox will be presented to the user.

Returns: true if the directory could be created.

void clearHistory () | ### clearHistory

Clears the forward and backward history.

void setFileReader ( KFileReader *reader ) | ### setFileReader

[protected]

void resizeEvent ( QResizeEvent * ) | ### resizeEvent

[protected]

Reimplemented from QWidget.

void setupActions () | ### setupActions

[protected]

void updateSortActions () | ### updateSortActions

[protected]

void updateViewActions () | ### updateViewActions

[protected]

void setupMenu () | ### setupMenu

[protected]

void prepareCompletionObjects () | ### prepareCompletionObjects

[protected]

void back () | ### back

[slot]

void forward () | ### forward

[slot]

void home () | ### home

[slot]

void cdUp () | ### cdUp

[slot]

void rereadDir () | ### rereadDir

[slot]

void mkdir () | ### mkdir

[slot]

QString makeCompletion (const QString&) | ### makeCompletion

[slot]

QString makeDirCompletion (const QString&) | ### makeDirCompletion

[slot]

void resetCursor () | ### resetCursor

[protected slots slot]

void readNextMimeType () | ### readNextMimeType

[protected slots slot]

void pathChanged () | ### pathChanged

[protected slots slot]

void filterChanged () | ### filterChanged

[protected slots slot]

void insertNewFiles (const KFileItemList &newone) | ### insertNewFiles

[protected slots slot]

void itemDeleted (KFileItem *) | ### itemDeleted

[protected slots slot]

void selectDir (const KFileViewItem*) | ### selectDir

[protected slots slot]

void selectFile (const KFileViewItem*) | ### selectFile

[protected slots slot]

void highlightFile (const KFileViewItem* i) | ### highlightFile

[protected slots slot]

void activatedMenu ( const KFileViewItem * ) | ### activatedMenu

[protected slots virtual slot]

Called upon right-click to activate the popupmenu.

void sortByName () | ### sortByName

[protected slots slot]

void sortBySize () | ### sortBySize

[protected slots slot]

void sortByDate () | ### sortByDate

[protected slots slot]

void sortReversed () | ### sortReversed

[protected slots slot]

void toggleDirsFirst () | ### toggleDirsFirst

[protected slots slot]

void toggleIgnoreCase () | ### toggleIgnoreCase

[protected slots slot]

void deleteOldView () | ### deleteOldView

[protected slots slot]

void slotCompletionMatch (const QString&) | ### slotCompletionMatch

[protected slots slot]

void urlEntered (const KURL& ) | ### urlEntered

[signal]

void updateInformation (int files, int dirs) | ### updateInformation

[signal]

void completion (const QString&) | ### completion

[signal]

void finishedLoading () | ### finishedLoading

[signal]

void viewChanged ( KFileView * newView ) | ### viewChanged

[signal]

Emitted whenever the current fileview is changed, either by an explicit call to setView() or by the user selecting a different view thru the GUI.

void fileHighlighted (const KFileViewItem*) | ### fileHighlighted

[signal]

void dirActivated (const KFileViewItem*) | ### dirActivated

[signal]

void fileSelected (const KFileViewItem*) | ### fileSelected

[signal]

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:44 2001, using kdoc 2.0a53.