fixed plugin loading

Conflicts:
	src/core/plugins/plugins.cpp
	src/core/plugins/plugins.h
This commit is contained in:
Patrick von Reth 2014-02-15 19:42:57 +01:00
parent 58f95602ce
commit 8522a1fd4f
3 changed files with 52 additions and 23 deletions

View File

@ -118,6 +118,26 @@ SnoreSecondaryBackend::~SnoreSecondaryBackend()
snoreDebug( SNORE_DEBUG )<<"Deleting"<<name();
}
bool SnoreSecondaryBackend::initialize(SnoreCore *snore)
{
if(!SnorePlugin::initialize(snore))
{
return false;
}
connect( snore->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
return true;
}
bool SnoreSecondaryBackend::deinitialize()
{
if(SnorePlugin::deinitialize())
{
disconnect( snore()->d(), SIGNAL(notify(Snore::Notification)), this, SLOT(slotNotify(Snore::Notification)));
return true;
}
return false;
}
bool SnoreSecondaryBackend::supportsRichtext()
{
return m_supportsRichtext;

View File

@ -92,6 +92,8 @@ class SNORE_EXPORT SnoreSecondaryBackend : public SnorePlugin
public:
SnoreSecondaryBackend(const QString &name, bool supportsRhichtext);
virtual ~SnoreSecondaryBackend();
virtual bool initialize(SnoreCore *snore);
virtual bool deinitialize();
bool supportsRichtext();

View File

@ -55,7 +55,11 @@ SnoreCore::~SnoreCore()
void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
{
Q_D(SnoreCore);
foreach( PluginContainer *info, PluginContainer::pluginCache(types).values())
foreach( SnorePlugin::PluginTypes type, PluginContainer::types())
{
if(type!= SnorePlugin::ALL && types && type)
{
foreach( PluginContainer *info, PluginContainer::pluginCache(type).values())
{
switch(info->type())
{
@ -77,10 +81,13 @@ void SnoreCore::loadPlugins( SnorePlugin::PluginTypes types )
snoreDebug( SNORE_DEBUG ) << info->name() << "is a" << info->type();
d->m_plugins[info->type()].append(info->name());
}
foreach( SnorePlugin::PluginTypes type, PluginContainer::types())
if(d->m_plugins.contains(type))
{
qSort(d->m_plugins[type]);
}
}
}
snoreDebug( SNORE_INFO ) << "Loaded Plugins:" << d->m_plugins;
}