QtContacts: "database" property specifies address book

The value is a QtContacts URI for an address book, composed of
qtcontacts:<backend>:<URL encoded parameters>

Example values for "database":
qtcontacts:tracker:
qtcontacts:eds:source=local:/system
This commit is contained in:
Patrick Ohly 2011-03-22 15:14:51 +01:00
parent 40dd80d25f
commit 377112b99d
2 changed files with 16 additions and 2 deletions

View file

@ -25,6 +25,7 @@
#include "QtContactsSource.h" #include "QtContactsSource.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug>
#include <QContact> #include <QContact>
#include <QContactManager> #include <QContactManager>
@ -386,7 +387,12 @@ QtContactsSource::~QtContactsSource()
void QtContactsSource::open() void QtContactsSource::open()
{ {
m_data = new QtContactsData(this, NULL); QString buffer;
QDebug(&buffer) << "available managers (default one first): " << QContactManager::availableManagers();
SE_LOG_DEBUG(NULL, NULL, buffer.toUtf8().data());
string id = getDatabaseID();
m_data = new QtContactsData(this, id.c_str());
cxxptr<QContactManager> manager(QContactManager::fromUri(m_data->m_managerURI), cxxptr<QContactManager> manager(QContactManager::fromUri(m_data->m_managerURI),
"QTContactManager"); "QTContactManager");
if (manager->error()) { if (manager->error()) {
@ -394,6 +400,11 @@ void QtContactsSource::open()
m_data->m_managerURI.toLocal8Bit().constData(), m_data->m_managerURI.toLocal8Bit().constData(),
manager->error())); manager->error()));
} }
buffer = "";
QDebug(&buffer) << manager->managerUri() << " manager supports contact types: " << manager->supportedContactTypes() <<
" and data types: " << manager->supportedDataTypes();
SE_LOG_DEBUG(NULL, NULL, buffer.toUtf8().data());
m_data->m_manager = manager; m_data->m_manager = manager;
} }

View file

@ -58,7 +58,10 @@ static RegisterSyncSource registerMe("QtContacts",
#endif #endif
createSource, createSource,
"QtContacts = addressbook = contacts = qt-contacts\n" "QtContacts = addressbook = contacts = qt-contacts\n"
" vCard 3.0 = text/vcard\n", " vCard 3.0 = text/vcard\n"
" 'database' is specified via a QtContacts URI, which\n"
" consists of qtcontacts:<backend>:<URL encoded parameters>.\n"
" Examples: 'qtcontacts:tracker:' or 'qtcontacts:eds:source=local:/system'\n",
Values() + Values() +
(Aliases("QtContacts") + "qt-contacts")); (Aliases("QtContacts") + "qt-contacts"));