diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-06-19 15:58:54 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-06-19 23:26:02 -0700 |
commit | b3d51e2d73a1e7e0fbd3d7a1b8d203b3d15b81f2 (patch) | |
tree | e275243de387338746e67911795b4df7808d56c8 | |
parent | 9d896c9c8f5622370362091f38bbc5d1f4189901 (diff) |
libqtappfw: pbap: add import verb for contacts
To allow the switch from on every connection of updating the contact
info to per UI request of syncing.
This patchset adds the 'import' verb call. OBEX transfer are very slow
and ineffective for redundant data.
Also max_entries parameter is still left in for backwards compatiblity
but not used in the actual binding call.
Bug-AGL: SPEC-2541
Change-Id: I94e43b1fb5f6eeae3efde7d14ce7c3816cebe0ad
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r-- | pbap/pbap.cpp | 15 | ||||
-rw-r--r-- | pbap/pbap.h | 1 | ||||
-rw-r--r-- | pbap/pbapmessage.h | 1 |
3 files changed, 13 insertions, 4 deletions
diff --git a/pbap/pbap.cpp b/pbap/pbap.cpp index bdd2bd9..53b646b 100644 --- a/pbap/pbap.cpp +++ b/pbap/pbap.cpp @@ -98,13 +98,20 @@ Pbap::~Pbap() delete m_mloop; } -void Pbap::refreshContacts(int max_entries) +void Pbap::importContacts(int max_entries) { PbapMessage *tmsg = new PbapMessage(); QJsonObject parameter; - if (max_entries >= 0) - parameter.insert("max_entries", max_entries); + tmsg->createRequest("import", parameter); + m_mloop->sendMessage(tmsg); + delete tmsg; +} + +void Pbap::refreshContacts(int max_entries) +{ + PbapMessage *tmsg = new PbapMessage(); + QJsonObject parameter; tmsg->createRequest("contacts", parameter); m_mloop->sendMessage(tmsg); @@ -285,7 +292,7 @@ void Pbap::onMessageReceived(MessageType type, Message *msg) } else if (msg->isReply() && type == ResponseRequestMessage) { ResponseMessage *tmsg = qobject_cast<ResponseMessage*>(msg); - if (tmsg->requestVerb() == "contacts") { + if (tmsg->requestVerb() == "contacts") || tmsg->requestVerb() == "import") { updateContacts(tmsg->replyData().value("vcards").toArray()); } else if (tmsg->requestVerb() == "history") { updateCalls(tmsg->replyData().value("vcards").toArray()); diff --git a/pbap/pbap.h b/pbap/pbap.h index 4d49521..4859343 100644 --- a/pbap/pbap.h +++ b/pbap/pbap.h @@ -146,6 +146,7 @@ class Pbap : public QObject explicit Pbap(QUrl &url, QQmlContext *context, QObject * parent = Q_NULLPTR); virtual ~Pbap(); + Q_INVOKABLE void importContacts(int max_entries); Q_INVOKABLE void refreshContacts(int max_entries); Q_INVOKABLE void refreshCalls(int max_entries); Q_INVOKABLE void search(QString number); diff --git a/pbap/pbapmessage.h b/pbap/pbapmessage.h index 65751cb..502879b 100644 --- a/pbap/pbapmessage.h +++ b/pbap/pbapmessage.h @@ -29,6 +29,7 @@ class PbapMessage : public Message private: QStringList verbs { + "import", "contacts", "entry", "history", |