125 // ----------------------------------------------------------------------------- |
125 // ----------------------------------------------------------------------------- |
126 // CESMRAddressSelectionQuery::ExecuteL |
126 // CESMRAddressSelectionQuery::ExecuteL |
127 // ----------------------------------------------------------------------------- |
127 // ----------------------------------------------------------------------------- |
128 // |
128 // |
129 TInt CESMRAddressSelectionQuery::ExecuteL( |
129 TInt CESMRAddressSelectionQuery::ExecuteL( |
130 const RPointerArray<HBufC>& aAddressArray ) |
130 const RPointerArray<HBufC>& aAddressArray ) |
131 { |
131 { |
132 FUNC_LOG; |
132 FUNC_LOG; |
133 TInt response( KErrCancel ); |
133 TInt response( KErrCancel ); |
134 |
134 |
135 CAknDoublePopupMenuStyleListBox* list = |
135 CAknDoublePopupMenuStyleListBox* list = |
136 new( ELeave )CAknDoublePopupMenuStyleListBox; |
136 new( ELeave )CAknDoublePopupMenuStyleListBox; |
137 CleanupStack::PushL( list ); |
137 CleanupStack::PushL( list ); |
138 |
138 |
139 CAknPopupList* popupList = CAknPopupList::NewL( list, |
139 CAknPopupList* popupList = CAknPopupList::NewL( list, |
140 R_AVKON_SOFTKEYS_SELECT_CANCEL, |
140 R_AVKON_SOFTKEYS_SELECT_CANCEL, |
141 AknPopupLayouts::EMenuDoubleWindow ); |
141 AknPopupLayouts::EMenuDoubleWindow ); |
173 // CESMRAddressSelectionQuery::SetListQueryTextsL |
173 // CESMRAddressSelectionQuery::SetListQueryTextsL |
174 // ----------------------------------------------------------------------------- |
174 // ----------------------------------------------------------------------------- |
175 // |
175 // |
176 |
176 |
177 void CESMRAddressSelectionQuery::SetListQueryTextsL( |
177 void CESMRAddressSelectionQuery::SetListQueryTextsL( |
178 CDesCArrayFlat* aItemArray, |
178 CDesCArrayFlat* aItemArray, |
179 CAknPopupList* aPopupList, |
179 CAknPopupList* aPopupList, |
180 const RPointerArray<HBufC>& aAddressArray ) |
180 const RPointerArray<HBufC>& aAddressArray ) |
181 { |
181 { |
182 FUNC_LOG; |
182 FUNC_LOG; |
183 // Set title for popup |
183 // Set title for popup |
184 aPopupList->SetTitleL( *iEnv->AllocReadResourceAsDes16LC( |
184 aPopupList->SetTitleL( *iEnv->AllocReadResourceAsDes16LC( |
185 R_QTN_MEET_REQ_LOC_ADDRESS_SELECTION_TITLE ) ); |
185 R_QTN_MEET_REQ_LOC_ADDRESS_SELECTION_TITLE ) ); |
186 CleanupStack::PopAndDestroy(); // Resource string |
186 CleanupStack::PopAndDestroy(); // Resource string |
187 |
187 |
188 // Amount of addresses the contact has |
188 // Amount of addresses the contact has |
189 TInt itemCount = aAddressArray.Count(); |
189 TInt itemCount = aAddressArray.Count(); |
190 |
190 |
191 RBuf item; |
191 RBuf item; |
192 item.Create( KMaxLength ); |
192 item.Create( KMaxLength ); |
193 item.CleanupClosePushL(); |
193 item.CleanupClosePushL(); |
194 |
194 |
195 for ( TInt i(0); i < itemCount; ++i ) |
195 for ( TInt i(0); i < itemCount; ++i ) |
196 { |
196 { |
197 // Descriptor has separator between label and the actual address |
197 // Descriptor has separator between label and the actual address |
198 TPtr16 temp = aAddressArray[i]->Des(); |
198 TPtr16 temp = aAddressArray[i]->Des(); |
199 |
199 |
200 // Let's truncate too long adresses |
200 // Let's truncate too long adresses |
201 if( temp.Length() > KMaxLength ) |
201 if( temp.Length() > KMaxLength ) |
202 { |
202 { |
203 temp.SetLength( KMaxLength ); |
203 temp.SetLength( KMaxLength ); |
204 } |
204 } |
205 |
205 |
206 // Finding the first instance of a separator |
206 // Finding the first instance of a separator |
207 TInt offset = temp.Find( KSeparator ); |
207 TInt offset = temp.Find( KSeparator ); |
208 |
208 |
209 if( 0 <= offset && offset < KMaxLength ) |
209 if( 0 <= offset && offset < KMaxLength ) |
210 { |
210 { |
211 // Forming label from the beginning to the first separator |
211 // Forming label from the beginning to the first separator |
212 TPtrC16 tempLabel = temp.Mid( 0, offset ); |
212 TPtrC16 tempLabel = temp.Mid( 0, offset ); |
213 |
213 |
214 // Forming address from the first separator to the end |
214 // Forming address from the first separator to the end |
215 TPtrC16 tempAddress = temp.Mid( |
215 TPtrC16 tempAddress = temp.Mid( |
216 offset + KSeparatorLength, |
216 offset + KSeparatorLength, |
217 temp.Length() - offset - KSeparatorLength ); |
217 temp.Length() - offset - KSeparatorLength ); |
218 |
218 |
219 // appending address item to array |
219 // appending address item to array |
220 item.Format( KListItemFormat, &tempLabel, &tempAddress ); |
220 item.Format( KListItemFormat, &tempLabel, &tempAddress ); |
221 aItemArray->AppendL( item ); |
221 aItemArray->AppendL( item ); |
222 } |
222 } |
223 |
223 |
224 } |
224 } |
225 CleanupStack::PopAndDestroy( &item ); |
225 CleanupStack::PopAndDestroy( &item ); |
226 } |
226 } |
227 |
227 |
228 // End of File |
228 // End of File |
229 |
229 |