diff options
| author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
|---|---|---|
| committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
| commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
| tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kugar/part/kugar_factory.cpp | |
| download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip | |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kugar/part/kugar_factory.cpp')
| -rw-r--r-- | kugar/part/kugar_factory.cpp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/kugar/part/kugar_factory.cpp b/kugar/part/kugar_factory.cpp new file mode 100644 index 000000000..19db5a964 --- /dev/null +++ b/kugar/part/kugar_factory.cpp @@ -0,0 +1,92 @@ +// Copyright (c) 2000 Phil Thompson <phil@river-bank.demon.co.uk> +// +// This file contains the implementation of the Kugar KPart. + + +#include <klocale.h> +#include <kstandarddirs.h> +#include <kinstance.h> +#include <kaboutdata.h> +#include <kglobal.h> +#include <kiconloader.h> + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include "kugar_factory.h" +#include "kugar_part.h" +#include "kugar_about.h" + +KInstance *KugarFactory::s_instance = 0L; +KAboutData *KugarFactory::s_aboutdata = 0L; + + +// The part's entry point. + +K_EXPORT_COMPONENT_FACTORY( libkugarpart, KugarFactory ) + + +// The factory ctor. + +KugarFactory::KugarFactory( QObject *parent, const char* name ) : KoFactory( parent, name ) +{ + global(); +} + +KInstance* KugarFactory::global() +{ + if ( !s_instance ) + { + s_instance = new KInstance( aboutData() ); + s_instance->iconLoader() ->addAppDir( "koffice" ); + s_instance->iconLoader() ->addAppDir( "kugar" ); + + } + return s_instance; +} + +// The factory dtor. + +KugarFactory::~KugarFactory() +{ + delete s_instance; + s_instance = 0; + delete s_aboutdata; + s_aboutdata = 0; +} + +KAboutData *KugarFactory::aboutData() +{ + if ( !s_aboutdata ) + s_aboutdata = newKugarAboutData(); + return s_aboutdata; +} + +// Create a new part. + +KParts::Part* KugarFactory::createPartObject( QWidget *parentWidget, const char *widgetName, + QObject* parent, const char* name, const char* classname, const QStringList & data ) +{ + QString forcedUserTemplate; + for ( QStringList::const_iterator it = data.begin();it != data.end();++it ) + { + QString tmp = ( *it ); + if ( tmp.startsWith( "template=" ) ) + forcedUserTemplate = tmp.right( tmp.length() - 9 ); + } + + bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 ); + // parentWidget and widgetName are used by KoDocument for the "readonly+singleView" case. + KugarPart *part = new KugarPart( parentWidget, widgetName, parent, name, !bWantKoDocument ); + + // if ( !bWantKoDocument ) + part->setReadWrite( false ); + + part->setForcedUserTemplate( forcedUserTemplate ); + return part; + //return ( new KugarPart(parentWidget,name,forcedUserTemplate)); +} + + +#include "kugar_factory.moc" |
