summaryrefslogtreecommitdiffstats
path: root/libtdepim/komposer/core/tests/testmanager.cpp
blob: a690c67c63aca9429343c15364600d81ad0be8b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "testmanager.h"
#include "testmanager.moc"

#include "pluginmanager.h"
#include "plugin.h"

#include <kplugininfo.h>
#include <tdecmdlineargs.h>
#include <tdeapplication.h>
#include <kdebug.h>

using namespace Komposer;

TestManager::TestManager( TQObject *parent )
  : TQObject( parent )
{
  m_manager = new PluginManager( this );
  connect( m_manager, TQT_SIGNAL(pluginLoaded(Plugin*)),
           TQT_SLOT(slotPluginLoaded(Plugin*)) );
  connect( m_manager, TQT_SIGNAL(allPluginsLoaded()),
           TQT_SLOT(slotAllPluginsLoaded()) );
  m_manager->loadAllPlugins();

  TQValueList<KPluginInfo*> plugins = m_manager->availablePlugins();
  kdDebug()<<"Number of available plugins is "<< plugins.count() <<endl;
  for ( TQValueList<KPluginInfo*>::iterator it = plugins.begin(); it != plugins.end(); ++it ) {
    KPluginInfo *i = ( *it );
    kdDebug()<<"\tAvailable plugin "<< i->name()
             <<", comment = "<< i->comment() <<endl;
  }
}

void TestManager::slotAllPluginsLoaded()
{
  kdDebug()<<"Done"<<endl;
  m_manager->shutdown();
  tqApp->exit();
}

void TestManager::slotPluginLoaded( Plugin *plugin )
{
  kdDebug()<<"A plugin "<< m_manager->pluginName( plugin ) << " has been loaded"<<endl;
}

int main( int argc, char **argv )
{
  TDECmdLineArgs::init( argc, argv, "test", "test", "test", "0.1" );
  TDEApplication app;

  TestManager manager( &app );

  return app.exec();
}