summaryrefslogtreecommitdiff
path: root/utils/themeeditor/skindocument.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/skindocument.cpp')
-rw-r--r--utils/themeeditor/skindocument.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/utils/themeeditor/skindocument.cpp b/utils/themeeditor/skindocument.cpp
index 53e480cbe3..9a9bf5c85f 100644
--- a/utils/themeeditor/skindocument.cpp
+++ b/utils/themeeditor/skindocument.cpp
@@ -138,6 +138,8 @@ void SkinDocument::setupUI()
138 /* Connecting the editor's signal */ 138 /* Connecting the editor's signal */
139 QObject::connect(editor, SIGNAL(textChanged()), 139 QObject::connect(editor, SIGNAL(textChanged()),
140 this, SLOT(codeChanged())); 140 this, SLOT(codeChanged()));
141 QObject::connect(editor, SIGNAL(cursorPositionChanged()),
142 this, SLOT(cursorChanged()));
141 143
142 settingsChanged(); 144 settingsChanged();
143} 145}
@@ -171,6 +173,28 @@ void SkinDocument::settingsChanged()
171 173
172} 174}
173 175
176void SkinDocument::cursorChanged()
177{
178 if(editor->isError(editor->textCursor().blockNumber() + 1))
179 {
180 QTextCursor line = editor->textCursor();
181 line.movePosition(QTextCursor::StartOfLine);
182 line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
183 skin_parse(line.selectedText().toAscii());
184 if(skin_error_line() > 0)
185 parseStatus = tr("Error on line ") +
186 QString::number(line.blockNumber() + 1) + tr(": ") +
187 skin_error_message();
188 statusLabel->setText(parseStatus);
189 }
190 else if(editor->hasErrors())
191 {
192 parseStatus = tr("Errors in document");
193 statusLabel->setText(parseStatus);
194 }
195
196}
197
174void SkinDocument::codeChanged() 198void SkinDocument::codeChanged()
175{ 199{
176 if(blockUpdate) 200 if(blockUpdate)
@@ -190,7 +214,6 @@ void SkinDocument::codeChanged()
190 parseStatus = tr("Errors in document"); 214 parseStatus = tr("Errors in document");
191 statusLabel->setText(parseStatus); 215 statusLabel->setText(parseStatus);
192 216
193
194 /* Highlighting if an error was found */ 217 /* Highlighting if an error was found */
195 if(skin_error_line() > 0) 218 if(skin_error_line() > 0)
196 { 219 {
@@ -225,6 +248,9 @@ void SkinDocument::codeChanged()
225 emit titleChanged(title + QChar('*')); 248 emit titleChanged(title + QChar('*'));
226 else 249 else
227 emit titleChanged(title); 250 emit titleChanged(title);
251
252 cursorChanged();
253
228} 254}
229 255
230void SkinDocument::save() 256void SkinDocument::save()