|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * Interface spefication for managing associations between various social contacts |
|
17 * |
|
18 */ |
|
19 |
|
20 #include "smfrelationmgr.h" |
|
21 #include "smfrelationmgr_p.h" |
|
22 |
|
23 SmfRelationItem::SmfRelationItem(SmfProvider* provider) |
|
24 { |
|
25 m_provider = *(provider); |
|
26 } |
|
27 |
|
28 SmfProvider SmfRelationItem::getProvider() const |
|
29 { |
|
30 return m_provider; |
|
31 } |
|
32 |
|
33 void SmfRelationItem::setProvider(SmfProvider& provider) |
|
34 { |
|
35 m_provider = provider; |
|
36 } |
|
37 |
|
38 SmfContact SmfRelationItem::getContact() const |
|
39 { |
|
40 return m_contact; |
|
41 } |
|
42 |
|
43 void SmfRelationItem::setContact(SmfContact& contact) |
|
44 { |
|
45 m_contact = contact; |
|
46 } |
|
47 |
|
48 quint32 SmfRelationItem::getIndex() const |
|
49 { |
|
50 return m_index; |
|
51 } |
|
52 |
|
53 void SmfRelationItem::setIndex(quint32 index) |
|
54 { |
|
55 m_index = index; |
|
56 } |
|
57 |
|
58 QDataStream &operator<<( QDataStream &aDataStream,const SmfRelationItem &aRelnItem ) |
|
59 { |
|
60 aDataStream<<aRelnItem.getProvider(); |
|
61 aDataStream<<aRelnItem.getContact(); |
|
62 aDataStream<<aRelnItem.getIndex(); |
|
63 |
|
64 return aDataStream; |
|
65 } |
|
66 |
|
67 QDataStream &operator>>( QDataStream &aDataStream,SmfRelationItem &aRelnItem) |
|
68 { |
|
69 SmfContact contact; |
|
70 SmfProvider provider; |
|
71 quint32 index; |
|
72 |
|
73 aDataStream>>provider; |
|
74 aDataStream>>contact; |
|
75 aDataStream>>index; |
|
76 |
|
77 aRelnItem.setProvider(provider); |
|
78 aRelnItem.setContact(contact); |
|
79 aRelnItem.setIndex(index); |
|
80 |
|
81 return aDataStream; |
|
82 } |
|
83 |
|
84 |
|
85 |
|
86 SmfRelationMgr::SmfRelationMgr(QObject* parent):QObject(parent) |
|
87 { |
|
88 m_private = new SmfRelationMgrPrivate(this); |
|
89 } |
|
90 |
|
91 SmfRelationMgr::~SmfRelationMgr() |
|
92 { |
|
93 if(m_private) |
|
94 { |
|
95 delete m_private; |
|
96 m_private = NULL; |
|
97 } |
|
98 } |
|
99 |
|
100 SmfRelationId SmfRelationMgr::create(SmfProvider *provider, SmfContact *contact) |
|
101 { |
|
102 return m_private->create(provider,contact); |
|
103 } |
|
104 |
|
105 SmfError SmfRelationMgr::associate(SmfRelationId& relation,const SmfContact* contact,SmfProvider* provider) |
|
106 { |
|
107 return m_private->associate(relation,contact,provider); |
|
108 } |
|
109 |
|
110 SmfError SmfRelationMgr::remove(SmfRelationId& relation,const SmfContact* contact) |
|
111 { |
|
112 return m_private->remove(relation,contact); |
|
113 } |
|
114 |
|
115 SmfRelationItem* SmfRelationMgr::searchById(const SmfRelationId& relation) |
|
116 { |
|
117 return m_private->searchById(relation); |
|
118 } |
|
119 |
|
120 SmfRelationId SmfRelationMgr::searchByContact( SmfContact contact) |
|
121 { |
|
122 return m_private->searchByContact(contact); |
|
123 } |
|
124 |
|
125 uint SmfRelationMgr::count(SmfRelationId relation) |
|
126 { |
|
127 return m_private->count(relation); |
|
128 } |
|
129 |
|
130 SmfRelationItem* SmfRelationMgr::get(SmfRelationId& relation, quint32 index) |
|
131 { |
|
132 return m_private->get(relation,index); |
|
133 } |
|
134 |
|
135 QList<SmfRelationItem> SmfRelationMgr::getAll(SmfRelationId& relation) |
|
136 { |
|
137 return m_private->getAll(relation); |
|
138 } |
|
139 |
|
140 QList<SmfRelationId> SmfRelationMgr::getAllRelations() |
|
141 { |
|
142 return m_private->getAllRelations(); |
|
143 } |
|
144 |
|
145 SmfError SmfRelationMgr::Delete(SmfRelationId& relation) |
|
146 { |
|
147 return m_private->Delete(relation); |
|
148 } |