Kate
#include <snippetrepository.h>
Public Member Functions | |
SnippetRepository (const QString &file) | |
~SnippetRepository () | |
QString | authors () const |
QString | completionNamespace () const |
virtual QVariant | data (int role=Qt::UserRole+1) const |
const QString & | file () const |
QStringList | fileTypes () const |
QString | license () const |
KTextEditor::TemplateScript * | registeredScript () const |
void | remove () |
void | save () |
QString | script () const |
void | setAuthors (const QString &authors) |
void | setCompletionNamespace (const QString &completionNamespace) |
virtual void | setData (const QVariant &value, int role=Qt::UserRole+1) |
void | setFileTypes (const QStringList &filetypes) |
void | setLicense (const QString &license) |
void | setScript (const QString &script) |
Static Public Member Functions | |
static SnippetRepository * | createRepoFromName (const QString &name) |
Detailed Description
Each object of this type represents a repository of snippets.
Each repository has a name and will be saved to an XML file that includes all items of this repository.
To access the snippets in this repo, iterate over it's children and dynamic_cast as required. To add a snippet, appendRow()
it. To access the name of the repository, use text()
and setText()
.
NOTE: Unchecked repositores are considered "disabled" in the sense that their snippets won't show up during code completion.
Definition at line 52 of file snippetrepository.h.
Constructor & Destructor Documentation
SnippetRepository::SnippetRepository | ( | const QString & | file | ) |
Creates a new SnippetRepository.
When file
exists it will be parsed (XML).
- Parameters
-
file Location of the snippet's repository file.
Definition at line 52 of file snippetrepository.cpp.
SnippetRepository::~SnippetRepository | ( | ) |
Definition at line 67 of file snippetrepository.cpp.
Member Function Documentation
QString SnippetRepository::authors | ( | ) | const |
The author(s) of the snippets contained in this repository.
Definition at line 93 of file snippetrepository.cpp.
QString SnippetRepository::completionNamespace | ( | ) | const |
The namespace associated with this repository.
Used in CodeCompletion for filtering.
Definition at line 127 of file snippetrepository.cpp.
|
static |
Creates a snippet repository for the given name and adds it to the SnippetStore.
Definition at line 73 of file snippetrepository.cpp.
|
virtual |
TODO: make the selected items also "disalbed" so the toggle action is seen directly
Definition at line 349 of file snippetrepository.cpp.
const QString & SnippetRepository::file | ( | ) | const |
The path to this repository's file.
Definition at line 88 of file snippetrepository.cpp.
QStringList SnippetRepository::fileTypes | ( | ) | const |
The valid filetypes for the snippets contained in this repository.
Empty list means no restriction on the modes.
- See also
- KTextEditor::Document::mode()
Definition at line 103 of file snippetrepository.cpp.
QString SnippetRepository::license | ( | ) | const |
The license for the snippets contained in this repository.
Definition at line 117 of file snippetrepository.cpp.
KTextEditor::TemplateScript * SnippetRepository::registeredScript | ( | ) | const |
The token identifying the script in this repository.
Definition at line 142 of file snippetrepository.cpp.
void SnippetRepository::remove | ( | ) |
Remove this repository from the disk.
Also deletes the item and all its children.
Definition at line 156 of file snippetrepository.cpp.
void SnippetRepository::save | ( | ) |
Save this repository to disk.
based on the code from snippets_tng/lib/completionmodel.cpp
- Copyright
- 2009 Joseph Wenninger jowen n@kd e.org
Definition at line 172 of file snippetrepository.cpp.
QString SnippetRepository::script | ( | ) | const |
The QtScript(s) associated with this repository.
- Since
- KDE 4.5
Definition at line 137 of file snippetrepository.cpp.
void SnippetRepository::setAuthors | ( | const QString & | authors | ) |
Sets the author(s) of the snippets contained in this repository.
Definition at line 98 of file snippetrepository.cpp.
void SnippetRepository::setCompletionNamespace | ( | const QString & | completionNamespace | ) |
Sets the code completion namespace for this repository.
Definition at line 132 of file snippetrepository.cpp.
|
virtual |
Definition at line 369 of file snippetrepository.cpp.
void SnippetRepository::setFileTypes | ( | const QStringList & | filetypes | ) |
Sets the valid filetypes for the snippets contained in this repository.
An empty list, or any list which contains an element "*" is treated as a no-restriction filter.
Definition at line 108 of file snippetrepository.cpp.
void SnippetRepository::setLicense | ( | const QString & | license | ) |
Sets the license for the snippets contained in this repository.
Definition at line 122 of file snippetrepository.cpp.
void SnippetRepository::setScript | ( | const QString & | script | ) |
Sets the QtScript(s) associated with this repository.
- Since
- KDE 4.5
Definition at line 147 of file snippetrepository.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.