mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 02:45:38 +00:00
Revert 604187b7a3
and 258cd6562a
I did not have time to finish the poppler work and even if this will probably be good for using the poppler work, this adds new API and I don't want to commit to this since having a proper look at making it work Sorry i failed to fulfill my promise
This commit is contained in:
parent
ffbaa091b6
commit
83a052b3ac
|
@ -429,49 +429,3 @@ QString MovieAction::actionTip() const
|
|||
return i18n( "Play movie..." );
|
||||
}
|
||||
#endif
|
||||
|
||||
// FormAction
|
||||
|
||||
class Okular::ResetFormActionPrivate : public Okular::ActionPrivate
|
||||
{
|
||||
public:
|
||||
ResetFormActionPrivate( const QStringList &fieldList, ResetFormAction::Behaviour behaviour )
|
||||
: ActionPrivate(), m_fieldList(fieldList), m_behaviour(behaviour)
|
||||
{
|
||||
}
|
||||
|
||||
QStringList m_fieldList;
|
||||
ResetFormAction::Behaviour m_behaviour;
|
||||
};
|
||||
|
||||
ResetFormAction::ResetFormAction( const QStringList &fieldList, Behaviour behaviour )
|
||||
: Action( *new ResetFormActionPrivate( fieldList, behaviour ) )
|
||||
{
|
||||
}
|
||||
|
||||
ResetFormAction::~ResetFormAction()
|
||||
{
|
||||
}
|
||||
|
||||
Action::ActionType ResetFormAction::actionType() const
|
||||
{
|
||||
return ResetForm;
|
||||
}
|
||||
|
||||
QString ResetFormAction::actionTip() const
|
||||
{
|
||||
return i18n( "Reset Forms" );
|
||||
}
|
||||
|
||||
ResetFormAction::Behaviour ResetFormAction::behaviour() const
|
||||
{
|
||||
Q_D( const Okular::ResetFormAction );
|
||||
return d->m_behaviour;
|
||||
}
|
||||
|
||||
QStringList ResetFormAction::fieldList() const
|
||||
{
|
||||
Q_D( const Okular::ResetFormAction );
|
||||
return d->m_fieldList;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ class ScriptActionPrivate;
|
|||
class MovieActionPrivate;
|
||||
class Sound;
|
||||
class DocumentViewport;
|
||||
class ResetFormActionPrivate;
|
||||
|
||||
/**
|
||||
* @short Encapsulates data that describes an action.
|
||||
|
@ -49,8 +48,7 @@ class OKULAR_EXPORT Action
|
|||
DocAction, ///< Start a custom action
|
||||
Sound, ///< Play a sound
|
||||
Movie, ///< Play a movie
|
||||
Script, ///< Executes a Script code
|
||||
ResetForm ///< Start a reset form action @since 0.14 (KDE 4.8)
|
||||
Script ///< Executes a Script code
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -433,55 +431,6 @@ class MovieAction : public Action
|
|||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The ResetFormAction action resets forms on activation
|
||||
* @since 0.14 (KDE 4.8)
|
||||
*/
|
||||
class OKULAR_EXPORT ResetFormAction : public Action
|
||||
{
|
||||
public:
|
||||
enum Behaviour
|
||||
{
|
||||
ResetAllForms, ///< Reset all the forms in the document
|
||||
ResetFormsInFieldList, ///< Reset the forms whose fully qualified name is in the list
|
||||
ResetAllFormsExceptFieldList ///< Reset all the forms in the document exect those whose fully qualified name is in the list
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new reset form action.
|
||||
*/
|
||||
ResetFormAction( const QStringList &fieldList, Behaviour behaviour );
|
||||
|
||||
/**
|
||||
* Destroys the document action.
|
||||
*/
|
||||
virtual ~ResetFormAction();
|
||||
|
||||
/**
|
||||
* Returns the action type.
|
||||
*/
|
||||
ActionType actionType() const;
|
||||
|
||||
/**
|
||||
* Returns the action tip.
|
||||
*/
|
||||
QString actionTip() const;
|
||||
|
||||
/**
|
||||
* Returns the reset behaviour.
|
||||
*/
|
||||
Behaviour behaviour() const;
|
||||
|
||||
/**
|
||||
* Returns the list of field fully qualified names.
|
||||
*/
|
||||
QStringList fieldList() const;
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE( ResetFormAction )
|
||||
Q_DISABLE_COPY( ResetFormAction )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -78,7 +78,6 @@
|
|||
#include "utils_p.h"
|
||||
#include "view.h"
|
||||
#include "view_p.h"
|
||||
#include "form.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -3003,55 +3002,6 @@ void Document::processAction( const Action * action )
|
|||
//const MovieAction * movie = static_cast< const MovieAction * >( action );
|
||||
// TODO this (Movie action)
|
||||
break;
|
||||
|
||||
case Action::ResetForm: {
|
||||
const ResetFormAction *resetFormAction = static_cast< const ResetFormAction * >( action );
|
||||
foreach( Page *page, d->m_pagesVector )
|
||||
{
|
||||
foreach( FormField* ff, page->formFields() )
|
||||
{
|
||||
bool reset = false;
|
||||
switch (resetFormAction->behaviour())
|
||||
{
|
||||
case ResetFormAction::ResetAllForms:
|
||||
reset = true;
|
||||
break;
|
||||
case ResetFormAction::ResetFormsInFieldList:
|
||||
reset = resetFormAction->fieldList().contains(ff->fullyQualifiedName());
|
||||
break;
|
||||
case ResetFormAction::ResetAllFormsExceptFieldList:
|
||||
reset = !resetFormAction->fieldList().contains(ff->fullyQualifiedName());
|
||||
break;
|
||||
}
|
||||
|
||||
if (reset)
|
||||
{
|
||||
switch (ff->type()) {
|
||||
case Okular::FormField::FormText: {
|
||||
Okular::FormFieldText* fft = static_cast<Okular::FormFieldText *>(ff);
|
||||
if (!fft->isReadOnly()) {
|
||||
fft->setText( fft->defaultValue() );
|
||||
emit formFieldChanged(fft);
|
||||
}
|
||||
} break;
|
||||
|
||||
case Okular::FormField::FormButton: {
|
||||
Okular::FormFieldButton* ffb = static_cast<Okular::FormFieldButton *>(ff);
|
||||
|
||||
if (!ffb->isReadOnly()) {
|
||||
ffb->setState( "true" == ffb->defaultValue() );
|
||||
emit formFieldChanged(ffb);
|
||||
}
|
||||
} break;
|
||||
|
||||
default:
|
||||
kDebug() << "Unhandled form field: " << ff->name() << ff->defaultValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ class DocumentViewport;
|
|||
class EmbeddedFile;
|
||||
class ExportFormat;
|
||||
class FontInfo;
|
||||
class FormField;
|
||||
class Generator;
|
||||
class Action;
|
||||
class Page;
|
||||
|
@ -723,12 +722,6 @@ class OKULAR_EXPORT Document : public QObject
|
|||
* Reports that the current search finished
|
||||
*/
|
||||
void searchFinished( int id, Okular::Document::SearchStatus endStatus );
|
||||
|
||||
/**
|
||||
* Reports that some data of the given form changed
|
||||
* @since 0.14 (KDE 4.8)
|
||||
*/
|
||||
void formFieldChanged( Okular::FormField *formField );
|
||||
|
||||
/**
|
||||
* This signal is emitted whenever a source reference with the given parameters has been
|
||||
|
|
|
@ -50,12 +50,6 @@ FormField::FieldType FormField::type() const
|
|||
return d->m_type;
|
||||
}
|
||||
|
||||
QString FormField::defaultValue() const
|
||||
{
|
||||
Q_D( const FormField );
|
||||
return d->m_default;
|
||||
}
|
||||
|
||||
bool FormField::isReadOnly() const
|
||||
{
|
||||
return false;
|
||||
|
@ -72,12 +66,6 @@ Action* FormField::activationAction() const
|
|||
return d->m_activateAction;
|
||||
}
|
||||
|
||||
QString FormField::fullyQualifiedName() const
|
||||
{
|
||||
Q_D( const FormField );
|
||||
return d->m_fullyQualifiedName;
|
||||
}
|
||||
|
||||
void FormField::setActivationAction( Action *action )
|
||||
{
|
||||
Q_D( FormField );
|
||||
|
@ -85,11 +73,6 @@ void FormField::setActivationAction( Action *action )
|
|||
d->m_activateAction = action;
|
||||
}
|
||||
|
||||
void FormField::setFullyQualifiedName( const QString &name )
|
||||
{
|
||||
Q_D( FormField );
|
||||
d->m_fullyQualifiedName = name;
|
||||
}
|
||||
|
||||
class Okular::FormFieldButtonPrivate : public Okular::FormFieldPrivate
|
||||
{
|
||||
|
|
14
core/form.h
14
core/form.h
|
@ -59,12 +59,6 @@ class OKULAR_EXPORT FormField
|
|||
*/
|
||||
FieldType type() const;
|
||||
|
||||
/**
|
||||
* The field default value.
|
||||
* @since 0.14 (KDE 4.8)
|
||||
*/
|
||||
QString defaultValue() const;
|
||||
|
||||
/**
|
||||
* The bouding rect of the field, in normalized coordinates.
|
||||
*/
|
||||
|
@ -98,12 +92,6 @@ class OKULAR_EXPORT FormField
|
|||
virtual bool isVisible() const;
|
||||
|
||||
Action* activationAction() const;
|
||||
|
||||
/**
|
||||
* The internal fully qualified name of the field
|
||||
* @since 0.14 (KDE 4.8)
|
||||
*/
|
||||
QString fullyQualifiedName() const;
|
||||
|
||||
protected:
|
||||
/// @cond PRIVATE
|
||||
|
@ -113,8 +101,6 @@ class OKULAR_EXPORT FormField
|
|||
/// @endcond
|
||||
|
||||
void setActivationAction( Action *action );
|
||||
/// @since 0.14 (KDE 4.8)
|
||||
void setFullyQualifiedName( const QString &name );
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY( FormField )
|
||||
|
|
|
@ -33,7 +33,6 @@ class FormFieldPrivate
|
|||
FormField::FieldType m_type;
|
||||
QString m_default;
|
||||
Action *m_activateAction;
|
||||
QString m_fullyQualifiedName;
|
||||
|
||||
Q_DECLARE_PUBLIC( FormField )
|
||||
FormField *q_ptr;
|
||||
|
|
1
part.cpp
1
part.cpp
|
@ -399,7 +399,6 @@ m_cliPresentation(false), m_embedMode(detectEmbedMode(parentWidget, parent, args
|
|||
connect( m_document, SIGNAL(error(QString,int)), m_pageView, SLOT(errorMessage(QString,int)) );
|
||||
connect( m_document, SIGNAL(warning(QString,int)), m_pageView, SLOT(warningMessage(QString,int)) );
|
||||
connect( m_document, SIGNAL(notice(QString,int)), m_pageView, SLOT(noticeMessage(QString,int)) );
|
||||
connect( m_document, SIGNAL(formFieldChanged(Okular::FormField*)), m_pageView, SLOT(slotFormFieldChanged(Okular::FormField*)) );
|
||||
connect( m_document, SIGNAL(sourceReferenceActivated(const QString&,int,int,bool*)), this, SLOT(slotHandleActivatedSourceReference(const QString&,int,int,bool*)) );
|
||||
rightLayout->addWidget( m_pageView );
|
||||
m_findBar = new FindBar( m_document, rightContainer );
|
||||
|
|
|
@ -4364,40 +4364,6 @@ void PageView::slotAction( Okular::Action *action )
|
|||
d->document->processAction( action );
|
||||
}
|
||||
|
||||
void PageView::slotFormFieldChanged( Okular::FormField *ff )
|
||||
{
|
||||
QVector< PageViewItem * >::const_iterator dIt = d->items.constBegin(), dEnd = d->items.constEnd();
|
||||
for ( ; dIt != dEnd; ++dIt )
|
||||
{
|
||||
FormWidgetIface *fw = (*dIt)->formWidgets().value( ff->id() );
|
||||
if (fw != NULL)
|
||||
{
|
||||
switch (ff->type()) {
|
||||
case Okular::FormField::FormText: {
|
||||
Okular::FormFieldText* fft = static_cast<Okular::FormFieldText *>(ff);
|
||||
FormLineEdit *le = dynamic_cast<FormLineEdit *>(fw);
|
||||
TextAreaEdit *te = dynamic_cast<TextAreaEdit *>(fw);
|
||||
|
||||
if (le) le->setText( fft->text() );
|
||||
if (te) te->setText( fft->text() );
|
||||
} break;
|
||||
|
||||
case Okular::FormField::FormButton: {
|
||||
Okular::FormFieldButton* ffb = static_cast<Okular::FormFieldButton *>(ff);
|
||||
QAbstractButton *be = dynamic_cast<QAbstractButton *>(fw);
|
||||
if (be) be->setChecked( ffb->state() );
|
||||
} break;
|
||||
|
||||
default:
|
||||
kDebug() << "Unhandled form field: " << ff->name() << ff->defaultValue();
|
||||
break;
|
||||
}
|
||||
|
||||
break; // Found the widget, no need to loop more pages
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PageView::externalKeyPressEvent( QKeyEvent *e )
|
||||
{
|
||||
keyPressEvent( e );
|
||||
|
|
|
@ -37,7 +37,6 @@ class Action;
|
|||
class Document;
|
||||
class DocumentViewport;
|
||||
class Annotation;
|
||||
class FormField;
|
||||
}
|
||||
|
||||
class FormWidgetIface;
|
||||
|
@ -246,7 +245,6 @@ Q_OBJECT
|
|||
void slotSpeakCurrentPage();
|
||||
void slotStopSpeaks();
|
||||
void slotAction( Okular::Action *action );
|
||||
void slotFormFieldChanged( Okular::FormField *formField );
|
||||
void externalKeyPressEvent( QKeyEvent *e );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue