epoc32/include/mw/AknGlobalMsgQuery.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/AknGlobalMsgQuery.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,158 @@
     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 message query.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#ifndef __AKNGLOBALMSGQUERY_H__
    1.22 +#define __AKNGLOBALMSGQUERY_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 +* CAknGlobalMsgQuery
    1.33 +*   Uses notification framework to show a global message query.
    1.34 +*   Usage:
    1.35 +*       Create an active object, start it and pass its TRequestStatus as a
    1.36 +*       parameter to ShowMsgQueryL. After the user presses a softkey,
    1.37 +*       the request status will hold the id of the pressed softkey. E.g. 
    1.38 +*       If the user selected Cancel, the request status will hold -1.
    1.39 +*
    1.40 +*   Example 1. Show the global message query:
    1.41 +*        if ( iListObserver )
    1.42 +*            {
    1.43 +*            iListObserver->Cancel();
    1.44 +*            delete iListObserver;
    1.45 +*            }
    1.46 +*        iMsgObserver = new(ELeave) CGlobalMsgObserver(iEikonEnv);
    1.47 +*        iMsgObserver->Start();
    1.48 +*        iGlobalMsgQuery->ShowMsgQueryL(
    1.49 +*            iMsgObserver->iStatus, iMsgText, 
    1.50 +*            R_AVKON_SOFTKEYS_OK_CANCEL, iMsgHeader,
    1.51 +*            iHeaderImageFile, EImageId, EMaskId );
    1.52 +*
    1.53 +*   Example 2. Get and handle the result in active object.
    1.54 +*        void CMyActiveObject::RunL() 
    1.55 +*            {
    1.56 +*            TBuf<120> msg = _L("Received: ");
    1.57 +*            msg.AppendNum( iStatus.Int() );
    1.58 +*            iEnv->InfoMsg(msg);
    1.59 +*            Cancel();
    1.60 +*            }
    1.61 +*
    1.62 +*   Example 3. Update the query (softkeys)
    1.63 +*       iGlobalMsgQuery->UpdateMsgQuery( R_AVKON_SOFTKEYS_BACK );
    1.64 +*
    1.65 +*   Example 4. Cancel the query
    1.66 +*       iGlobalMsgQuery->CancelMsgQuery();
    1.67 +*
    1.68 +* NOTE !!! All descriptors passed as parameters need to be class members, i.e.
    1.69 +*           they cannot be local variables of a method. That is because
    1.70 +*           they need to exist when server gets the message.
    1.71 +*/
    1.72 +
    1.73 +NONSHARABLE_CLASS(CAknGlobalMsgQuery) : public CBase
    1.74 +    {
    1.75 +    public:
    1.76 +        IMPORT_C static CAknGlobalMsgQuery* NewL();
    1.77 +        IMPORT_C static CAknGlobalMsgQuery* NewLC();
    1.78 +        IMPORT_C ~CAknGlobalMsgQuery();
    1.79 +
    1.80 +        /**
    1.81 +        * Shows global message query synchronously.
    1.82 +        *
    1.83 +        * @param    aMsgText        Message text.
    1.84 +        * @param    aHeaderText     Header text.
    1.85 +        * @param    aSoftkeys       Softkey resource.
    1.86 +        * @param    aStatus         TRequestStatus which will be completed when user
    1.87 +        *                           selects one item from the list query.
    1.88 +        */
    1.89 +        IMPORT_C void ShowMsgQueryL( 
    1.90 +            TRequestStatus& aStatus,
    1.91 +            const TDesC& aMsgText,
    1.92 +            TInt aSoftkeys,
    1.93 +            const TDesC& aHeaderText,
    1.94 +            const TDesC& aHeaderImageFile,
    1.95 +            TInt aImageId = 0,
    1.96 +            TInt aImageMaskId = -1,
    1.97 +            CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone);
    1.98 +
    1.99 +        /**
   1.100 +        * Update the softkeys of the message query.
   1.101 +        *
   1.102 +        * @param    aSoftkeys  New resource for softkeys.
   1.103 +        */
   1.104 +        IMPORT_C void UpdateMsgQuery( TInt aSoftkeys );
   1.105 +
   1.106 +        /**
   1.107 +        * Cancel the message query.
   1.108 +        */
   1.109 +        IMPORT_C void CancelMsgQuery();
   1.110 +
   1.111 +        /**
   1.112 +        * Set delay after which query will be removed from screen after message is completed.
   1.113 +        * Can be used to get around problems with global query exit and CrossCheckForeground probs.
   1.114 +        * Must be called before ShowMsgQueryL in order to be effective.
   1.115 +        * 
   1.116 +        * @param aDelay   Time in microsecond, after which query will be removed from display.
   1.117 +        * @since  S60 2.1
   1.118 +        */
   1.119 +        IMPORT_C void SetExitDelay(TInt aDelay);
   1.120 +
   1.121 +        /**
   1.122 +        * Set Skin id for query header image. Must be called before ShowMsgQueryL in order to have 
   1.123 +        * effect. No need to use this method if image from avkon.mbm is used.
   1.124 +        *
   1.125 +        * @aparam aId   SkinId for image in query. If image not found from active skin, image 
   1.126 +        *               definitions used in ShowMsgQueryL used instead.
   1.127 +        * @since S60 2.6
   1.128 +        */      
   1.129 +        IMPORT_C void SetImageSkinId( TAknsItemID& aId );
   1.130 +
   1.131 +        /**
   1.132 +        * Sets additional information to be sent to secondary display. Takes ownership of object.
   1.133 +        * Must be called before sending data to notifier to have effect.
   1.134 +        *
   1.135 +        * @param aData Data to be sent to cover UI.
   1.136 +        * @internal to S60
   1.137 +        * @since S60 3.1
   1.138 +        */
   1.139 +        IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
   1.140 +    
   1.141 +    private:
   1.142 +        CAknGlobalMsgQuery();
   1.143 +        void ConstructL(); 
   1.144 +
   1.145 +    private:
   1.146 +        TAknGlobalQueryCmd iCmd;
   1.147 +        TInt iSoftkeys;
   1.148 +        TInt iImageId;
   1.149 +        TInt iImageMaskId;
   1.150 +        CAknQueryDialog::TTone iTone;
   1.151 +        RNotifier iNotify;
   1.152 +        CBufFlat *iBuffer;
   1.153 +        TPtrC8 iBufferPtr;
   1.154 +        TInt iDelay;
   1.155 +        TInt   iSkinsMajorId;
   1.156 +        TInt   iSkinsMinorId;
   1.157 +        CAknSDData* iAknSDData;
   1.158 +        TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
   1.159 +    };
   1.160 +
   1.161 +#endif // __AKNGLOBALMSGQUERY_H__