interfaces: undeprecate KTextEditor::TemplateInterface methods and remove KTextEditor::TemplateInterface2

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-09-28 18:37:06 +03:00
parent 6cf96c3a87
commit a7b141e60f
6 changed files with 0 additions and 217 deletions

View file

@ -499,7 +499,6 @@ install(
KTextEditor/SmartRangeNotifier
KTextEditor/SmartRangeWatcher
KTextEditor/TemplateInterface
KTextEditor/TemplateInterface2
KTextEditor/TextHintInterface
KTextEditor/VariableInterface
KTextEditor/View

View file

@ -1 +0,0 @@
#include "../../ktexteditor/templateinterface2.h"

View file

@ -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

View file

@ -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<QString,QString> &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<QString,QString> &initialValues)=0;

View file

@ -1,62 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2010 Joseph Wenninger <jowenn@kde.org>
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<QString, QString> &initialValues,
TemplateScript* templateScript)
{
QMap<QString,QString> 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;

View file

@ -1,125 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2010 Joseph Wenninger <jowenn@kde.org>
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 <QtCore/QString>
#include <QtCore/QMap>
#include <QtGui/QImage>
#include <ktexteditor/ktexteditor_export.h>
#include <ktexteditor/cursor.h>
#include <ktexteditor/templateinterface.h>
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<QString,QString> &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<QString,QString> &initialValues,
TemplateScript* templateScript) = 0;
virtual bool insertTemplateTextImplementation ( const Cursor &insertPosition,
const QString &templateString,
const QMap<QString,QString> &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