[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Providing good error messages
From: Patrick Julien <freak () ideasandassociates ! com>
Date: 2002-02-10 21:39:42
[Download RAW message or body]
Hi,
Sorry if I'm sending this to kde-devel instead of koffice, but the
koffice list seems pretty dead. I'm playing around in Krayon and I want
to provide a good error message to the user when he can't import an
image for some reason... I don't see anything in QImage that can help
me... I would like to say something like, "This is not a valid jpeg", or
"QImage does not have jpeg plug-in installed".
Attached is my current patch against that code.
["krayon-#2.patch" (text/plain)]
Index: kis_view.cc
===================================================================
RCS file: /home/kde/koffice/krayon/core/kis_view.cc,v
retrieving revision 1.85
diff -u -3 -p -u -r1.85 kis_view.cc
--- kis_view.cc 2002/01/01 19:27:47 1.85
+++ kis_view.cc 2002/02/10 21:39:10
@@ -2584,12 +2584,14 @@ void KisView::insert_layer_image(bool ne
if( !url.isEmpty() )
{
- QImage *fileImage = new QImage(url.path());
- if(!fileImage)
- {
- kdDebug() << "Can't create QImage from file" << endl;
- return;
- }
+ QImage *fileImage = new QImage();
+
+ if (!fileImage -> load(url.path())) {
+ kdDebug() << "Can't create QImage from file" << endl;
+ KMessageBox::sorry(this, i18n("Could not convert file: %1\n").arg(url.path()));
+ delete fileImage;
+ return;
+ }
/* convert indexed images, all gifs and some pngs of 8 bits
or less, to 16 bit by creating a QPixmap from the file and
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic