r14395 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:46:26 CET 2009
Revision: 14395
Author: jghali
Date: 2009-12-10T12:56:05.080676Z
Commit message: #8606 related : better error reporting when loading file fail (part 2)
Changeset:
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/loadsaveplugin.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M /trunk/Scribus/scribus/loadsaveplugin.h
M /trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
Diffs:
Index: scribus/loadsaveplugin.h
===================================================================
--- scribus/loadsaveplugin.h (revision 14394)
+++ scribus/loadsaveplugin.h (revision 14395)
@@ -115,6 +115,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/loadsaveplugin.cpp
===================================================================
--- scribus/loadsaveplugin.cpp (revision 14394)
+++ scribus/loadsaveplugin.cpp (revision 14395)
@@ -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/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 14394)
+++ scribus/scribus.cpp (revision 14395)
@@ -3500,7 +3500,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/plugins/fileloader/scribus12format/scribus12format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14394)
+++ scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14395)
@@ -228,7 +228,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;
@@ -1197,7 +1200,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 14394)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14395)
@@ -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... */
@@ -2624,7 +2627,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/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14394)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14395)
@@ -186,7 +186,10 @@
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString fileDir = QFileInfo(fileName).absolutePath();
int firstPage = 0;
int layerToSetActive = 0;
@@ -2978,7 +2981,10 @@
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString fileDir = QFileInfo(fileName).absolutePath();
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14394)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14395)
@@ -188,7 +188,10 @@
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString fileDir = QFileInfo(fileName).absolutePath();
int firstPage = 0;
int layerToSetActive = 0;
@@ -2941,7 +2944,10 @@
QString f(readSLA(fileName));
if (f.isEmpty())
+ {
+ setFileReadError();
return false;
+ }
QString fileDir = QFileInfo(fileName).absolutePath();
More information about the scribus-commit
mailing list