~ubuntu-branches/ubuntu/jaunty/poppler/jaunty-security

« back to all changes in this revision

Viewing changes to qt4/src/poppler-pdf-converter.cc

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2009-01-14 16:57:14 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20090114165714-fc0eniq9604rq6u4
Tags: 0.10.3-0ubuntu1
* New upstream version
* debian/patches/60_manpages-cfg-flag.patch:
  - the change is in the new version
* debian/patches/61_manpages-hyphens.patch:
  - the change is in the new version
* debian/patches/62_pdftops-mandatory-arg.patch:
  - the change is in the new version
* debian/patches/63_do-not-make-ps-arrays-bigger-than-64k-from-big-images-in-patterns.patch:
  - the change is in the new version
* Updated for the libpoppler and libpoppler-glib soname changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* poppler-pdf-converter.cc: qt4 interface to poppler
2
2
 * Copyright (C) 2008, Pino Toscano <pino@kde.org>
 
3
 * Copyright (C) 2008, Albert Astals Cid <aacid@kde.org>
3
4
 *
4
5
 * This program is free software; you can redistribute it and/or modify
5
6
 * it under the terms of the GNU General Public License as published by
22
23
#include "poppler-converter-private.h"
23
24
#include "poppler-qiodeviceoutstream-private.h"
24
25
 
 
26
#include <QtCore/QFile>
 
27
 
25
28
namespace Poppler {
26
29
 
27
30
class PDFConverterPrivate : public BaseConverterPrivate
72
75
        if (!dev)
73
76
                return false;
74
77
 
 
78
        bool deleteFile = false;
 
79
        if (QFile *file = qobject_cast<QFile*>(dev))
 
80
                deleteFile = !file->exists();
 
81
 
 
82
        bool success;
75
83
        QIODeviceOutStream stream(dev);
76
84
        if (d->opts & WithChanges)
77
85
        {
78
 
                d->document->doc->saveAs(&stream);
 
86
                success = d->document->doc->saveAs(&stream);
79
87
        }
80
88
        else
81
89
        {
82
 
                d->document->doc->saveWithoutChangesAs(&stream);
 
90
                success = d->document->doc->saveWithoutChangesAs(&stream);
83
91
        }
84
92
        d->closeDevice();
 
93
        if (!success)
 
94
        {
 
95
                if (deleteFile)
 
96
                {
 
97
                        qobject_cast<QFile*>(dev)->remove();
 
98
                }
 
99
        }
85
100
 
86
 
        return true;
 
101
        return success;
87
102
}
88
103
 
89
104
}