63
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Implementation of details view plugin
|
|
15 |
* Version : %version: be1s60pr#23.1.1.2.18 %
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#include <bautils.h>
|
|
21 |
#include <AknIconUtils.h>
|
|
22 |
#include <AiwServiceHandler.h>
|
|
23 |
#include <AknsUtils.h>
|
|
24 |
#include <aknViewAppUi.h>
|
|
25 |
|
|
26 |
#include <mccapppluginparameter.h>
|
|
27 |
#include "ccaparameter.h"
|
|
28 |
#include "mccaparameter.h"
|
|
29 |
|
|
30 |
#include <CVPbkContactManager.h>
|
|
31 |
#include <CPbk2StoreConfiguration.h>
|
|
32 |
#include <CVPbkContactStoreUriArray.h>
|
|
33 |
#include <CVPbkContactLinkArray.h>
|
|
34 |
#include <CPbk2ApplicationServices.h>
|
|
35 |
#include <CPbk2StoreManager.h>
|
|
36 |
#include <TVPbkContactStoreUriPtr.h>
|
|
37 |
#include <VPbkContactStoreUris.h>
|
|
38 |
#include <mccappengine.h>
|
|
39 |
#include <ccacontactorservice.h>
|
|
40 |
#include <MVPbkContactStoreProperties.h>
|
|
41 |
#include <MVPbkContactStore.h>
|
|
42 |
|
|
43 |
#include <Pbk2DataCaging.hrh>
|
|
44 |
|
|
45 |
#include "ccappdetailsviewplugin.h"
|
|
46 |
#include "ccappdetailsviewlistboxmodel.h"
|
|
47 |
#include "ccappdetailsviewcontainer.h"
|
|
48 |
#include "ccappdetailsviewmenuhandler.h"
|
|
49 |
#include "ccappdetailsviewdefs.h"
|
|
50 |
#include "ccappdetailsviewpluginuids.hrh"
|
|
51 |
#include "ccappdetailsview.hrh"
|
|
52 |
|
|
53 |
#include <ccappdetailsviewpluginrsc.rsg>
|
|
54 |
#include <ccappdetailsviewplugin.mbg>
|
|
55 |
|
|
56 |
#include <CVPbkContactManager.h>
|
|
57 |
|
|
58 |
// cms engine
|
|
59 |
#include "cmscontactfield.h"
|
|
60 |
#include "cmscontactfieldinfo.h"
|
|
61 |
#include "cmscontactfielditem.h"
|
|
62 |
#include "cmssession.h"
|
|
63 |
#include "cmscontact.h"
|
|
64 |
#include "ccacontactorservice.h"
|
|
65 |
#include <VPbkFieldTypeSelectorFactory.h>
|
|
66 |
#include "cmspresencedata.h"
|
|
67 |
|
|
68 |
#include "ccacmscontactfetcherwrapper.h"
|
|
69 |
|
|
70 |
// Consts
|
|
71 |
_LIT(KCCAppDetailsViewResourceFileName, "\\resource\\ccappdetailsviewpluginrsc.rsc");
|
|
72 |
_LIT(KCCAppDetailsViewIconFileName, "\\resource\\apps\\ccappdetailsviewplugin.mif");
|
|
73 |
|
|
74 |
_LIT(KPbk2CommandsDllResFileName, "Pbk2Commands.rsc");
|
|
75 |
_LIT(KPbk2UiControlsDllResFileName, "Pbk2UiControls.rsc");
|
|
76 |
_LIT(KPbk2CommonUiDllResFileName, "Pbk2CommonUi.rsc" );
|
|
77 |
|
|
78 |
// ======== MEMBER FUNCTIONS ========
|
|
79 |
|
|
80 |
// ---------------------------------------------------------------------------
|
|
81 |
// CCCAppDetailsViewPlugin::NewL
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
//
|
|
84 |
CCCAppDetailsViewPlugin* CCCAppDetailsViewPlugin::NewL()
|
|
85 |
{
|
|
86 |
CCCAppDetailsViewPlugin* self = new(ELeave) CCCAppDetailsViewPlugin();
|
|
87 |
CleanupStack::PushL(self);
|
|
88 |
self->ConstructL();
|
|
89 |
CleanupStack::Pop(self);
|
|
90 |
|
|
91 |
return self;
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin()
|
|
99 |
{
|
|
100 |
//CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin()"));
|
|
101 |
|
|
102 |
//Delete the Contact Link
|
|
103 |
delete iLink;
|
|
104 |
|
|
105 |
//BG task for checking the visibility of this plugin
|
|
106 |
if (iBgTaskForCheckingVisibility)
|
|
107 |
{
|
|
108 |
iBgTaskForCheckingVisibility->Cancel();
|
|
109 |
delete iBgTaskForCheckingVisibility;
|
|
110 |
}
|
|
111 |
|
|
112 |
if (AppEngine())
|
|
113 |
{
|
|
114 |
AppEngine()->RemoveObserver(*this);
|
|
115 |
}
|
|
116 |
|
|
117 |
if (iAppServices)
|
|
118 |
{
|
|
119 |
iAppServices->StoreManager().DeregisterStoreEvents(*this);
|
|
120 |
}
|
|
121 |
|
|
122 |
delete iMenuHandler;
|
|
123 |
delete iContactorService;
|
|
124 |
|
|
125 |
Release(iAppServices);
|
|
126 |
|
|
127 |
iCommandsResourceFile.Close();
|
|
128 |
iUiControlsResourceFile.Close();
|
|
129 |
iCommonUiResourceFile.Close();
|
|
130 |
|
|
131 |
if(iCmsWrapper)
|
|
132 |
{
|
|
133 |
iCmsWrapper->Release();
|
|
134 |
}
|
|
135 |
|
|
136 |
//CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewPlugin::~CCCAppDetailsViewPlugin()"));
|
|
137 |
}
|
|
138 |
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
// CCCAppDetailsViewPlugin::CCCAppDetailsViewPlugin()
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
CCCAppDetailsViewPlugin::CCCAppDetailsViewPlugin() :
|
|
144 |
iFocusedListIndex(0),
|
|
145 |
iCommandsResourceFile(*iCoeEnv),
|
|
146 |
iUiControlsResourceFile(*iCoeEnv),
|
|
147 |
iCommonUiResourceFile(*iCoeEnv),
|
|
148 |
iVisible(EFalse) // By default this plugin is not visible
|
|
149 |
{
|
|
150 |
}
|
|
151 |
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
// CCCAppDetailsViewPlugin::ConstructL
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
void CCCAppDetailsViewPlugin::ConstructL()
|
|
157 |
{
|
|
158 |
CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewPlugin::ConstructL()"));
|
|
159 |
|
|
160 |
// ConstructL should be as light as possible.
|
|
161 |
|
|
162 |
/*
|
|
163 |
CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL();
|
|
164 |
// Add phone memory to cnt manager loaded stores even if current configuration
|
|
165 |
// contains only SIM memory so that top contacts can be opened
|
|
166 |
// from e.g. home screen widget.
|
|
167 |
pbk2AppServices.ContactManager().LoadContactStoreL(
|
|
168 |
VPbkContactStoreUris::DefaultCntDbUri() );
|
|
169 |
*/
|
|
170 |
|
|
171 |
iCmsWrapper = CCCAppCmsContactFetcherWrapper::InstanceL();
|
|
172 |
// Create the BG Task which will help us in checking the visibility of this plugin
|
|
173 |
iBgTaskForCheckingVisibility = CIdle::NewL(CActive::EPriorityStandard);
|
|
174 |
|
|
175 |
CCA_DP(KDetailsViewLogFile, CCA_L("iFocusedListIndex = %d"), iFocusedListIndex);
|
|
176 |
|
|
177 |
CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewPlugin::ConstructL()"));
|
|
178 |
}
|
|
179 |
|
|
180 |
// ---------------------------------------------------------------------------
|
|
181 |
// CCCAppDetailsViewPlugin::PreparePluginViewL
|
|
182 |
// ---------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
void CCCAppDetailsViewPlugin::PreparePluginViewL(
|
|
185 |
MCCAppPluginParameter& /*aPluginParameter*/)
|
|
186 |
{
|
|
187 |
|
|
188 |
PrepareViewResourcesL();
|
|
189 |
|
|
190 |
// Get the PBK2AppServices
|
|
191 |
CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL();
|
|
192 |
|
|
193 |
if (AppEngine())
|
|
194 |
{
|
|
195 |
AppEngine()->AddObserverL(*this);
|
|
196 |
}
|
|
197 |
CPbk2StoreManager& storeManager = pbk2AppServices.StoreManager();
|
|
198 |
storeManager.RegisterStoreEventsL(*this);
|
|
199 |
storeManager.OpenStoresL();
|
|
200 |
|
|
201 |
//Get the Contact Link
|
|
202 |
HBufC& contactData = AppEngine()->Parameter().ContactDataL();
|
|
203 |
HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() );
|
|
204 |
TPtr8 contactData8Ptr( contactData8->Des() );
|
|
205 |
contactData8Ptr.Copy( contactData.Des() );
|
|
206 |
CVPbkContactManager* vPbkContactManager = &iAppServices->ContactManager();
|
|
207 |
|
|
208 |
if( vPbkContactManager )
|
|
209 |
{
|
|
210 |
MVPbkContactLinkArray* contactArray = NULL;
|
|
211 |
contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr );
|
|
212 |
if( contactArray->Count() > 0 )
|
|
213 |
{
|
|
214 |
iLink = contactArray->At( 0 ).CloneLC();
|
|
215 |
CleanupStack::Pop(); //link
|
|
216 |
}
|
|
217 |
if( contactArray )
|
|
218 |
{
|
|
219 |
CleanupStack::PopAndDestroy(); // contactArray
|
|
220 |
}
|
|
221 |
}
|
|
222 |
CleanupStack::PopAndDestroy(); // contactData8
|
|
223 |
|
|
224 |
iSchedulerWait.Start();
|
|
225 |
|
|
226 |
BaseConstructL(R_CCAPPDETAILSVIEW_MAINVIEW);
|
|
227 |
}
|
|
228 |
|
|
229 |
// ---------------------------------------------------------------------------
|
|
230 |
// CCCAppDetailsViewPlugin::ProvideBitmapL
|
|
231 |
// ---------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
void CCCAppDetailsViewPlugin::ProvideBitmapL(
|
|
234 |
TCCAppIconType aIconType, CAknIcon& aIcon)
|
|
235 |
{
|
|
236 |
if (ECCAppTabIcon == aIconType)
|
|
237 |
{
|
|
238 |
CFbsBitmap* bmp = NULL;
|
|
239 |
CFbsBitmap* bmpMask = NULL;
|
|
240 |
|
|
241 |
AknsUtils::CreateIconL(
|
|
242 |
AknsUtils::SkinInstance(),
|
|
243 |
KAknsIIDDefault,//todo; get a proper skin
|
|
244 |
bmp,
|
|
245 |
bmpMask,
|
|
246 |
KCCAppDetailsViewIconFileName,
|
|
247 |
EMbmCcappdetailsviewpluginQgn_prop_contact_detail_tab2,
|
|
248 |
EMbmCcappdetailsviewpluginQgn_prop_contact_detail_tab2_mask);
|
|
249 |
|
|
250 |
aIcon.SetBitmap(bmp);
|
|
251 |
aIcon.SetMask(bmpMask);
|
|
252 |
}
|
|
253 |
}
|
|
254 |
|
|
255 |
// ---------------------------------------------------------------------------
|
|
256 |
// CCCAppDetailsViewPlugin::NewContainerL
|
|
257 |
// ---------------------------------------------------------------------------
|
|
258 |
//
|
|
259 |
void CCCAppDetailsViewPlugin::NewContainerL()
|
|
260 |
{
|
|
261 |
iContainer = new(ELeave) CCCAppDetailsViewContainer(Id(), *this);
|
|
262 |
|
|
263 |
// Get the PBK2AppServices
|
|
264 |
CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL();
|
|
265 |
|
|
266 |
static_cast<CCCAppDetailsViewContainer*>
|
|
267 |
(iContainer)->SetApplicationServices(&pbk2AppServices);
|
|
268 |
}
|
|
269 |
|
|
270 |
// --------------------------------------------------------------------------
|
|
271 |
// CCCAppDetailsViewPlugin::HandleStatusPaneSizeChange
|
|
272 |
// --------------------------------------------------------------------------
|
|
273 |
//
|
|
274 |
void CCCAppDetailsViewPlugin::HandleStatusPaneSizeChange()
|
|
275 |
{
|
|
276 |
// Resize the container to fill the client rectangle
|
|
277 |
if (iContainer)
|
|
278 |
{
|
|
279 |
iContainer->SetRect(ClientRect());
|
|
280 |
}
|
|
281 |
}
|
|
282 |
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
// CCCAppDetailsViewPlugin::DynInitMenuPaneL
|
|
285 |
// ---------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
void CCCAppDetailsViewPlugin::DynInitMenuPaneL(TInt aResourceId,
|
|
288 |
CEikMenuPane* aMenuPane)
|
|
289 |
{
|
|
290 |
EnsureMenuHandlerCreatedL();
|
|
291 |
iMenuHandler->DynInitMenuPaneL(aResourceId, aMenuPane);
|
|
292 |
}
|
|
293 |
|
|
294 |
// ---------------------------------------------------------------------------
|
|
295 |
// CCCAppDetailsViewPlugin::EnsureMenuHandlerCreatedL
|
|
296 |
// ---------------------------------------------------------------------------
|
|
297 |
//
|
|
298 |
void CCCAppDetailsViewPlugin::EnsureMenuHandlerCreatedL()
|
|
299 |
{
|
|
300 |
if (!iMenuHandler)
|
|
301 |
{
|
|
302 |
iMenuHandler = CCCAppDetailsViewMenuHandler::NewL(*this);
|
|
303 |
iMenuHandler->SetAppEngine(AppEngine());
|
|
304 |
}
|
|
305 |
}
|
|
306 |
|
|
307 |
// ---------------------------------------------------------------------------
|
|
308 |
// CCCAppDetailsViewPlugin::HandleEditRequestL
|
|
309 |
// ---------------------------------------------------------------------------
|
|
310 |
//
|
|
311 |
void CCCAppDetailsViewPlugin::HandleEditRequestL()
|
|
312 |
{
|
|
313 |
/* Note: We do not need to check if contact is editable, as this is called
|
|
314 |
* from CCCAppDetailsViewListBoxModel::HandleEditRequestL(), which checks
|
|
315 |
* if the contact is editable or not.
|
|
316 |
*/
|
|
317 |
EnsureMenuHandlerCreatedL();
|
|
318 |
iMenuHandler->HandleCommandL(ECCAppDetailsViewEditItemCmd);
|
|
319 |
}
|
|
320 |
|
|
321 |
// ---------------------------------------------------------------------------
|
|
322 |
// CCCAppDetailsViewPlugin::HandleDeleteRequestL
|
|
323 |
// ---------------------------------------------------------------------------
|
|
324 |
//
|
|
325 |
void CCCAppDetailsViewPlugin::HandleDeleteRequestL()
|
|
326 |
{
|
|
327 |
/* Note: We do not need to check if contact is editable, as this is called
|
|
328 |
* from CCCAppDetailsViewListBoxModel::HandleDeleteRequestL(), which checks
|
|
329 |
* if the contact is editable or not.
|
|
330 |
*/
|
|
331 |
EnsureMenuHandlerCreatedL();
|
|
332 |
iMenuHandler->HandleCommandL(ECCAppDetailsViewDeleteCmd);
|
|
333 |
}
|
|
334 |
|
|
335 |
// ---------------------------------------------------------------------------
|
|
336 |
// CCCAppDetailsViewPlugin::HandleCommandL
|
|
337 |
// ---------------------------------------------------------------------------
|
|
338 |
//
|
|
339 |
void CCCAppDetailsViewPlugin::HandleCommandL(TInt aCommand)
|
|
340 |
{
|
|
341 |
// CCApp handles the "Exit"- and "Back"-commands,
|
|
342 |
// rest to menuhandler
|
|
343 |
CCCAppViewPluginAknView::HandleCommandL(aCommand);
|
|
344 |
|
|
345 |
if (iContainer)
|
|
346 |
{
|
|
347 |
iFocusedListIndex = static_cast<CCCAppDetailsViewContainer*>
|
|
348 |
(iContainer)->ListBoxModel().FocusedListIndex();
|
|
349 |
}
|
|
350 |
|
|
351 |
// Rest to menuhandler
|
|
352 |
EnsureMenuHandlerCreatedL();
|
|
353 |
iMenuHandler->HandleCommandL(aCommand);
|
|
354 |
}
|
|
355 |
|
|
356 |
// ---------------------------------------------------------------------------
|
|
357 |
// CCCAppDetailsViewPlugin::Id
|
|
358 |
// ---------------------------------------------------------------------------
|
|
359 |
//
|
|
360 |
TUid CCCAppDetailsViewPlugin::Id() const
|
|
361 |
{
|
|
362 |
return TUid::Uid(KCCADetailsViewPluginImplmentationUid);
|
|
363 |
}
|
|
364 |
|
|
365 |
// ---------------------------------------------------------------------------
|
|
366 |
// CCCAppDetailsViewPlugin::PrepareViewResourcesL
|
|
367 |
// ---------------------------------------------------------------------------
|
|
368 |
//
|
|
369 |
void CCCAppDetailsViewPlugin::PrepareViewResourcesL()
|
|
370 |
{
|
|
371 |
// preparing resources for use
|
|
372 |
TFileName fileName(KCCAppDetailsViewResourceFileName);
|
|
373 |
BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), fileName);
|
|
374 |
iResourceLoader.OpenL(fileName);
|
|
375 |
}
|
|
376 |
|
|
377 |
// ---------------------------------------------------------------------------
|
|
378 |
// CCCAppDetailsViewPlugin::DoActivateL
|
|
379 |
// ---------------------------------------------------------------------------
|
|
380 |
//
|
|
381 |
void CCCAppDetailsViewPlugin::DoActivateL(
|
|
382 |
const TVwsViewId& aPrevViewId,
|
|
383 |
TUid aCustomMessageId,
|
|
384 |
const TDesC8& aCustomMessage)
|
|
385 |
{
|
|
386 |
CCCAppViewPluginAknView::DoActivateL(aPrevViewId, aCustomMessageId,
|
|
387 |
aCustomMessage);
|
|
388 |
|
|
389 |
GetContactDataL();
|
|
390 |
|
|
391 |
static_cast<CCCAppDetailsViewContainer*>
|
|
392 |
(iContainer)->SetAppEngine(AppEngine());
|
|
393 |
|
|
394 |
if ( iMenuHandler != NULL )
|
|
395 |
{
|
|
396 |
iMenuHandler->Activate();
|
|
397 |
}
|
|
398 |
|
|
399 |
if ( iContactorService == NULL )
|
|
400 |
{
|
|
401 |
iContactorService = CCAContactorService::NewL();
|
|
402 |
}
|
|
403 |
}
|
|
404 |
|
|
405 |
// ---------------------------------------------------------------------------
|
|
406 |
// CCCAppDetailsViewPlugin::DoDeactivate
|
|
407 |
// ---------------------------------------------------------------------------
|
|
408 |
//
|
|
409 |
void CCCAppDetailsViewPlugin::DoDeactivate()
|
|
410 |
{
|
|
411 |
if (iContainer)
|
|
412 |
{
|
|
413 |
iFocusedListIndex = static_cast<CCCAppDetailsViewContainer*>
|
|
414 |
(iContainer)->ListBoxModel().FocusedListIndex();
|
|
415 |
}
|
|
416 |
|
|
417 |
if ( iMenuHandler != NULL )
|
|
418 |
{
|
|
419 |
iMenuHandler->Reset();
|
|
420 |
}
|
|
421 |
|
|
422 |
CCCAppViewPluginAknView::DoDeactivate();
|
|
423 |
}
|
|
424 |
|
|
425 |
// --------------------------------------------------------------------------
|
|
426 |
// CCCAppDetailsViewPlugin::GetContactDataL
|
|
427 |
// --------------------------------------------------------------------------
|
|
428 |
//
|
|
429 |
void CCCAppDetailsViewPlugin::GetContactDataL()
|
|
430 |
{
|
|
431 |
CCA_DP(KDetailsViewLogFile, CCA_L(">>> CCCAppDetailsViewPlugin::GetContactDataL()"));
|
|
432 |
|
|
433 |
if (iContainer)
|
|
434 |
{
|
|
435 |
// Get the PBK2AppServices
|
|
436 |
CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL();
|
|
437 |
|
|
438 |
HBufC8* contactLinkArrayDes = iCmsWrapper->ContactIdentifierLC();
|
|
439 |
CVPbkContactLinkArray* links = CVPbkContactLinkArray::NewLC(*contactLinkArrayDes,
|
|
440 |
pbk2AppServices.ContactManager().ContactStoresL());
|
|
441 |
|
|
442 |
CCA_DP(KDetailsViewLogFile, CCA_L("iFocusedListIndex = %d"), iFocusedListIndex);
|
|
443 |
|
|
444 |
|
|
445 |
static_cast<CCCAppDetailsViewContainer*>
|
|
446 |
(iContainer)->ListBoxModel().SetLinks(links); // takes ownership of links.
|
|
447 |
CleanupStack::Pop(links);
|
|
448 |
CleanupStack::PopAndDestroy(contactLinkArrayDes);
|
|
449 |
|
|
450 |
static_cast<CCCAppDetailsViewContainer*>
|
|
451 |
(iContainer)->ListBoxModel().SetInitialFocusIndex(iFocusedListIndex);
|
|
452 |
iContainer->DrawDeferred();
|
|
453 |
}
|
|
454 |
|
|
455 |
CCA_DP(KDetailsViewLogFile, CCA_L("<<< CCCAppDetailsViewPlugin::GetContactDataL()"));
|
|
456 |
}
|
|
457 |
|
|
458 |
// --------------------------------------------------------------------------
|
|
459 |
// CCCAppDetailsViewPlugin::OpenComplete
|
|
460 |
// --------------------------------------------------------------------------
|
|
461 |
//
|
|
462 |
void CCCAppDetailsViewPlugin::OpenComplete()
|
|
463 |
{
|
|
464 |
if (iSchedulerWait.IsStarted())
|
|
465 |
{
|
|
466 |
iSchedulerWait.AsyncStop();
|
|
467 |
}
|
|
468 |
}
|
|
469 |
|
|
470 |
// --------------------------------------------------------------------------
|
|
471 |
// CCCAppDetailsViewPlugin::StoreReady
|
|
472 |
// --------------------------------------------------------------------------
|
|
473 |
//
|
|
474 |
void CCCAppDetailsViewPlugin::StoreReady(MVPbkContactStore& aContactStore)
|
|
475 |
{
|
|
476 |
if( iLink )
|
|
477 |
{
|
|
478 |
const MVPbkContactStoreProperties& storeProperties =
|
|
479 |
iLink->ContactStore().StoreProperties();
|
|
480 |
TVPbkContactStoreUriPtr uri = storeProperties.Uri();
|
|
481 |
if( 0 == uri.Compare( aContactStore.StoreProperties().Uri(),
|
|
482 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ) )
|
|
483 |
{
|
|
484 |
delete iLink;
|
|
485 |
iLink = NULL;
|
|
486 |
if ( iSchedulerWait.IsStarted() )
|
|
487 |
{
|
|
488 |
iSchedulerWait.AsyncStop();
|
|
489 |
}
|
|
490 |
}
|
|
491 |
}
|
|
492 |
else
|
|
493 |
{
|
|
494 |
//We shouldnt get here
|
|
495 |
//but if so, lets be safe
|
|
496 |
if ( iSchedulerWait.IsStarted() )
|
|
497 |
{
|
|
498 |
iSchedulerWait.AsyncStop();
|
|
499 |
}
|
|
500 |
}
|
|
501 |
|
|
502 |
|
|
503 |
}
|
|
504 |
|
|
505 |
// --------------------------------------------------------------------------
|
|
506 |
// CCCAppDetailsViewPlugin::StoreUnavailable
|
|
507 |
// --------------------------------------------------------------------------
|
|
508 |
//
|
|
509 |
void CCCAppDetailsViewPlugin::StoreUnavailable(
|
|
510 |
MVPbkContactStore& aContactStore,
|
|
511 |
TInt /*aReason*/)
|
|
512 |
{
|
|
513 |
if( iLink )
|
|
514 |
{
|
|
515 |
TVPbkContactStoreUriPtr linkuri =
|
|
516 |
iLink->ContactStore().StoreProperties().Uri();
|
|
517 |
|
|
518 |
TVPbkContactStoreUriPtr uri = aContactStore.StoreProperties().Uri();
|
|
519 |
|
|
520 |
if( linkuri.Compare( uri,
|
|
521 |
TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ) == 0 )
|
|
522 |
{
|
|
523 |
/*
|
|
524 |
* When the end user is selecting a phone contact, the SIM store
|
|
525 |
* will be opened during opening phone stores, and this function is
|
|
526 |
* called if the SIM store is unavailable.However the scheduler wait
|
|
527 |
* object can not stop during the operation (phone contact
|
|
528 |
* selecting), since the program is keeping on waiting for the
|
|
529 |
* other call backs coming.
|
|
530 |
*/
|
|
531 |
if (iSchedulerWait.IsStarted())
|
|
532 |
{
|
|
533 |
iSchedulerWait.AsyncStop();
|
|
534 |
}
|
|
535 |
}
|
|
536 |
}
|
|
537 |
else
|
|
538 |
{
|
|
539 |
if (iSchedulerWait.IsStarted())
|
|
540 |
{
|
|
541 |
iSchedulerWait.AsyncStop();
|
|
542 |
}
|
|
543 |
}
|
|
544 |
}
|
|
545 |
|
|
546 |
// --------------------------------------------------------------------------
|
|
547 |
// CCCAppDetailsViewPlugin::HandleStoreEventL
|
|
548 |
// --------------------------------------------------------------------------
|
|
549 |
//
|
|
550 |
void CCCAppDetailsViewPlugin::HandleStoreEventL(
|
|
551 |
MVPbkContactStore& /*aContactStore*/,
|
|
552 |
TVPbkContactStoreEvent aStoreEvent)
|
|
553 |
{
|
|
554 |
if (iSchedulerWait.IsStarted())
|
|
555 |
{
|
|
556 |
iSchedulerWait.AsyncStop();
|
|
557 |
}
|
|
558 |
|
|
559 |
switch (aStoreEvent.iEventType)
|
|
560 |
{
|
|
561 |
case TVPbkContactStoreEvent::EContactChanged:
|
|
562 |
GetContactDataL();
|
|
563 |
break;
|
|
564 |
|
|
565 |
case TVPbkContactStoreEvent::EContactDeleted:
|
|
566 |
break;
|
|
567 |
|
|
568 |
default:
|
|
569 |
break;
|
|
570 |
}
|
|
571 |
}
|
|
572 |
|
|
573 |
// ---------------------------------------------------------------------------
|
|
574 |
// CCCAppDetailsViewPlugin::SetTitleL
|
|
575 |
// ---------------------------------------------------------------------------
|
|
576 |
//
|
|
577 |
void CCCAppDetailsViewPlugin::SetTitleL(const TDesC& aTitle)
|
|
578 |
{
|
|
579 |
// Forward the SetTitleL-call to base-class
|
|
580 |
CCCAppViewPluginAknView::SetTitleL(aTitle);
|
|
581 |
}
|
|
582 |
|
|
583 |
// ---------------------------------------------------------------------------
|
|
584 |
// CCCAppDetailsViewPlugin::CheckVisibilityL
|
|
585 |
// ---------------------------------------------------------------------------
|
|
586 |
//
|
|
587 |
TBool CCCAppDetailsViewPlugin::CheckVisibilityL(MCCAppPluginParameter& /*aPluginParameter*/)
|
|
588 |
{
|
|
589 |
// Start checking the visibility of this plugin in the background
|
|
590 |
CheckVisibilityInBackgroundL();
|
|
591 |
return iVisible;
|
|
592 |
}
|
|
593 |
|
|
594 |
// ---------------------------------------------------------------------------
|
|
595 |
// CCCAppDetailsViewPlugin::CCCAppViewPluginBaseExtension
|
|
596 |
// ---------------------------------------------------------------------------
|
|
597 |
//
|
|
598 |
TAny* CCCAppDetailsViewPlugin::CCCAppViewPluginBaseExtension( TUid aExtensionUid )
|
|
599 |
{
|
|
600 |
if ( aExtensionUid == KMCCAppViewPluginBaseExtension2Uid )
|
|
601 |
{
|
|
602 |
return static_cast<MCCAppViewPluginBase2*>( this );
|
|
603 |
}
|
|
604 |
return NULL;
|
|
605 |
}
|
|
606 |
|
|
607 |
// --------------------------------------------------------------------------
|
|
608 |
// CCCAppDetailsViewPlugin::UpdateMSKinCbaL
|
|
609 |
// Sets CBA with empty MSK or MSK with text "Edit" when contact is editable.
|
|
610 |
// --------------------------------------------------------------------------
|
|
611 |
//
|
|
612 |
void CCCAppDetailsViewPlugin::UpdateMSKinCbaL(TBool aEditable)
|
|
613 |
{
|
|
614 |
CEikButtonGroupContainer* cba = Cba();
|
|
615 |
|
|
616 |
if (cba)
|
|
617 |
{
|
|
618 |
cba->SetCommandSetL(aEditable
|
|
619 |
? R_CCAPPDETAILSVIEW_SOFTKEYS_OPTIONS_BACK_EDIT
|
|
620 |
: R_CCAPPDETAILSVIEW_SOFTKEYS_OPTIONS_BACK_EMPTY);
|
|
621 |
|
|
622 |
cba->DrawDeferred();
|
|
623 |
}
|
|
624 |
}
|
|
625 |
|
|
626 |
// ---------------------------------------------------------------------------
|
|
627 |
// CCCAppDetailsViewPlugin::CheckValidityOfContactInfoL
|
|
628 |
// ---------------------------------------------------------------------------
|
|
629 |
//
|
|
630 |
void CCCAppDetailsViewPlugin::CheckValidityOfContactInfoL()
|
|
631 |
{
|
|
632 |
TBool validContact = EFalse;
|
|
633 |
HBufC8* contactLinkArrayDes = iCmsWrapper->ContactIdentifierLC();
|
|
634 |
|
|
635 |
if (contactLinkArrayDes)
|
|
636 |
{
|
|
637 |
// Get the PBK2AppServices
|
|
638 |
CPbk2ApplicationServices& pbk2AppServices = GetPbk2AppServicesL();
|
|
639 |
CVPbkContactLinkArray* contactLinkArray = CVPbkContactLinkArray::NewLC(*contactLinkArrayDes,
|
|
640 |
pbk2AppServices.ContactManager().ContactStoresL());
|
|
641 |
if (contactLinkArray->Count())
|
|
642 |
{
|
|
643 |
// Valid contact
|
|
644 |
validContact = ETrue;
|
|
645 |
}
|
|
646 |
CleanupStack::PopAndDestroy(contactLinkArray);
|
|
647 |
}
|
|
648 |
CleanupStack::PopAndDestroy(contactLinkArrayDes);
|
|
649 |
|
|
650 |
if (validContact)
|
|
651 |
{
|
|
652 |
MakeMeVisibleL();
|
|
653 |
}
|
|
654 |
}
|
|
655 |
|
|
656 |
// ---------------------------------------------------------------------------
|
|
657 |
// CCCAppDetailsViewPlugin::CheckVisibilityInBackgroundL
|
|
658 |
// ---------------------------------------------------------------------------
|
|
659 |
//
|
|
660 |
void CCCAppDetailsViewPlugin::CheckVisibilityInBackgroundL()
|
|
661 |
{
|
|
662 |
// Start checking the visibility of this plugin in the background
|
|
663 |
if (!iBgTaskForCheckingVisibility->IsActive())
|
|
664 |
{
|
|
665 |
iBgTaskForCheckingVisibility->Start(TCallBack(CheckVisibilityCallbackL , this));
|
|
666 |
}
|
|
667 |
}
|
|
668 |
|
|
669 |
// ---------------------------------------------------------------------------
|
|
670 |
// CCCAppDetailsViewPlugin::CheckVisibilityCallbackL
|
|
671 |
// ---------------------------------------------------------------------------
|
|
672 |
//
|
|
673 |
|
|
674 |
TInt CCCAppDetailsViewPlugin::CheckVisibilityCallbackL(TAny* aContainer)
|
|
675 |
{
|
|
676 |
CCCAppDetailsViewPlugin* container = static_cast<CCCAppDetailsViewPlugin*>(aContainer);
|
|
677 |
container->CheckValidityOfContactInfoL();
|
|
678 |
return KErrNone;
|
|
679 |
}
|
|
680 |
|
|
681 |
|
|
682 |
// ---------------------------------------------------------------------------
|
|
683 |
// CCCAppDetailsViewPlugin::MakeMeVisibleL
|
|
684 |
// ---------------------------------------------------------------------------
|
|
685 |
//
|
|
686 |
void CCCAppDetailsViewPlugin::MakeMeVisibleL()
|
|
687 |
{
|
|
688 |
// Set this plugin as visible
|
|
689 |
iVisible = ETrue;
|
|
690 |
// Call the below API to make yourself visible in the CCA Tabs
|
|
691 |
ShowPluginL();
|
|
692 |
}
|
|
693 |
|
|
694 |
|
|
695 |
// ---------------------------------------------------------------------------
|
|
696 |
// CCCAppDetailsViewPlugin::GetPbk2AppServicesL
|
|
697 |
// ---------------------------------------------------------------------------
|
|
698 |
//
|
|
699 |
CPbk2ApplicationServices& CCCAppDetailsViewPlugin::GetPbk2AppServicesL()
|
|
700 |
{
|
|
701 |
// create only if iAppServices is NULL
|
|
702 |
if (!iAppServices)
|
|
703 |
{
|
|
704 |
//Required for creating the instance of CPbk2ApplicationServices
|
|
705 |
iCommandsResourceFile.OpenL(
|
|
706 |
KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2CommandsDllResFileName);
|
|
707 |
iUiControlsResourceFile.OpenL(
|
|
708 |
KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2UiControlsDllResFileName);
|
|
709 |
iCommonUiResourceFile.OpenL(
|
|
710 |
KPbk2RomFileDrive, KDC_RESOURCE_FILES_DIR, KPbk2CommonUiDllResFileName);
|
|
711 |
|
|
712 |
iAppServices = CPbk2ApplicationServices::InstanceL();
|
|
713 |
}
|
|
714 |
|
|
715 |
return *iAppServices;
|
|
716 |
}
|
|
717 |
|
|
718 |
// ---------------------------------------------------------------------------
|
|
719 |
// CCCAppDetailsViewPlugin::NotifyPluginOfContactEventL
|
|
720 |
// ---------------------------------------------------------------------------
|
|
721 |
//
|
|
722 |
void CCCAppDetailsViewPlugin::NotifyPluginOfContactEventL()
|
|
723 |
{
|
|
724 |
//If a contact has e.g. relocated from sim to phone memory we need to
|
|
725 |
//continue using relocated contact instead of old
|
|
726 |
iCmsWrapper->RefetchContactL();
|
|
727 |
}
|
|
728 |
|
|
729 |
// ---------------------------------------------------------------------------
|
|
730 |
// CCCAppDetailsViewPlugin::ContactorService()
|
|
731 |
// ---------------------------------------------------------------------------
|
|
732 |
//
|
|
733 |
CCAContactorService* CCCAppDetailsViewPlugin::ContactorService()
|
|
734 |
{
|
|
735 |
return iContactorService;
|
|
736 |
}
|
|
737 |
|
|
738 |
// ---------------------------------------------------------------------------
|
|
739 |
// CCCAppDetailsViewPlugin::PluginBusy()
|
|
740 |
// ---------------------------------------------------------------------------
|
|
741 |
//
|
|
742 |
TBool CCCAppDetailsViewPlugin::PluginBusy()
|
|
743 |
{
|
|
744 |
TBool ret = EFalse;
|
|
745 |
|
|
746 |
if ( iContactorService != NULL )
|
|
747 |
{
|
|
748 |
ret = iContactorService->IsBusy();
|
|
749 |
}
|
|
750 |
return ret;
|
|
751 |
}
|
|
752 |
|
|
753 |
|
|
754 |
// End of File
|