Commit 67229cbb authored by Christian Loose's avatar Christian Loose

use KGenericFactory

svn path=/trunk/kdesdk/cervisia/; revision=168601
parent ba0a9153
......@@ -54,63 +54,11 @@
#define COMMIT_SPLIT_CHAR '\r'
extern "C"
{
/**
* This function is the 'main' function of this part. It takes
* the form 'void *init_lib<library name>() It always returns a
* new factory object
*/
void *init_libcervisia()
{
return new CervisiaFactory;
}
};
KInstance *CervisiaFactory::s_instance = 0L;
K_EXPORT_COMPONENT_FACTORY( libcervisia, CervisiaFactory );
CervisiaFactory::CervisiaFactory()
{
// Nothing to do
}
CervisiaFactory::~CervisiaFactory()
{
if ( s_instance ) {
delete s_instance->aboutData();
delete s_instance;
}
s_instance = 0;
}
KParts::Part *CervisiaFactory::createPartObject( QWidget *parentWidget, const char *widgetName,
QObject* parent, const char* name,
const char * /*classname*/,
const QStringList & /*args*/ )
{
KParts::Part *obj = new CervisiaPart( parentWidget, widgetName, parent, name );
return obj;
}
KInstance *CervisiaFactory::instance()
{
if ( !s_instance )
s_instance = new KInstance( aboutData() );
return s_instance;
}
KAboutData *CervisiaFactory::aboutData()
{
return new KAboutData( "cervisiapart", I18N_NOOP("Cervisia"),
CERVISIA_VERSION,
I18N_NOOP("A CVS frontend"),
KAboutData::License_QPL,
I18N_NOOP("Copyright (c) 1999-2002 Bernd Gehrmann"));
}
CervisiaPart::CervisiaPart( QWidget *parentWidget, const char *widgetName,
QObject *parent, const char *name )
QObject *parent, const char *name, const QStringList& args )
: KParts::ReadOnlyPart( parent, name )
, hasRunningJob( false )
, opt_hideFiles( false )
......@@ -618,6 +566,16 @@ void CervisiaPart::aboutCervisia()
}
KAboutData* CervisiaPart::createAboutData()
{
return new KAboutData( "cervisiapart", I18N_NOOP("Cervisia"),
CERVISIA_VERSION,
I18N_NOOP("A CVS frontend"),
KAboutData::License_QPL,
I18N_NOOP("Copyright (c) 1999-2002 Bernd Gehrmann"));
}
void CervisiaPart::slotOpenSandbox()
{
QString dirname = KFileDialog::getExistingDirectory(QDir::homeDirPath(), widget(),
......
......@@ -17,7 +17,7 @@
#include <kparts/part.h>
#include <kparts/browserextension.h>
#include <kparts/factory.h>
#include <kparts/genericfactory.h>
#include "commitdlg.h"
#include "checkoutdlg.h"
......@@ -32,29 +32,6 @@ class ProtocolView;
class KAboutData;
class KRecentFilesAction;
/**
* Factory for instantiating CervisiaParts.
*/
class CervisiaFactory : public KParts::Factory
{
Q_OBJECT
public:
CervisiaFactory();
virtual ~CervisiaFactory();
virtual KParts::Part *createPartObject( QWidget *parentWidget, const char *widgetName,
QObject* parent = 0, const char* name = 0,
const char* classname = "QObject",
const QStringList &args = QStringList() );
static KInstance *instance();
static KAboutData *aboutData();
private:
static KInstance *s_instance;
};
/**
* An embeddable Cervisia viewer.
......@@ -65,7 +42,7 @@ class CervisiaPart : public KParts::ReadOnlyPart
public:
CervisiaPart( QWidget *parentWidget, const char *widgetName,
QObject *parent, const char *name=0 );
QObject *parent, const char *name=0, const QStringList& args = QStringList());
virtual ~CervisiaPart();
/**
......@@ -80,6 +57,8 @@ public:
void readDialogProperties( KConfig *config );
void saveDialogProperties( KConfig *config );
static KAboutData* createAboutData();
public slots:
virtual bool openFile() { return true; }
......@@ -180,6 +159,8 @@ private:
KRecentFilesAction *recent;
};
typedef KParts::GenericFactory<CervisiaPart> CervisiaFactory;
/**
* A mysterious class, needed to make Konqueror intrgration work.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment