Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-164

No easy way to detect a tag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 1.0.1
    • 1.0.0
    • Contacts
    • None
    • 7990abae52dd6271bcea13397b904e03740311bb

      It's fairly easy to set an individual tag:

      QContactTag tag;
      tag.setTag(MY_TAG_NAME);

      QContact contact = getTheContactFromSomewhere();
      contact.saveDetail(&tag);
      manager->saveContact(&contact);

      (Though this is not suggested in the QContact or QContactTag documentation, so it's hard to guess.)

      However, to discover if that tag exists, we need to get all tags and examine them all:

      foreach (const QContactTag& tag, contact.details<QContactTag>())
      {
      if(tag.tag() == MY_TAG_NAME)

      { doSomething(); break; }

      }

      And this is not even suggested in the QContacts or QContactTag documentation.

      In the end it's just a bool, so anything other than
      void QContact::setTag(const QString& name, bool set = true);
      and
      bool QContact::hasTag() const
      seems like architecture astronautism.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            mgoddard Michael Goddard (closed Nokia identity) (Inactive)
            murrayc Murray Cumming
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes