| 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 | { |
nothing calls this directly
no test coverage detected