emailservices/nmclientapi/src/nmapimessagemanager.cpp
author hgs
Thu, 24 Jun 2010 14:32:18 +0300
changeset 47 f83bd4ae1fe3
child 48 10eaf342f539
permissions -rw-r--r--
201025
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
 */
hgs
parents:
diff changeset
    17
#include <nmapimessagemanager.h>
hgs
parents:
diff changeset
    18
#include <nmapifolder.h>
hgs
parents:
diff changeset
    19
#include <nmapiprivateclasses.h>
hgs
parents:
diff changeset
    20
#include "nmapimessagemanager_p.h"
hgs
parents:
diff changeset
    21
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
/*!
hgs
parents:
diff changeset
    24
    \class NmApiMessageManager
hgs
parents:
diff changeset
    25
    \brief A class for performing various operations on messages.
hgs
parents:
diff changeset
    26
 */
hgs
parents:
diff changeset
    27
 
hgs
parents:
diff changeset
    28
 
hgs
parents:
diff changeset
    29
namespace EmailClientApi
hgs
parents:
diff changeset
    30
{
hgs
parents:
diff changeset
    31
hgs
parents:
diff changeset
    32
 NmApiMessageManager::NmApiMessageManager(quint64 mailboxId,QObject *parent)
hgs
parents:
diff changeset
    33
	:QObject(parent)
hgs
parents:
diff changeset
    34
{
hgs
parents:
diff changeset
    35
	d = new NmApiMessageManagerPrivate(mailboxId,this);	
hgs
parents:
diff changeset
    36
	connect(d, SIGNAL(messagesCopied(int)),this,SIGNAL(messagesCopied(int)));
hgs
parents:
diff changeset
    37
	connect(d, SIGNAL(messagesCreated(int)),this,SIGNAL(messagesCreated(int)));
hgs
parents:
diff changeset
    38
	connect(d, SIGNAL(messagesMoved(int)),this,SIGNAL(messagesMoved(int)));
hgs
parents:
diff changeset
    39
	connect(d, SIGNAL(messagesDeleted(int)),this,SIGNAL(messagesDeleted(int)));	
hgs
parents:
diff changeset
    40
}
hgs
parents:
diff changeset
    41
hgs
parents:
diff changeset
    42
NmApiMessageManager::~NmApiMessageManager()
hgs
parents:
diff changeset
    43
{
hgs
parents:
diff changeset
    44
	delete d;
hgs
parents:
diff changeset
    45
}
hgs
parents:
diff changeset
    46
   
hgs
parents:
diff changeset
    47
hgs
parents:
diff changeset
    48
    // creates a new email message
hgs
parents:
diff changeset
    49
    // signaled with draftMessageCreated(NmApiMessage *message,int result) 
hgs
parents:
diff changeset
    50
    //    * ownership transferred
hgs
parents:
diff changeset
    51
bool NmApiMessageManager::createDraftMessage(const QVariant *initData)
hgs
parents:
diff changeset
    52
{
hgs
parents:
diff changeset
    53
    NM_FUNCTION;
hgs
parents:
diff changeset
    54
    Q_UNUSED(initData);
hgs
parents:
diff changeset
    55
	return false;
hgs
parents:
diff changeset
    56
}
hgs
parents:
diff changeset
    57
    
hgs
parents:
diff changeset
    58
    // creates fw message
hgs
parents:
diff changeset
    59
    // signaled with forwardMessageCreated(NmApiMessage *message,int result) 
hgs
parents:
diff changeset
    60
    //    * ownership transferred
hgs
parents:
diff changeset
    61
 bool NmApiMessageManager::createForwardMessage(const QVariant *initData)
hgs
parents:
diff changeset
    62
 {
hgs
parents:
diff changeset
    63
    NM_FUNCTION;
hgs
parents:
diff changeset
    64
    Q_UNUSED(initData);
hgs
parents:
diff changeset
    65
	return false;
hgs
parents:
diff changeset
    66
 }
hgs
parents:
diff changeset
    67
    
hgs
parents:
diff changeset
    68
    // creates reply message
hgs
parents:
diff changeset
    69
    // signaled with replyMessageCreated(NmApiMessage *message,int result) 
hgs
parents:
diff changeset
    70
    //    * ownership transferred
hgs
parents:
diff changeset
    71
bool NmApiMessageManager::createReplyMessage(const QVariant *initData,
hgs
parents:
diff changeset
    72
													bool replyAll)
hgs
parents:
diff changeset
    73
{
hgs
parents:
diff changeset
    74
    NM_FUNCTION;
hgs
parents:
diff changeset
    75
    Q_UNUSED(initData);
hgs
parents:
diff changeset
    76
    Q_UNUSED(replyAll);
hgs
parents:
diff changeset
    77
	return false;
hgs
parents:
diff changeset
    78
}
hgs
parents:
diff changeset
    79
 
hgs
parents:
diff changeset
    80
/*!
hgs
parents:
diff changeset
    81
 \fn moveMessages 
hgs
parents:
diff changeset
    82
 \param messageIds Id list of source messages.
hgs
parents:
diff changeset
    83
 \param sourceFolderId Id of the source folder.
hgs
parents:
diff changeset
    84
 \param targetFolderId Id of the target folder.
hgs
parents:
diff changeset
    85
 \return true if operation was successfully started.
hgs
parents:
diff changeset
    86
 
hgs
parents:
diff changeset
    87
 Starts async move operation for given messages.  
hgs
parents:
diff changeset
    88
 Completion signalled with messagesMoved(int result).
hgs
parents:
diff changeset
    89
 */
hgs
parents:
diff changeset
    90
bool NmApiMessageManager::moveMessages(const QList<quint64> messageIds,
hgs
parents:
diff changeset
    91
									quint64 sourceFolderId,
hgs
parents:
diff changeset
    92
									quint64 targetFolderId)
hgs
parents:
diff changeset
    93
{    
hgs
parents:
diff changeset
    94
	return d->moveMessages(messageIds,sourceFolderId,targetFolderId);
hgs
parents:
diff changeset
    95
}
hgs
parents:
diff changeset
    96
hgs
parents:
diff changeset
    97
/*!
hgs
parents:
diff changeset
    98
 \fn copyMessages 
hgs
parents:
diff changeset
    99
 \param messageIds Id list of source messages.
hgs
parents:
diff changeset
   100
 \param sourceFolder Id of the source folder.
hgs
parents:
diff changeset
   101
 \param targetFolder Id of the target folder.
hgs
parents:
diff changeset
   102
 \return true if operation was successfully started.
hgs
parents:
diff changeset
   103
 
hgs
parents:
diff changeset
   104
 Starts async copy operation for given messages.  
hgs
parents:
diff changeset
   105
 Completion signalled with messagesCopied(int result).
hgs
parents:
diff changeset
   106
 */
hgs
parents:
diff changeset
   107
bool NmApiMessageManager::copyMessages(const QList<quint64> messageIds,								
hgs
parents:
diff changeset
   108
									quint64 sourceFolder,
hgs
parents:
diff changeset
   109
									quint64 targetFolder)
hgs
parents:
diff changeset
   110
{
hgs
parents:
diff changeset
   111
	return d->copyMessages(messageIds, sourceFolder, targetFolder);
hgs
parents:
diff changeset
   112
}
hgs
parents:
diff changeset
   113
    
hgs
parents:
diff changeset
   114
// signaled with messageSaved(quint64 messageId, int result)
hgs
parents:
diff changeset
   115
bool NmApiMessageManager::saveMessage(const NmApiMessage &message)
hgs
parents:
diff changeset
   116
{
hgs
parents:
diff changeset
   117
    Q_UNUSED(message);
hgs
parents:
diff changeset
   118
	return false;
hgs
parents:
diff changeset
   119
}
hgs
parents:
diff changeset
   120
    
hgs
parents:
diff changeset
   121
// deletes message
hgs
parents:
diff changeset
   122
// signaled with messagesDeleted(int result)
hgs
parents:
diff changeset
   123
bool NmApiMessageManager::deleteMessages(const QList<quint64> messageIds)
hgs
parents:
diff changeset
   124
{
hgs
parents:
diff changeset
   125
    Q_UNUSED(messageIds);
hgs
parents:
diff changeset
   126
	return false;
hgs
parents:
diff changeset
   127
}
hgs
parents:
diff changeset
   128
    
hgs
parents:
diff changeset
   129
    // starts fetching rest of message body from server
hgs
parents:
diff changeset
   130
    // signaled with messageFetched(quint64 messageId, int result)
hgs
parents:
diff changeset
   131
bool NmApiMessageManager::fetch(const NmApiMessage &message)
hgs
parents:
diff changeset
   132
{
hgs
parents:
diff changeset
   133
    Q_UNUSED(message);
hgs
parents:
diff changeset
   134
	return false;
hgs
parents:
diff changeset
   135
}
hgs
parents:
diff changeset
   136
    
hgs
parents:
diff changeset
   137
    // moves message to outbox. Actual sending time may be immediate or scheduled
hgs
parents:
diff changeset
   138
    // signaled with messageSent(quint64 messageId, int result)
hgs
parents:
diff changeset
   139
bool NmApiMessageManager::send(const NmApiMessage &message)
hgs
parents:
diff changeset
   140
{
hgs
parents:
diff changeset
   141
    Q_UNUSED(message);
hgs
parents:
diff changeset
   142
	return false;
hgs
parents:
diff changeset
   143
}
hgs
parents:
diff changeset
   144
hgs
parents:
diff changeset
   145
// creates new attachment for a message. Currently attachment can be specified as file name (attachmentSpec is QString)
hgs
parents:
diff changeset
   146
// signaled with attachmentCreated(quint64 attachemntId)
hgs
parents:
diff changeset
   147
//  * 
hgs
parents:
diff changeset
   148
bool NmApiMessageManager::createAttachment(NmApiEmailMessage &message,
hgs
parents:
diff changeset
   149
										const QVariant &attachmenSpec)
hgs
parents:
diff changeset
   150
{
hgs
parents:
diff changeset
   151
    Q_UNUSED(message);
hgs
parents:
diff changeset
   152
    Q_UNUSED(attachmenSpec);
hgs
parents:
diff changeset
   153
    return false;
hgs
parents:
diff changeset
   154
}
hgs
parents:
diff changeset
   155
                                                      
hgs
parents:
diff changeset
   156
// removes attachment from a message
hgs
parents:
diff changeset
   157
// signaled with attachmentRemoved(int result)
hgs
parents:
diff changeset
   158
bool NmApiMessageManager::removeAttachment(NmApiEmailMessage &message,
hgs
parents:
diff changeset
   159
quint64 /*attachmentId*/)
hgs
parents:
diff changeset
   160
{    
hgs
parents:
diff changeset
   161
    Q_UNUSED(message);
hgs
parents:
diff changeset
   162
    return false;
hgs
parents:
diff changeset
   163
}
hgs
parents:
diff changeset
   164
 
hgs
parents:
diff changeset
   165
} // namespace EmailClientApi
hgs
parents:
diff changeset
   166
hgs
parents:
diff changeset
   167