/*!
    Sets \a iface to point to the implementation of the
    QAccessibleInterface for \a object, and returns \c QS_OK if
    successfull, or sets \a iface to 0 and returns \c QE_NOCOMPONENT if
    no accessibility implementation for \a object exists.

    The function uses the \link QObject::className() classname
    \endlink of \a object to find a suitable implementation. If no
    implementation for the object's class is available the function
    tries to find an implementation for the object's parent class.

    This function is called to answer an accessibility client's
    request for object information. You should never need to call this
    function yourself.
*/
QRESULT QAccessible::queryAccessibleInterface( QObject *object, QAccessibleInterface **iface )
{
    *iface = 0;
    if ( !object )
	return QE_INVALIDARG;

    if ( qAccessibleInterface ) {
	*iface = qAccessibleInterface->find( object );
	if ( *iface ) {
	    (*iface)->addRef();
	    return QS_OK;
	}
    }

    if ( !qAccessibleManager ) {
	qAccessibleManager = new QPluginManager<QAccessibleFactoryInterface>( IID_QAccessibleFactory, QApplication::libraryPaths(), "/accessible" );
	if ( !cleanupAdded ) {
	    qAddPostRoutine( qAccessibleCleanup );
	    cleanupAdded = TRUE;
	}
    }

    QInterfacePtr<QAccessibleFactoryInterface> factory = 0;
    QMetaObject *mo = object->metaObject();
    while ( mo ) {
	qAccessibleManager->queryInterface( mo->className(), &factory );
	if ( factory )
	    break;
	mo = mo->superClass();
    }
    if ( factory )
	return factory->createAccessibleInterface( mo->className(), object, iface );

    return QE_NOCOMPONENT;
}
示例#2
0
/*!
    Creates a AExtension object that matches \a key. This is either a
    built-in extensions, or a extension from a extension plugin.

    \sa keys()
*/
AExtension *AExtensionFactory::create( const QString& key )
{
    AExtension *ret = 0;
    QString extension = key; //key.lower();
#ifndef A_NO_EXTENSION_XXXX
    if ( extension == "XXXX" )
        ret = new AExtension(extension);
#endif

    { } // Keep these here - they make the #ifdefery above work

#ifndef QT_NO_COMPONENT
    if(!ret) {
	if ( !instance )
	    instance = new AExtensionFactoryPrivate;

	QInterfacePtr<AExtensionFactoryInterface> iface;
	AExtensionFactoryPrivate::manager->queryInterface( extension, &iface );

	if ( iface )
	    ret = iface->create( extension );
    }
    if(ret)
	ret->setName(key);
#endif
    return ret;
}
示例#3
0
void Project::updateCustomSettings()
{
    if ( !projectSettingsPluginManager )
	return;

/*
    ProjectSettingsInterface *iface = 0;
    projectSettingsPluginManager->queryInterface( lang, (QUnknownInterface**)&iface );
    if ( !iface )
	return;
    csList = iface->projectSettings();
    iface->release();
*/

    QInterfacePtr<ProjectSettingsInterface> iface;
    projectSettingsPluginManager->queryInterface( lang, &iface );
    if ( !iface )
	return;
    csList = iface->projectSettings();
    customSettings.clear();

}
示例#4
0
/*!
    Creates a QStyle object that matches \a key case-insensitively.
    This is either a built-in style, or a style from a style plugin.

    \sa keys()
*/
QStyle *QStyleFactory::create( const QString& key )
{
    QStyle *ret = 0;
    QString style = key.lower();
#ifndef QT_NO_STYLE_WINDOWS
    if ( style == "windows" )
        ret = new QWindowsStyle;
    else
#endif
#ifndef QT_NO_STYLE_WINDOWSXP
    if ( style == "windowsxp" )
	ret = new QWindowsXPStyle;
    else
#endif
#ifndef QT_NO_STYLE_MOTIF
    if ( style == "motif" )
        ret = new QMotifStyle;
    else
#endif
#ifndef QT_NO_STYLE_CDE
    if ( style == "cde" )
        ret = new QCDEStyle;
    else
#endif
#ifndef QT_NO_STYLE_MOTIFPLUS
    if ( style == "motifplus" )
        ret = new QMotifPlusStyle;
    else
#endif
#ifndef QT_NO_STYLE_PLATINUM
    if ( style == "platinum" )
        ret = new QPlatinumStyle;
    else
#endif
#ifndef QT_NO_STYLE_SGI
    if ( style == "sgi")
        ret = new QSGIStyle;
    else
#endif
#ifndef QT_NO_STYLE_COMPACT
    if ( style == "compact" )
        ret = new QCompactStyle;
    else
#endif
#ifndef QT_NO_STYLE_AQUA
    if ( style == "aqua" )
        ret = new QAquaStyle;
#endif
#ifndef QT_NO_STYLE_POCKETPC
    if ( style == "pocketpc" )
	ret = new QPocketPCStyle;
#endif
#if !defined( QT_NO_STYLE_MAC ) && defined( Q_WS_MAC )
    if( style.left(9) == "macintosh" )
	ret = new QMacStyle;
#endif
    { } // Keep these here - they make the #ifdefery above work

#ifndef QT_NO_COMPONENT
    if(!ret) {
	if ( !instance )
	    instance = new QStyleFactoryPrivate;

	QInterfacePtr<QStyleFactoryInterface> iface;
	QStyleFactoryPrivate::manager->queryInterface( style, &iface );

	if ( iface )
	    ret = iface->create( style );
    }
    if(ret)
	ret->setName(key);
#endif
    return ret;
}
示例#5
0
void QSqlDatabase::init( const QString& type, const QString& )
{
    d = new QSqlDatabasePrivate();
    d->drvName = type;

    if ( !d->driver ) {

#ifdef QT_SQL_POSTGRES
	if ( type == "QPSQL7" )
	    d->driver = new QPSQLDriver();
#endif

#ifdef QT_SQL_MYSQL
	if ( type == "QMYSQL3" )
	    d->driver = new QMYSQLDriver();
#endif

#ifdef QT_SQL_ODBC
	if ( type == "QODBC3" )
	    d->driver = new QODBCDriver();
#endif

#ifdef QT_SQL_OCI
	if ( type == "QOCI8" )
	    d->driver = new QOCIDriver();
#endif

#ifdef QT_SQL_TDS
	if ( type == "QTDS7" )
	    d->driver = new QTDSDriver();
#endif

#ifdef QT_SQL_DB2
	if ( type == "QDB2" )
	    d->driver = new QDB2Driver();
#endif

#ifdef QT_SQL_SQLITE
	if ( type == "QSQLITE" )
	    d->driver = new QSQLiteDriver();
#endif

#ifdef QT_SQL_IBASE
	if ( type == "QIBASE" )
	    d->driver = new QIBaseDriver();
#endif

    }

    if ( !d->driver ) {
	QDictIterator<QSqlDriverCreatorBase> it( *QSqlDatabaseManager::driverDict() );
	while ( it.current() && !d->driver ) {
	    if ( type == it.currentKey() ) {
		d->driver = it.current()->createObject();
	    }
	    ++it;
	}
    }

#ifndef QT_NO_COMPONENT
    if ( !d->driver ) {
	d->plugIns =
	    new QPluginManager<QSqlDriverFactoryInterface>( IID_QSqlDriverFactory, QApplication::libraryPaths(), "/sqldrivers" );

	QInterfacePtr<QSqlDriverFactoryInterface> iface = 0;
	d->plugIns->queryInterface( type, &iface );
	if( iface )
	    d->driver = iface->create( type );
    }
#endif

    if ( !d->driver ) {
#ifdef QT_CHECK_RANGE
	qWarning( "QSqlDatabase: %s driver not loaded", type.latin1() );
	qWarning( "QSqlDatabase: available drivers: %s", drivers().join(" ").latin1() );
#endif
	d->driver = new QNullDriver();
	d->driver->setLastError( QSqlError( "Driver not loaded", "Driver not loaded" ) );
    }
}