class KFileBaseDialog

A file selection dialog. More...

Contains pure virtuals
Definition#include <kfiledialog.h>
InheritsQDialog (qt)
Inherited byKDirDialog, KFileDialog, KFilePreviewDialog
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members

Protected Slots

Signals


Detailed Description

The KFileDialog widget provides a user (and developer) friendly way to select files. The widget can be used as a drop in replacement for the QFileDialog widget, but has greater functionality and a nicer GUI.

You will usually want to use one of the two static methods KFileDialog::getOpenFileName or KFileDialog::getSaveFileName.

The dialog has been designed to allow applications to customise it by subclassing. It uses geometry management to ensure that subclasses can easily add children which will be incorperated into the layout.

KFileBaseDialog (const char *dirName, const char *filter= 0, QWidget *parent= 0, const char *name= 0, bool modal = false, bool acceptURLs = true)

Construct a KFileBaseDialog

Parameters:
dirNameThe name of the directory to start in.
filterA shell glob that specifies which files to display. see setFilter for details on how to use this argument
acceptURLsIf set to false, kfiledialog will just accept files on the local filesystem.

~KFileBaseDialog ()

Cleans up

QString selectedFile ()

Returns the fully qualified filename.

QString dirPath ()

Return the path of the selected directory.

void rereadDir ()

Rereads the currently selected directory.

void back ()

Go back to the previous directory if this is not the first.

void forward ()

Go forward to the next directory if this is not the last.

void home ()

Go home.

void cdUp ()

Go to parent.

bool dirIsLocal ()
[const]

Returns true for local files, false for remote files.

QString selectedFileURL ()

Returns the url of the selected filename

QStrList selectedFileURLList ()

Returns the URLs of the selected files.

void setMultiSelection (bool multi= true)

If the argument is true the dialog will accept multiple selections.

bool isMultiSelection ()
[const]

Returns true if multiple selections are enabled.

QString getDirectory (const char *url, QWidget *parent = 0, const char *name = 0)
[static]

This method creates a modal directory dialog and returns the selected directory or an empty string if none was chosen. Note that with this method the user must select an existing directory.

Parameters:
urlThis specifies the path the dialog will start in.
parentThe widget the dialog will be centered on initially.
nameThe name of the dialog widget.

QStrList getOpenFileURLList (const char *url= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0)

This a multiple selection version of getOpenFileURL().

QStrList getSaveFileURLList (const char *url= 0, const char *filter= 0, QWidget *parent= 0, const char *name= 0)

This a multiple selection version of getSaveFileURL().

void setDir (const char *name, bool clearforward = true)

Sets the directory to view

Parameters:
nameURL to show
clearforwardindicate, if the forward queue should be cleared

void setSelection (const char *name)

Sets the filename to preselect. It takes absolute and relative file names

void setFilter (const char *filter)

Sets the filter to be used to filter. You can set more filters for the user to select seperated by \n. Every filter entry is defined through namefilter|text to diplay. If no | is found in the expression, just the namefilter is shown. Examples:


 kfile->setFilter("*.cpp|C++ Source Files\n*.h|Header files");
 kfile->setFilter("*.cpp");
 kfile->setFilter("*.cpp|Sources (*.cpp");

Note: the text to display is not parsed in any way. So, if you want to show the suffix to select by a specific filter, you must repeat it.

void fileSelected (const char *)
[signal]

Emitted when the user selects a file.

void fileHighlighted (const char *)
[signal]

Emitted when the user highlights a file.

void dirEntered (const char *)
[signal]

Emitted when a new directory is entered.

void historyUpdate (bool, bool)
[signal]

Emitted when the allowable history operations change.

QStack<QString> backStack
[protected]

Contains all URLs you can reach with the back button.

QStack<QString> forwardStack
[protected]

Contains all URLs you can reach with the forward button.

bool stackLock
[protected]

Lock backStack and forwardStack .

QWidget * swallower ()
[protected virtual]

Subclasses should reimplement this method to swallow the main layout. This allows the addition of children that are outside the existing layout. The function should return the widget that should be the parent of the main layout.

KFileInfoContents * initFileList ( QWidget *parent )
[protected pure virtual]

Subclasses, that want another view should override this function to provide another file view. It will be used to display files.

bool getShowFilter ()
[protected pure virtual]

Overload this function, if you want the filter shown/unshown

void addDirEntry (KFileInfo *entry, bool disableUpdating)
[protected]

adds a entry of the current directory. If disableUpdating is set to true, it will care about clever updating

void initGUI ()
[protected]

rebuild geometry managment.

void mkdir ()
[protected]

Makes a new directory in current directory after asking user for a name

void checkPath (const char *txt, bool takeFiles = false)
[protected]

takes action on the new location. If it's a directory, change into it, if it's a file, correct the name, etc.

Parameters:
takeFilesif set to true, if will close the dialog, if txt is a file name

void init ()
[protected]

this functions must be called by the constructor of a derived class.

void help ()
[protected virtual slot]

You should override this method if you change the user interface of this dialog in a subclass in order to invoke your updated user help.

void addToBookmarks ()
[protected slot]

Add the current location to the global bookmarks list