- HACKFIX for ReactOS in gui.cpp - prevent counting below zero
  see explanation comment
- Fix for percentage being shown incorrectly

svn path=/branches/GSoC_2017/rapps/; revision=75664
This commit is contained in:
Alexander Shaposhnikov 2017-08-24 23:48:10 +00:00
parent aa15934f23
commit 94406ba5bc
2 changed files with 17 additions and 7 deletions

View file

@ -1059,7 +1059,17 @@ private:
if ((pnic->uNewState & LVIS_STATEIMAGEMASK) && !bUpdating)
{
BOOL checked = ListView_GetCheckState(pnic->hdr.hwndFrom, pnic->iItem);
nSelectedApps += (checked) ? 1 : -1;
/* FIXME: HAX!
- preventing decremention below zero as a safeguard for ReactOS
In ReactOS this action is triggered whenever user changes *selection*, but should be only when *checkbox* state toggled
Maybe LVIS_STATEIMAGEMASK is set incorrectly
*/
nSelectedApps +=
(checked)
? 1
:((nSelectedApps > 0)
? -1
: 0);
UpdateStatusBarText();
}
}
@ -1290,7 +1300,7 @@ private:
break;
case ID_INSTALL:
if (nSelectedApps)
if (nSelectedApps > 0)
{
CDownloadManager::DownloadListOfApplications(m_ListView->GetCheckedItems());
UpdateApplicationsList(-1);

View file

@ -163,9 +163,9 @@ public:
m_UrlHasBeenCopied = TRUE;
}
SetLastError(0);
SetLastError(ERROR_SUCCESS);
r = GetWindowLongPtrW(m_hDialog, GWLP_USERDATA);
if (0 != r || 0 != GetLastError())
if (r || GetLastError() != ERROR_SUCCESS)
{
*m_pbCancelled = TRUE;
return E_ABORT;
@ -432,7 +432,7 @@ INT_PTR CALLBACK CDownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM w
case WM_CLOSE:
EndDialog(Dlg, 0);
DestroyWindow(Dlg);
//DestroyWindow(Dlg);
return TRUE;
default:
@ -719,6 +719,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
if (hOut == INVALID_HANDLE_VALUE)
goto end;
dwCurrentBytesRead = 0;
do
{
if (!InternetReadFile(hFile, lpBuffer, _countof(lpBuffer), &dwBytesRead))
@ -734,7 +735,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
}
dwCurrentBytesRead += dwBytesRead;
dl->OnProgress(dwCurrentBytesRead, dwContentLen, 0, pCurrentInfo->szUrlDownload);
dl->OnProgress(dwCurrentBytesRead, dwContentLen, 0, pCurrentInfo->szUrlDownload.GetString());
} while (dwBytesRead && !bCancelled);
CloseHandle(hOut);
@ -870,6 +871,5 @@ VOID CDownloadManager::LaunchDownloadDialog(BOOL modal)
hMainWnd,
DownloadDlgProc);
}
}
// CDownloadManager