messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp
changeset 27 e4592d119491
child 48 4f501b74aeb1
equal deleted inserted replaced
25:84d9eb65b26f 27:e4592d119491
       
     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 {
       
    84     // Pass the results to the observer
       
    85     if ( iResultsObserver )
       
    86     {
       
    87         iResultsObserver->Conversations(aConversationEntryList);
       
    88     }
       
    89 }
       
    90 
       
    91 void TestConversationNotifier
       
    92 ::UpdateConversationEntryModify(CCsConversationEntry& aConversationEntry)
       
    93 {
       
    94     // Pass the results to the observer
       
    95     if ( iConversationChangeObserver )
       
    96     {
       
    97         iConversationChangeObserver->ModifyConversation(aConversationEntry);
       
    98     }
       
    99 }
       
   100 
       
   101 void TestConversationNotifier
       
   102 ::UpdateConversationEntryAdd(CCsConversationEntry& aConversationEntry)
       
   103 {
       
   104     // Pass the results to the observer
       
   105     if ( iConversationChangeObserver )
       
   106     {
       
   107         iConversationChangeObserver->AddConversation(aConversationEntry);
       
   108     }
       
   109 }
       
   110 
       
   111 void TestConversationNotifier
       
   112 ::UpdateConversationEntryDelete(CCsConversationEntry& aConversationEntry)
       
   113 {
       
   114     // Pass the results to the observer
       
   115     if ( iConversationChangeObserver )
       
   116     {
       
   117         iConversationChangeObserver->DeleteConversation(aConversationEntry);
       
   118     }
       
   119 }
       
   120 
       
   121 void TestConversationNotifier
       
   122 ::SendClientListUpdate(RPointerArray<CCsClientConversation>& 
       
   123                                         aConversationClientList)
       
   124 {
       
   125     // Pass the results to the observer
       
   126      if ( iResultsObserver )
       
   127      {
       
   128      iResultsObserver->ConversationList(aConversationClientList);
       
   129      }
       
   130 }
       
   131 
       
   132 void TestConversationNotifier
       
   133 ::UpdateConversationClientModify(CCsClientConversation& aConversationClient)
       
   134 {
       
   135     if ( iConversationListChangeObserver )
       
   136     {
       
   137         iConversationListChangeObserver->
       
   138             ModifyConversationList(aConversationClient);
       
   139     }
       
   140 }
       
   141     
       
   142 void TestConversationNotifier
       
   143 ::UpdateConversationClientAdd(CCsClientConversation& aConversationClient)
       
   144 {
       
   145     if ( iConversationListChangeObserver )
       
   146     {
       
   147         iConversationListChangeObserver->
       
   148             AddConversationList(aConversationClient);
       
   149     }
       
   150 }
       
   151 
       
   152 void TestConversationNotifier
       
   153 ::UpdateConversationClientDelete(CCsClientConversation& aConversationClient)
       
   154 {
       
   155     if ( iConversationListChangeObserver )
       
   156     {
       
   157         iConversationListChangeObserver->
       
   158                 DeleteConversationList(aConversationClient);
       
   159     }
       
   160 }
       
   161