diff --git a/includes/CMakeLists.txt b/includes/CMakeLists.txt index 9308265f..b1ba57bc 100644 --- a/includes/CMakeLists.txt +++ b/includes/CMakeLists.txt @@ -499,7 +499,6 @@ install( KTextEditor/SmartRangeNotifier KTextEditor/SmartRangeWatcher KTextEditor/TemplateInterface - KTextEditor/TemplateInterface2 KTextEditor/TextHintInterface KTextEditor/VariableInterface KTextEditor/View diff --git a/includes/KTextEditor/TemplateInterface2 b/includes/KTextEditor/TemplateInterface2 deleted file mode 100644 index 5d6bcec7..00000000 --- a/includes/KTextEditor/TemplateInterface2 +++ /dev/null @@ -1 +0,0 @@ -#include "../../ktexteditor/templateinterface2.h" diff --git a/interfaces/ktexteditor/CMakeLists.txt b/interfaces/ktexteditor/CMakeLists.txt index 66f36417..285532bd 100644 --- a/interfaces/ktexteditor/CMakeLists.txt +++ b/interfaces/ktexteditor/CMakeLists.txt @@ -12,7 +12,6 @@ set(ktexteditor_LIB_SRCS range.cpp cursor.cpp templateinterface.cpp - templateinterface2.cpp editorchooser.cpp attribute.cpp cursorfeedback.cpp @@ -72,7 +71,6 @@ install( texthintinterface.h variableinterface.h templateinterface.h - templateinterface2.h modificationinterface.h commandinterface.h smartinterface.h diff --git a/interfaces/ktexteditor/templateinterface.h b/interfaces/ktexteditor/templateinterface.h index cc49b7a9..8ab68898 100644 --- a/interfaces/ktexteditor/templateinterface.h +++ b/interfaces/ktexteditor/templateinterface.h @@ -87,30 +87,6 @@ class KTEXTEDITOR_EXPORT TemplateInterface //should be named AbstractTemplateInt * If you have mirrored ranges and want another occurence than the first one as the master * you can add @ directly after the placeholder name. * - * The interface2 version invokes the function specified by functionName within the script specified - * by the scriptToken, if a placeholder is specified with backticks like - * ${placeholder`functionName`} - * The function has a global environment containing "view", "document" and "debug", at - * least in the katepart implementation. The function invokation is not allowed to be mixed with other replacements - * - * If a / or ` replacement is done on a master the initial value is modified and therefor - * also all mirrored placeholders are affected too, later on the replacement is not done anymore on master ranges - * - * - * The parameters for invoked javascript functions will be the following: - * value of the master (or initial value), //to be done: placeholder name, small wrapper around the template handler (to do more sophisticated things, like adding additional placehlder points, aattaching custom properties for state keeping, ....) you tell - * - * - * Specification of initial values - * You can specify initial values which are different from the placeholder name - * this is done via, this makes only sense for $ placeholders, not for % - * ${placeholder:some value} or ${placeholder@:some value} - * It is not allowed to mix : and / - * after the first colon, everything is interpreted as default value, } in - * the default value have to be escaped (backslashes before } have to be escaped themselves) and regexp searches are ignored. The : has to be - * directly after the placeholder name or after an optional @ symbol. - * - * * Common placeholders and values are * * - index: "i" @@ -134,7 +110,6 @@ class KTEXTEDITOR_EXPORT TemplateInterface //should be named AbstractTemplateInt * * If the editor supports some kind of smart indentation, the inserted code * should be layouted by the indenter. - * @deprecated */ bool insertTemplateText ( const Cursor &insertPosition, const QString &templateString, const QMap &initialValues); @@ -145,7 +120,6 @@ protected: * this method should work as described in the documentation for * insertTemplateText above. * \return true if any text was inserted. - * @deprecated */ virtual bool insertTemplateTextImplementation ( const Cursor &insertPosition, const QString &templateString, const QMap &initialValues)=0; diff --git a/interfaces/ktexteditor/templateinterface2.cpp b/interfaces/ktexteditor/templateinterface2.cpp deleted file mode 100644 index 68ea10ed..00000000 --- a/interfaces/ktexteditor/templateinterface2.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2010 Joseph Wenninger - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "templateinterface.h" -#include "templateinterface2.h" - - -using namespace KTextEditor; - -TemplateScript::~TemplateScript() -{ -} - - - - -TemplateScriptRegistrar::TemplateScriptRegistrar() -{ -} - -TemplateScriptRegistrar::~TemplateScriptRegistrar() -{ -} - -TemplateInterface2::TemplateInterface2() - : TemplateInterface() - , d(0) -{ -} - -TemplateInterface2::~TemplateInterface2() -{ -} - -bool TemplateInterface2::insertTemplateText ( const Cursor& insertPosition, - const QString &templateString, - const QMap &initialValues, - TemplateScript* templateScript) -{ - QMap enhancedInitValues(initialValues); - if (!KTE_INTERNAL_setupIntialValues(templateString,&enhancedInitValues)) { - return false; - } - return insertTemplateTextImplementation( insertPosition, templateString, enhancedInitValues, templateScript); -} - -// kate: space-indent on; indent-width 2; replace-tabs on; diff --git a/interfaces/ktexteditor/templateinterface2.h b/interfaces/ktexteditor/templateinterface2.h deleted file mode 100644 index 46a57365..00000000 --- a/interfaces/ktexteditor/templateinterface2.h +++ /dev/null @@ -1,125 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2010 Joseph Wenninger - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KDELIBS_KTEXTEDITOR_TEMPLATEINTERFACE2_H -#define KDELIBS_KTEXTEDITOR_TEMPLATEINTERFACE2_H - -#include -#include -#include - -#include -#include -#include - -namespace KTextEditor -{ - -class Cursor; - -class KTEXTEDITOR_EXPORT TemplateScript -{ - public: - virtual ~TemplateScript(); -}; - -/** - * @since 4.5 - * This is an interface for inserting template strings with user editable - * fields into a document and support for scripts. Fold back into base Interface in KDE 5 - * \ingroup kte_group_view_extensions - */ -class KTEXTEDITOR_EXPORT TemplateInterface2: public TemplateInterface -{ - public: - TemplateInterface2(); - virtual ~TemplateInterface2(); - - public: - - /** - * See the function description in TemplateInterface, this should be folded into the base Interface in KDE 5 - * @param templateScript pointer to TemplateScript created by TemplateScriptRegistrar::registerTemplateScript - */ - bool insertTemplateText ( const Cursor &insertPosition, - const QString &templateString, - const QMap &initialValues, - TemplateScript* templateScript); - - -protected: - /** - * You must implement this, it is called by insertTemplateText, after all - * default values are inserted. If you are implementing this interface, - * this method should work as described in the documentation for - * insertTemplateText above. - * \return true if any text was inserted. - */ - virtual bool insertTemplateTextImplementation ( const Cursor &insertPosition, - const QString &templateString, - const QMap &initialValues, - TemplateScript* templateScript) = 0; - - - virtual bool insertTemplateTextImplementation ( const Cursor &insertPosition, - const QString &templateString, - const QMap &initialValues) = 0; - - private: - class TemplateInterfacePrivate2* const d; -}; - -/// This is an extension for KTextEditor::Editor -/// @since 4.5 -class KTEXTEDITOR_EXPORT TemplateScriptRegistrar { - -public: - TemplateScriptRegistrar(); - virtual ~TemplateScriptRegistrar(); - - /** - * This registeres the script, which is contained in \param script. - * \return the template script pointer, returns an empty QString on error - * The implementation has to register the script for all views and all documents, - * == globally - * If owner is destructed, all scripts owned by it are automatically freed. - * Scripts have to be self contained. - * Depending on the underlying editor, there might be some global functions, - * perhaps there will be a specifiction for a common functionset later on, but not - * yet. - */ - virtual TemplateScript* registerTemplateScript(QObject *owner, const QString& script) = 0; - - /** - * This frees the template script which is identified by the token - */ - virtual void unregisterTemplateScript(TemplateScript* templateScript) = 0; - -}; - -} - -Q_DECLARE_INTERFACE(KTextEditor::TemplateInterface2, -"org.kde.KTextEditor.TemplateInterface2") - -Q_DECLARE_INTERFACE(KTextEditor::TemplateScriptRegistrar, -"org.kde.KTextEditor.TemplateScriptRegistrar") - - - -#endif