email_plat/email_services_api/email_services_api.h
changeset 66 084b5b1f02a7
parent 51 d845db10c0d4
child 68 83cc6bae1de8
--- a/email_plat/email_services_api/email_services_api.h	Mon Aug 23 23:32:31 2010 +0300
+++ b/email_plat/email_services_api/email_services_api.h	Fri Sep 03 14:07:42 2010 +0300
@@ -18,6 +18,25 @@
 #ifndef EMAIL_SERVICES_API_H
 #define EMAIL_SERVICES_API_H
 
+// Qt
+#include <QMetaType>
+#include <QString>
+
+// Platform
+#include <xqaiwdeclplat.h>
+
+
+/*!
+    The flags which can be used with the service interfaces.
+*/
+enum EmailServiceInterfaceFlags {
+    EmailNoFlags = 0x0,
+    EmailBackReturnsToMessageList = 0x1
+};
+
+Q_DECLARE_METATYPE(EmailServiceInterfaceFlags)
+
+
 /*!
     Keys for mail send service data.
 */
@@ -28,6 +47,7 @@
 static const QString emailSendBodyTextKey = "body";
 static const QString emailSendAttachmentKey = "attachment";
 
+
 /*!
     Mail service name
 */
@@ -36,12 +56,18 @@
 /*!
     Mail send service interface name.
 */
-static const QString emailInterfaceNameSend = "com.nokia.symbian.IEmailMessageSend";
+static const QString emailFullServiceNameSend = emailServiceName + "." + XQI_EMAIL_MESSAGE_SEND;
 
 /*!
-    Mail send service interface name.
+    Mailbox service full name.
 */
-static const QString emailFullServiceNameSend = emailServiceName + "." + emailInterfaceNameSend;
+static const QString emailFullServiceNameMailbox = emailServiceName + "." + XQI_EMAIL_INBOX_VIEW;
+
+
+/*!
+    Message service full name.
+*/
+static const QString emailFullServiceNameMessage = emailServiceName + "." + XQI_EMAIL_MESSAGE_VIEW;
 
 
 /*!
@@ -67,7 +93,7 @@
         bool syncronous;
 
         XQServiceRequest request(emailFullServiceNameSend,
-                                 emailOperationSendMail,
+                                 XQOP_EMAIL_MESSAGE_SEND,
                                  syncronous);
 
         QMap<QString, QVariant> map;
@@ -87,29 +113,6 @@
         QVariant returnValue;
         bool retVal = request.send(returnValue);
 */
-static const QString emailOperationSendMail = "send(QVariant)";
-
-
-/*!
-    Mailbox service interface name.
-*/
-static const QString emailInterfaceNameMailbox = "com.nokia.symbian.IEmailInboxView";
-
-/*!
-    Mailbox service full name.
-*/
-static const QString emailFullServiceNameMailbox = emailServiceName + "." + emailInterfaceNameMailbox;
-
-
-/*!
-    Message service interface name.
-*/
-static const QString emailInterfaceNameMessage = "com.nokia.symbian.IEmailMessageView";
-
-/*!
-    Message service full name.
-*/
-static const QString emailFullServiceNameMessage = emailServiceName + "." + emailInterfaceNameMessage;
 
 
 /*!
@@ -124,7 +127,7 @@
 
     XQServiceRequest request(
         emailFullServiceNameMailbox,
-        emailOperationViewInbox,
+        XQOP_EMAIL_INBOX_VIEW,
         syncronous);
 
     QList<QVariant> list;
@@ -134,35 +137,57 @@
     QVariant returnValue;
     bool rval = request.send(returnValue);
 */
-static const QString emailOperationViewInbox = "displayInboxByMailboxId(QVariant)";
 
 
 /*!
-    \fn viewMessage(QVariant mailboxId, QVariant folderId, QVariant messageId)
-    \param mailboxId The ID of the mailbox where message is
-    \param folderId The ID of the folder where message is
-    \param messageId The ID of the message to be shown
+    \fn viewMessage(QVariant idList, QVariant flags)
+
+    This method opens the mail viewer view containing the specific message.
+    It is intended to be used via Qt Highway.
+
+
+    \param idList A list containing the required IDs for locating the wanted
+                  message. The ID are the following (and should be placed in
+                  the following order): mailbox ID, folder ID and message ID.
+
+    \param flags The flags which can contain any values defined by
+                 EmailServiceInterfaceFlags enumeration. The only flag
+                 acknowledged by this interface is EmailBackReturnsToMessageList,
+                 which, if given, will add the message list (according to the
+                 given mailbox and folder IDs) into the view stack. This means
+                 that when the back button is pressed from the viewer view, the
+                 message list view will be shown.
+                     
     \return 1 if message was opened. 0 if one of the IDs was incorrect.
 
-    This method opens a view for a specific message.
-    It is intended to be used via Qt Highway.
 
     Usage example:
 
     XQServiceRequest request(
        emailFullServiceNameMessage,
-       emailOperationViewMessage,
-       syncronous);
+       XQOP_EMAIL_MESSAGE_VIEW,
+       synchronous);
+
+    QVariantList idList;
+    idList.append(mailboxId);
+    idList.append(folderId);
+    idList.append(messageId);
+    QVariant idListAsVariant = QVariant::fromValue(idList);
 
-    QList<QVariant> list;
-    list.append(mailboxId);
-    list.append(folderId);
-    list.append(messageId);
-    request.setArguments(list);
+    // Add the message list view into the view stack. If the list view should
+    // not be added into the stack, use "quint64 flags(EmailNoFlags);" instead.
+    quint64 flags(EmailBackReturnsToMessageList);
+
+    QList<QVariant> argumentList;
+    argumentList.append(idListAsVariant);
+    argumentList.append(flags);
+
+    request.setArguments(argumentList);
 
     QVariant returnValue;
+
     bool rval = request.send(returnValue);
 */
-static const QString emailOperationViewMessage = "viewMessage(QVariant,QVariant,QVariant)";
+
 
 #endif // EMAIL_SERVICES_API_H