r14394 by jghali - #8606 related : better error reporting when loading file fail (part 2)
scribus-commit
scribus-commit at lists.scribus.net
Fri Dec 11 00:45:42 CET 2009
Revision: 14394
Author: jghali
Date: 2009-12-10T12:55:05.513143Z
Commit message: #8606 related : better error reporting when loading file fail (part 2)
Changeset:
M /branches/Version135/Scribus/scribus/scribus.cpp
M /branches/Version135/Scribus/scribus/loadsaveplugin.cpp
M /branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M /branches/Version135/Scribus/scribus/loadsaveplugin.h
M /branches/Version135/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
M /branches/Version135/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
Diffs:
Index: scribus/loadsaveplugin.h
===================================================================
--- scribus/loadsaveplugin.h (revision 14393)
+++ scribus/loadsaveplugin.h (revision 14394)
@@ -112,6 +112,9 @@
/// Unregister all formats owned by the calling plugin
void unregisterAll();
+ // Set standard message for file read errors
+ virtual void setFileReadError();
+
// Set standard message for dom style errors with line and column
virtual void setDomParsingError(const QString& msg, int line, int column);
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 14393)
+++ scribus/scribus.cpp (revision 14394)
@@ -3816,7 +3816,11 @@
undoManager->setUndoEnabled(false);
QFileInfo fi(fileName);
if (!fi.exists())
+ {
+ QMessageBox::warning(this, CommonStrings::trWarning, tr("File does not exist on the specified path :\n%1").arg(QDir::toNativeSeparators(fileName)),
+ CommonStrings::tr_OK);
return false;
+ }
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
if (HaveDoc)
outlinePalette->buildReopenVals();
Index: scribus/loadsaveplugin.cpp
===================================================================
--- scribus/loadsaveplugin.cpp (revision 14393)
+++ scribus/loadsaveplugin.cpp (revision 14394)
@@ -88,6 +88,11 @@
return false;
}
+void LoadSavePlugin::setFileReadError()
+{
+ m_lastError = tr("An error occured while opening file or file is damaged");
+}
+
void LoadSavePlugin::setDomParsingError(const QString& msg, int line, int column)
{
m_lastError = tr("An error occured while parsing file at line %1, column %2 :\n%3").arg(line).arg(column).arg(msg);
Index: scribus/plugins/fileloader/scribus12format/scribus12format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14393)
+++ scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14394)
@@ -227,7 +227,10 @@
// Load the document text
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
// Build the DOM from it
QString errorMsg;
int errorLine, errorColumn;
@@ -1180,7 +1183,10 @@
QDomDocument docu("scridoc");
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString errorMsg;
int errorLine, errorColumn;
if (!docu.setContent(f, &errorMsg, &errorLine, &errorColumn))
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14393)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14394)
@@ -195,7 +195,10 @@
QDomDocument docu("scridoc");
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString fileDir = QFileInfo(fileName).absolutePath();
/* 2004/10/02 - petr vanek - bug #1092 - missing <PAGE> crash Scribus. The check constraint moved into IsScribus()
FIXME: I've add test on containig tag PAGE but returning false freezes S. in scribus.cpp need some hack too... */
@@ -2605,7 +2608,10 @@
QDomDocument docu("scridoc");
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString errorMsg;
int errorLine, errorColumn;
if (!docu.setContent(f, &errorMsg, &errorLine, &errorColumn))
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14393)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14394)
@@ -201,7 +201,10 @@
QDomDocument docu("scridoc");
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString fileDir = QFileInfo(fileName).absolutePath();
/* 2004/10/02 - petr vanek - bug #1092 - missing <PAGE> crash Scribus. The check constraint moved into IsScribus()
FIXME: I've add test on containig tag PAGE but returning false freezes S. in scribus.cpp need some hack too... */
@@ -2754,7 +2757,10 @@
QDomDocument docu("scridoc");
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString errorMsg;
int errorLine, errorColumn;
if (!docu.setContent(f, &errorMsg, &errorLine, &errorColumn))
More information about the scribus-commit
mailing list