Kate
katewordcompletion.cpp
Go to the documentation of this file.
120 QModelIndex KateWordCompletionModel::index(int row, int column, const QModelIndex& parent) const
149 bool KateWordCompletionModel::shouldStartCompletion(KTextEditor::View* view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position)
179 bool KateWordCompletionModel::shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range &range, const QString ¤tCompletion) {
186 return CodeCompletionModelControllerInterface4::shouldAbortCompletion(view,range,currentCompletion);
191 void KateWordCompletionModel::completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType it)
203 QStringList KateWordCompletionModel::allMatches( KTextEditor::View *view, const KTextEditor::Range &range ) const
206 const int minWordSize = qMax(2, qobject_cast<KateView*>(view)->config()->wordCompletionMinimalWordLength());
217 if ( offset - wordBegin > minWordSize && ( line != range.end().line() || offset != range.end().column() ) ) {
253 int sizeDiff = m_matches.at(index.row()).size() - (word.end().column() - word.start().column());
273 KTextEditor::CodeCompletionModelControllerInterface3::MatchReaction KateWordCompletionModel::matchingItem(const QModelIndex& /*matched*/)
286 KTextEditor::Range KateWordCompletionModel::completionRange(KTextEditor::View* view, const KTextEditor::Cursor &position)
320 KateWordCompletionView::KateWordCompletionView( KTextEditor::View *view, KActionCollection* ac )
329 d->liRange = static_cast<KateDocument*>(m_view->document())->newMovingRange(KTextEditor::Range::invalid(), KTextEditor::MovingRange::DoNotExpand);
337 KTextEditor::CodeCompletionInterface *cci = qobject_cast<KTextEditor::CodeCompletionInterface *>(view);
364 KTextEditor::CodeCompletionInterface *cci = qobject_cast<KTextEditor::CodeCompletionInterface *>(m_view);
387 KTextEditor::CodeCompletionInterface *cci = qobject_cast<KTextEditor::CodeCompletionInterface *>( m_view );
420 connect( m_view, SIGNAL(cursorPositionChanged(KTextEditor::View*,KTextEditor::Cursor)), this, SLOT(slotCursorMoved()) );
470 connect( m_view, SIGNAL(cursorPositionChanged(KTextEditor::View*,KTextEditor::Cursor)), this, SLOT(slotCursorMoved()) );
489 if ( m != doc->text( *d->liRange ) && (d->dcCursor.line() != d->dcRange.start().line() || pos != d->dcRange.start().column() ) )
560 disconnect( m_view, SIGNAL(cursorPositionChanged(KTextEditor::View*,KTextEditor::Cursor)), this, SLOT(slotCursorMoved()) );
virtual void unregisterCompletionModel(CodeCompletionModel *model)=0
virtual bool insertText(const Cursor &position, const QString &text, bool block=false)=0
~KateWordCompletionModel()
Definition: katewordcompletion.cpp:72
Cursor & start()
static const int autoInvocationMaxFilesize
Amount of characters the document may have to enable automatic invocation (1MB)
Definition: katewordcompletion.cpp:63
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional])
Definition: katescripthelpers.cpp:186
QBrush background(BackgroundRole=NormalBackground) const
virtual void executeCompletionItem2(KTextEditor::Document *document, const KTextEditor::Range &word, const QModelIndex &index) const
Definition: katewordcompletion.cpp:231
InvocationType
QStringList allMatches(KTextEditor::View *view, const KTextEditor::Range &range) const
Scan throughout the entire document for possible completions, ignoring any dublets and words shorter ...
Definition: katewordcompletion.cpp:203
virtual bool isCompletionActive() const =0
int wordCompletionMinimalWordLength() const
Definition: kateconfig.cpp:1793
virtual KTextEditor::Range completionRange(KTextEditor::View *view, const KTextEditor::Cursor &position)
Definition: katewordcompletion.cpp:286
QAction * addAction(const QString &name, QAction *action)
virtual void setRange(const Range &range)
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
virtual void registerCompletionModel(CodeCompletionModel *model)=0
KateWordCompletionModel(QObject *parent)
Definition: katewordcompletion.cpp:66
KSharedConfigPtr config()
~KateWordCompletionView()
Definition: katewordcompletion.cpp:362
int columnWidth() const
bool wordCompletionRemoveTail() const
Definition: kateconfig.cpp:1814
virtual View * activeView() const =0
QBrush foreground(ForegroundRole=NormalText) const
virtual bool removeText(const Range &range, bool block=false)=0
int rowCount(const QModelIndex &parent) const
Definition: katewordcompletion.cpp:138
KSharedPtr< Attribute > Ptr
static Range invalid()
virtual Document * document() const =0
bool shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position)
Definition: katewordcompletion.cpp:149
static void beep(const QString &reason=QString(), QWidget *widget=0L)
void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType)
This function is responsible to generating / updating the list of current completions.
Definition: katewordcompletion.cpp:191
virtual Cursor cursorPosition() const =0
Definition: kateview.h:78
void saveMatches(KTextEditor::View *view, const KTextEditor::Range &range)
Definition: katewordcompletion.cpp:76
virtual QString text() const =0
void setHasGroups(bool hasGroups)
Definition: katedocument.h:74
static const int ColumnCount
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: katewordcompletion.cpp:120
virtual int totalCharacters() const =0
QVariant data(const QModelIndex &index, int role) const
Definition: katewordcompletion.cpp:83
virtual QString line(int line) const =0
virtual int line() const
virtual QChar character(const Cursor &position) const =0
Cursor & end()
virtual bool shouldHideItemsWithEqualNames() const
When multiple completion models are used at the same time, it may happen that multiple models add ite...
Definition: katewordcompletion.cpp:278
KateGlobal One instance of this class is hold alive during a kate part session, as long as any factor...
Definition: kateglobal.h:70
virtual void startCompletion(const Range &word, CodeCompletionModel *model)=0
void editStart()
Enclose editor actions with editStart() and editEnd() to group them.
Definition: katedocument.cpp:776
virtual QModelIndex parent(const QModelIndex &index) const
Definition: katewordcompletion.cpp:112
virtual MatchReaction matchingItem(const QModelIndex &matched)
Definition: katewordcompletion.cpp:273
const KShortcut & end()
virtual void setColumn(int column)
int column() const
virtual bool replaceText(const Range &range, const QString &text, bool block=false)
KateWordCompletionView(KTextEditor::View *view, KActionCollection *ac)
Definition: katewordcompletion.cpp:320
bool shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString ¤tCompletion)
Definition: katewordcompletion.cpp:179
virtual int lines() const =0
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:53 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:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.