2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Uses notification framework to show a global message query.
18 #ifndef __AKNGLOBALMSGQUERY_H__
19 #define __AKNGLOBALMSGQUERY_H__
21 #include <AknNotify.h>
22 #include <AknNotifyStd.h>
23 #include <AknQueryDialog.h>
24 #include <AknsItemID.h>
30 * Uses notification framework to show a global message query.
32 * Create an active object, start it and pass its TRequestStatus as a
33 * parameter to ShowMsgQueryL. After the user presses a softkey,
34 * the request status will hold the id of the pressed softkey. E.g.
35 * If the user selected Cancel, the request status will hold -1.
37 * Example 1. Show the global message query:
38 * if ( iListObserver )
40 * iListObserver->Cancel();
41 * delete iListObserver;
43 * iMsgObserver = new(ELeave) CGlobalMsgObserver(iEikonEnv);
44 * iMsgObserver->Start();
45 * iGlobalMsgQuery->ShowMsgQueryL(
46 * iMsgObserver->iStatus, iMsgText,
47 * R_AVKON_SOFTKEYS_OK_CANCEL, iMsgHeader,
48 * iHeaderImageFile, EImageId, EMaskId );
50 * Example 2. Get and handle the result in active object.
51 * void CMyActiveObject::RunL()
53 * TBuf<120> msg = _L("Received: ");
54 * msg.AppendNum( iStatus.Int() );
59 * Example 3. Update the query (softkeys)
60 * iGlobalMsgQuery->UpdateMsgQuery( R_AVKON_SOFTKEYS_BACK );
62 * Example 4. Cancel the query
63 * iGlobalMsgQuery->CancelMsgQuery();
65 * NOTE !!! All descriptors passed as parameters need to be class members, i.e.
66 * they cannot be local variables of a method. That is because
67 * they need to exist when server gets the message.
70 NONSHARABLE_CLASS(CAknGlobalMsgQuery) : public CBase
73 IMPORT_C static CAknGlobalMsgQuery* NewL();
74 IMPORT_C static CAknGlobalMsgQuery* NewLC();
75 IMPORT_C ~CAknGlobalMsgQuery();
78 * Shows global message query synchronously.
80 * @param aMsgText Message text.
81 * @param aHeaderText Header text.
82 * @param aSoftkeys Softkey resource.
83 * @param aStatus TRequestStatus which will be completed when user
84 * selects one item from the list query.
86 IMPORT_C void ShowMsgQueryL(
87 TRequestStatus& aStatus,
88 const TDesC& aMsgText,
90 const TDesC& aHeaderText,
91 const TDesC& aHeaderImageFile,
93 TInt aImageMaskId = -1,
94 CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone);
97 * Update the softkeys of the message query.
99 * @param aSoftkeys New resource for softkeys.
101 IMPORT_C void UpdateMsgQuery( TInt aSoftkeys );
104 * Cancel the message query.
106 IMPORT_C void CancelMsgQuery();
109 * Set delay after which query will be removed from screen after message is completed.
110 * Can be used to get around problems with global query exit and CrossCheckForeground probs.
111 * Must be called before ShowMsgQueryL in order to be effective.
113 * @param aDelay Time in microsecond, after which query will be removed from display.
116 IMPORT_C void SetExitDelay(TInt aDelay);
119 * Set Skin id for query header image. Must be called before ShowMsgQueryL in order to have
120 * effect. No need to use this method if image from avkon.mbm is used.
122 * @aparam aId SkinId for image in query. If image not found from active skin, image
123 * definitions used in ShowMsgQueryL used instead.
126 IMPORT_C void SetImageSkinId( TAknsItemID& aId );
129 * Sets additional information to be sent to secondary display. Takes ownership of object.
130 * Must be called before sending data to notifier to have effect.
132 * @param aData Data to be sent to cover UI.
136 IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
139 CAknGlobalMsgQuery();
143 TAknGlobalQueryCmd iCmd;
147 CAknQueryDialog::TTone iTone;
154 CAknSDData* iAknSDData;
155 TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
158 #endif // __AKNGLOBALMSGQUERY_H__