emailservices/emailclientapi/src/emailmailbox.cpp
author hgs
Thu, 14 Oct 2010 17:33:43 +0300
changeset 76 38bf5461e270
parent 66 084b5b1f02a7
permissions -rw-r--r--
201041
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: This file implements class CEmailMailbox.
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include <e32cmn.h>
hgs
parents:
diff changeset
    19
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
hgs
parents:
diff changeset
    20
#include <viewclipartner.h>
hgs
parents:
diff changeset
    21
#include <vwsdefpartner.h>
hgs
parents:
diff changeset
    22
#else
hgs
parents:
diff changeset
    23
#include <viewcli.h>
hgs
parents:
diff changeset
    24
#include <vwsdef.h>
hgs
parents:
diff changeset
    25
#endif // SYMBIAN_ENABLE_SPLIT_HEADERS
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
#include <mmailboxsyncobserver.h>
hgs
parents:
diff changeset
    28
#include "emailmailbox.h"
hgs
parents:
diff changeset
    29
#include "emailapiutils.h"
hgs
parents:
diff changeset
    30
#include "emailaddress.h"
hgs
parents:
diff changeset
    31
#include "emailfolder.h"
hgs
parents:
diff changeset
    32
#include "emailmessage.h"
hgs
parents:
diff changeset
    33
#include "emailmessagesearch.h"
62
hgs
parents: 47
diff changeset
    34
#include "CFSMailClient.h"
47
hgs
parents:
diff changeset
    35
#include "emailclientapiimpl.h"
62
hgs
parents: 47
diff changeset
    36
#include "CFSMailPlugin.h"
hgs
parents: 47
diff changeset
    37
#include "CFSMailBox.h"
hgs
parents: 47
diff changeset
    38
#include "CFSMailFolder.h"
47
hgs
parents:
diff changeset
    39
#include "emailclientapi.hrh"
hgs
parents:
diff changeset
    40
62
hgs
parents: 47
diff changeset
    41
#include <xqservicerequest.h>
47
hgs
parents:
diff changeset
    42
#include "email_services_api.h"
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
// Constants
hgs
parents:
diff changeset
    45
hgs
parents:
diff changeset
    46
#include <QStringList>
hgs
parents:
diff changeset
    47
hgs
parents:
diff changeset
    48
_LIT( KNewLine, "\n" );
hgs
parents:
diff changeset
    49
hgs
parents:
diff changeset
    50
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    51
//
hgs
parents:
diff changeset
    52
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    53
CEmailMailbox* CEmailMailbox::NewL(
hgs
parents:
diff changeset
    54
    CPluginData& aPluginData,
hgs
parents:
diff changeset
    55
    const TMailboxId& aMailboxId )
hgs
parents:
diff changeset
    56
    {
hgs
parents:
diff changeset
    57
    CEmailMailbox* self = new ( ELeave ) CEmailMailbox( aPluginData, aMailboxId );
hgs
parents:
diff changeset
    58
    CleanupStack::PushL( self );
hgs
parents:
diff changeset
    59
    self->ConstructL();
hgs
parents:
diff changeset
    60
    CleanupStack::Pop( self );
hgs
parents:
diff changeset
    61
    return self;
hgs
parents:
diff changeset
    62
    }
hgs
parents:
diff changeset
    63
hgs
parents:
diff changeset
    64
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    65
//
hgs
parents:
diff changeset
    66
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    67
CEmailMailbox::CEmailMailbox(
hgs
parents:
diff changeset
    68
    CPluginData& aPluginData,
hgs
parents:
diff changeset
    69
    const TMailboxId& aMailboxId )
hgs
parents:
diff changeset
    70
    : iPluginData( aPluginData ),
hgs
parents:
diff changeset
    71
    iMailboxId( aMailboxId.iId )
hgs
parents:
diff changeset
    72
    {
hgs
parents:
diff changeset
    73
    }
hgs
parents:
diff changeset
    74
hgs
parents:
diff changeset
    75
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    76
//
hgs
parents:
diff changeset
    77
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    78
void CEmailMailbox::ConstructL()
hgs
parents:
diff changeset
    79
    {
hgs
parents:
diff changeset
    80
    iPlugin = iPluginData.ClaimInstanceL();
hgs
parents:
diff changeset
    81
    iEventMapper = new ( ELeave ) TObserverEventMapper(
hgs
parents:
diff changeset
    82
        iPlugin, iPluginData.Uid(), iMailboxId );
hgs
parents:
diff changeset
    83
    iFsMailbox = iPlugin->GetMailBoxByUidL( FsMailboxId() );
hgs
parents:
diff changeset
    84
    iSyncObserver = new ( ELeave ) CEmailMailbox::CEmailRequestObserver();
hgs
parents:
diff changeset
    85
    }
hgs
parents:
diff changeset
    86
hgs
parents:
diff changeset
    87
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    88
//
hgs
parents:
diff changeset
    89
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
    90
CEmailMailbox::~CEmailMailbox()
hgs
parents:
diff changeset
    91
    {
hgs
parents:
diff changeset
    92
    delete iFsMailbox;
hgs
parents:
diff changeset
    93
    delete iEventMapper;
hgs
parents:
diff changeset
    94
    delete iAddress;
hgs
parents:
diff changeset
    95
    iPluginData.ReleaseInstance();
hgs
parents:
diff changeset
    96
    delete iSyncObserver;
hgs
parents:
diff changeset
    97
    }
hgs
parents:
diff changeset
    98
hgs
parents:
diff changeset
    99
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   100
//
hgs
parents:
diff changeset
   101
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   102
TEmailTypeId CEmailMailbox::InterfaceId() const
hgs
parents:
diff changeset
   103
    {
hgs
parents:
diff changeset
   104
    return KEmailIFUidMailbox;
hgs
parents:
diff changeset
   105
    }
hgs
parents:
diff changeset
   106
hgs
parents:
diff changeset
   107
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   108
//
hgs
parents:
diff changeset
   109
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   110
void CEmailMailbox::Release()
hgs
parents:
diff changeset
   111
    {
hgs
parents:
diff changeset
   112
    delete this;
hgs
parents:
diff changeset
   113
    }
hgs
parents:
diff changeset
   114
hgs
parents:
diff changeset
   115
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   116
//
hgs
parents:
diff changeset
   117
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   118
TMailboxId CEmailMailbox::MailboxId() const
hgs
parents:
diff changeset
   119
    {
hgs
parents:
diff changeset
   120
    return iMailboxId;
hgs
parents:
diff changeset
   121
    }
hgs
parents:
diff changeset
   122
hgs
parents:
diff changeset
   123
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   124
//
hgs
parents:
diff changeset
   125
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   126
MEmailAddress* CEmailMailbox::AddressL() const
hgs
parents:
diff changeset
   127
    {
hgs
parents:
diff changeset
   128
    if ( !iAddress )
hgs
parents:
diff changeset
   129
        {
hgs
parents:
diff changeset
   130
        iAddress = CEmailAddress::NewL(
hgs
parents:
diff changeset
   131
            MEmailAddress::ESender, EAPIOwns );
hgs
parents:
diff changeset
   132
        iAddress->SetDisplayNameL( iFsMailbox->GetName() );
hgs
parents:
diff changeset
   133
        iAddress->SetAddressL( iFsMailbox->OwnMailAddress().GetEmailAddress() );
hgs
parents:
diff changeset
   134
        }
hgs
parents:
diff changeset
   135
    return iAddress;
hgs
parents:
diff changeset
   136
    }
hgs
parents:
diff changeset
   137
hgs
parents:
diff changeset
   138
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   139
//
hgs
parents:
diff changeset
   140
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   141
TPtrC CEmailMailbox::MailboxName() const
hgs
parents:
diff changeset
   142
    {
hgs
parents:
diff changeset
   143
    return iFsMailbox->GetName();
hgs
parents:
diff changeset
   144
    }
hgs
parents:
diff changeset
   145
hgs
parents:
diff changeset
   146
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   147
// Constructs and returns type mailbox id of internal data type TFSMailMsgId
hgs
parents:
diff changeset
   148
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   149
TFSMailMsgId CEmailMailbox::FsMailboxId() const
hgs
parents:
diff changeset
   150
    {
hgs
parents:
diff changeset
   151
    return FsMsgId( iPluginData, iMailboxId );
hgs
parents:
diff changeset
   152
    }
hgs
parents:
diff changeset
   153
hgs
parents:
diff changeset
   154
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   155
//
hgs
parents:
diff changeset
   156
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   157
TInt CEmailMailbox::GetFoldersL( RFolderArray& aFolders ) const
hgs
parents:
diff changeset
   158
    {
hgs
parents:
diff changeset
   159
    TFSMailMsgId rootId = TFSMailMsgId();
hgs
parents:
diff changeset
   160
    RPointerArray<CFSMailFolder> folders;
hgs
parents:
diff changeset
   161
    CleanupResetAndDestroyPushL( folders );
hgs
parents:
diff changeset
   162
    iPlugin->ListFoldersL( FsMailboxId(), rootId, folders );
hgs
parents:
diff changeset
   163
    TInt res( folders.Count() );
hgs
parents:
diff changeset
   164
    for ( TInt i = 0; i < res; i++ )
hgs
parents:
diff changeset
   165
        {
hgs
parents:
diff changeset
   166
        const CFSMailFolder* fsfolder = folders[i];
hgs
parents:
diff changeset
   167
        const TEntryId id = fsfolder->GetFolderId().Id();
hgs
parents:
diff changeset
   168
        const TFolderId folderId( id, iMailboxId );
hgs
parents:
diff changeset
   169
        CEmailFolder* folder = CEmailFolder::NewLC( iPluginData, folderId, folders[i] );
hgs
parents:
diff changeset
   170
        aFolders.AppendL( folder );
hgs
parents:
diff changeset
   171
        CleanupStack::Pop( folder );
hgs
parents:
diff changeset
   172
        }
hgs
parents:
diff changeset
   173
    CleanupStack::Pop( &folders );
hgs
parents:
diff changeset
   174
    folders.Close(); // close but don't delete folders because they are
hgs
parents:
diff changeset
   175
                     // owned by CEmailFolder
hgs
parents:
diff changeset
   176
    return res;
hgs
parents:
diff changeset
   177
    }
