I think it would be a good idea exposing the error to the user so that okular can tell you if saving failed because opening the file failed or because we don't support writing encripted files.
Albert A Dilluns, 2 de març de 2009, Pino Toscano va escriure: > qt4/src/poppler-pdf-converter.cc | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > New commits: > commit de3131ae38fc9442b198d4d7b0c57c6939ad66ce > Author: Pino Toscano <[email protected]> > Date: Mon Mar 2 15:20:07 2009 +0100 > > [Qt4] adapt to the new PDFDoc saving API > > store the error code instead of the bool > > diff --git a/qt4/src/poppler-pdf-converter.cc > b/qt4/src/poppler-pdf-converter.cc index 995d46e..d0fed5b 100644 > --- a/qt4/src/poppler-pdf-converter.cc > +++ b/qt4/src/poppler-pdf-converter.cc > @@ -25,6 +25,8 @@ > > #include <QtCore/QFile> > > +#include <ErrorCodes.h> > + > namespace Poppler { > > class PDFConverterPrivate : public BaseConverterPrivate > @@ -79,18 +81,18 @@ bool PDFConverter::convert() > if (QFile *file = qobject_cast<QFile*>(dev)) > deleteFile = !file->exists(); > > - bool success; > + int errorCode = errNone; > QIODeviceOutStream stream(dev); > if (d->opts & WithChanges) > { > - success = d->document->doc->saveAs(&stream); > + errorCode = d->document->doc->saveAs(&stream); > } > else > { > - success = d->document->doc->saveWithoutChangesAs(&stream); > + errorCode = d->document->doc->saveWithoutChangesAs(&stream); > } > d->closeDevice(); > - if (!success) > + if (errorCode != errNone) > { > if (deleteFile) > { > @@ -98,7 +100,7 @@ bool PDFConverter::convert() > } > } > > - return success; > + return (errorCode == errNone); > } > > } > _______________________________________________ > poppler mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/poppler _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
