Commit fb8f96f2 authored by Méven Car's avatar Méven Car
Browse files

Project git tree : Fix single file click and context menus action

parent 08981495
...@@ -648,7 +648,7 @@ void GitWidget::handleClick(const QModelIndex &idx, ClickAction clickAction) ...@@ -648,7 +648,7 @@ void GitWidget::handleClick(const QModelIndex &idx, ClickAction clickAction)
return; return;
} }
const QString file = m_gitPath + idx.data(GitStatusModel::FileNameRole).toString(); const QString file = idx.data(GitStatusModel::FileNameRole).toString();
bool staged = idx.internalId() == GitStatusModel::NodeStage; bool staged = idx.internalId() == GitStatusModel::NodeStage;
if (clickAction == ClickAction::StageUnstage) { if (clickAction == ClickAction::StageUnstage) {
...@@ -663,7 +663,7 @@ void GitWidget::handleClick(const QModelIndex &idx, ClickAction clickAction) ...@@ -663,7 +663,7 @@ void GitWidget::handleClick(const QModelIndex &idx, ClickAction clickAction)
} }
if (clickAction == ClickAction::OpenFile) { if (clickAction == ClickAction::OpenFile) {
m_mainWin->openUrl(QUrl::fromLocalFile(file)); m_mainWin->openUrl(QUrl::fromLocalFile(m_gitPath + file));
} }
} }
...@@ -978,7 +978,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e) ...@@ -978,7 +978,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
return; return;
} }
const QString file = m_gitPath + idx.data(GitStatusModel::FileNameRole).toString(); const QString file = idx.data(GitStatusModel::FileNameRole).toString();
if (act == stageAct) { if (act == stageAct) {
if (staged) { if (staged) {
return unstage({file}); return unstage({file});
...@@ -1001,7 +1001,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e) ...@@ -1001,7 +1001,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
} else if (act == launchDifftoolAct) { } else if (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(m_gitPath + QLatin1Char('/') + file));
} }
} else if (type == GitStatusModel::NodeStage) { } else if (type == GitStatusModel::NodeStage) {
QMenu menu; QMenu menu;
......
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