/***************************************************************************
 *   Copyright (C) 2004 by Trenton Carr                                    *
 *   trenton.carr@gmail.com						   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.             *
 ***************************************************************************/
 
#include "kmathtool_part.h"
#include "startwidgetview.h"

#include <kcomponentdata.h>

KMathToolPart::KMathToolPart( QWidget *parentWidget, const char *widgetName,
                              QObject *parent, const char *name )
    : KParts::ReadOnlyPart(parent, name)
{
  // we need an instance
  setInstance( KMathToolPartFactory::instance() );

  m_kmstart = new StartWidgetView(parentWidget,widgetName);
  
  m_kmstart->show();

  setWidget( m_kmstart );

  setXMLFile("kmathtool_part.rc");
}

KMathToolPart::~KMathToolPart()
{}

bool KMathToolPart::openFile()
{
  return false;
}


// It's usually safe to leave the factory code alone.. with the
// notable exception of the KAboutData data
#include <kaboutdata.h>
#include <klocale.h>

KInstance*  KMathToolPartFactory::s_instance = 0L;
KAboutData* KMathToolPartFactory::s_about = 0L;

KMathToolPartFactory::KMathToolPartFactory()
    : KParts::Factory()
{}

KMathToolPartFactory::~KMathToolPartFactory()
{
  delete s_instance;
  delete s_about;

  s_instance = 0L;
}

KParts::Part* KMathToolPartFactory::createPartObject( QWidget *parentWidget, const char *widgetName,
    QObject *parent, const char *name,
    const char *classname, const QStringList &args )
{
  // Create an instance of our Part
  KMathToolPart* obj = new KMathToolPart( parentWidget, widgetName, parent, name );
  return obj;
}

KInstance* KMathToolPartFactory::instance()
{
  if( !s_instance )
  {
    s_about = new KAboutData("kmathtoolpart", I18N_NOOP("KMathToolPart"), "0.3");
    s_about->addAuthor("Trenton Carr", 0, "trentoncarr@telkomsa.net");
    s_instance = new KInstance(s_about);
  }
  return s_instance;
}


K_EXPORT_COMPONENT_FACTORY( libkmathtoolpart, KMathToolPartFactory )

#include "kmathtool_part.moc"
