mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
[SHELL32] CDrivesFolder: Unhardcode pqcminfo->idCmdFirst value
DFM_MERGECONTEXTMENU handler works better now. However there is difference
between ours and Windows' menu building systems, which has to be fixed.
Addendum to 64657051c3
. CORE-13841 CORE-18577
This commit is contained in:
parent
2628309baf
commit
a09e903398
1 changed files with 18 additions and 4 deletions
|
@ -286,38 +286,52 @@ HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder *psf,
|
||||||
GetVolumeInformationA(szDrive, NULL, 0, NULL, NULL, &dwFlags, NULL, 0);
|
GetVolumeInformationA(szDrive, NULL, 0, NULL, NULL, &dwFlags, NULL, 0);
|
||||||
|
|
||||||
// custom command IDs
|
// custom command IDs
|
||||||
|
#if 0 // Disabled until our menu building system is fixed
|
||||||
|
#define CMDID_FORMAT 0
|
||||||
|
#define CMDID_EJECT 1
|
||||||
|
#define CMDID_DISCONNECT 2
|
||||||
|
#else
|
||||||
|
/* FIXME: These IDs should start from 0, however there is difference
|
||||||
|
* between ours and Windows' menu building systems, which should be fixed. */
|
||||||
#define CMDID_FORMAT 1
|
#define CMDID_FORMAT 1
|
||||||
#define CMDID_EJECT 2
|
#define CMDID_EJECT 2
|
||||||
#define CMDID_DISCONNECT 3
|
#define CMDID_DISCONNECT 3
|
||||||
|
#endif
|
||||||
|
|
||||||
if (uMsg == DFM_MERGECONTEXTMENU)
|
if (uMsg == DFM_MERGECONTEXTMENU)
|
||||||
{
|
{
|
||||||
QCMINFO *pqcminfo = (QCMINFO *)lParam;
|
QCMINFO *pqcminfo = (QCMINFO *)lParam;
|
||||||
|
|
||||||
UINT idCmdFirst = pqcminfo->idCmdFirst;
|
UINT idCmdFirst = pqcminfo->idCmdFirst;
|
||||||
|
UINT idCmd = 0;
|
||||||
if (!(dwFlags & FILE_READ_ONLY_VOLUME) && nDriveType != DRIVE_REMOTE)
|
if (!(dwFlags & FILE_READ_ONLY_VOLUME) && nDriveType != DRIVE_REMOTE)
|
||||||
{
|
{
|
||||||
/* add separator and Format */
|
/* add separator and Format */
|
||||||
UINT idCmd = idCmdFirst + CMDID_FORMAT;
|
idCmd = idCmdFirst + CMDID_FORMAT;
|
||||||
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
||||||
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, idCmd, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED);
|
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, idCmd, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED);
|
||||||
}
|
}
|
||||||
if (nDriveType == DRIVE_REMOVABLE || nDriveType == DRIVE_CDROM)
|
if (nDriveType == DRIVE_REMOVABLE || nDriveType == DRIVE_CDROM)
|
||||||
{
|
{
|
||||||
/* add separator and Eject */
|
/* add separator and Eject */
|
||||||
UINT idCmd = idCmdFirst + CMDID_EJECT;
|
idCmd = idCmdFirst + CMDID_EJECT;
|
||||||
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
||||||
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, idCmd, MFT_STRING, MAKEINTRESOURCEW(IDS_EJECT), MFS_ENABLED);
|
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, idCmd, MFT_STRING, MAKEINTRESOURCEW(IDS_EJECT), MFS_ENABLED);
|
||||||
}
|
}
|
||||||
if (nDriveType == DRIVE_REMOTE)
|
if (nDriveType == DRIVE_REMOTE)
|
||||||
{
|
{
|
||||||
/* add separator and Disconnect */
|
/* add separator and Disconnect */
|
||||||
UINT idCmd = idCmdFirst + CMDID_DISCONNECT;
|
idCmd = idCmdFirst + CMDID_DISCONNECT;
|
||||||
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
|
||||||
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, idCmd, MFT_STRING, MAKEINTRESOURCEW(IDS_DISCONNECT), MFS_ENABLED);
|
_InsertMenuItemW(pqcminfo->hmenu, pqcminfo->indexMenu++, TRUE, idCmd, MFT_STRING, MAKEINTRESOURCEW(IDS_DISCONNECT), MFS_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
pqcminfo->idCmdFirst += 3;
|
if (idCmd)
|
||||||
|
#if 0 // see FIXME above
|
||||||
|
pqcminfo->idCmdFirst = ++idCmd;
|
||||||
|
#else
|
||||||
|
pqcminfo->idCmdFirst = (idCmd + 2);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (uMsg == DFM_INVOKECOMMAND)
|
else if (uMsg == DFM_INVOKECOMMAND)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue