Commit 1d954b1b authored by jkobus's avatar jkobus Committed by Jarek Kobus

Get rid of DiffEditor::editorWidget();

Change-Id: I3078002359871dad74d4a07924d5beeaeb9f82ba
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 5ee3d2da
......@@ -85,6 +85,11 @@ Core::Id DiffEditor::id() const
return Constants::DIFF_EDITOR_ID;
}
QTextCodec *DiffEditor::codec() const
{
return m_editorWidget->codec();
}
static QToolBar *createToolBar(const QWidget *someWidget)
{
// Create
......
......@@ -63,7 +63,7 @@ public:
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
Core::IDocument *document();
Core::Id id() const;
DiffEditorWidget *editorWidget() const { return m_editorWidget; }
QTextCodec *codec() const;
QWidget *toolBar();
......
......@@ -109,10 +109,10 @@ void DiffEditorPlugin::diff()
Core::EditorManager::activateEditor(editor);
DiffEditorWidget *editorWidget = editor->editorWidget();
QTextCodec *codec = editor->codec();
const QString text1 = getFileContents(fileName1, editorWidget->codec());
const QString text2 = getFileContents(fileName2, editorWidget->codec());
const QString text1 = getFileContents(fileName1, codec);
const QString text2 = getFileContents(fileName2, codec);
DiffEditorWidget::DiffFilesContents dfc;
dfc.leftFileInfo = fileName1;
......
......@@ -362,7 +362,7 @@ void GitDiffHandler::collectShowDescription(const QString &id)
return;
m_editor->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
command->setCodec(m_editor->editorWidget()->codec());
command->setCodec(m_editor->codec());
connect(command, SIGNAL(output(QString)), this, SLOT(slotShowDescriptionReceived(QString)));
QStringList arguments;
arguments << QLatin1String("show") << QLatin1String("-s")
......@@ -392,7 +392,7 @@ void GitDiffHandler::collectFilesList(const QStringList &additionalArguments)
return;
m_editor->clear(m_waitMessage);
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
command->setCodec(m_editor->editorWidget()->codec());
command->setCodec(m_editor->codec());
connect(command, SIGNAL(output(QString)), this, SLOT(slotFileListReceived(QString)));
QStringList arguments;
arguments << QLatin1String("diff") << QLatin1String("--name-only") << additionalArguments;
......@@ -461,7 +461,7 @@ void GitDiffHandler::collectFilesContents()
VcsBase::Command *command = new VcsBase::Command(m_gitPath, m_workingDirectory, m_processEnvironment);
if (m_editor)
command->setCodec(m_editor->editorWidget()->codec());
command->setCodec(m_editor->codec());
connect(command, SIGNAL(output(QString)), this, SLOT(slotFileContentsReceived(QString)));
QString revisionArgument = (revision.type == Other)
......@@ -547,7 +547,7 @@ QString GitDiffHandler::workingTreeContents(const QString &fileName) const
QFile file(absoluteFileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
return m_editor->editorWidget()->codec()->toUnicode(file.readAll());
return m_editor->codec()->toUnicode(file.readAll());
return QString();
}
......
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