|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Uses notification framework to show a global confirmation query. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __AKNGLOBALCONFIRMATIONQUERY_H__ |
|
19 #define __AKNGLOBALCONFIRMATIONQUERY_H__ |
|
20 |
|
21 #include <AknNotify.h> |
|
22 #include <AknNotifyStd.h> |
|
23 #include <AknQueryDialog.h> |
|
24 #include <AknsItemID.h> |
|
25 |
|
26 class CAknSDData; |
|
27 |
|
28 /** |
|
29 * CAknGlobalConfirmationQuery |
|
30 * Uses notification framework to show a global confirmation query. |
|
31 * Usage: |
|
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. |
|
36 * |
|
37 * Example 1. Show the global confirmation query: |
|
38 * if ( iConfObserver ) |
|
39 * { |
|
40 * iConfObserver->Cancel(); |
|
41 * delete iConfObserver; |
|
42 * } |
|
43 * iConfObserver = new(ELeave) CGlobalConfirmationObserver(iEikonEnv); |
|
44 * iConfObserver->Start(); |
|
45 * iGlobalConfirmationQuery->ShowMsgQueryL( |
|
46 * iConfObserver->iStatus, |
|
47 * iPrompt, |
|
48 * R_AVKON_SOFTKEYS_OK_CANCEL, |
|
49 * R_QUERY_NOTE_ANIMATION); |
|
50 * |
|
51 * |
|
52 * Example 2. Get and handle the result in active object. |
|
53 * void CMyActiveObject::RunL() |
|
54 * { |
|
55 * TBuf<120> msg = _L("Received: "); |
|
56 * msg.AppendNum( iStatus.Int() ); |
|
57 * iEnv->InfoMsg(msg); |
|
58 * Cancel(); |
|
59 * } |
|
60 * |
|
61 * Example 3. Update the query (softkeys) |
|
62 * iGlobalConfirmationQuery->UpdateConfirmationQuery( R_AVKON_SOFTKEYS_BACK ); |
|
63 * |
|
64 * Example 4. Cancel the query |
|
65 * iGlobalConfirmationQuery->CancelConfirmationQuery(); |
|
66 * |
|
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. |
|
70 */ |
|
71 |
|
72 NONSHARABLE_CLASS(CAknGlobalConfirmationQuery) : public CBase |
|
73 { |
|
74 public: |
|
75 IMPORT_C static CAknGlobalConfirmationQuery* NewL(); |
|
76 IMPORT_C static CAknGlobalConfirmationQuery* NewLC(); |
|
77 IMPORT_C ~CAknGlobalConfirmationQuery(); |
|
78 |
|
79 /** |
|
80 * Shows global confirmation query synchronously. |
|
81 * |
|
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 |
|
89 * keypresses. |
|
90 */ |
|
91 IMPORT_C void ShowConfirmationQueryL( |
|
92 TRequestStatus& aStatus, |
|
93 const TDesC& aPrompt, |
|
94 TInt aSoftkeys = 0, |
|
95 TInt aAnimation = 0, |
|
96 const TDesC& aImageFile = KNullDesC, |
|
97 TInt aImageId = 0, |
|
98 TInt aImageMaskId = 0, |
|
99 CAknQueryDialog::TTone aTone = CAknQueryDialog::ENoTone, |
|
100 TBool aDismissWithAllKeys = EFalse ); |
|
101 /** |
|
102 * Update the softkeys of the confirmation query. |
|
103 * |
|
104 * @param aSoftkeys New resource for softkeys. |
|
105 */ |
|
106 IMPORT_C void UpdateConfirmationQuery( TInt aSoftkeys ); |
|
107 |
|
108 /** |
|
109 * Cancel the confirmation query. |
|
110 */ |
|
111 IMPORT_C void CancelConfirmationQuery(); |
|
112 |
|
113 /** |
|
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. |
|
116 * |
|
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. |
|
119 * @since S60 2.6 |
|
120 */ |
|
121 IMPORT_C void SetImageSkinId( TAknsItemID& aId ); |
|
122 |
|
123 /** |
|
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. |
|
126 * |
|
127 * @param aData Data to be sent to cover UI. |
|
128 * @since S60 3.1 |
|
129 * @internal to S60 |
|
130 */ |
|
131 IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData); |
|
132 |
|
133 private: |
|
134 CAknGlobalConfirmationQuery(); |
|
135 void ConstructL(); |
|
136 |
|
137 private: |
|
138 TAknGlobalQueryCmd iCmd; |
|
139 TInt iSoftkeys; |
|
140 TInt iAnimation; |
|
141 CAknQueryDialog::TTone iTone; |
|
142 RNotifier iNotify; |
|
143 CBufFlat *iBuffer; |
|
144 TPtrC8 iBufferPtr; |
|
145 TInt iSkinsMajorId; |
|
146 TInt iSkinsMinorId; |
|
147 CAknSDData* iAknSDData; |
|
148 TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors. |
|
149 }; |
|
150 |
|
151 #endif // __AKNGLOBALCONFIRMATIONQUERY_H__ |