email_plat/email_services_api/email_services_api.h
changeset 72 64e38f08e49c
parent 59 16ed8d08d0b1
child 68 83cc6bae1de8
equal deleted inserted replaced
65:478bc57ad291 72:64e38f08e49c
    16 */
    16 */
    17 
    17 
    18 #ifndef EMAIL_SERVICES_API_H
    18 #ifndef EMAIL_SERVICES_API_H
    19 #define EMAIL_SERVICES_API_H
    19 #define EMAIL_SERVICES_API_H
    20 
    20 
       
    21 // Qt
       
    22 #include <QMetaType>
       
    23 #include <QString>
       
    24 
       
    25 // Platform
       
    26 #include <xqaiwdeclplat.h>
       
    27 
       
    28 
       
    29 /*!
       
    30     The flags which can be used with the service interfaces.
       
    31 */
       
    32 enum EmailServiceInterfaceFlags {
       
    33     EmailNoFlags = 0x0,
       
    34     EmailBackReturnsToMessageList = 0x1
       
    35 };
       
    36 
       
    37 Q_DECLARE_METATYPE(EmailServiceInterfaceFlags)
       
    38 
       
    39 
    21 /*!
    40 /*!
    22     Keys for mail send service data.
    41     Keys for mail send service data.
    23 */
    42 */
    24 static const QString emailSendSubjectKey = "subject";
    43 static const QString emailSendSubjectKey = "subject";
    25 static const QString emailSendToKey = "to";
    44 static const QString emailSendToKey = "to";
    26 static const QString emailSendCcKey = "cc";
    45 static const QString emailSendCcKey = "cc";
    27 static const QString emailSendBccKey = "bcc";
    46 static const QString emailSendBccKey = "bcc";
    28 static const QString emailSendBodyTextKey = "body";
    47 static const QString emailSendBodyTextKey = "body";
    29 static const QString emailSendAttachmentKey = "attachment";
    48 static const QString emailSendAttachmentKey = "attachment";
    30 
    49 
       
    50 
    31 /*!
    51 /*!
    32     Mail service name
    52     Mail service name
    33 */
    53 */
    34 static const QString emailServiceName("nmail");
    54 static const QString emailServiceName("nmail");
    35 
    55 
    36 /*!
    56 /*!
    37     Mail send service interface name.
    57     Mail send service interface name.
    38 */
    58 */
    39 static const QString emailInterfaceNameSend = "com.nokia.symbian.IEmailMessageSend";
    59 static const QString emailFullServiceNameSend = emailServiceName + "." + XQI_EMAIL_MESSAGE_SEND;
    40 
    60 
    41 /*!
    61 /*!
    42     Mail send service interface name.
    62     Mailbox service full name.
    43 */
    63 */
    44 static const QString emailFullServiceNameSend = emailServiceName + "." + emailInterfaceNameSend;
    64 static const QString emailFullServiceNameMailbox = emailServiceName + "." + XQI_EMAIL_INBOX_VIEW;
       
    65 
       
    66 
       
    67 /*!
       
    68     Message service full name.
       
    69 */
       
    70 static const QString emailFullServiceNameMessage = emailServiceName + "." + XQI_EMAIL_MESSAGE_VIEW;
    45 
    71 
    46 
    72 
    47 /*!
    73 /*!
    48     \fn send(QVariant data)
    74     \fn send(QVariant data)
    49     \param data The email message data e.g. recipients.
    75     \param data The email message data e.g. recipients.
    65     Usage example:
    91     Usage example:
    66 
    92 
    67         bool syncronous;
    93         bool syncronous;
    68 
    94 
    69         XQServiceRequest request(emailFullServiceNameSend,
    95         XQServiceRequest request(emailFullServiceNameSend,
    70                                  emailOperationSendMail,
    96                                  XQOP_EMAIL_MESSAGE_SEND,
    71                                  syncronous);
    97                                  syncronous);
    72 
    98 
    73         QMap<QString, QVariant> map;
    99         QMap<QString, QVariant> map;
    74 
   100 
    75         QStringList recipients;
   101         QStringList recipients;
    85         request.setArguments(data);
   111         request.setArguments(data);
    86 
   112 
    87         QVariant returnValue;
   113         QVariant returnValue;
    88         bool retVal = request.send(returnValue);
   114         bool retVal = request.send(returnValue);
    89 */
   115 */
    90 static const QString emailOperationSendMail = "send(QVariant)";
       
    91 
       
    92 
       
    93 /*!
       
    94     Mailbox service interface name.
       
    95 */
       
    96 static const QString emailInterfaceNameMailbox = "com.nokia.symbian.IEmailInboxView";
       
    97 
       
    98 /*!
       
    99     Mailbox service full name.
       
   100 */
       
   101 static const QString emailFullServiceNameMailbox = emailServiceName + "." + emailInterfaceNameMailbox;
       
   102 
       
   103 
       
   104 /*!
       
   105     Message service interface name.
       
   106 */
       
   107 static const QString emailInterfaceNameMessage = "com.nokia.symbian.IEmailMessageView";
       
   108 
       
   109 /*!
       
   110     Message service full name.
       
   111 */
       
   112 static const QString emailFullServiceNameMessage = emailServiceName + "." + emailInterfaceNameMessage;
       
   113 
   116 
   114 
   117 
   115 /*!
   118 /*!
   116     \fn displayInboxByMailboxId(QVariant data)
   119     \fn displayInboxByMailboxId(QVariant data)
   117     \param data The ID of the mailbox to open
   120     \param data The ID of the mailbox to open
   122 
   125 
   123     Usage example:
   126     Usage example:
   124 
   127 
   125     XQServiceRequest request(
   128     XQServiceRequest request(
   126         emailFullServiceNameMailbox,
   129         emailFullServiceNameMailbox,
   127         emailOperationViewInbox,
   130         XQOP_EMAIL_INBOX_VIEW,
   128         syncronous);
   131         syncronous);
   129 
   132 
   130     QList<QVariant> list;
   133     QList<QVariant> list;
   131     list.append(QVariant(id));
   134     list.append(QVariant(id));
   132     request.setArguments(list);
   135     request.setArguments(list);
   133 
   136 
   134     QVariant returnValue;
   137     QVariant returnValue;
   135     bool rval = request.send(returnValue);
   138     bool rval = request.send(returnValue);
   136 */
   139 */
   137 static const QString emailOperationViewInbox = "displayInboxByMailboxId(QVariant)";
       
   138 
   140 
   139 
   141 
   140 /*!
   142 /*!
   141     \fn viewMessage(QVariant mailboxId, QVariant folderId, QVariant messageId)
   143     \fn viewMessage(QVariant idList, QVariant flags)
   142     \param mailboxId The ID of the mailbox where message is
   144 
   143     \param folderId The ID of the folder where message is
   145     This method opens the mail viewer view containing the specific message.
   144     \param messageId The ID of the message to be shown
   146     It is intended to be used via Qt Highway.
       
   147 
       
   148 
       
   149     \param idList A list containing the required IDs for locating the wanted
       
   150                   message. The ID are the following (and should be placed in
       
   151                   the following order): mailbox ID, folder ID and message ID.
       
   152 
       
   153     \param flags The flags which can contain any values defined by
       
   154                  EmailServiceInterfaceFlags enumeration. The only flag
       
   155                  acknowledged by this interface is EmailBackReturnsToMessageList,
       
   156                  which, if given, will add the message list (according to the
       
   157                  given mailbox and folder IDs) into the view stack. This means
       
   158                  that when the back button is pressed from the viewer view, the
       
   159                  message list view will be shown.
       
   160                      
   145     \return 1 if message was opened. 0 if one of the IDs was incorrect.
   161     \return 1 if message was opened. 0 if one of the IDs was incorrect.
   146 
   162 
   147     This method opens a view for a specific message.
       
   148     It is intended to be used via Qt Highway.
       
   149 
   163 
   150     Usage example:
   164     Usage example:
   151 
   165 
   152     XQServiceRequest request(
   166     XQServiceRequest request(
   153        emailFullServiceNameMessage,
   167        emailFullServiceNameMessage,
   154        emailOperationViewMessage,
   168        XQOP_EMAIL_MESSAGE_VIEW,
   155        syncronous);
   169        synchronous);
   156 
   170 
   157     QList<QVariant> list;
   171     QVariantList idList;
   158     list.append(mailboxId);
   172     idList.append(mailboxId);
   159     list.append(folderId);
   173     idList.append(folderId);
   160     list.append(messageId);
   174     idList.append(messageId);
   161     request.setArguments(list);
   175     QVariant idListAsVariant = QVariant::fromValue(idList);
       
   176 
       
   177     // Add the message list view into the view stack. If the list view should
       
   178     // not be added into the stack, use "quint64 flags(EmailNoFlags);" instead.
       
   179     quint64 flags(EmailBackReturnsToMessageList);
       
   180 
       
   181     QList<QVariant> argumentList;
       
   182     argumentList.append(idListAsVariant);
       
   183     argumentList.append(flags);
       
   184 
       
   185     request.setArguments(argumentList);
   162 
   186 
   163     QVariant returnValue;
   187     QVariant returnValue;
       
   188 
   164     bool rval = request.send(returnValue);
   189     bool rval = request.send(returnValue);
   165 */
   190 */
   166 static const QString emailOperationViewMessage = "viewMessage(QVariant,QVariant,QVariant)";
   191 
   167 
   192 
   168 #endif // EMAIL_SERVICES_API_H
   193 #endif // EMAIL_SERVICES_API_H