1 /* |
1 /* |
2 * Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2003-2009 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 |
|
236 TBuf<KMaxDataTypeLength> fileName; |
230 TBuf<KMaxDataTypeLength> fileName; |
237 User::LeaveIfError(fileHandle->Name(fileName)); |
231 User::LeaveIfError(fileHandle->Name(fileName)); |
238 isRecognized = iResolver->DoRecognizeL(fileName, aBuffer, FileMimeType, ContentMimeType); |
232 isRecognized = iResolver->DoRecognizeL(fileName, aBuffer, FileMimeType, ContentMimeType); |
239 } |
233 } |
240 |
234 |
241 if (isRecognized == EFalse) |
235 if (isRecognized) |
242 { |
236 { |
243 return; |
237 // If there is no content type but the file is recognized it is assumed |
244 } |
238 // to be a file that can be processed through the supplier interface |
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 |
|
249 |
239 |
250 // dummy object for comparison in match function |
240 // dummy object for comparison in match function |
251 CMimeTypeMapping* mimeTypeMapping = (ContentMimeType.Length() == 0) ? |
241 CMimeTypeMapping* mimeTypeMapping = (ContentMimeType.Length() == 0) ? |
252 CMimeTypeMapping::NewL(FileMimeType) : |
242 CMimeTypeMapping::NewL(FileMimeType) : |
253 CMimeTypeMapping::NewL(ContentMimeType); |
243 CMimeTypeMapping::NewL(ContentMimeType); |
254 |
244 |
255 |
245 |
256 // check that the content mime type is one of the ones we |
246 // check that the content mime type is one of the ones we |
257 // told Apparc we can recognize in the beginning |
247 // told Apparc we can recognize in the beginning |
258 // The mime type should always be found as the file has been recognised. |
248 // The mime type should always be found as the file has been recognised. |
259 // If not it is because an agent, when recognising the file, has set a mime type not in its supplier list. |
249 // If not it is because an agent, when recognising the file, has set a mime type not in its supplier list. |
260 // Mime types are always forced to lower case therefore this match can be case sensitive. |
250 // Mime types are always forced to lower case therefore this match can be case sensitive. |
261 TInt index = iContentTypes.Find(mimeTypeMapping, CMimeTypeMapping::ContentMimeTypeMatch); |
251 TInt index = iContentTypes.Find(mimeTypeMapping, CMimeTypeMapping::ContentMimeTypeMatch); |
262 if (index != KErrNotFound) |
252 if (index != KErrNotFound) |
263 { |
253 { |
264 iDataType = TDataType(iContentTypes[index]->CafMimeType()); |
254 iDataType = TDataType(iContentTypes[index]->CafMimeType()); |
265 iConfidence=ECertain; |
255 iConfidence=ECertain; |
266 } |
256 } |
267 |
257 |
268 delete mimeTypeMapping; |
258 delete mimeTypeMapping; |
|
259 } |
269 } |
260 } |
270 |
261 |
271 const TImplementationProxy ImplementationTable[] = |
262 const TImplementationProxy ImplementationTable[] = |
272 { |
263 { |
273 IMPLEMENTATION_PROXY_ENTRY(0x102031E9, CApaCafRecognizer::NewL) |
264 IMPLEMENTATION_PROXY_ENTRY(0x102031E9, CApaCafRecognizer::NewL) |