MCPcopy Create free account
hub / github.com/KDE/kdevelop / batchModeEditButtonClicked

Method batchModeEditButtonClicked

kdevplatform/shell/settings/environmentwidget.cpp:230–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void 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
265void EnvironmentWidget::addProfile()
266{

Callers

nothing calls this directly

Calls 10

setPlaceholderTextMethod · 0.80
buttonMethod · 0.80
execMethod · 0.80
rowCountMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
indexMethod · 0.45
appendMethod · 0.45
addWidgetMethod · 0.45

Tested by

no test coverage detected