diff -r 25a17d01db0c -r ebc84c812384 Symbian3/SDK/Source/GUID-A8130D83-E684-5B6C-BDFE-EB6EE3CD49E8.dita --- a/Symbian3/SDK/Source/GUID-A8130D83-E684-5B6C-BDFE-EB6EE3CD49E8.dita Fri Jan 22 18:26:19 2010 +0000 +++ b/Symbian3/SDK/Source/GUID-A8130D83-E684-5B6C-BDFE-EB6EE3CD49E8.dita Thu Mar 11 15:24:26 2010 +0000 @@ -1,4 +1,7 @@ + + - 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 @@ -27,7 +35,8 @@

    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 @@ -48,7 +57,8 @@ 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:

    @@ -89,7 +99,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 @@ -118,28 +128,16 @@ 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:

    // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of the License "Symbian Foundation License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. - -// refdialogcreator.cpp - - -#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> +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; @@ -154,7 +152,7 @@ { CRefDialogCreator* self = new (ELeave)CRefDialogCreator(); CleanupStack::PushL(self); - self->ConstructL(); + self->ConstructL(); CleanupStack::Pop(self); return self; } @@ -249,31 +247,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); } @@ -316,7 +314,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]; } @@ -333,14 +331,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; @@ -349,12 +347,12 @@ if (aVid.iId == 0x70000001) { _LIT(KSymbian, "Symbian Foundation"); - iPromptData->iVendorName.Create(KSymbian); + iPromptData->iVendorName.Create(KSymbian); } else { _LIT(KUnknown, "Unknown vendor"); - iPromptData->iVendorName.Create(KUnknown); + iPromptData->iVendorName.Create(KUnknown); } } @@ -389,9 +387,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); } } @@ -417,8 +415,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) @@ -454,8 +452,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; } @@ -466,7 +464,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; @@ -506,4 +504,6 @@ User::RequestComplete(status, KErrNone); }
    -
    \ No newline at end of file + + +