/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \example serviceactions
    \title Service Actions Example

    This simple example demonstrates how to compose, send, show, query and retrieve messages,
    and also react to message store events using the QtMobility Messaging API.

    Each of these actions is demonstrated in a separate sub example accessible from
    the "File" menu of each platform.

\section1 Send and Compose

    Messages are sent and composed from a composition widget under the "Compose/Send"
    menu. Relevant message details such as sending account, recipients and
    message bodies (attachments for email accounts) can be entered by the user
    via corresponding UI elements. A QMessage is constructed using these details:

    \snippet    ../../demos/serviceactions/mainwindow.cpp construct-message

    The message is then passed to the QMessageService::compose() or QMessageService::send()
    service actions to initiate sending of the message by the platform, or trigger
    display by the platforms' message composer with the QMessage contents:

    \snippet    ../../demos/serviceactions/mainwindow.cpp send-compose-message

\section1 Show

    Messages are displayed by a show widget under the "Show" menu. This widget
    displays the users last 50 messages. (Ensure the platform has one or more messages
    in its mail accounts).

    The last 50 messages (incoming/outgoing) are queried from the store using
    the QMessageService::queryMessages() service request:

    \snippet    ../../demos/serviceactions/mainwindow.cpp load-message

    Once the results of the query are returned via the QMessageService::messagesFound() signal,
    the widget loads each of the returned messages in turn and populates it's list with
    message subjects.

    \snippet    ../../demos/serviceactions/mainwindow.cpp process-results

    \snippet    ../../demos/serviceactions/mainwindow.cpp process-results2

    Selecting "Show" from the action menu will display the selected message using the
    platforms' message viewer via the QMessageService::show() service action.

    \snippet    ../../demos/serviceactions/mainwindow.cpp show-message

\section1 Query and Retrieve

    Message contents are displayed/retrieved by a retrieve widget under the "Query/Retrieve" menu.
    This example displays the last 50 messages, as in the "Show" example, but also displays
    message content in a QTextBrowser widget and provides the option to download messages that are incomplete.

    After the message list is populated, the message display widget will attempt to load
    and display the currently selected message. The completeness of the message body is checked using the
    QMessageContentContainer::isContentAvailable function. If the message body is partially downloaded, a download link
    is displayed.

    \snippet    ../../demos/serviceactions/mainwindow.cpp partial-message-check

    When the download link is clicked, the message body is retrieved using the QMessageService::retrieveBody() service action.

    \snippet    ../../demos/serviceactions/mainwindow.cpp retrieve-message-body

\section1 Store Signals

    This example displays the activities of the QMessageManager in a QListWidget by connecting to QMessageManager::message(Added/Updated/Removed) signals.

    \snippet    ../../demos/serviceactions/mainwindow.cpp store-signals

*/


