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 confirmation query.
18 #ifndef __AKNGLOBALCONFIRMATIONQUERY_H__
19 #define __AKNGLOBALCONFIRMATIONQUERY_H__
21 #include <AknNotify.h>
22 #include <AknNotifyStd.h>
23 #include <AknQueryDialog.h>
24 #include <AknsItemID.h>
29 * CAknGlobalConfirmationQuery
30 * Uses notification framework to show a global confirmation query.
32 * Create an active object, start it and pass its TRequestStatus as a
33 * parameter to ShowConfirmationQueryL. After the user presses a softkey,
34 * the request status will hold the id of the pressed softkey. E.g. If
35 * the user selected Cancel, the request status will hold -1.
37 * Example 1. Show the global confirmation query:
38 * if ( iConfObserver )
40 * iConfObserver->Cancel();
41 * delete iConfObserver;
43 * iConfObserver = new(ELeave) CGlobalConfirmationObserver(iEikonEnv);
44 * iConfObserver->Start();
45 * iGlobalConfirmationQuery->ShowMsgQueryL(
46 * iConfObserver->iStatus,
48 * R_AVKON_SOFTKEYS_OK_CANCEL,
49 * R_QUERY_NOTE_ANIMATION);
52 * Example 2. Get and handle the result in active object.
53 * void CMyActiveObject::RunL()
55 * TBuf<120> msg = _L("Received: ");
56 * msg.AppendNum( iStatus.Int() );
61 * Example 3. Update the query (softkeys)
62 * iGlobalConfirmationQuery->UpdateConfirmationQuery( R_AVKON_SOFTKEYS_BACK );
64 * Example 4. Cancel the query
65 * iGlobalConfirmationQuery->CancelConfirmationQuery();
67 * NOTE !!! All descriptors passed as parameters need to be class members, i.e.
68 * they cannot be local variables of a method. That is because
69 * they need to exist when server gets the message.
72 NONSHARABLE_CLASS(CAknGlobalConfirmationQuery) : public CBase
75 IMPORT_C static CAknGlobalConfirmationQuery* NewL();
76 IMPORT_C static CAknGlobalConfirmationQuery* NewLC();
77 IMPORT_C ~CAknGlobalConfirmationQuery();
80 * Shows global confirmation query synchronously.
82 * @param aStatus TRequestStatus which will be completed when user
83 * selects one item from the list query.
84 * @param aPrompt Prompt text.
85 * @param aSoftkeys Softkey resource.
86 * @param aAnimation Animation resource.
87 * @param aTone Tone id.
88 * @param aDismissWithAllKeys If set ETrue the query gets dismissed with all
91 IMPORT_C void ShowConfirmationQueryL(
92 TRequestStatus& aStatus,
96 const TDesC& aImageFile = KNullDesC,
98 TInt aImageMaskId = 0,
99 CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone,
100 TBool aDismissWithAllKeys = EFalse );
102 * Update the softkeys of the confirmation query.
104 * @param aSoftkeys New resource for softkeys.
106 IMPORT_C void UpdateConfirmationQuery( TInt aSoftkeys );
109 * Cancel the confirmation query.
111 IMPORT_C void CancelConfirmationQuery();
114 * Set skin id for query image. Must be called before ShowConfirmationQueryL in order to
115 * have effect. No need to use this method if image from avkon.mbm is used.
117 * @aparam aId SkinId for image in query. If image is not found from the active skin,
118 * image definitions used in ShowConfirmationQueryL are used instead.
121 IMPORT_C void SetImageSkinId( TAknsItemID& aId );
124 * Sets additional information to be sent to secondary display. Takes ownership of object.
125 * Must be called before sending data to notifier to have effect.
127 * @param aData Data to be sent to cover UI.
131 IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
134 CAknGlobalConfirmationQuery();
138 TAknGlobalQueryCmd iCmd;
141 CAknQueryDialog::TTone iTone;
147 CAknSDData* iAknSDData;
148 TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
151 #endif // __AKNGLOBALCONFIRMATIONQUERY_H__