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 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
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
QScriptValue i18nc(QScriptContext *context, QScriptEngine *engine)
i18nc("context", "text", arguments [optional])
Definition: katescripthelpers.cpp:210
static SnippetRepository * createRepoFromName(const QString &name)
Creates a snippet repository for the given name and adds it to the SnippetStore.
Definition: snippetrepository.cpp:73
const KShortcut & shortcut(StandardShortcut id)
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
QVariant property(UserProperty which) const
KTextEditor::TemplateScript * registerScript(const QString &script)
Register script to make it available in snippets.
Definition: snippetstore.cpp:135
void setArguments(const QString &arguments)
Sets the display arguments of this snippet.
Definition: snippet.cpp:82
KStandardDirs * dirs()
void setPrefix(const QString &prefix)
Sets the display prefix of this snippet.
Definition: snippet.cpp:62
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
KShortcut shortcut
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
QString license() const
The license for the snippets contained in this repository.
Definition: snippetrepository.cpp:117
KSharedConfigPtr config()
void setFileTypes(const QStringList &filetypes)
Sets the valid filetypes for the snippets contained in this repository.
Definition: snippetrepository.cpp:108
QBrush foreground(ForegroundRole=NormalText) 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
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
Each object of this type represents a repository of snippets.
Definition: snippetrepository.h:52
void setShortcut(const KShortcut &shortcut, ShortcutTypes type=ShortcutTypes(ActiveShortcut|DefaultShortcut))
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
QKeySequence alternate() const
void setScript(const QString &script)
Sets the QtScript(s) associated with this repository.
Definition: snippetrepository.cpp:147
const QString & file() const
The path to this repository's file.
Definition: snippetrepository.cpp:88
void setAlternate(const QKeySequence &keySeq)
static QString locateLocal(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
void setPrimary(const QKeySequence &keySeq)
void sync()
QKeySequence primary() const
T readEntry(const QString &key, const T &aDefault) const
KTextEditor::TemplateScript * registeredScript() const
The token identifying the script in this repository.
Definition: snippetrepository.cpp:142
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
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
This file is part of the KDE documentation.
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
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.