[poppler] poppler/qt4/src: poppler-document.cc, 1.9, 1.10 poppler-qt4.h, 1.15, 1.16

Brad Hards bradh at freedesktop.org
Wed Dec 7 00:31:12 PST 2005


Update of /cvs/poppler/poppler/qt4/src
In directory gabe:/tmp/cvs-serv22115/qt4/src

Modified Files:
	poppler-document.cc poppler-qt4.h 
Log Message:
Add infoKeys() - allows you to get a list of all the string names (keys)
for the metadata.


Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-document.cc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- poppler-document.cc	6 Aug 2005 02:15:58 -0000	1.9
+++ poppler-document.cc	7 Dec 2005 08:31:09 -0000	1.10
@@ -240,6 +240,28 @@
 	return NULL;
     }
 
+    QStringList Document::infoKeys() const
+    {
+	QStringList keys;
+
+	Object info;
+	if ( m_doc->locked )
+	    return QStringList();
+
+	m_doc->doc.getDocInfo( &info );
+	if ( !info.isDict() )
+	    return QStringList();
+
+	Dict *infoDict = info.getDict();
+	// somehow iterate over keys in infoDict
+	for( int i=0; i < infoDict->getLength(); ++i ) {
+	    keys.append( QString::fromAscii(infoDict->getKey(i)) );
+	}
+
+	info.free();
+	return keys;
+    }
+
     /* borrowed from kpdf */
     QDateTime Document::date( const QString & type ) const
     {

Index: poppler-qt4.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-qt4.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- poppler-qt4.h	4 Dec 2005 11:30:00 -0000	1.15
+++ poppler-qt4.h	7 Dec 2005 08:31:09 -0000	1.16
@@ -348,10 +348,17 @@
 	   includes Author, Keywords, Creator and Producer.
 
 	   \param data the information that is required
+
+	   \sa infoKeys() to get a list of the available keys
 	*/
 	QString info( const QString & data ) const;
 
 	/**
+	   Obtain a list of the available string information keys.
+	*/
+	QStringList infoKeys() const;
+
+	/**
 	   Test if the document is encrypted
 	*/
 	bool isEncrypted() const;



More information about the poppler mailing list