qt4/src/poppler-document.cc | 6 +++--- qt4/src/poppler-private.h | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-)
New commits: commit e0f5bc1deebaa9861baffd7c9ba31ea31585cd1d Author: Hib Eris <[email protected]> Date: Tue Nov 1 14:15:09 2011 +0100 qt4: Use PDFDoc(wchar_t *, ...) on Windows Bug 35378 diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc index 04c56c6..7b3e1af 100644 --- a/qt4/src/poppler-document.cc +++ b/qt4/src/poppler-document.cc @@ -3,7 +3,7 @@ * Copyright (C) 2005, 2008, Brad Hards <[email protected]> * Copyright (C) 2005-2010, Albert Astals Cid <[email protected]> * Copyright (C) 2006-2010, Pino Toscano <[email protected]> - * Copyright (C) 2010 Hib Eris <[email protected]> + * Copyright (C) 2010, 2011 Hib Eris <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ namespace Poppler { Document *Document::load(const QString &filePath, const QByteArray &ownerPassword, const QByteArray &userPassword) { - DocumentData *doc = new DocumentData(new GooString(QFile::encodeName(filePath)), + DocumentData *doc = new DocumentData(filePath, new GooString(ownerPassword.data()), new GooString(userPassword.data())); return DocumentData::checkDocument(doc); @@ -128,7 +128,7 @@ namespace Poppler { } else { - doc2 = new DocumentData(new GooString(m_doc->doc->getFileName()), + doc2 = new DocumentData(m_doc->m_filePath, new GooString(ownerPassword.data()), new GooString(userPassword.data())); } diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h index 6d2b315..36af055 100644 --- a/qt4/src/poppler-private.h +++ b/qt4/src/poppler-private.h @@ -4,6 +4,7 @@ * Copyright (C) 2006-2009, 2011 by Albert Astals Cid <[email protected]> * Copyright (C) 2007-2009, 2011 by Pino Toscano <[email protected]> * Copyright (C) 2011 Andreas Hartmetz <[email protected]> + * Copyright (C) 2011 Hib Eris <[email protected]> * Inspired on code by * Copyright (C) 2004 by Albert Astals Cid <[email protected]> * Copyright (C) 2004 by Enrico Ros <[email protected]> @@ -75,10 +76,21 @@ namespace Poppler { class DocumentData { public: - DocumentData(GooString *filePath, GooString *ownerPassword, GooString *userPassword) + DocumentData(const QString &filePath, GooString *ownerPassword, GooString *userPassword) { init(); - doc = new PDFDoc(filePath, ownerPassword, userPassword); + m_filePath = filePath; + +#if defined(_WIN32) + wchar_t *fileName = new WCHAR[filePath.length()]; + int length = filePath.toWCharArray(fileName); + doc = new PDFDoc(fileName, length, ownerPassword, userPassword); + delete fileName; +#else + GooString *fileName = new GooString(QFile::encodeName(filePath)); + doc = new PDFDoc(fileName, ownerPassword, userPassword); +#endif + delete ownerPassword; delete userPassword; } @@ -173,6 +185,7 @@ namespace Poppler { static Document *checkDocument(DocumentData *doc); PDFDoc *doc; + QString m_filePath; QByteArray fileContents; bool locked; FontIterator *m_fontInfoIterator; _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
