Home · All Classes · Grouped Classes · Annotated · Functions

QDocumentSelectorService Class Reference

The QDocumentSelectorService class provides an interface for low-privilege applications to open to user selected documents. More...

    #include <QDocumentSelectorService>

Inherits QObject.

Public Functions

Public Slots

Signals

Additional Inherited Members


Detailed Description

The QDocumentSelectorService class provides an interface for low-privilege applications to open to user selected documents.

Applications with insufficient permissions to access the Qtopia Document System directly may use the document selector service to request that a server application open files on their behalf. Rather that opening a document specified by the application, the server displays a document selector for the user to select a document which is then opened and read access granted to the application.

Documents may also write to files by requesting permission to either save an already open document or create a new document. In both cases the user must confirm they wish to save the document before the server will open it in write-only mode.

Only one document may be opened by the service at a time. The currently opened document may be retrieved using the selectedDocument() method and the selectedDocumentData() method returns a QIODevice through the the document may be read from or written to.

See also QDocumentSelector.


Member Function Documentation

QDocumentSelectorService::QDocumentSelectorService ( QObject * parent = 0 )

Contructs a new document selector service with the given parent.

QDocumentSelectorService::~QDocumentSelectorService ()   [virtual]

Destroys the document selector service.

void QDocumentSelectorService::close ()   [slot]

Closes the selected document QIODevice and clears the selected document.

If the service is displaying a dialog that will also be closed.

To close the document without clearing the selection close the QIODevice returned by selectedDocumentData() instead.

void QDocumentSelectorService::documentOpened ( const QContent & document, QIODevice * data )   [signal]

Signals that a document has been opened and it may be read from or written to using data.

After this signal has been emitted the values of document and data may be acquired from the selectedDocument() and selectedDocumentData() methods.

QContentFilter QDocumentSelectorService::filter () const

Returns the services document selector's content filter.

See also setFilter().

bool QDocumentSelectorService::newDocument ( const QString & name, const QString & type, QWidget * widget = 0 )

Attempts to create a new document.

The user will be prompted with a suggested name and the type to save the document as. Returns true if the user accepts and the document was succesfully created; false otherwise.

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in write-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

bool QDocumentSelectorService::newDocument ( const QString & name, const QStringList & types, QWidget * widget = 0 )

This is an overloaded member function, provided for convenience.

Attempts to create a new document.

The user will be prompted with a suggested name and possible mime types to save the document as. Returns true if the user accepts and the document was succesfully created; false otherwise.

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in write-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

bool QDocumentSelectorService::openDocument ( QWidget * widget = 0 )

Prompts the user to select a document to open in read-only mode. Returns true if the user selects a document and it is successfully opened; false otherwise.

The content displayed in the selector may be altered by setting the content filter with setFilter() and the sort order with sortOrder().

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in read-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

bool QDocumentSelectorService::saveDocument ( QWidget * widget = 0 )

Tries to open the last opened document in write only mode so changes can be saved.

The user will be prompted before the document is opened. Returns true if the user accepts and the document was succesfully opened; false otherwise.

If successful the documentOpened() signal will be emitted with the document QContent and a pointer to the document QIODevice opened in write-only mode. These can also be obtained from the selectedDocument() and selectedDocumentData() methods respectively upon return.

The dialog displayed will parented off the given widget.

See also selectedDocument() and selectedDocumentData().

QContent QDocumentSelectorService::selectedDocument () const

Returns the last selected document.

QIODevice * QDocumentSelectorService::selectedDocumentData ()

Returns a pointer to the data of the selected document.

The service retains ownership of the returned QIODevice.

See also selectedDocument().

void QDocumentSelectorService::setFilter ( const QContentFilter & filter )

Sets the service document selector's content filter.

See also filter().

void QDocumentSelectorService::setSortCriteria ( const QContentSortCriteria & sort )

Sets the sort criteria of the service document selector.

See also sortCriteria().

QContentSortCriteria QDocumentSelectorService::sortCriteria () const

Returns the sort mode of the service document selector.

See also setSortCriteria().


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3