MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / setupFileMenu

Method setupFileMenu

src/plugins/git/utils/gitmenumanager.cpp:94–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void GitMenuManager::setupFileMenu(const QString &filePath)
95{
96 QString file = filePath;
97 if (file.isEmpty()) {
98 if (!editSrv)
99 editSrv = dpfGetService(EditorService);
100
101 file = editSrv->currentFile();
102 }
103
104 auto mCurFile = ActionManager::instance()->actionContainer(M_GIT_FILE);
105 if (file.isEmpty() || !GitClient::instance()->checkRepositoryExist(file)) {
106 mCurFile->containerAction()->setEnabled(false);
107 return;
108 }
109
110 mCurFile->containerAction()->setEnabled(true);
111 QFileInfo info(file);
112
113 auto fileLogAct = ActionManager::instance()->command(A_GIT_LOG_FILE);
114 fileLogAct->setProperty(GitFilePath, file);
115 fileLogAct->action()->setText(tr("Log of \"%1\"").arg(info.fileName()));
116
117 auto fileBlameAct = ActionManager::instance()->command(A_GIT_BLAME_FILE);
118 fileBlameAct->setProperty(GitFilePath, file);
119 fileBlameAct->action()->setText(tr("Blame of \"%1\"").arg(info.fileName()));
120
121 auto fileDiffAct = ActionManager::instance()->command(A_GIT_DIFF_FILE);
122 fileDiffAct->setProperty(GitFilePath, file);
123 fileDiffAct->action()->setText(tr("Diff of \"%1\"").arg(info.fileName()));
124}
125
126QAction *GitMenuManager::gitAction() const
127{

Callers 1

Calls 11

actionContainerMethod · 0.80
checkRepositoryExistMethod · 0.80
containerActionMethod · 0.80
fileNameMethod · 0.80
isEmptyMethod · 0.45
currentFileMethod · 0.45
setEnabledMethod · 0.45
commandMethod · 0.45
setPropertyMethod · 0.45
setTextMethod · 0.45
actionMethod · 0.45

Tested by

no test coverage detected