From 665778862cb1946df692bf6b0a98dac5a3668486 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 10 Mar 2016 23:33:34 +0000 Subject: [PATCH] kdm: fix regression since fba94c20 before checking if the image is supported it must be downloaded if the path is not local, this actually improves the handling of the case when it is local compared to the original case before fba94c20 Signed-off-by: Ivailo Monev --- kdm/kcm/kdm-users.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/kdm/kcm/kdm-users.cpp b/kdm/kcm/kdm-users.cpp index fbb9731a..2b169be6 100644 --- a/kdm/kcm/kdm-users.cpp +++ b/kdm/kcm/kdm-users.cpp @@ -434,16 +434,22 @@ void KDMUsersWidget::userButtonDropEvent(QDropEvent *e) if (!uriList.isEmpty()) { KUrl *url = new KUrl(uriList.first()); - QImageReader reader(url->path()); - if ( !reader.canRead() ) { - KMessageBox::sorry(this, i18n("%1 does not appear to be an image file.\n", url->path())); - delete url; + bool tempfile = false; + QString pixpath; + if (url->isLocalFile()) { + pixpath = url->path(); } else { - QString pixpath; + tempfile = true; KIO::NetAccess::download(*url, pixpath, parentWidget()); + } + QImageReader reader(pixpath); + if (!reader.canRead()) { + KMessageBox::sorry(this, i18n("%1 does not appear to be an image file.\n", url->path())); + } else { changeUserPix(pixpath); + } + if (tempfile) { KIO::NetAccess::removeTempFile(pixpath); - delete url; } } } -- 2.11.0