messagingapp/msgappfw/server/src/ccsconversationevent.cpp
changeset 31 ebfee66fde93
parent 23 238255e8b033
child 37 518b245aa84c
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     1 /*
       
     2 * Copyright (c) 2007 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:  This is a class to hold the conversation entry and the event 
       
    15  *                  associated receieved from plugin
       
    16  *
       
    17 */
       
    18 
       
    19 
       
    20 // SYSTEM INCLUDE FILES
       
    21 #include <ccsclientconversation.h>
       
    22 #include <ccsconversationentry.h>
       
    23 
       
    24 // USER INCLUDE FILES
       
    25 #include "ccsdebug.h"
       
    26 #include "ccsconversationevent.h"
       
    27 // ============================== MEMBER FUNCTIONS ============================
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // CCsConversationEvent::CCsConversationEvent
       
    31 // Default constructor
       
    32 // ----------------------------------------------------------------------------
       
    33 CCsConversationEvent::CCsConversationEvent()
       
    34     {
       
    35     }
       
    36 
       
    37 // ----------------------------------------------------------------------------
       
    38 // CCsConversationEvent::ConstructL
       
    39 // Two phase construction
       
    40 // ----------------------------------------------------------------------------
       
    41 void CCsConversationEvent::ConstructL()
       
    42     {
       
    43     iClientConversation = NULL;
       
    44     iEvent = KConversationEventNone;
       
    45     }
       
    46 
       
    47 // ----------------------------------------------------------------------------
       
    48 // CCsConversationEvent::NewL
       
    49 // Two Phase constructor
       
    50 // ----------------------------------------------------------------------------
       
    51 CCsConversationEvent* CCsConversationEvent::NewL()
       
    52     {
       
    53     CCsConversationEvent* self = new (ELeave) CCsConversationEvent();
       
    54     CleanupStack::PushL(self);
       
    55     self->ConstructL();
       
    56     CleanupStack::Pop(self);
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ----------------------------------------------------------------------------
       
    61 // CCsConversationEvent::~CCsConversationEvent
       
    62 // Destructor
       
    63 // ----------------------------------------------------------------------------
       
    64 CCsConversationEvent::~CCsConversationEvent()
       
    65     {
       
    66     // delete iEntry
       
    67     if(iClientConversation)
       
    68         {
       
    69         delete iClientConversation;
       
    70         iClientConversation = NULL;
       
    71         }
       
    72     }
       
    73 
       
    74 // ----------------------------------------------------------------------------
       
    75 // CCsConversationEvent::ClientConversation
       
    76 // returns the iClientConversation of the object
       
    77 // ----------------------------------------------------------------------------
       
    78 CCsClientConversation* 
       
    79 CCsConversationEvent::ClientConversation() const
       
    80     {
       
    81     return iClientConversation;
       
    82     }
       
    83 
       
    84 // ----------------------------------------------------------------------------
       
    85 // CCsConversationEvent::SetClientConversation
       
    86 // set iClientConversation in the object
       
    87 // ----------------------------------------------------------------------------
       
    88 void 
       
    89 CCsConversationEvent::SetClientConversationL(
       
    90         const CCsClientConversation& aClientConversation)
       
    91     {
       
    92     iClientConversation = aClientConversation.CloneL();
       
    93     }
       
    94 
       
    95 // ----------------------------------------------------------------------------
       
    96 // CCsConversationEvent::SetConversationEvent
       
    97 // set conversation event .
       
    98 // ----------------------------------------------------------------------------
       
    99 void CCsConversationEvent::SetEvent(
       
   100         const TUint32  aConversationEvent)
       
   101     {
       
   102     iEvent = KConversationEventNone;
       
   103     iEvent |= aConversationEvent;
       
   104     }
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // CCsConversationEvent::SetConversationEvent
       
   108 // returns conversation event .
       
   109 // ----------------------------------------------------------------------------
       
   110 TUint32 CCsConversationEvent::Event() const
       
   111     {
       
   112     return iEvent;
       
   113     }
       
   114 
       
   115 // ----------------------------------------------------------------------------
       
   116 // Compares 2 CCsConversationEntry objects based on ConversationEntryId.
       
   117 //
       
   118 // ----------------------------------------------------------------------------
       
   119 TBool CCsConversationEvent::CompareByEntryId(const CCsConversationEvent& aObj1,
       
   120         const CCsConversationEvent& aObj2)
       
   121     {
       
   122     CCsConversationEntry* Entry1 = 
       
   123         (aObj1.ClientConversation())->GetConversationEntry();
       
   124     CCsConversationEntry* Entry2 = 
       
   125         (aObj2.ClientConversation())->GetConversationEntry();
       
   126     
       
   127     if(Entry1 == 0 || Entry2 == 0)
       
   128         {
       
   129         return false;
       
   130         }
       
   131     //check whether they are of same type (sms/mms/call...)
       
   132     if(Entry1->GetType() == Entry2->GetType())
       
   133         {
       
   134         if( Entry1->EntryId() == Entry2->EntryId() )
       
   135             {
       
   136             return ETrue;
       
   137             }
       
   138         }
       
   139     return EFalse;
       
   140     }
       
   141 
       
   142 // ----------------------------------------------------------------------------
       
   143 // CCsConversationEvent::IsNewConversationListEventSet
       
   144 // ----------------------------------------------------------------------------
       
   145 TBool CCsConversationEvent::IsNewConversationListEventSet() const
       
   146     {
       
   147     return iEvent & KConversationListEventNew;
       
   148     }
       
   149 
       
   150 // ----------------------------------------------------------------------------
       
   151 // CCsNotifyConversationEvent::IsDeleteConversationListEventSet
       
   152 // ----------------------------------------------------------------------------
       
   153 TBool CCsConversationEvent::IsDeleteConversationListEventSet() const
       
   154     {
       
   155     return iEvent & KConversationListEventDelete;
       
   156     }
       
   157 
       
   158 // ----------------------------------------------------------------------------
       
   159 // CCsNotifyConversationEvent::IsUpdateConversationListEventSet
       
   160 // ----------------------------------------------------------------------------
       
   161 TBool CCsConversationEvent::IsUpdateConversationListEventSet() const
       
   162     {
       
   163     return iEvent & KConversationListEventUpdate;
       
   164     }
       
   165 
       
   166 // ----------------------------------------------------------------------------
       
   167 // CCsNotifyConversationEvent::IsNewConversationEventSet
       
   168 // ----------------------------------------------------------------------------
       
   169 TBool CCsConversationEvent::IsNewConversationEventSet() const
       
   170     {
       
   171     return iEvent & KConversationEventNew;
       
   172     }
       
   173 
       
   174 // ----------------------------------------------------------------------------
       
   175 // CCsNotifyConversationEvent::IsDeleteConversationEventSet
       
   176 // ----------------------------------------------------------------------------
       
   177 TBool CCsConversationEvent::IsDeleteConversationEventSet() const
       
   178     {
       
   179     return iEvent & KConversationEventDelete;
       
   180     }
       
   181 
       
   182 // ----------------------------------------------------------------------------
       
   183 // CCsNotifyConversationEvent::IsUpdateConversationEventSet
       
   184 // ----------------------------------------------------------------------------
       
   185 TBool CCsConversationEvent::IsUpdateConversationEventSet() const
       
   186     {
       
   187     return iEvent & KConversationEventUpdate;
       
   188     }
       
   189 
       
   190 // ----------------------------------------------------------------------------
       
   191 // CCsNotifyConversationEvent::IsRefreshConversationListEventSet
       
   192 // ----------------------------------------------------------------------------
       
   193 TBool CCsConversationEvent::IsRefreshConversationListEventSet() const
       
   194     {
       
   195     return iEvent & KConversationEventListRefresh;
       
   196     }
       
   197 
       
   198 // ----------------------------------------------------------------------------
       
   199 // CCsNotifyConversationEvent::IsUpdateConversationEventSet
       
   200 // ----------------------------------------------------------------------------
       
   201 TBool CCsConversationEvent::IsRefreshConversationEventSet() const
       
   202     {
       
   203     return iEvent & KConversationEventRefresh;
       
   204     }
       
   205 //EOF