| 776 | } |
| 777 | |
| 778 | void 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 | |
| 800 | bool ProjectTree::createNewDirectory(const QStandardItem *item, const QString &dirName) |
| 801 | { |
nothing calls this directly
no test coverage detected