QCAD Bugtracker

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bug Report
  • Category QCAD (main)
  • Assigned To
    Andrew
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version 3.2.2
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: QCAD Bugtracker
Opened by Tamas TEVESZ - 05.09.2013
Last edited by Andrew - 05.09.2013

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

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";
         }
 
Closed by  Andrew
05.09.2013 11:37
Reason for closing:  Fixed
Admin
Andrew commented on 05.09.2013 11:37

Thanks for the report and fix!

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing