<commit_before>#include <qwidget.h>


#include <kmessagebox.h>
#include <kaction.h>
#include <kgenericfactory.h>
#include <kiconloader.h>
#include <kparts/componentfactory.h>

#include "kpcore.h"

#include "korganizer_plugin.h"
#include <kdebug.h>

typedef KGenericFactory< KOrganizerPlugin, Kontact::Core > KOrganizerPluginFactory;
K_EXPORT_COMPONENT_FACTORY( libkpkorganizerplugin,
                            KOrganizerPluginFactory( "kporganizerplugin" ) );

KOrganizerPlugin::KOrganizerPlugin(Kontact::Core *_core, const char *, const QStringList &)
  : Kontact::Plugin(i18n("Calendar"), "korganizer", _core, _core, "korganizer"), 
    m_part(0), m_iface(0)
{
  setInstance(KOrganizerPluginFactory::instance());

  setXMLFile("kpkorganizerplugin.rc");

  insertNewAction(  new KAction(  i18n(  "New Event" ), BarIcon(  "event" ),
			                0, this, SLOT( slotNewEvent() ), actionCollection(), "new_event" ) );

  insertNewAction(  new KAction(  i18n(  "New Todo" ), BarIcon(  "todo" ),
			                0, this, SLOT( slotNewTodo() ), actionCollection(), "new_todo" ) );

}


KOrganizerPlugin::~KOrganizerPlugin()
{
}

KParts::ReadOnlyPart* KOrganizerPlugin::part()
{
    if (!m_part) {
      (void) dcopClient(); // ensure that we register to DCOP as "korganizer"
      m_iface = new KOrganizerIface_stub(dcopClient(), "korganizer", "KOrganizerIface");

      m_part = KParts::ComponentFactory
       ::createPartInstanceFromLibrary<KParts::ReadOnlyPart>( "libkorganizer",
                                                                0, 0, // parentwidget,name
                                                               this, 0 ); // parent,name
    }

    return m_part;

}

void KOrganizerPlugin::slotNewEvent()
{
  part();
  if(!m_iface)
    return;
  m_iface->newEvent();
}

void KOrganizerPlugin::slotNewTodo()
{
  part();
  if(!m_iface)
    return;
  m_iface->newTodo();

}

bool KOrganizerPlugin::createDCOPInterface( const QString& serviceType )
{
  kdDebug(5602) << k_funcinfo << serviceType << endl;
  if ( serviceType == "DCOP/Organizer" || serviceType == "DCOP/Calendar" )
  {
    if ( part() )
      return true;
  }

  return false;
}

#include "korganizer_plugin.moc"<commit_msg>comment those out for now until I can commit the respective changes in korganizer<commit_after>#include <qwidget.h>


#include <kmessagebox.h>
#include <kaction.h>
#include <kgenericfactory.h>
#include <kiconloader.h>
#include <kparts/componentfactory.h>

#include "kpcore.h"

#include "korganizer_plugin.h"
#include <kdebug.h>

typedef KGenericFactory< KOrganizerPlugin, Kontact::Core > KOrganizerPluginFactory;
K_EXPORT_COMPONENT_FACTORY( libkpkorganizerplugin,
                            KOrganizerPluginFactory( "kporganizerplugin" ) );

KOrganizerPlugin::KOrganizerPlugin(Kontact::Core *_core, const char *, const QStringList &)
  : Kontact::Plugin(i18n("Calendar"), "korganizer", _core, _core, "korganizer"), 
    m_part(0), m_iface(0)
{
  setInstance(KOrganizerPluginFactory::instance());

  setXMLFile("kpkorganizerplugin.rc");

  insertNewAction(  new KAction(  i18n(  "New Event" ), BarIcon(  "event" ),
			                0, this, SLOT( slotNewEvent() ), actionCollection(), "new_event" ) );

  insertNewAction(  new KAction(  i18n(  "New Todo" ), BarIcon(  "todo" ),
			                0, this, SLOT( slotNewTodo() ), actionCollection(), "new_todo" ) );

}


KOrganizerPlugin::~KOrganizerPlugin()
{
}

KParts::ReadOnlyPart* KOrganizerPlugin::part()
{
    if (!m_part) {
      (void) dcopClient(); // ensure that we register to DCOP as "korganizer"
      m_iface = new KOrganizerIface_stub(dcopClient(), "korganizer", "KOrganizerIface");

      m_part = KParts::ComponentFactory
       ::createPartInstanceFromLibrary<KParts::ReadOnlyPart>( "libkorganizer",
                                                                0, 0, // parentwidget,name
                                                               this, 0 ); // parent,name
    }

    return m_part;

}

void KOrganizerPlugin::slotNewEvent()
{
  part();
  if(!m_iface)
    return;
 // m_iface->newEvent();
}

void KOrganizerPlugin::slotNewTodo()
{
  part();
  if(!//m_iface)
    return;
  //m_iface->newTodo();

}

bool KOrganizerPlugin::createDCOPInterface( const QString& serviceType )
{
  kdDebug(5602) << k_funcinfo << serviceType << endl;
  if ( serviceType == "DCOP/Organizer" || serviceType == "DCOP/Calendar" )
  {
    if ( part() )
      return true;
  }

  return false;
}

#include "korganizer_plugin.moc"
{'fraction_non_alphanumeric': 0.1352549889135255, 'fraction_numerical': 0.00753880266075388, 'mean_word_length': 3.2476459510357816, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2883396', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1497, 'n_words': 284}