kio Library API Documentation

KDirOperator Class Reference

This widget works as a network transparent filebrowser. A widget for displaying files and browsing directories. More...

#include <kdiroperator.h>

Inheritance diagram for KDirOperator:

QWidget List of all members.

Public Types

enum  ActionTypes
 The various action types. More...


Public Slots

void back ()
 Goes one step back in the history and opens that url.

void forward ()
 Goes one step forward in the history and opens that url.

void home ()
 Enters the home directory.

void cdUp ()
 Goes one directory up from the current url.

void updateDir ()
 to update the view after changing the settings

void rereadDir ()
 Re-reads the current url.

void mkdir ()
 Opens a dialog to create a new directory.

void deleteSelected ()
 Deletes the currently selected files/directories.

void updateSelectionDependentActions ()
 Enables/disables actions that are selection dependent.

QString makeCompletion (const QString &)
 Tries to complete the given string (only completes files).

QString makeDirCompletion (const QString &)
 Tries to complete the given string (only completes directores).


Signals

void viewChanged (KFileView *newView)
 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.


Public Methods

 KDirOperator (const KURL &urlName=KURL(), QWidget *parent=0, const char *name=0)
 Constructs the KDirOperator with no initial view.

virtual ~KDirOperator ()
 Destroys the KDirOperator.

void setShowHiddenFiles (bool s)
 Enables/disables showing hidden files.

bool showHiddenFiles () const
void close ()
 Stops loading immediately.

void setNameFilter (const QString &filter)
 Sets a filter like "*.cpp *.h *.o".

const QStringnameFilter () const
void setMimeFilter (const QStringList &mimetypes)
 Sets a list of mimetypes as filter.

QStringList mimeFilter () const
void clearFilter ()
 Clears both the namefilter and mimetype filter, so that all files and directories will be shown.

KURL url () const
void setURL (const KURL &url, bool clearforward)
 Sets a new url to list.

void setCurrentItem (const QString &filename)
 Clears the current selection and attempts to set filename the current file.

void setView (KFileView *view)
 Sets a new KFileView to be used for showing and browsing files.

KFileViewview () const
QWidgetviewWidget () const
 Returns the widget of the current view.

void setView (KFile::FileView view)
 Sets one of the predefined fileviews.

void setSorting (QDir::SortSpec)
 Sets the way to sort files and directories.

QDir::SortSpec sorting () const
bool isRoot () const
KDirListerdirLister () const
KProgressprogressBar () const
void setMode (KFile::Mode m)
 Sets the listing/selection mode for the views, an OR'ed combination of
  • File
  • Directory
  • Files
  • ExistingOnly
  • LocalOnly.


KFile::Mode mode () const
void setPreviewWidget (const QWidget *w)
 Sets a preview-widget to be shown next to the file-view.

const KFileItemList * selectedItems () const
bool isSelected (const KFileItem *item) const
int numDirs () const
int numFiles () const
KCompletioncompletionObject () const
KCompletiondirCompletionObject () const
KActionCollectionactionCollection () const
 an accessor to a collection of all available Actions.

void setViewConfig (KConfig *config, const QString &group)
 Sets the config object and the to be used group in KDirOperator.

KConfigviewConfig ()
 Returns the KConfig object used for saving and restoring view's configuration.

QString viewConfigGroup () const
 Returns the group name used for saving and restoring view's configuration.

virtual void readConfig (KConfig *, const QString &group=QString::null)
 Reads the default settings for a view, i.e.

virtual void writeConfig (KConfig *, const QString &group=QString::null)
 Saves the current settings like sorting, simple or detailed view.

void setOnlyDoubleClickSelectsFiles (bool enable)
 This is a KFileDialog specific hack: we want to select directories with single click, but not files.

bool onlyDoubleClickSelectsFiles () const
bool mkdir (const QString &directory, bool enterDirectory=true)
 Creates the given directory/url.

KIO::DeleteJobdel (const KFileItemList &items, bool ask=true, bool showProgress=true)
 Starts and returns a KIO::DeleteJob to delete the given items.

KIO::DeleteJobdel (const KFileItemList &items, QWidget *parent, bool ask=true, bool showProgress=true)
 Starts and returns a KIO::DeleteJob to delete the given items.

void clearHistory ()
 Clears the forward and backward history.

