| 535 | } |
| 536 | |
| 537 | void 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 | |
| 572 | void TemplateClassAssistant::setCurrentPageValid(bool valid) |
| 573 | { |
nothing calls this directly
no test coverage detected