qtmobility/src/contacts/qcontactmanager.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
child 15 1f895d8a5b2b
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
   196     if (pManagerId)
   196     if (pManagerId)
   197         *pManagerId = managerName;
   197         *pManagerId = managerName;
   198     return true;
   198     return true;
   199 }
   199 }
   200 
   200 
   201 /*! Returns a URI that completely describes a manager implementation, datastore, and the parameters with which to instantiate the manager, from the given \a managerName, \a params and an optional \a implementationVersion */
   201 /*!
       
   202    Returns a URI that completely describes a manager implementation, datastore, and the parameters
       
   203    with which to instantiate the manager, from the given \a managerName, \a params and an optional
       
   204    \a implementationVersion.  This function is generally useful only if you intend to construct a
       
   205    manager with the \l fromUri() function, or wish to set the manager URI field in a QContactId
       
   206    manually (for synchronization or other purposes).  Most clients will not need to use this function. */
   202 QString QContactManager::buildUri(const QString& managerName, const QMap<QString, QString>& params, int implementationVersion) 
   207 QString QContactManager::buildUri(const QString& managerName, const QMap<QString, QString>& params, int implementationVersion) 
   203 {
   208 {
   204     QString ret(QLatin1String("qtcontacts:%1:%2"));
   209     QString ret(QLatin1String("qtcontacts:%1:%2"));
   205     // we have to escape each param
   210     // we have to escape each param
   206     QStringList escapedParams;
   211     QStringList escapedParams;
   225 
   230 
   226     return ret.arg(managerName, escapedParams.join(QLatin1String("&")));
   231     return ret.arg(managerName, escapedParams.join(QLatin1String("&")));
   227 }
   232 }
   228 
   233 
   229 /*!
   234 /*!
   230   Constructs a QContactManager whose implementation, store and parameters are specified in the given \a storeUri,
   235   Constructs a QContactManager whose implementation version, manager name and specific parameters
   231   and whose parent object is \a parent.
   236   are specified in the given \a managerUri, and whose parent object is \a parent.
   232  */
   237  */
   233 QContactManager* QContactManager::fromUri(const QString& storeUri, QObject* parent)
   238 QContactManager* QContactManager::fromUri(const QString& managerUri, QObject* parent)
   234 {
   239 {
   235     if (storeUri.isEmpty()) {
   240     if (managerUri.isEmpty()) {
   236         return new QContactManager(QString(), QMap<QString, QString>(), parent);
   241         return new QContactManager(QString(), QMap<QString, QString>(), parent);
   237     } else {
   242     } else {
   238         QString id;
   243         QString id;
   239         QMap<QString, QString> parameters;
   244         QMap<QString, QString> parameters;
   240         if (parseUri(storeUri, &id, &parameters)) {
   245         if (parseUri(managerUri, &id, &parameters)) {
   241             return new QContactManager(id, parameters, parent);
   246             return new QContactManager(id, parameters, parent);
   242         } else {
   247         } else {
   243             // invalid
   248             // invalid
   244             return new QContactManager(QLatin1String("invalid"), QMap<QString, QString>(), parent);
   249             return new QContactManager(QLatin1String("invalid"), QMap<QString, QString>(), parent);
   245         }
   250         }