Commit 333e1d16 authored by Martin Koller's avatar Martin Koller
Browse files

Fix handling of commandline filename argument when given relative path

When a relative path was given as argument, an invalid QUrl was used,
leading to not opening the file. Fixed that.
Also when a non-existing filename was given, we now detect the mime-type
by the filename extension so that saving this file will correctly do so.

BUG: 368131
FIXED-IN: 16.08.1
parent 015d25f5
......@@ -48,6 +48,7 @@
#include <qcolor.h>
#include <qimage.h>
#include <QMimeDatabase>
#include "kpLogCategories.h"
#include <kimageio.h>
......@@ -200,13 +201,21 @@ void kpDocument::openNew (const QUrl &url)
setURL (url, false/*not from url*/);
// TODO: Maybe we should guess the mimetype from "url"'s filename
// extension.
// That way "kolourpaint doesnotexist.bmp" would automatically
// select the BMP file format when the save dialog comes up for
// the first time.
*m_saveOptions = kpDocumentSaveOptions ();
if ( !url.isEmpty() )
// guess the mimetype from url's filename extension.
// That way "kolourpaint doesnotexist.bmp" automatically
// selects the BMP file format when the save dialog comes up for
// the first time.
QMimeDatabase mimeDb;
*m_metaInfo = kpDocumentMetaInfo ();
m_modified = false;
Copyright (c) 2003-2007 Clarence Dang <>
Copyright (c) 2015 Martin Koller <>
Copyright (c) 2015,2016 Martin Koller <>
All rights reserved.
Redistribution and use in source and binary forms, with or without
......@@ -34,6 +34,7 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QDir>
#include <KLocalizedString>
int main(int argc, char *argv [])
......@@ -105,7 +106,7 @@ int main(int argc, char *argv [])
for (int i = 0; i < args.count(); i++)
mainWindow = new kpMainWindow(QUrl::fromUserInput(args[i]));
mainWindow = new kpMainWindow(QUrl::fromUserInput(args[i], QDir::currentPath(), QUrl::AssumeLocalFile));
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