Commit cdbf4e11 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Enable DiffWidget for git blame

parent 2ba40c6c
......@@ -456,5 +456,5 @@ void CommitDiffTreeView::showDiff(const QModelIndex &idx)
}
}
Q_EMIT showDiffRequested(git.readAllStandardOutput());
Q_EMIT showDiffRequested(git.readAllStandardOutput(), file);
}
......@@ -36,7 +36,7 @@ public:
void openCommit(const QString &hash, const QString &filePath);
Q_SIGNAL void closeRequested();
Q_SIGNAL void showDiffRequested(const QByteArray &diffContents);
Q_SIGNAL void showDiffRequested(const QByteArray &diffContents, const QString &file);
public:
void createFileTreeForCommit(const QString &filePath, const QByteArray &rawNumStat);
......
......@@ -584,21 +584,10 @@ void KateGitBlamePluginView::hideToolView()
// CommitFileView will be destroyed as well as it is the child of m_ToolView
}
void KateGitBlamePluginView::showDiffForFile(const QByteArray &diffContents)
void KateGitBlamePluginView::showDiffForFile(const QByteArray &diffContents, const QString &file)
{
if (m_diffView) {
m_diffView->document()->setText(QString::fromUtf8(diffContents));
m_diffView->document()->setModified(false);
m_mainWindow->activateView(m_diffView->document());
m_diffView->setCursorPosition({0, 0});
return;
}
m_diffView = m_mainWindow->openUrl(QUrl());
m_diffView->document()->setHighlightingMode(QStringLiteral("Diff"));
m_diffView->document()->setText(QString::fromUtf8(diffContents));
m_diffView->document()->setModified(false);
m_mainWindow->activateView(m_diffView->document());
m_diffView->setCursorPosition({0, 0});
auto mw = m_mainWindow->window();
QMetaObject::invokeMethod(mw, "showDiff", Q_ARG(QByteArray, diffContents), Q_ARG(QString, file), Q_ARG(QString, {}));
}
#include "kategitblameplugin.moc"
......@@ -107,7 +107,7 @@ private:
void createToolView();
void hideToolView();
void showDiffForFile(const QByteArray &diffContents);
void showDiffForFile(const QByteArray &diffContents, const QString &file);
const CommitInfo &blameGetUpdateInfo(int lineNr);
......
Supports Markdown
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