Author: akhaldi
Date: Thu Oct 1 09:37:55 2015
New Revision: 69425
URL:
http://svn.reactos.org/svn/reactos?rev=69425&view=rev
Log:
[RAPPS] Get rid of the flickering of the URL in the download dialog and decode it. By
Ismael Ferreras Morezuelas. CORE-9060
Modified:
trunk/reactos/base/applications/rapps/loaddlg.c
Modified: trunk/reactos/base/applications/rapps/loaddlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/lo…
==============================================================================
--- trunk/reactos/base/applications/rapps/loaddlg.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/loaddlg.c [iso-8859-1] Thu Oct 1 09:37:55 2015
@@ -6,6 +6,7 @@
* Copyright 2004 Mike McCormack (for CodeWeavers)
* Copyright 2005 Ge van Geldorp (gvg(a)reactos.org)
* Copyright 2009 Dmitry Chapyshev (dmitry(a)reactos.org)
+ * Copyright 2015 Ismael Ferreras Morezuelas (swyterzone+ros(a)gmail.com)
*/
/*
* Based on Wine dlls/shdocvw/shdocvw_main.c
@@ -37,6 +38,7 @@
LONG ref;
HWND hDialog;
BOOL *pbCancelled;
+ BOOL UrlHasBeenCopied;
} IBindStatusCallbackImpl;
static
@@ -111,7 +113,6 @@
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
HWND Item;
LONG r;
- WCHAR OldText[100];
Item = GetDlgItem(This->hDialog, IDC_DOWNLOAD_PROGRESS);
if (Item && ulProgressMax)
@@ -120,13 +121,29 @@
}
Item = GetDlgItem(This->hDialog, IDC_DOWNLOAD_STATUS);
- if (Item && szStatusText)
- {
- SendMessageW(Item, WM_GETTEXT, sizeof(OldText) / sizeof(OldText[0]), (LPARAM)
OldText);
- if (sizeof(OldText) / sizeof(OldText[0]) - 1 <= wcslen(OldText) || 0 !=
wcscmp(OldText, szStatusText))
+ if (Item && szStatusText && wcslen(szStatusText) > 0 &&
This->UrlHasBeenCopied == FALSE)
+ {
+ DWORD len = wcslen(szStatusText) * sizeof(WCHAR);
+ PWSTR buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+
+ if (buf)
{
- SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) szStatusText);
+ /* beautify our url for display purposes */
+ InternetCanonicalizeUrl(szStatusText, buf, &len, ICU_DECODE |
ICU_NO_ENCODE);
+
+ /* paste it into our dialog, free the temp buffer
+ and don't do it again in this instance */
+ SendMessageW(Item, WM_SETTEXT, 0, (LPARAM)buf);
+ HeapFree(GetProcessHeap(), 0, buf);
}
+ else
+ {
+ /* our computer is old and rusty and does not have enough ram for this,
+ use the ugly version and call it a day */
+ SendMessageW(Item, WM_SETTEXT, 0, (LPARAM)szStatusText);
+ }
+
+ This->UrlHasBeenCopied = TRUE;
}
SetLastError(0);