[poppler] Branch 'poppler-0.16' - 2 commits - poppler/Annot.cc qt4/src

Pino Toscano pino at kemper.freedesktop.org
Sun Feb 27 08:12:29 PST 2011


 poppler/Annot.cc        |   12 ++++++------
 qt4/src/poppler-form.cc |   26 ++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 10 deletions(-)

New commits:
commit 5005b9c2738046dc7ddc62cf903499aa93cac204
Author: Pino Toscano <pino at kde.org>
Date:   Sun Feb 27 17:11:53 2011 +0100

    [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

diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc
index 6224b68..8353f91 100644
--- a/qt4/src/poppler-form.cc
+++ b/qt4/src/poppler-form.cc
@@ -188,11 +188,29 @@ FormFieldButton::ButtonType FormFieldButton::buttonType() const
 QString FormFieldButton::caption() const
 {
   FormWidgetButton* fwb = static_cast<FormWidgetButton*>(m_formData->fm);
-  // HACK push buttons seems to have a null GooString for the caption
+  QString ret;
   if (fwb->getButtonType() == formButtonPush)
-    return QString();
-
-  return fwb->getOnStr() ? QString::fromUtf8(fwb->getOnStr()) : QString();
+  {
+    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 (const char *str = fwb->getOnStr())
+    {
+      ret = QString::fromUtf8(str);
+    }
+  }
+  return ret;
 }
 
 bool FormFieldButton::state() const
commit b8aa73d1e0a66e467161f10d11e4d0d66a3336cd
Author: Pino Toscano <pino at kde.org>
Date:   Sun Feb 27 16:24:22 2011 +0100

    annots: 'CA', 'RC' and 'AC' are strings, not names

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 7c0ba8d..1475db3 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -790,22 +790,22 @@ AnnotAppearanceCharacs::AnnotAppearanceCharacs(Dict *dict) {
   }
   obj1.free();
 
-  if (dict->lookup("CA", &obj1)->isName()) {
-    normalCaption = new GooString(obj1.getName());
+  if (dict->lookup("CA", &obj1)->isString()) {
+    normalCaption = new GooString(obj1.getString());
   } else {
     normalCaption = NULL;
   }
   obj1.free();
 
-  if (dict->lookup("RC", &obj1)->isName()) {
-    rolloverCaption = new GooString(obj1.getName());
+  if (dict->lookup("RC", &obj1)->isString()) {
+    rolloverCaption = new GooString(obj1.getString());
   } else {
     rolloverCaption = NULL;
   }
   obj1.free();
 
-  if (dict->lookup("AC", &obj1)->isName()) {
-    alternateCaption = new GooString(obj1.getName());
+  if (dict->lookup("AC", &obj1)->isString()) {
+    alternateCaption = new GooString(obj1.getString());
   } else {
     alternateCaption = NULL;
   }


More information about the poppler mailing list