emailservices/nmclientapi/src/nmapimessagemanager.cpp
author hgs
Thu, 30 Sep 2010 11:43:07 +0300
changeset 74 6c59112cfd31
parent 68 83cc6bae1de8
permissions -rw-r--r--
201039
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
 * All rights reserved.
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
 *
hgs
parents:
diff changeset
     9
 * Initial Contributors:
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
 *
hgs
parents:
diff changeset
    12
 * Contributors:
hgs
parents:
diff changeset
    13
 *
hgs
parents:
diff changeset
    14
 * Description:
hgs
parents:
diff changeset
    15
 *     Email message related operations
hgs
parents:
diff changeset
    16
 */
48
10eaf342f539 201025_1
hgs
parents: 47
diff changeset
    17
 
10eaf342f539 201025_1
hgs
parents: 47
diff changeset
    18
#include "nmapiheaders.h"
47
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
hgs
parents:
diff changeset
    21
/*!
hgs
parents:
diff changeset
    22
    \class NmApiMessageManager
hgs
parents:
diff changeset
    23
    \brief A class for performing various operations on messages.
hgs
parents:
diff changeset
    24
 */
hgs
parents:
diff changeset
    25
 
hgs
parents:
diff changeset
    26
 
hgs
parents:
diff changeset
    27
namespace EmailClientApi
hgs
parents:
diff changeset
    28
{
hgs
parents:
diff changeset
    29
68
hgs
parents: 48
diff changeset
    30
NmApiMessageManager::NmApiMessageManager(QObject *parent, quint64 mailboxId)
47
hgs
parents:
diff changeset
    31
	:QObject(parent)
hgs
parents:
diff changeset
    32
{
68
hgs
parents: 48
diff changeset
    33
	d = new NmApiMessageManagerPrivate(this, mailboxId);
47
hgs
parents:
diff changeset
    34
}
hgs
parents:
diff changeset
    35
hgs
parents:
diff changeset
    36
NmApiMessageManager::~NmApiMessageManager()
hgs
parents:
diff changeset
    37
{
hgs
parents:
diff changeset
    38
}
hgs
parents:
diff changeset
    39
   
74
hgs
parents: 68
diff changeset
    40
/*!
hgs
parents: 68
diff changeset
    41
 \fn createDraftMessage 
hgs
parents: 68
diff changeset
    42
 \param initData Initializing data. Can contain NULL value.
hgs
parents: 68
diff changeset
    43
 \return Create draft message operation.
hgs
parents: 68
diff changeset
    44
 
hgs
parents: 68
diff changeset
    45
 Creates a new email message. Returns create draft message operation. 
hgs
parents: 68
diff changeset
    46
 */
hgs
parents: 68
diff changeset
    47
QPointer<NmApiOperation> NmApiMessageManager::createDraftMessage(const QVariant *initData)
47
hgs
parents:
diff changeset
    48
{
hgs
parents:
diff changeset
    49
    NM_FUNCTION;
74
hgs
parents: 68
diff changeset
    50
    return d->createDraftMessage(initData);
47
hgs
parents:
diff changeset
    51
}
hgs
parents:
diff changeset
    52
    
hgs
parents:
diff changeset
    53
    // creates fw message
hgs
parents:
diff changeset
    54
    // signaled with forwardMessageCreated(NmApiMessage *message,int result) 
hgs
parents:
diff changeset
    55
    //    * ownership transferred
74
hgs
parents: 68
diff changeset
    56
QPointer<NmApiOperation> NmApiMessageManager::createForwardMessage(NmApiMessage *orig,const QVariant *initData)
47
hgs
parents:
diff changeset
    57
 {
hgs
parents:
diff changeset
    58
    NM_FUNCTION;
hgs
parents:
diff changeset
    59
    Q_UNUSED(initData);
68
hgs
parents: 48
diff changeset
    60
    Q_UNUSED(orig);
74
hgs
parents: 68
diff changeset
    61
	return 0;
47
hgs
parents:
diff changeset
    62
 }
hgs
parents:
diff changeset
    63
    
hgs
parents:
diff changeset
    64
    // creates reply message
hgs
parents:
diff changeset
    65
    // signaled with replyMessageCreated(NmApiMessage *message,int result) 
hgs
parents:
diff changeset
    66
    //    * ownership transferred
74
hgs
parents: 68
diff changeset
    67
QPointer<NmApiOperation> NmApiMessageManager::createReplyMessage(const NmApiMessage *orig,
68
hgs
parents: 48
diff changeset
    68
        const QVariant *initData,bool replyAll)
47
hgs
parents:
diff changeset
    69
{
hgs
parents:
diff changeset
    70
    NM_FUNCTION;
68
hgs
parents: 48
diff changeset
    71
    Q_UNUSED(orig);
47
hgs
parents:
diff changeset
    72
    Q_UNUSED(initData);
hgs
parents:
diff changeset
    73
    Q_UNUSED(replyAll);
74
hgs
parents: 68
diff changeset
    74
	return 0;
47
hgs
parents:
diff changeset
    75
}
hgs
parents:
diff changeset
    76
 
hgs
parents:
diff changeset
    77
/*!
hgs
parents:
diff changeset
    78
 \fn moveMessages 
hgs
parents:
diff changeset
    79
 \param messageIds Id list of source messages.
hgs
parents:
diff changeset
    80
 \param sourceFolderId Id of the source folder.
hgs
parents:
diff changeset
    81
 \param targetFolderId Id of the target folder.
hgs
parents:
diff changeset
    82
 \return true if operation was successfully started.
hgs
parents:
diff changeset
    83
 
hgs
parents:
diff changeset
    84
 Starts async move operation for given messages.  
hgs
parents:
diff changeset
    85
 Completion signalled with messagesMoved(int result).
hgs
parents:
diff changeset
    86
 */
74
hgs
parents: 68
diff changeset
    87
QPointer<NmApiOperation> NmApiMessageManager::moveMessages(const QList<quint64> messageIds,
47
hgs
parents:
diff changeset
    88
									quint64 sourceFolderId,
hgs
parents:
diff changeset
    89
									quint64 targetFolderId)
hgs
parents:
diff changeset
    90
{    
68
hgs
parents: 48
diff changeset
    91
    NM_FUNCTION;
hgs
parents: 48
diff changeset
    92
    Q_UNUSED(messageIds);
hgs
parents: 48
diff changeset
    93
    Q_UNUSED(sourceFolderId);
hgs
parents: 48
diff changeset
    94
    Q_UNUSED(targetFolderId);
74
hgs
parents: 68
diff changeset
    95
    return 0;
68
hgs
parents: 48
diff changeset
    96
	//return d->moveMessages(messageIds,sourceFolderId,targetFolderId);
47
hgs
parents:
diff changeset
    97
}
hgs
parents:
diff changeset
    98
    
74
hgs
parents: 68
diff changeset
    99
/*!
hgs
parents: 68
diff changeset
   100
 \fn saveMessage 
hgs
parents: 68
diff changeset
   101
 \param message Message to be saved (note that message must exists to complete successfully).
hgs
parents: 68
diff changeset
   102
 \return Save message operation.
hgs
parents: 68
diff changeset
   103
 
hgs
parents: 68
diff changeset
   104
 Saves email message. Message must be created before this operation with createDraftMessage/createForwardMessage/
hgs
parents: 68
diff changeset
   105
 createReplyMessage operation. Operation will run unsuccessfully, if message haven't created before. 
hgs
parents: 68
diff changeset
   106
 Returns save message operation. 
hgs
parents: 68
diff changeset
   107
 */
hgs
parents: 68
diff changeset
   108
QPointer<NmApiOperation> NmApiMessageManager::saveMessage(const NmApiMessage &message)
47
hgs
parents:
diff changeset
   109
{
74
hgs
parents: 68
diff changeset
   110
    return d->saveMessage(message);
47
hgs
parents:
diff changeset
   111
}
hgs
parents:
diff changeset
   112
    
hgs
parents:
diff changeset
   113
// deletes message
hgs
parents:
diff changeset
   114
// signaled with messagesDeleted(int result)
74
hgs
parents: 68
diff changeset
   115
QPointer<NmApiOperation> NmApiMessageManager::deleteMessages(const QList<quint64> messageIds)
47
hgs
parents:
diff changeset
   116
{
hgs
parents:
diff changeset
   117
    Q_UNUSED(messageIds);
74
hgs
parents: 68
diff changeset
   118
	return 0;
47
hgs
parents:
diff changeset
   119
}
hgs
parents:
diff changeset
   120
    
hgs
parents:
diff changeset
   121
    // starts fetching rest of message body from server
hgs
parents:
diff changeset
   122
    // signaled with messageFetched(quint64 messageId, int result)
74
hgs
parents: 68
diff changeset
   123
QPointer<NmApiOperation> NmApiMessageManager::fetchMessage(quint64 messageId)
47
hgs
parents:
diff changeset
   124
{
68
hgs
parents: 48
diff changeset
   125
    Q_UNUSED(messageId);
74
hgs
parents: 68
diff changeset
   126
	return 0;
47
hgs
parents:
diff changeset
   127
}
hgs
parents:
diff changeset
   128
    
74
hgs
parents: 68
diff changeset
   129
/*!
hgs
parents: 68
diff changeset
   130
 \fn sendMessage 
hgs
parents: 68
diff changeset
   131
 \param message Message to be sent (note that message must exists to complete successfully).
hgs
parents: 68
diff changeset
   132
 \return Send message operation.
hgs
parents: 68
diff changeset
   133
 
hgs
parents: 68
diff changeset
   134
 Sends email message. Message must be created before this operation with createDraftMessage/createForwardMessage/
hgs
parents: 68
diff changeset
   135
 createReplyMessage operation. Operation will run unsuccessfully, if message haven't created before. 
hgs
parents: 68
diff changeset
   136
 Returns send message operation. 
hgs
parents: 68
diff changeset
   137
 */
hgs
parents: 68
diff changeset
   138
QPointer<NmApiOperation> NmApiMessageManager::sendMessage(const NmApiMessage &message)
47
hgs
parents:
diff changeset
   139
{
74
hgs
parents: 68
diff changeset
   140
    NM_FUNCTION;
hgs
parents: 68
diff changeset
   141
    return d->sendMessage(message);
47
hgs
parents:
diff changeset
   142
}
hgs
parents:
diff changeset
   143
hgs
parents:
diff changeset
   144
// creates new attachment for a message. Currently attachment can be specified as file name (attachmentSpec is QString)
hgs
parents:
diff changeset
   145
// signaled with attachmentCreated(quint64 attachemntId)
hgs
parents:
diff changeset
   146
//  * 
74
hgs
parents: 68
diff changeset
   147
QPointer<NmApiOperation> NmApiMessageManager::createAttachment(NmApiMessage &message,
47
hgs
parents:
diff changeset
   148
										const QVariant &attachmenSpec)
hgs
parents:
diff changeset
   149
{
hgs
parents:
diff changeset
   150
    Q_UNUSED(message);
hgs
parents:
diff changeset
   151
    Q_UNUSED(attachmenSpec);
74
hgs
parents: 68
diff changeset
   152
    return 0;
47
hgs
parents:
diff changeset
   153
}
hgs
parents:
diff changeset
   154
                                                      
hgs
parents:
diff changeset
   155
// removes attachment from a message
hgs
parents:
diff changeset
   156
// signaled with attachmentRemoved(int result)
74
hgs
parents: 68
diff changeset
   157
QPointer<NmApiOperation> NmApiMessageManager::removeAttachment(NmApiMessage &message,
68
hgs
parents: 48
diff changeset
   158
quint64 attachmentId)
47
hgs
parents:
diff changeset
   159
{    
hgs
parents:
diff changeset
   160
    Q_UNUSED(message);
68
hgs
parents: 48
diff changeset
   161
    Q_UNUSED(attachmentId);
74
hgs
parents: 68
diff changeset
   162
    return 0;
68
hgs
parents: 48
diff changeset
   163
}
hgs
parents: 48
diff changeset
   164
74
hgs
parents: 68
diff changeset
   165
QPointer<NmApiOperation> NmApiMessageManager::fetchAttachment(const NmApiMessage &relatedMessage,
68
hgs
parents: 48
diff changeset
   166
        quint64 attachmentId)
hgs
parents: 48
diff changeset
   167
{
hgs
parents: 48
diff changeset
   168
    Q_UNUSED(relatedMessage);
hgs
parents: 48
diff changeset
   169
    Q_UNUSED(attachmentId);
74
hgs
parents: 68
diff changeset
   170
    return 0;
47
hgs
parents:
diff changeset
   171
}
hgs
parents:
diff changeset
   172
 
hgs
parents:
diff changeset
   173
} // namespace EmailClientApi
hgs
parents:
diff changeset
   174
hgs
parents:
diff changeset
   175