Commit 9f19fc3d authored by Fabio D'Urso's avatar Fabio D'Urso
Browse files

PDF documents: Tell the user that XFA forms are not supported yet

parent e9189c0d
......@@ -1236,6 +1236,15 @@ QVariant PDFGenerator::metaData( const QString & key, const QVariant & option )
QMutexLocker ml(userMutex());
return pdfdoc->scripts();
}
else if ( key == "HasUnsupportedXfaForm" )
{
#ifdef HAVE_POPPLER_0_22
QMutexLocker ml(userMutex());
return pdfdoc->formType() == Poppler::Document::XfaForm;
#else
return false;
#endif
}
return QVariant();
}
......
......@@ -415,7 +415,6 @@ m_cliPresentation(false), m_embedMode(detectEmbedMode(parentWidget, parent, args
connect( m_topMessage, SIGNAL(action()), this, SLOT(slotShowEmbeddedFiles()) );
rightLayout->addWidget( m_topMessage );
m_formsMessage = new PageViewTopMessage( rightContainer );
m_formsMessage->setup( i18n( "This document has forms. Click on the button to interact with them, or use View -> Show Forms." ) );
rightLayout->addWidget( m_formsMessage );
m_pageView = new PageView( rightContainer, m_document );
QMetaObject::invokeMethod( m_pageView, "setFocus", Qt::QueuedConnection ); //usability setting
......@@ -1216,8 +1215,24 @@ bool Part::openFile()
bool hasEmbeddedFiles = ok && m_document->embeddedFiles() && m_document->embeddedFiles()->count() > 0;
if ( m_showEmbeddedFiles ) m_showEmbeddedFiles->setEnabled( hasEmbeddedFiles );
m_topMessage->setVisible( hasEmbeddedFiles );
// Warn the user that XFA forms are not supported yet (NOTE: poppler generator only)
if ( ok && m_document->metaData( "HasUnsupportedXfaForm" ).toBool() == true )
{
m_formsMessage->setup( i18n( "This document has XFA forms, which are currently <b>unsupported</b>." ), KIcon( "dialog-warning" ) );
m_formsMessage->setVisible( true );
}
// m_pageView->toggleFormsAction() may be null on dummy mode
m_formsMessage->setVisible( ok && m_pageView->toggleFormsAction() && m_pageView->toggleFormsAction()->isEnabled() );
else if ( ok && m_pageView->toggleFormsAction() && m_pageView->toggleFormsAction()->isEnabled() )
{
m_formsMessage->setup( i18n( "This document has forms. Click on the button to interact with them, or use View -> Show Forms." ) );
m_formsMessage->setVisible( true );
}
else
{
m_formsMessage->setVisible( false );
}
if ( m_showPresentation ) m_showPresentation->setEnabled( ok );
if ( ok )
{
......
......@@ -411,20 +411,22 @@ PageViewTopMessage::PageViewTopMessage( QWidget * parent )
void PageViewTopMessage::setup( const QString & message, const KIcon& icon )
{
m_label->setText( message );
resize( minimumSizeHint() );
if ( icon.isNull() )
{
m_icon->setPixmap( QPixmap() );
m_icon->setVisible( false );
}
else
{
m_icon->setPixmap( icon.pixmap( m_icon->size() ) );
m_icon->setVisible( true );
}
resize( minimumSizeHint() );
}
void PageViewTopMessage::setIconSize( int size )
{
m_icon->resize( size, size );
m_icon->setFixedSize( size, size );
}
void PageViewTopMessage::setActionButton( QAction * action )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment