29
|
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 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "cvimpstdetailsviewplugin.h"
|
|
20 |
|
|
21 |
#include "cvimpstdetailsviewcontainer.h"
|
|
22 |
#include "cvimpstdetailsviewlistboxmodel.h"
|
|
23 |
#include "cvimpstdetailsviewmenuhandler.h"
|
|
24 |
#include "vimpstdetailsviewpluginuids.hrh"
|
|
25 |
#include "cvimpstdetailsviewbrandhandler.h"
|
|
26 |
#include "cvimpstdetailscontacthandler.h"
|
|
27 |
|
|
28 |
#include "vimpstdetailsview.hrh"
|
|
29 |
#include <vimpstui.mbg>
|
|
30 |
#include <conversations.mbg>
|
|
31 |
#include <vimpstdetailsviewpluginrsc.rsg>
|
|
32 |
#include "cvimpstdetailspresencehandler.h"
|
|
33 |
|
|
34 |
#include <imconnectionproviderconsts.h>
|
|
35 |
|
|
36 |
#include <bautils.h>
|
|
37 |
#include <AknIconUtils.h>
|
|
38 |
#include <AiwServiceHandler.h>
|
|
39 |
#include <AknsUtils.h>
|
|
40 |
#include <e32property.h>
|
|
41 |
#include <StringLoader.h>
|
|
42 |
// cca
|
|
43 |
#include <ccappviewpluginakncontainer.h>
|
|
44 |
#include <mccapppluginparameter.h>
|
|
45 |
#include <mccaparameter.h>
|
|
46 |
|
|
47 |
// settings
|
|
48 |
#include <spsettings.h>
|
|
49 |
#include <spentry.h>
|
|
50 |
#include <spproperty.h>
|
|
51 |
|
|
52 |
// Virtual Phonebook
|
|
53 |
#include <CVPbkContactLinkArray.h>
|
|
54 |
|
|
55 |
#include "uiservicetabtracer.h"
|
|
56 |
// meco service uid
|
|
57 |
#define KMECOIMPLEMENTATIONUID 0x20012423
|
|
58 |
_LIT(KVIMPSTDetailsViewDllResFileName, "\\resource\\vimpstdetailsviewpluginrsc.rsc");
|
|
59 |
_LIT8( KEMbmConversationsQgnDefaultImage, "default_brand_image");
|
|
60 |
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
// CVIMPSTDetailsViewPlugin::NewL
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
CVIMPSTDetailsViewPlugin* CVIMPSTDetailsViewPlugin::NewL(TInt aServiceId)
|
|
66 |
{
|
|
67 |
CVIMPSTDetailsViewPlugin* self = new(ELeave) CVIMPSTDetailsViewPlugin(aServiceId);
|
|
68 |
CleanupStack::PushL(self);
|
|
69 |
self->ConstructL();
|
|
70 |
CleanupStack::Pop(self);
|
|
71 |
return self;
|
|
72 |
}
|
|
73 |
// ---------------------------------------------------------------------------
|
|
74 |
// CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
CVIMPSTDetailsViewPlugin::~CVIMPSTDetailsViewPlugin()
|
|
78 |
{
|
|
79 |
TRACER_AUTO;
|
|
80 |
delete iMenuHandler;
|
|
81 |
TRACE("iMenuHandler deleted");
|
|
82 |
delete iBrandHandler;
|
|
83 |
TRACE("iBrandHandler deleted");
|
|
84 |
delete iPresenceHandler;
|
|
85 |
TRACE("iPresenceHandler deleted");
|
|
86 |
delete iContactHandler;
|
|
87 |
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// CVIMPSTDetailsViewPlugin::CVIMPSTDetailsViewPlugin()
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
CVIMPSTDetailsViewPlugin::CVIMPSTDetailsViewPlugin(TInt aServiceId) : iFocusedListIndex(0),
|
|
95 |
iServiceId (aServiceId)
|
|
96 |
{
|
|
97 |
}
|
|
98 |
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
// CVIMPSTDetailsViewPlugin::ConstructL
|
|
101 |
// ---------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
void CVIMPSTDetailsViewPlugin::ConstructL()
|
|
104 |
{
|
|
105 |
iBrandHandler = CVIMPSTDetailsViewBrandHandler::NewL( iServiceId );
|
|
106 |
}
|
|
107 |
// ---------------------------------------------------------------------------
|
|
108 |
// CVIMPSTDetailsViewPlugin::PreparePluginViewL
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
void CVIMPSTDetailsViewPlugin::PreparePluginViewL(
|
|
112 |
MCCAppPluginParameter& aPluginParameter)
|
|
113 |
{
|
|
114 |
// check parameter version
|
|
115 |
TRACER_AUTO;
|
|
116 |
if (aPluginParameter.Version() != 1)
|
|
117 |
{
|
|
118 |
User::Leave(KErrNotSupported);
|
|
119 |
}
|
|
120 |
|
|
121 |
if (aPluginParameter.CCAppLaunchParameter().ContactDataFlag() ==
|
|
122 |
MCCAParameter::EContactLink)
|
|
123 |
{
|
|
124 |
iLaunchParameter = &aPluginParameter.CCAppLaunchParameter();
|
|
125 |
}
|
|
126 |
|
|
127 |
PrepareViewResourcesL();
|
|
128 |
|
|
129 |
HBufC* serviceName = HBufC::NewLC( KVIMPST_MAX_LENGTH );
|
|
130 |
TPtr serviceNamePtr = serviceName->Des() ;
|
|
131 |
iBrandHandler->GetServiceNameL( serviceNamePtr );
|
|
132 |
//initialize the presence cache.
|
|
133 |
iPresenceHandler = CVIMPSTDetailsPresenceHandler::NewL( serviceNamePtr,*this,
|
|
134 |
iBrandHandler->ServiceSupportedL() );
|
|
135 |
|
|
136 |
iContactHandler = CVIMPSTDetailsContactHandler::NewL( *iLaunchParameter ,
|
|
137 |
*this,
|
|
138 |
iBrandHandler->ServiceStoreUriL(),
|
|
139 |
serviceNamePtr,
|
|
140 |
iServiceId);
|
|
141 |
|
|
142 |
TRACE("iContactHandler created");
|
|
143 |
CleanupStack::PopAndDestroy(); // serviceName
|
|
144 |
|
|
145 |
}
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
// CVIMPSTDetailsViewPlugin::ImplementationUid
|
|
148 |
// ---------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
TUid CVIMPSTDetailsViewPlugin::ImplementationUid()
|
|
151 |
{
|
|
152 |
return TUid::Uid(KVIMPSTDetailsViewPluginImplmentationUid );
|
|
153 |
}
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
// CVIMPSTDetailsViewPlugin::ProvideBitmapLC
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
void CVIMPSTDetailsViewPlugin::ProvideBitmapLC(
|
|
159 |
TCCAppIconType aIconType, CFbsBitmap*& aBitmap, CFbsBitmap*& aBitmapMask)
|
|
160 |
{
|
|
161 |
if (ECCAppTabIcon == aIconType)
|
|
162 |
{
|
|
163 |
CFbsBitmap* bmp = NULL;
|
|
164 |
CFbsBitmap* bmpMask = NULL;
|
|
165 |
|
|
166 |
// Create icon array
|
|
167 |
iBrandHandler->LoadBitMapLC(
|
|
168 |
bmp,
|
|
169 |
bmpMask,
|
|
170 |
EMbmConversationsQgn_prop_im_imsg,
|
|
171 |
EMbmConversationsQgn_prop_im_imsg_mask
|
|
172 |
);
|
|
173 |
|
|
174 |
aBitmap = bmp;
|
|
175 |
aBitmapMask = bmpMask;
|
|
176 |
}
|
|
177 |
}
|
|
178 |
|
|
179 |
// ---------------------------------------------------------------------------
|
|
180 |
// CVIMPSTDetailsViewPlugin::ProvideBitmapL
|
|
181 |
// ---------------------------------------------------------------------------
|
|
182 |
//
|
|
183 |
void CVIMPSTDetailsViewPlugin::ProvideBitmapL(
|
|
184 |
TCCAppIconType aIconType, CAknIcon& aIcon)
|
|
185 |
|
|
186 |
{
|
|
187 |
TRACER_AUTO;
|
|
188 |
if (ECCAppTabIcon == aIconType)
|
|
189 |
{
|
|
190 |
CFbsBitmap* bmp = NULL;
|
|
191 |
CFbsBitmap* bmpMask = NULL;
|
|
192 |
CGulIcon* tabIcon = iBrandHandler->LoadBrandBitmapL(KEMbmConversationsQgnDefaultImage);
|
|
193 |
if(tabIcon)
|
|
194 |
{
|
|
195 |
bmp = tabIcon->Bitmap();
|
|
196 |
bmpMask = tabIcon->Mask();
|
|
197 |
aIcon.SetBitmap(bmp); // ownership transfer to aIcon
|
|
198 |
aIcon.SetMask(bmpMask); // ownership transfer to aIcon
|
|
199 |
// this is remove the memory leak
|
|
200 |
tabIcon->SetBitmapsOwnedExternally( ETrue );
|
|
201 |
delete tabIcon ;
|
|
202 |
}
|
|
203 |
}
|
|
204 |
}
|
|
205 |
|
|
206 |
// ---------------------------------------------------------------------------
|
|
207 |
// CVIMPSTDetailsViewPlugin::NewContainerL
|
|
208 |
// ---------------------------------------------------------------------------
|
|
209 |
//
|
|
210 |
void CVIMPSTDetailsViewPlugin::NewContainerL()
|
|
211 |
{
|
|
212 |
if( iBrandHandler && iLaunchParameter )
|
|
213 |
{
|
|
214 |
iContainer = new (ELeave) CVIMPSTDetailsViewContainer( Id(),
|
|
215 |
*iBrandHandler,
|
|
216 |
*iPresenceHandler,
|
|
217 |
iFocusedListIndex );
|
|
218 |
}
|
|
219 |
|
|
220 |
}
|
|
221 |
|
|
222 |
// ---------------------------------------------------------------------------
|
|
223 |
// CVIMPSTDetailsViewPlugin::DynInitMenuPaneL
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
void CVIMPSTDetailsViewPlugin::DynInitMenuPaneL(TInt aResourceId,
|
|
227 |
CEikMenuPane* aMenuPane)
|
|
228 |
{
|
|
229 |
if (!iMenuHandler)
|
|
230 |
{
|
|
231 |
iMenuHandler = CVIMPSTDetailsViewMenuHandler::NewL(*this,
|
|
232 |
iContactHandler->StoreType() );
|
|
233 |
}
|
|
234 |
iMenuHandler->DynInitMenuPaneL(aResourceId, aMenuPane);
|
|
235 |
}
|
|
236 |
|
|
237 |
// ---------------------------------------------------------------------------
|
|
238 |
// CVIMPSTDetailsViewPlugin::HandleCommandL
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
void CVIMPSTDetailsViewPlugin::HandleCommandL(TInt aCommand)
|
|
242 |
{
|
|
243 |
// CCApp handles the "Exit"- and "Back"-commands,
|
|
244 |
// rest to menuhandler
|
|
245 |
CCCAppViewPluginAknView::HandleCommandL(aCommand);
|
|
246 |
|
|
247 |
iMenuHandler->HandleCommandL(aCommand);
|
|
248 |
}
|
|
249 |
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
// CVIMPSTDetailsViewPlugin::Id
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
//
|
|
254 |
TUid CVIMPSTDetailsViewPlugin::Id() const
|
|
255 |
{
|
|
256 |
return TUid::Uid(KVIMPSTDetailsViewPluginImplmentationUid + iServiceId);
|
|
257 |
}
|
|
258 |
|
|
259 |
// ---------------------------------------------------------------------------
|
|
260 |
// CVIMPSTDetailsViewPlugin::PrepareViewResourcesL
|
|
261 |
// ---------------------------------------------------------------------------
|
|
262 |
//
|
|
263 |
void CVIMPSTDetailsViewPlugin::PrepareViewResourcesL()
|
|
264 |
{
|
|
265 |
// Ignore codescanner warning generated here : " Leaving function called before BaseConstructL "
|
|
266 |
TRACER_AUTO;
|
|
267 |
TFileName fileName(KVIMPSTDetailsViewDllResFileName);
|
|
268 |
BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), fileName);
|
|
269 |
iResourceLoader.OpenL(fileName);
|
|
270 |
BaseConstructL(R_VIMPSTDETAILSVIEW_MAINVIEW);
|
|
271 |
|
|
272 |
}
|
|
273 |
|
|
274 |
// ---------------------------------------------------------------------------
|
|
275 |
// CVIMPSTDetailsViewPlugin::DoActivateL
|
|
276 |
// ---------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
void CVIMPSTDetailsViewPlugin::DoActivateL(
|
|
279 |
const TVwsViewId& aPrevViewId,
|
|
280 |
TUid aCustomMessageId,
|
|
281 |
const TDesC8& aCustomMessage)
|
|
282 |
{
|
|
283 |
TRACER_AUTO;
|
|
284 |
CCCAppViewPluginAknView::DoActivateL(aPrevViewId, aCustomMessageId,
|
|
285 |
aCustomMessage);
|
|
286 |
TRACE("calling GetContactData");
|
|
287 |
GetContactDataL();
|
|
288 |
|
|
289 |
}
|
|
290 |
|
|
291 |
// ---------------------------------------------------------------------------
|
|
292 |
// CVIMPSTDetailsViewPlugin::DoDeactivate
|
|
293 |
// ---------------------------------------------------------------------------
|
|
294 |
//
|
|
295 |
void CVIMPSTDetailsViewPlugin::DoDeactivate()
|
|
296 |
{
|
|
297 |
TRACER_AUTO;
|
|
298 |
if( iContactHandler )
|
|
299 |
{
|
|
300 |
iContactHandler->CancelOngoingRequest();
|
|
301 |
}
|
|
302 |
TRACE("ongoing request canceled");
|
|
303 |
if (iContainer)
|
|
304 |
{
|
|
305 |
iFocusedListIndex = static_cast<CVIMPSTDetailsViewContainer*>
|
|
306 |
(iContainer)->ListBoxModel().FocusedFieldIndex();
|
|
307 |
}
|
|
308 |
TRACE("calling base class Deactivate");
|
|
309 |
CCCAppViewPluginAknView::DoDeactivate();
|
|
310 |
// not woned by this class
|
|
311 |
iContainer = NULL;
|
|
312 |
|
|
313 |
}
|
|
314 |
|
|
315 |
// --------------------------------------------------------------------------
|
|
316 |
// CVIMPSTDetailsViewPlugin::GetContactDataL
|
|
317 |
// --------------------------------------------------------------------------
|
|
318 |
//
|
|
319 |
void CVIMPSTDetailsViewPlugin::GetContactDataL()
|
|
320 |
{
|
|
321 |
|
|
322 |
TRACER_AUTO;
|
|
323 |
if (iLaunchParameter && iContactHandler )
|
|
324 |
{
|
|
325 |
// todo: pass launchparameter to listbox model?
|
|
326 |
HBufC& contactData = iLaunchParameter->ContactDataL();
|
|
327 |
|
|
328 |
HBufC8* buf = HBufC8::NewLC(contactData.Length());
|
|
329 |
buf->Des().Copy(contactData);
|
|
330 |
TPtrC8 bufDes(buf->Des());
|
|
331 |
|
|
332 |
CVPbkContactLinkArray* links = CVPbkContactLinkArray::NewLC( bufDes, iContactHandler->ContactStoresL() );
|
|
333 |
CleanupStack::Pop(links);
|
|
334 |
TRACE("links created");
|
|
335 |
CleanupStack::PopAndDestroy(buf);
|
|
336 |
TRACE("buffer destroyed");
|
|
337 |
TUid launchUid = iLaunchParameter->LaunchedViewUid();
|
|
338 |
if( launchUid.iUid != (KVIMPSTDetailsViewPluginImplmentationUid+iServiceId) && iContactHandler->StoreType() == EStoreServer )
|
|
339 |
{
|
|
340 |
TRACE("service store set link called from pbk");
|
|
341 |
// launch from other than service tab
|
|
342 |
// ETrue, read xsp id from pbk store and search in service store and show
|
|
343 |
// incase of xsp store , need to find the details from xsp store
|
|
344 |
iContactHandler->SetLinks( links , ETrue );
|
|
345 |
}
|
|
346 |
else
|
|
347 |
{
|
|
348 |
TRACE("set linkcalled from service tab/CV");
|
|
349 |
iContactHandler->SetLinks( links , EFalse );
|
|
350 |
//make sure this is set to null after view is changed
|
|
351 |
// cannot be set it to null in dodeactivate call. as ilaunchparameter is not
|
|
352 |
//owned by us. might get destryoed by cca
|
|
353 |
iLaunchParameter->SetLaunchedViewUid(TUid::Null());
|
|
354 |
}
|
|
355 |
}
|
|
356 |
|
|
357 |
}
|
|
358 |
// ---------------------------------------------------------------------------
|
|
359 |
// CVIMPSTDetailsViewPlugin::SetTitleL
|
|
360 |
// ---------------------------------------------------------------------------
|
|
361 |
//
|
|
362 |
void CVIMPSTDetailsViewPlugin::SetTitleL()
|
|
363 |
{
|
|
364 |
TRACER_AUTO;
|
|
365 |
HBufC* title = NULL;
|
|
366 |
|
|
367 |
if( iContainer && iContactHandler )
|
|
368 |
{
|
|
369 |
title = static_cast<CVIMPSTDetailsViewContainer*>
|
|
370 |
(iContainer)->GetTitleTextLC( iContactHandler->StoreType() );
|
|
371 |
}
|
|
372 |
if( !title )
|
|
373 |
{
|
|
374 |
if(iContactHandler)
|
|
375 |
{
|
|
376 |
title = iContactHandler->GetDisplayNameLC();
|
|
377 |
}
|
|
378 |
}
|
|
379 |
// Forward the SetTitleL-call to base-class
|
|
380 |
if( title )
|
|
381 |
{
|
|
382 |
CCCAppViewPluginAknView::SetTitleL( *title );
|
|
383 |
CleanupStack::PopAndDestroy(); // title
|
|
384 |
}
|
|
385 |
}
|
|
386 |
|
|
387 |
// --------------------------------------------------------------------------
|
|
388 |
// CVIMPSTDetailsViewPlugin::HandlePresenceChangedL
|
|
389 |
// --------------------------------------------------------------------------
|
|
390 |
//
|
|
391 |
void CVIMPSTDetailsViewPlugin::HandlePresenceChangedL()
|
|
392 |
{
|
|
393 |
if( iContainer )
|
|
394 |
{
|
|
395 |
static_cast<CVIMPSTDetailsViewContainer*>
|
|
396 |
(iContainer)->PresenceChangedL();
|
|
397 |
}
|
|
398 |
|
|
399 |
}
|
|
400 |
// --------------------------------------------------------------------------
|
|
401 |
// CVIMPSTDetailsViewPlugin::HandleContactReadyL
|
|
402 |
// --------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
void CVIMPSTDetailsViewPlugin::HandleContactReadyL( MVPbkStoreContact& aContact )
|
|
405 |
{
|
|
406 |
TRACER_AUTO;
|
|
407 |
if( iContainer )
|
|
408 |
{
|
|
409 |
// read the service name for servic eid - iServiceId
|
|
410 |
// pass to CreatePresentation
|
|
411 |
HBufC* serviceName = HBufC::NewLC( KVIMPST_MAX_LENGTH );
|
|
412 |
TPtr serviceNamePtr = serviceName->Des() ;
|
|
413 |
iBrandHandler->GetServiceNameL( serviceNamePtr );
|
|
414 |
|
|
415 |
static_cast<CVIMPSTDetailsViewContainer*>
|
|
416 |
(iContainer)->CreatePresentationL( aContact ,*serviceName, iContactHandler->StoreType() );
|
|
417 |
// delete service name
|
|
418 |
CleanupStack::PopAndDestroy();//serviceName
|
|
419 |
}
|
|
420 |
SetTitleL(); // call only after presentation is created
|
|
421 |
}
|
|
422 |
|
|
423 |
// --------------------------------------------------------------------------
|
|
424 |
// CVIMPSTDetailsViewPlugin::HandleContactUnavailableL
|
|
425 |
// --------------------------------------------------------------------------
|
|
426 |
//
|
|
427 |
void CVIMPSTDetailsViewPlugin::HandleContactUnavailableL()
|
|
428 |
{
|
|
429 |
if( iContainer )
|
|
430 |
{
|
|
431 |
static_cast<CVIMPSTDetailsViewContainer*>
|
|
432 |
(iContainer)->CreateEmptyPresentationL();
|
|
433 |
}
|
|
434 |
SetTitleL(); // call only after presentation is created
|
|
435 |
}
|
|
436 |
|
|
437 |
// --------------------------------------------------------------------------
|
|
438 |
// CVIMPSTDetailsViewPlugin::GetContactHandler
|
|
439 |
// --------------------------------------------------------------------------
|
|
440 |
//
|
|
441 |
CVIMPSTDetailsContactHandler* CVIMPSTDetailsViewPlugin::GetContactHandler()
|
|
442 |
{
|
|
443 |
return iContactHandler;
|
|
444 |
}
|
|
445 |
// End of File
|
|
446 |
|
|
447 |
|