williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
3 |
* All rights reserved.
|
williamr@4
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Initial Contributors:
|
williamr@4
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Contributors:
|
williamr@4
|
13 |
*
|
williamr@4
|
14 |
* Description: Uses notification framework to show a global list query.
|
williamr@4
|
15 |
*
|
williamr@4
|
16 |
*/
|
williamr@4
|
17 |
|
williamr@4
|
18 |
#ifndef __AKNGLOBALLISTQUERY_H__
|
williamr@4
|
19 |
#define __AKNGLOBALLISTQUERY_H__
|
williamr@4
|
20 |
|
williamr@4
|
21 |
#include <AknNotify.h>
|
williamr@4
|
22 |
#include <AknNotifyStd.h>
|
williamr@4
|
23 |
#include <bamdesca.h>
|
williamr@4
|
24 |
|
williamr@4
|
25 |
class CAknSDData;
|
williamr@4
|
26 |
|
williamr@4
|
27 |
// Default index for list query
|
williamr@4
|
28 |
const TInt KGlobalListQueryDefaultIndex = 0;
|
williamr@4
|
29 |
|
williamr@4
|
30 |
_LIT( KGlobalListQueryItemSeparator, "\n");
|
williamr@4
|
31 |
|
williamr@4
|
32 |
/**
|
williamr@4
|
33 |
* CAknGlobalListQuery
|
williamr@4
|
34 |
* Uses notification framework to show a global list query.
|
williamr@4
|
35 |
* Usage:
|
williamr@4
|
36 |
* Create an active object, start it and pass its TRequestStatus as a
|
williamr@4
|
37 |
* parameter to ShowListQueryL. After the user selects one item from
|
williamr@4
|
38 |
* the list query, the request status will hold the number of the
|
williamr@4
|
39 |
* selected item. If the user selected Cancel, the request status will
|
williamr@4
|
40 |
* hold -1.
|
williamr@4
|
41 |
*
|
williamr@4
|
42 |
* Example 1. Show the global list query:
|
williamr@4
|
43 |
* CDesCArray* textArray = iCoeEnv->ReadDesCArrayResourceL( R_GLOBAL_LIST_ARRAY );
|
williamr@4
|
44 |
* CleanupStack::PushL(textArray);
|
williamr@4
|
45 |
* TInt result = -555;
|
williamr@4
|
46 |
* if ( iListObserver )
|
williamr@4
|
47 |
* {
|
williamr@4
|
48 |
* iListObserver->Cancel();
|
williamr@4
|
49 |
* delete iListObserver;
|
williamr@4
|
50 |
* }
|
williamr@4
|
51 |
* iListObserver = new(ELeave) CGlobalListObserver(iEikonEnv);
|
williamr@4
|
52 |
* iListObserver->Start();
|
williamr@4
|
53 |
* iGlobalListQuery->ShowListQueryL(textArray, iListObserver->iStatus, 4);
|
williamr@4
|
54 |
* CleanupStack::PopAndDestroy(); // textArray
|
williamr@4
|
55 |
*
|
williamr@4
|
56 |
* Example 2. Get and handle the result in active object.
|
williamr@4
|
57 |
* void CMyActiveObject::RunL()
|
williamr@4
|
58 |
* {
|
williamr@4
|
59 |
* TBuf<120> msg = _L("Received: ");
|
williamr@4
|
60 |
* msg.AppendNum( iStatus.Int() );
|
williamr@4
|
61 |
* iEnv->InfoMsg(msg);
|
williamr@4
|
62 |
* Cancel();
|
williamr@4
|
63 |
* }
|
williamr@4
|
64 |
*/
|
williamr@4
|
65 |
NONSHARABLE_CLASS(CAknGlobalListQuery) : public CBase
|
williamr@4
|
66 |
{
|
williamr@4
|
67 |
public:
|
williamr@4
|
68 |
/**
|
williamr@4
|
69 |
* Two-phased constructor.
|
williamr@4
|
70 |
*/
|
williamr@4
|
71 |
IMPORT_C static CAknGlobalListQuery* NewL();
|
williamr@4
|
72 |
|
williamr@4
|
73 |
/**
|
williamr@4
|
74 |
* Two-phased constructor. Leaves the instance to cleanupstack
|
williamr@4
|
75 |
*/
|
williamr@4
|
76 |
IMPORT_C static CAknGlobalListQuery* NewLC();
|
williamr@4
|
77 |
|
williamr@4
|
78 |
/**
|
williamr@4
|
79 |
* Destructor
|
williamr@4
|
80 |
*/
|
williamr@4
|
81 |
IMPORT_C ~CAknGlobalListQuery();
|
williamr@4
|
82 |
|
williamr@4
|
83 |
/**
|
williamr@4
|
84 |
* Shows global list query synchronously.
|
williamr@4
|
85 |
*
|
williamr@4
|
86 |
* @param aItems Strings for items
|
williamr@4
|
87 |
* @param aStatus TRequestStatus which will be completed when user
|
williamr@4
|
88 |
* selects one item from the list query.
|
williamr@4
|
89 |
* @param aIndex Index which item in the list will be highlighted
|
williamr@4
|
90 |
*/
|
williamr@4
|
91 |
IMPORT_C void ShowListQueryL(
|
williamr@4
|
92 |
const MDesCArray* aItems,
|
williamr@4
|
93 |
TRequestStatus& aStatus,
|
williamr@4
|
94 |
const TInt aIndex = KGlobalListQueryDefaultIndex);
|
williamr@4
|
95 |
|
williamr@4
|
96 |
/**
|
williamr@4
|
97 |
* Move selection up.
|
williamr@4
|
98 |
*/
|
williamr@4
|
99 |
IMPORT_C void MoveSelectionUp();
|
williamr@4
|
100 |
|
williamr@4
|
101 |
/**
|
williamr@4
|
102 |
* Move selection down.
|
williamr@4
|
103 |
*/
|
williamr@4
|
104 |
IMPORT_C void MoveSelectionDown();
|
williamr@4
|
105 |
|
williamr@4
|
106 |
/**
|
williamr@4
|
107 |
* Select currently selected item in the list.
|
williamr@4
|
108 |
*/
|
williamr@4
|
109 |
IMPORT_C void SelectItem();
|
williamr@4
|
110 |
|
williamr@4
|
111 |
/**
|
williamr@4
|
112 |
* Cancel the list query.
|
williamr@4
|
113 |
*/
|
williamr@4
|
114 |
IMPORT_C void CancelListQuery();
|
williamr@4
|
115 |
|
williamr@4
|
116 |
/**
|
williamr@4
|
117 |
* Sets the heading for the query. In order to have effect, the heading must be set before
|
williamr@4
|
118 |
* calling ShowListQueryL.
|
williamr@4
|
119 |
*
|
williamr@4
|
120 |
* @param aHeading Heading string.
|
williamr@4
|
121 |
* @since 2.1
|
williamr@4
|
122 |
*/
|
williamr@4
|
123 |
IMPORT_C void SetHeadingL(const TDesC& aHeading);
|
williamr@4
|
124 |
|
williamr@4
|
125 |
/**
|
williamr@4
|
126 |
* Sets additional information to be sent to secondary display. Takes ownership of object.
|
williamr@4
|
127 |
* Must be called before sending data to notifier to have effect.
|
williamr@4
|
128 |
*
|
williamr@4
|
129 |
* @param aData Data to be sent to cover UI.
|
williamr@4
|
130 |
* @internal to S60
|
williamr@4
|
131 |
* @since S60 3.1
|
williamr@4
|
132 |
*/
|
williamr@4
|
133 |
IMPORT_C void SetSecondaryDisplayData(CAknSDData* aData);
|
williamr@4
|
134 |
|
williamr@4
|
135 |
private:
|
williamr@4
|
136 |
/**
|
williamr@4
|
137 |
* Updates list query.
|
williamr@4
|
138 |
*/
|
williamr@4
|
139 |
IMPORT_C void UpdateListQuery();
|
williamr@4
|
140 |
|
williamr@4
|
141 |
private:
|
williamr@4
|
142 |
/**
|
williamr@4
|
143 |
* Default constructor.
|
williamr@4
|
144 |
*/
|
williamr@4
|
145 |
CAknGlobalListQuery();
|
williamr@4
|
146 |
|
williamr@4
|
147 |
/**
|
williamr@4
|
148 |
* EPOC constructor.
|
williamr@4
|
149 |
*/
|
williamr@4
|
150 |
void ConstructL();
|
williamr@4
|
151 |
|
williamr@4
|
152 |
private:
|
williamr@4
|
153 |
// Command id.
|
williamr@4
|
154 |
TAknGlobalQueryCmd iCmd;
|
williamr@4
|
155 |
// Notifier handle.
|
williamr@4
|
156 |
RNotifier iNotify;
|
williamr@4
|
157 |
// Index to set which item will be selected.
|
williamr@4
|
158 |
TInt iIndex;
|
williamr@4
|
159 |
// Buffer to hold the variables passed to server.
|
williamr@4
|
160 |
CBufFlat *iBuffer;
|
williamr@4
|
161 |
// Pointer to buffer.
|
williamr@4
|
162 |
TPtrC8 iBufferPtr;
|
williamr@4
|
163 |
HBufC* iHeading;
|
williamr@4
|
164 |
CAknSDData* iAknSDData;
|
williamr@4
|
165 |
TBuf8<1> iResultBuf; // Not really used, but needed to prevent buffer handling errors.
|
williamr@4
|
166 |
};
|
williamr@4
|
167 |
|
williamr@4
|
168 |
#endif // __AKNGLOBALLISTQUERY_H__
|