summaryrefslogtreecommitdiff
path: root/qt4
diff options
context:
space:
mode:
authorPino Toscano <pino@kde.org>2011-02-27 16:39:59 +0100
committerPino Toscano <pino@kde.org>2011-02-27 16:39:59 +0100
commite927384897595f1bda5f7e41b552602f9cc8ed95 (patch)
tree98233f7309e095213ee040d1a7a1529b4f822df3 /qt4
parent5b24ee2c934feea1b7d46c8ec423d1c547258be2 (diff)
[qt4] fix caption of push button fields
instead of asking the 'onStr' of the underlying form widget, take (if available) the 'MK' entry, i.e. the appearance characteristics dictionary, and use the normal caption of that
Diffstat (limited to 'qt4')
-rw-r--r--qt4/src/poppler-form.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 40376e55..5c546819 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -200,8 +200,29 @@ FormFieldButton::ButtonType FormFieldButton::buttonType() const
QString FormFieldButton::caption() const
{
FormWidgetButton* fwb = static_cast<FormWidgetButton*>(m_formData->fm);
- GooString *goo = fwb->getOnStr();
- return goo ? QString::fromUtf8(goo->getCString()) : QString();
+ QString ret;
+ if (fwb->getButtonType() == formButtonPush)
+ {
+ Dict *dict = m_formData->fm->getObj()->getDict();
+ Object obj1;
+ if (dict->lookup("MK", &obj1)->isDict())
+ {
+ AnnotAppearanceCharacs appearCharacs(obj1.getDict());
+ if (appearCharacs.getNormalCaption())
+ {
+ ret = UnicodeParsedString(appearCharacs.getNormalCaption());
+ }
+ }
+ obj1.free();
+ }
+ else
+ {
+ if (GooString *goo = fwb->getOnStr())
+ {
+ ret = QString::fromUtf8(goo->getCString());
+ }
+ }
+ return ret;
}
bool FormFieldButton::state() const