forked from qt-creator/qt-creator
add errorString output argument to IFile::reload() & IEditor::open()
add/unify read error handling in all affected classes
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QtDebug>
|
||||
|
||||
@@ -116,10 +117,12 @@ bool ImageViewer::createNew(const QString &contents)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImageViewer::open(const QString &fileName)
|
||||
bool ImageViewer::open(QString *errorString, const QString &fileName)
|
||||
{
|
||||
if (!d_ptr->imageView->openFile(fileName))
|
||||
if (!d_ptr->imageView->openFile(fileName)) {
|
||||
*errorString = tr("Cannot open image file %1").arg(QDir::toNativeSeparators(fileName));
|
||||
return false;
|
||||
}
|
||||
setDisplayName(QFileInfo(fileName).fileName());
|
||||
d_ptr->file->setFileName(fileName);
|
||||
// d_ptr->file->setMimeType
|
||||
|
||||
Reference in New Issue
Block a user