summaryrefslogtreecommitdiffstats
path: root/doc/src/examples/serviceactions.qdoc
blob: f8937d15d796d6a93aaf8da6ef939f1e13490253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/****************************************************************************
**
** Copyright (C) 2012 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$
** GNU Free Documentation License
** 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms
** and conditions contained in a signed written agreement between you
** and Nokia.
**
**
**
**
**
** $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

*/