Kate
snippetrepository.cpp
Go to the documentation of this file.
56 bool activated = SnippetStore::self()->getConfig().readEntry<QStringList>("enabledRepositories", QStringList()).contains(file);
165 static void addAndCreateElement(QDomDocument& doc, QDomElement& item, const QString& name, const QString &content)
177 <snippets name="Testsnippets" filetype="*" authors="Joseph Wenninger" license="BSD" namespace="test::">
222 QString outname = KGlobal::dirs()->locateLocal( "data", "ktexteditor_snippets/data/" + fi.fileName() );
226 // there could be cases that new new name clashes with a global file, but I guess it is not that often.
229 outname = KGlobal::dirs()->locateLocal( "data", "ktexteditor_snippets/data/"+QString("%1_").arg(i++)+fi.fileName());
232 i18n("You have edited a data file not located in your personal data directory; as such, a renamed clone of the original data file has been created within your personal data directory."));
266 KMessageBox::error( QApplication::activeWindow(), i18n("Cannot open snippet repository %1.", m_file) );
286 KMessageBox::error( QApplication::activeWindow(), i18n("Invalid XML snippet file: %1", m_file) );
353 return i18n("Repository is disabled, the contained snippets will not be shown during code-completion.");
void clear()
void setSnippet(const QString &snippet)
Sets the actual contents of this snippet.
Definition: snippet.cpp:52
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional])
Definition: katescripthelpers.cpp:186
virtual QVariant data(int role=Qt::UserRole+1) const
Definition: snippetrepository.cpp:349
void setIcon(const QIcon &icon)
virtual void setData(const QVariant &value, int role=Qt::UserRole+1)
Definition: snippetrepository.cpp:369
void setCompletionNamespace(const QString &completionNamespace)
Sets the code completion namespace for this repository.
Definition: snippetrepository.cpp:132
void unregisterScript(KTextEditor::TemplateScript *token)
Unregister script identified by token.
Definition: snippetstore.cpp:128
QDomNode appendChild(const QDomNode &newChild)
QStandardItem * invisibleRootItem() const
QString attribute(const QString &name, const QString &defValue) const
QScriptValue i18nc(QScriptContext *context, QScriptEngine *engine)
i18nc("context", "text", arguments [optional])
Definition: katescripthelpers.cpp:210
bool remove()
static SnippetRepository * createRepoFromName(const QString &name)
Creates a snippet repository for the given name and adds it to the SnippetStore.
Definition: snippetrepository.cpp:73
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
bool isElement() const
KTextEditor::TemplateScript * registerScript(const QString &script)
Register script to make it available in snippets.
Definition: snippetstore.cpp:135
const QObjectList & children() const
void setArguments(const QString &arguments)
Sets the display arguments of this snippet.
Definition: snippet.cpp:82
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void setPrefix(const QString &prefix)
Sets the display prefix of this snippet.
Definition: snippet.cpp:62
void removeRow(int row)
QDomElement documentElement() const
QString join(const QString &separator) const
bool exists() const
QDomNodeList childNodes() const
QString license() const
The license for the snippets contained in this repository.
Definition: snippetrepository.cpp:117
QString text() const
Qt::CheckState checkState() const
virtual void setData(const QVariant &value, int role)
T value(int i) const
QDomElement toElement() const
void setFileTypes(const QStringList &filetypes)
Sets the valid filetypes for the snippets contained in this repository.
Definition: snippetrepository.cpp:108
const char * name() const
QWidget * activeWindow()
int count(const T &value) const
QString text() const
int toInt(bool *ok) const
QString fileName() const
static void addAndCreateElement(QDomDocument &doc, QDomElement &item, const QString &name, const QString &content)
copied code from snippets_tng/lib/completionmodel.cpp
Definition: snippetrepository.cpp:165
void setAttribute(const QString &name, const QString &value)
void appendRow(const QList< QStandardItem * > &items)
bool isEmpty() const
bool isEmpty() const
int removeAll(const T &value)
QString authors() const
The author(s) of the snippets contained in this repository.
Definition: snippetrepository.cpp:93
QString completionNamespace() const
The namespace associated with this repository.
Definition: snippetrepository.cpp:127
void setPostfix(const QString &postfix)
Sets the display postfix of this snippet.
Definition: snippet.cpp:72
QString script() const
The QtScript(s) associated with this repository.
Definition: snippetrepository.cpp:137
void removeRows(int row, int count)
Each object of this type represents a repository of snippets.
Definition: snippetrepository.h:52
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QStandardItem * child(int row, int column) const
QDomText createTextNode(const QString &value)
void setAuthors(const QString &authors)
Sets the author(s) of the snippets contained in this repository.
Definition: snippetrepository.cpp:98
SnippetRepository(const QString &file)
Creates a new SnippetRepository.
Definition: snippetrepository.cpp:52
virtual void close()
void setScript(const QString &script)
Sets the QtScript(s) associated with this repository.
Definition: snippetrepository.cpp:147
void setText(const QString &text)
QString & replace(int position, int n, QChar after)
const QString & file() const
The path to this repository's file.
Definition: snippetrepository.cpp:88
QStandardItemModel * model() const
qint64 write(const char *data, qint64 maxSize)
int rowCount() const
QString tagName() const
void setCheckState(Qt::CheckState state)
int size() const
QDomElement createElement(const QString &tagName)
KTextEditor::TemplateScript * registeredScript() const
The token identifying the script in this repository.
Definition: snippetrepository.cpp:142
int row() const
void appendRow(const QList< QStandardItem * > &items)
virtual QVariant data(int role) const
QStringList fileTypes() const
The valid filetypes for the snippets contained in this repository.
Definition: snippetrepository.cpp:103
void setLicense(const QString &license)
Sets the license for the snippets contained in this repository.
Definition: snippetrepository.cpp:122
QByteArray toByteArray(int indent) const
QDomNode at(int index) const
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
singleShot
QByteArray toUtf8() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.