Commit b455b0f9 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Disable/Enable button if/if not a git repo

parent fbe3ad6b
......@@ -103,7 +103,7 @@ public:
name.append(QStringLiteral(" &nbsp;<span style=\"color:gray; font-size:%1pt;\">tag at %2</span>").arg(fontSz));
} */
else {
Q_ASSERT(false);
Q_UNREACHABLE();
}
doc.setHtml(name);
......
......@@ -65,8 +65,20 @@ KateProjectView::KateProjectView(KateProjectPluginView *pluginView, KateProject
});
connect(m_branchesDialog, &BranchesDialog::branchChanged, this, [this](const QString &branch) {
m_branchBtn->setText(branch);
m_project->reload();
m_project->reload(true);
});
connect(m_project, &KateProject::modelChanged, this, [this] {
if (GitUtils::isGitRepo(m_project->baseDir())) {
m_branchBtn->setHidden(false);
m_branchBtn->setText(GitUtils::getCurrentBranchName(m_project->baseDir()));
} else {
m_branchBtn->setHidden(true);
}
});
if (!GitUtils::isGitRepo(m_project->baseDir())) {
m_branchBtn->setHidden(true);
}
}
KateProjectView::~KateProjectView()
......
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