|
4 | 4 | #include <ui/widgets/button/button.h> |
5 | 5 | #include <ui/widgets/check_box/check_box.h> |
6 | 6 | #include <ui/widgets/combo_box/combo_box.h> |
| 7 | +#include <ui/widgets/dialog/dialog.h> |
7 | 8 | #include <ui/widgets/icon_button/icon_button.h> |
8 | 9 | #include <ui/widgets/label/label.h> |
9 | 10 | #include <ui/widgets/label/link_label.h> |
@@ -900,8 +901,22 @@ AiAssistantView::AiAssistantView(QWidget* _parent) |
900 | 901 | d->translateSourceText->text(), |
901 | 902 | d->translateLanguage->currentIndex().data(Qt::UserRole).toString()); |
902 | 903 | } else { |
903 | | - emit translateDocumentRequested( |
904 | | - d->translateLanguage->currentIndex().data(Qt::UserRole).toString()); |
| 904 | + auto dialog = new Dialog(topLevelWidget()); |
| 905 | + dialog->setContentMaximumWidth(Ui::DesignSystem::dialog().maximumWidth()); |
| 906 | + dialog->showDialog({}, |
| 907 | + tr("Translation will be loaded in the current document and fully " |
| 908 | + "replaced content. Do you want to continue?"), |
| 909 | + { { 0, tr("Cancel"), Dialog::RejectButton }, |
| 910 | + { 1, tr("Yes, translate"), Dialog::AcceptButton } }); |
| 911 | + connect(dialog, &Dialog::finished, this, |
| 912 | + [this, dialog](const Dialog::ButtonInfo& _presedButton) { |
| 913 | + dialog->hideDialog(); |
| 914 | + if (_presedButton.type == Dialog::AcceptButton) { |
| 915 | + emit translateDocumentRequested( |
| 916 | + d->translateLanguage->currentIndex().data(Qt::UserRole).toString()); |
| 917 | + } |
| 918 | + }); |
| 919 | + QObject::connect(dialog, &Dialog::disappeared, dialog, &Dialog::deleteLater); |
905 | 920 | } |
906 | 921 | }); |
907 | 922 | connect(d->translateInsertButton, &Button::clicked, this, |
|
0 commit comments