Commit a889850c authored by Kåre Särs's avatar Kåre Särs
Browse files

Reload the blame-info on document save and reload

parent 1532bffd
......@@ -151,7 +151,6 @@ QObject *KateGitBlamePlugin::createView(KTextEditor::MainWindow *mainWindow)
connect(m_mainWindow, &KTextEditor::MainWindow::viewChanged, this, &KateGitBlamePlugin::viewChanged);
return nullptr;
}
......@@ -164,6 +163,12 @@ void KateGitBlamePlugin::addDocument(KTextEditor::Document *doc)
connect(doc, &KTextEditor::Document::destroyed, this, [this, doc]() {
m_inlineNoteProviders.remove(doc);
});
connect(doc, &KTextEditor::Document::reloaded, this, [this, doc]() {
startBlameProcess(doc->url());
});
connect(doc, &KTextEditor::Document::documentSavedOrUploaded, this, [this, doc]() {
startBlameProcess(doc->url());
});
}
void KateGitBlamePlugin::viewChanged(KTextEditor::View *view)
......@@ -173,15 +178,17 @@ void KateGitBlamePlugin::viewChanged(KTextEditor::View *view)
if (view == nullptr || view->document() == nullptr) {
return;
}
m_blameInfoView = view;
startBlameProcess(view->document()->url());
}
void KateGitBlamePlugin::startBlameProcess(const QUrl &url)
{
if (m_blameInfoProc.state() != QProcess::NotRunning) {
// Wait for the previous process to be done...
return;
}
m_blameInfoView = view;
QUrl url = view->document()->url();
QString fileName{url.fileName()};
QDir dir{url.toLocalFile()};
dir.cdUp();
......
......@@ -77,6 +77,8 @@ private Q_SLOTS:
private:
void addDocument(KTextEditor::Document *doc);
void startBlameProcess(const QUrl &url);
KTextEditor::MainWindow *m_mainWindow;
QHash<KTextEditor::Document *, GitBlameInlineNoteProvider *> m_inlineNoteProviders;
......
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