
class ModelWatcher : public QObject
{
  Q_OBJECT
public:
  ModelWatcher(QObject *parent)
      : QObject(parent)
  {
  }

  void setWatchedModel(QAbstractItemModel *model)
  {
    m_model = model;
    setWatch(true);
  }

  void setWatch(bool watch)
  {
    Q_ASSERT(m_model);
    if (watch)
      connect(m_model, SIGNAL(rowsInserted(const QModelIndex &, int, int),
            SLOT(rowsInserted(const QModelIndex &, int, int))));
    else
      disconnect(m_model, SIGNAL(rowsInserted(const QModelIndex &, int, int),
            SLOT(rowsInserted(const QModelIndex &, int, int))));
  }

  void setWatchedItem(Item::Id itemId)
  {
    m_itemId = itemId;
  }

  void setWatchedCollection( Collection::Id colId )
  {
    m_colId = colId;
  }

signals:
  void newItem(const QModelIndex &idx);

public slots:
  void rowsInserted(QModelIndex &parent, int start, int end)
  {
    if (parent.data(EntityTreeModel::CollectionIdRole).toULongLong() != m_colId)
      return;

    const int column = 0;
    for (int row = start; row < end; ++row)
    {
      QModelIndex idx = m_model->index(row, column, parent);
      if (idx.data(EntityTreeModel::ItemIdRole).toULongLong() != m_itemId)
        continue;

      emit newItem(idx);

      // stop watching the model.
      setWatch(false);
    }
  }

private:
  Collection::Id m_colId;
  Item::Id m_itemId;
  QAbstractItemModel *m_model;
};

...

  Item newItem;
  newItem.setMimetype(bookmarkMimetype);
  newItem.setPayload(bookmark);

  ItemCreateJob *job = new ItemCreateJob(newItem, myCollection);

  ModelWatcher *mw = new ModelWatcher(this);
  mw->setModel(bookmarksModel);
  mw->setWatchedCollection(myCollection.id());
  connect(mw, SIGNAL(newItem(const QModelIndex &)), view, SLOT(select(const QModelIndex &)));

  if (job->exec())
  {
    mw->setWatchedItem(job.item().id());
  }


