forked from qt-creator/qt-creator
TextEditor: Allow only a single "select encoding" infobar entry
Change-Id: I2e8ac37b2e980bed88e270ccd10cb7319f1f9ffd Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
e2d24a8b55
commit
c1c25a0704
@@ -542,14 +542,18 @@ QString BaseTextEditorWidget::msgTextTooLarge(quint64 size)
|
||||
void BaseTextEditorWidget::updateCannotDecodeInfo()
|
||||
{
|
||||
setReadOnly(d->m_document->hasDecodingError());
|
||||
Core::InfoBar *infoBar = d->m_document->infoBar();
|
||||
Core::Id selectEncodingId(Constants::SELECT_ENCODING);
|
||||
if (d->m_document->hasDecodingError()) {
|
||||
Core::InfoBarEntry info(Core::Id(Constants::SELECT_ENCODING),
|
||||
if (!infoBar->canInfoBeAdded(selectEncodingId))
|
||||
return;
|
||||
Core::InfoBarEntry info(selectEncodingId,
|
||||
tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
|
||||
.arg(d->m_document->displayName()).arg(QString::fromLatin1(d->m_document->codec()->name())));
|
||||
info.setCustomButtonInfo(tr("Select Encoding"), this, SLOT(selectEncoding()));
|
||||
d->m_document->infoBar()->addInfo(info);
|
||||
infoBar->addInfo(info);
|
||||
} else {
|
||||
d->m_document->infoBar()->removeInfo(Core::Id(Constants::SELECT_ENCODING));
|
||||
infoBar->removeInfo(selectEncodingId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user