Commit d21b8e41 authored by Halla Rempt's avatar Halla Rempt
Browse files

Give a warning if a resource cannot be opened.

parent 2642741e
......@@ -123,7 +123,12 @@ bool KisPaintOpPreset::load()
}
QFile file(filename());
if (file.size() == 0) return false;
if (!file.open(QIODevice::ReadOnly)) {
warnKrita << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&file);
......
......@@ -38,7 +38,10 @@ bool KisPngBrush::load()
QFile f(filename());
if (f.size() == 0) return false;
if (!f.exists()) return false;
f.open(QFile::ReadOnly);
if (!f.open(QIODevice::ReadOnly)) {
warnKrita << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&f);
f.close();
return res;
......
......@@ -38,7 +38,10 @@ bool KisSvgBrush::load()
QFile f(filename());
if (f.size() == 0) return false;
if (!f.exists()) return false;
if (!f.open(QIODevice::ReadOnly)) {
warnKrita << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&f);
f.close();
......
......@@ -24,6 +24,8 @@
#include <QByteArray>
#include <QCryptographicHash>
#include <kis_debug.h>
#define TASKSET_VERSION 1
TasksetResource::TasksetResource(const QString& f)
......@@ -54,7 +56,10 @@ bool TasksetResource::load()
QFile file(fn);
if (file.size() == 0) return false;
if (!file.open(QIODevice::ReadOnly)) return false;
if (!file.open(QIODevice::ReadOnly)) {
warnKrita << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&file);
......
......@@ -77,7 +77,10 @@ bool KisWorkspaceResource::load()
QFile file(filename());
if (file.size() == 0) return false;
if (!file.open(QIODevice::ReadOnly)) return false;
if (!file.open(QIODevice::ReadOnly)) {
warnKrita << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&file);
file.close();
......
......@@ -102,7 +102,10 @@ bool KoColorSet::load()
{
QFile file(filename());
if (file.size() == 0) return false;
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly)) {
kWarning() << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&file);
file.close();
return res;
......
......@@ -90,7 +90,10 @@ bool KoPattern::load()
if (file.size() == 0) return false;
bool result;
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly)) {
kWarning() << "Can't open file " << filename();
return false;
}
result = loadFromDevice(&file);
file.close();
......
......@@ -64,9 +64,10 @@ KoSegmentGradient::~KoSegmentGradient()
bool KoSegmentGradient::load()
{
QFile file(filename());
if (!file.open(QIODevice::ReadOnly)) return false;
if (!file.open(QIODevice::ReadOnly)) {
kWarning() << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&file);
file.close();
return res;
......
......@@ -49,7 +49,10 @@ KoStopGradient::~KoStopGradient()
bool KoStopGradient::load()
{
QFile f(filename());
f.open(QIODevice::ReadOnly);
if (!f.open(QIODevice::ReadOnly)) {
kWarning() << "Can't open file " << filename();
return false;
}
bool res = loadFromDevice(&f);
f.close();
return res;
......
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