23
|
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 for CVIMPSTUiBlockView.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
|
|
20 |
#include "cvimpstuiblockview.h"
|
|
21 |
#include "cvimpstuiblockviewcontrol.h"
|
|
22 |
#include "cvimpstenginepresencesubservice.h"
|
|
23 |
#include "vimpstutilswaitnote.h"
|
|
24 |
#include "mvimpstengine.h"
|
|
25 |
#include "vimpstextentionuiuid.h"
|
|
26 |
#include "cvimpstuiextensionservice.h"
|
|
27 |
#include "vimpstui.hrh"
|
|
28 |
#include "cvimpstuistatuspanehandler.h"
|
|
29 |
#include "cvimpstcmdhandler.h"
|
|
30 |
// System includes
|
|
31 |
#include <StringLoader.h>
|
|
32 |
// Pbk2
|
|
33 |
#include <MPbk2AppUi.h>
|
|
34 |
#include <CPbk2UIExtensionView.h>
|
|
35 |
#include <MPbk2ViewActivationTransaction.h>
|
|
36 |
#include <MPbk2ViewExplorer.h>
|
|
37 |
#include <MPbk2StartupMonitor.h>
|
|
38 |
#include <eikmenup.h>
|
|
39 |
#include <AiwCommon.hrh>
|
|
40 |
//resource
|
|
41 |
#include <vimpstuires.rsg>
|
|
42 |
#include <extensionmanagerres.rsg>
|
|
43 |
#include "uiservicetabtracer.h"
|
|
44 |
|
|
45 |
using namespace Phonebook2;
|
|
46 |
|
|
47 |
// ================= MEMBER FUNCTIONS =======================
|
|
48 |
|
|
49 |
// --------------------------------------------------------------------------
|
|
50 |
// CVIMPSTUiBlockView::CVIMPSTUiBlockView
|
|
51 |
// --------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
CVIMPSTUiBlockView::CVIMPSTUiBlockView(
|
|
54 |
MxSPViewMapper& aMapper,
|
|
55 |
MxSPContactManager& aContactManager,
|
|
56 |
TUint aBlockViewId,
|
|
57 |
CPbk2UIExtensionView& aView,
|
|
58 |
CVIMPSTUIExtensionService& aServiceData,
|
|
59 |
MVIMPSTEngine& aEngine ,
|
|
60 |
MVIMPSTCmdHandler& aCommandHandler) :
|
|
61 |
CxSPBaseView( aMapper, aContactManager, aView ),
|
|
62 |
iBlockViewId( aBlockViewId ),
|
|
63 |
iEngine(aEngine),
|
|
64 |
iExtensionService( aServiceData ),
|
|
65 |
iCommandHandler( aCommandHandler )
|
|
66 |
{
|
|
67 |
|
|
68 |
}
|
|
69 |
|
|
70 |
// --------------------------------------------------------------------------
|
|
71 |
// CVIMPSTUiBlockView::ConstructL
|
|
72 |
// --------------------------------------------------------------------------
|
|
73 |
//
|
|
74 |
void CVIMPSTUiBlockView::ConstructL()
|
|
75 |
{
|
|
76 |
TRACER_AUTO;
|
|
77 |
ViewBaseConstructL( KIMCONTACTSEXTNIMPLEMENTATIONUID, iBlockViewId );
|
|
78 |
|
|
79 |
iPresenceSubService = iEngine.GetPreseceSubService();
|
|
80 |
if(iPresenceSubService)
|
|
81 |
{
|
|
82 |
iBlockedList = iPresenceSubService->GetBlockedList();
|
|
83 |
}
|
|
84 |
|
|
85 |
}
|
|
86 |
|
|
87 |
|
|
88 |
// --------------------------------------------------------------------------
|
|
89 |
// CVIMPSTUiBlockView::NewL
|
|
90 |
// --------------------------------------------------------------------------
|
|
91 |
//
|
|
92 |
CVIMPSTUiBlockView* CVIMPSTUiBlockView::NewL( MxSPViewMapper& aMapper,
|
|
93 |
MxSPContactManager& aContactManager,
|
|
94 |
TUint aBlockViewId,
|
|
95 |
CPbk2UIExtensionView& aView,
|
|
96 |
CVIMPSTUIExtensionService& aServiceData,
|
|
97 |
MVIMPSTEngine& aEngine ,
|
|
98 |
MVIMPSTCmdHandler& aCommandHandler)
|
|
99 |
{
|
|
100 |
TRACER_AUTO;
|
|
101 |
CVIMPSTUiBlockView* self = new(ELeave) CVIMPSTUiBlockView( aMapper,
|
|
102 |
aContactManager,
|
|
103 |
aBlockViewId,
|
|
104 |
aView,
|
|
105 |
aServiceData,
|
|
106 |
aEngine,
|
|
107 |
aCommandHandler );
|
|
108 |
CleanupStack::PushL(self);
|
|
109 |
self->ConstructL();
|
|
110 |
CleanupStack::Pop(self);
|
|
111 |
return self;
|
|
112 |
}
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
// ---------------------------------------------------------
|
|
117 |
// CVIMPSTUiBlockView::~CVIMPSTUiBlockView()
|
|
118 |
// C++ Destructor
|
|
119 |
// ---------------------------------------------------------
|
|
120 |
//
|
|
121 |
CVIMPSTUiBlockView::~CVIMPSTUiBlockView()
|
|
122 |
{
|
|
123 |
delete iNaviDecorator;
|
|
124 |
}
|
|
125 |
|
|
126 |
// ---------------------------------------------------------
|
|
127 |
// CVIMPSTUiBlockView::HandleCommandL( TInt aCommand )
|
|
128 |
// This class handles all commands from menu
|
|
129 |
// ---------------------------------------------------------
|
|
130 |
//
|
|
131 |
void CVIMPSTUiBlockView::HandleCommandL( TInt aCommand )
|
|
132 |
{
|
|
133 |
TRACER_AUTO;
|
|
134 |
switch ( aCommand )
|
|
135 |
{
|
|
136 |
//Next two commands have same function
|
|
137 |
case EAknSoftkeyBack:
|
|
138 |
{
|
|
139 |
|
|
140 |
// this might get called when the view is not active
|
|
141 |
// back key pressed, activate tabbed view.
|
|
142 |
// CPbk2ViewState is not utilized here, but here the
|
|
143 |
// focused contact info could be delivered to next view, if required later
|
|
144 |
CPbk2ViewState* state = NULL;
|
|
145 |
|
|
146 |
TInt tabViewId;
|
|
147 |
TInt err = iMapper.GetNewView( KIMCONTACTSEXTNIMPLEMENTATIONUID,
|
|
148 |
iExtensionService.TabbedViewId(),
|
|
149 |
tabViewId );
|
|
150 |
User::LeaveIfError( err );
|
|
151 |
Pbk2AppUi()->Pbk2ViewExplorer()->ActivatePhonebook2ViewL(
|
|
152 |
TUid::Uid(tabViewId),
|
|
153 |
state );
|
|
154 |
|
|
155 |
break;
|
|
156 |
}
|
|
157 |
case ECmdUnBlock:
|
|
158 |
{
|
|
159 |
//show wait note
|
|
160 |
// load, format and show confirmation note
|
|
161 |
HBufC* unblockContact = iContainer->GetFocusedContactLC();
|
|
162 |
if(unblockContact)
|
|
163 |
{
|
|
164 |
HBufC* prompt = StringLoader::LoadLC( R_QTN_CHAT_UNBLOCKING, *unblockContact );
|
|
165 |
CVIMPSTUtilsWaitNote* note = CVIMPSTUtilsWaitNote::ShowWaitNoteLC( *prompt );
|
|
166 |
iCommandHandler.HandleCommandL(ECmdUnBlockContact, this, unblockContact );
|
|
167 |
CleanupStack::PopAndDestroy( 3,unblockContact );//note;prompt;unblockContact.
|
|
168 |
}
|
|
169 |
break;
|
|
170 |
}
|
|
171 |
default:
|
|
172 |
{
|
|
173 |
Pbk2AppUi()->HandleCommandL( aCommand );
|
|
174 |
break;
|
|
175 |
}
|
|
176 |
|
|
177 |
}
|
|
178 |
}
|
|
179 |
|
|
180 |
|
|
181 |
// ---------------------------------------------------------
|
|
182 |
// CVIMPSTUiSearchView::DynInitMenuPaneL()
|
|
183 |
// Initialises menu pane when needed
|
|
184 |
// (other items were commented in a header).
|
|
185 |
// ---------------------------------------------------------
|
|
186 |
//
|
|
187 |
void CVIMPSTUiBlockView::DynInitMenuPaneL( TInt aResourceId,
|
|
188 |
CEikMenuPane* aMenuPane )
|
|
189 |
{
|
|
190 |
TRACER_AUTO;
|
|
191 |
//using the existing menu resource as it contains unblock item
|
|
192 |
if( aResourceId == R_EXTENSION_MANAGER_MENU)
|
|
193 |
{
|
|
194 |
//add search view menu items
|
|
195 |
aMenuPane->AddMenuItemsL( R_SERVTAB_TABBED_VIEW_MENU );
|
|
196 |
aMenuPane->SetItemDimmed(ECmdOpenConversation, ETrue);
|
|
197 |
aMenuPane->SetItemDimmed(ECmdContactAddAsFriend,ETrue);
|
|
198 |
aMenuPane->SetItemDimmed(KAiwCmdCall,ETrue);
|
|
199 |
aMenuPane->SetItemDimmed(ECmdCloseConversation,ETrue);
|
|
200 |
aMenuPane->SetItemDimmed(ECmdCreateNewOption,ETrue);
|
|
201 |
aMenuPane->SetItemDimmed(ECmdContactDetails,ETrue);
|
|
202 |
aMenuPane->SetItemDimmed(ECmdOpenFriendRequest,ETrue);
|
|
203 |
aMenuPane->SetItemDimmed(ECmdContactEdit,ETrue);
|
|
204 |
aMenuPane->SetItemDimmed(ECmdAIWAddToContact,ETrue);
|
|
205 |
aMenuPane->SetItemDimmed(ECmdAIWLinkToContact,ETrue);
|
|
206 |
aMenuPane->SetItemDimmed(ECmdBlock,ETrue);
|
|
207 |
aMenuPane->SetItemDimmed(ECmdContactDelete,ETrue);
|
|
208 |
aMenuPane->SetItemDimmed(ECmdMyAvatar,ETrue);
|
|
209 |
aMenuPane->SetItemDimmed(ECmdChangeStatus,ETrue);
|
|
210 |
if(0==iBlockedList->Count())
|
|
211 |
{
|
|
212 |
aMenuPane->SetItemDimmed(ECmdUnBlock,ETrue);
|
|
213 |
}
|
|
214 |
}
|
|
215 |
}
|
|
216 |
|
|
217 |
// ---------------------------------------------------------
|
|
218 |
// CVIMPSTUiBlockView::DoActivateViewL()
|
|
219 |
// Activates view
|
|
220 |
// (other items were commented in a header).
|
|
221 |
// ---------------------------------------------------------
|
|
222 |
//
|
|
223 |
void CVIMPSTUiBlockView::DoActivateViewL( const TVwsViewId& aPrevViewId,
|
|
224 |
TUid /*aCustomMessageId*/,
|
|
225 |
const TDesC8& /*aCustomMessage*/ )
|
|
226 |
{
|
|
227 |
TRACER_AUTO;
|
|
228 |
HBufC* titleText = StringLoader::LoadLC( R_QTN_SERVTAB_TITLE_BLOCKEDLIST );
|
|
229 |
|
|
230 |
//to set the icon ( context pane image) as in tabbed view
|
|
231 |
MPbk2ViewActivationTransaction* viewActivationTransaction =
|
|
232 |
Pbk2AppUi()->Pbk2ViewExplorer()->HandleViewActivationLC(
|
|
233 |
iView.Id(),
|
|
234 |
aPrevViewId,
|
|
235 |
titleText,
|
|
236 |
NULL,
|
|
237 |
EUpdateAll );
|
|
238 |
|
|
239 |
// Notifies startup monitor of view activation
|
|
240 |
if( Pbk2AppUi()->Pbk2StartupMonitor() )
|
|
241 |
{
|
|
242 |
Pbk2AppUi()->Pbk2StartupMonitor()->
|
|
243 |
NotifyViewActivationL( iView.Id() );
|
|
244 |
}
|
|
245 |
|
|
246 |
if (!iContainer)
|
|
247 |
{
|
|
248 |
iContainer = CVIMPSTUiBlockViewControl::NewL(*this,iView, iEngine, iBlockedList );
|
|
249 |
CCoeEnv::Static()->AppUi()->AddToStackL( iView, iContainer );
|
|
250 |
iContainer->SetMopParent( &iView );
|
|
251 |
iContainer->SetRect( iView.ClientRect() );
|
|
252 |
iContainer->ActivateL();
|
|
253 |
iContainer->UpdateCbaL();
|
|
254 |
}
|
|
255 |
|
|
256 |
// Commit application-wide state changes
|
|
257 |
viewActivationTransaction->Commit();
|
|
258 |
CleanupStack::PopAndDestroy(); //viewActivationTransaction
|
|
259 |
CleanupStack::PopAndDestroy( titleText );
|
|
260 |
// Change the navigation pane from tabs to text label
|
|
261 |
UpdateNaviPaneTextL();
|
|
262 |
//resetting the blocked list to empty.and show it in blocked view.
|
|
263 |
iBlockedList->ResetAndDestroy();
|
|
264 |
iContainer->UpdateBlockedListL();
|
|
265 |
//set the text as updating blocked list while fetching blocked list
|
|
266 |
iContainer->SetUpdatingTextsToListboxL();
|
|
267 |
//fetch the fresh blocked list from server..
|
|
268 |
FetchBlockedListFromServerL();
|
|
269 |
}
|
|
270 |
|
|
271 |
// ---------------------------------------------------------
|
|
272 |
// CVIMPSTUiBlockView::DoDeactivate()
|
|
273 |
// Deactivates the view
|
|
274 |
// (other items were commented in a header).
|
|
275 |
// ---------------------------------------------------------
|
|
276 |
//
|
|
277 |
void CVIMPSTUiBlockView::DoDeactivate()
|
|
278 |
{
|
|
279 |
if (iContainer)
|
|
280 |
{
|
|
281 |
CCoeEnv::Static()->AppUi()->RemoveFromStack(iContainer);
|
|
282 |
delete iContainer;
|
|
283 |
iContainer = NULL;
|
|
284 |
}
|
|
285 |
}
|
|
286 |
|
|
287 |
|
|
288 |
// ---------------------------------------------------------
|
|
289 |
// CVIMPSTUiBlockView::UpdateNaviPaneTextL()
|
|
290 |
// ---------------------------------------------------------
|
|
291 |
//
|
|
292 |
void CVIMPSTUiBlockView::UpdateNaviPaneTextL( )
|
|
293 |
{
|
|
294 |
TRACER_AUTO;
|
|
295 |
// Change the navigation pane from tabs to text label
|
|
296 |
CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane();
|
|
297 |
CAknNavigationControlContainer* np =
|
|
298 |
static_cast<CAknNavigationControlContainer*>(
|
|
299 |
sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
|
|
300 |
delete iNaviDecorator;
|
|
301 |
iNaviDecorator = NULL;
|
|
302 |
//fix for disableing navigation search string text, makeing it null
|
|
303 |
iNaviDecorator = np->CreateNavigationLabelL( iEngine.ServiceName());
|
|
304 |
|
|
305 |
np->PushL( *iNaviDecorator );
|
|
306 |
sp->DrawNow();
|
|
307 |
}
|
|
308 |
|
|
309 |
// --------------------------------------------------------------------------
|
|
310 |
// CVIMPSTUiSearchView::HandleStatusPaneSizeChange
|
|
311 |
// --------------------------------------------------------------------------
|
|
312 |
//
|
|
313 |
void CVIMPSTUiBlockView::HandleStatusPaneSizeChange()
|
|
314 |
{
|
|
315 |
// Resize the container to fill the client rectangle
|
|
316 |
if (iContainer)
|
|
317 |
{
|
|
318 |
iContainer->SetRect( iView.ClientRect() );
|
|
319 |
}
|
|
320 |
}
|
|
321 |
|
|
322 |
// --------------------------------------------------------------------------
|
|
323 |
// CVIMPSTUiSearchView::FetchBlockedListFromServerL
|
|
324 |
// --------------------------------------------------------------------------
|
|
325 |
//
|
|
326 |
void CVIMPSTUiBlockView::FetchBlockedListFromServerL()
|
|
327 |
{
|
|
328 |
iEngine.RegisterBlockedListObserver(this);
|
|
329 |
iCommandHandler.HandleCommandL(EFetchBlockedList, this, NULL );
|
|
330 |
}
|
|
331 |
|
|
332 |
// --------------------------------------------------------------------------
|
|
333 |
// CVIMPSTUiSearchView::HandleBlockedListFetchCompleteL
|
|
334 |
// --------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
void CVIMPSTUiBlockView::HandleBlockedListFetchCompleteL()
|
|
337 |
{
|
|
338 |
if(iContainer)
|
|
339 |
{
|
|
340 |
iContainer->UpdateBlockedListL();
|
|
341 |
}
|
|
342 |
}
|
|
343 |
|
|
344 |
// --------------------------------------------------------------------------
|
|
345 |
// CVIMPSTUiSearchView::CommandFinishedL
|
|
346 |
// --------------------------------------------------------------------------
|
|
347 |
//
|
|
348 |
void CVIMPSTUiBlockView::CommandFinishedL( const MVIMPSTCmd& /*aCommand */)
|
|
349 |
{
|
|
350 |
|
|
351 |
}
|
|
352 |
|
|
353 |
// --------------------------------------------------------------------------
|
|
354 |
// CVIMPSTUiSearchView::HandleCommandEventL
|
|
355 |
// --------------------------------------------------------------------------
|
|
356 |
//
|
|
357 |
void CVIMPSTUiBlockView::HandleCommandEventL( TVIMPSTEnums::TVIMPSTRegistrationState /*aState*/,
|
|
358 |
TInt /*aServiceError*/)
|
|
359 |
{
|
|
360 |
|
|
361 |
}
|
|
362 |
|
|
363 |
// End of File
|