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) |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Public Member Functions inherited from QStandardItem | |
QStandardItem () | |
QStandardItem (const QString &text) | |
QStandardItem (int rows, int columns) | |
QStandardItem (const QIcon &icon, const QString &text) | |
virtual | ~QStandardItem () |
QString | accessibleDescription () const |
QString | accessibleText () const |
void | appendColumn (const QList< QStandardItem * > &items) |
void | appendRow (const QList< QStandardItem * > &items) |
void | appendRow (QStandardItem *item) |
void | appendRows (const QList< QStandardItem * > &items) |
QBrush | background () const |
Qt::CheckState | checkState () const |
QStandardItem * | child (int row, int column) const |
virtual QStandardItem * | clone () const |
int | column () const |
int | columnCount () const |
Qt::ItemFlags | flags () const |
QFont | font () const |
QBrush | foreground () const |
bool | hasChildren () const |
QIcon | icon () const |
QModelIndex | index () const |
void | insertColumn (int column, const QList< QStandardItem * > &items) |
void | insertColumns (int column, int count) |
void | insertRow (int row, QStandardItem *item) |
void | insertRow (int row, const QList< QStandardItem * > &items) |
void | insertRows (int row, const QList< QStandardItem * > &items) |
void | insertRows (int row, int count) |
bool | isCheckable () const |
bool | isDragEnabled () const |
bool | isDropEnabled () const |
bool | isEditable () const |
bool | isEnabled () const |
bool | isSelectable () const |
bool | isTristate () const |
QStandardItemModel * | model () const |
virtual bool | operator< (const QStandardItem &other) const |
QStandardItem * | parent () const |
virtual void | read (QDataStream &in) |
void | removeColumn (int column) |
void | removeColumns (int column, int count) |
void | removeRow (int row) |
void | removeRows (int row, int count) |
int | row () const |
int | rowCount () const |
void | setAccessibleDescription (const QString &accessibleDescription) |
void | setAccessibleText (const QString &accessibleText) |
void | setBackground (const QBrush &brush) |
void | setCheckable (bool checkable) |
void | setCheckState (Qt::CheckState state) |
void | setChild (int row, int column, QStandardItem *item) |
void | setChild (int row, QStandardItem *item) |
void | setColumnCount (int columns) |
void | setDragEnabled (bool dragEnabled) |
void | setDropEnabled (bool dropEnabled) |
void | setEditable (bool editable) |
void | setEnabled (bool enabled) |
void | setFlags (QFlags< Qt::ItemFlag > flags) |
void | setFont (const QFont &font) |
void | setForeground (const QBrush &brush) |
void | setIcon (const QIcon &icon) |
void | setRowCount (int rows) |
void | setSelectable (bool selectable) |
void | setSizeHint (const QSize &size) |
void | setStatusTip (const QString &statusTip) |
void | setText (const QString &text) |
void | setTextAlignment (QFlags< Qt::AlignmentFlag > alignment) |
void | setToolTip (const QString &toolTip) |
void | setTristate (bool tristate) |
void | setWhatsThis (const QString &whatsThis) |
QSize | sizeHint () const |
void | sortChildren (int column, Qt::SortOrder order) |
QString | statusTip () const |
QStandardItem * | takeChild (int row, int column) |
QList< QStandardItem * > | takeColumn (int column) |
QList< QStandardItem * > | takeRow (int row) |
QString | text () const |
Qt::Alignment | textAlignment () const |
QString | toolTip () const |
virtual int | type () const |
QString | whatsThis () const |
virtual void | write (QDataStream &out) const |
Static Public Member Functions | |
static SnippetRepository * | createRepoFromName (const QString &name) |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Additional Inherited Members | |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Member Functions inherited from QStandardItem | |
QStandardItem (const QStandardItem &other) | |
void | emitDataChanged () |
QStandardItem & | operator= (const QStandardItem &other) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
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
Reimplemented from QStandardItem.
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 |
Reimplemented from QStandardItem.
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-2020 The KDE developers.
Generated on Sat May 9 2020 03:57:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.