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

Method actionDeleteDocument

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

Source from the content-addressed store, hash-verified

747}
748
749void 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
778void ProjectTree::actionOpenInTerminal(const QStandardItem *menuItem)
779{

Callers

nothing calls this directly

Calls 11

indexFromItemMethod · 0.80
fileNameMethod · 0.80
getFunction · 0.50
toStringMethod · 0.45
dataMethod · 0.45
setMessageMethod · 0.45
setIconMethod · 0.45
execMethod · 0.45
removeMethod · 0.45
filePathMethod · 0.45
kitNameMethod · 0.45

Tested by

no test coverage detected