162 aResult = KErrArgument; |
162 aResult = KErrArgument; |
163 } |
163 } |
164 } |
164 } |
165 else |
165 else |
166 { |
166 { |
167 // it is also possible that displayname is included |
167 // it is also possible that displayname is included, in case there's |
168 // in, in case that there is no brackets around the uri. So if there is something |
168 // no brackets around the uri. So if there is something |
169 // inside quotationMarks it should be used as displayname |
169 // inside quotationMarks it should be used as displayname |
170 |
170 |
171 // check if displayname is found |
171 // check if displayname is found |
172 TInt displayNameStart = resultStr.Locate( KQuotationMark ); |
172 TInt displayNameStart = resultStr.Locate( KQuotationMark ); |
173 TInt displayNameEnd = resultStr.LocateReverse( KQuotationMark ); |
173 TInt displayNameEnd = resultStr.LocateReverse( KQuotationMark ); |
175 if ( displayNameStart != KErrNotFound |
175 if ( displayNameStart != KErrNotFound |
176 && displayNameEnd != KErrNotFound |
176 && displayNameEnd != KErrNotFound |
177 && displayNameStart < displayNameEnd ) |
177 && displayNameStart < displayNameEnd ) |
178 { |
178 { |
179 // displayname is included |
179 // displayname is included |
180 // ++, to remove quotationMark from the start |
180 // +1, to remove quotationMark from the start |
181 aResult = aDisplayname.Create( resultStr.Mid( ++displayNameStart, |
181 // -1, to remove quotationMark from the end |
182 // -1, to remove quotationMark from the end |
182 aResult = aDisplayname.Create( resultStr.Mid( displayNameStart + 1, |
183 displayNameEnd - displayNameStart - 1 ) ); |
183 displayNameEnd - displayNameStart - 1 ) ); |
184 } |
184 } |
185 else |
185 else |
186 { |
186 { |
187 // check if there is spaces in the uri, if there is |
187 // check if there is spaces in the uri. If there is, |
188 // everything before it belongs to display name |
188 // everything before it belongs to display name |
189 TInt index = resultStr.LocateReverse( KSpaceMark ); |
189 TInt index = resultStr.LocateReverse( KSpaceMark ); |
190 |
190 |
191 if ( KErrNotFound != index ) |
191 if ( KErrNotFound != index ) |
192 { |
192 { |