diff dwt/browser/Download.d @ 352:a3c5f744d03f

Update Browser/Mozilla package to SWT 3.4.1 and bug fixes
author John Reimer <terminal.node@gmail.com>
date Tue, 04 Nov 2008 21:20:45 -0800
parents 9a4d7706df52
children
line wrap: on
line diff
--- a/dwt/browser/Download.d	Mon Nov 03 23:35:30 2008 +0100
+++ b/dwt/browser/Download.d	Tue Nov 04 21:20:45 2008 -0800
@@ -20,9 +20,8 @@
 
 import dwt.browser.Mozilla;
 
-//import dwt.internal.Compatibility;
 import XPCOM = dwt.internal.mozilla.XPCOM;
-//import dwt.internal.mozilla.XPCOMObject;
+
 import dwt.internal.mozilla.prtime;
 import dwt.internal.mozilla.Common;
 import dwt.internal.mozilla.nsID;
@@ -125,15 +124,15 @@
     * these interfaces the second argument implements and act accordingly.  
     */
     String filename = null;
-    //nsISupports supports = new nsISupports (aTarget);
-    nsIURI target = null;
-    rc = aTarget.QueryInterface (&nsIURI.IID, cast(void**)&target);
+    nsISupports supports = cast(nsISupports)aTarget;
+    nsIURI target;
+    rc = supports.QueryInterface (&nsIURI.IID, cast(void**)&target);
     if (rc is 0) {  /* >= 1.7 */
         //result[0] = 0;
         //int /*long*/ aPath = XPCOM.nsEmbedCString_new ();
         scope auto aPath = new nsEmbedCString;
         rc = target.GetPath (cast(nsACString*)aPath);
-        if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
+        if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__);
         //length = XPCOM.nsEmbedCString_Length (aPath);
         //buffer = XPCOM.nsEmbedCString_get (aPath);
         //dest = new byte[length];
@@ -144,22 +143,16 @@
         filename = filename.substring (separator + 1);
         target.Release ();
     } else {    /* < 1.7 */
-        // Earlier versions (<1.7) of Mozilla are not really supported
-        // in the D port (yet) because we depend on bindings where the interface
-        // is directly mapped, not wrapped as in the Java SWT case
-        implMissing(__FILE__,__LINE__);
-    /*
-        //nsILocalFile target = new nsILocalFile (aTarget);
+        nsILocalFile target2 = cast(nsILocalFile) aTarget;
         scope auto aNativeTarget = new nsEmbedCString;
-        rc = aTarget.GetNativeLeafName (cast(nsACString*)aNativeTarget);
-        if (rc !is XPCOM.NS_OK) Mozilla.error (rc);
+        rc = target2.GetNativeLeafName (cast(nsACString*)aNativeTarget);
+        if (rc !is XPCOM.NS_OK) Mozilla.error (rc,__FILE__,__LINE__);
         //length = XPCOM.nsEmbedCString_Length (aNativeTarget);
         //buffer = XPCOM.nsEmbedCString_get (aNativeTarget);
         //dest = new byte[length];
         //XPCOM.memmove (dest, buffer, length);
         //XPCOM.nsEmbedCString_delete (aNativeTarget);
         filename = aNativeTarget.toString;
-    */
     }
 
     Listener listener = new class() Listener  {