hgs
parents:
diff changeset
   178
hgs
parents:
diff changeset
   179
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   180
//
hgs
parents:
diff changeset
   181
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   182
MEmailFolder* CEmailMailbox::FolderL( const TFolderId& aFolderId ) const
hgs
parents:
diff changeset
   183
    {
hgs
parents:
diff changeset
   184
    CFSMailFolder* fsFolder = iPlugin->GetFolderByUidL(
hgs
parents:
diff changeset
   185
            FsMsgId( iPluginData, iMailboxId ),
hgs
parents:
diff changeset
   186
            FsMsgId( iPluginData, aFolderId ) );
hgs
parents:
diff changeset
   187
    CleanupStack::PushL( fsFolder );
hgs
parents:
diff changeset
   188
hgs
parents:
diff changeset
   189
    CEmailFolder* folder = CEmailFolder::NewL( iPluginData,
hgs
parents:
diff changeset
   190
                aFolderId, fsFolder );
hgs
parents:
diff changeset
   191
    CleanupStack::Pop( fsFolder );
hgs
parents:
diff changeset
   192
hgs
parents:
diff changeset
   193
    return folder;
hgs
parents:
diff changeset
   194
    }
hgs
parents:
diff changeset
   195
hgs
parents:
diff changeset
   196
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   197
//
hgs
parents:
diff changeset
   198
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   199
MEmailFolder* CEmailMailbox::FolderByTypeL(
hgs
parents:
diff changeset
   200
    const TFolderType aFolderType ) const
hgs
parents:
diff changeset
   201
    {
hgs
parents:
diff changeset
   202
    TFSMailMsgId fsFolderId;
hgs
parents:
diff changeset
   203
hgs
parents:
diff changeset
   204
    switch ( aFolderType )
hgs
parents:
diff changeset
   205
        {
hgs
parents:
diff changeset
   206
        case EInbox:
hgs
parents:
diff changeset
   207
            fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSInbox );
hgs
parents:
diff changeset
   208
            break;
hgs
parents:
diff changeset
   209
        case EOutbox:
hgs
parents:
diff changeset
   210
            fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSOutbox );
hgs
parents:
diff changeset
   211
            break;
hgs
parents:
diff changeset
   212
        case EDrafts:
hgs
parents:
diff changeset
   213
            fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSDraftsFolder );
hgs
parents:
diff changeset
   214
            break;
hgs
parents:
diff changeset
   215
        case EDeleted:
hgs
parents:
diff changeset
   216
            fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSDeleted );
hgs
parents:
diff changeset
   217
            break;
hgs
parents:
diff changeset
   218
        case ESent:
hgs
parents:
diff changeset
   219
            fsFolderId = iPlugin->GetStandardFolderIdL( FsMailboxId(), EFSSentFolder );
hgs
parents:
diff changeset
   220
            break;
hgs
parents:
diff changeset
   221
        case EOther:
hgs
parents:
diff changeset
   222
        default:
hgs
parents:
diff changeset
   223
            User::Leave( KErrNotFound );
hgs
parents:
diff changeset
   224
            break;
hgs
parents:
diff changeset
   225
        }
hgs
parents:
diff changeset
   226
hgs
parents:
diff changeset
   227
    const TFolderId folderId( fsFolderId.Id(), iMailboxId );
hgs
parents:
diff changeset
   228
hgs
parents:
diff changeset
   229
    CFSMailFolder* fsFolder = iPlugin->GetFolderByUidL(
hgs
parents:
diff changeset
   230
            FsMsgId( iPluginData, iMailboxId ),
hgs
parents:
diff changeset
   231
            fsFolderId );
hgs
parents:
diff changeset
   232
    CleanupStack::PushL( fsFolder );
hgs
parents:
diff changeset
   233
hgs
parents:
diff changeset
   234
    CEmailFolder* folder = CEmailFolder::NewL( iPluginData,
hgs
parents:
diff changeset
   235
            folderId,
hgs
parents:
diff changeset
   236
            fsFolder );
hgs
parents:
diff changeset
   237
hgs
parents:
diff changeset
   238
    CleanupStack::Pop( fsFolder );
hgs
parents:
diff changeset
   239
hgs
parents:
diff changeset
   240
    return folder;
hgs
parents:
diff changeset
   241
    }
hgs
parents:
diff changeset
   242
hgs
parents:
diff changeset
   243
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   244
//
hgs
parents:
diff changeset
   245
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   246
MEmailMessage* CEmailMailbox::MessageL( const TMessageId& aMessageId )
hgs
parents:
diff changeset
   247
    {
hgs
parents:
diff changeset
   248
    CFSMailMessage *fsMessage = iPlugin->GetMessageByUidL(
hgs
parents:
diff changeset
   249
            FsMsgId( iPluginData, aMessageId.iFolderId.iMailboxId ),
hgs
parents:
diff changeset
   250
            FsMsgId( iPluginData, aMessageId.iFolderId ),
hgs
parents:
diff changeset
   251
            FsMsgId( iPluginData, aMessageId ),
hgs
parents:
diff changeset
   252
            EFSMsgDataEnvelope );
hgs
parents:
diff changeset
   253
hgs
parents:
diff changeset
   254
    CleanupStack::PushL( fsMessage );
hgs
parents:
diff changeset
   255
    CEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns );
