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 list query.
18 #ifndef __AKNGLOBALLISTQUERY_H__
19 #define __AKNGLOBALLISTQUERY_H__
21 #include <AknNotify.h>
22 #include <AknNotifyStd.h>
27 // Default index for list query
28 const TInt KGlobalListQueryDefaultIndex = 0;
30 _LIT( KGlobalListQueryItemSeparator, "\n");
34 * Uses notification framework to show a global list query.
36 * Create an active object, start it and pass its TRequestStatus as a
37 * parameter to ShowListQueryL. After the user selects one item from
38 * the list query, the request status will hold the number of the
39 * selected item. If the user selected Cancel, the request status will
42 * Example 1. Show the global list query:
43 * CDesCArray* textArray = iCoeEnv->ReadDesCArrayResourceL( R_GLOBAL_LIST_ARRAY );
44 * CleanupStack::PushL(textArray);
46 * if ( iListObserver )
48 * iListObserver->Cancel();
49 * delete iListObserver;
51 * iListObserver = new(ELeave) CGlobalListObserver(iEikonEnv);
52 * iListObserver->Start();
53 * iGlobalListQuery->ShowListQueryL(textArray, iListObserver->iStatus, 4);
54 * CleanupStack::PopAndDestroy(); // textArray
56 * Example 2. Get and handle the result in active object.
57 * void CMyActiveObject::RunL()
59 * TBuf<120> msg = _L("Received: ");
60 * msg.AppendNum( iStatus.Int() );
65 NONSHARABLE_CLASS(CAknGlobalListQuery) : public CBase
69 * Two-phased constructor.
71 IMPORT_C static CAknGlobalListQuery* NewL();
74 * Two-phased constructor. Leaves the instance to cleanupstack
76 IMPORT_C static CAknGlobalListQuery* NewLC();
81 IMPORT_C ~CAknGlobalListQuery();
84 * Shows global list query synchronously.
86 * @param aItems Strings for items
87 * @param aStatus TRequestStatus which will be completed when user
88 * selects one item from the list query.
89 * @param aIndex Index which item in the list will be highlighted
91 IMPORT_C void ShowListQueryL(
92 const MDesCArray* aItems,
93 TRequestStatus& aStatus,
94 const TInt aIndex = KGlobalListQueryDefaultIndex);
99 IMPORT_C void MoveSelectionUp();
102 * Move selection down.
104 IMPORT_C void MoveSelectionDown();
107 * Select currently selected item in the list.
109 IMPORT_C void SelectItem();
112 * Cancel the list query.
114 IMPORT_C void CancelListQuery();
117 * Sets the heading for the query. In order to have effect, the heading must be set before
118 * calling ShowListQueryL.
120 * @param aHeading Heading string.
123 IMPORT_C void SetHeadingL(const TDesC& aHeading);
126 * Sets additional information to be sent to secondary display. Takes ownership of object.
127 * Must be called before sending data to notifier to have effect.
129 * @param aData Data to be sent to cover UI.
133 IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
137 * Updates list query.
139 IMPORT_C void UpdateListQuery();
143 * Default constructor.
145 CAknGlobalListQuery();
154 TAknGlobalQueryCmd iCmd;
157 // Index to set which item will be selected.
159 // Buffer to hold the variables passed to server.
161 // Pointer to buffer.
164 CAknSDData* iAknSDData;
165 TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
168 #endif // __AKNGLOBALLISTQUERY_H__