Kate
katefactory.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 "kateglobal.h"
00020 #include "katedocument.h"
00021
00022 #include <ktexteditor/factory.h>
00023
00029 class KateFactory : public KTextEditor::Factory
00030 {
00031 public:
00037 KateFactory ( QObject *parent = 0 )
00038 : KTextEditor::Factory (parent)
00039 {
00040 KateGlobal::incRef ();
00041 }
00042
00046 virtual ~KateFactory ()
00047 {
00048 KateGlobal::decRef ();
00049 }
00050
00051 KTextEditor::Editor *editor () { return KateGlobal::self(); }
00052
00060 KParts::Part *createPartObject ( QWidget *parentWidget, QObject *parent, const char *_classname, const QStringList & )
00061 {
00062 QByteArray classname( _classname );
00063
00064
00065 bool bWantSingleView = ( classname != "KTextEditor::Document" );
00066
00067
00068 bool bWantBrowserView = false;
00069
00070
00071 bool bWantReadOnly = (bWantBrowserView || ( classname == "KParts::ReadOnlyPart" ));
00072
00073
00074 KateGlobal::self ()->setSimpleMode (bWantReadOnly);
00075
00076 KParts::ReadWritePart *part = new KateDocument (bWantSingleView, bWantBrowserView, bWantReadOnly, parentWidget, parent);
00077 part->setReadWrite( !bWantReadOnly );
00078
00079 return part;
00080 }
00081 };
00082
00083 K_EXPORT_PLUGIN( KateFactory )
00084
00085