| 228 | } |
| 229 | |
| 230 | void EnvironmentWidget::batchModeEditButtonClicked() |
| 231 | { |
| 232 | ScopedDialog<QDialog> dialog(this); |
| 233 | dialog->setWindowTitle( i18nc("@title:window", "Batch Edit Mode" ) ); |
| 234 | |
| 235 | auto *layout = new QVBoxLayout(dialog); |
| 236 | |
| 237 | auto edit = new QPlainTextEdit; |
| 238 | edit->setPlaceholderText(QStringLiteral("VARIABLE1=VALUE1\nVARIABLE2=VALUE2")); |
| 239 | QString text; |
| 240 | for (int i = 0; i < m_proxyModel->rowCount(); ++i) { |
| 241 | const auto variable = m_proxyModel->index(i, EnvironmentProfileModel::VariableColumn).data().toString(); |
| 242 | const auto value = m_proxyModel->index(i, EnvironmentProfileModel::ValueColumn).data().toString(); |
| 243 | text.append(variable + QLatin1Char('=') + value + QLatin1Char('\n')); |
| 244 | } |
| 245 | edit->setPlainText(text); |
| 246 | layout->addWidget( edit ); |
| 247 | |
| 248 | auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); |
| 249 | auto okButton = buttonBox->button(QDialogButtonBox::Ok); |
| 250 | okButton->setDefault(true); |
| 251 | okButton->setShortcut(Qt::CTRL | Qt::Key_Return); |
| 252 | dialog->connect(buttonBox, &QDialogButtonBox::accepted, dialog.data(), &QDialog::accept); |
| 253 | dialog->connect(buttonBox, &QDialogButtonBox::rejected, dialog.data(), &QDialog::reject); |
| 254 | layout->addWidget(buttonBox); |
| 255 | |
| 256 | dialog->resize(600, 400); |
| 257 | |
| 258 | if ( dialog->exec() != QDialog::Accepted ) { |
| 259 | return; |
| 260 | } |
| 261 | |
| 262 | m_environmentProfileModel->setVariablesFromString(edit->toPlainText()); |
| 263 | } |
| 264 | |
| 265 | void EnvironmentWidget::addProfile() |
| 266 | { |
nothing calls this directly
no test coverage detected