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

# FileManager Class Reference

The FileManager class assists with AppLnk input/output. More...

`#include <filemanager.h>`

List of all member functions.

## Public Members

- FileManager ()
- ~FileManager ()
- bool saveFile ( const DocLnk & f, const QByteArray & data )
- bool saveFile ( const DocLnk & f, const QString & text )
- bool loadFile ( const DocLnk & f, QByteArray & ba )
- bool loadFile ( const DocLnk & f, QString & text )
- bool copyFile ( const AppLnk & src, const AppLnk & dest )
- QIODevice * openFile ( const DocLnk & f )
- QIODevice * saveFile ( const DocLnk & f )
- bool exists ( const DocLnk & f )

## Protected Members

- bool ensurePathExists ( const QString & fn )

## Detailed Description

The FileManager class assists with AppLnk input/output.

The FileManager class is used to loadFile()s and saveFile()s. It also provides a copyFile() function and a function to test for a file's existence, exists(). It also provides openFile() that provides an IO device for reading.

## Member Function Documentation

### FileManager::FileManager ()

Constructs a FileManager object.

### FileManager::~FileManager ()

Destroys the FileManager object.

### bool FileManager::copyFile ( const AppLnk & src, const AppLnk & dest )

Copies the document specified by src to the document specified by dest.

Returns TRUE if the operation succeeded; otherwise returns FALSE.

### bool FileManager::ensurePathExists ( const QString & fn )`[protected]`

Ensures that the path fn exists, by creating required directories.

Returns TRUE if it succeededs; otherwise returns FALSE.

### bool FileManager::exists ( const DocLnk & f )

Returns TRUE if the document specified by f current exists as a file on disk; otherwise returns FALSE.

### bool FileManager::loadFile ( const DocLnk & f, QByteArray & ba )

Loads ba from the document specified by f.

Returns TRUE if the operation succeeded; otherwise returns FALSE.

### bool FileManager::loadFile ( const DocLnk & f, QString & text )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Loads text from the document specified by f.

The text must be in UTF8 format.

Returns TRUE if the operation succeeded; otherwise returns FALSE.

### QIODevice * FileManager::openFile ( const DocLnk & f )

Opens the document specified by f as a readable QIODevice. The caller must delete the return value.

Returns 0 if the operation fails.

### bool FileManager::saveFile ( const DocLnk & f, const QString & text )

Saves text as the document specified by f.

The text is saved in UTF8 format.

Returns TRUE if the operation succeeded; otherwise returns FALSE.

### bool FileManager::saveFile ( const DocLnk & f, const QByteArray & data )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Saves data as the document specified by f.

Returns TRUE if the operation succeeded; otherwise returns FALSE.

### QIODevice * FileManager::saveFile ( const DocLnk & f )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Opens the document specified by f as a writable QIODevice. The caller must delete the return value.

Returns 0 if the operation fails.

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