Changeset View
Changeset View
Standalone View
Standalone View
core/textdocumentgenerator.cpp
Show First 20 Lines • Show All 302 Lines • ▼ Show 20 Line(s) | 301 | { | |||
---|---|---|---|---|---|
303 | const Document::OpenResult openResult = d->mConverter->convertWithPassword( fileName, password ); | 303 | const Document::OpenResult openResult = d->mConverter->convertWithPassword( fileName, password ); | ||
304 | 304 | | |||
305 | if ( openResult != Document::OpenSuccess ) | 305 | if ( openResult != Document::OpenSuccess ) | ||
306 | { | 306 | { | ||
307 | d->mDocument = nullptr; | 307 | d->mDocument = nullptr; | ||
308 | 308 | | |||
309 | // loading failed, cleanup all the stuff eventually gathered from the converter | 309 | // loading failed, cleanup all the stuff eventually gathered from the converter | ||
310 | d->mTitlePositions.clear(); | 310 | d->mTitlePositions.clear(); | ||
311 | Q_FOREACH ( const TextDocumentGeneratorPrivate::LinkPosition &linkPos, d->mLinkPositions ) | 311 | for ( const TextDocumentGeneratorPrivate::LinkPosition &linkPos : qAsConst(d->mLinkPositions) ) | ||
312 | { | 312 | { | ||
313 | delete linkPos.link; | 313 | delete linkPos.link; | ||
314 | } | 314 | } | ||
315 | d->mLinkPositions.clear(); | 315 | d->mLinkPositions.clear(); | ||
316 | Q_FOREACH ( const TextDocumentGeneratorPrivate::AnnotationPosition &annPos, d->mAnnotationPositions ) | 316 | for ( const TextDocumentGeneratorPrivate::AnnotationPosition &annPos : qAsConst(d->mAnnotationPositions) ) | ||
317 | { | 317 | { | ||
318 | delete annPos.annotation; | 318 | delete annPos.annotation; | ||
319 | } | 319 | } | ||
320 | d->mAnnotationPositions.clear(); | 320 | d->mAnnotationPositions.clear(); | ||
321 | 321 | | |||
322 | return openResult; | 322 | return openResult; | ||
323 | } | 323 | } | ||
324 | d->mDocument = d->mConverter->document(); | 324 | d->mDocument = d->mConverter->document(); | ||
▲ Show 20 Lines • Show All 246 Lines • ▼ Show 20 Line(s) | |||||
571 | } | 571 | } | ||
572 | 572 | | |||
573 | void TextDocumentGenerator::setTextDocument( QTextDocument *textDocument ) | 573 | void TextDocumentGenerator::setTextDocument( QTextDocument *textDocument ) | ||
574 | { | 574 | { | ||
575 | Q_D( TextDocumentGenerator ); | 575 | Q_D( TextDocumentGenerator ); | ||
576 | 576 | | |||
577 | d->mDocument = textDocument; | 577 | d->mDocument = textDocument; | ||
578 | 578 | | |||
579 | Q_FOREACH (Page *p, d->m_document->m_pagesVector ) | 579 | for (Page *p : qAsConst(d->m_document->m_pagesVector)) | ||
580 | { | 580 | { | ||
581 | p->setTextPage( nullptr ); | 581 | p->setTextPage( nullptr ); | ||
582 | } | 582 | } | ||
583 | } | 583 | } | ||
584 | 584 | | |||
585 | #include "moc_textdocumentgenerator.cpp" | 585 | #include "moc_textdocumentgenerator.cpp" | ||
586 | 586 | |