epoc32/include/mw/AknGlobalConfirmationQuery.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description:  Uses notification framework to show a global confirmation query.
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
#ifndef __AKNGLOBALCONFIRMATIONQUERY_H__
williamr@4
    19
#define __AKNGLOBALCONFIRMATIONQUERY_H__
williamr@4
    20
williamr@4
    21
#include <AknNotify.h>
williamr@4
    22
#include <AknNotifyStd.h>
williamr@4
    23
#include <AknQueryDialog.h>
williamr@4
    24
#include <AknsItemID.h>
williamr@4
    25
williamr@4
    26
class CAknSDData;
williamr@4
    27
williamr@4
    28
/**
williamr@4
    29
* CAknGlobalConfirmationQuery
williamr@4
    30
*   Uses notification framework to show a global confirmation query.
williamr@4
    31
*   Usage:
williamr@4
    32
*       Create an active object, start it and pass its TRequestStatus as a
williamr@4
    33
*       parameter to ShowConfirmationQueryL. After the user presses a softkey,
williamr@4
    34
*       the request status will hold the id of the pressed softkey. E.g. If 
williamr@4
    35
*       the user selected Cancel, the request status will hold -1.
williamr@4
    36
*
williamr@4
    37
*   Example 1. Show the global confirmation query:
williamr@4
    38
*        if ( iConfObserver )
williamr@4
    39
*            {
williamr@4
    40
*            iConfObserver->Cancel();
williamr@4
    41
*            delete iConfObserver;
williamr@4
    42
*            }
williamr@4
    43
*        iConfObserver = new(ELeave) CGlobalConfirmationObserver(iEikonEnv);
williamr@4
    44
*        iConfObserver->Start();
williamr@4
    45
*        iGlobalConfirmationQuery->ShowMsgQueryL(
williamr@4
    46
*            iConfObserver->iStatus, 
williamr@4
    47
*            iPrompt, 
williamr@4
    48
*            R_AVKON_SOFTKEYS_OK_CANCEL,
williamr@4
    49
*            R_QUERY_NOTE_ANIMATION);
williamr@4
    50
*
williamr@4
    51
*
williamr@4
    52
*   Example 2. Get and handle the result in active object.
williamr@4
    53
*        void CMyActiveObject::RunL() 
williamr@4
    54
*            {
williamr@4
    55
*            TBuf<120> msg = _L("Received: ");
williamr@4
    56
*            msg.AppendNum( iStatus.Int() );
williamr@4
    57
*            iEnv->InfoMsg(msg);
williamr@4
    58
*            Cancel();
williamr@4
    59
*            }
williamr@4
    60
*
williamr@4
    61
*   Example 3. Update the query (softkeys)
williamr@4
    62
*       iGlobalConfirmationQuery->UpdateConfirmationQuery( R_AVKON_SOFTKEYS_BACK );
williamr@4
    63
*
williamr@4
    64
*   Example 4. Cancel the query
williamr@4
    65
*       iGlobalConfirmationQuery->CancelConfirmationQuery();
williamr@4
    66
*
williamr@4
    67
* NOTE !!! All descriptors passed as parameters need to be class members, i.e.
williamr@4
    68
*           they cannot be local variables of a method. That is because
williamr@4
    69
*           they need to exist when server gets the message.
williamr@4
    70
*/
williamr@4
    71
williamr@4
    72
