Commit bf3f6a09 authored by Filipe Saraiva's avatar Filipe Saraiva
Browse files

Add backward compability code to load image entries

files from the worksheet file
parent 4bba01ba
Pipeline #26252 failed with stage
in 1 minute and 48 seconds
...@@ -277,12 +277,26 @@ void ImageEntry::updateEntry() ...@@ -277,12 +277,26 @@ void ImageEntry::updateEntry()
if (!m_imageItem) if (!m_imageItem)
m_imageItem = new WorksheetImageItem(this); m_imageItem = new WorksheetImageItem(this);
// This if-else block was used for backward compability for *cws files
// without FileName tag. After some releases from 20.08 version, it will
// be possible to remove the else part and strip the m_imagePath from the
// code and Path tag from the CWS format
if (!m_fileName.isNull()) {
QString imagePath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + QDir::separator() + m_fileName;
if (imagePath.endsWith(QLatin1String(".eps"), Qt::CaseInsensitive)) {
m_imageItem->setEps(QUrl::fromLocalFile(imagePath));
} else {
QImage img(imagePath);
m_imageItem->setImage(img);
}
} else {
if (m_imagePath.endsWith(QLatin1String(".eps"), Qt::CaseInsensitive)) { if (m_imagePath.endsWith(QLatin1String(".eps"), Qt::CaseInsensitive)) {
m_imageItem->setEps(QUrl::fromLocalFile(m_imagePath)); m_imageItem->setEps(QUrl::fromLocalFile(m_imagePath));
} else { } else {
QImage img(QStandardPaths::writableLocation(QStandardPaths::TempLocation) + QDir::separator() + m_fileName); QImage img(m_imagePath);
m_imageItem->setImage(img); m_imageItem->setImage(img);
} }
}
if (!m_imageItem->imageIsValid()) { if (!m_imageItem->imageIsValid()) {
const QString msg = i18n("Cannot load image %1", m_imagePath); const QString msg = i18n("Cannot load image %1", m_imagePath);
......
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