Commit 4315e88c authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Make file extension comparisons more robust

Wehn detecting file format via file extension we should compare
it in case-insensitive way.

CCBUG:447454
parent 73ecac02
......@@ -32,7 +32,7 @@ QImage RecentImageImageProvider::requestImage(const QString &id, QSize *size, co
QImage thumbnail;
if (f.exists()) {
if (f.fileName().endsWith(".kra")) {
if (f.fileName().endsWith(".kra", Qt::CaseInsensitive)) {
// try to use any embedded thumbnail
KoStore *store = KoStore::createStore(id, KoStore::Read);
......
......@@ -884,7 +884,7 @@ bool KisResourceCacheDb::addResource(KisResourceStorageSP storage, QDateTime tim
} else if (storage->location() == "memory") {
translationContext = "memory/" + resourceType + "/" + resource->filename();
}
else if (resource->filename().endsWith(".myb")) {
else if (resource->filename().endsWith(".myb", Qt::CaseInsensitive)) {
translationContext = "./plugins/paintops/mypaint/brushes/" + resource->filename();
} else {
translationContext = "./krita/data/" + resourceType + "/" + resource->filename();
......
......@@ -626,7 +626,7 @@ bool KisApplication::start(const KisApplicationArguments &args)
return true;
}
else if (d->mainWindow) {
if (fileName.endsWith(".bundle")) {
if (fileName.endsWith(".bundle", Qt::CaseInsensitive)) {
d->mainWindow->installBundle(fileName);
}
else {
......
......@@ -441,7 +441,7 @@ void KisWelcomePageWidget::dropEvent(QDropEvent *event)
if (event->mimeData()->hasUrls() && !event->mimeData()->urls().empty()) {
Q_FOREACH (const QUrl &url, event->mimeData()->urls()) {
if (url.toLocalFile().endsWith(".bundle")) {
if (url.toLocalFile().endsWith(".bundle", Qt::CaseInsensitive)) {
bool r = m_mainWindow->installBundle(url.toLocalFile());
if (!r) {
qWarning() << "Could not install bundle" << url.toLocalFile();
......
......@@ -371,7 +371,7 @@ QJsonObject KisFFMpegWrapper::findProcessPath(const QString &processName, const
if (proposedPaths[i].endsWith('/')) {
continue;
}
if (!proposedPaths[i].endsWith(".exe")) {
if (!proposedPaths[i].endsWith(".exe", Qt::CaseInsensitive)) {
if (!QFile::exists(proposedPaths[i])) {
proposedPaths[i] += ".exe";
if (!QFile::exists(proposedPaths[i])) {
......
......@@ -254,7 +254,7 @@ void KisPresetLivePreviewView::setupAndPaintStroke()
qreal diameterToBrushRatio = 1.0;
qreal diameter = settings->getInt("Spray/diameter");
//hack, 1000 being the maximum possible brushsize.
if (brush->filename().endsWith(".svg")) {
if (brush->filename().endsWith(".svg", Qt::CaseInsensitive)) {
diameterToBrushRatio = diameter/(1000.0*scale);
scale = 25.0 / 1000.0;
} else {
......
......@@ -137,7 +137,7 @@ bool KisMyPaintPaintOpPreset::loadFromDevice(QIODevice *dev, KisResourcesInterfa
apply(settings());
// correct filename
const QString f = filename();
if (f.endsWith(".myb")) {
if (f.endsWith(".myb", Qt::CaseInsensitive)) {
setFilename(QFileInfo(f).completeBaseName().append(KisPaintOpPreset::defaultFileExtension()));
}
return true;
......
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