hgs
parents:
diff changeset
   256
    CleanupStack::Pop( fsMessage );
hgs
parents:
diff changeset
   257
hgs
parents:
diff changeset
   258
    return message;
hgs
parents:
diff changeset
   259
    }
hgs
parents:
diff changeset
   260
hgs
parents:
diff changeset
   261
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   262
//
hgs
parents:
diff changeset
   263
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   264
MEmailMessage* CEmailMailbox::CreateDraftMessageL() const
hgs
parents:
diff changeset
   265
    {
hgs
parents:
diff changeset
   266
    CFSMailMessage* fsMessage = iFsMailbox->CreateMessageToSend();
hgs
parents:
diff changeset
   267
    User::LeaveIfNull( fsMessage );
hgs
parents:
diff changeset
   268
    CleanupStack::PushL( fsMessage );
hgs
parents:
diff changeset
   269
    MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns );
hgs
parents:
diff changeset
   270
    CleanupStack::Pop( fsMessage );
hgs
parents:
diff changeset
   271
hgs
parents:
diff changeset
   272
    return message;
hgs
parents:
diff changeset
   273
    }
hgs
parents:
diff changeset
   274
hgs
parents:
diff changeset
   275
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   276
//
hgs
parents:
diff changeset
   277
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   278
MEmailMessage* CEmailMailbox::CreateReplyMessageL( 
hgs
parents:
diff changeset
   279
        const TMessageId& aMessageId, const TBool aReplyToAll ) const
hgs
parents:
diff changeset
   280
    {
hgs
parents:
diff changeset
   281
    CFSMailMessage* fsMessage = iFsMailbox->CreateReplyMessage( 
hgs
parents:
diff changeset
   282
        FsMsgId( iPluginData, aMessageId ), aReplyToAll );
hgs
parents:
diff changeset
   283
    User::LeaveIfNull( fsMessage );
hgs
parents:
diff changeset
   284
    CleanupStack::PushL( fsMessage );
hgs
parents:
diff changeset
   285
    MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns );
hgs
parents:
diff changeset
   286
    CleanupStack::Pop( fsMessage );
hgs
parents:
diff changeset
   287
hgs
parents:
diff changeset
   288
    return message;
hgs
parents:
diff changeset
   289
    }
hgs
parents:
diff changeset
   290
hgs
parents:
diff changeset
   291
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   292
//
hgs
parents:
diff changeset
   293
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   294
MEmailMessage* CEmailMailbox::CreateForwardMessageL( const TMessageId& aMessageId ) const
hgs
parents:
diff changeset
   295
    {
hgs
parents:
diff changeset
   296
    CFSMailMessage* fsMessage = iFsMailbox->CreateForwardMessage(
hgs
parents:
diff changeset
   297
        FsMsgId( iPluginData, aMessageId ), KNewLine() );
hgs
parents:
diff changeset
   298
    User::LeaveIfNull( fsMessage );
hgs
parents:
diff changeset
   299
    CleanupStack::PushL( fsMessage );
hgs
parents:
diff changeset
   300
    MEmailMessage* message = CEmailMessage::NewL( iPluginData, fsMessage, EClientOwns );
hgs
parents:
diff changeset
   301
    CleanupStack::Pop( fsMessage );
hgs
parents:
diff changeset
   302
hgs
parents:
diff changeset
   303
    return message;
hgs
parents:
diff changeset
   304
    }
hgs
parents:
diff changeset
   305
hgs
parents:
diff changeset
   306
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   307
//
hgs
parents:
diff changeset
   308
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   309
void CEmailMailbox::SynchroniseL( MMailboxSyncObserver& aObserver )
hgs
parents:
diff changeset
   310
    {
hgs
parents:
diff changeset
   311
    iSyncObserver->SetObserverL( &aObserver );
hgs
parents:
diff changeset
   312
    iRequestId = iFsMailbox->RefreshNowL( *iSyncObserver );
hgs
parents:
diff changeset
   313
    }
hgs
parents:
diff changeset
   314
hgs
parents:
diff changeset
   315
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   316
//
hgs
parents:
diff changeset
   317
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   318
void CEmailMailbox::CancelSynchronise()
hgs
parents:
diff changeset
   319
    {
hgs
parents:
diff changeset
   320
    iFsMailbox->CancelSearch();
hgs
parents:
diff changeset
   321
    }
hgs
parents:
diff changeset
   322
hgs
parents:
diff changeset
   323
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   324
//
hgs
parents:
diff changeset
   325
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   326
void CEmailMailbox::RegisterObserverL( MMailboxContentObserver& aObserver )
hgs
parents:
diff changeset
   327
    {
hgs
parents:
diff changeset
   328
    iEventMapper->AddObserverL( aObserver );
hgs
parents:
diff changeset
   329
    }
hgs
parents:
diff changeset
   330
