112 QMap<QContactLocalId, QList<QContactRelationship> > m_orderedRelationships; // map of ordered lists of contact relationships |
111 QMap<QContactLocalId, QList<QContactRelationship> > m_orderedRelationships; // map of ordered lists of contact relationships |
113 QList<QString> m_definitionIds; // list of definition types (id's) |
112 QList<QString> m_definitionIds; // list of definition types (id's) |
114 mutable QMap<QString, QMap<QString, QContactDetailDefinition> > m_definitions; // map of contact type to map of definition name to definitions. |
113 mutable QMap<QString, QMap<QString, QContactDetailDefinition> > m_definitions; // map of contact type to map of definition name to definitions. |
115 QContactLocalId m_nextContactId; |
114 QContactLocalId m_nextContactId; |
116 bool m_anonymous; // Is this backend ever shared? |
115 bool m_anonymous; // Is this backend ever shared? |
117 QString m_engineName; // name of this engine as supplied by factory (memory) |
116 |
118 int m_engineVersion; // version of this engine as supplied by factory |
117 void emitSharedSignals(QContactChangeSet* cs) |
119 |
118 { |
120 QQueue<QContactAbstractRequest*> m_asynchronousOperations; // async requests to be performed. |
119 foreach(QContactManagerEngine* engine, m_sharedEngines) |
|
120 cs->emitSignals(engine); |
|
121 } |
|
122 |
|
123 QList<QContactManagerEngine*> m_sharedEngines; // The list of engines that share this data |
121 }; |
124 }; |
122 |
125 |
123 class Q_CONTACTS_EXPORT QContactMemoryEngine : public QContactManagerEngine |
126 class QContactMemoryEngine : public QContactManagerEngine |
124 { |
127 { |
125 Q_OBJECT |
128 Q_OBJECT |
126 |
129 |
127 public: |
130 public: |
128 using QContactManagerEngine::contacts; |
|
129 |
|
130 static QContactMemoryEngine *createMemoryEngine(const QMap<QString, QString>& parameters); |
131 static QContactMemoryEngine *createMemoryEngine(const QMap<QString, QString>& parameters); |
131 void deref(); |
132 |
|
133 ~QContactMemoryEngine(); |
132 |
134 |
133 /* URI reporting */ |
135 /* URI reporting */ |
134 QString managerName() const; |
136 QString managerName() const; |
135 QMap<QString, QString> managerParameters() const; |
137 QMap<QString, QString> managerParameters() const; |
|
138 /*! \reimp */ |
|
139 int managerVersion() const {return 1;} |
|
140 |
|
141 virtual QList<QContactLocalId> contactIds(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders, QContactManager::Error* error) const; |
|
142 virtual QList<QContact> contacts(const QContactFilter& filter, const QList<QContactSortOrder>& sortOrders, const QContactFetchHint& fetchHint, QContactManager::Error* error) const; |
|
143 virtual QContact contact(const QContactLocalId& contactId, const QContactFetchHint& fetchHint, QContactManager::Error* error) const; |
|
144 |
|
145 virtual bool saveContacts(QList<QContact>* contacts, QMap<int, QContactManager::Error>* errorMap, QContactManager::Error* error); |
|
146 virtual bool removeContacts(const QList<QContactLocalId>& contactIds, QMap<int, QContactManager::Error>* errorMap, QContactManager::Error* error); |
|
147 |
|
148 /*! \reimp */ |
|
149 virtual QContact compatibleContact(const QContact& original, QContactManager::Error* error) const |
|
150 { |
|
151 return QContactManagerEngine::compatibleContact(original, error); |
|
152 } |
|
153 |
|
154 /*! \reimp */ |
|
155 virtual QString synthesizedDisplayLabel(const QContact& contact, QContactManager::Error* error) const |
|
156 { |
|
157 return QContactManagerEngine::synthesizedDisplayLabel(contact, error); |
|
158 } |
136 |
159 |
137 /* "Self" contact id (MyCard) */ |
160 /* "Self" contact id (MyCard) */ |
138 bool setSelfContactId(const QContactLocalId& contactId, QContactManager::Error& error); |
161 virtual bool setSelfContactId(const QContactLocalId& contactId, QContactManager::Error* error); |
139 QContactLocalId selfContactId(QContactManager::Error& error) const; |
162 virtual QContactLocalId selfContactId(QContactManager::Error* error) const; |
140 |
163 |
141 /* Contacts - Accessors and Mutators */ |
164 /* Relationships between contacts */ |
142 QList<QContactLocalId> Q_DECL_DEPRECATED contacts(const QList<QContactSortOrder>& sortOrders, QContactManager::Error& error) const; |
165 virtual QList<QContactRelationship> relationships(const QString& relationshipType, const QContactId& participantId, QContactRelationship::Role role, QContactManager::Error* error) const; |
143 QList<QContactManager::Error> Q_DECL_DEPRECATED saveContacts(QList<QContact>* contacts, QContactManager::Error& error); |
166 virtual bool saveRelationships(QList<QContactRelationship>* relationships, QMap<int, QContactManager::Error>* errorMap, QContactManager::Error* error); |
144 QList<QContactManager::Error> Q_DECL_DEPRECATED removeContacts(QList<QContactLocalId>* contactIds, QContactManager::Error& error); |
167 virtual bool removeRelationships(const QList<QContactRelationship>& relationships, QMap<int, QContactManager::Error>* errorMap, QContactManager::Error* error); |
145 QContact Q_DECL_DEPRECATED contact(const QContactLocalId& contactId, QContactManager::Error& error) const; |
168 |
146 |
169 /*! \reimp */ |
147 QList<QContactLocalId> contactIds(const QList<QContactSortOrder> &sortOrders, QContactManager::Error &error) const; |
170 virtual bool validateContact(const QContact& contact, QContactManager::Error* error) const |
148 QList<QContact> contacts(const QList<QContactSortOrder> &sortOrders, const QStringList& definitionRestrictions, QContactManager::Error &error) const; |
171 { |
149 QContact contact(const QContactLocalId& contactId, const QStringList& definitionRestrictions, QContactManager::Error& error) const; |
172 return QContactManagerEngine::validateContact(contact, error); |
150 bool saveContacts(QList<QContact>* contacts, QMap<int, QContactManager::Error>* errorMap, QContactManager::Error& error); |
173 } |
151 bool saveContact(QContact* contact, QContactManager::Error& error); |
174 /*! \reimp */ |
152 bool removeContacts(QList<QContactLocalId>* contactIds, QMap<int, QContactManager::Error>* errorMap, QContactManager::Error& error); |
175 virtual bool validateDefinition(const QContactDetailDefinition& def, QContactManager::Error* error) const |
153 bool removeContact(const QContactLocalId& contactId, QContactManager::Error& error); |
176 { |
154 |
177 return QContactManagerEngine::validateDefinition(def, error); |
155 /* Relationships - Accessors and Mutators */ |
178 } |
156 QList<QContactRelationship> relationships(const QString& relationshipType, const QContactId& participantId, QContactRelationshipFilter::Role role, QContactManager::Error& error) const; |
|
157 bool saveRelationship(QContactRelationship* relationship, QContactManager::Error& error); |
|
158 QList<QContactManager::Error> saveRelationships(QList<QContactRelationship>* relationships, QContactManager::Error& error); |
|
159 bool removeRelationship(const QContactRelationship& relationship, QContactManager::Error& error); |
|
160 QList<QContactManager::Error> removeRelationships(const QList<QContactRelationship>& relationships, QContactManager::Error& error); |
|
161 |
179 |
162 /* Definitions - Accessors and Mutators */ |
180 /* Definitions - Accessors and Mutators */ |
163 QMap<QString, QContactDetailDefinition> detailDefinitions(const QString& contactType, QContactManager::Error& error) const; |
181 virtual QMap<QString, QContactDetailDefinition> detailDefinitions(const QString& contactType, QContactManager::Error* error) const; |
164 bool saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType, QContactManager::Error& error); |
182 /*! \reimp */ |
165 bool removeDetailDefinition(const QString& definitionId, const QString& contactType, QContactManager::Error& error); |
183 virtual QContactDetailDefinition detailDefinition(const QString& definitionId, const QString& contactType, QContactManager::Error* error) const |
|
184 { |
|
185 return QContactManagerEngine::detailDefinition(definitionId, contactType, error); |
|
186 } |
|
187 virtual bool saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType, QContactManager::Error* error); |
|
188 virtual bool removeDetailDefinition(const QString& definitionId, const QString& contactType, QContactManager::Error* error); |
166 |
189 |
167 /* Asynchronous Request Support */ |
190 /* Asynchronous Request Support */ |
168 void requestDestroyed(QContactAbstractRequest* req); |
191 virtual void requestDestroyed(QContactAbstractRequest* req); |
169 bool startRequest(QContactAbstractRequest* req); |
192 virtual bool startRequest(QContactAbstractRequest* req); |
170 bool cancelRequest(QContactAbstractRequest* req); |
193 virtual bool cancelRequest(QContactAbstractRequest* req); |
171 bool waitForRequestProgress(QContactAbstractRequest* req, int msecs); |
194 virtual bool waitForRequestFinished(QContactAbstractRequest* req, int msecs); |
172 bool waitForRequestFinished(QContactAbstractRequest* req, int msecs); |
|
173 |
195 |
174 /* Capabilities reporting */ |
196 /* Capabilities reporting */ |
175 bool hasFeature(QContactManager::ManagerFeature feature, const QString& contactType) const; |
197 virtual bool hasFeature(QContactManager::ManagerFeature feature, const QString& contactType) const; |
176 QStringList supportedRelationshipTypes(const QString& contactType) const; |
198 virtual bool isRelationshipTypeSupported(const QString& relationshipType, const QString& contactType) const; |
177 bool filterSupported(const QContactFilter& filter) const; |
199 virtual bool isFilterSupported(const QContactFilter& filter) const; |
178 QList<QVariant::Type> supportedDataTypes() const; |
200 virtual QList<QVariant::Type> supportedDataTypes() const; |
179 |
201 /*! \reimp */ |
180 /* Version Reporting */ |
202 virtual QStringList supportedContactTypes() const |
181 int implementationVersion() const; |
203 { |
|
204 return QContactManagerEngine::supportedContactTypes(); |
|
205 } |
182 |
206 |
183 protected: |
207 protected: |
184 QContactMemoryEngine(const QMap<QString, QString>& parameters); |
208 QContactMemoryEngine(QContactMemoryEngineData* data); |
185 |
|
186 private slots: |
|
187 void performAsynchronousOperation(); |
|
188 |
209 |
189 private: |
210 private: |
190 /* Implement "signal coalescing" for batch functions via change set */ |
211 /* Implement "signal coalescing" for batch functions via change set */ |
191 bool saveContact(QContact* theContact, QContactChangeSet& changeSet, QContactManager::Error& error); |
212 bool saveContact(QContact* theContact, QContactChangeSet& changeSet, QContactManager::Error* error); |
192 bool removeContact(const QContactLocalId& contactId, QContactChangeSet& changeSet, QContactManager::Error& error); |
213 bool removeContact(const QContactLocalId& contactId, QContactChangeSet& changeSet, QContactManager::Error* error); |
193 bool saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType, QContactChangeSet& changeSet, QContactManager::Error& error); |
214 bool saveDetailDefinition(const QContactDetailDefinition& def, const QString& contactType, QContactChangeSet& changeSet, QContactManager::Error* error); |
194 bool removeDetailDefinition(const QString& definitionId, const QString& contactType, QContactChangeSet& changeSet, QContactManager::Error& error); |
215 bool removeDetailDefinition(const QString& definitionId, const QString& contactType, QContactChangeSet& changeSet, QContactManager::Error* error); |
195 bool saveRelationship(QContactRelationship* relationship, QContactChangeSet& changeSet, QContactManager::Error& error); |
216 bool saveRelationship(QContactRelationship* relationship, QContactChangeSet& changeSet, QContactManager::Error* error); |
196 bool removeRelationship(const QContactRelationship& relationship, QContactChangeSet& changeSet, QContactManager::Error& error); |
217 bool removeRelationship(const QContactRelationship& relationship, QContactChangeSet& changeSet, QContactManager::Error* error); |
|
218 |
|
219 void performAsynchronousOperation(QContactAbstractRequest* request); |
197 |
220 |
198 QContactMemoryEngineData* d; |
221 QContactMemoryEngineData* d; |
199 static QMap<QString, QContactMemoryEngine*> engines; |
222 static QMap<QString, QContactMemoryEngineData*> engineDatas; |
200 }; |
223 }; |
201 |
224 |
202 QTM_END_NAMESPACE |
225 QTM_END_NAMESPACE |
203 |
226 |
204 #endif |
227 #endif |