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

Fix incorrect actions launching from git-contextmenu


Signed-off-by: Waqar Ahmed's avatarWaqar Ahmed <waqar.17a@gmail.com>
parent 30a9ef88
...@@ -862,7 +862,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e) ...@@ -862,7 +862,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
if (ret == KMessageBox::Yes) { if (ret == KMessageBox::Yes) {
clean(files); clean(files);
} }
} else if (untracked && act == ignoreAct) { } else if (ignoreAct && untracked && act == ignoreAct) {
const auto files = m_project->files(); const auto files = m_project->files();
const auto it = std::find_if(files.cbegin(), files.cend(), [](const QString &s) { const auto it = std::find_if(files.cbegin(), files.cend(), [](const QString &s) {
if (s.contains(QStringLiteral(".gitignore"))) { if (s.contains(QStringLiteral(".gitignore"))) {
...@@ -873,7 +873,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e) ...@@ -873,7 +873,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
if (it != files.cend()) { if (it != files.cend()) {
m_mainWin->openUrl(QUrl::fromLocalFile(*it)); m_mainWin->openUrl(QUrl::fromLocalFile(*it));
} }
} else if (!untracked && act == diff) { } else if (diff && !untracked && act == diff) {
showDiff(QString(), false); showDiff(QString(), false);
} }
} else if (type == GitStatusModel::NodeFile) { } else if (type == GitStatusModel::NodeFile) {
...@@ -895,21 +895,21 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e) ...@@ -895,21 +895,21 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
return unstage({file}); return unstage({file});
} }
return stage({file}); return stage({file});
} else if (act == discardAct && !untracked) { } else if (discardAct && act == discardAct && !untracked) {
auto ret = confirm(this, i18n("Are you sure you want to discard the changes in this file?")); auto ret = confirm(this, i18n("Are you sure you want to discard the changes in this file?"));
if (ret == KMessageBox::Yes) { if (ret == KMessageBox::Yes) {
discard({file}); discard({file});
} }
} else if (act == openAtHead && !untracked) { } else if (openAtHead && act == openAtHead && !untracked) {
openAtHEAD(idx.data(GitStatusModel::FileNameRole).toString()); openAtHEAD(idx.data(GitStatusModel::FileNameRole).toString());
} else if (act == showDiffAct && !untracked) { } else if (showDiffAct && act == showDiffAct && !untracked) {
showDiff(file, staged); showDiff(file, staged);
} else if (act == discardAct && untracked) { } else if (discardAct && act == discardAct && untracked) {
auto ret = confirm(this, i18n("Are you sure you want to remove this file?")); auto ret = confirm(this, i18n("Are you sure you want to remove this file?"));
if (ret == KMessageBox::Yes) { if (ret == KMessageBox::Yes) {
clean({file}); clean({file});
} }
} else if (act == launchDifftoolAct) { } else if (launchDifftoolAct && act == launchDifftoolAct) {
launchExternalDiffTool(idx.data(GitStatusModel::FileNameRole).toString(), staged); launchExternalDiffTool(idx.data(GitStatusModel::FileNameRole).toString(), staged);
} else if (act == openFile) { } else if (act == openFile) {
m_mainWin->openUrl(QUrl::fromLocalFile(file)); m_mainWin->openUrl(QUrl::fromLocalFile(file));
......
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