63
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2007 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: Phonebook 2 single contact data assigner.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include "CPbk2SingleContactDataAssigner.h"
|
|
20 |
|
|
21 |
// Phonebook 2
|
|
22 |
#include "CPbk2ServerAppAppUi.h"
|
|
23 |
#include "MPbk2UiServiceObserver.h"
|
|
24 |
#include "TPbk2TitlePaneOperator.h"
|
|
25 |
#include "TPbk2ServerMessageDataRetriever.h"
|
|
26 |
#include "CPbk2ServerAppStoreManager.h"
|
|
27 |
#include "CPbk2SelectSinglePropertyPhase.h"
|
|
28 |
#include "CPbk2ContactFetchPhase.h"
|
|
29 |
#include "CPbk2SingleAssignDataPhase.h"
|
|
30 |
#include "CPbk2SelectCreateNewPropertyPhase.h"
|
|
31 |
#include "CPbk2PrepareSingleAssignPhase.h"
|
|
32 |
#include "MPbk2SelectFieldProperty.h"
|
|
33 |
#include <Pbk2UIControls.rsg>
|
|
34 |
#include <Pbk2ServerApp.rsg>
|
|
35 |
#include <CPbk2StoreManager.h>
|
|
36 |
#include <CPbk2StoreConfiguration.h>
|
|
37 |
#include <MPbk2ApplicationServices.h>
|
|
38 |
#include "TPbk2AssignNoteService.h"
|
|
39 |
|
|
40 |
// Virtual Phonebook
|
|
41 |
#include <CVPbkContactManager.h>
|
|
42 |
#include <CVPbkContactStoreUriArray.h>
|
|
43 |
#include <MVPbkContactLink.h>
|
|
44 |
#include <CVPbkFieldTypeSelector.h>
|
|
45 |
#include <MVPbkStoreContact.h>
|
|
46 |
#include <TVPbkContactStoreUriPtr.h>
|
|
47 |
#include <VPbkContactStoreUris.h>
|
|
48 |
|
|
49 |
// System includes
|
|
50 |
#include <AiwContactAssignDataTypes.h>
|
|
51 |
|
|
52 |
using namespace AiwContactAssign;
|
|
53 |
|
|
54 |
|
|
55 |
/// Unnamed namespace for local definitions
|
|
56 |
namespace {
|
|
57 |
|
|
58 |
#ifdef _DEBUG
|
|
59 |
|
|
60 |
enum TPanicCode
|
|
61 |
{
|
|
62 |
ELogicPreselectedContacts,
|
|
63 |
EPanicLogicPhaseCompletion
|
|
64 |
};
|
|
65 |
|
|
66 |
void Panic(TPanicCode aReason)
|
|
67 |
{
|
|
68 |
_LIT( KPanicText, "CPbk2SingleContactDataAssigner" );
|
|
69 |
User::Panic( KPanicText, aReason );
|
|
70 |
}
|
|
71 |
|
|
72 |
#endif // _DEBUG
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Sets title pane.
|
|
76 |
*
|
|
77 |
* @param aDataRetriever Server message data retriever.
|
|
78 |
* @param aFlags Assign flags.
|
|
79 |
* @param aMessage Server message.
|
|
80 |
*/
|
|
81 |
void SetTitlePaneL
|
|
82 |
( TPbk2ServerMessageDataRetriever& aDataRetriever, TUint aFlags,
|
|
83 |
const RMessage2& aMessage )
|
|
84 |
{
|
|
85 |
HBufC* titlePaneText = NULL;
|
|
86 |
if ( !( aFlags & AiwContactAssign::EUseProviderTitle ) )
|
|
87 |
{
|
|
88 |
titlePaneText = aDataRetriever.GetTitlePaneTextL( aMessage );
|
|
89 |
TPbk2TitlePaneOperator titlePaneOperator;
|
|
90 |
titlePaneOperator.SetTitlePaneL( titlePaneText ); // takes ownership
|
|
91 |
}
|
|
92 |
}
|
|
93 |
|
|
94 |
} /// namespace
|
|
95 |
|
|
96 |
|
|
97 |
// --------------------------------------------------------------------------
|
|
98 |
// CPbk2SingleContactDataAssigner::CPbk2SingleContactDataAssigner
|
|
99 |
// --------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
CPbk2SingleContactDataAssigner::CPbk2SingleContactDataAssigner
|
|
102 |
( MPbk2UiServiceObserver& aObserver ) :
|
|
103 |
iObserver( aObserver )
|
|
104 |
{
|
|
105 |
}
|
|
106 |
|
|
107 |
// --------------------------------------------------------------------------
|
|
108 |
// CPbk2SingleContactDataAssigner::~CPbk2SingleContactDataAssigner
|
|
109 |
// --------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
CPbk2SingleContactDataAssigner::~CPbk2SingleContactDataAssigner()
|
|
112 |
{
|
|
113 |
delete iSelectPropertyPhase;
|
|
114 |
delete iFetchPhase;
|
|
115 |
delete iPrepareAssignPhase;
|
|
116 |
delete iAssignDataPhase;
|
|
117 |
delete iStoreUris;
|
|
118 |
delete iDataBuffer;
|
|
119 |
delete iAddressSelectFilterBuffer;
|
|
120 |
delete iPreselectedContact;
|
|
121 |
delete iSelectFieldProperty;
|
|
122 |
delete iContactViewFilter;
|
|
123 |
delete iStoreManager;
|
|
124 |
}
|
|
125 |
|
|
126 |
// --------------------------------------------------------------------------
|
|
127 |
// CPbk2SingleContactDataAssigner::NewL
|
|
128 |
// --------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
CPbk2SingleContactDataAssigner* CPbk2SingleContactDataAssigner::NewL
|
|
131 |
( const RMessage2& aFetchCompleteMessage,
|
|
132 |
MPbk2UiServiceObserver& aObserver )
|
|
133 |
{
|
|
134 |
CPbk2SingleContactDataAssigner* self =
|
|
135 |
new(ELeave) CPbk2SingleContactDataAssigner( aObserver );
|
|
136 |
CleanupStack::PushL( self );
|
|
137 |
self->ConstructL( aFetchCompleteMessage );
|
|
138 |
CleanupStack::Pop( self );
|
|
139 |
return self;
|
|
140 |
}
|
|
141 |
|
|
142 |
// --------------------------------------------------------------------------
|
|
143 |
// CPbk2SingleContactDataAssigner::ConstructL
|
|
144 |
// --------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
void CPbk2SingleContactDataAssigner::ConstructL( const RMessage2& aMessage )
|
|
147 |
{
|
|
148 |
// Retrieve data from the client-server message
|
|
149 |
TPbk2ServerMessageDataRetriever dataRetriever;
|
|
150 |
iAssignFlags = dataRetriever.SingleContactAssignFlagsL( aMessage );
|
|
151 |
|
|
152 |
// Set title pane
|
|
153 |
SetTitlePaneL( dataRetriever, iAssignFlags, aMessage );
|
|
154 |
|
|
155 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
156 |
( *CEikonEnv::Static()->EikAppUi() );
|
|
157 |
|
|
158 |
iPreselectedContact = dataRetriever.GetPreselectedContactLinksL
|
|
159 |
( aMessage, appUi.ApplicationServices().ContactManager() );
|
|
160 |
iStoreUris = dataRetriever.GetContactStoreUriArrayL
|
|
161 |
( aMessage, appUi.ApplicationServices().StoreConfiguration(),
|
|
162 |
iPreselectedContact, iUseDeviceConfig );
|
|
163 |
|
|
164 |
// Assert that there aren't multiple preselected contacts
|
|
165 |
__ASSERT_DEBUG( ( !iPreselectedContact ||
|
|
166 |
iPreselectedContact->Count() <= 1 ),
|
|
167 |
Panic( ELogicPreselectedContacts ) );
|
|
168 |
|
|
169 |
iAddressSelectFilterBuffer =
|
|
170 |
dataRetriever.GetAddressSelectFilterBufferL( aMessage );
|
|
171 |
iDataBuffer = dataRetriever.GetDataBufferL( aMessage );
|
|
172 |
iMimeType = dataRetriever.GetMimeTypeL( aMessage );
|
|
173 |
iFieldIndex = dataRetriever.GetFocusIndexL( aMessage );
|
|
174 |
|
|
175 |
iEditorHelpContext = dataRetriever.GetEditorHelpContextL( aMessage );
|
|
176 |
|
|
177 |
// Drop all non-writable stores
|
|
178 |
iStoreManager = CPbk2ServerAppStoreManager::NewL
|
|
179 |
( appUi.StoreManager(),
|
|
180 |
appUi.ApplicationServices().ContactManager() );
|
|
181 |
iStoreManager->RemoveReadOnlyStoreUris
|
|
182 |
( *iStoreUris, appUi.ApplicationServices().StoreProperties() );
|
|
183 |
|
|
184 |
// Retrieve view filter
|
|
185 |
iContactViewFilter =
|
|
186 |
dataRetriever.GetContactViewFilterForAttributeAssignL
|
|
187 |
( aMessage,
|
|
188 |
appUi.ApplicationServices().ContactManager().FieldTypes() );
|
|
189 |
}
|
|
190 |
|
|
191 |
// --------------------------------------------------------------------------
|
|
192 |
// CPbk2SingleContactDataAssigner::LaunchServiceL
|
|
193 |
// --------------------------------------------------------------------------
|
|
194 |
//
|
|
195 |
void CPbk2SingleContactDataAssigner::LaunchServiceL()
|
|
196 |
{
|
|
197 |
// Open stores
|
|
198 |
iStoreManager->LoadAndOpenContactStoresL( *iStoreUris, *this, ETrue );
|
|
199 |
}
|
|
200 |
|
|
201 |
// --------------------------------------------------------------------------
|
|
202 |
// CPbk2SingleContactDataAssigner::CancelService
|
|
203 |
// --------------------------------------------------------------------------
|
|
204 |
//
|
|
205 |
void CPbk2SingleContactDataAssigner::CancelService()
|
|
206 |
{
|
|
207 |
if ( iAssignDataPhase )
|
|
208 |
{
|
|
209 |
iAssignDataPhase->CancelServicePhase();
|
|
210 |
}
|
|
211 |
|
|
212 |
if ( iPrepareAssignPhase )
|
|
213 |
{
|
|
214 |
iPrepareAssignPhase->CancelServicePhase();
|
|
215 |
}
|
|
216 |
|
|
217 |
if ( iSelectPropertyPhase )
|
|
218 |
{
|
|
219 |
iSelectPropertyPhase->CancelServicePhase();
|
|
220 |
}
|
|
221 |
|
|
222 |
if ( iFetchPhase )
|
|
223 |
{
|
|
224 |
iFetchPhase->CancelServicePhase();
|
|
225 |
}
|
|
226 |
}
|
|
227 |
|
|
228 |
// --------------------------------------------------------------------------
|
|
229 |
// CPbk2SingleContactDataAssigner::AcceptDelayedContactsL
|
|
230 |
// --------------------------------------------------------------------------
|
|
231 |
//
|
|
232 |
void CPbk2SingleContactDataAssigner::AcceptDelayedContactsL
|
|
233 |
( const TDesC8& /*aContactLinkBuffer*/ )
|
|
234 |
{
|
|
235 |
// Do nothing
|
|
236 |
}
|
|
237 |
|
|
238 |
// --------------------------------------------------------------------------
|
|
239 |
// CPbk2SingleContactDataAssigner::DenyDelayedContactsL
|
|
240 |
// --------------------------------------------------------------------------
|
|
241 |
//
|
|
242 |
void CPbk2SingleContactDataAssigner::DenyDelayedContactsL
|
|
243 |
( const TDesC8& /*aContactLinkBuffer*/ )
|
|
244 |
{
|
|
245 |
// Do nothing
|
|
246 |
}
|
|
247 |
|
|
248 |
// --------------------------------------------------------------------------
|
|
249 |
// CPbk2SingleContactDataAssigner::ExitServiceL
|
|
250 |
// --------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
void CPbk2SingleContactDataAssigner::ExitServiceL( TInt aExitCommandId )
|
|
253 |
{
|
|
254 |
if ( iAssignDataPhase )
|
|
255 |
{
|
|
256 |
iAssignDataPhase->RequestCancelL( aExitCommandId );
|
|
257 |
}
|
|
258 |
|
|
259 |
if ( iPrepareAssignPhase )
|
|
260 |
{
|
|
261 |
iPrepareAssignPhase->RequestCancelL( aExitCommandId );
|
|
262 |
}
|
|
263 |
|
|
264 |
if ( iSelectPropertyPhase )
|
|
265 |
{
|
|
266 |
iSelectPropertyPhase->RequestCancelL( aExitCommandId );
|
|
267 |
}
|
|
268 |
|
|
269 |
if ( iFetchPhase )
|
|
270 |
{
|
|
271 |
iFetchPhase->RequestCancelL( aExitCommandId );
|
|
272 |
}
|
|
273 |
}
|
|
274 |
|
|
275 |
// --------------------------------------------------------------------------
|
|
276 |
// CPbk2SingleContactDataAssigner::ServiceResults
|
|
277 |
// --------------------------------------------------------------------------
|
|
278 |
//
|
|
279 |
void CPbk2SingleContactDataAssigner::ServiceResults(TServiceResults* aResults) const
|
|
280 |
{
|
|
281 |
if ( iAssignDataPhase )
|
|
282 |
{
|
|
283 |
aResults->iLinkArray = iAssignDataPhase->Results();
|
|
284 |
aResults->iExtraData = iAssignDataPhase->ExtraResultData();
|
|
285 |
aResults->iFieldContent = iAssignDataPhase->FieldContent();
|
|
286 |
}
|
|
287 |
}
|
|
288 |
|
|
289 |
// --------------------------------------------------------------------------
|
|
290 |
// CPbk2SingleContactDataAssigner::NextPhase
|
|
291 |
// --------------------------------------------------------------------------
|
|
292 |
//
|
|
293 |
void CPbk2SingleContactDataAssigner::NextPhase
|
|
294 |
( MPbk2ServicePhase& aPhase )
|
|
295 |
{
|
|
296 |
TInt err = KErrNone;
|
|
297 |
|
|
298 |
if ( &aPhase == iFetchPhase )
|
|
299 |
{
|
|
300 |
MVPbkContactLinkArray* fetchResult = iFetchPhase->Results();
|
|
301 |
__ASSERT_DEBUG( fetchResult && fetchResult->Count() > 0,
|
|
302 |
Panic( EPanicLogicPhaseCompletion ) );
|
|
303 |
|
|
304 |
TRAP( err, LaunchSelectSinglePropertyPhaseL( fetchResult ) );
|
|
305 |
}
|
|
306 |
else if ( &aPhase == iSelectPropertyPhase )
|
|
307 |
{
|
|
308 |
TRAP( err, LaunchPrepareSingleAssignPhaseL
|
|
309 |
( iSelectPropertyPhase->TakeStoreContact() ) );
|
|
310 |
}
|
|
311 |
else if ( &aPhase == iPrepareAssignPhase )
|
|
312 |
{
|
|
313 |
TRAP( err, LaunchAssignPhaseL
|
|
314 |
( iPrepareAssignPhase->TakeStoreContact() ) );
|
|
315 |
}
|
|
316 |
else if ( &aPhase == iAssignDataPhase )
|
|
317 |
{
|
|
318 |
iObserver.ServiceComplete();
|
|
319 |
}
|
|
320 |
else
|
|
321 |
{
|
|
322 |
__ASSERT_DEBUG( EFalse, Panic( EPanicLogicPhaseCompletion ) );
|
|
323 |
}
|
|
324 |
|
|
325 |
if ( err != KErrNone )
|
|
326 |
{
|
|
327 |
iObserver.ServiceError( err );
|
|
328 |
}
|
|
329 |
}
|
|
330 |
|
|
331 |
// --------------------------------------------------------------------------
|
|
332 |
// CPbk2SingleContactDataAssigner::PreviousPhase
|
|
333 |
// --------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
void CPbk2SingleContactDataAssigner::PreviousPhase
|
|
336 |
( MPbk2ServicePhase& aPhase )
|
|
337 |
{
|
|
338 |
TInt err = KErrNone;
|
|
339 |
|
|
340 |
if ( &aPhase == iPrepareAssignPhase )
|
|
341 |
{
|
|
342 |
MVPbkContactLinkArray* resultLinks = aPhase.Results();
|
|
343 |
__ASSERT_DEBUG( resultLinks && resultLinks->Count() == 1,
|
|
344 |
Panic( EPanicLogicPhaseCompletion ) );
|
|
345 |
|
|
346 |
TRAP( err, LaunchSelectSinglePropertyPhaseL( resultLinks ) );
|
|
347 |
}
|
|
348 |
|
|
349 |
if ( err != KErrNone )
|
|
350 |
{
|
|
351 |
iObserver.ServiceError( err );
|
|
352 |
}
|
|
353 |
}
|
|
354 |
|
|
355 |
// --------------------------------------------------------------------------
|
|
356 |
// CPbk2SingleContactDataAssigner::PhaseCanceled
|
|
357 |
// --------------------------------------------------------------------------
|
|
358 |
//
|
|
359 |
void CPbk2SingleContactDataAssigner::PhaseCanceled
|
|
360 |
( MPbk2ServicePhase& /*aPhase*/ )
|
|
361 |
{
|
|
362 |
iObserver.ServiceCanceled();
|
|
363 |
}
|
|
364 |
|
|
365 |
// --------------------------------------------------------------------------
|
|
366 |
// CPbk2SingleContactDataAssigner::PhaseAborted
|
|
367 |
// --------------------------------------------------------------------------
|
|
368 |
//
|
|
369 |
void CPbk2SingleContactDataAssigner::PhaseAborted
|
|
370 |
( MPbk2ServicePhase& /*aPhase*/ )
|
|
371 |
{
|
|
372 |
iObserver.ServiceAborted();
|
|
373 |
}
|
|
374 |
|
|
375 |
// --------------------------------------------------------------------------
|
|
376 |
// CPbk2SingleContactDataAssigner::PhaseError
|
|
377 |
// --------------------------------------------------------------------------
|
|
378 |
//
|
|
379 |
void CPbk2SingleContactDataAssigner::PhaseError
|
|
380 |
( MPbk2ServicePhase& /*aPhase*/, TInt aErrorCode )
|
|
381 |
{
|
|
382 |
iObserver.ServiceError( aErrorCode );
|
|
383 |
}
|
|
384 |
|
|
385 |
// --------------------------------------------------------------------------
|
|
386 |
// CPbk2SingleContactDataAssigner::PhaseOkToExit
|
|
387 |
// --------------------------------------------------------------------------
|
|
388 |
//
|
|
389 |
TBool CPbk2SingleContactDataAssigner::PhaseOkToExit
|
|
390 |
( MPbk2ServicePhase& /*aPhase*/, TInt aCommandId )
|
|
391 |
{
|
|
392 |
// Deny exit and pass an asynchronous query to the consumer,
|
|
393 |
// which may later approve exit
|
|
394 |
iObserver.CompleteExitMessage( aCommandId );
|
|
395 |
return EFalse;
|
|
396 |
}
|
|
397 |
|
|
398 |
// --------------------------------------------------------------------------
|
|
399 |
// CPbk2SingleContactDataAssigner::PhaseAccept
|
|
400 |
// --------------------------------------------------------------------------
|
|
401 |
//
|
|
402 |
void CPbk2SingleContactDataAssigner::PhaseAccept
|
|
403 |
( MPbk2ServicePhase& /*aPhase*/, const TDesC8& /*aMarkedEntries*/,
|
|
404 |
const TDesC8& /*aLinkData*/ )
|
|
405 |
{
|
|
406 |
// Not supported in assign
|
|
407 |
}
|
|
408 |
|
|
409 |
// --------------------------------------------------------------------------
|
|
410 |
// CPbk2SingleContactDataAssigner::ContactUiReadyL
|
|
411 |
// --------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
void CPbk2SingleContactDataAssigner::ContactUiReadyL
|
|
414 |
( MPbk2StartupMonitor& aStartupMonitor )
|
|
415 |
{
|
|
416 |
aStartupMonitor.DeregisterEvents( *this );
|
|
417 |
|
|
418 |
if ( iAssignFlags & ECreateNewContact )
|
|
419 |
{
|
|
420 |
CVPbkContactStoreUriArray* validStores =
|
|
421 |
iStoreManager->CurrentlyValidStoresL();
|
|
422 |
CleanupStack::PushL( validStores );
|
|
423 |
|
|
424 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
425 |
( *CEikonEnv::Static()->EikAppUi() );
|
|
426 |
|
|
427 |
// Saving store URI
|
|
428 |
TVPbkContactStoreUriPtr savingStoreUri =
|
|
429 |
appUi.ApplicationServices().StoreConfiguration().
|
|
430 |
DefaultSavingStoreL();
|
|
431 |
|
|
432 |
TPbk2AssignNoteService noteService;
|
|
433 |
if ( validStores->IsIncluded ( savingStoreUri ) )
|
|
434 |
{
|
|
435 |
LaunchSelectCreateNewPropertyPhaseL( savingStoreUri );
|
|
436 |
}
|
|
437 |
else if ( noteService.ShowCreateNewToPhoneQueryL() )
|
|
438 |
{
|
|
439 |
savingStoreUri.Set(
|
|
440 |
TVPbkContactStoreUriPtr(
|
|
441 |
VPbkContactStoreUris::DefaultCntDbUri() ) );
|
|
442 |
LaunchSelectCreateNewPropertyPhaseL( savingStoreUri );
|
|
443 |
}
|
|
444 |
else
|
|
445 |
{
|
|
446 |
// Canceled
|
|
447 |
iObserver.ServiceCanceled();
|
|
448 |
}
|
|
449 |
|
|
450 |
CleanupStack::PopAndDestroy( validStores );
|
|
451 |
}
|
|
452 |
else
|
|
453 |
{
|
|
454 |
if ( iPreselectedContact && iPreselectedContact->Count() == 1 )
|
|
455 |
{
|
|
456 |
if ( iStoreManager->ContactsAvailableL( *iPreselectedContact ) )
|
|
457 |
{
|
|
458 |
LaunchSelectSinglePropertyPhaseL( iPreselectedContact );
|
|
459 |
}
|
|
460 |
else
|
|
461 |
{
|
|
462 |
iObserver.ServiceError( KErrNotSupported );
|
|
463 |
}
|
|
464 |
}
|
|
465 |
else
|
|
466 |
{
|
|
467 |
LaunchFetchPhaseL();
|
|
468 |
}
|
|
469 |
}
|
|
470 |
}
|
|
471 |
|
|
472 |
// --------------------------------------------------------------------------
|
|
473 |
// CPbk2SingleContactDataAssigner::StartupCanceled
|
|
474 |
// --------------------------------------------------------------------------
|
|
475 |
//
|
|
476 |
void CPbk2SingleContactDataAssigner::StartupCanceled( TInt aErrorCode )
|
|
477 |
{
|
|
478 |
if ( aErrorCode == KErrCancel )
|
|
479 |
{
|
|
480 |
iObserver.ServiceCanceled();
|
|
481 |
}
|
|
482 |
else
|
|
483 |
{
|
|
484 |
iObserver.ServiceError( aErrorCode );
|
|
485 |
}
|
|
486 |
}
|
|
487 |
|
|
488 |
// --------------------------------------------------------------------------
|
|
489 |
// CPbk2SingleContactDataAssigner::LaunchFetchPhaseL
|
|
490 |
// --------------------------------------------------------------------------
|
|
491 |
//
|
|
492 |
void CPbk2SingleContactDataAssigner::LaunchFetchPhaseL()
|
|
493 |
{
|
|
494 |
CPbk2FetchDlg::TParams params;
|
|
495 |
params.iResId = R_PBK2_SINGLE_ENTRY_FETCH_DLG;
|
|
496 |
params.iFlags = CPbk2FetchDlg::EFetchSingle;
|
|
497 |
|
|
498 |
delete iFetchPhase;
|
|
499 |
iFetchPhase = NULL;
|
|
500 |
iFetchPhase = CPbk2ContactFetchPhase::NewL
|
|
501 |
( *this, *iStoreManager, params, ETrue,
|
|
502 |
MPbk2FetchDlgObserver::EFetchYes, iContactViewFilter,
|
|
503 |
iUseDeviceConfig, iStoreUris );
|
|
504 |
|
|
505 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
506 |
( *CEikonEnv::Static()->EikAppUi() );
|
|
507 |
|
|
508 |
// Change layout to fetch's layout
|
|
509 |
appUi.ChangeStatuspaneLayoutL(
|
|
510 |
CPbk2ServerAppAppUi::EStatusPaneLayoutUsual );
|
|
511 |
|
|
512 |
iFetchPhase->LaunchServicePhaseL();
|
|
513 |
}
|
|
514 |
|
|
515 |
// --------------------------------------------------------------------------
|
|
516 |
// CPbk2SingleContactDataAssigner::LaunchSelectSinglePropertyPhaseL
|
|
517 |
// --------------------------------------------------------------------------
|
|
518 |
//
|
|
519 |
void CPbk2SingleContactDataAssigner::LaunchSelectSinglePropertyPhaseL
|
|
520 |
( MVPbkContactLinkArray* aContactLinks )
|
|
521 |
{
|
|
522 |
delete iSelectPropertyPhase;
|
|
523 |
iSelectPropertyPhase = NULL;
|
|
524 |
|
|
525 |
// Prepare parameters by reseting them
|
|
526 |
delete iSelectFieldProperty;
|
|
527 |
iSelectFieldProperty = NULL;
|
|
528 |
iSelectFieldResult = KErrNotReady;
|
|
529 |
|
|
530 |
iSelectPropertyPhase = CPbk2SelectSinglePropertyPhase::NewL
|
|
531 |
( *this, aContactLinks, iAddressSelectFilterBuffer,
|
|
532 |
iSelectFieldProperty, iSelectFieldResult );
|
|
533 |
|
|
534 |
iRelocationFlags = CPbk2ContactRelocator::EPbk2RelocatorExistingContact;
|
|
535 |
|
|
536 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
537 |
( *CEikonEnv::Static()->EikAppUi() );
|
|
538 |
|
|
539 |
// Change layout back to regular
|
|
540 |
appUi.ChangeStatuspaneLayoutL(
|
|
541 |
CPbk2ServerAppAppUi::EStatusPaneLayoutEmpty );
|
|
542 |
|
|
543 |
iSelectPropertyPhase->LaunchServicePhaseL();
|
|
544 |
}
|
|
545 |
|
|
546 |
// --------------------------------------------------------------------------
|
|
547 |
// CPbk2SingleContactDataAssigner::LaunchSelectCreateNewPropertyPhaseL
|
|
548 |
// --------------------------------------------------------------------------
|
|
549 |
//
|
|
550 |
void CPbk2SingleContactDataAssigner::LaunchSelectCreateNewPropertyPhaseL(
|
|
551 |
TVPbkContactStoreUriPtr savingStoreUri )
|
|
552 |
{
|
|
553 |
delete iSelectPropertyPhase;
|
|
554 |
iSelectPropertyPhase = NULL;
|
|
555 |
|
|
556 |
// Prepare parameters by reseting them
|
|
557 |
delete iSelectFieldProperty;
|
|
558 |
iSelectFieldProperty = NULL;
|
|
559 |
iSelectFieldResult = KErrNotReady;
|
|
560 |
|
|
561 |
iSelectPropertyPhase = CPbk2SelectCreateNewPropertyPhase::NewL
|
|
562 |
( savingStoreUri, *this, iAddressSelectFilterBuffer,
|
|
563 |
iSelectFieldProperty, iSelectFieldResult, iInformationNoteFlags );
|
|
564 |
|
|
565 |
iRelocationFlags = CPbk2ContactRelocator::EPbk2RelocatorNewContact;
|
|
566 |
|
|
567 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
568 |
( *CEikonEnv::Static()->EikAppUi() );
|
|
569 |
|
|
570 |
// Change layout back to regular
|
|
571 |
appUi.ChangeStatuspaneLayoutL(
|
|
572 |
CPbk2ServerAppAppUi::EStatusPaneLayoutEmpty );
|
|
573 |
|
|
574 |
iSelectPropertyPhase->LaunchServicePhaseL();
|
|
575 |
}
|
|
576 |
|
|
577 |
// --------------------------------------------------------------------------
|
|
578 |
// CPbk2SingleContactDataAssigner::LaunchPrepareSingleAssignPhaseL
|
|
579 |
// --------------------------------------------------------------------------
|
|
580 |
//
|
|
581 |
void CPbk2SingleContactDataAssigner::LaunchPrepareSingleAssignPhaseL
|
|
582 |
( MVPbkStoreContact* aStoreContact )
|
|
583 |
{
|
|
584 |
delete iPrepareAssignPhase;
|
|
585 |
iPrepareAssignPhase = NULL;
|
|
586 |
|
|
587 |
CleanupStack::PushL( aStoreContact );
|
|
588 |
iPrepareAssignPhase = CPbk2PrepareSingleAssignPhase::NewL
|
|
589 |
( *this, aStoreContact, iSelectFieldProperty,
|
|
590 |
iSelectFieldResult, iFieldIndex, iInformationNoteFlags,
|
|
591 |
iRelocationFlags );
|
|
592 |
CleanupStack::Pop( aStoreContact );
|
|
593 |
|
|
594 |
iPrepareAssignPhase->LaunchServicePhaseL();
|
|
595 |
}
|
|
596 |
|
|
597 |
// --------------------------------------------------------------------------
|
|
598 |
// CPbk2SingleContactDataAssigner::LaunchAssignPhaseL
|
|
599 |
// --------------------------------------------------------------------------
|
|
600 |
//
|
|
601 |
void CPbk2SingleContactDataAssigner::LaunchAssignPhaseL
|
|
602 |
( MVPbkStoreContact* aStoreContact )
|
|
603 |
{
|
|
604 |
delete iAssignDataPhase;
|
|
605 |
iAssignDataPhase = NULL;
|
|
606 |
|
|
607 |
CleanupStack::PushL( aStoreContact );
|
|
608 |
iAssignDataPhase = CPbk2SingleAssignDataPhase::NewL
|
|
609 |
( *this, aStoreContact, iSelectFieldProperty,
|
|
610 |
iFieldIndex, iDataBuffer, iMimeType,
|
|
611 |
iEditorHelpContext, iAssignFlags, iInformationNoteFlags );
|
|
612 |
CleanupStack::Pop( aStoreContact );
|
|
613 |
|
|
614 |
// In case of the assign phase it is important to delete the
|
|
615 |
// previous phases so that exit and cancel methods work correctly
|
|
616 |
delete iPrepareAssignPhase;
|
|
617 |
iPrepareAssignPhase = NULL;
|
|
618 |
delete iSelectPropertyPhase;
|
|
619 |
iSelectPropertyPhase = NULL;
|
|
620 |
delete iFetchPhase;
|
|
621 |
iFetchPhase = NULL;
|
|
622 |
|
|
623 |
// If need to open the editor, then change StatuspaneLayout to
|
|
624 |
// CPbk2ServerAppAppUi::EStatusPaneLayoutUsual
|
|
625 |
if (!(iAssignFlags & EDoNotOpenEditor))
|
|
626 |
{
|
|
627 |
CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
|
|
628 |
( *CEikonEnv::Static()->EikAppUi() );
|
|
629 |
appUi.ChangeStatuspaneLayoutL(CPbk2ServerAppAppUi::EStatusPaneLayoutUsual);
|
|
630 |
}
|
|
631 |
|
|
632 |
iAssignDataPhase->LaunchServicePhaseL();
|
|
633 |
}
|
|
634 |
|
|
635 |
// End of File
|