Example #1
0
/*!
  Given an application binary name \a bin return the QContentId of the QContent record
  for that application.  If \a bin is the fully qualified path of an ordinary file the
  QContentId of that file will be returned.

  If \a bin does not refer to any application or file in the backing store then an
  InvalidId will be returned.

  Note that binary names are unique across Qtopia.
 */
QContentId QContent::execToContent( const QString& bin )
{
    QContent content = QContentStore::instance()->contentFromFileName( bin, QContentStore::Lookup );

    if( !content.isNull() )
        return content.id();
    else
        return QContent::InvalidId;
}
Example #2
0
QContent QDocumentServerContentStore::contentFromId( QContentId contentId )
{
    if( contentId == QContent::InvalidId )
        return QContent();

    QContent content = QContentCache::instance()->lookup( contentId );

    if( content.isNull() )
    {
        QDocumentServerMessage response = d->callWithArgumentList( "contentFromId(QContentId)",
                                          QVariantList() << QVariant::fromValue( contentId ) );

        if( response.type() == QDocumentServerMessage::ReplyMessage )
        {
            Q_ASSERT( response.arguments().count() == 1 );

            content = qvariant_cast< QContent >( response.arguments().first() );

            QContentCache::instance()->cache( content );
        }
    }

    return content;
}