| 747 | } |
| 748 | |
| 749 | void ProjectTree::actionDeleteDocument(QStandardItem *item) |
| 750 | { |
| 751 | QModelIndex index = d->itemModel->indexFromItem(item); |
| 752 | QFileInfo info(index.data(Qt::ToolTipRole).toString()); |
| 753 | if (!info.isFile()) |
| 754 | return; |
| 755 | |
| 756 | QString message = tr("Delete operation not be recoverable, delete anyway?"); |
| 757 | |
| 758 | DDialog dialog; |
| 759 | dialog.setMessage(message); |
| 760 | dialog.setWindowTitle(tr("Delete: ") + info.fileName()); |
| 761 | dialog.setIcon(QIcon::fromTheme("dialog-warning")); |
| 762 | dialog.insertButton(0, tr("Ok")); |
| 763 | dialog.insertButton(1, tr("Cancel")); |
| 764 | int code = dialog.exec(); |
| 765 | |
| 766 | if (code == 1) |
| 767 | return; |
| 768 | |
| 769 | QFile(info.filePath()).remove(); |
| 770 | |
| 771 | // notify file deleted event. |
| 772 | QStandardItem *root = ProjectGenerator::root(item); |
| 773 | auto projectInfo = ProjectInfo::get(root); |
| 774 | |
| 775 | project.fileDeleted(info.filePath(), projectInfo.kitName()); |
| 776 | } |
| 777 | |
| 778 | void ProjectTree::actionOpenInTerminal(const QStandardItem *menuItem) |
| 779 | { |
nothing calls this directly
no test coverage detected