KDevelop API Documentation

kneditfactory.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2002 Harald Fernengel <harry@kdevelop.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00016    Boston, MA 02111-1307, USA.
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   // nc has to be installed...
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 
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:23 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003