Changeset View
Changeset View
Standalone View
Standalone View
generators/poppler/formfields.cpp
1 | /*************************************************************************** | 1 | /*************************************************************************** | ||
---|---|---|---|---|---|
2 | * Copyright (C) 2007 by Pino Toscano <pino@kde.org> * | 2 | * Copyright (C) 2007 by Pino Toscano <pino@kde.org> * | ||
3 | * Copyright (C) 2018 by Intevation GmbH <intevation@intevation.de> * | 3 | * Copyright (C) 2018 by Intevation GmbH <intevation@intevation.de> * | ||
4 | * * | 4 | * * | ||
5 | * This program is free software; you can redistribute it and/or modify * | 5 | * This program is free software; you can redistribute it and/or modify * | ||
6 | * it under the terms of the GNU General Public License as published by * | 6 | * it under the terms of the GNU General Public License as published by * | ||
7 | * the Free Software Foundation; either version 2 of the License, or * | 7 | * the Free Software Foundation; either version 2 of the License, or * | ||
8 | * (at your option) any later version. * | 8 | * (at your option) any later version. * | ||
9 | ***************************************************************************/ | 9 | ***************************************************************************/ | ||
10 | 10 | | |||
11 | #include "formfields.h" | 11 | #include "formfields.h" | ||
12 | 12 | | |||
13 | #include "core/action.h" | 13 | #include "core/action.h" | ||
14 | 14 | | |||
15 | #include "pdfsignatureutils.h" | ||||
16 | | ||||
15 | #include <poppler-qt5.h> | 17 | #include <poppler-qt5.h> | ||
16 | 18 | | |||
17 | #include <config-okular-poppler.h> | 19 | #include <config-okular-poppler.h> | ||
18 | 20 | | |||
19 | extern Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink, bool deletePopplerLink = true); | 21 | extern Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink, bool deletePopplerLink = true); | ||
20 | #ifdef HAVE_POPPLER_0_65 | 22 | #ifdef HAVE_POPPLER_0_65 | ||
21 | # define SET_ANNOT_ACTIONS \ | 23 | # define SET_ANNOT_ACTIONS \ | ||
22 | setAdditionalAction( Okular::Annotation::CursorEntering, createLinkFromPopplerLink( field->additionalAction( Poppler::Annotation::CursorEnteringAction ) ) ); \ | 24 | setAdditionalAction( Okular::Annotation::CursorEntering, createLinkFromPopplerLink( field->additionalAction( Poppler::Annotation::CursorEnteringAction ) ) ); \ | ||
▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Line(s) | 363 | { | |||
362 | return Qt::AlignTop | m_field->textAlignment(); | 364 | return Qt::AlignTop | m_field->textAlignment(); | ||
363 | } | 365 | } | ||
364 | 366 | | |||
365 | bool PopplerFormFieldChoice::canBeSpellChecked() const | 367 | bool PopplerFormFieldChoice::canBeSpellChecked() const | ||
366 | { | 368 | { | ||
367 | return m_field->canBeSpellChecked(); | 369 | return m_field->canBeSpellChecked(); | ||
368 | } | 370 | } | ||
369 | 371 | | |||
372 | PopplerFormFieldSignature::PopplerFormFieldSignature( Poppler::FormFieldSignature * field ) | ||||
373 | : Okular::FormFieldSignature(), m_field( field ), m_info( nullptr ) | ||||
374 | { | ||||
375 | m_rect = Okular::NormalizedRect::fromQRectF( m_field->rect() ); | ||||
376 | m_id = m_field->id(); | ||||
377 | m_info = new PopplerSignatureInfo( m_field->validate( Poppler::FormFieldSignature::ValidateVerifyCertificate ) ); | ||||
378 | SET_ACTIONS | ||||
379 | } | ||||
370 | 380 | | |||
381 | PopplerFormFieldSignature::~PopplerFormFieldSignature() | ||||
382 | { | ||||
383 | delete m_field; | ||||
384 | delete m_info; | ||||
385 | } | ||||
386 | | ||||
387 | Okular::NormalizedRect PopplerFormFieldSignature::rect() const | ||||
388 | { | ||||
389 | return m_rect; | ||||
390 | } | ||||
391 | | ||||
392 | int PopplerFormFieldSignature::id() const | ||||
393 | { | ||||
394 | return m_id; | ||||
395 | } | ||||
396 | | ||||
397 | QString PopplerFormFieldSignature::name() const | ||||
398 | { | ||||
399 | return m_field->name(); | ||||
400 | } | ||||
401 | | ||||
402 | QString PopplerFormFieldSignature::uiName() const | ||||
403 | { | ||||
404 | return m_field->uiName(); | ||||
405 | } | ||||
406 | | ||||
407 | bool PopplerFormFieldSignature::isReadOnly() const | ||||
408 | { | ||||
409 | return m_field->isReadOnly(); | ||||
410 | } | ||||
411 | | ||||
412 | bool PopplerFormFieldSignature::isVisible() const | ||||
413 | { | ||||
414 | return m_field->isVisible(); | ||||
415 | } | ||||
416 | | ||||
417 | PopplerFormFieldSignature::SignatureType PopplerFormFieldSignature::signatureType() const | ||||
418 | { | ||||
419 | switch ( m_field->signatureType() ) | ||||
420 | { | ||||
421 | case Poppler::FormFieldSignature::AdbePkcs7sha1: | ||||
422 | return Okular::FormFieldSignature::AdbePkcs7sha1; | ||||
423 | case Poppler::FormFieldSignature::AdbePkcs7detached: | ||||
424 | return Okular::FormFieldSignature::AdbePkcs7detached; | ||||
425 | case Poppler::FormFieldSignature::EtsiCAdESdetached: | ||||
426 | return Okular::FormFieldSignature::EtsiCAdESdetached; | ||||
427 | default: | ||||
428 | return Okular::FormFieldSignature::UnknownType; | ||||
429 | } | ||||
430 | } | ||||
431 | | ||||
432 | Okular::SignatureInfo *PopplerFormFieldSignature::validate() const | ||||
433 | { | ||||
434 | return m_info; | ||||
435 | } |