forked from qt-creator/qt-creator
Git: Fix error encoding if the source file not exist
Change-Id: Ia98195f966e79d65f1947c638cb9aacfb9b2f309 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
62afcd6742
commit
58f8d43fff
@@ -408,7 +408,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
|
||||
QTC_ASSERT(rc, return 0);
|
||||
rc->setSource(source);
|
||||
if (codecType == CodecSource) {
|
||||
rc->setCodec(VcsBase::VcsBaseEditorWidget::getCodec(source));
|
||||
rc->setCodec(getSourceCodec(source));
|
||||
} else if (codecType == CodecLogOutput) {
|
||||
QString encodingName = readConfigValue(source, QLatin1String("i18n.logOutputEncoding"));
|
||||
if (encodingName.isEmpty())
|
||||
@@ -675,6 +675,16 @@ void GitClient::slotBlameRevisionRequested(const QString &source, QString change
|
||||
blame(fi.absolutePath(), QStringList(), fi.fileName(), change, lineNumber);
|
||||
}
|
||||
|
||||
QTextCodec *GitClient::getSourceCodec(const QString &file) const
|
||||
{
|
||||
if (QFileInfo(file).isFile())
|
||||
return VcsBase::VcsBaseEditorWidget::getCodec(file);
|
||||
QString encodingName = readConfigValue(file, QLatin1String("gui.encoding"));
|
||||
if (encodingName.isEmpty())
|
||||
encodingName = QLatin1String("utf-8");
|
||||
return QTextCodec::codecForName(encodingName.toLocal8Bit());
|
||||
}
|
||||
|
||||
void GitClient::blame(const QString &workingDirectory,
|
||||
const QStringList &args,
|
||||
const QString &fileName,
|
||||
|
||||
Reference in New Issue
Block a user