|
1 /* |
|
2 * Copyright (c) 2007-2008 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: text message implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cimcvenginetextmessage.h" |
|
19 #include <StringLoader.h> |
|
20 #include "imcvenginemessageutils.h" |
|
21 #include <imcvuiapp.rsg> |
|
22 // logs |
|
23 #include "imcvlogger.h" |
|
24 |
|
25 //----------------------------------------------------------------------------- |
|
26 // CIMCVEngineTextMessage::CIMCVEngineTextMessage |
|
27 // ( Other items commented in header ) |
|
28 //----------------------------------------------------------------------------- |
|
29 CIMCVEngineTextMessage::CIMCVEngineTextMessage() |
|
30 { |
|
31 } |
|
32 |
|
33 //----------------------------------------------------------------------------- |
|
34 // CIMCVEngineTextMessage::~CIMCVEngineTextMessage |
|
35 // ( Other items commented in header ) |
|
36 //----------------------------------------------------------------------------- |
|
37 CIMCVEngineTextMessage::~CIMCVEngineTextMessage() |
|
38 { |
|
39 } |
|
40 |
|
41 //----------------------------------------------------------------------------- |
|
42 // CIMCVEngineTextMessage::NewL |
|
43 // ( Other items commented in header ) |
|
44 //----------------------------------------------------------------------------- |
|
45 CIMCVEngineTextMessage* CIMCVEngineTextMessage::NewL( |
|
46 const TDesC& aSender, |
|
47 const TDesC& aRecipient, |
|
48 const TDesC& aData ) |
|
49 { |
|
50 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::NewL() start") ); |
|
51 CIMCVEngineTextMessage* self = CIMCVEngineTextMessage::NewLC( |
|
52 aSender, |
|
53 aRecipient, |
|
54 aData ); |
|
55 CleanupStack::Pop( self ); |
|
56 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::NewL() end") ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 //----------------------------------------------------------------------------- |
|
62 // CIMCVEngineTextMessage::NewLC |
|
63 // ( Other items commented in header ) |
|
64 //----------------------------------------------------------------------------- |
|
65 CIMCVEngineTextMessage* CIMCVEngineTextMessage::NewLC( |
|
66 const TDesC& aSender, |
|
67 const TDesC& aRecipient, |
|
68 const TDesC& aData ) |
|
69 { |
|
70 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::NewLC() start") ); |
|
71 CIMCVEngineTextMessage* self = new ( ELeave ) CIMCVEngineTextMessage(); |
|
72 CleanupStack::PushL( self ); |
|
73 self->ConstructL( aData ); |
|
74 self->CIMCVEngineMessageBase::ConstructL( |
|
75 aSender, |
|
76 aRecipient |
|
77 ); |
|
78 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::NewLC() end") ); |
|
79 return self; |
|
80 } |
|
81 |
|
82 //----------------------------------------------------------------------------- |
|
83 // CIMCVEngineTextMessage::ConstructL |
|
84 // ( Other items commented in header ) |
|
85 //----------------------------------------------------------------------------- |
|
86 void CIMCVEngineTextMessage::ConstructL( const TDesC& aData ) |
|
87 { |
|
88 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::ConstructL() start") ); |
|
89 |
|
90 iText = aData.AllocL(); |
|
91 |
|
92 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::ConstructL() end") ); |
|
93 } |
|
94 |
|
95 //----------------------------------------------------------------------------- |
|
96 // CIMCVEngineTextMessage::SizeInBytes |
|
97 // ( Other items commented in header ) |
|
98 //----------------------------------------------------------------------------- |
|
99 TInt CIMCVEngineTextMessage::SizeInBytes() const |
|
100 { |
|
101 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::SizeInBytes() start") ); |
|
102 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::SizeInBytes() end") ); |
|
103 return CIMCVEngineMessageBase::SizeInBytes() + |
|
104 iText->Size() + |
|
105 sizeof( *this ); |
|
106 } |
|
107 |
|
108 //----------------------------------------------------------------------------- |
|
109 // CIMCVEngineTextMessage::ContentType |
|
110 // ( Other items commented in header ) |
|
111 //----------------------------------------------------------------------------- |
|
112 MIMCVEngineMessage::TContentType CIMCVEngineTextMessage::ContentType() const |
|
113 { |
|
114 return EContentText; |
|
115 } |
|
116 |
|
117 //----------------------------------------------------------------------------- |
|
118 // CCATextMessage::SetFailed |
|
119 // ( Other items commented in header ) |
|
120 //----------------------------------------------------------------------------- |
|
121 void CIMCVEngineTextMessage::SetFailedL() |
|
122 { |
|
123 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::SetFailedL() start") ); |
|
124 SetFailed(); |
|
125 HBufC* failed = NULL; |
|
126 if( iText ) |
|
127 { |
|
128 failed = IMCVEngineMessageUtils::LoadResourceL( R_QTN_CONVIEW_FAILED, *iText); |
|
129 delete iText; |
|
130 iText = NULL; |
|
131 iText = failed; |
|
132 } |
|
133 IM_CV_LOGS(TXT("CIMCVEngineTextMessage::SetFailedL() end") ); |
|
134 } |
|
135 |
|
136 // end of file |