76 } |
76 } |
77 |
77 |
78 |
78 |
79 // class CHnRepositoryWidgetTypeObserver |
79 // class CHnRepositoryWidgetTypeObserver |
80 // --------------------------------------------------------------------------- |
80 // --------------------------------------------------------------------------- |
81 // |
81 // |
82 // --------------------------------------------------------------------------- |
82 // --------------------------------------------------------------------------- |
83 // |
83 // |
84 CHnRepositoryWidgetTypeObserver * CHnRepositoryWidgetTypeObserver::NewL( |
84 CHnRepositoryWidgetTypeObserver * CHnRepositoryWidgetTypeObserver::NewL( |
85 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid ) |
85 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid ) |
86 { |
86 { |
87 CHnRepositoryWidgetTypeObserver * self = CHnRepositoryWidgetTypeObserver::NewLC( aCmnPtrs, aRepositoryUid ); |
87 CHnRepositoryWidgetTypeObserver * self = CHnRepositoryWidgetTypeObserver::NewLC( aCmnPtrs, aRepositoryUid ); |
88 CleanupStack::Pop(self); |
88 CleanupStack::Pop(self); |
89 return self; |
89 return self; |
90 } |
90 } |
91 |
91 |
92 // --------------------------------------------------------------------------- |
92 // --------------------------------------------------------------------------- |
93 // |
93 // |
94 // --------------------------------------------------------------------------- |
94 // --------------------------------------------------------------------------- |
95 // |
95 // |
96 CHnRepositoryWidgetTypeObserver * CHnRepositoryWidgetTypeObserver::NewLC( |
96 CHnRepositoryWidgetTypeObserver * CHnRepositoryWidgetTypeObserver::NewLC( |
97 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid ) |
97 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid ) |
98 { |
98 { |
99 CHnRepositoryWidgetTypeObserver * self = new (ELeave) CHnRepositoryWidgetTypeObserver( aCmnPtrs ); |
99 CHnRepositoryWidgetTypeObserver * self = new (ELeave) CHnRepositoryWidgetTypeObserver( aCmnPtrs ); |
100 CleanupStack::PushL(self); |
100 CleanupStack::PushL(self); |
101 self->ConstructL( aRepositoryUid ); |
101 self->ConstructL( aRepositoryUid ); |
102 return self; |
102 return self; |
103 } |
103 } |
104 |
104 |
105 // --------------------------------------------------------------------------- |
105 // --------------------------------------------------------------------------- |
106 // |
106 // |
107 // --------------------------------------------------------------------------- |
107 // --------------------------------------------------------------------------- |
108 // |
108 // |
109 void CHnRepositoryWidgetTypeObserver::ConstructL( const TUid aRepositoryUid ) |
109 void CHnRepositoryWidgetTypeObserver::ConstructL( const TUid aRepositoryUid ) |
110 { |
110 { |
111 CHnRepositoryObserver::ConstructL( aRepositoryUid ); |
111 CHnRepositoryObserver::ConstructL( aRepositoryUid ); |
113 iNotifyHandler->StartListeningL(); |
113 iNotifyHandler->StartListeningL(); |
114 } |
114 } |
115 |
115 |
116 |
116 |
117 // --------------------------------------------------------------------------- |
117 // --------------------------------------------------------------------------- |
118 // |
118 // |
119 // --------------------------------------------------------------------------- |
119 // --------------------------------------------------------------------------- |
120 // |
120 // |
121 CHnRepositoryWidgetTypeObserver::CHnRepositoryWidgetTypeObserver( THnMdCommonPointers* aCmnPtrs ) |
121 CHnRepositoryWidgetTypeObserver::CHnRepositoryWidgetTypeObserver( THnMdCommonPointers* aCmnPtrs ) |
122 : CHnRepositoryObserver( aCmnPtrs ) |
122 : CHnRepositoryObserver( aCmnPtrs ) |
123 { |
123 { |
124 |
124 |
125 } |
125 } |
126 |
126 |
127 // --------------------------------------------------------------------------- |
127 // --------------------------------------------------------------------------- |
128 // |
128 // |
129 // --------------------------------------------------------------------------- |
129 // --------------------------------------------------------------------------- |
130 // |
130 // |
131 CHnRepositoryWidgetTypeObserver::~CHnRepositoryWidgetTypeObserver() |
131 CHnRepositoryWidgetTypeObserver::~CHnRepositoryWidgetTypeObserver() |
132 { |
132 { |
133 iWidgetSwitches.Close(); |
133 iWidgetSwitches.Close(); |
134 } |
134 } |
135 |
135 |
136 // --------------------------------------------------------------------------- |
136 // --------------------------------------------------------------------------- |
137 // |
137 // |
138 // --------------------------------------------------------------------------- |
138 // --------------------------------------------------------------------------- |
139 // |
139 // |
140 void CHnRepositoryWidgetTypeObserver::HandleNotifyGeneric(TUint32 aId) |
140 void CHnRepositoryWidgetTypeObserver::HandleNotifyGeneric(TUint32 aId) |
141 { |
141 { |
142 TRAP_IGNORE( HandleNotifyGenericL(aId) ); |
142 TRAP_IGNORE( HandleNotifyGenericL(aId) ); |
143 } |
143 } |
144 |
144 |
145 // --------------------------------------------------------------------------- |
145 // --------------------------------------------------------------------------- |
146 // |
146 // |
147 // --------------------------------------------------------------------------- |
147 // --------------------------------------------------------------------------- |
148 // |
148 // |
149 void CHnRepositoryWidgetTypeObserver::HandleNotifyGenericL(TUint32 aId) |
149 void CHnRepositoryWidgetTypeObserver::HandleNotifyGenericL(TUint32 aId) |
150 { |
150 { |
151 DEBUG(("_MM_:CHnRepositoryObserver::HandleNotifyGeneric IN")); |
151 DEBUG(("_MM_:CHnRepositoryObserver::HandleNotifyGeneric IN")); |
152 DEBUG(("\tID: %d",aId)); |
152 DEBUG(("\tID: %d",aId)); |
153 THnSuiteWidgetType suiteState( EUnspecified ); |
153 THnSuiteWidgetType suiteState( EUnspecified ); |
154 |
154 |
155 iRepository->Get( aId, (int &) suiteState); |
155 iRepository->Get( aId, (int &) suiteState); |
156 TInt id = iWidgetSwitches.Find(aId); |
156 TInt id = iWidgetSwitches.Find(aId); |
157 |
157 |
158 if ( suiteState == EChangeWidget ) |
158 if ( suiteState == EChangeWidget ) |
159 { |
159 { |
160 iWidgetSwitches.AppendL(aId); |
160 iWidgetSwitches.AppendL(aId); |
161 } |
161 } |
162 else if ( id != KErrNotFound ) |
162 else if ( id != KErrNotFound ) |
163 { |
163 { |
164 iWidgetSwitches.Remove(id); |
164 iWidgetSwitches.Remove(id); |
165 return; |
165 return; |
166 } |
166 } |
167 |
167 |
168 CHnSuiteModel* lastSuiteModel = iCmnPtrs->iContainer->GetLastSuiteModel(); |
168 CHnSuiteModel* lastSuiteModel = iCmnPtrs->iContainer->GetLastSuiteModel(); |
169 TBuf <NCentralRepositoryConstants::KMaxUnicodeStringLength> suiteName; |
169 TBuf <NCentralRepositoryConstants::KMaxUnicodeStringLength> suiteName; |
170 if ( iRepository->Get( aId - 1, suiteName ) == KErrNone && lastSuiteModel |
170 if ( iRepository->Get( aId - 1, suiteName ) == KErrNone && lastSuiteModel |
171 && lastSuiteModel->WidgetType() != suiteState ) |
171 && lastSuiteModel->WidgetType() != suiteState ) |
172 { |
172 { |
173 DEBUG16(("\t\tSuite Name: %S",&suiteName)); |
173 DEBUG16(("\t\tSuite Name: %S",&suiteName)); |
174 lastSuiteModel->GetItemsOrder()->MarkSuiteUninitialized(); |
174 lastSuiteModel->GetItemsOrder()->MarkSuiteUninitialized(); |
175 |
175 |
176 TInt32 suiteId = lastSuiteModel->CustomId(); |
176 TInt32 suiteId = lastSuiteModel->CustomId(); |
177 |
177 |
178 CLiwGenericParamList* inParam = CLiwGenericParamList::NewL(); |
178 CLiwGenericParamList* inParam = CLiwGenericParamList::NewL(); |
179 CleanupStack::PushL( inParam ); |
179 CleanupStack::PushL( inParam ); |
180 |
180 |
181 CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); |
181 CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); |
182 |
182 |
183 map->InsertL( KGenreName8, TLiwVariant(suiteName) ); |
183 map->InsertL( KGenreName8, TLiwVariant(suiteName) ); |
184 map->InsertL( KId8, TLiwVariant(suiteId) ); |
184 map->InsertL( KId8, TLiwVariant(suiteId) ); |
185 inParam->AppendL(TLiwGenericParam( KFilterElementItem8, TLiwVariant(map) )); |
185 inParam->AppendL(TLiwGenericParam( KFilterElementItem8, TLiwVariant(map) )); |
186 CleanupStack::PopAndDestroy( map ); |
186 CleanupStack::PopAndDestroy( map ); |
187 |
187 |
188 iCmnPtrs->iModelEventObserver->HandleModelEventL( KReevaluateMdEvent, *inParam ); |
188 iCmnPtrs->iModelEventObserver->HandleModelEventL( KReevaluateMdEvent, *inParam ); |
189 |
189 |
190 CleanupStack::PopAndDestroy( inParam ); |
190 CleanupStack::PopAndDestroy( inParam ); |
191 } |
191 } |
192 DEBUG(("_MM_:CHnRepositoryObserver::HandleNotifyGeneric OUT")); |
192 DEBUG(("_MM_:CHnRepositoryObserver::HandleNotifyGeneric OUT")); |
193 } |
193 } |
194 |
194 |
195 |
195 |
196 // class CHnRepositoryShowFolderObserver |
196 // class CHnRepositoryShowFolderObserver |
197 // --------------------------------------------------------------------------- |
197 // --------------------------------------------------------------------------- |
198 // |
198 // |
199 // --------------------------------------------------------------------------- |
199 // --------------------------------------------------------------------------- |
200 // |
200 // |
201 CHnRepositoryShowFolderObserver * CHnRepositoryShowFolderObserver::NewL( |
201 CHnRepositoryShowFolderObserver * CHnRepositoryShowFolderObserver::NewL( |
202 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId ) |
202 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId ) |
203 { |
203 { |
204 CHnRepositoryShowFolderObserver * self = CHnRepositoryShowFolderObserver::NewLC( aCmnPtrs, aRepositoryUid, aId ); |
204 CHnRepositoryShowFolderObserver * self = CHnRepositoryShowFolderObserver::NewLC( aCmnPtrs, aRepositoryUid, aId ); |
205 CleanupStack::Pop(self); |
205 CleanupStack::Pop(self); |
206 return self; |
206 return self; |
207 } |
207 } |
208 |
208 |
209 // --------------------------------------------------------------------------- |
209 // --------------------------------------------------------------------------- |
210 // |
210 // |
211 // --------------------------------------------------------------------------- |
211 // --------------------------------------------------------------------------- |
212 // |
212 // |
213 CHnRepositoryShowFolderObserver * CHnRepositoryShowFolderObserver::NewLC( |
213 CHnRepositoryShowFolderObserver * CHnRepositoryShowFolderObserver::NewLC( |
214 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId ) |
214 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId ) |
215 { |
215 { |
216 CHnRepositoryShowFolderObserver * self = new (ELeave) CHnRepositoryShowFolderObserver( aCmnPtrs, aId ); |
216 CHnRepositoryShowFolderObserver * self = new (ELeave) CHnRepositoryShowFolderObserver( aCmnPtrs, aId ); |
217 CleanupStack::PushL(self); |
217 CleanupStack::PushL(self); |
218 self->ConstructL( aRepositoryUid ); |
218 self->ConstructL( aRepositoryUid ); |
219 return self; |
219 return self; |
220 } |
220 } |
221 |
221 |
222 // --------------------------------------------------------------------------- |
222 // --------------------------------------------------------------------------- |
223 // |
223 // |
224 // --------------------------------------------------------------------------- |
224 // --------------------------------------------------------------------------- |
225 // |
225 // |
226 void CHnRepositoryShowFolderObserver::ConstructL( const TUid aRepositoryUid ) |
226 void CHnRepositoryShowFolderObserver::ConstructL( const TUid aRepositoryUid ) |
227 { |
227 { |
228 CHnRepositoryObserver::ConstructL( aRepositoryUid ); |
228 CHnRepositoryObserver::ConstructL( aRepositoryUid ); |
229 TInt ret = iRepository->Create( iId, KBlank ); |
229 TInt ret = iRepository->Create( iId, KBlank ); |
230 iNotifyHandler = CCenRepNotifyHandler::NewL( |
230 iNotifyHandler = CCenRepNotifyHandler::NewL( |
231 *this, *iRepository, |
231 *this, *iRepository, |
232 CCenRepNotifyHandler::EStringKey, iId ); |
232 CCenRepNotifyHandler::EStringKey, iId ); |
233 iNotifyHandler->StartListeningL(); |
233 iNotifyHandler->StartListeningL(); |
234 } |
234 } |
235 |
235 |
236 |
236 |
237 // --------------------------------------------------------------------------- |
237 // --------------------------------------------------------------------------- |
238 // |
238 // |
239 // --------------------------------------------------------------------------- |
239 // --------------------------------------------------------------------------- |
240 // |
240 // |
241 CHnRepositoryShowFolderObserver::CHnRepositoryShowFolderObserver( THnMdCommonPointers* aCmnPtrs, TUint32 aId ) |
241 CHnRepositoryShowFolderObserver::CHnRepositoryShowFolderObserver( THnMdCommonPointers* aCmnPtrs, TUint32 aId ) |
242 : CHnRepositoryObserver( aCmnPtrs, aId ) |
242 : CHnRepositoryObserver( aCmnPtrs, aId ) |
243 { |
243 { |
244 |
244 |
245 } |
245 } |
246 |
246 |
247 // --------------------------------------------------------------------------- |
247 // --------------------------------------------------------------------------- |
248 // |
248 // |
249 // --------------------------------------------------------------------------- |
249 // --------------------------------------------------------------------------- |
250 // |
250 // |
251 CHnRepositoryShowFolderObserver::~CHnRepositoryShowFolderObserver() |
251 CHnRepositoryShowFolderObserver::~CHnRepositoryShowFolderObserver() |
252 { |
252 { |
253 delete iServiceHandler; |
253 delete iServiceHandler; |
254 } |
254 } |
255 |
255 |
256 // --------------------------------------------------------------------------- |
256 // --------------------------------------------------------------------------- |
257 // |
257 // |
258 // --------------------------------------------------------------------------- |
258 // --------------------------------------------------------------------------- |
259 // |
259 // |
260 void CHnRepositoryShowFolderObserver::HandleNotifyString(TUint32 aId, const TDesC16& aNewValue ) |
260 void CHnRepositoryShowFolderObserver::HandleNotifyString(TUint32 aId, const TDesC16& aNewValue ) |
261 { |
261 { |
262 TRAP_IGNORE( HandleNotifyStringL(aId, aNewValue) ); |
262 TRAP_IGNORE( HandleNotifyStringL(aId, aNewValue) ); |
263 } |
263 } |
264 |
264 |
265 // --------------------------------------------------------------------------- |
265 // --------------------------------------------------------------------------- |
266 // |
266 // |
267 // --------------------------------------------------------------------------- |
267 // --------------------------------------------------------------------------- |
268 // |
268 // |
269 void CHnRepositoryShowFolderObserver::HandleNotifyStringL(TUint32 aId, const TDesC16& aNewValue) |
269 void CHnRepositoryShowFolderObserver::HandleNotifyStringL(TUint32 aId, const TDesC16& aNewValue) |
270 { |
270 { |
271 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyStringL IN")); |
271 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyStringL IN")); |
272 DEBUG(("\tID: %d : %S", aId, &aNewValue)); |
272 DEBUG(("\tID: %d : %S", aId, &aNewValue)); |
273 |
273 |
274 //++Show Folder |
274 //++Show Folder |
275 if( aId == iId && aNewValue.Length()) |
275 if( aId == iId && aNewValue.Length()) |
276 { |
276 { |
277 iNotifyType = 0; |
277 iNotifyType = 0; |
278 ExtractCRKeyShowFolderName( aNewValue ); |
278 ExtractCRKeyShowFolderName( aNewValue ); |
279 |
279 |
280 // iCRKeyFolderItemUid can contain mcs id or uid |
280 // iCRKeyFolderItemUid can contain mcs id or uid |
281 // in case of uid it will be replaced whith id in HandleNotifyL callback |
281 // in case of uid it will be replaced whith id in HandleNotifyL callback |
282 if( iCRKeyFolderItemUid.Length()>0 ) |
282 if( iCRKeyFolderItemUid.Length()>0 ) |
283 { |
283 { |
284 if( iCRKeyFolderItemUid.FindF( KHexPrefix8 )==0 ) |
284 if( iCRKeyFolderItemUid.FindF( KHexPrefix8 )==0 ) |
452 { |
452 { |
453 return; |
453 return; |
454 } |
454 } |
455 timeStamp.Copy( tempBuf ); |
455 timeStamp.Copy( tempBuf ); |
456 } |
456 } |
457 |
457 |
458 TTime currentTime; |
458 TTime currentTime; |
459 currentTime.HomeTime(); |
459 currentTime.HomeTime(); |
460 TTimeIntervalSeconds interval; |
460 TTimeIntervalSeconds interval; |
461 |
461 |
462 TTime timeStampTime; |
462 TTime timeStampTime; |
463 ret = timeStampTime.Set(timeStamp); |
463 ret = timeStampTime.Set(timeStamp); |
464 |
464 |
465 if(ret == KErrGeneral ) |
465 if(ret == KErrGeneral ) |
466 { |
466 { |
467 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad timestamp) OUT" )); |
467 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad timestamp) OUT" )); |
468 return; // bad time stamp value |
468 return; // bad time stamp value |
469 } |
469 } |
470 |
470 |
471 ret = currentTime.SecondsFrom( timeStampTime, interval ); |
471 ret = currentTime.SecondsFrom( timeStampTime, interval ); |
472 |
472 |
473 if( interval.Int() < 0 ) |
473 if( interval.Int() < 0 ) |
474 {//negative timestamp is set ahead of current time...! |
474 {//negative timestamp is set ahead of current time...! |
475 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (negative interval) OUT" )); |
475 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (negative interval) OUT" )); |
476 return; |
476 return; |
477 } |
477 } |
478 |
478 |
479 if(( interval.Int()) > KTimeStampCutOff ) |
479 if(( interval.Int()) > KTimeStampCutOff ) |
480 {//positive timestamp but more than 5 seconds |
480 {//positive timestamp but more than 5 seconds |
481 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (more than 5 seconds) OUT" )); |
481 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (more than 5 seconds) OUT" )); |
482 return; |
482 return; |
483 } |
483 } |
484 else |
484 else |
485 { |
485 { |
486 iCRKeyFolderName.Copy(folder); |
486 iCRKeyFolderName.Copy(folder); |
487 } |
487 } |
488 } |
488 } |
489 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName OUT" )); |
489 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName OUT" )); |
490 } |
490 } |
491 |
491 |
492 // --------------------------------------------------------------------------- |
492 // --------------------------------------------------------------------------- |
493 // |
493 // |
494 // --------------------------------------------------------------------------- |
494 // --------------------------------------------------------------------------- |
495 // |
495 // |
496 void CHnRepositoryShowFolderObserver::GetShowFolderL( TUint32 aFolderId ) |
496 void CHnRepositoryShowFolderObserver::GetShowFolderL( TUint32 aFolderId ) |
497 { |
497 { |
498 |
498 |
499 CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL( |
499 CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL( |
500 KInData8, KKeyTypeMap, KDefaultParentId8 ); |
500 KInData8, KKeyTypeMap, KDefaultParentId8 ); |
501 CleanupStack::PushL( inDataKey ); |
501 CleanupStack::PushL( inDataKey ); |
502 HBufC8* id = HnConvUtils::NumToStr8LC( aFolderId ); |
502 HBufC8* id = HnConvUtils::NumToStr8LC( aFolderId ); |
503 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) ); |
503 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) ); |
540 CleanupStack::PopAndDestroy( inDataKey ); |
540 CleanupStack::PopAndDestroy( inDataKey ); |
541 |
541 |
542 } |
542 } |
543 |
543 |
544 // --------------------------------------------------------------------------- |
544 // --------------------------------------------------------------------------- |
545 // |
545 // |
546 // --------------------------------------------------------------------------- |
546 // --------------------------------------------------------------------------- |
547 // |
547 // |
548 void CHnRepositoryShowFolderObserver::GetShowFolderGroupNameL() |
548 void CHnRepositoryShowFolderObserver::GetShowFolderGroupNameL() |
549 { |
549 { |
550 |
550 |
551 CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL( |
551 CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL( |
552 KInData8, KKeyTypeMap, KDefaultParentId8 ); |
552 KInData8, KKeyTypeMap, KDefaultParentId8 ); |
553 CleanupStack::PushL( inDataKey ); |
553 CleanupStack::PushL( inDataKey ); |
554 HBufC8* id = HnConvUtils::NumToStr8LC( KRootId ); |
554 HBufC8* id = HnConvUtils::NumToStr8LC( KRootId ); |
555 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) ); |
555 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) ); |
556 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) ); |
556 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) ); |
557 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KRecursiveSearch8, KKeyTypeBoolean, KStringTrue8 ) ); |
557 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KRecursiveSearch8, KKeyTypeBoolean, KStringTrue8 ) ); |
558 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KFlatResult8, KKeyTypeBoolean, KStringTrue8 ) ); |
558 inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KFlatResult8, KKeyTypeBoolean, KStringTrue8 ) ); |
559 |
559 |
560 CHnMdBaseKey* filter = HnMdKeyFactory::CreateL( |
560 CHnMdBaseKey* filter = HnMdKeyFactory::CreateL( |
561 KFilter8, KKeyTypeMap, KStringTrue8 ); |
561 KFilter8, KKeyTypeMap, KStringTrue8 ); |
562 CleanupStack::PushL( filter ); |
562 CleanupStack::PushL( filter ); |
563 filter->AddSubKeyL( HnMdKeyFactory::CreateL( KMcsAppGroupName8, KKeyTypeString, iCRKeyFolderName ) ); |
563 filter->AddSubKeyL( HnMdKeyFactory::CreateL( KMcsAppGroupName8, KKeyTypeString, iCRKeyFolderName ) ); |
564 filter->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) ); |
564 filter->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) ); |
565 filter->AddSubKeyL( HnMdKeyFactory::CreateL( KHidden8, KKeyTypeBoolean, KStringFalse8 ) ); |
565 filter->AddSubKeyL( HnMdKeyFactory::CreateL( KHidden8, KKeyTypeBoolean, KStringFalse8 ) ); |
566 |
566 |
567 RPointerArray< CHnMdBaseKey > data; |
567 RPointerArray< CHnMdBaseKey > data; |
568 CleanupClosePushL( data ); |
568 CleanupClosePushL( data ); |
569 data.AppendL( inDataKey ); |
569 data.AppendL( inDataKey ); |
570 if ( filter ) |
570 if ( filter ) |
571 { |
571 { |
572 data.AppendL( filter ); |
572 data.AppendL( filter ); |
573 } |
573 } |
574 |
574 |
575 CHnMdBaseKey* serviceData = HnMdKeyFactory::CreateL( |
575 CHnMdBaseKey* serviceData = HnMdKeyFactory::CreateL( |
576 KServiceContentName, KKeyTypeString, KMatrixMenuData ); |
576 KServiceContentName, KKeyTypeString, KMatrixMenuData ); |
577 CleanupStack::PushL( serviceData ); |
577 CleanupStack::PushL( serviceData ); |
578 |
578 |
579 RPointerArray< CHnMdBaseKey> constructor; |
579 RPointerArray< CHnMdBaseKey> constructor; |
690 } |
690 } |
691 if ( count == 0 ) |
691 if ( count == 0 ) |
692 { |
692 { |
693 return KErrNotFound; |
693 return KErrNotFound; |
694 } |
694 } |
695 |
695 |
696 TLiwVariant varId; varId.PushL(); |
696 TLiwVariant varId; varId.PushL(); |
697 TLiwVariant varAppGroupName; varAppGroupName.PushL(); |
697 TLiwVariant varAppGroupName; varAppGroupName.PushL(); |
698 TLiwVariant varSuiteName; varSuiteName.PushL(); |
698 TLiwVariant varSuiteName; varSuiteName.PushL(); |
699 TLiwVariant varChildrenCount; varChildrenCount.PushL(); |
699 TLiwVariant varChildrenCount; varChildrenCount.PushL(); |
700 |
700 |
701 HnLiwUtils::GetVariantL( aEventParamList, KIdPath8, 0, varId ); |
701 HnLiwUtils::GetVariantL( aEventParamList, KIdPath8, 0, varId ); |
702 HnLiwUtils::GetVariantL( aEventParamList, KAppGroupNamePath8, 0, varAppGroupName ); |
702 HnLiwUtils::GetVariantL( aEventParamList, KAppGroupNamePath8, 0, varAppGroupName ); |
703 HnLiwUtils::GetVariantL( aEventParamList, KTitleNamePath8, 0, varSuiteName ); |
703 HnLiwUtils::GetVariantL( aEventParamList, KTitleNamePath8, 0, varSuiteName ); |
704 HnLiwUtils::GetVariantL( aEventParamList, KChildrenCountPath8, 0, varChildrenCount ); |
704 HnLiwUtils::GetVariantL( aEventParamList, KChildrenCountPath8, 0, varChildrenCount ); |
705 |
705 |
706 CLiwGenericParamList* paramList = CLiwGenericParamList::NewL(); |
706 CLiwGenericParamList* paramList = CLiwGenericParamList::NewL(); |
707 CleanupStack::PushL( paramList ); |
707 CleanupStack::PushL( paramList ); |
708 |
708 |
709 CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); |
709 CLiwDefaultMap* map = CLiwDefaultMap::NewLC(); |
710 |
710 |
711 paramList->AppendL( TLiwGenericParam( KSuiteName8, |
711 paramList->AppendL( TLiwGenericParam( KSuiteName8, |
712 TLiwVariant( KFolderSuite ) ) ); |
712 TLiwVariant( KFolderSuite ) ) ); |
713 |
713 |
714 map->InsertL( KSuiteName8, varSuiteName ); |
714 map->InsertL( KSuiteName8, varSuiteName ); |
715 map->InsertL( KFolderId8, varId ); |
715 map->InsertL( KFolderId8, varId ); |
716 map->InsertL( KRemoveLocked8, TLiwVariant( KStringFalse8 ) ); |
716 map->InsertL( KRemoveLocked8, TLiwVariant( KStringFalse8 ) ); |
717 map->InsertL( KParentFolderId8, varId ); |
717 map->InsertL( KParentFolderId8, varId ); |
718 map->InsertL( KTmpParentFolderId8, varId ); |
718 map->InsertL( KTmpParentFolderId8, varId ); |
719 map->InsertL( KMcsAppGroupName8, varAppGroupName ); |
719 map->InsertL( KMcsAppGroupName8, varAppGroupName ); |
720 |
720 |
721 paramList->AppendL( TLiwGenericParam( KParams8, TLiwVariant( map ) ) ); |
721 paramList->AppendL( TLiwGenericParam( KParams8, TLiwVariant( map ) ) ); |
722 |
722 |
723 CleanupStack::PopAndDestroy( map ); |
723 CleanupStack::PopAndDestroy( map ); |
724 |
724 |
725 while ( iCmnPtrs->iModel->LoadedSuitesCount() > 1 ) |
725 while ( iCmnPtrs->iModel->LoadedSuitesCount() > 1 ) |
726 { |
726 { |
727 CHnMdSuite* suite = iCmnPtrs->iModel->GetLastSuite(); |
727 CHnMdSuite* suite = iCmnPtrs->iModel->GetLastSuite(); |
728 iCmnPtrs->iContainer->PopSuiteModelL( suite->SuiteName() ); |
728 iCmnPtrs->iContainer->PopSuiteModelL( suite->SuiteName() ); |
729 iCmnPtrs->iModel->DeleteLastSuite(); |
729 iCmnPtrs->iModel->DeleteLastSuite(); |
730 } |
730 } |
731 |
731 |
732 if ( iCmnPtrs->iContainer->GetLastSuiteModel()->CustomId() != varId.AsTInt64() ) |
732 if ( iCmnPtrs->iContainer->GetLastSuiteModel()->CustomId() != varId.AsTInt64() ) |
733 { |
733 { |
734 iCmnPtrs->iModelEventObserver->HandleModelEventL( KNewSuiteLoadedMdEvent, *paramList ); |
734 iCmnPtrs->iModelEventObserver->HandleModelEventL( KNewSuiteLoadedMdEvent, *paramList ); |
735 iCmnPtrs->iContainer->GetLastSuiteModel()->RegisterSuiteObserverL( this ); |
735 iCmnPtrs->iContainer->GetLastSuiteModel()->RegisterSuiteObserverL( this ); |
736 iCmnPtrs->iModel->QueueForeground( CHnMdModel::EWhenCurrentTopSuiteIsEvaluated ); |
736 iCmnPtrs->iModel->QueueForeground( CHnMdModel::EWhenCurrentTopSuiteIsEvaluated ); |
752 iCmnPtrs->iModelEventObserver->HandleModelEventL( KSetFocusEvent, *pl ); |
752 iCmnPtrs->iModelEventObserver->HandleModelEventL( KSetFocusEvent, *pl ); |
753 iCmnPtrs->iModelEventObserver->HandleModelEventL( KAppGainForeground, *pl ); |
753 iCmnPtrs->iModelEventObserver->HandleModelEventL( KAppGainForeground, *pl ); |
754 CleanupStack::PopAndDestroy( pl ); |
754 CleanupStack::PopAndDestroy( pl ); |
755 CleanupStack::PopAndDestroy( &varId ); |
755 CleanupStack::PopAndDestroy( &varId ); |
756 CleanupStack::PopAndDestroy( &varItemCustomId ); |
756 CleanupStack::PopAndDestroy( &varItemCustomId ); |
757 |
757 |
758 iCRKeyFolderItemUid.Copy( KBlank ); |
758 iCRKeyFolderItemUid.Copy( KBlank ); |
759 } |
759 } |
760 |
760 |
761 iNotifyType = 0; |
761 iNotifyType = 0; |
762 iCRKeyFolderName.Copy( KBlank ); |
762 iCRKeyFolderName.Copy( KBlank ); |
763 iRepository->Set( iId, KBlank ); |
763 iRepository->Set( iId, KBlank ); |
764 |
764 |
765 CleanupStack::PopAndDestroy( paramList ); |
765 CleanupStack::PopAndDestroy( paramList ); |
766 CleanupStack::PopAndDestroy( &varChildrenCount ); |
766 CleanupStack::PopAndDestroy( &varChildrenCount ); |
767 CleanupStack::PopAndDestroy( &varSuiteName ); |
767 CleanupStack::PopAndDestroy( &varSuiteName ); |
768 CleanupStack::PopAndDestroy( &varAppGroupName ); |
768 CleanupStack::PopAndDestroy( &varAppGroupName ); |
769 CleanupStack::PopAndDestroy( &varId ); |
769 CleanupStack::PopAndDestroy( &varId ); |
770 } |
770 } |
771 |
771 |
772 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyL OUT")); |
772 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyL OUT")); |
773 return KErrNone; |
773 return KErrNone; |
774 } |
774 } |
775 |
775 |
776 // --------------------------------------------------------------------------- |
776 // --------------------------------------------------------------------------- |
777 // |
777 // |
778 // --------------------------------------------------------------------------- |
778 // --------------------------------------------------------------------------- |
779 // |
779 // |
780 void CHnRepositoryShowFolderObserver::HandleSuiteEventL ( THnCustomSuiteEvent aCustomSuiteEvent, |
780 void CHnRepositoryShowFolderObserver::HandleSuiteEventL ( THnCustomSuiteEvent aCustomSuiteEvent, |
781 CHnSuiteModel *aModel ) |
781 CHnSuiteModel *aModel ) |
782 { |
782 { |
783 |
783 |
784 if ( aCustomSuiteEvent == ESuiteModelInitialized && iCRKeyFolderItemUid.Length() > 0 ) |
784 if ( aCustomSuiteEvent == ESuiteModelInitialized && iCRKeyFolderItemUid.Length() > 0 ) |
785 { |
785 { |
786 if (iCRKeyFolderItemUid.Length() > 0 ) |
786 if (iCRKeyFolderItemUid.Length() > 0 ) |
787 { |
787 { |
788 TLex8 lex( iCRKeyFolderItemUid ); |
788 TLex8 lex( iCRKeyFolderItemUid ); |
800 iCmnPtrs->iModelEventObserver->HandleModelEventL( KAppGainForeground, *pl ); |
800 iCmnPtrs->iModelEventObserver->HandleModelEventL( KAppGainForeground, *pl ); |
801 CleanupStack::PopAndDestroy( pl ); |
801 CleanupStack::PopAndDestroy( pl ); |
802 } |
802 } |
803 } |
803 } |
804 |
804 |
805 |
|
806 // class CHnRepositoryZoomObserver |
|
807 // --------------------------------------------------------------------------- |
|
808 // |
|
809 // --------------------------------------------------------------------------- |
|
810 // |
|
811 CHnRepositoryZoomObserver * CHnRepositoryZoomObserver::NewL( |
|
812 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId ) |
|
813 { |
|
814 CHnRepositoryZoomObserver * self = CHnRepositoryZoomObserver::NewLC( aCmnPtrs, aRepositoryUid, aId ); |
|
815 CleanupStack::Pop(self); |
|
816 return self; |
|
817 } |
|
818 |
|
819 // --------------------------------------------------------------------------- |
|
820 // |
|
821 // --------------------------------------------------------------------------- |
|
822 // |
|
823 CHnRepositoryZoomObserver * CHnRepositoryZoomObserver::NewLC( |
|
824 THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId ) |
|
825 { |
|
826 CHnRepositoryZoomObserver * self = new (ELeave) CHnRepositoryZoomObserver( aCmnPtrs, aId ); |
|
827 CleanupStack::PushL(self); |
|
828 self->ConstructL( aRepositoryUid ); |
|
829 return self; |
|
830 } |
|
831 |
|
832 // --------------------------------------------------------------------------- |
|
833 // |
|
834 // --------------------------------------------------------------------------- |
|
835 // |
|
836 void CHnRepositoryZoomObserver::ConstructL( const TUid aRepositoryUid ) |
|
837 { |
|
838 CHnRepositoryObserver::ConstructL( aRepositoryUid ); |
|
839 iNotifyHandler = CCenRepNotifyHandler::NewL( |
|
840 *this, *iRepository, |
|
841 CCenRepNotifyHandler::EIntKey, iId ); |
|
842 InitializeL(); |
|
843 iNotifyHandler->StartListeningL(); |
|
844 } |
|
845 |
|
846 |
|
847 // --------------------------------------------------------------------------- |
|
848 // |
|
849 // --------------------------------------------------------------------------- |
|
850 // |
|
851 CHnRepositoryZoomObserver::CHnRepositoryZoomObserver( THnMdCommonPointers* aCmnPtrs, TUint32 aId ) |
|
852 : CHnRepositoryObserver( aCmnPtrs, aId ) |
|
853 { |
|
854 |
|
855 } |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // |
|
859 // --------------------------------------------------------------------------- |
|
860 // |
|
861 CHnRepositoryZoomObserver::~CHnRepositoryZoomObserver() |
|
862 { |
|
863 } |
|
864 |
|
865 // --------------------------------------------------------------------------- |
|
866 // |
|
867 // --------------------------------------------------------------------------- |
|
868 // |
|
869 void CHnRepositoryZoomObserver::HandleNotifyInt(TUint32 aId, TInt aNewValue ) |
|
870 { |
|
871 TRAP_IGNORE( HandleNotifyIntL(aId, aNewValue) ); |
|
872 } |
|
873 |
|
874 // --------------------------------------------------------------------------- |
|
875 // |
|
876 // --------------------------------------------------------------------------- |
|
877 // |
|
878 void CHnRepositoryZoomObserver::HandleNotifyIntL(TUint32 aId, TInt aNewValue ) |
|
879 { |
|
880 DEBUG(("_MM_:CHnRepositoryZoomObserver::HandleNotifyStringL IN")); |
|
881 DEBUG(("\tID: %d : %d", aId, aNewValue)); |
|
882 |
|
883 CLiwGenericParamList* paramList = CLiwGenericParamList::NewL(); |
|
884 CleanupStack::PushL( paramList ); |
|
885 |
|
886 if ( (TAknUiZoom)aNewValue == EAknUiZoomLarge ) |
|
887 { |
|
888 iCmnPtrs->iModelEventObserver->HandleModelEventL( KZoomLarge, *paramList ); |
|
889 } |
|
890 else if ( (TAknUiZoom)aNewValue == EAknUiZoomSmall ) |
|
891 { |
|
892 iCmnPtrs->iModelEventObserver->HandleModelEventL( KZoomSmall, *paramList ); |
|
893 } |
|
894 else |
|
895 { |
|
896 iCmnPtrs->iModelEventObserver->HandleModelEventL( KZoomNormal, *paramList ); |
|
897 } |
|
898 |
|
899 CleanupStack::PopAndDestroy( paramList ); |
|
900 DEBUG(("_MM_:CHnRepositoryZoomObserver::HandleNotifyStringL OUT")); |
|
901 } |
|
902 |
|
903 // --------------------------------------------------------------------------- |
|
904 // |
|
905 // --------------------------------------------------------------------------- |
|
906 // |
|
907 void CHnRepositoryZoomObserver::InitializeL() |
|
908 { |
|
909 TInt value(0); |
|
910 iRepository->Get( iId, value); |
|
911 HandleNotifyIntL( iId, value ); |
|
912 } |
|
913 // End of File |
805 // End of File |