/***************************************************************************
 *   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 "kmathfactor_part.h"

#include <kcomponentdata.h>
#include <klocale.h>

#include "factors.h"

KMathFactorPart::KMathFactorPart( QWidget *parentWidget, const char *widgetName,
                                  QObject *parent, const char *name )
    : KMathBasePart(parentWidget, widgetName, parent, name)
{

    setInstance( KMathFactorPartFactory::instance() );

    m_widget = new Factors( parentWidget, widgetName );

    setWidget(m_widget);

    setXMLFile("kmathfactor_part.rc");
}

// 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*  KMathFactorPartFactory::s_instance = 0L;
KAboutData* KMathFactorPartFactory::s_about = 0L;

KMathFactorPartFactory::KMathFactorPartFactory()
    : KParts::Factory()
{
}

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

    s_instance = 0L;
}

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

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

K_EXPORT_COMPONENT_FACTORY( libkmathfactorpart, KMathFactorPartFactory )

#include "kmathfactor_part.moc"
