Mercurial > projects > dwt-mac
comparison dwt/browser/Download_1_8.d @ 45:d8635bb48c7c
Merge with SWT 3.5
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 01 Dec 2008 17:07:00 +0100 |
parents | e831403a80a9 |
children | 5583f8eeee6c |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2003, 2007 IBM Corporation and others. | 2 * Copyright (c) 2003, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
30 import dwt.widgets.Event; | 30 import dwt.widgets.Event; |
31 import dwt.widgets.Label; | 31 import dwt.widgets.Label; |
32 import dwt.widgets.Listener; | 32 import dwt.widgets.Listener; |
33 import dwt.widgets.Shell; | 33 import dwt.widgets.Shell; |
34 | 34 |
35 /** | |
36 * This class implements the nsIDownload interface for mozilla | |
37 * version 1.8.x. For mozilla versions 1.4 - 1.7.x this interface | |
38 * is implemented by class nsIDownload. Mozilla versions later | |
39 * than 1.8.x do not need to call this interface. | |
40 */ | |
35 class Download_1_8 { | 41 class Download_1_8 { |
36 XPCOMObject supports; | 42 XPCOMObject supports; |
37 XPCOMObject download; | 43 XPCOMObject download; |
38 XPCOMObject progressDialog; | 44 XPCOMObject progressDialog; |
39 XPCOMObject webProgressListener; | 45 XPCOMObject webProgressListener; |
256 shell = null; | 262 shell = null; |
257 cancelable = null; | 263 cancelable = null; |
258 } | 264 } |
259 }; | 265 }; |
260 shell = new Shell (DWT.DIALOG_TRIM); | 266 shell = new Shell (DWT.DIALOG_TRIM); |
261 String msg = Compatibility.getMessage ("SWT_Download_File", new Object[] {filename}); //$NON-NLS-1$ | 267 String msg = Compatibility.getMessage ("DWT_Download_File", new Object[] {filename}); //$NON-NLS-1$ |
262 shell.setText (msg); | 268 shell.setText (msg); |
263 GridLayout gridLayout = new GridLayout (); | 269 GridLayout gridLayout = new GridLayout (); |
264 gridLayout.marginHeight = 15; | 270 gridLayout.marginHeight = 15; |
265 gridLayout.marginWidth = 15; | 271 gridLayout.marginWidth = 15; |
266 gridLayout.verticalSpacing = 20; | 272 gridLayout.verticalSpacing = 20; |
267 shell.setLayout (gridLayout); | 273 shell.setLayout (gridLayout); |
268 msg = Compatibility.getMessage ("SWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$ | 274 msg = Compatibility.getMessage ("DWT_Download_Location", new Object[] {filename, url}); //$NON-NLS-1$ |
269 new Label (shell, DWT.SIMPLE).setText (msg); | 275 new Label (shell, DWT.SIMPLE).setText (msg); |
270 status = new Label (shell, DWT.SIMPLE); | 276 status = new Label (shell, DWT.SIMPLE); |
271 msg = Compatibility.getMessage ("SWT_Download_Started"); //$NON-NLS-1$ | 277 msg = Compatibility.getMessage ("DWT_Download_Started"); //$NON-NLS-1$ |
272 status.setText (msg); | 278 status.setText (msg); |
273 GridData data = new GridData (); | 279 GridData data = new GridData (); |
274 data.grabExcessHorizontalSpace = true; | 280 data.grabExcessHorizontalSpace = true; |
275 data.grabExcessVerticalSpace = true; | 281 data.grabExcessVerticalSpace = true; |
276 status.setLayoutData (data); | 282 status.setLayoutData (data); |
277 | 283 |
278 cancel = new Button (shell, DWT.PUSH); | 284 cancel = new Button (shell, DWT.PUSH); |
279 cancel.setText (DWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$ | 285 cancel.setText (DWT.getMessage ("DWT_Cancel")); //$NON-NLS-1$ |
280 data = new GridData (); | 286 data = new GridData (); |
281 data.horizontalAlignment = GridData.CENTER; | 287 data.horizontalAlignment = GridData.CENTER; |
282 cancel.setLayoutData (data); | 288 cancel.setLayoutData (data); |
283 cancel.addListener (DWT.Selection, listener); | 289 cancel.addListener (DWT.Selection, listener); |
284 shell.addListener (DWT.Close, listener); | 290 shell.addListener (DWT.Close, listener); |
378 int OnProgressChange64 (int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) { | 384 int OnProgressChange64 (int /*long*/ aWebProgress, int /*long*/ aRequest, long aCurSelfProgress, long aMaxSelfProgress, long aCurTotalProgress, long aMaxTotalProgress) { |
379 long currentKBytes = aCurTotalProgress / 1024; | 385 long currentKBytes = aCurTotalProgress / 1024; |
380 long totalKBytes = aMaxTotalProgress / 1024; | 386 long totalKBytes = aMaxTotalProgress / 1024; |
381 if (shell !is null && !shell.isDisposed ()) { | 387 if (shell !is null && !shell.isDisposed ()) { |
382 Object[] arguments = {new Long (currentKBytes), new Long (totalKBytes)}; | 388 Object[] arguments = {new Long (currentKBytes), new Long (totalKBytes)}; |
383 String statusMsg = Compatibility.getMessage ("SWT_Download_Status", arguments); //$NON-NLS-1$ | 389 String statusMsg = Compatibility.getMessage ("DWT_Download_Status", arguments); //$NON-NLS-1$ |
384 status.setText (statusMsg); | 390 status.setText (statusMsg); |
385 shell.layout (true); | 391 shell.layout (true); |
386 shell.getDisplay ().update (); | 392 shell.getDisplay ().update (); |
387 } | 393 } |
388 return XPCOM.NS_OK; | 394 return XPCOM.NS_OK; |