hgs
parents:
diff changeset
   331
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   332
//
hgs
parents:
diff changeset
   333
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   334
void CEmailMailbox::UnregisterObserver( MMailboxContentObserver& aObserver )
hgs
parents:
diff changeset
   335
    {
hgs
parents:
diff changeset
   336
    iEventMapper->RemoveObserver( aObserver );
hgs
parents:
diff changeset
   337
    }
hgs
parents:
diff changeset
   338
hgs
parents:
diff changeset
   339
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   340
//
hgs
parents:
diff changeset
   341
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   342
MEmailMessageSearchAsync* CEmailMailbox::MessageSearchL()
hgs
parents:
diff changeset
   343
    {
hgs
parents:
diff changeset
   344
    MEmailMessageSearchAsync* searchAPI = 
hgs
parents:
diff changeset
   345
        CEmailMessageSearchAsync::NewL( iPluginData, iMailboxId );
hgs
parents:
diff changeset
   346
    return searchAPI;
hgs
parents:
diff changeset
   347
    }
hgs
parents:
diff changeset
   348
hgs
parents:
diff changeset
   349
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   350
//
hgs
parents:
diff changeset
   351
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   352
void CEmailMailbox::ShowInboxL()
hgs
parents:
diff changeset
   353
    {
hgs
parents:
diff changeset
   354
    User::Leave( KErrNotSupported );
hgs
parents:
diff changeset
   355
    }
hgs
parents:
diff changeset
   356
hgs
parents:
diff changeset
   357
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   358
//
hgs
parents:
diff changeset
   359
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   360
void CEmailMailbox::EditNewMessageL()
hgs
parents:
diff changeset
   361
    {
hgs
parents:
diff changeset
   362
    bool syncronous;
hgs
parents:
diff changeset
   363
66
hgs
parents: 62
diff changeset
   364
    XQServiceRequest request( XQI_EMAIL_MESSAGE_SEND,
hgs
parents: 62
diff changeset
   365
                              XQOP_EMAIL_MESSAGE_SEND,
hgs
parents: 62
diff changeset
   366
                              syncronous );
47
hgs
parents:
diff changeset
   367
hgs
parents:
diff changeset
   368
    QVariant returnValue;
66
hgs
parents: 62
diff changeset
   369
47
hgs
parents:
diff changeset
   370
    if ( !request.send( returnValue ) )
66
hgs
parents: 62
diff changeset
   371
        {
47
hgs
parents:
diff changeset
   372
        User::Leave( KErrGeneral );
66
hgs
parents: 62
diff changeset
   373
        }
47
hgs
parents:
diff changeset
   374
    }
hgs
parents:
diff changeset
   375
hgs
parents:
diff changeset
   376
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   377
//
hgs
parents:
diff changeset
   378
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   379
CEmailMailbox::TObserverEventMapper::TObserverEventMapper(
hgs
parents:
diff changeset
   380
    CFSMailPlugin* aPlugin,
hgs
parents:
diff changeset
   381
    TUid aPluginUid, const TMailboxId& aMailboxId )
hgs
parents:
diff changeset
   382
     : iPlugin( aPlugin ),
hgs
parents:
diff changeset
   383
       iFsMailboxId( aPluginUid.iUid, aMailboxId.iId )
hgs
parents:
diff changeset
   384
    {
hgs
parents:
diff changeset
   385
    }
hgs
parents:
diff changeset
   386
hgs
parents:
diff changeset
   387
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   388
//
hgs
parents:
diff changeset
   389
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   390
CEmailMailbox::TObserverEventMapper::~TObserverEventMapper()
hgs
parents:
diff changeset
   391
    {
hgs
parents:
diff changeset
   392
    iClientObservers.Close();
hgs
parents:
diff changeset
   393
    }
hgs
parents:
diff changeset
   394
hgs
parents:
diff changeset
   395
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   396
// Adds mailbox observer and subscribes to plugin mailbox events if there
hgs
parents:
diff changeset
   397
// were no previous observers.
hgs
parents:
diff changeset
   398
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   399
void CEmailMailbox::TObserverEventMapper::AddObserverL( 
hgs
parents:
diff changeset
   400
        MMailboxContentObserver& aObserver )
hgs
parents:
diff changeset
   401
    {
hgs
parents:
diff changeset
   402
    TIdentityRelation<MMailboxContentObserver> relation( 
hgs
parents:
diff changeset
   403
        &CEmailMailbox::TObserverEventMapper::Equals );
hgs
parents:
diff changeset
   404
    if ( iClientObservers.Find( &aObserver, relation ) == KErrNotFound )
hgs
parents:
diff changeset
   405
        {
hgs
parents:
diff changeset
   406
        const TInt count( iClientObservers.Count() );
hgs
parents:
diff changeset
   407
        if  ( !count )
hgs
parents:
diff changeset
   408
            {
hgs
parents:
diff changeset
   409
            iPlugin->SubscribeMailboxEventsL( iFsMailboxId, *this );
hgs
parents:
diff changeset
   410
            }
hgs
parents:
diff changeset
   411
        iClientObservers.AppendL( &aObserver );
hgs
parents:
diff changeset
   412
        }
hgs
parents:
diff changeset
   413
    }
hgs
parents:
diff changeset
   414
