Commit 8b136624 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Don't cache not translate xpdf error messages, only show them using kdDebug

svn path=/branches/kpdf_experiments/kdegraphics/kpdf/; revision=366462
parent f79f1188
......@@ -42,7 +42,7 @@ shellrc_DATA = kpdf_shell.rc
kde_module_LTLIBRARIES = libkpdfpart.la
# the Part's source, library search path, and link libraries
libkpdfpart_la_SOURCES = QOutputDev.cpp kpdf_part.cpp pageview.cpp thumbnaillist.cpp kpdf_error.cpp xpdf_errors.cpp thumbnailgenerator.cpp document.cpp page.cpp searchwidget.cpp toc.cpp kpdf_dcop.skel pageviewutils.cpp
libkpdfpart_la_SOURCES = QOutputDev.cpp kpdf_part.cpp pageview.cpp thumbnaillist.cpp kpdf_error.cpp thumbnailgenerator.cpp document.cpp page.cpp searchwidget.cpp toc.cpp kpdf_dcop.skel pageviewutils.cpp
libkpdfpart_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
libkpdfpart_la_LIBADD = ../xpdf/libxpdf.la conf/libconf.la $(LIB_KPARTS) $(LIB_KFILE) $(LIB_KDEPRINT) $(LIB_KUTILS) -lm
......
......@@ -36,7 +36,6 @@
#include "PSOutputDev.h"
#include "QOutputDev.h"
#include "kpdf_error.h"
#include "document.h"
#include "page.h"
#include "settings.h"
......@@ -162,9 +161,6 @@ bool KPDFDocument::openDocument( const QString & docFile )
}
}
// clear xpdf errors
errors::clear();
// initialize output device for rendering current pdf
d->kpdfOutputDev->startDoc( d->pdfdoc->getXRef() );
......
......@@ -18,32 +18,9 @@
#include "GlobalParams.h"
#include "Error.h"
#include "kpdf_error.h"
#include <qstring.h>
#include <klocale.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include "xpdf_errors.h"
QStringList errors::p_errors;
void errors::add(const QString &s)
{
p_errors.append(s);
}
bool errors::exists(const QString &s)
{
return p_errors.findIndex(s) != -1;
}
void errors::clear()
{
p_errors.clear();
}
void CDECL error(int pos, const char *msg, ...) {
va_list args;
......@@ -55,19 +32,13 @@ void CDECL error(int pos, const char *msg, ...) {
return;
}
if (pos >= 0) {
emsg = i18n("Error (%1): ").arg(pos);
emsg = QString("Error (%1): ").arg(pos);
} else {
emsg = i18n("Error: ");
emsg = "Error: ";
}
va_start(args, msg);
tmsg = XPDFErrorTranslator::translateError(msg);
vsprintf(buffer, tmsg.latin1(), args);
vsprintf(buffer, msg, args);
va_end(args);
emsg += buffer;
if (!errors::exists(emsg))
{
//KMessageBox::error(0, emsg);
kdDebug() << emsg << endl;
errors::add(emsg);
}
kdDebug() << emsg << endl;
}
/***************************************************************************
* Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* 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 *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef KPDF_ERROR_H
#define KPDF_ERROR_H
#include <qstringlist.h>
class errors
{
public:
static void add(const QString &s);
static bool exists(const QString &s);
static void clear();
private:
static QStringList p_errors;
};
#endif
......@@ -44,8 +44,6 @@
#include <kiconloader.h>
#include <kio/netaccess.h>
#include "kpdf_error.h"
#include "GlobalParams.h"
#include "kpdf_part.h"
......
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2004 by Andrew Coles <andrew_coles@yahoo.co.uk> *
* *
* 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 *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef XPDF_ERRORS_H
#define XPDF_ERRORS_H
#include <qmap.h>
#include <qstring.h>
class XPDFErrorTranslator {
private:
static bool mapNotInitialised;
static QMap<QString, QString> translationmap;
public:
static QString translateError(const QString & originalError);
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment