epoc32/include/mw/AknGlobalConfirmationQuery.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/AknGlobalConfirmationQuery.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,151 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Uses notification framework to show a global confirmation query.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#ifndef __AKNGLOBALCONFIRMATIONQUERY_H__
    1.22 +#define __AKNGLOBALCONFIRMATIONQUERY_H__
    1.23 +
    1.24 +#include <AknNotify.h>
    1.25 +#include <AknNotifyStd.h>
    1.26 +#include <AknQueryDialog.h>
    1.27 +#include <AknsItemID.h>
    1.28 +
    1.29 +class CAknSDData;
    1.30 +
    1.31 +/**
    1.32 +* CAknGlobalConfirmationQuery
    1.33 +*   Uses notification framework to show a global confirmation query.
    1.34 +*   Usage:
    1.35 +*       Create an active object, start it and pass its TRequestStatus as a
    1.36 +*       parameter to ShowConfirmationQueryL. After the user presses a softkey,
    1.37 +*       the request status will hold the id of the pressed softkey. E.g. If 
    1.38 +*       the user selected Cancel, the request status will hold -1.
    1.39 +*
    1.40 +*   Example 1. Show the global confirmation query:
    1.41 +*        if ( iConfObserver )
    1.42 +*            {
    1.43 +*            iConfObserver->Cancel();
    1.44 +*            delete iConfObserver;
    1.45 +*            }
    1.46 +*        iConfObserver = new(ELeave) CGlobalConfirmationObserver(iEikonEnv);
    1.47 +*        iConfObserver->Start();
    1.48 +*        iGlobalConfirmationQuery->ShowMsgQueryL(
    1.49 +*            iConfObserver->iStatus, 
    1.50 +*            iPrompt, 
    1.51 +*            R_AVKON_SOFTKEYS_OK_CANCEL,
    1.52 +*            R_QUERY_NOTE_ANIMATION);
    1.53 +*
    1.54 +*
    1.55 +*   Example 2. Get and handle the result in active object.
    1.56 +*        void CMyActiveObject::RunL() 
    1.57 +*            {
    1.58 +*            TBuf<120> msg = _L("Received: ");
    1.59 +*            msg.AppendNum( iStatus.Int() );
    1.60 +*            iEnv->InfoMsg(msg);
    1.61 +*            Cancel();
    1.62 +*            }
    1.63 +*
    1.64 +*   Example 3. Update the query (softkeys)
    1.65 +*       iGlobalConfirmationQuery->UpdateConfirmationQuery( R_AVKON_SOFTKEYS_BACK );
    1.66 +*
    1.67 +*   Example 4. Cancel the query
    1.68 +*       iGlobalConfirmationQuery->CancelConfirmationQuery();
    1.69 +*
    1.70 +* NOTE !!! All descriptors passed as parameters need to be class members, i.e.
    1.71 +*           they cannot be local variables of a method. That is because
    1.72 +*           they need to exist when server gets the message.
    1.73 +*/
    1.74 +
    1.75 +NONSHARABLE_CLASS(CAknGlobalConfirmationQuery) : public CBase
    1.76 +    {
    1.77 +    public:
    1.78 +        IMPORT_C static CAknGlobalConfirmationQuery* NewL();
    1.79 +        IMPORT_C static CAknGlobalConfirmationQuery* NewLC();
    1.80 +        IMPORT_C ~CAknGlobalConfirmationQuery();
    1.81 +
    1.82 +        /**
    1.83 +        * Shows global confirmation query synchronously.
    1.84 +        *
    1.85 +        * @param    aStatus             TRequestStatus which will be completed when user
    1.86 +        *                               selects one item from the list query.
    1.87 +        * @param    aPrompt             Prompt text.
    1.88 +        * @param    aSoftkeys           Softkey resource. 
    1.89 +        * @param    aAnimation          Animation resource.
    1.90 +        * @param    aTone               Tone id.
    1.91 +        * @param    aDismissWithAllKeys If set ETrue the query gets dismissed with all
    1.92 +        *                               keypresses.
    1.93 +        */
    1.94 +        IMPORT_C void ShowConfirmationQueryL( 
    1.95 +            TRequestStatus& aStatus,
    1.96 +            const TDesC& aPrompt,
    1.97 +            TInt aSoftkeys = 0,
    1.98 +            TInt aAnimation = 0,
    1.99 +            const TDesC& aImageFile = KNullDesC,
   1.100 +            TInt aImageId = 0,
   1.101 +            TInt aImageMaskId = 0,
   1.102 +            CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone,
   1.103 +            TBool aDismissWithAllKeys = EFalse );
   1.104 +        /**
   1.105 +        * Update the softkeys of the confirmation query.
   1.106 +        *
   1.107 +        * @param    aSoftkeys  New resource for softkeys.
   1.108 +        */
   1.109 +        IMPORT_C void UpdateConfirmationQuery( TInt aSoftkeys );
   1.110 +
   1.111 +        /**
   1.112 +        * Cancel the confirmation query.
   1.113 +        */
   1.114 +        IMPORT_C void CancelConfirmationQuery();
   1.115 +
   1.116 +        /**
   1.117 +        * Set skin id for query image. Must be called before ShowConfirmationQueryL in order to 
   1.118 +        * have effect. No need to use this method if image from avkon.mbm is used.
   1.119 +        *
   1.120 +        * @aparam aId   SkinId for image in query. If image is not found from the active skin, 
   1.121 +        *               image definitions used in ShowConfirmationQueryL are used instead.
   1.122 +        * @since S60 2.6
   1.123 +        */      
   1.124 +        IMPORT_C void SetImageSkinId( TAknsItemID& aId );
   1.125 +        
   1.126 +        /**
   1.127 +        * Sets additional information to be sent to secondary display. Takes ownership of object.
   1.128 +        * Must be called before sending data to notifier to have effect.
   1.129 +        *
   1.130 +        * @param aData Data to be sent to cover UI.
   1.131 +        * @since S60 3.1        
   1.132 +        * @internal to S60        
   1.133 +        */
   1.134 +        IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
   1.135 +        
   1.136 +    private:
   1.137 +        CAknGlobalConfirmationQuery();
   1.138 +        void ConstructL(); 
   1.139 +
   1.140 +    private:
   1.141 +        TAknGlobalQueryCmd iCmd;
   1.142 +        TInt iSoftkeys;
   1.143 +        TInt iAnimation;
   1.144 +        CAknQueryDialog::TTone iTone;
   1.145 +        RNotifier iNotify;
   1.146 +        CBufFlat *iBuffer;
   1.147 +        TPtrC8 iBufferPtr;
   1.148 +        TInt   iSkinsMajorId;
   1.149 +        TInt   iSkinsMinorId;
   1.150 +        CAknSDData* iAknSDData;
   1.151 +        TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
   1.152 +    };
   1.153 +
   1.154 +#endif // __AKNGLOBALCONFIRMATIONQUERY_H__