hgs
parents:
diff changeset
   415
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   416
// Removes an observer and removes event subscription if the observer was
hgs
parents:
diff changeset
   417
// last in observer array.
hgs
parents:
diff changeset
   418
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   419
void CEmailMailbox::TObserverEventMapper::RemoveObserver( 
hgs
parents:
diff changeset
   420
        MMailboxContentObserver& aObserver )
hgs
parents:
diff changeset
   421
    {
hgs
parents:
diff changeset
   422
    TIdentityRelation<MMailboxContentObserver> relation( 
hgs
parents:
diff changeset
   423
        &CEmailMailbox::TObserverEventMapper::Equals );
hgs
parents:
diff changeset
   424
    const TInt index( iClientObservers.Find( &aObserver, relation ) );
hgs
parents:
diff changeset
   425
    if ( index != KErrNotFound )
hgs
parents:
diff changeset
   426
        {
hgs
parents:
diff changeset
   427
        iClientObservers.Remove( index );
hgs
parents:
diff changeset
   428
        const TInt count( iClientObservers.Count() );
hgs
parents:
diff changeset
   429
        if  ( !count )
hgs
parents:
diff changeset
   430
            {
hgs
parents:
diff changeset
   431
            iPlugin->UnsubscribeMailboxEvents( iFsMailboxId, *this );
hgs
parents:
diff changeset
   432
            }
hgs
parents:
diff changeset
   433
        }
hgs
parents:
diff changeset
   434
    }
hgs
parents:
diff changeset
   435
hgs
parents:
diff changeset
   436
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   437
// Maps protocol a plugin event to client event
hgs
parents:
diff changeset
   438
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   439
void CEmailMailbox::TObserverEventMapper::EventL(
hgs
parents:
diff changeset
   440
    TFSMailEvent aEvent,
hgs
parents:
diff changeset
   441
    TFSMailMsgId aMailbox,
hgs
parents:
diff changeset
   442
    TAny* aParam1,
hgs
parents:
diff changeset
   443
    TAny* aParam2,
hgs
parents:
diff changeset
   444
    TAny* aParam3 )
hgs
parents:
diff changeset
   445
    {
hgs
parents:
diff changeset
   446
    const TEventMapFunc KMailboxEventHandlers[] = {
hgs
parents:
diff changeset
   447
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   448
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   449
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   450
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   451
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   452
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   453
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   454
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   455
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   456
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   457
    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
hgs
parents:
diff changeset
   458
    &CEmailMailbox::TObserverEventMapper::NewMessageL,
hgs
parents:
diff changeset
   459
    &CEmailMailbox::TObserverEventMapper::MessageChangedL,
hgs
parents:
diff changeset
   460
    &CEmailMailbox::TObserverEventMapper::MessageDeletedL,
hgs
parents:
diff changeset
   461
    &CEmailMailbox::TObserverEventMapper::MessageMoved,
hgs
parents:
diff changeset
   462
    &CEmailMailbox::TObserverEventMapper::MessageCopiedL,
hgs
parents:
diff changeset
   463
    &CEmailMailbox::TObserverEventMapper::NewFolderL,
hgs
parents:
diff changeset
   464
    &CEmailMailbox::TObserverEventMapper::FolderChangeL,
hgs
parents:
diff changeset
   465
    &CEmailMailbox::TObserverEventMapper::FoldersDeletedL,
hgs
parents:
diff changeset
   466
    &CEmailMailbox::TObserverEventMapper::FoldersMovedL,
hgs
parents:
diff changeset
   467
    &CEmailMailbox::TObserverEventMapper::ExceptionL
hgs
parents:
diff changeset
   468
    };
hgs
parents:
diff changeset
   469
hgs
parents:
diff changeset
   470
    TMailboxId id( aMailbox.Id() );
hgs
parents:
diff changeset
   471
    // boundary check
hgs
parents:
diff changeset
   472
    const TInt index( aEvent );
hgs
parents:
diff changeset
   473
    if ( index < sizeof( KMailboxEventHandlers ) / sizeof( KMailboxEventHandlers[ index ] ) )
hgs
parents:
diff changeset
   474
        {
hgs
parents:
diff changeset
   475
        // call event handler function
hgs
parents:
diff changeset
   476
        TEventMapFunc method = KMailboxEventHandlers[ index ];
hgs
parents:
diff changeset
   477
        (this->*method)(id, aParam1,aParam2,aParam3 );
hgs
parents:
diff changeset
   478
        }
hgs
parents:
diff changeset
   479
    }
hgs
parents:
diff changeset
   480
hgs
parents:
diff changeset
   481
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   482
//
hgs
parents:
diff changeset
   483
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   484
void CEmailMailbox::TObserverEventMapper::ConvertParamsL( 
hgs
parents:
diff changeset
   485
        TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, 
hgs
parents:
diff changeset
   486
        REmailMessageIdArray& aMessageIds, TFolderId& aFolderId )
