| 617 | } |
| 618 | |
| 619 | void ProjectTree::actionRenameDocument(const QStandardItem *item) |
| 620 | { |
| 621 | auto dialog = new DDialog(this); |
| 622 | auto inputEdit = new DLineEdit(dialog); |
| 623 | |
| 624 | inputEdit->setPlaceholderText(tr("New Document Name")); |
| 625 | inputEdit->lineEdit()->setAlignment(Qt::AlignLeft); |
| 626 | |
| 627 | dialog->setAttribute(Qt::WA_DeleteOnClose); |
| 628 | dialog->setWindowTitle(tr("Rename")); |
| 629 | |
| 630 | dialog->addContent(inputEdit); |
| 631 | dialog->addButton(tr("Ok"), true, DDialog::ButtonRecommend); |
| 632 | |
| 633 | QObject::connect(dialog, &DDialog::buttonClicked, dialog, [=]() { |
| 634 | if (!inputEdit->text().isEmpty()) { |
| 635 | renameDocument(item, inputEdit->text()); |
| 636 | } |
| 637 | dialog->close(); |
| 638 | }); |
| 639 | |
| 640 | dialog->exec(); |
| 641 | } |
| 642 | |
| 643 | void ProjectTree::renameDocument(const QStandardItem *item, const QString &newFileName) |
| 644 | { |
nothing calls this directly
no test coverage detected