| Classes | Functions | DevRef | Qt API | Qtopia Documentation |

# FileSelector Class Reference

The FileSelector widget allows the user to select DocLnk objects. More...

`#include <fileselector.h>`

List of all member functions.

## Public Members

- FileSelector ( const QString & f, QWidget * parent, const char * name, bool newVisible = TRUE, bool closeVisible = TRUE )
- ~FileSelector ()
- void setNewVisible ( bool b )
- void setCloseVisible ( bool b )
- void reread ()
- int fileCount ()
- const DocLnk * selected ()

## Signals

- void fileSelected ( const DocLnk & f )
- void newSelected ( const DocLnk & f )
- void closeMe ()

## Detailed Description

The FileSelector widget allows the user to select DocLnk objects.

This class presents a file selection dialog to the user. Use setNewVisible() depending on whether the application can be used to create new files or not. Use setCloseVisible() depending on whether the user may leave the dialog without creating or selecting a document or not. The number of files in the view is available from fileCount(). To force the view to be updated call reread().

If the user presses the 'New Document' button the newSelected() signal is emitted. If the user selects an existing file the fileSelected() signal is emitted. The selected file's DocLnk is available from the selected() function. If the file selector is no longer necessary the closeMe() signal is emitted.

## Member Function Documentation

### FileSelector::FileSelector ( const QString & f, QWidget * parent, const char * name, bool newVisible = TRUE, bool closeVisible = TRUE )

Constructs a FileSelector with mime filter f. The standard Qt parent and name parameters are passed to the parent widget.

If newVisible is TRUE, the widget has a button to allow the user the create "new" documents; this is useful for applications that can create and edit documents but not suitable for applications that only provide viewing.

If closeVisible is TRUE, the widget has a button to allow the user to close the dialog without creating or selecting a document, i.e. this effectively allows the user to select "no document".

See also DocLnkSet::DocLnkSet().

### FileSelector::~FileSelector ()

Destroys the widget.

### void FileSelector::closeMe ()`[signal]`

This signal is emitted when the user no longer needs to view the widget.

### int FileSelector::fileCount ()

Returns the number of files in the view. If this is zero, an editor application might bypass the selector and immediately start with a "new" document.

### void FileSelector::fileSelected ( const DocLnk & f )`[signal]`

This signal is emitted when the user selects a document. f is the document.

### void FileSelector::newSelected ( const DocLnk & f )`[signal]`

This signal is emitted when the user selects a "new" document. f is a DocLnk for the document. You will need to set the type of the document after copying it.

### void FileSelector::reread ()

Rereads the list of documents.

### const DocLnk * FileSelector::selected ()

Returns the selected DocLnk. The caller is responsible for deleting the returned value.

### void FileSelector::setCloseVisible ( bool b )

If b is TRUE a "close" or "no document" button is visible; if b is FALSE this button is not visible and the user is unable to leave the dialog without creating or selecting a document.

### void FileSelector::setNewVisible ( bool b )

If b is TRUE a "new document" button is visible; if b is FALSE this button is not visible and the user is unable to create new documents from the dialog.

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.