Symbian
Symbian OS Library

FAQ-0545 How do I allow the user to make my application the default handler for a MIME type?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Application architecture
Created: 12/11/2000 Modified: 06/12/2001
Number: FAQ-0545
Platform: ER5

Question:
How do I allow the user to make my application the default handler for a MIME type?

Answer:
If you are going to allow the user to alter which application controls a certain MIME type then a suggested method is to provide a function somewhere in your AppUi class along these lines:
    {
    CTypeStoreManager* db = CTypeStoreManager::NewL(iEikonEnv->FsSession());
    CleanupStack::PushL(db);
      _LIT8(KMimeType, "some/mime-type");
        // EOF is an expected error if the file does not exist...
        TRAPD(err,db->RestoreL());
        if (err != KErrNone && err != KErrEof)
          {
          User::Leave(err);
          }
            db->InsertDataMappingL(TDataType(KMimeType)
                    ,KDataTypePriorityUserSpecified
                    ,Application()->AppDllUid()
                    );
                      db->StoreL();
                        CleanupStack::PopAndDestroy(); //db
                        }