kneditfactory.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "kneditfactory.h"
00020
00021 #include "document.h"
00022
00023 #include <klocale.h>
00024 #include <kinstance.h>
00025 #include <kaboutdata.h>
00026 #include <kstandarddirs.h>
00027
00028 #include <kdebug.h>
00029
00030 extern "C"
00031 {
00032 void *init_libkneditpart()
00033 {
00034 KGlobal::locale()->insertCatalogue("kneditpart");
00035 kdDebug() << "in init_libkneditpart" << endl;
00036 return new KNEditFactory();
00037 }
00038 }
00039
00040 KInstance *KNEditFactory::s_instance = 0;
00041
00042 KNEditFactory::KNEditFactory()
00043 {
00044 s_instance = 0;
00045 }
00046
00047 KNEditFactory::~KNEditFactory()
00048 {
00049 if ( s_instance )
00050 {
00051 delete s_instance->aboutData();
00052 delete s_instance;
00053 }
00054 s_instance = 0;
00055 }
00056
00057 KParts::Part *KNEditFactory::createPartObject( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *classname, const QStringList & )
00058 {
00059 bool bReadOnly = (classname == QString::fromLatin1("KParts::ReadOnlyPart") );
00060 bool bSingleView = (classname != QString::fromLatin1("KTextEditor::Document"));
00061
00062
00063 if ( KStandardDirs::findExe( "nc" ).isEmpty() )
00064 return 0;
00065
00066 KParts::ReadWritePart *part = new KNEdit::Document (bReadOnly, bSingleView, parentWidget, widgetName, parent, name);
00067 part->setReadWrite( !bReadOnly );
00068
00069 return part;
00070 }
00071
00072 KInstance *KNEditFactory::instance()
00073 {
00074 if ( !s_instance )
00075 s_instance = new KInstance( aboutData() );
00076 return s_instance;
00077 }
00078
00079 const KAboutData *KNEditFactory::aboutData()
00080 {
00081 KAboutData *data = new KAboutData ("knedit", I18N_NOOP("KNEdit"), "1.0",
00082 I18N_NOOP( "KNEdit - KDE wrapper for NEdit" ),
00083 KAboutData::License_LGPL_V2,
00084 I18N_NOOP( "(c) 2002" ), 0, "http://www.kde.org");
00085 data->addAuthor ("Cornelius Schumacher", I18N_NOOP("Initial version"), "cs@caldera.de");
00086 data->addAuthor ("Harald Fernengel", I18N_NOOP("Ported to KTextEditor"), "harry@kdevelop.org");
00087 data->addAuthor ("Christoph Cullmann", I18N_NOOP("A lot of help"), "cullmann@kde.org", "http://www.babylon2k.de");
00088
00089 data->setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"), I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));
00090
00091 return data;
00092 }
00093
00094 #include "kneditfactory.moc"
00095
This file is part of the documentation for KDevelop Version 3.1.2.