|
1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <cntviewbase.h> |
|
17 #include "cntviewprivate.h" |
|
18 |
|
19 |
|
20 // |
|
21 // CContactNamedLocalView. |
|
22 // |
|
23 |
|
24 CContactNamedLocalView::~CContactNamedLocalView() |
|
25 { |
|
26 delete iName; |
|
27 } |
|
28 |
|
29 CContactNamedLocalView::CContactNamedLocalView(const CContactDatabase& aDb,TContactViewPreferences aContactTypes) : CContactLocalView(aDb,aContactTypes) |
|
30 { |
|
31 } |
|
32 |
|
33 CContactNamedLocalView::CContactNamedLocalView(const CContactDatabase& aDb,TContactViewPreferences aContactTypes,MLplPersistenceLayerFactory* aFactory) |
|
34 : CContactLocalView(aDb,aContactTypes,aFactory) |
|
35 { |
|
36 } |
|
37 |
|
38 EXPORT_C CContactNamedLocalView* CContactNamedLocalView::NewL(MContactViewObserver& aObserver,const TDesC& aName,const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes) |
|
39 { |
|
40 CContactNamedLocalView* self=new(ELeave) CContactNamedLocalView(aDb,aContactTypes); |
|
41 CleanupStack::PushL(self); |
|
42 self->ConstructL(aObserver, aName, aSortOrder, EFalse, KNullDesC8); |
|
43 CleanupStack::Pop(self); |
|
44 return self; |
|
45 } |
|
46 |
|
47 void CContactNamedLocalView::ConstructL(MContactViewObserver& aObserver,const TDesC& aName,const RContactViewSortOrder& aSortOrder, |
|
48 TBool aUseNamedPlugin, const TDesC8& aSortPluginName) |
|
49 { |
|
50 iName=aName.AllocL(); |
|
51 if(aSortPluginName.Length()) |
|
52 { |
|
53 CContactLocalView::ConstructL(aObserver, aSortOrder, aUseNamedPlugin, aSortPluginName); |
|
54 } |
|
55 else |
|
56 { |
|
57 CContactLocalView::ConstructL(aObserver, aSortOrder); |
|
58 } |
|
59 |
|
60 } |
|
61 |
|
62 |
|
63 EXPORT_C CContactNamedLocalView* CContactNamedLocalView::NewL(MContactViewObserver& aObserver,const TDesC& aName,const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes, const TDesC8& aSortPluginName) |
|
64 { |
|
65 CContactNamedLocalView* self=new(ELeave) CContactNamedLocalView(aDb,aContactTypes); |
|
66 CleanupStack::PushL(self); |
|
67 self->ConstructL(aObserver, aName, aSortOrder, ETrue, aSortPluginName); |
|
68 CleanupStack::Pop(self); |
|
69 return self; |
|
70 } |
|
71 |
|
72 /** CContactNamedLocalView contructor, used in the server |
|
73 @internalTechnology |
|
74 */ |
|
75 EXPORT_C CContactNamedLocalView* CContactNamedLocalView::NewL(MContactViewObserver& aObserver,const TDesC& aName,const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes, MLplPersistenceLayerFactory* aFactory, const TDesC8& aSortPluginName) |
|
76 { |
|
77 CContactNamedLocalView* self=new(ELeave) CContactNamedLocalView(aDb,aContactTypes,aFactory); |
|
78 CleanupStack::PushL(self); |
|
79 self->ConstructL(aObserver, aName, aSortOrder, ETrue, aSortPluginName); |
|
80 CleanupStack::Pop(self); |
|
81 return self; |
|
82 } |
|
83 |
|
84 EXPORT_C const TDesC& CContactNamedLocalView::Name() |
|
85 { |
|
86 return *iName; |
|
87 } |
|
88 |
|
89 EXPORT_C void CContactNamedLocalView::ChangeSortOrderL(RContactViewSortOrder& aSortOrder) |
|
90 { |
|
91 SetState(ENotReady); |
|
92 TRAPD(err,SortL(aSortOrder)); |
|
93 if (err) |
|
94 { |
|
95 NotifyObservers(TContactViewEvent(TContactViewEvent::ESortError,err)); |
|
96 } |
|
97 else |
|
98 { |
|
99 iSortOrder.CopyL(aSortOrder); |
|
100 } |
|
101 } |
|
102 |