messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
       
    17 
       
    18 #include "testconversationnotifier.h"
       
    19 
       
    20 #include <mcsresultsobserver.h>
       
    21 #include <mcsconversationlistchangeobserver.h>
       
    22 #include <mcsconversationchangeobserver.h>
       
    23 #include <mcscachingstatusobserver.h>
       
    24 
       
    25 
       
    26 TestConversationNotifier::TestConversationNotifier()
       
    27                             :iResultsObserver(NULL), 
       
    28                             iConversationListChangeObserver(NULL), 
       
    29                             iConversationChangeObserver(NULL),
       
    30                             iCachingStatusObserver(NULL) 
       
    31 {
       
    32 }
       
    33 
       
    34 void TestConversationNotifier
       
    35 ::SetResultNotifier(MCsResultsObserver* aResultsObserver)
       
    36 {
       
    37     iResultsObserver = aResultsObserver;
       
    38 }
       
    39 
       
    40 void TestConversationNotifier::RemoveResultNotifier( )
       
    41 {
       
    42     iResultsObserver = NULL;
       
    43 }
       
    44 
       
    45 void TestConversationNotifier
       
    46 ::SetConversationListNotifier(MCsConversationListChangeObserver* 
       
    47                                     aConversationListChangeObserver)
       
    48 {
       
    49     iConversationListChangeObserver = aConversationListChangeObserver;
       
    50 }
       
    51 
       
    52 void TestConversationNotifier::RemoveConversationListNotifier( )
       
    53 {
       
    54     iConversationListChangeObserver = NULL;        
       
    55 }
       
    56 
       
    57 void TestConversationNotifier
       
    58 ::SetConversationChangeNotifier(MCsConversationChangeObserver* 
       
    59                                     aConversationChangeObserver)
       
    60 {
       
    61     iConversationChangeObserver = aConversationChangeObserver;
       
    62 }
       
    63 
       
    64 void TestConversationNotifier::RemoveConversationChangeNotifier()
       
    65 {
       
    66     iConversationChangeObserver = NULL;
       
    67 }
       
    68 
       
    69 void TestConversationNotifier
       
    70 ::SetCachingStatusNotifier(MCsCachingStatusObserver* aCachingStatusObserver)
       
    71 {
       
    72     iCachingStatusObserver = aCachingStatusObserver;
       
    73 }
       
    74 
       
    75 void TestConversationNotifier::RemoveCachingStatusNotifier()
       
    76 {
       
    77     iCachingStatusObserver = NULL;
       
    78 }
       
    79 
       
    80 void TestConversationNotifier
       
    81 ::SendListResultUpdate(RPointerArray<CCsConversationEntry>& 
       
    82                                         aConversationEntryList,
       
    83                                         TInt& aTotalCount)
       
    84 {
       
    85     // Pass the results to the observer
       
    86     if ( iResultsObserver )
       
    87     {
       
    88         iResultsObserver->Conversations(aConversationEntryList,aTotalCount);
       
    89     }
       
    90 }
       
    91 
       
    92 void TestConversationNotifier
       
    93 ::UpdateConversationEntryModify(CCsConversationEntry& aConversationEntry)
       
    94 {
       
    95     // Pass the results to the observer
       
    96     if ( iConversationChangeObserver )
       
    97     {
       
    98         iConversationChangeObserver->ModifyConversation(aConversationEntry);
       
    99     }
       
   100 }
       
   101 
       
   102 void TestConversationNotifier
       
   103 ::UpdateConversationEntryAdd(CCsConversationEntry& aConversationEntry)
       
   104 {
       
   105     // Pass the results to the observer
       
   106     if ( iConversationChangeObserver )
       
   107     {
       
   108         iConversationChangeObserver->AddConversation(aConversationEntry);
       
   109     }
       
   110 }
       
   111 
       
   112 void TestConversationNotifier
       
   113 ::UpdateConversationEntryDelete(CCsConversationEntry& aConversationEntry)
       
   114 {
       
   115     // Pass the results to the observer
       
   116     if ( iConversationChangeObserver )
       
   117     {
       
   118         iConversationChangeObserver->DeleteConversation(aConversationEntry);
       
   119     }
       
   120 }
       
   121 
       
   122 void TestConversationNotifier
       
   123 ::SendClientListUpdate(RPointerArray<CCsClientConversation>& 
       
   124                                         aConversationClientList)
       
   125 {
       
   126     // Pass the results to the observer
       
   127      if ( iResultsObserver )
       
   128      {
       
   129      iResultsObserver->ConversationList(aConversationClientList);
       
   130      }
       
   131 }
       
   132 
       
   133 void TestConversationNotifier
       
   134 ::UpdateConversationClientModify(CCsClientConversation& aConversationClient)
       
   135 {
       
   136     if ( iConversationListChangeObserver )
       
   137     {
       
   138         iConversationListChangeObserver->
       
   139             ModifyConversationList(aConversationClient);
       
   140     }
       
   141 }
       
   142     
       
   143 void TestConversationNotifier
       
   144 ::UpdateConversationClientAdd(CCsClientConversation& aConversationClient)
       
   145 {
       
   146     if ( iConversationListChangeObserver )
       
   147     {
       
   148         iConversationListChangeObserver->
       
   149             AddConversationList(aConversationClient);
       
   150     }
       
   151 }
       
   152 
       
   153 void TestConversationNotifier
       
   154 ::UpdateConversationClientDelete(CCsClientConversation& aConversationClient)
       
   155 {
       
   156     if ( iConversationListChangeObserver )
       
   157     {
       
   158         iConversationListChangeObserver->
       
   159                 DeleteConversationList(aConversationClient);
       
   160     }
       
   161 }
       
   162