diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-A8130D83-E684-5B6C-BDFE-EB6EE3CD49E8.dita --- a/Symbian3/PDK/Source/GUID-A8130D83-E684-5B6C-BDFE-EB6EE3CD49E8.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-A8130D83-E684-5B6C-BDFE-EB6EE3CD49E8.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,7 +1,4 @@ - - + Writing -a UPS Dialog Creator - - - - - - -
Introduction

Dialog creators are EComplug-ins that -device creators can write to generate the dialogs containing prompts for phone -users.

The plug-in has an API that consists of two asynchronous functions:

    +a UPS Dialog Creator +
    Introduction

    Dialog +creators are ECom plug-ins that device creators can write to generate the +dialogs containing prompts for phone users.

    The plug-in has an API +that consists of two asynchronous functions:

    • The PrepareDialog() function. This function is called first by the UPS server. It enables the dialog creator to query other system servers such as AppArc or the SIS registry to retrieve @@ -34,8 +28,7 @@

    The UPS displays only one prompt at a time so it is possible for there to be a delay between calling the function to prepare the dialog and the function to display the dialog. It is also possible for other dialogs -to be displayed between the dialog being prepared and its being displayed.

    Both PrepareDialog() and DisplayDialog() are asynchronous and must support cancellation through CActive::Cancel. +to be displayed between the dialog being prepared and its being displayed.

    Both PrepareDialog() and DisplayDialog() are asynchronous and must support cancellation through CActive::Cancel. If either function is cancelled, the dialog creator instance is destroyed without calling further methods.

    The work split between PrepareDialog() and DisplayDialog() described above is a recommendation, and some of the functionality could be implemented @@ -44,9 +37,9 @@ functionality for policy evaluators. This allows multiple policy evaluators to share common UI code. However, it is possible to deliver policy evaluator and dialog creator plug-ins in the same DLL.

    -
    Procedure

    Dialog creators implement the CDialogCreator interface. -This section shows how to implement the functions that prepare and display -the user prompt.

      +
      Procedure

      Dialog +creators implement the CDialogCreator interface. This section +shows how to implement the functions that prepare and display the user prompt.

      1. Prepare a dialog using the PrepareDialog() function.

      2. Display the dialog using @@ -56,8 +49,7 @@ the dialog

        The parameters to PrepareDialog() are mostly const pointers and references to the data that has already been generated by the UPS or policy evaluator.

        The following -table describes the parameters for the PrepareDialog() function:

        +table describes the parameters for the PrepareDialog() function:

        @@ -98,7 +90,7 @@ -

        The UPS does not allow any responses to be returned +

        The UPS does not allow any responses to be returned to the system server except those defined in the UPS policy file. If the dialog creator returns an option that was not specified in the policy, the request is rejected and EUpsDecNo is returned.

        Your implementation @@ -126,17 +118,17 @@ framework to display the dialogs. The DoDisplayDialogL() function is called through a switch statement, which can be seen in the full code sample at the end of this section:

      -
      Example

      The following code shows an example of -a full implementation of the dialog creator file:

      #include "refdialogcreator.h" -#include <ecom/implementationproxy.h> -#include <apaid.h> -#include <apgcli.h> -#include <ups/promptrequest.h> -#include <swi/sisregistrypackage.h> -#include <swi/sisregistrysession.h> -#include <scs/nullstream.h> -#include <s32mem.h> +
      Example

      The +following code shows an example of a full implementation of the dialog creator +file:

      #include "refdialogcreator.h" +#include <ecom/implementationproxy.h> +#include <apaid.h> +#include <apgcli.h> +#include <ups/promptrequest.h> +#include <swi/sisregistrypackage.h> +#include <swi/sisregistrysession.h> +#include <scs/nullstream.h> +#include <s32mem.h> static const TUint KRefDialogCreatorImplementationId = 0x10283694; @@ -151,7 +143,7 @@ { CRefDialogCreator* self = new (ELeave)CRefDialogCreator(); CleanupStack::PushL(self); - self->ConstructL(); + self->ConstructL(); CleanupStack::Pop(self); return self; } @@ -246,31 +238,31 @@ // Only one state at the moment but more should be // added for long running operators e.g. querying the SIS registry // or resolving the client entity. - ResolveClientNameL(iRequest->ClientSid()); + ResolveClientNameL(iRequest->ClientSid()); // Get the vendor name for the client process - ResolveVendorNameL(iRequest->ClientVid()); + ResolveVendorNameL(iRequest->ClientVid()); // Server / Service localized names generated in notifier plug-in. - iPromptData->iServerSid = iRequest->ServerSid(); - iPromptData->iServiceId = iRequest->ServiceId(); + iPromptData->iServerSid = iRequest->ServerSid(); + iPromptData->iServiceId = iRequest->ServiceId(); // Different dialog text is displayed depending on whether the client application // is signed. // N.B. Protected SID is assumed to be signed or included at ROM build. - if (iRequest->IsClientSidProtected()) iPromptData->iFlags |= ETrustedClient; + if (iRequest->IsClientSidProtected()) iPromptData->iFlags |= ETrustedClient; // Use the options specified by the policy - iPromptData->iOptions = iPolicy->Options(); + iPromptData->iOptions = iPolicy->Options(); // Add the descriptions of the fingerprints. This could be used // to allow the user to grant access to all destinations // or a single destination. - TInt count = iFingerprints->Count(); + TInt count = iFingerprints->Count(); for (TInt i = 0; i < count; ++i) { - HBufC* description = (*iFingerprints)[i]->Description().AllocLC(); - iPromptData->iDescriptions.AppendL(description); + HBufC* description = (*iFingerprints)[i]->Description().AllocLC(); + iPromptData->iDescriptions.AppendL(description); CleanupStack::Pop(description); } @@ -313,7 +305,7 @@ // // In this implementation a copy of the original fingerprint is returned. However, // it is permitted to return a different fingerprint e.g. a modifier description. - if (iPromptResult.iDestination >= 0 && iPromptResult.iDestination < iFingerprints->Count()) + if (iPromptResult.iDestination >= 0 && iPromptResult.iDestination < iFingerprints->Count()) { *iFingerprint = (*iFingerprints)[iPromptResult.iDestination]; } @@ -330,14 +322,14 @@ void CRefDialogCreator::ResolveVendorNameL(const TVendorId& aVid) /** Looks up the localized vendor name for the client process and writes -this to iPromptData->iVendorName. +this to iPromptData->iVendorName. Typically, this would be resolved from the SIS registry or a lookup table. @param aVid The vendor id of the client process. */ { - if (iPromptData->iVendorName.Length() != 0) + if (iPromptData->iVendorName.Length() != 0) { // already obtained vendor name from SIS registry return; @@ -345,13 +337,13 @@ if (aVid.iId == 0x70000001) { - _LIT(KSymbian, "Symbian Foundation"); - iPromptData->iVendorName.Create(KSymbian); + _LIT(KSymbian, "XYZ Vendor"); + iPromptData->iVendorName.Create(KSymbian); } else { _LIT(KUnknown, "Unknown vendor"); - iPromptData->iVendorName.Create(KUnknown); + iPromptData->iVendorName.Create(KUnknown); } } @@ -386,9 +378,9 @@ if (! found) { RProcess clientProcess; - User::LeaveIfError(clientProcess.Open(iRequest->ClientProcessId())); + User::LeaveIfError(clientProcess.Open(iRequest->ClientProcessId())); CleanupClosePushL(clientProcess); - iPromptData->iClientName.Create(clientProcess.FileName()); + iPromptData->iClientName.Create(clientProcess.FileName()); CleanupStack::PopAndDestroy(&clientProcess); } } @@ -414,8 +406,8 @@ err = apa.GetAppInfo(*info, TUid::Uid(aSid)); if (err == KErrNone) { - iPromptData->iClientName.Close(); - iPromptData->iClientName.Create(info->iCaption); + iPromptData->iClientName.Close(); + iPromptData->iClientName.Create(info->iCaption); found = ETrue; } else if (err != KErrNotFound) @@ -451,8 +443,8 @@ TRAPD(err, p = r.SidToPackageL(TUid::Uid(aSid.iId))); if (err == KErrNone) { - iPromptData->iClientName.Create(p->Name()); - iPromptData->iVendorName.Create(p->Vendor()); + iPromptData->iClientName.Create(p->Name()); + iPromptData->iVendorName.Create(p->Vendor()); found = ETrue; delete p; } @@ -463,7 +455,7 @@ // From CDialogCreator void CRefDialogCreator::PrepareDialog( const UserPromptService::CPromptRequest& aRequest, const CPolicy& aPolicy, - const RPointerArray<CFingerprint>& aFingerprints, const CClientEntity* aClientEntity, + const RPointerArray<CFingerprint>& aFingerprints, const CClientEntity* aClientEntity, const TAny* aEvalPrivateData, TRequestStatus& aStatus) { aStatus = KRequestPending; @@ -503,6 +495,4 @@ User::RequestComplete(status, KErrNone); }
      - - - + \ No newline at end of file