KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.8KB

  1. /*
  2. * Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
  3. * Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. */
  19. #include <tqstring.h>
  20. #include <tqptrlist.h>
  21. #include <tdeaction.h>
  22. #include <kdebug.h>
  23. #include <tdelocale.h>
  24. #include <tdeparts/plugin.h>
  25. #include <kservice.h>
  26. #include <ktrader.h>
  27. #include <tdeparts/componentfactory.h>
  28. #include "kis_debug_areas.h"
  29. #include <math.h>
  30. #include "kis_types.h"
  31. #include "kis_filter_registry.h"
  32. #include "kis_paint_device.h"
  33. #include "kis_filter.h"
  34. KisFilterRegistry *KisFilterRegistry::m_singleton = 0;
  35. KisFilterRegistry::KisFilterRegistry()
  36. {
  37. Q_ASSERT(KisFilterRegistry::m_singleton == 0);
  38. KisFilterRegistry::m_singleton = this;
  39. TDETrader::OfferList offers = TDETrader::self()->query(TQString::fromLatin1("Chalk/Filter"),
  40. TQString::fromLatin1("(Type == 'Service') and "
  41. "([X-Chalk-Version] == 2)"));
  42. TDETrader::OfferList::ConstIterator iter;
  43. for(iter = offers.begin(); iter != offers.end(); ++iter)
  44. {
  45. KService::Ptr service = *iter;
  46. int errCode = 0;
  47. KParts::Plugin* plugin =
  48. KParts::ComponentFactory::createInstanceFromService<KParts::Plugin> ( service, this, 0, TQStringList(), &errCode);
  49. if ( plugin )
  50. kdDebug(DBG_AREA_PLUGINS) << "found plugin " << service->property("Name").toString() << "\n";
  51. else {
  52. kdDebug(41006) << "found plugin " << service->property("Name").toString() << ", " << errCode << "\n";
  53. if( errCode == KParts::ComponentFactory::ErrNoLibrary)
  54. {
  55. kdWarning(41006) << " Error loading plugin was : ErrNoLibrary " << KLibLoader::self()->lastErrorMessage() << endl;
  56. }
  57. }
  58. }
  59. }
  60. KisFilterRegistry::~KisFilterRegistry()
  61. {
  62. }
  63. KisFilterRegistry* KisFilterRegistry::instance()
  64. {
  65. if(KisFilterRegistry::m_singleton == 0)
  66. {
  67. KisFilterRegistry::m_singleton = new KisFilterRegistry();
  68. }
  69. return KisFilterRegistry::m_singleton;
  70. }
  71. #include "kis_filter_registry.moc"