QCAD

QCAD - 2D CAD System.

Click here for a documentation of the DokuWiki formatting syntax that can be used in reports

Please search for existing tasks (also closed ones) before opening a new task.

Please make sure that you are using the latest Version of QCAD before posting a bug (menu Help - Check for Updates)

Tasklist

FS#907 - I, M file dialog doesn't work as intended (with fix)

Attached to Project: QCAD
Opened by Tamas TEVESZ (kazmer) - Thursday, 05 September 2013, 13:09 GMT+1
Last edited by Andrew (andrew) - Thursday, 05 September 2013, 13:37 GMT+1
Task Type Bug Report
Category Main
Status Closed
Assigned To Andrew (andrew)
Operating System All
Severity Low
Priority Normal
Reported Version 3.2.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

In scripts/Draw/Image/Image.js, while building the filter for the file dialog, constructs like this are used:

var formats = QImageReader.supportedImageFormats();

for (var i=0; i<formats.length; ++i) {
    var format = formats[i];

        if (format==="jpg" ||
            format==="tif") {
            continue;
        }

=== also checks for type equality, and since format is actually an object, it will never match. The result is that duplicates are not filtered from the list as the code suggests they were intended to be filtered, nor are formats that are not intended to be there.

The following patch fixes this:

diff --git a/scripts/Draw/Image/Image.js b/scripts/Draw/Image/Image.js
index 0a6400e..cc58c98 100644
--- a/scripts/Draw/Image/Image.js
+++ b/scripts/Draw/Image/Image.js
@@ -91,23 +91,23 @@ Image.prototype.getFileName = function() {
         var formatAlt = "";
 
         // ignore format aliases:
-        if (format==="jpg" ||
-            format==="tif") {
+        if (format=="jpg" ||
+            format=="tif") {
             continue;
         }
 
         // ignore unsupported formats:
-        if (format==="ico" || format==="mng" ||
-            format==="pbm" || format==="pgm" || format==="ppm" ||
-            format==="svg" || format==="svgz" ||
-            format==="xbm" || format==="xpm") {
+        if (format=="ico" || format=="mng" ||
+            format=="pbm" || format=="pgm" || format=="ppm" ||
+            format=="svg" || format=="svgz" ||
+            format=="xbm" || format=="xpm") {
             continue;
         }
 
-        if (format==="jpeg") {
+        if (format=="jpeg") {
             formatAlt = "jpg";
         }
-        else if (format==="tiff") {
+        else if (format=="tiff") {
             formatAlt = "tif";
         }
 
This task depends upon

Closed by  Andrew (andrew)
Thursday, 05 September 2013, 13:37 GMT+1
Reason for closing:  Fixed
Comment by Andrew (andrew) - Thursday, 05 September 2013, 13:37 GMT+1

Thanks for the report and fix!

Loading...