void setEnableDirHighlighting (bool enable)
 When going up in the directory hierarchy, KDirOperator can highlight the directory that was just left.

bool dirHighlighting () const
bool dirOnlyMode () const
void setupMenu (int whichActions)
 Sets up the action menu.


Protected Slots

void resetCursor ()
 Restores the normal cursor after showing the busy-cursor.

void pathChanged ()
 Called after setURL() to load the directory, update the history, etc.

void insertNewFiles (const KFileItemList &newone)
 Adds a new list of KFileItems to the view (coming from KDirLister).

void itemDeleted (KFileItem *)
 Removes the given KFileItem item from the view (usually called from KDirLister).

void selectDir (const KFileItem *item)
 Enters the directory specified by the given item.

void selectFile (const KFileItem *item)
 Emits fileSelected( item ).

void highlightFile (const KFileItem *i)
 Emits fileHighlighted( i ).

virtual void activatedMenu (const KFileItem *, const QPoint &pos)
 Called upon right-click to activate the popupmenu.

void sortByName ()
 Changes sorting to sort by name.

void sortBySize ()
 Changes sorting to sort by size.

void sortByDate ()
 Changes sorting to sort by date.

void sortReversed ()
 Changes sorting to reverse sorting.

void toggleDirsFirst ()
 Toggles showing directories first / having them sorted like files.

void toggleIgnoreCase ()
 Toggles case sensitive / case insensitive sorting.

void slotCompletionMatch (const QString &match)
 Tries to make the given match as current item in the view and emits completion( match ).


Protected Methods

virtual KFileViewcreateView (QWidget *parent, KFile::FileView view)
 A view factory for creating predefined fileviews.

void setDirLister (KDirLister *lister)
 Sets a custom KFileReader to list directories.

void resizeEvent (QResizeEvent *)
void setupActions ()
 Sets up all the actions.

void updateSortActions ()
 Updates the sorting-related actions to comply with the current sorting.

void updateViewActions ()
 Updates the view-related actions to comply with the current KFile::FileView.

void setupMenu ()
 Sets up the context-menu with all the necessary actions.

void prepareCompletionObjects ()
 Synchronizes the completion objects with the entries of the currently listed url.

bool checkPreviewSupport ()
 Checks if there support from KIO::PreviewJob for the currently shown files, taking mimeFilter() and nameFilter() into account Enables/disables the preview-action accordingly.


Detailed Description

This widget works as a network transparent filebrowser. A widget for displaying files and browsing directories.

You specify a URL to display and this url will be loaded via KDirLister. The user can browse through directories, highlight and select files, delete or rename files.

It supports different views, e.g. a detailed view (see KFileDetailView), a simple icon view (see KFileIconView), a combination of two views, separating directories and files (KCombiView).

Additionally, a preview view is available (see KFilePreview), which can show either a simple or detailed view and additionally a preview widget (see setPreviewWidget()). KImageFilePreview is one implementation of a preview widget, that displays previews for all supported filetypes utilizing KIO::PreviewJob.

Currently, those classes don't support Drag&Drop out of the box -- there you have to use your own view-classes. You can use some DnD-aware views from Björn Sahlström <bjorn@kbear.org> until they will be integrated into this library. See http://devel-home.kde.org/~pfeiffer/DnD-classes.tar.gz

This widget is the one used in the KFileDialog.

Basic usage is like this:

   KDirOperator *op = new KDirOperator( KURL( "file:/home/gis" ), this );
   // some signals you might be interested in
   connect(op, SIGNAL(urlEntered(const KURL&)),
           SLOT(urlEntered(const KURL&)));
   connect(op, SIGNAL(fileHighlighted(const KFileItem *)),
           SLOT(fileHighlighted(const KFileItem *)));
   connect(op, SIGNAL(fileSelected(const KFileItem *)),
           SLOT(fileSelected(const KFileItem *)));
   connect(op, SIGNAL(finishedLoading()),
           SLOT(slotLoadingFinished()));

   op->readConfig( KGlobal::config(), "Your KDiroperator ConfigGroup" );
   op->setView(KFile::Default);
 

This will create a childwidget of 'this' showing the directory contents of /home/gis in the default-view. The view is determined by the readConfig() call, which will read the KDirOperator settings, the user left your program with (and which you saved with op->writeConfig()).

Author:
Stephan Kulow <coolo@kde.org>, Carsten Pfeiffer <pfeiffer@kde.org>

Definition at line 98 of file kdiroperator.h.


Member Enumeration Documentation

enum KDirOperator::ActionTypes
 

The various action types.

These values can be or'd together

Since:
3.1

Definition at line 107 of file kdiroperator.h.


Constructor & Destructor Documentation

KDirOperator::KDirOperator const KURL   urlName = KURL(),
QWidget   parent = 0,
const char *    name = 0
 

Constructs the KDirOperator with no initial view.

As the views are configurable, call readConfig() to load the user's configuration and then setView to explicitly set a view.

This constructor doesn't start loading the url, setView will do it.

Definition at line 93 of file kdiroperator.cpp.

References KURL::addPath(), QString::append(), QDir::currentDirPath(), QString::fromLatin1(), QWidget::height(), QString::isEmpty(), KURL::isEmpty(), KURL::protocol(), QPtrStack< KURL >::setAutoDelete(), setDirLister(), QWidget::setFocusPolicy(), KURL::setPath(), KURL::setProtocol(), setupActions(), setupMenu(), and slotCompletionMatch().

KDirOperator::~KDirOperator   [virtual]
 

Destroys the KDirOperator.

Definition at line 146 of file kdiroperator.cpp.

References resetCursor(), and KFileView::writeConfig().


Member Function Documentation

void KDirOperator::setShowHiddenFiles bool    s [inline]
 

Enables/disables showing hidden files.

Definition at line 129 of file kdiroperator.h.

References KToggleAction::setChecked().

bool KDirOperator::showHiddenFiles   const [inline]
 

Returns:
true when hidden files are shown or false otherwise.

Definition at line 134 of file kdiroperator.h.

References KToggleAction::isChecked().

void KDirOperator::close  
 

Stops loading immediately.

You don't need to call this, usually.

Reimplemented from QWidget.

Definition at line 442 of file kdiroperator.cpp.

References KCompletion::clear(), QPtrList< KFileItem >::clear(), resetCursor(), and KDirLister::stop().

void KDirOperator::setNameFilter const QString   filter
 

Sets a filter like "*.cpp *.h *.o".

Only files matching that filter will be shown. Call updateDir() to apply it.

See also:
KDirLister::setNameFilter , nameFilter

Definition at line 655 of file kdiroperator.cpp.

References checkPreviewSupport(), and KDirLister::setNameFilter().

Referenced by KFileDialog::setFilter().

const QString& KDirOperator::nameFilter   const [inline]
 

Returns:
the current namefilter.
See also:
setNameFilter

Definition at line 154 of file kdiroperator.h.

References KDirLister::nameFilter().

void KDirOperator::setMimeFilter const QStringList   mimetypes
 

Sets a list of mimetypes as filter.

Only files of those mimetypes will be shown.

Example:

 QStringList filter;
 filter << "text/html" << "image/png" << "inode/directory";
 dirOperator->setMimefilter( filter );
 

Node: Without the mimetype inode/directory, only files would be shown. Call updateDir() to apply it.

See also:
KDirLister::setMimeFilter , mimeFilter

Definition at line 661 of file kdiroperator.cpp.

References checkPreviewSupport(), and KDirLister::setMimeFilter().

Referenced by KFileDialog::setMimeFilter().

QStringList KDirOperator::mimeFilter   const [inline]
 

Returns:
the current mime filter.

Definition at line 178 of file kdiroperator.h.

References KDirLister::mimeFilters().

void KDirOperator::clearFilter  
 

Clears both the namefilter and mimetype filter, so that all files and directories will be shown.

Call updateDir() to apply it.

See also:
setMimeFilter , setNameFilter

Definition at line 648 of file kdiroperator.cpp.

References checkPreviewSupport(), KDirLister::clearMimeFilter(), and KDirLister::setNameFilter().

Referenced by KFileDialog::clearFilter(), KFileDialog::setFilter(), and KFileDialog::setMimeFilter().

KURL KDirOperator::url  
 

Returns:
the current url

Definition at line 631 of file kdiroperator.cpp.

Referenced by KFileDialog::baseURL(), del(), isRoot(), mkdir(), KFileDialog::readConfig(), KFileDialog::setSelection(), setView(), and KFileDialog::tokenize().

void KDirOperator::setURL const KURL   url,
bool    clearforward
 

Sets a new url to list.

Parameters:
clearforward  specifies whether the "forward" history should be cleared.

Definition at line 505 of file kdiroperator.cpp.

References KURL::cd(), QPtrStack< KURL >::clear(), KURL::cmp(), KMessageBox::error(), QString::fromLatin1(), QDir::homeDirPath(), QPtrStack< KURL >::isEmpty(), KURL::isMalformed(), isRoot(), KDirLister::openURL(), KURL::path(), pathChanged(), QPtrStack< KURL >::push(), resetCursor(), KAction::setEnabled(), KURL::setPath(), KURL::url(), and viewWidget().

Referenced by back(), cdUp(), forward(), home(), mkdir(), selectDir(), and KFileDialog::setURL().

void KDirOperator::setCurrentItem const QString   filename
 

Clears the current selection and attempts to set filename the current file.

filename is just the name, no path or url.

Definition at line 1021 of file kdiroperator.cpp.

References KFileView::clearSelection(), KFileView::ensureItemVisible(), KDirLister::findByName(), QString::isNull(), KFileView::setCurrentItem(), and KFileView::setSelected().

Referenced by slotCompletionMatch().

void KDirOperator::setView KFileView   view
 

Sets a new KFileView to be used for showing and browsing files.

Note: this will read the current url() to fill the view.

See also:
KFileView , KFileIconView , KFileDetailView , KFileCombiView , view

Definition at line 936 of file kdiroperator.cpp.

References QWidget::setFocusProxy(), KFileView::setOnlyDoubleClickSelectsFiles(), KFileView::setSorting(), viewChanged(), and KFileView::widget().

Referenced by setMode(), setPreviewWidget(), and setView().

KFileView* KDirOperator::view   const [inline]
 

Returns:
the currently used view.
See also:
setView

Definition at line 223 of file kdiroperator.h.

Referenced by createView(), and setView().

QWidget* KDirOperator::viewWidget   const [inline]
 

Returns the widget of the current view.

0L if there is no view/widget. (KFileView itself is not a widget.)

Definition at line 229 of file kdiroperator.h.

References KFileView::widget().

Referenced by mkdir(), pathChanged(), and setURL().

void KDirOperator::setView KFile::FileView    view
 

Sets one of the predefined fileviews.

See also:
KFile::FileView

Definition at line 787 of file kdiroperator.cpp.

References createView(), KFile::isPreviewInfo(), mode(), KToggleAction::setChecked(), setView(), url(), and view().

void KDirOperator::setSorting QDir::SortSpec   
 

Sets the way to sort files and directories.

Definition at line 164 of file kdiroperator.cpp.

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

Referenced by readConfig().

QDir::SortSpec KDirOperator::sorting   const [inline]
 

Returns:
the current way of sorting files and directories

Definition at line 245 of file kdiroperator.h.

Referenced by readConfig().

bool KDirOperator::isRoot   const [inline]
 

Returns:
true if we are displaying the root directory of the current url

Definition at line 250 of file kdiroperator.h.

References KURL::path(), and url().

Referenced by setURL().

KDirLister* KDirOperator::dirLister   const [inline]
 

Returns:
the object listing the directory

Definition at line 255 of file kdiroperator.h.

KProgress * KDirOperator::progressBar  
 

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

Definition at line 1456 of file kdiroperator.cpp.

void KDirOperator::setMode KFile::Mode    m
 

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, as the former means single-selection mode, the latter multi-selection.

Definition at line 923 of file kdiroperator.cpp.

References dirOnlyMode(), KFile::Mode, KDirLister::setDirOnlyMode(), and setView().

Referenced by KFileDialog::setMode().

KFile::Mode KDirOperator::mode  
 

Returns:
the listing/selection mode.

Definition at line 918 of file kdiroperator.cpp.

References KFile::Mode.

Referenced by KFileDialog::init(), KFileDialog::mode(), KFileDialog::selectedFiles(), KFileDialog::selectedURLs(), and setView().

void KDirOperator::setPreviewWidget const QWidget   w
 

Sets a preview-widget to be shown next to the file-view.

The ownership of w is transferred to KDirOperator, so don't delete it yourself!

Definition at line 216 of file kdiroperator.cpp.

References KToggleAction::setChecked(), and setView().

Referenced by KFileDialog::setPreviewWidget().

const KFileItemList* KDirOperator::selectedItems   const [inline]
 

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

Definition at line 291 of file kdiroperator.h.

References KFileView::selectedItems().

Referenced by KFileDialog::multiSelectionChanged().

bool KDirOperator::isSelected const KFileItem   item const [inline]
 

Returns:
true if item is currently selected, or false otherwise.

Definition at line 298 of file kdiroperator.h.

References KFileView::isSelected().

int KDirOperator::numDirs  
 

Returns:
the number of directories in the currently listed url. Returns 0 if there is no view.

Definition at line 232 of file kdiroperator.cpp.

References KFileView::numDirs().

int KDirOperator::numFiles  
 

Returns:
the number of files in the currently listed url. Returns 0 if there is no view.

Definition at line 237 of file kdiroperator.cpp.

References KFileView::numFiles().

KCompletion* KDirOperator::completionObject   const [inline]
 

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()

Definition at line 322 of file kdiroperator.h.

Referenced by KFileDialog::init().

KCompletion* KDirOperator::dirCompletionObject   const [inline]
 

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()

Definition at line 334 of file kdiroperator.h.

Referenced by KFileDialog::init().

KActionCollection* KDirOperator::actionCollection   const [inline]
 

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
  • delete : deletes the selected files/directories
  • 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
  • preview : shows a preview next to the fileview
  • single : hides the separate view for directories or the preview
  • properties : shows a KPropertiesDialog for the selected files
The short and detailed view are in an exclusive group. The sort-by actions are in an exclusive group as well. Also the "separate dirs", "preview" and "single" actions are in an exclusive group.

You can e.g. use

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

Returns:
all available Actions

Definition at line 381 of file kdiroperator.h.

Referenced by KFileDialog::actionCollection(), KFileDialog::init(), and KFileDialog::toggleSpeedbar().

void KDirOperator::setViewConfig KConfig   config,
const QString   group
 

Sets the config object and the to be used group in KDirOperator.

This will be used to store the view's configuration via KFileView::writeConfig() (and for KFileView::readConfig()). If you don't set this, the views cannot save and restore their configuration.

Usually you call this right after KDirOperator creation so that the view instantiation can make use of it already.

Note that KDirOperator does NOT take ownership of that object (typically it's KGlobal::config() anyway.

See also:
viewConfig , viewConfigGroup
Since:
3.1

Definition at line 1554 of file kdiroperator.cpp.

Referenced by KFileDialog::init().

KConfig * KDirOperator::viewConfig  
 

Returns the KConfig object used for saving and restoring view's configuration.

Returns:
the KConfig object used for saving and restoring view's configuration.
Since:
3.1

Definition at line 1560 of file kdiroperator.cpp.

QString KDirOperator::viewConfigGroup  
 

Returns the group name used for saving and restoring view's configuration.

Returns:
the group name used for saving and restoring view's configuration.
Since:
3.1

Definition at line 1565 of file kdiroperator.cpp.

void KDirOperator::readConfig KConfig  ,
const QString   group = QString::null
[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

 setView( KFile::Default )
 
to apply it.

See also:
setView , setViewConfig , writeConfig

Definition at line 1273 of file kdiroperator.cpp.

References QString::fromLatin1(), QString::isEmpty(), KToggleAction::setChecked(), KDirLister::setShowingDotFiles(), setSorting(), and sorting().

Referenced by KFileDialog::readConfig().

void KDirOperator::writeConfig KConfig  ,
const QString   group = QString::null
[virtual]
 

Saves the current settings like sorting, simple or detailed view.

See also:
readConfig , setViewConfig

Definition at line 1331 of file kdiroperator.cpp.

References QString::fromLatin1(), KToggleAction::isChecked(), QString::isEmpty(), and QWidget::style().

Referenced by KFileDialog::writeConfig().

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

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

Definition at line 1400 of file kdiroperator.cpp.

References KFileView::setOnlyDoubleClickSelectsFiles().

Referenced by KFileDialog::init().

bool KDirOperator::onlyDoubleClickSelectsFiles  
 

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

Definition at line 1407 of file kdiroperator.cpp.

bool KDirOperator::mkdir const QString   directory,
bool    enterDirectory = true
 

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.

Definition at line 348 of file kdiroperator.cpp.

References KURL::addPath(), KURL::isLocalFile(), KIO::NetAccess::mkdir(), KURL::path(), setURL(), KMessageBox::sorry(), url(), and viewWidget().

KIO::DeleteJob * KDirOperator::del const KFileItemList &    items,
bool    ask = true,
bool    showProgress = true
 

Starts and returns a KIO::DeleteJob to delete the given items.

Parameters:
ask  specifies whether a confirmation dialog should be shown
showProgress  passed to the DeleteJob to show a progress dialog

Definition at line 374 of file kdiroperator.cpp.

Referenced by deleteSelected().

KIO::DeleteJob * KDirOperator::del const KFileItemList &    items,
QWidget   parent,
bool    ask = true,
bool    showProgress = true
 

Starts and returns a KIO::DeleteJob to delete the given items.

Parameters:
parent  the parent widget used for the confirmation dialog
ask  specifies whether a confirmation dialog should be shown
showProgress  passed to the DeleteJob to show a progress dialog
Since:
3.1

Definition at line 380 of file kdiroperator.cpp.

References QPtrList< KFileItem >::count(), QPtrListIterator< KFileItem >::current(), KIO::del(), KMessageBox::information(), QPtrList< KFileItem >::isEmpty(), KURL::isLocalFile(), KURL::path(), KURL::prettyURL(), KIO::Job::setAutoErrorHandlingEnabled(), KURL::url(), url(), KMessageBox::warningContinueCancel(), and KMessageBox::warningContinueCancelList().

void KDirOperator::clearHistory  
 

Clears the forward and backward history.

Definition at line 1461 of file kdiroperator.cpp.

References QPtrStack< KURL >::clear(), and KAction::setEnabled().

Referenced by KFileDialog::getExistingDirectory(), KFileDialog::getExistingURL(), KFileDialog::getOpenFileName(), KFileDialog::getOpenFileNames(), KFileDialog::getOpenURL(), KFileDialog::getOpenURLs(), and KFileDialog::setPreviewWidget().

void KDirOperator::setEnableDirHighlighting bool    enable
 

When going up in the directory hierarchy, KDirOperator can highlight the directory that was just left.

I.e. when you go from /home/gis/src to /home/gis, the item "src" will be made the current item.

Default is off.

Definition at line 1491 of file kdiroperator.cpp.

bool KDirOperator::dirHighlighting  
 

Returns:
whether the last directory will be made the current item when going up in the directory hierarchy.
Default is false.

Definition at line 1496 of file kdiroperator.cpp.

bool KDirOperator::dirOnlyMode   const [inline]
 

Returns:
true if we are in directory-only mode, that is, no files are shown.

Definition at line 521 of file kdiroperator.h.

Referenced by KFileDialog::setMode(), and setMode().

void KDirOperator::setupMenu int    whichActions
 

Sets up the action menu.

Parameters:
actionTypes  is an value of OR'd ActionTypes that controls which actions to show in the action menu

Definition at line 1184 of file kdiroperator.cpp.

Referenced by KFileDialog::init().

KFileView * KDirOperator::createView QWidget   parent,
KFile::FileView    view
[protected, virtual]
 

A view factory for creating predefined fileviews.

Called internally by setView , but you can also call it directly. Reimplement this if you depend on self defined fileviews.

Parameters:
parent  is the QWidget to be set as parent
view  is the predefined view to be set, note: this can be several ones OR:ed together.
Returns:
the created KFileView
See also:
KFileView , KCombiView , KFileDetailView , KFileIconView , KFilePreview , KFile::FileView , setView

Definition at line 741 of file kdiroperator.cpp.

References KFile::isPreviewInfo(), KFileView::setOnlyDoubleClickSelectsFiles(), KCombiView::setRight(), KFileView::setViewName(), and view().

Referenced by setView().

void KDirOperator::setDirLister KDirLister   lister [protected]
 

Sets a custom KFileReader to list directories.

Definition at line 950 of file kdiroperator.cpp.

References insertNewFiles(), itemDeleted(), and KDirLister::setAutoUpdate().

Referenced by KDirOperator().

void KDirOperator::setupActions   [protected]
 

Sets up all the actions.

Called from the constructor, you usually better not call this.

Definition at line 1084 of file kdiroperator.cpp.

References back(), KStdAction::back(), cdUp(), deleteSelected(), forward(), KStdAction::forward(), QString::fromLatin1(), home(), KStdAction::home(), mkdir(), KStdAction::redisplay(), rereadDir(), KAction::setShortcut(), KAction::setText(), and KStdAction::up().

Referenced by KDirOperator().

void KDirOperator::updateSortActions   [protected]
 

Updates the sorting-related actions to comply with the current sorting.

See also:
sorting

Definition at line 1245 of file kdiroperator.cpp.

References KFileView::isReversed(), and KToggleAction::setChecked().

Referenced by setSorting().

void KDirOperator::updateViewActions   [protected]
 

Updates the view-related actions to comply with the current KFile::FileView.

Definition at line 1262 of file kdiroperator.cpp.

References KToggleAction::setChecked().

void KDirOperator::setupMenu   [protected]
 

Sets up the context-menu with all the necessary actions.

Called from the constructor, you usually don't need to call this.

Since:
3.1

Definition at line 1179 of file kdiroperator.cpp.

Referenced by KDirOperator().

void KDirOperator::prepareCompletionObjects   [protected]
 

Synchronizes the completion objects with the entries of the currently listed url.

Automatically called from makeCompletion() and makeDirCompletion()

Definition at line 1060 of file kdiroperator.cpp.

References KCompletion::addItem(), QPtrListIterator< KFileItem >::current(), KFileItem::isDir(), KFileView::items(), and KFileItem::name().

Referenced by makeCompletion(), and makeDirCompletion().

bool KDirOperator::checkPreviewSupport   [protected]
 

Checks if there support from KIO::PreviewJob for the currently shown files, taking mimeFilter() and nameFilter() into account Enables/disables the preview-action accordingly.

Definition at line 667 of file kdiroperator.cpp.

References KGlobal::config().

Referenced by clearFilter(), setMimeFilter(), and setNameFilter().

void KDirOperator::back   [slot]
 

Goes one step back in the history and opens that url.

Definition at line 605 of file kdiroperator.cpp.

References QPtrStack< KURL >::isEmpty(), QPtrStack< KURL >::pop(), QPtrStack< KURL >::push(), and setURL().

Referenced by pathChanged(), and setupActions().

void KDirOperator::forward   [slot]
 

Goes one step forward in the history and opens that url.

Definition at line 619 of file kdiroperator.cpp.

References QPtrStack< KURL >::isEmpty(), QPtrStack< KURL >::pop(), QPtrStack< KURL >::push(), and setURL().

Referenced by setupActions().

void KDirOperator::home   [slot]
 

Enters the home directory.

Definition at line 643 of file kdiroperator.cpp.

References QDir::homeDirPath(), and setURL().

Referenced by pathChanged(), and setupActions().

void KDirOperator::cdUp   [slot]
 

Goes one directory up from the current url.

Definition at line 636 of file kdiroperator.cpp.

References KURL::cd(), QString::fromLatin1(), and setURL().

Referenced by setupActions().

void KDirOperator::updateDir   [slot]
 

to update the view after changing the settings

Definition at line 553 of file kdiroperator.cpp.

References KDirLister::emitChanges(), and KFileView::listingCompleted().

void KDirOperator::rereadDir   [slot]
 

Re-reads the current url.

Definition at line 560 of file kdiroperator.cpp.

References KDirLister::openURL(), and pathChanged().

Referenced by setupActions().

void KDirOperator::mkdir   [slot]
 

Opens a dialog to create a new directory.

Definition at line 337 of file kdiroperator.cpp.

References QString::fromLatin1(), KLineEditDlg::text(), and url().

Referenced by setupActions().

void KDirOperator::deleteSelected   [slot]
 

Deletes the currently selected files/directories.

Definition at line 432 of file kdiroperator.cpp.

References del(), and KFileView::selectedItems().

Referenced by setupActions().

void KDirOperator::updateSelectionDependentActions   [slot]
 

Enables/disables actions that are selection dependent.

Call this e.g. when you are about to show a popup menu using some of KDirOperators actions.

Definition at line 208 of file kdiroperator.cpp.

References QPtrList< KFileItem >::isEmpty(), and KFileView::selectedItems().

Referenced by activatedMenu().

QString KDirOperator::makeCompletion const QString   [slot]
 

Tries to complete the given string (only completes files).

Definition at line 1038 of file kdiroperator.cpp.

References KFileView::clearSelection(), QString::isEmpty(), KCompletion::makeCompletion(), and prepareCompletionObjects().

QString KDirOperator::makeDirCompletion const QString   [slot]
 

Tries to complete the given string (only completes directores).

Definition at line 1049 of file kdiroperator.cpp.

References KFileView::clearSelection(), QString::isEmpty(), KCompletion::makeCompletion(), and prepareCompletionObjects().

void KDirOperator::resetCursor   [protected, slot]
 

Restores the normal cursor after showing the busy-cursor.

Also hides the progressbar.

Definition at line 172 of file kdiroperator.cpp.

References QApplication::restoreOverrideCursor().

Referenced by close(), insertNewFiles(), setURL(), and ~KDirOperator().

void KDirOperator::pathChanged   [protected, slot]
 

Called after setURL() to load the directory, update the history, etc.

Definition at line 567 of file kdiroperator.cpp.

References back(), KCompletion::clear(), KFileView::clear(), QPtrList< KFileItem >::clear(), KMessageBox::error(), home(), QPtrStack< KURL >::isEmpty(), QApplication::restoreOverrideCursor(), QApplication::setOverrideCursor(), and viewWidget().

Referenced by rereadDir(), and setURL().

void KDirOperator::insertNewFiles const KFileItemList &    newone [protected, slot]
 

Adds a new list of KFileItems to the view (coming from KDirLister).

Definition at line 976 of file kdiroperator.cpp.

References KFileView::addItemList(), QPtrListIterator< KFileItem >::current(), KFileView::ensureItemVisible(), KFileItem::isDir(), QPtrList< KFileItem >::isEmpty(), KFileView::numDirs(), KFileView::numFiles(), resetCursor(), KFileView::setCurrentItem(), QTimer::singleShot(), KURL::url(), and KFileItem::url().

Referenced by setDirLister().

void KDirOperator::itemDeleted KFileItem   [protected, slot]
 

Removes the given KFileItem item from the view (usually called from KDirLister).

Definition at line 1007 of file kdiroperator.cpp.

References KFileView::numDirs(), KFileView::numFiles(), KFileView::removeItem(), and QPtrList< KFileItem >::removeRef().

Referenced by setDirLister().

void KDirOperator::selectDir const KFileItem   item [protected, slot]
 

Enters the directory specified by the given item.

Definition at line 1002 of file kdiroperator.cpp.

References setURL(), and KFileItem::url().

void KDirOperator::selectFile const KFileItem   item [protected, slot]
 

Emits fileSelected( item ).

Definition at line 1014 of file kdiroperator.cpp.

References QApplication::restoreOverrideCursor().

void KDirOperator::highlightFile const KFileItem   i [inline, protected, slot]
 

Emits fileHighlighted( i ).

Definition at line 697 of file kdiroperator.h.

void KDirOperator::activatedMenu const KFileItem  ,
const QPoint   pos
[protected, virtual, slot]
 

Called upon right-click to activate the popupmenu.

Definition at line 201 of file kdiroperator.cpp.

References updateSelectionDependentActions().

void KDirOperator::sortByName   [inline, protected, slot]
 

Changes sorting to sort by name.

Definition at line 707 of file kdiroperator.h.

void KDirOperator::sortBySize   [inline, protected, slot]
 

Changes sorting to sort by size.

Definition at line 712 of file kdiroperator.h.

void KDirOperator::sortByDate   [inline, protected, slot]
 

Changes sorting to sort by date.

Definition at line 717 of file kdiroperator.h.

void KDirOperator::sortReversed   [inline, protected, slot]
 

Changes sorting to reverse sorting.

Definition at line 722 of file kdiroperator.h.

References KToggleAction::isChecked(), and KToggleAction::setChecked().

void KDirOperator::toggleDirsFirst   [inline, protected, slot]
 

Toggles showing directories first / having them sorted like files.

Definition at line 727 of file kdiroperator.h.

References KToggleAction::isChecked(), and KToggleAction::setChecked().

void KDirOperator::toggleIgnoreCase   [inline, protected, slot]
 

Toggles case sensitive / case insensitive sorting.

Definition at line 732 of file kdiroperator.h.

References KToggleAction::isChecked(), and KToggleAction::setChecked().

void KDirOperator::slotCompletionMatch const QString   match [protected, slot]
 

Tries to make the given match as current item in the view and emits completion( match ).

Definition at line 1078 of file kdiroperator.cpp.

References setCurrentItem().

Referenced by KDirOperator().

void KDirOperator::viewChanged KFileView   newView [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.

Referenced by setView().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:35 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001