30 // FORWARD DECLARATION |
30 // FORWARD DECLARATION |
31 class CPsSettings; |
31 class CPsSettings; |
32 |
32 |
33 // CLASS DECLARATION |
33 // CLASS DECLARATION |
34 /** |
34 /** |
35 * |
35 * @lib |
36 * |
|
37 * |
|
38 * |
|
39 * @lib |
|
40 * @since S60 v3.2 |
36 * @since S60 v3.2 |
41 */ |
37 */ |
42 class CPsTestQueryHandler: public CBase, |
38 class CPsTestQueryHandler: public CBase, |
43 public MPsResultsObserver |
39 public MPsResultsObserver |
44 { |
40 { |
45 |
|
46 public: // Constructors and destructor |
|
47 |
41 |
48 /** |
42 public: // Constructors and destructor |
49 * Two-phased constructor. |
|
50 */ |
|
51 static CPsTestQueryHandler* NewL(); |
|
52 |
43 |
53 /** |
44 /** |
54 * Destructor. |
45 * Two-phased constructor. |
55 */ |
46 */ |
56 virtual ~CPsTestQueryHandler(); |
47 static CPsTestQueryHandler* NewL(); |
57 |
48 |
58 public: // New functions |
49 /** |
59 /** |
50 * Destructor. |
60 * Sets the test case currently being executed |
51 */ |
61 * |
52 virtual ~CPsTestQueryHandler(); |
62 * @param aCurrentTestCase Current test case. |
|
63 */ |
|
64 void SetCurrentTestCase(TTestCase aCurrentTestCase); |
|
65 |
|
66 /** |
|
67 * Sets the error code for test case |
|
68 * |
|
69 * @param aCurrentErrorCode Error code for the test case. |
|
70 */ |
|
71 void SetCurrentErrorCode(TInt aCurrentErrorCode); |
|
72 |
|
73 /** |
|
74 * Returns the error code for test case |
|
75 * |
|
76 * @return Error code for the test case. |
|
77 */ |
|
78 TInt CurrentErrorCode(); |
|
79 |
|
80 void GetAllContentsL(); |
|
81 |
|
82 void StartSearchL(const CPsQuery& aSearchQuery); |
|
83 |
|
84 void TestSearchL(const TDesC& aBuf, TKeyboardModes aMode); |
|
85 |
|
86 void InputSearchL(const CPsQuery& aSearchQuery, const TDesC& aInput, RPointerArray<TDesC>& aResultSet); |
|
87 |
|
88 void SetSearchSettingsL(RPointerArray<TDesC>& aSearchUri, RArray<TInt>& aDisplayFields, TInt aMaxResults); |
|
89 |
|
90 void ShutDownL(); |
|
91 |
|
92 void Cancel(); |
|
93 |
|
94 TVersion Version(); |
|
95 |
|
96 TBool IsLanguageSupportedL(TLanguage aLang); |
|
97 |
53 |
98 public: // Function from base class MPsResultsObserver |
54 public: // New functions |
99 /** |
55 |
100 * HandlePsResultsUpdateL. |
56 /** |
101 * Handle updates from the server. |
57 * Sets the test case currently being executed |
102 * |
58 * |
103 * @param searchResults Search results returned from the server. |
59 * @param aCurrentTestCase Current test case. |
104 * @param searchSeqs List of matching character sequences. |
60 */ |
105 */ |
61 void SetCurrentTestCase(TTestCase aCurrentTestCase); |
106 void HandlePsResultsUpdate(RPointerArray<CPsClientData>& searchResults, RPointerArray<TDesC>& searchSeqs); |
62 |
107 |
63 /** |
108 /** |
64 * Sets the error code for test case |
109 * HandlePsError. |
65 * |
110 * Handle errors from the server. |
66 * @param aCurrentErrorCode Error code for the test case. |
111 * |
67 */ |
112 * @param aErrorCode Search errors returned from the server. |
68 void SetCurrentErrorCode(TInt aCurrentErrorCode); |
113 */ |
69 |
114 void HandlePsError(TInt aErrorCode); |
70 /** |
115 |
71 * Returns the error code for test case |
|
72 * |
|
73 * @return Error code for the test case. |
|
74 */ |
|
75 TInt CurrentErrorCode(); |
|
76 |
|
77 void GetAllContentsL(); |
|
78 |
|
79 void StartSearchL(const CPsQuery& aSearchQuery); |
|
80 |
|
81 void TestSearchL(const TDesC& aBuf, TKeyboardModes aMode); |
|
82 |
|
83 void InputSearchL(const CPsQuery& aSearchQuery, const TDesC& aInput, RPointerArray<TDesC>& aResultSet); |
|
84 |
|
85 void SetSearchSettingsL(RPointerArray<TDesC>& aSearchUri, RArray<TInt>& aDisplayFields, TInt aMaxResults); |
|
86 |
|
87 void ShutDownL(); |
|
88 |
|
89 void Cancel(); |
|
90 |
|
91 TVersion Version(); |
|
92 |
|
93 TBool IsLanguageSupportedL(TLanguage aLang); |
|
94 |
|
95 public: // Function from base class MPsResultsObserver |
|
96 |
|
97 /** |
|
98 * HandlePsResultsUpdateL. |
|
99 * Handle updates from the server. |
|
100 * |
|
101 * @param searchResults Search results returned from the server. |
|
102 * @param searchSeqs List of matching character sequences. |
|
103 */ |
|
104 void HandlePsResultsUpdate(RPointerArray<CPsClientData>& searchResults, RPointerArray<TDesC>& searchSeqs); |
|
105 |
|
106 /** |
|
107 * HandlePsError. |
|
108 * Handle errors from the server. |
|
109 * |
|
110 * @param aErrorCode Search errors returned from the server. |
|
111 */ |
|
112 void HandlePsError(TInt aErrorCode); |
|
113 |
116 /** |
114 /** |
117 * CachingStatus |
115 * CachingStatus |
118 * Gets called when caching is completed. |
116 * Gets called when caching is completed. |
119 * Observers need to implement this function accordingly |
117 * Observers need to implement this function accordingly |
120 * to take action after cache completion |
118 * to take action after cache completion |
121 * @param aStatus - caching status, 20 - Caching completes succesfully, 30 - Caching completed with errors |
119 * @param aStatus - caching status, 20 - Caching completes succesfully, 30 - Caching completed with errors |
122 * @param aError - Any error that occurred while caching. KErrNone if no error else the error code |
120 * @param aError - Any error that occurred while caching. KErrNone if no error else the error code |
123 */ |
121 */ |
124 void CachingStatus(TCachingStatus& aStatus, TInt& aError); |
122 void CachingStatus(TCachingStatus& aStatus, TInt& aError); |
125 |
123 |
126 public: |
124 public: |
127 /** |
|
128 * Sets the list of contacts created for test case |
|
129 * |
|
130 * @param aContactsList List of contacts (each contact as CPsClientData). |
|
131 */ |
|
132 void SetContactsDetails(RPointerArray<CPsClientData>& aContactsList); |
|
133 |
|
134 TInt IndexForGroupDataL(); |
|
135 |
|
136 private: |
|
137 /** |
|
138 * C++ default constructor. |
|
139 */ |
|
140 CPsTestQueryHandler(); |
|
141 |
125 |
142 /** |
126 /** |
143 * Symbian 2nd phase constructor. |
127 * Sets the list of contacts created for test case |
144 */ |
128 * |
145 void ConstructL(); |
129 * @param aContactsList List of contacts (each contact as CPsClientData). |
|
130 */ |
|
131 void SetContactsDetails(RPointerArray<CPsClientData>& aContactsList); |
|
132 |
|
133 TInt IndexForGroupDataL(); |
146 |
134 |
147 private: |
135 private: |
148 |
136 |
149 void FormTestSearchQueryL(const TDesC& aBuf, TKeyboardModes aMode); |
137 /** |
150 |
138 * C++ default constructor. |
151 void VerifyResult(RPointerArray<CPsClientData>& aSearchResults, TBool aResultType); |
139 */ |
152 |
140 CPsTestQueryHandler(); |
153 TBool VerifySortResult(RPointerArray<CPsClientData>& aSearchResults); |
|
154 |
|
155 void SwitchEPsData(RPointerArray<CPsClientData>& searchResults); |
|
156 |
|
157 TInt CompareByData ( const CPsClientData& aObject1, const CPsClientData& aObject2 ); |
|
158 |
141 |
159 private: // data |
142 /** |
|
143 * Symbian 2nd phase constructor. |
|
144 */ |
|
145 void ConstructL(); |
160 |
146 |
161 TTestCase iCurrentTestCase; |
147 private: |
162 |
148 |
163 TInt iCurrentErrorCode; |
149 void FormTestSearchQueryL(const TDesC& aBuf, TKeyboardModes aMode); |
164 |
150 |
|
151 void VerifyResult(RPointerArray<CPsClientData>& aSearchResults, TBool aResultType); |
|
152 |
|
153 TBool VerifySortResult(RPointerArray<CPsClientData>& aSearchResults); |
|
154 |
|
155 void SwitchEPsData(RPointerArray<CPsClientData>& searchResults); |
|
156 |
|
157 TInt CompareByData ( const CPsClientData& aObject1, const CPsClientData& aObject2 ); |
|
158 |
|
159 private: // data |
|
160 |
|
161 TTestCase iCurrentTestCase; |
|
162 |
|
163 TInt iCurrentErrorCode; |
|
164 |
165 CPSRequestHandler* iAsyncHandler; |
165 CPSRequestHandler* iAsyncHandler; |
166 |
166 |
167 CPsSettings* iSettings; |
167 CPsSettings* iSettings; |
168 |
168 |
169 CPsQuery *iPsQuery; |
169 CPsQuery *iPsQuery; |
170 |
|
171 RPointerArray<CPsClientData> iContactsList; |
|
172 |
170 |
|
171 RPointerArray<CPsClientData> iContactsList; |
173 }; |
172 }; |
174 |
173 |
175 #endif //PSTEST_QUERY_HANDLER_H |
174 #endif //PSTEST_QUERY_HANDLER_H |