Make the push buttons of forms trigger their activation action, if present.

svn path=/trunk/KDE/kdegraphics/okular/; revision=788108
This commit is contained in:
Pino Toscano 2008-03-20 17:45:37 +00:00
parent 67cec6ac9e
commit 082c385295
4 changed files with 28 additions and 0 deletions

View file

@ -30,6 +30,11 @@ void FormWidgetsController::signalChanged( FormWidgetIface *w )
emit changed( w );
}
void FormWidgetsController::signalAction( Okular::Action *a )
{
emit action( a );
}
QButtonGroup* FormWidgetsController::registerRadioButton( FormWidgetIface* widget, const QList< int >& siblings )
{
if ( !widget->button() )
@ -212,6 +217,14 @@ PushButtonEdit::PushButtonEdit( Okular::FormFieldButton * button, QWidget * pare
setText( m_form->caption() );
setEnabled( !m_form->isReadOnly() );
setVisible( m_form->isVisible() );
connect( this, SIGNAL( clicked() ), this, SLOT( slotClicked() ) );
}
void PushButtonEdit::slotClicked()
{
if ( m_form->activationAction() )
m_controller->signalAction( m_form->activationAction() );
}

View file

@ -27,6 +27,7 @@ class PageViewItem;
class RadioButtonEdit;
namespace Okular {
class Action;
class FormField;
class FormFieldButton;
class FormFieldChoice;
@ -50,12 +51,14 @@ class FormWidgetsController : public QObject
virtual ~FormWidgetsController();
void signalChanged( FormWidgetIface *w );
void signalAction( Okular::Action *action );
QButtonGroup* registerRadioButton( FormWidgetIface* widget, const QList< int >& siblings );
void dropRadioButtons();
signals:
void changed( FormWidgetIface *w );
void action( Okular::Action *action );
private slots:
void slotButtonClicked( QAbstractButton *button );
@ -108,6 +111,9 @@ class PushButtonEdit : public QPushButton, public FormWidgetIface
public:
PushButtonEdit( Okular::FormFieldButton * button, QWidget * parent = 0 );
private slots:
void slotClicked();
private:
Okular::FormFieldButton * m_form;
};

View file

@ -172,6 +172,8 @@ FormWidgetsController* PageViewPrivate::formWidgetsController()
formsWidgetController = new FormWidgetsController();
QObject::connect( formsWidgetController, SIGNAL( changed( FormWidgetIface* ) ),
q, SLOT( slotFormWidgetChanged( FormWidgetIface * ) ) );
QObject::connect( formsWidgetController, SIGNAL( action( Okular::Action* ) ),
q, SLOT( slotAction( Okular::Action* ) ) );
}
return formsWidgetController;
@ -3210,6 +3212,11 @@ void PageView::slotStopSpeaks()
d->m_tts->stopAllSpeechs();
}
void PageView::slotAction( Okular::Action *action )
{
d->document->processAction( action );
}
//END private SLOTS
#include "pageview.moc"

View file

@ -31,6 +31,7 @@ class KActionCollection;
class KUrl;
namespace Okular {
class Action;
class Document;
class Annotation;
}
@ -200,6 +201,7 @@ Q_OBJECT
void slotSpeakDocument();
void slotSpeakCurrentPage();
void slotStopSpeaks();
void slotAction( Okular::Action *action );
};
#endif