Qtopia library API Documentation

FileManager Class Reference

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

List of all members.

Public Member Functions

 FileManager ()
 ~FileManager ()
bool saveFile (const DocLnk &, const QByteArray &data)
bool saveFile (const DocLnk &, const QString &text)
bool loadFile (const DocLnk &, QByteArray &data)
bool loadFile (const DocLnk &, QString &text)
bool copyFile (const AppLnk &src, const AppLnk &dest)
bool copyFile (const QString &src, const QString &dest)
bool renameFile (const QString &, const QString &)
QIODeviceopenFile (const DocLnk &)
QIODevicesaveFile (const DocLnk &)
bool exists (const DocLnk &)

Protected Member Functions

bool ensurePathExists (const QString &fn)


Detailed Description

The FileManager class assists with AppLnk input/output.

Definition at line 30 of file filemanager.h.


Constructor & Destructor Documentation

FileManager::FileManager  ) 
 

Constructs a FileManager.

Definition at line 54 of file filemanager.cpp.

FileManager::~FileManager  ) 
 

Destroys a FileManager.

Definition at line 61 of file filemanager.cpp.


Member Function Documentation

bool FileManager::saveFile const DocLnk f,
const QByteArray data
 

Saves data as the document specified by f.

Returns whether the operation succeeded.

Definition at line 71 of file filemanager.cpp.

References QFile::close(), ensurePathExists(), AppLnk::file(), QString::latin1(), QFile::open(), QFile::remove(), QByteArray::size(), QIODevice::writeBlock(), and AppLnk::writeLink().

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 whether the operation succeeded.

Definition at line 103 of file filemanager.cpp.

References QFile::close(), QByteArray::data(), ensurePathExists(), AppLnk::file(), QString::latin1(), QCString::length(), QFile::open(), QFile::remove(), QString::utf8(), QIODevice::writeBlock(), and AppLnk::writeLink().

bool FileManager::loadFile const DocLnk f,
QByteArray ba
 

Loads ba from the document specified by f.

Returns whether the operation succeeded.

Definition at line 162 of file filemanager.cpp.

References QFile::close(), QByteArray::data(), AppLnk::file(), QFile::open(), QFile::readBlock(), QByteArray::resize(), and QFile::size().

bool FileManager::loadFile const DocLnk f,
QString text
 

Loads text from the document specified by f.

The text is required to be in UTF8 format.

Returns whether the operation succeeded.

Definition at line 138 of file filemanager.cpp.

References QFile::close(), AppLnk::file(), QFile::open(), QTextStream::read(), QTextStream::setCodec(), and QTextStream::setEncoding().

bool FileManager::copyFile const AppLnk src,
const AppLnk dest
 

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

Returns whether the operation succeeded.

Definition at line 181 of file filemanager.cpp.

References QFile::atEnd(), ensurePathExists(), AppLnk::file(), QString::latin1(), QFile::open(), QFile::readBlock(), QFile::remove(), QIODevice::writeBlock(), and AppLnk::writeLink().

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.

Definition at line 388 of file filemanager.cpp.

References AppLnk::file(), and QFile::open().

QIODevice * FileManager::saveFile const DocLnk f  ) 
 

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

Returns 0 if the operation fails.

Definition at line 405 of file filemanager.cpp.

References ensurePathExists(), AppLnk::file(), QFile::open(), and AppLnk::writeLink().

bool FileManager::exists const DocLnk f  ) 
 

Returns whether the document specified by f current exists as a file on disk.

Definition at line 423 of file filemanager.cpp.

References QFile::exists(), and AppLnk::file().

bool FileManager::ensurePathExists const QString fn  )  [protected]
 

Ensures that the path fn exists, by creating required directories. Returns TRUE if successful.

Definition at line 433 of file filemanager.cpp.

References QFileInfo::dirPath(), QFileInfo::exists(), QFileInfo::filePath(), and QFileInfo::setFile().

Referenced by copyFile(), and saveFile().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:19 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001