~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to filters/kformula/png/pngexport.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
 
40
40
typedef KGenericFactory<PNGExport> PNGExportFactory;
41
 
K_EXPORT_COMPONENT_FACTORY( libkfopngexport, PNGExportFactory( "kofficefilters" ) )
42
 
 
43
 
 
44
 
PNGExport::PNGExport( QObject* parent, const QStringList& )
45
 
    : KoFilter(parent)
 
41
K_EXPORT_COMPONENT_FACTORY(libkfopngexport, PNGExportFactory("kofficefilters"))
 
42
 
 
43
 
 
44
PNGExport::PNGExport(QObject* parent, const QStringList&)
 
45
        : KoFilter(parent)
46
46
{
47
47
}
48
48
 
49
49
 
50
 
KoFilter::ConversionStatus PNGExport::convert( const QByteArray& from, const QByteArray& to )
 
50
KoFilter::ConversionStatus PNGExport::convert(const QByteArray& from, const QByteArray& to)
51
51
{
52
 
    if ( to != "image/png" || from != "application/x-kformula" )
 
52
    if (to != "image/png" || from != "application/x-kformula")
53
53
        return KoFilter::NotImplemented;
54
54
 
55
 
    KoStoreDevice* in = m_chain->storageFile( "root", KoStore::Read );
56
 
    if(!in) {
 
55
    KoStoreDevice* in = m_chain->storageFile("root", KoStore::Read);
 
56
    if (!in) {
57
57
        kapp->restoreOverrideCursor();
58
 
        KMessageBox::error( 0, i18n( "Failed to read data." ), i18n( "PNG Export Error" ) );
 
58
        KMessageBox::error(0, i18n("Failed to read data."), i18n("PNG Export Error"));
59
59
        return KoFilter::FileNotFound;
60
60
    }
61
61
 
62
 
    QDomDocument dom( "KFORMULA" );
63
 
    if ( !dom.setContent( in, false ) ) {
 
62
    QDomDocument dom("KFORMULA");
 
63
    if (!dom.setContent(in, false)) {
64
64
        kapp->restoreOverrideCursor();
65
 
        KMessageBox::error( 0, i18n( "Malformed XML data." ), i18n( "PNG Export Error" ) );
 
65
        KMessageBox::error(0, i18n("Malformed XML data."), i18n("PNG Export Error"));
66
66
        return KoFilter::WrongFormat;
67
67
    }
68
68
 
69
 
    PNGExportDia* dialog = new PNGExportDia( dom, m_chain->outputFile() );
 
69
    PNGExportDia* dialog = new PNGExportDia(dom, m_chain->outputFile());
70
70
    dialog->exec();
71
71
    delete dialog;
72
72
    return KoFilter::OK;