NONSHARABLE_CLASS(CAknGlobalConfirmationQuery) : public CBase
williamr@4
    73
    {
williamr@4
    74
    public:
williamr@4
    75
        IMPORT_C static CAknGlobalConfirmationQuery* NewL();
williamr@4
    76
        IMPORT_C static CAknGlobalConfirmationQuery* NewLC();
williamr@4
    77
        IMPORT_C ~CAknGlobalConfirmationQuery();
williamr@4
    78
williamr@4
    79
        /**
williamr@4
    80
        * Shows global confirmation query synchronously.
williamr@4
    81
        *
williamr@4
    82
        * @param    aStatus             TRequestStatus which will be completed when user
williamr@4
    83
        *                               selects one item from the list query.
williamr@4
    84
        * @param    aPrompt             Prompt text.
williamr@4
    85
        * @param    aSoftkeys           Softkey resource. 
williamr@4
    86
        * @param    aAnimation          Animation resource.
williamr@4
    87
        * @param    aTone               Tone id.
williamr@4
    88
        * @param    aDismissWithAllKeys If set ETrue the query gets dismissed with all
williamr@4
    89
        *                               keypresses.
williamr@4
    90
        */
williamr@4
    91
        IMPORT_C void ShowConfirmationQueryL( 
williamr@4
    92
            TRequestStatus& aStatus,
williamr@4
    93
            const TDesC& aPrompt,
williamr@4
    94
            TInt aSoftkeys = 0,
williamr@4
    95
            TInt aAnimation = 0,
williamr@4
    96
            const TDesC& aImageFile = KNullDesC,
williamr@4
    97
            TInt aImageId = 0,
williamr@4
    98
            TInt aImageMaskId = 0,
williamr@4
    99
            CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone,
williamr@4
   100
            TBool aDismissWithAllKeys = EFalse );
williamr@4
   101
        /**
williamr@4
   102
        * Update the softkeys of the confirmation query.
williamr@4
   103
        *
williamr@4
   104
        * @param    aSoftkeys  New resource for softkeys.
williamr@4
   105
        */
williamr@4
   106
        IMPORT_C void UpdateConfirmationQuery( TInt aSoftkeys );
williamr@4
   107
williamr@4
   108
        /**
williamr@4
   109
        * Cancel the confirmation query.
williamr@4
   110
        */
williamr@4
   111
        IMPORT_C void CancelConfirmationQuery();
williamr@4
   112
williamr@4
   113
        /**
williamr@4
   114
        * Set skin id for query image. Must be called before ShowConfirmationQueryL in order to 
williamr@4
   115
        * have effect. No need to use this method if image from avkon.mbm is used.
williamr@4
   116
        *
williamr@4
   117
        * @aparam aId   SkinId for image in query. If image is not found from the active skin, 
williamr@4
   118
        *               image definitions used in ShowConfirmationQueryL are used instead.
williamr@4
   119
        * @since S60 2.6
williamr@4
   120
        */      
williamr@4
   121
        IMPORT_C void SetImageSkinId( TAknsItemID& aId );
williamr@4
   122
        
williamr@4
   123
        /**
williamr@4
   124
        * Sets additional information to be sent to secondary display. Takes ownership of object.
williamr@4
   125
        * Must be called before sending data to notifier to have effect.
williamr@4
   126
        *
williamr@4
   127
        * @param aData Data to be sent to cover UI.
williamr@4
   128
        * @since S60 3.1        
williamr@4
   129
        * @internal to S60        
williamr@4
   130
        */
williamr@4
   131
        IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
williamr@4
   132
        
williamr@4
   133
    private:
williamr@4
   134
        CAknGlobalConfirmationQuery();
williamr@4
   135
        void ConstructL(); 
williamr@4
   136
williamr@4
   137
    private:
williamr@4
   138
        TAknGlobalQueryCmd iCmd;
williamr@4
   139
        TInt iSoftkeys;
williamr@4
   140
        TInt iAnimation;
williamr@4
   141
        CAknQueryDialog::TTone iTone;
williamr@4
   142
        RNotifier iNotify;
williamr@4
   143
        CBufFlat *iBuffer;
williamr@4
   144
        TPtrC8 iBufferPtr;
williamr@4
   145
        TInt   iSkinsMajorId;
williamr@4
   146
        TInt   iSkinsMinorId;
williamr@4
   147
        CAknSDData* iAknSDData;
williamr@4
   148
        TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
williamr@4
   149
    };
williamr@4
   150
williamr@4
   151
#endif // __AKNGLOBALCONFIRMATIONQUERY_H__