hgs
parents:
diff changeset
   487
    {
hgs
parents:
diff changeset
   488
    RArray<TFSMailMsgId>* newEntries( static_cast< RArray<TFSMailMsgId>* >( aParam1 ) );
hgs
parents:
diff changeset
   489
    CleanupClosePushL( *newEntries );
hgs
parents:
diff changeset
   490
    TFSMailMsgId* parentFolder = static_cast<TFSMailMsgId*>( aParam2 );
hgs
parents:
diff changeset
   491
    aFolderId = TFolderId( parentFolder->Id(), aMailbox );
hgs
parents:
diff changeset
   492
hgs
parents:
diff changeset
   493
    for ( TInt j = 0; j < newEntries->Count(); j++ ) 
hgs
parents:
diff changeset
   494
        {
hgs
parents:
diff changeset
   495
        TFSMailMsgId fsId(( *newEntries )[j] );
hgs
parents:
diff changeset
   496
        TMessageId messageId( fsId.Id(), aFolderId.iId, aMailbox );
hgs
parents:
diff changeset
   497
        aMessageIds.Append( messageId );
hgs
parents:
diff changeset
   498
        }
hgs
parents:
diff changeset
   499
hgs
parents:
diff changeset
   500
    CleanupStack::PopAndDestroy( newEntries );
hgs
parents:
diff changeset
   501
    }
hgs
parents:
diff changeset
   502
