| 83 | }; |
| 84 | |
| 85 | CheckSetNameEditor::CheckSetNameEditor(CheckSetSelectionListModel* checkSetSelectionListModel, |
| 86 | const QString& defaultName, QWidget* parent) |
| 87 | : QDialog(parent) |
| 88 | { |
| 89 | setWindowTitle(i18nc("@title:window", "Enter Name of New Check Set")); |
| 90 | |
| 91 | auto* layout = new QVBoxLayout(this); |
| 92 | |
| 93 | auto* editLayout = new QHBoxLayout; |
| 94 | |
| 95 | auto* label = new QLabel(i18nc("@label:textbox", "Name:")); |
| 96 | editLayout->addWidget(label); |
| 97 | m_nameEdit = new QLineEdit; |
| 98 | m_nameEdit->setClearButtonEnabled(true); |
| 99 | editLayout->addWidget(m_nameEdit); |
| 100 | layout->addLayout(editLayout); |
| 101 | |
| 102 | auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
| 103 | m_okButton = buttonBox->button(QDialogButtonBox::Ok); |
| 104 | m_okButton->setEnabled(false); |
| 105 | m_okButton->setDefault(true); |
| 106 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); |
| 107 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); |
| 108 | layout->addWidget(buttonBox); |
| 109 | |
| 110 | m_validator = new CheckSetNameValidator(checkSetSelectionListModel, this); |
| 111 | connect(m_nameEdit, &QLineEdit::textChanged, this, &CheckSetNameEditor::handleNameEdit); |
| 112 | |
| 113 | m_nameEdit->setText(defaultName); |
| 114 | m_nameEdit->selectAll(); |
| 115 | } |
| 116 | |
| 117 | QString CheckSetNameEditor::name() const |
| 118 | { |
nothing calls this directly
no test coverage detected