messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp
author hgs
Sun, 25 Jul 2010 18:59:19 +0530
changeset 48 4f501b74aeb1
parent 37 518b245aa84c
permissions -rw-r--r--
201029_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2009 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
 *
hgs
parents:
diff changeset
    16
 */
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include "testconversationnotifier.h"
hgs
parents:
diff changeset
    19
hgs
parents:
diff changeset
    20
#include <mcsresultsobserver.h>
hgs
parents:
diff changeset
    21
#include <mcsconversationlistchangeobserver.h>
hgs
parents:
diff changeset
    22
#include <mcsconversationchangeobserver.h>
hgs
parents:
diff changeset
    23
#include <mcscachingstatusobserver.h>
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
hgs
parents:
diff changeset
    26
TestConversationNotifier::TestConversationNotifier()
hgs
parents:
diff changeset
    27
                            :iResultsObserver(NULL), 
hgs
parents:
diff changeset
    28
                            iConversationListChangeObserver(NULL), 
hgs
parents:
diff changeset
    29
                            iConversationChangeObserver(NULL),
hgs
parents:
diff changeset
    30
                            iCachingStatusObserver(NULL) 
hgs
parents:
diff changeset
    31
{
hgs
parents:
diff changeset
    32
}
hgs
parents:
diff changeset
    33
hgs
parents:
diff changeset
    34
void TestConversationNotifier
hgs
parents:
diff changeset
    35
::SetResultNotifier(MCsResultsObserver* aResultsObserver)
hgs
parents:
diff changeset
    36
{
hgs
parents:
diff changeset
    37
    iResultsObserver = aResultsObserver;
hgs
parents:
diff changeset
    38
}
hgs
parents:
diff changeset
    39
hgs
parents:
diff changeset
    40
void TestConversationNotifier::RemoveResultNotifier( )
hgs
parents:
diff changeset
    41
{
hgs
parents:
diff changeset
    42
    iResultsObserver = NULL;
hgs
parents:
diff changeset
    43
}
hgs
parents:
diff changeset
    44
hgs
parents:
diff changeset
    45
void TestConversationNotifier
hgs
parents:
diff changeset
    46
::SetConversationListNotifier(MCsConversationListChangeObserver* 
hgs
parents:
diff changeset
    47
                                    aConversationListChangeObserver)
hgs
parents:
diff changeset
    48
{
hgs
parents:
diff changeset
    49
    iConversationListChangeObserver = aConversationListChangeObserver;
hgs
parents:
diff changeset
    50
}
hgs
parents:
diff changeset
    51
hgs
parents:
diff changeset
    52
void TestConversationNotifier::RemoveConversationListNotifier( )
hgs
parents:
diff changeset
    53
{
hgs
parents:
diff changeset
    54
    iConversationListChangeObserver = NULL;        
hgs
parents:
diff changeset
    55
}
hgs
parents:
diff changeset
    56
hgs
parents:
diff changeset
    57
void TestConversationNotifier
hgs
parents:
diff changeset
    58
::SetConversationChangeNotifier(MCsConversationChangeObserver* 
hgs
parents:
diff changeset
    59
                                    aConversationChangeObserver)
hgs
parents:
diff changeset
    60
{
hgs
parents:
diff changeset
    61
    iConversationChangeObserver = aConversationChangeObserver;
hgs
parents:
diff changeset
    62
}
hgs
parents:
diff changeset
    63
hgs
parents:
diff changeset
    64
void TestConversationNotifier::RemoveConversationChangeNotifier()
hgs
parents:
diff changeset
    65
{
hgs
parents:
diff changeset
    66
    iConversationChangeObserver = NULL;
hgs
parents:
diff changeset
    67
}
hgs
parents:
diff changeset
    68
hgs
parents:
diff changeset
    69
void TestConversationNotifier
hgs
parents:
diff changeset
    70
::SetCachingStatusNotifier(MCsCachingStatusObserver* aCachingStatusObserver)
hgs
parents:
diff changeset
    71
{
hgs
parents:
diff changeset
    72
    iCachingStatusObserver = aCachingStatusObserver;
hgs
parents:
diff changeset
    73
}
hgs
parents:
diff changeset
    74
hgs
parents:
diff changeset
    75
void TestConversationNotifier::RemoveCachingStatusNotifier()
hgs
parents:
diff changeset
    76
{
hgs
parents:
diff changeset
    77
    iCachingStatusObserver = NULL;
hgs
parents:
diff changeset
    78
}
hgs
parents:
diff changeset
    79
hgs
parents:
diff changeset
    80
void TestConversationNotifier
hgs
parents:
diff changeset
    81
::SendListResultUpdate(RPointerArray<CCsConversationEntry>& 
48
4f501b74aeb1 201029_02
hgs
parents: 37
diff changeset
    82
                                        aConversationEntryList,
4f501b74aeb1 201029_02
hgs
parents: 37
diff changeset
    83
                                        TInt& aTotalCount)