hgs
parents:
diff changeset
   503
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   504
//
hgs
parents:
diff changeset
   505
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   506
void CEmailMailbox::TObserverEventMapper::IgnoreEventL(
hgs
parents:
diff changeset
   507
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   508
    {
hgs
parents:
diff changeset
   509
    }
hgs
parents:
diff changeset
   510
hgs
parents:
diff changeset
   511
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   512
//
hgs
parents:
diff changeset
   513
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   514
void CEmailMailbox::TObserverEventMapper::NewMessageL(
hgs
parents:
diff changeset
   515
    TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   516
    {
hgs
parents:
diff changeset
   517
    REmailMessageIdArray messageIds;
hgs
parents:
diff changeset
   518
    TFolderId folderId;
hgs
parents:
diff changeset
   519
    ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId );
hgs
parents:
diff changeset
   520
    CleanupClosePushL( messageIds );
hgs
parents:
diff changeset
   521
hgs
parents:
diff changeset
   522
    for ( TInt i = 0; i < iClientObservers.Count(); i++ )
hgs
parents:
diff changeset
   523
        {
hgs
parents:
diff changeset
   524
        MMailboxContentObserver* observer = iClientObservers[i];
hgs
parents:
diff changeset
   525
        if (observer)
hgs
parents:
diff changeset
   526
            observer->NewMessageEventL( aMailbox, messageIds, folderId );
hgs
parents:
diff changeset
   527
        }
hgs
parents:
diff changeset
   528
    
hgs
parents:
diff changeset
   529
    CleanupStack::PopAndDestroy( &messageIds );
hgs
parents:
diff changeset
   530
    }
hgs
parents:
diff changeset
   531
hgs
parents:
diff changeset
   532
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   533
//
hgs
parents:
diff changeset
   534
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   535
void CEmailMailbox::TObserverEventMapper::MessageChangedL(
hgs
parents:
diff changeset
   536
    TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   537
    {
hgs
parents:
diff changeset
   538
    REmailMessageIdArray messageIds;
hgs
parents:
diff changeset
   539
    TFolderId folderId;
hgs
parents:
diff changeset
   540
    ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId );
hgs
parents:
diff changeset
   541
    CleanupClosePushL( messageIds );
hgs
parents:
diff changeset
   542
hgs
parents:
diff changeset
   543
    for ( TInt i = 0; i < iClientObservers.Count(); i++ )
hgs
parents:
diff changeset
   544
        {
hgs
parents:
diff changeset
   545
        MMailboxContentObserver* observer = iClientObservers[i];
hgs
parents:
diff changeset
   546
        if (observer)
hgs
parents:
diff changeset
   547
            observer->MessageChangedEventL( aMailbox, messageIds, folderId );
hgs
parents:
diff changeset
   548
        }
hgs
parents:
diff changeset
   549
    CleanupStack::PopAndDestroy( &messageIds );
hgs
parents:
diff changeset
   550
    }
hgs
parents:
diff changeset
   551
hgs
parents:
diff changeset
   552
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   553
//
hgs
parents:
diff changeset
   554
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   555
void CEmailMailbox::TObserverEventMapper::MessageDeletedL(
hgs
parents:
diff changeset
   556
    TMailboxId aMailbox, TAny* aParam1, TAny* aParam2, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   557
    {
hgs
parents:
diff changeset
   558
    REmailMessageIdArray messageIds;    
hgs
parents:
diff changeset
   559
    TFolderId folderId;
hgs
parents:
diff changeset
   560
    ConvertParamsL( aMailbox, aParam1, aParam2, messageIds, folderId );
hgs
parents:
diff changeset
   561
    CleanupClosePushL( messageIds );
hgs
parents:
diff changeset
   562
hgs
parents:
diff changeset
   563
    for ( TInt i = 0; i < iClientObservers.Count(); i++ )
hgs
parents:
diff changeset
   564
        {
hgs
parents:
diff changeset
   565
        MMailboxContentObserver* observer = iClientObservers[i];
hgs
parents:
diff changeset
   566
        if (observer)
hgs
parents:
diff changeset
   567
            observer->MessageDeletedEventL( aMailbox, messageIds, folderId );
hgs
parents:
diff changeset
   568
        }
hgs
parents:
diff changeset
   569
    
hgs
parents:
diff changeset
   570
    CleanupStack::PopAndDestroy( &messageIds );
hgs
parents:
diff changeset
   571
    }
hgs
parents:
diff changeset
   572
hgs
parents:
diff changeset
   573
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   574
//
hgs
parents:
diff changeset
   575
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   576
void CEmailMailbox::TObserverEventMapper::MessageMoved(
hgs
parents:
diff changeset
   577
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   578
    {
hgs
parents:
diff changeset
   579
    }
hgs
parents:
diff changeset
   580
hgs
parents:
diff changeset
   581
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   582
//
hgs
parents:
diff changeset
   583
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   584
void CEmailMailbox::TObserverEventMapper::MessageCopiedL(
hgs
parents:
diff changeset
   585
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   586
    {
hgs
parents:
diff changeset
   587
    }
hgs
parents:
diff changeset
   588
hgs
parents:
diff changeset
   589
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   590
//
hgs
parents:
diff changeset
   591
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   592
void CEmailMailbox::TObserverEventMapper::NewFolderL(
hgs
parents:
diff changeset
   593
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   594
    {
hgs
parents:
diff changeset
   595
    }
hgs
parents:
diff changeset
   596
hgs
parents:
diff changeset
   597
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   598
//
hgs
parents:
diff changeset
   599
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   600
void CEmailMailbox::TObserverEventMapper::FolderChangeL(
hgs
parents:
diff changeset
   601
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   602
    {
hgs
parents:
diff changeset
   603
    }
hgs
parents:
diff changeset
   604
hgs
parents:
diff changeset
   605
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   606
//
hgs
parents:
diff changeset
   607
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   608
void CEmailMailbox::TObserverEventMapper::FoldersDeletedL(
hgs
parents:
diff changeset
   609
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   610
    {
hgs
parents:
diff changeset
   611
    }
hgs
parents:
diff changeset
   612
hgs
parents:
diff changeset
   613
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   614
//
hgs
parents:
diff changeset
   615
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   616
void CEmailMailbox::TObserverEventMapper::FoldersMovedL(
hgs
parents:
diff changeset
   617
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   618
    {
hgs
parents:
diff changeset
   619
    }
hgs
parents:
diff changeset
   620
hgs
parents:
diff changeset
   621
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   622
//
hgs
parents:
diff changeset
   623
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   624
void CEmailMailbox::TObserverEventMapper::ExceptionL(
hgs
parents:
diff changeset
   625
    TMailboxId /*aMailbox*/, TAny* /*aParam1*/, TAny* /*aParam2*/, TAny* /*aParam3*/ )
hgs
parents:
diff changeset
   626
    {
hgs
parents:
diff changeset
   627
    }
hgs
parents:
diff changeset
   628
hgs
parents:
diff changeset
   629
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   630
//
hgs
parents:
diff changeset
   631
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   632
TBool CEmailMailbox::TObserverEventMapper::Equals( 
hgs
parents:
diff changeset
   633
        const MMailboxContentObserver& a1, const MMailboxContentObserver& a2 )
hgs
parents:
diff changeset
   634
    {
hgs
parents:
diff changeset
   635
    return ( &a1 == &a2 );
hgs
parents:
diff changeset
   636
    }
hgs
parents:
diff changeset
   637
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   638
//
hgs
parents:
diff changeset
   639
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   640
CEmailMailbox::CEmailRequestObserver::CEmailRequestObserver() : iObserver( NULL )
hgs
parents:
diff changeset
   641
    {
hgs
parents:
diff changeset
   642
    }
hgs
parents:
diff changeset
   643
hgs
parents:
diff changeset
   644
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   645
//
hgs
parents:
diff changeset
   646
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   647
void CEmailMailbox::CEmailRequestObserver::RequestResponseL( 
hgs
parents:
diff changeset
   648
        TFSProgress aEvent, TInt /* aRequestId */ )
hgs
parents:
diff changeset
   649
    {
hgs
parents:
diff changeset
   650
    if ( iObserver && aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete )
hgs
parents:
diff changeset
   651
        {
hgs
parents:
diff changeset
   652
        iObserver->MailboxSynchronisedL(aEvent.iError);
hgs
parents:
diff changeset
   653
        }
hgs
parents:
diff changeset
   654
    }
hgs
parents:
diff changeset
   655
hgs
parents:
diff changeset
   656
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   657
//
hgs
parents:
diff changeset
   658
// -----------------------------------------------------------------------------
hgs
parents:
diff changeset
   659
void CEmailMailbox::CEmailRequestObserver::SetObserverL( MMailboxSyncObserver* aObserver )
hgs
parents:
diff changeset
   660
    {
hgs
parents:
diff changeset
   661
    iObserver = aObserver;
hgs
parents:
diff changeset
   662
    }
hgs
parents:
diff changeset
   663
hgs
parents:
diff changeset
   664
// End of file
hgs
parents:
diff changeset
   665