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

Method accept

plugins/filetemplates/templateclassassistant.cpp:537–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537void TemplateClassAssistant::accept()
538{
539 // next() is not called for the last page (when the user clicks Finish), so we have to set output locations here
540 const QHash<QString, QUrl> fileUrls = d->outputPageWidget->fileUrls();
541 QHash<QString, KTextEditor::Cursor> filePositions = d->outputPageWidget->filePositions();
542
543 DocumentChangeSet changes;
544 if (d->generator)
545 {
546 QHash<QString, QUrl>::const_iterator it = fileUrls.constBegin();
547 for (; it != fileUrls.constEnd(); ++it)
548 {
549 d->generator->setFileUrl(it.key(), it.value());
550 d->generator->setFilePosition(it.key(), filePositions.value(it.key()));
551 }
552
553 d->generator->addVariables(d->templateOptions);
554 changes = d->generator->generate();
555 }
556 else
557 {
558 changes = d->renderer->renderFileTemplate(d->fileTemplate, d->baseUrl, fileUrls);
559 }
560
561 d->addFilesToTarget(fileUrls);
562 changes.applyAllChanges();
563
564 // Open the generated files in the editor
565 for (const QUrl& url : fileUrls) {
566 ICore::self()->documentController()->openDocument(url);
567 }
568
569 KAssistantDialog::accept();
570}
571
572void TemplateClassAssistant::setCurrentPageValid(bool valid)
573{

Callers

nothing calls this directly

Calls 15

filePositionsMethod · 0.80
constBeginMethod · 0.80
constEndMethod · 0.80
setFileUrlMethod · 0.80
setFilePositionMethod · 0.80
renderFileTemplateMethod · 0.80
applyAllChangesMethod · 0.80
documentControllerMethod · 0.80
fileUrlsMethod · 0.45
keyMethod · 0.45
valueMethod · 0.45
addVariablesMethod · 0.45

Tested by

no test coverage detected