Commit 10563365 authored by C. Boemann's avatar C. Boemann

Make methods argument non const as we use it non const

CCBUG: 296633
parent 696cf621
......@@ -112,7 +112,7 @@ QHash<QString, KAction*> KoTextEditingPlugin::actions() const
return d->actionCollection;
}
void KoTextEditingPlugin::setCurrentCursorPosition(const QTextDocument *document, int cursorPosition)
void KoTextEditingPlugin::setCurrentCursorPosition(QTextDocument *document, int cursorPosition)
{
Q_UNUSED(cursorPosition);
Q_UNUSED(document);
......
......@@ -81,7 +81,7 @@ public:
virtual void checkSection(QTextDocument *document, int startPosition, int endPosition);
/// can be called when this plugin needs the current position of the textcursor
virtual void setCurrentCursorPosition(const QTextDocument *document, int cursorPosition);
virtual void setCurrentCursorPosition(QTextDocument *document, int cursorPosition);
/**
* Retrieves the entire collection of actions for the plugin
......
......@@ -116,14 +116,14 @@ void SpellCheck::checkSection(QTextDocument *document, int startPosition, int en
m_spellCheckMenu->setVisible(true);
}
void SpellCheck::setDocument(const QTextDocument *document)
void SpellCheck::setDocument(QTextDocument *document)
{
if (m_document == document)
return;
if (m_document)
disconnect (document, SIGNAL(contentsChange(int,int,int)), this, SLOT(documentChanged(int,int,int)));
// XXX: evil!
m_document = const_cast<QTextDocument*>(document);
m_document = document;
connect (document, SIGNAL(contentsChange(int,int,int)), this, SLOT(documentChanged(int,int,int)));
}
......@@ -141,7 +141,7 @@ void SpellCheck::setDefaultLanguage(const QString &language)
{
m_speller.setDefaultLanguage(language);
m_bgSpellCheck->setDefaultLanguage(language);
if (m_enableSpellCheck) {
if (m_enableSpellCheck && m_document) {
checkSection(m_document, 0, m_document->characterCount() - 1);
}
}
......@@ -365,7 +365,7 @@ void SpellCheck::finishedRun()
QTimer::singleShot(0, this, SLOT(runQueue()));
}
void SpellCheck::setCurrentCursorPosition(const QTextDocument *document, int cursorPosition)
void SpellCheck::setCurrentCursorPosition(QTextDocument *document, int cursorPosition)
{
setDocument(document);
if (m_enableSpellCheck) {
......
......@@ -54,7 +54,7 @@ public:
void checkSection(QTextDocument *document, int startPosition, int endPosition);
///reimplemented from superclass
void setCurrentCursorPosition(const QTextDocument *document, int cursorPosition);
void setCurrentCursorPosition(QTextDocument *document, int cursorPosition);
QStringList availableBackends() const;
QStringList availableLanguages() const;
......@@ -68,7 +68,7 @@ public:
bool skipRunTogetherWords();
//reimplemented from Calligra2.0, we disconnect and re- connect the 'documentChanged' signal only when the document has replaced
void setDocument(const QTextDocument *document);
void setDocument(QTextDocument *document);
void replaceWordBySuggestion(const QString &word, int startPosition,int lengthOfWord);
......
......@@ -761,7 +761,7 @@ void TextTool::mousePressEvent(KoPointerEvent *event)
if (event->button() == Qt::RightButton) {
KoTextEditingPlugin *plugin = m_textEditingPlugins->spellcheck();
if (plugin)
plugin->setCurrentCursorPosition(m_textEditor.data()->document(), m_textEditor.data()->position());
plugin->setCurrentCursorPosition(m_textShapeData->document(), m_textEditor.data()->position());
event->ignore();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment