wvuing/wvuieng/EngSrc/CCAInvitation.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Used when inviting to chats
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "CCAInvitation.h"
       
    21 
       
    22 // ========================== MEMBER FUNCTIONS =================================
       
    23 
       
    24 //------------------------------------------------------------------------------
       
    25 // CCAInvitation::CCAInvitation
       
    26 // C++ default constructor can NOT contain any code, that might leave.
       
    27 //------------------------------------------------------------------------------
       
    28 CCAInvitation::CCAInvitation( TInt aValidityPeriod )
       
    29         : iTimeout( aValidityPeriod )
       
    30     {
       
    31     // store the time this invitation was received
       
    32     iCreated.HomeTime();
       
    33     }
       
    34 
       
    35 //------------------------------------------------------------------------------
       
    36 // CCAInvitation::ConstructL
       
    37 // Symbian OS default constructor can leave.
       
    38 //------------------------------------------------------------------------------
       
    39 void CCAInvitation::ConstructL( const TDesC& aInviteID,
       
    40                                 const TDesC& aUserID,
       
    41                                 const TDesC& aGroupId,
       
    42                                 const TDesC& aScreenName,
       
    43                                 const TDesC& aGroupName,
       
    44                                 const TDesC& aMessage )
       
    45     {
       
    46     iInviteID   = aInviteID.AllocL();
       
    47     iUserID     = aUserID.AllocL();
       
    48     iGroupID	= aGroupId.AllocL();
       
    49     iScreenName = aScreenName.AllocL();
       
    50     iGroupName  = aGroupName.AllocL();
       
    51     iMessage    = aMessage.AllocL();
       
    52     }
       
    53 
       
    54 //------------------------------------------------------------------------------
       
    55 // CCAInvitation::NewL
       
    56 // Two-phased constructor.
       
    57 //------------------------------------------------------------------------------
       
    58 CCAInvitation* CCAInvitation::NewL(
       
    59     const TDesC& aInviteID,
       
    60     const TDesC& aUserID,
       
    61     const TDesC& aGroupID,
       
    62     const TDesC& aScreenName,
       
    63     const TDesC& aGroupName,
       
    64     const TDesC& aMessage,
       
    65     TInt   aValidityPeriod /*= 0*/ )
       
    66     {
       
    67     CCAInvitation* self = new ( ELeave ) CCAInvitation( aValidityPeriod );
       
    68 
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL( aInviteID, aUserID, aGroupID, aScreenName, aGroupName,
       
    71                       aMessage );
       
    72     CleanupStack::Pop( self );
       
    73 
       
    74     return self;
       
    75     }
       
    76 
       
    77 //------------------------------------------------------------------------------
       
    78 // CCAInvitation::~CCAInvitation
       
    79 // Destructor
       
    80 //------------------------------------------------------------------------------
       
    81 CCAInvitation::~CCAInvitation()
       
    82     {
       
    83     delete iInviteID;
       
    84     delete iUserID;
       
    85     delete iGroupID;
       
    86     delete iScreenName;
       
    87     delete iGroupName;
       
    88     delete iMessage;
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CCAInvitation::AddReadObserver()
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CCAInvitation::AddReadObserver( MCAInviteReadObserver* aObserver )
       
    96     {
       
    97     iObserver = aObserver;
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CCAInvitation::InviteID()
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 const TDesC& CCAInvitation::InviteID() const
       
   105     {
       
   106     return *iInviteID;
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CCAInvitation::UserID()
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 const TDesC& CCAInvitation::UserID() const
       
   114     {
       
   115     return *iUserID;
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CCAInvitation::ScreenName()
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 const TDesC& CCAInvitation::ScreenName() const
       
   123     {
       
   124     return *iScreenName;
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CCAInvitation::GroupName()
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 const TDesC& CCAInvitation::GroupName() const
       
   132     {
       
   133     return *iGroupName;
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CCAInvitation::GroupId()
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 const TDesC& CCAInvitation::GroupId() const
       
   141     {
       
   142     return *iGroupID;
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // CCAInvitation::Message()
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 const TDesC& CCAInvitation::Message() const
       
   150     {
       
   151     return *iMessage;
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CCAInvitation::Timeout()
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 TInt CCAInvitation::Timeout() const
       
   159     {
       
   160     return iTimeout;
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CCAInvitation::ReceivedAt()
       
   165 // -----------------------------------------------------------------------------
       
   166 //
       
   167 TTime CCAInvitation::ReceivedAt() const
       
   168     {
       
   169     return iCreated;
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CCAInvitation::SetInvitationAsReadL()
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 void CCAInvitation::SetInvitationAsReadL()
       
   177     {
       
   178     iRead = ETrue;
       
   179 
       
   180     if ( iObserver )
       
   181         {
       
   182         iObserver->HandleInviteReadL();
       
   183         }
       
   184     }
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CCAInvitation::IsRead()
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 TBool CCAInvitation::IsRead() const
       
   191     {
       
   192     return iRead;
       
   193     }
       
   194 
       
   195 
       
   196 //  End of File