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

Method actionOpenInTerminal

src/plugins/project/mainframe/projecttree.cpp:778–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

776}
777
778void ProjectTree::actionOpenInTerminal(const QStandardItem *menuItem)
779{
780 if (!menuItem)
781 return;
782
783 QModelIndex index = d->itemModel->indexFromItem(menuItem);
784 QFileInfo fileInfo(index.data(Qt::ToolTipRole).toString());
785
786 QString dirPath;
787 if (fileInfo.isFile())
788 dirPath = fileInfo.dir().path();
789 else if (fileInfo.isDir())
790 dirPath = fileInfo.filePath();
791
792 auto terminalService = dpfGetService(TerminalService);
793 if (terminalService) {
794 terminalService->sendCommand(QString("cd %1\n").arg(dirPath));
795 terminalService->sendCommand(QString("clear\n"));
796 uiController.switchContext(TERMINAL_TAB_TEXT);
797 }
798}
799
800bool ProjectTree::createNewDirectory(const QStandardItem *item, const QString &dirName)
801{

Callers

nothing calls this directly

Calls 7

indexFromItemMethod · 0.80
sendCommandMethod · 0.80
QStringClass · 0.50
toStringMethod · 0.45
dataMethod · 0.45
pathMethod · 0.45
filePathMethod · 0.45

Tested by

no test coverage detected