1 /* |
1 /* |
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
225 // by two colons at the start of aName. |
225 // by two colons at the start of aName. |
226 // We need to get the actual file name from the file handle. |
226 // We need to get the actual file name from the file handle. |
227 else |
227 else |
228 { |
228 { |
229 RFile* fileHandle = CApaCafRecognizer::FilePassedByHandleL(); |
229 RFile* fileHandle = CApaCafRecognizer::FilePassedByHandleL(); |
|
230 |
|
231 if( fileHandle == NULL ) |
|
232 { |
|
233 return; |
|
234 } |
|
235 |
230 TBuf<KMaxDataTypeLength> fileName; |
236 TBuf<KMaxDataTypeLength> fileName; |
231 User::LeaveIfError(fileHandle->Name(fileName)); |
237 User::LeaveIfError(fileHandle->Name(fileName)); |
232 isRecognized = iResolver->DoRecognizeL(fileName, aBuffer, FileMimeType, ContentMimeType); |
238 isRecognized = iResolver->DoRecognizeL(fileName, aBuffer, FileMimeType, ContentMimeType); |
233 } |
239 } |
234 |
240 |
235 if (isRecognized) |
241 if (isRecognized == EFalse) |
236 { |
242 { |
237 // If there is no content type but the file is recognized it is assumed |
243 return; |
238 // to be a file that can be processed through the supplier interface |
244 } |
|
245 |
|
246 |
|
247 // If there is no content type but the file is recognized it is assumed |
|
248 // to be a file that can be processed through the supplier interface |
239 |
249 |
240 // dummy object for comparison in match function |
250 // dummy object for comparison in match function |
241 CMimeTypeMapping* mimeTypeMapping = (ContentMimeType.Length() == 0) ? |
251 CMimeTypeMapping* mimeTypeMapping = (ContentMimeType.Length() == 0) ? |
242 CMimeTypeMapping::NewL(FileMimeType) : |
252 CMimeTypeMapping::NewL(FileMimeType) : |
243 CMimeTypeMapping::NewL(ContentMimeType); |
253 CMimeTypeMapping::NewL(ContentMimeType); |
244 |
254 |
245 |
255 |
246 // check that the content mime type is one of the ones we |
256 // check that the content mime type is one of the ones we |
247 // told Apparc we can recognize in the beginning |
257 // told Apparc we can recognize in the beginning |
248 // The mime type should always be found as the file has been recognised. |
258 // The mime type should always be found as the file has been recognised. |
249 // If not it is because an agent, when recognising the file, has set a mime type not in its supplier list. |
259 // If not it is because an agent, when recognising the file, has set a mime type not in its supplier list. |
250 // Mime types are always forced to lower case therefore this match can be case sensitive. |
260 // Mime types are always forced to lower case therefore this match can be case sensitive. |
251 TInt index = iContentTypes.Find(mimeTypeMapping, CMimeTypeMapping::ContentMimeTypeMatch); |
261 TInt index = iContentTypes.Find(mimeTypeMapping, CMimeTypeMapping::ContentMimeTypeMatch); |
252 if (index != KErrNotFound) |
262 if (index != KErrNotFound) |
253 { |
263 { |
254 iDataType = TDataType(iContentTypes[index]->CafMimeType()); |
264 iDataType = TDataType(iContentTypes[index]->CafMimeType()); |
255 iConfidence=ECertain; |
265 iConfidence=ECertain; |
256 } |
266 } |
257 |
267 |
258 delete mimeTypeMapping; |
268 delete mimeTypeMapping; |
259 } |
|
260 } |
269 } |
261 |
270 |
262 const TImplementationProxy ImplementationTable[] = |
271 const TImplementationProxy ImplementationTable[] = |
263 { |
272 { |
264 IMPLEMENTATION_PROXY_ENTRY(0x102031E9, CApaCafRecognizer::NewL) |
273 IMPLEMENTATION_PROXY_ENTRY(0x102031E9, CApaCafRecognizer::NewL) |