MCPcopy Create free account
hub / github.com/KDE/okular / end

Method end

part/pageviewannotator.cpp:394–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392 }
393
394 QList<Okular::Annotation *> end() override
395 {
396 rect.left = qMin(startpoint.x, point.x);
397 rect.top = qMin(startpoint.y, point.y);
398 rect.right = qMax(startpoint.x, point.x);
399 rect.bottom = qMax(startpoint.y, point.y);
400
401 clicked = false;
402
403 // find out annotation's type
404 Okular::SignatureAnnotation *ann = new Okular::SignatureAnnotation();
405 ann->setFlags(ann->flags() | Okular::Annotation::FixedRotation);
406
407 const QString certSubjectCommonName = m_signingInformation->certificate->subjectInfo(Okular::CertificateInfo::CommonName, Okular::CertificateInfo::EmptyString::TranslatedNotAvailable);
408 const QString datetime = QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss t"));
409 const QString signatureText = i18n("Signed by: %1\n\nDate: %2", certSubjectCommonName, datetime);
410
411 m_creationCompleted = false;
412 clicked = false;
413 // safety check
414 if (!ann) {
415 return QList<Okular::Annotation *>();
416 }
417
418 ann->setLeftText(certSubjectCommonName);
419 ann->setText(signatureText);
420 ann->setImagePath(m_signingInformation->backgroundImagePath);
421
422#if HAVE_AUTOMATIC_SIGNATURE_FONT_SIZE
423 // 0 means "Chose an appropriate size"
424 ann->setLeftFontSize(0);
425 ann->setFontSize(0);
426#endif
427
428 // set the bounding rectangle, and make sure that the newly created
429 // annotation lies within the page by translating it if necessary
430 if (rect.right > 1) {
431 rect.left -= rect.right - 1;
432 rect.right = 1;
433 }
434 if (rect.bottom > 1) {
435 rect.top -= rect.bottom - 1;
436 rect.bottom = 1;
437 }
438 ann->setBoundingRectangle(rect);
439
440 return QList<Okular::Annotation *>() << ann;
441 }
442
443 bool isAccepted() const
444 {

Callers

nothing calls this directly

Calls 13

setFlagsMethod · 0.80
subjectInfoMethod · 0.80
toStringMethod · 0.80
setLeftTextMethod · 0.80
setImagePathMethod · 0.80
QStringClass · 0.70
flagsMethod · 0.45
setTextMethod · 0.45
setLeftFontSizeMethod · 0.45
setFontSizeMethod · 0.45
setBoundingRectangleMethod · 0.45
widthMethod · 0.45

Tested by

no test coverage detected