mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-10 09:49:33 +00:00
ability to specify provider to isSupported, also added QCA::findProvider()
svn path=/trunk/kdesupport/qca/; revision=405506
This commit is contained in:
parent
55997c30ba
commit
2cc707f493
@ -169,14 +169,14 @@ namespace QCA
|
||||
* are present.
|
||||
*
|
||||
*/
|
||||
QCA_EXPORT bool isSupported(const char *features);
|
||||
QCA_EXPORT bool isSupported(const char *features, const QString &provider = QString());
|
||||
|
||||
/**
|
||||
* \overload
|
||||
*
|
||||
* \param features a list of features to test for
|
||||
*/
|
||||
QCA_EXPORT bool isSupported(const QStringList &features);
|
||||
QCA_EXPORT bool isSupported(const QStringList &features, const QString &provider = QString());
|
||||
|
||||
/**
|
||||
* Generate a list of all the supported features in plugins,
|
||||
@ -293,6 +293,11 @@ namespace QCA
|
||||
*/
|
||||
QCA_EXPORT ProviderList providers();
|
||||
|
||||
/**
|
||||
* Return the named provider, or 0 if not found
|
||||
*/
|
||||
QCA_EXPORT Provider *findProvider(const QString &name);
|
||||
|
||||
/**
|
||||
* Return the default provider
|
||||
*/
|
||||
|
@ -131,28 +131,45 @@ bool haveSecureMemory()
|
||||
return global->secmem;
|
||||
}
|
||||
|
||||
bool isSupported(const QStringList &features)
|
||||
bool isSupported(const QStringList &features, const QString &provider)
|
||||
{
|
||||
if(!global)
|
||||
return false;
|
||||
|
||||
QMutexLocker lock(&global->manager_mutex);
|
||||
|
||||
if(features_have(global->manager.allFeatures(), features))
|
||||
return true;
|
||||
// single
|
||||
if(!provider.isEmpty())
|
||||
{
|
||||
Provider *p = global->manager.find(provider);
|
||||
if(!p)
|
||||
{
|
||||
// ok, try scanning for new stuff
|
||||
global->manager.scan();
|
||||
p = global->manager.find(provider);
|
||||
}
|
||||
|
||||
// ok, try scanning for new stuff
|
||||
global->manager.scan();
|
||||
if(p && features_have(p->features(), features))
|
||||
return true;
|
||||
}
|
||||
// all
|
||||
else
|
||||
{
|
||||
if(features_have(global->manager.allFeatures(), features))
|
||||
return true;
|
||||
|
||||
if(features_have(global->manager.allFeatures(), features))
|
||||
return true;
|
||||
// ok, try scanning for new stuff
|
||||
global->manager.scan();
|
||||
|
||||
if(features_have(global->manager.allFeatures(), features))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSupported(const char *features)
|
||||
bool isSupported(const char *features, const QString &provider)
|
||||
{
|
||||
return isSupported(QString(features).split(',', QString::SkipEmptyParts));
|
||||
return isSupported(QString(features).split(',', QString::SkipEmptyParts), provider);
|
||||
}
|
||||
|
||||
QStringList supportedFeatures()
|
||||
@ -213,8 +230,17 @@ ProviderList providers()
|
||||
return global->manager.providers();
|
||||
}
|
||||
|
||||
Provider *findProvider(const QString &name)
|
||||
{
|
||||
QMutexLocker lock(&global->manager_mutex);
|
||||
|
||||
return global->manager.find(name);
|
||||
}
|
||||
|
||||
Provider *defaultProvider()
|
||||
{
|
||||
QMutexLocker lock(&global->manager_mutex);
|
||||
|
||||
return global->manager.find("default");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user