|
1 /* |
|
2 * Copyright (c) 2001-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <cntviewbase.h> |
|
20 #include "cntviewprivate.h" |
|
21 |
|
22 |
|
23 // |
|
24 // CContactNamedLocalView. |
|
25 // |
|
26 |
|
27 CContactNamedLocalView::~CContactNamedLocalView() |
|
28 { |
|
29 delete iName; |
|
30 } |
|
31 |
|
32 CContactNamedLocalView::CContactNamedLocalView(const CContactDatabase& aDb,TContactViewPreferences aContactTypes) : CContactLocalView(aDb,aContactTypes) |
|
33 { |
|
34 } |
|
35 |
|
36 CContactNamedLocalView::CContactNamedLocalView(const CContactDatabase& aDb,TContactViewPreferences aContactTypes,MLplPersistenceLayerFactory* aFactory) |
|
37 : CContactLocalView(aDb,aContactTypes,aFactory) |
|
38 { |
|
39 } |
|
40 |
|
41 EXPORT_C CContactNamedLocalView* CContactNamedLocalView::NewL(MContactViewObserver& aObserver,const TDesC& aName,const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes) |
|
42 { |
|
43 CContactNamedLocalView* self=new(ELeave) CContactNamedLocalView(aDb,aContactTypes); |
|
44 CleanupStack::PushL(self); |
|
45 self->ConstructL(aObserver, aName, aSortOrder, EFalse, KNullDesC8); |
|
46 CleanupStack::Pop(self); |
|
47 return self; |
|
48 } |
|
49 |
|
50 void CContactNamedLocalView::ConstructL(MContactViewObserver& aObserver,const TDesC& aName,const RContactViewSortOrder& aSortOrder, |
|
51 TBool aUseNamedPlugin, const TDesC8& aSortPluginName) |
|
52 { |
|
53 iName=aName.AllocL(); |
|
54 if(aSortPluginName.Length()) |
|
55 { |
|
56 CContactLocalView::ConstructL(aObserver, aSortOrder, aUseNamedPlugin, aSortPluginName); |
|
57 } |
|
58 else |
|
59 { |
|
60 CContactLocalView::ConstructL(aObserver, aSortOrder); |
|
61 } |
|
62 |
|
63 } |
|
64 |
|
65 |
|
66 EXPORT_C CContactNamedLocalView* CContactNamedLocalView::NewL(MContactViewObserver& aObserver,const TDesC& aName,const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes, const TDesC8& aSortPluginName) |
|
67 { |
|
68 CContactNamedLocalView* self=new(ELeave) CContactNamedLocalView(aDb,aContactTypes); |
|
69 CleanupStack::PushL(self); |
|
70 self->ConstructL(aObserver, aName, aSortOrder, ETrue, aSortPluginName); |
|
71 CleanupStack::Pop(self); |
|
72 return self; |
|
73 } |
|
74 |
|
75 /** CContactNamedLocalView contructor, used in the server |
|
76 @internalTechnology |
|
77 */ |
|
78 EXPORT_C CContactNamedLocalView* CContactNamedLocalView::NewL(MContactViewObserver& aObserver,const TDesC& aName,const CContactDatabase& aDb,const RContactViewSortOrder& aSortOrder,TContactViewPreferences aContactTypes, MLplPersistenceLayerFactory* aFactory, const TDesC8& aSortPluginName) |
|
79 { |
|
80 CContactNamedLocalView* self=new(ELeave) CContactNamedLocalView(aDb,aContactTypes,aFactory); |
|
81 CleanupStack::PushL(self); |
|
82 self->ConstructL(aObserver, aName, aSortOrder, ETrue, aSortPluginName); |
|
83 CleanupStack::Pop(self); |
|
84 return self; |
|
85 } |
|
86 |
|
87 EXPORT_C const TDesC& CContactNamedLocalView::Name() |
|
88 { |
|
89 return *iName; |
|
90 } |
|
91 |
|
92 EXPORT_C void CContactNamedLocalView::ChangeSortOrderL(RContactViewSortOrder& aSortOrder) |
|
93 { |
|
94 SetState(ENotReady); |
|
95 TRAPD(err,SortL(aSortOrder)); |
|
96 if (err) |
|
97 { |
|
98 NotifyObservers(TContactViewEvent(TContactViewEvent::ESortError,err)); |
|
99 } |
|
100 else |
|
101 { |
|
102 iSortOrder.CopyL(aSortOrder); |
|
103 } |
|
104 } |
|
105 |