37
hgs
parents:
diff changeset
    84
{
hgs
parents:
diff changeset
    85
    // Pass the results to the observer
hgs
parents:
diff changeset
    86
    if ( iResultsObserver )
hgs
parents:
diff changeset
    87
    {
48
4f501b74aeb1 201029_02
hgs
parents: 37
diff changeset
    88
        iResultsObserver->Conversations(aConversationEntryList,aTotalCount);
37
hgs
parents:
diff changeset
    89
    }
hgs
parents:
diff changeset
    90
}
hgs
parents:
diff changeset
    91
hgs
parents:
diff changeset
    92
void TestConversationNotifier
hgs
parents:
diff changeset
    93
::UpdateConversationEntryModify(CCsConversationEntry& aConversationEntry)
hgs
parents:
diff changeset
    94
{
hgs
parents:
diff changeset
    95
    // Pass the results to the observer
hgs
parents:
diff changeset
    96
    if ( iConversationChangeObserver )
hgs
parents:
diff changeset
    97
    {
hgs
parents:
diff changeset
    98
        iConversationChangeObserver->ModifyConversation(aConversationEntry);
hgs
parents:
diff changeset
    99
    }
hgs
parents:
diff changeset
   100
}
hgs
parents:
diff changeset
   101
hgs
parents:
diff changeset
   102
void TestConversationNotifier
hgs
parents:
diff changeset
   103
::UpdateConversationEntryAdd(CCsConversationEntry& aConversationEntry)
hgs
parents:
diff changeset
   104
{
hgs
parents:
diff changeset
   105
    // Pass the results to the observer
hgs
parents:
diff changeset
   106
    if ( iConversationChangeObserver )
hgs
parents:
diff changeset
   107
    {
hgs
parents:
diff changeset
   108
        iConversationChangeObserver->AddConversation(aConversationEntry);
hgs
parents:
diff changeset
   109
    }
hgs
parents:
diff changeset
   110
}
hgs
parents:
diff changeset
   111
hgs
parents:
diff changeset
   112
void TestConversationNotifier
hgs
parents:
diff changeset
   113
::UpdateConversationEntryDelete(CCsConversationEntry& aConversationEntry)
hgs
parents:
diff changeset
   114
{
hgs
parents:
diff changeset
   115
    // Pass the results to the observer
hgs
parents:
diff changeset
   116
    if ( iConversationChangeObserver )
hgs
parents:
diff changeset
   117
    {
hgs
parents:
diff changeset
   118
        iConversationChangeObserver->DeleteConversation(aConversationEntry);
hgs
parents:
diff changeset
   119
    }
hgs
parents:
diff changeset
   120
}
hgs
parents:
diff changeset
   121
hgs
parents:
diff changeset
   122
void TestConversationNotifier
hgs
parents:
diff changeset
   123
::SendClientListUpdate(RPointerArray<CCsClientConversation>& 
hgs
parents:
diff changeset
   124
                                        aConversationClientList)
hgs
parents:
diff changeset
   125
{
hgs
parents:
diff changeset
   126
    // Pass the results to the observer
hgs
parents:
diff changeset
   127
     if ( iResultsObserver )
hgs
parents:
diff changeset
   128
     {
hgs
parents:
diff changeset
   129
     iResultsObserver->ConversationList(aConversationClientList);
hgs
parents:
diff changeset
   130
     }
hgs
parents:
diff changeset
   131
}
hgs
parents:
diff changeset
   132
hgs
parents:
diff changeset
   133
void TestConversationNotifier
hgs
parents:
diff changeset
   134
::UpdateConversationClientModify(CCsClientConversation& aConversationClient)
hgs
parents:
diff changeset
   135
{
hgs
parents:
diff changeset
   136
    if ( iConversationListChangeObserver )
hgs
parents:
diff changeset
   137
    {
hgs
parents:
diff changeset
   138
        iConversationListChangeObserver->
hgs
parents:
diff changeset
   139
            ModifyConversationList(aConversationClient);
hgs
parents:
diff changeset
   140
    }
hgs
parents:
diff changeset
   141
}
hgs
parents:
diff changeset
   142
    
hgs
parents:
diff changeset
   143
void TestConversationNotifier
hgs
parents:
diff changeset
   144
::UpdateConversationClientAdd(CCsClientConversation& aConversationClient)
hgs
parents:
diff changeset
   145
{
hgs
parents:
diff changeset
   146
    if ( iConversationListChangeObserver )
hgs
parents:
diff changeset
   147
    {
hgs
parents:
diff changeset
   148
        iConversationListChangeObserver->
hgs
parents:
diff changeset
   149
            AddConversationList(aConversationClient);
hgs
parents:
diff changeset
   150
    }
hgs
parents:
diff changeset
   151
}
hgs
parents:
diff changeset
   152
hgs
parents:
diff changeset
   153
void TestConversationNotifier
hgs
parents:
diff changeset
   154
::UpdateConversationClientDelete(CCsClientConversation& aConversationClient)
hgs
parents:
diff changeset
   155
{
hgs
parents:
diff changeset
   156
    if ( iConversationListChangeObserver )
hgs
parents:
diff changeset
   157
    {
hgs
parents:
diff changeset
   158
        iConversationListChangeObserver->
hgs
parents:
diff changeset
   159
                DeleteConversationList(aConversationClient);
hgs
parents:
diff changeset
   160
    }
hgs
parents:
diff changeset
   161
}
hgs
parents:
diff changeset
   162