• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

Kate

katefactory.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE libraries and the Kate part.
00002  *
00003  *  Copyright (C) 2001-2010 Christoph Cullmann <cullmann@kde.org>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  *  Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #include "kateglobal.h"
00022 #include "katedocument.h"
00023 
00024 #include <ktexteditor/factory.h>
00025 
00031 class KateFactory : public KTextEditor::Factory
00032 {
00033   public:
00039     KateFactory ( QObject *parent = 0 )
00040       : KTextEditor::Factory (parent)
00041     {
00042       KateGlobal::incRef ();
00043     }
00044 
00048     virtual ~KateFactory ()
00049     {
00050       KateGlobal::decRef ();
00051     }
00052 
00053     KTextEditor::Editor *editor () { return KateGlobal::self(); }
00054 
00062     KParts::Part *createPartObject ( QWidget *parentWidget, QObject *parent, const char *_classname, const QStringList & )
00063     {
00064       QByteArray classname( _classname );
00065 
00066       // default to the kparts::* behavior of having one single widget() if the user don't requested a pure document
00067       bool bWantSingleView = ( classname != "KTextEditor::Document" );
00068 
00069       // does user want browserview?
00070       bool bWantBrowserView = ( classname == "Browser/View" );
00071 
00072       // should we be readonly?
00073       bool bWantReadOnly = (bWantBrowserView || ( classname == "KParts::ReadOnlyPart" ));
00074 
00075       // set simple mode on for read-only part per default
00076       KateGlobal::self ()->setSimpleMode (bWantReadOnly);
00077 
00078       KParts::ReadWritePart *part = new KateDocument (bWantSingleView, bWantBrowserView, bWantReadOnly, parentWidget, parent);
00079       part->setReadWrite( !bWantReadOnly );
00080 
00081       return part;
00082     }
00083 };
00084 
00085 K_EXPORT_PLUGIN( KateFactory )
00086 
00087 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal