30 // CTextOverrides::NewL |
30 // CTextOverrides::NewL |
31 // --------------------------------------------------------- |
31 // --------------------------------------------------------- |
32 // |
32 // |
33 CTextOverrides* CTextOverrides::NewL( ) |
33 CTextOverrides* CTextOverrides::NewL( ) |
34 { |
34 { |
35 APSETUILOGGER_ENTERFN( EOther,"TxtOverride::NewL") |
35 return NULL; |
36 |
|
37 CTextOverrides* db = new( ELeave ) CTextOverrides(); |
|
38 CleanupStack::PushL( db ); |
|
39 db->ConstructL( ); |
|
40 CleanupStack::Pop(); // db |
|
41 |
|
42 APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::NewL") |
|
43 return db; |
|
44 } |
36 } |
45 |
37 |
46 |
38 |
47 |
39 |
48 // Destructor |
40 // Destructor |
49 CTextOverrides::~CTextOverrides() |
41 CTextOverrides::~CTextOverrides() |
50 { |
42 { |
51 APSETUILOGGER_ENTERFN( EOther,"TxtOverride::~CTextOverrides") |
|
52 |
|
53 if ( iTxtArray ) |
|
54 { |
|
55 iTxtArray->ResetAndDestroy(); |
|
56 } |
|
57 delete iTxtArray; |
|
58 |
|
59 APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::~CTextOverrides") |
|
60 } |
43 } |
61 |
44 |
62 |
45 |
63 // Constructor |
46 // Constructor |
64 CTextOverrides::CTextOverrides() |
47 CTextOverrides::CTextOverrides() |
70 // CTextOverrides::ConstructL |
53 // CTextOverrides::ConstructL |
71 // --------------------------------------------------------- |
54 // --------------------------------------------------------- |
72 // |
55 // |
73 void CTextOverrides::ConstructL( ) |
56 void CTextOverrides::ConstructL( ) |
74 { |
57 { |
75 APSETUILOGGER_ENTERFN( EOther,"TxtOverride::ConstructL") |
|
76 |
|
77 iTxtArray = new( ELeave ) CArrayPtrFlat<HBufC>( KTxtOverrideGran ); |
|
78 for (TInt i=0; i<=KTTextIdMax; i++ ) |
|
79 { |
|
80 iTxtArray->AppendL( NULL); |
|
81 } |
|
82 |
|
83 APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::ConstructL") |
|
84 } |
58 } |
85 |
59 |
86 |
60 |
87 // --------------------------------------------------------- |
61 // --------------------------------------------------------- |
88 // CTextOverrides::SetTextOverridesL |
62 // CTextOverrides::SetTextOverridesL |
89 // --------------------------------------------------------- |
63 // --------------------------------------------------------- |
90 // |
64 // |
91 void CTextOverrides::SetTextOverrideL( TTextID aText2Change, |
65 void CTextOverrides::SetTextOverrideL( TTextID aText2Change, |
92 const TDesC& aNewText ) |
66 const TDesC& aNewText ) |
93 { |
67 { |
94 APSETUILOGGER_ENTERFN( EOther,"TxtOverride::SetTextOverrideL") |
|
95 |
|
96 ValidateIdL( aText2Change ); |
|
97 |
|
98 HBufC* a = aNewText.AllocL(); |
|
99 iTxtArray->Delete( aText2Change ); |
|
100 iTxtArray->InsertL( aText2Change, a ); |
|
101 |
|
102 APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::SetTextOverrideL") |
|
103 } |
68 } |
104 |
69 |
105 |
70 |
106 // --------------------------------------------------------- |
71 // --------------------------------------------------------- |
107 // CTextOverrides::TextOverridesL |
72 // CTextOverrides::TextOverridesL |
108 // --------------------------------------------------------- |
73 // --------------------------------------------------------- |
109 // |
74 // |
110 const TDesC& CTextOverrides::TextOverrideL( TTextID aTextId ) |
75 const TDesC& CTextOverrides::TextOverrideL( TTextID aTextId ) |
111 { |
76 { |
112 APSETUILOGGER_ENTERFN( EOther,"TxtOverride::TextOverrideL") |
77 User::Leave( KErrNotSupported ); |
113 |
|
114 ValidateIdL( aTextId ); |
|
115 if ( !IsTextOverridenL( aTextId ) ) |
|
116 { |
|
117 User::Leave( KTxtNotOverriden ); |
|
118 } |
|
119 |
|
120 APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::TextOverrideL") |
|
121 return *iTxtArray->At( aTextId ); |
|
122 } |
78 } |
123 |
79 |
124 |
80 |
125 // --------------------------------------------------------- |
81 // --------------------------------------------------------- |
126 // CTextOverrides::IsTextOverridenL |
82 // CTextOverrides::IsTextOverridenL |
127 // --------------------------------------------------------- |
83 // --------------------------------------------------------- |
128 // |
84 // |
129 TBool CTextOverrides::IsTextOverridenL( TTextID aTextId ) |
85 TBool CTextOverrides::IsTextOverridenL( TTextID aTextId ) |
130 { |
86 { |
131 APSETUILOGGER_ENTERFN( EOther,"TxtOverride::IsTextOverridenL") |
87 return EFalse; |
132 |
|
133 TBool retval( EFalse ); |
|
134 ValidateIdL( aTextId ); |
|
135 if ( iTxtArray->At( aTextId ) ) |
|
136 { |
|
137 retval = ETrue; |
|
138 } |
|
139 else |
|
140 { |
|
141 retval = EFalse; |
|
142 } |
|
143 |
|
144 APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::IsTextOverridenL") |
|
145 return retval; |
|
146 } |
88 } |
147 |
89 |
148 |
90 |
149 // --------------------------------------------------------- |
91 // --------------------------------------------------------- |
150 // CTextOverrides::ValidateIdL |
92 // CTextOverrides::ValidateIdL |
151 // --------------------------------------------------------- |
93 // --------------------------------------------------------- |
152 // |
94 // |
153 void CTextOverrides::ValidateIdL( TTextID aTextId ) |
95 void CTextOverrides::ValidateIdL( TTextID aTextId ) |
154 { |
96 { |
155 APSETUILOGGER_ENTERFN( EOther,"TxtOverride::ValidateIdL") |
|
156 |
|
157 if ( ( aTextId < KTTextIdMin ) || ( aTextId > KTTextIdMax ) ) |
|
158 { |
|
159 User::Leave( KErrInvalidTextId ); |
|
160 } |
|
161 |
|
162 APSETUILOGGER_LEAVEFN( EOther,"TxtOverride::ValidateIdL") |
|
163 } |
97 } |
164 |
98 |
165 |
99 |
166 // End of File |
100 // End of File |