Author: janderwald
Date: Wed Aug 27 22:52:51 2008
New Revision: 35719
URL:
http://svn.reactos.org/svn/reactos?rev=35719&view=rev
Log:
- Add Items to Connection ShellFolder Item Context Menu
- Are not yet handled
Modified:
trunk/reactos/dll/win32/netshell/lang/de-DE.rc
trunk/reactos/dll/win32/netshell/lang/en-US.rc
trunk/reactos/dll/win32/netshell/resource.h
trunk/reactos/dll/win32/netshell/shfldr_netconnect.c
Modified: trunk/reactos/dll/win32/netshell/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lang/de…
==============================================================================
--- trunk/reactos/dll/win32/netshell/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/lang/de-DE.rc [iso-8859-1] Wed Aug 27 22:52:51 2008
@@ -18,4 +18,12 @@
IDS_STATUS_CONNECTED "Verbindung hergestellt"
IDS_STATUS_OPERATIONAL "Verbindung hergestellt"
+ IDS_NET_ACTIVATE "Aktivieren"
+ IDS_NET_DEACTIVATE "Deaktivieren"
+ IDS_NET_STATUS "Status"
+ IDS_NET_REPAIR "Reparieren"
+ IDS_NET_CREATELINK "Verknüpfung erstellen"
+ IDS_NET_DELETE "Löschen"
+ IDS_NET_RENAME "Umbenennen"
+ IDS_NET_PROPERTIES "Eigenschaften"
END
Modified: trunk/reactos/dll/win32/netshell/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lang/en…
==============================================================================
--- trunk/reactos/dll/win32/netshell/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/lang/en-US.rc [iso-8859-1] Wed Aug 27 22:52:51 2008
@@ -16,5 +16,13 @@
IDS_STATUS_CONNECTING "Acquiring network address"
IDS_STATUS_CONNECTED "Connected"
IDS_STATUS_OPERATIONAL "Connected"
+
+ IDS_NET_ACTIVATE "Enable"
+ IDS_NET_DEACTIVATE "Disable"
+ IDS_NET_STATUS "Status"
+ IDS_NET_REPAIR "Repair"
+ IDS_NET_CREATELINK "Create Shortcut"
+ IDS_NET_DELETE "Delete"
+ IDS_NET_PROPERTIES "Properties"
END
Modified: trunk/reactos/dll/win32/netshell/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/resourc…
==============================================================================
--- trunk/reactos/dll/win32/netshell/resource.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/resource.h [iso-8859-1] Wed Aug 27 22:52:51 2008
@@ -29,3 +29,12 @@
#define IDS_STATUS_CONNECTING 10011
#define IDS_STATUS_CONNECTED 10012
#define IDS_STATUS_OPERATIONAL 10013
+
+#define IDS_NET_ACTIVATE 10100
+#define IDS_NET_DEACTIVATE 10101
+#define IDS_NET_STATUS 10102
+#define IDS_NET_REPAIR 10103
+#define IDS_NET_CREATELINK 10104
+#define IDS_NET_DELETE 10105
+#define IDS_NET_RENAME 10106
+#define IDS_NET_PROPERTIES 10107
Modified: trunk/reactos/dll/win32/netshell/shfldr_netconnect.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/shfldr_…
==============================================================================
--- trunk/reactos/dll/win32/netshell/shfldr_netconnect.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netshell/shfldr_netconnect.c [iso-8859-1] Wed Aug 27 22:52:51
2008
@@ -380,7 +380,7 @@
val = _ILGetValueStruct(pidl);
if (val)
{
- if (INetConnection_GetProperties((INetConnection*)val->pItem,
&pProperties) == NOERROR)
+ if (INetConnection_GetProperties(val->pItem, &pProperties) ==
NOERROR)
{
if (pProperties->pszwName)
{
@@ -628,6 +628,51 @@
return IShellFolder2_Release((IShellFolder2*)This);
}
+void WINAPI _InsertMenuItemW (
+ HMENU hmenu,
+ UINT indexMenu,
+ BOOL fByPosition,
+ UINT wID,
+ UINT fType,
+ LPCWSTR dwTypeData,
+ UINT fState)
+{
+ MENUITEMINFOW mii;
+ WCHAR szText[100];
+
+ ZeroMemory(&mii, sizeof(mii));
+ mii.cbSize = sizeof(mii);
+ if (fType == MFT_SEPARATOR)
+ {
+ mii.fMask = MIIM_ID | MIIM_TYPE;
+ }
+ else if (fType == MFT_STRING)
+ {
+ mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
+ if ((ULONG_PTR)HIWORD((ULONG_PTR)dwTypeData) == 0)
+ {
+ if (LoadStringW(netshell_hInstance, LOWORD((ULONG_PTR)dwTypeData), szText,
sizeof(szText)/sizeof(WCHAR)))
+ {
+ szText[(sizeof(szText)/sizeof(WCHAR))-1] = 0;
+ mii.dwTypeData = szText;
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ mii.dwTypeData = (LPWSTR) dwTypeData;
+ }
+ mii.fState = fState;
+ }
+
+ mii.wID = wID;
+ mii.fType = fType;
+ InsertMenuItemW( hmenu, indexMenu, fByPosition, &mii);
+}
+
/**************************************************************************
* ISF_NetConnect_IContextMenu_QueryContextMenu()
*/
@@ -639,10 +684,52 @@
UINT idCmdLast,
UINT uFlags)
{
- int Count = 1;
- //IGenericSFImpl * This = impl_from_IContextMenu2(iface);
-
- return MAKE_HRESULT(SEVERITY_SUCCESS, 0, Count);
+ IGenericSFImpl * This = impl_from_IContextMenu2(iface);
+ VALUEStruct * val;
+ NETCON_PROPERTIES * pProperties;
+
+ val = _ILGetValueStruct(This->apidl);
+ if (!val)
+ return E_FAIL;
+
+ if (INetConnection_GetProperties((INetConnection*)val->pItem, &pProperties) !=
NOERROR)
+ return E_FAIL;
+
+ if (pProperties->Status == NCS_HARDWARE_DISABLED)
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_ACTIVATE, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_ACTIVATE), MFS_DEFAULT);
+ else
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_DEACTIVATE, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_DEACTIVATE), MFS_ENABLED);
+
+ if (pProperties->Status == NCS_HARDWARE_DISABLED || pProperties->Status ==
NCS_MEDIA_DISCONNECTED || pProperties->Status == NCS_DISCONNECTED)
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_STATUS, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_GRAYED);
+ else if (pProperties->Status == NCS_CONNECTED)
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_STATUS, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_DEFAULT);
+ else
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_STATUS, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_ENABLED);
+
+ if (pProperties->Status == NCS_HARDWARE_DISABLED || pProperties->Status ==
NCS_MEDIA_DISCONNECTED)
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_REPAIR, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_GRAYED);
+ else
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_REPAIR, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_ENABLED);
+
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_CREATELINK, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_CREATELINK), MFS_ENABLED);
+
+ if (pProperties->dwCharacter & NCCF_ALLOW_REMOVAL)
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_DELETE, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_ENABLED);
+ else
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_DELETE, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_GRAYED);
+
+ if (pProperties->dwCharacter & NCCF_ALLOW_RENAME)
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_RENAME, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_ENABLED);
+ else
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_RENAME, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_GRAYED);
+
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
+ _InsertMenuItemW(hMenu, indexMenu++, TRUE, IDS_NET_PROPERTIES, MFT_STRING,
MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_ENABLED);
+
+
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 9);
}