Author: dquintana
Date: Wed Oct 29 22:28:51 2014
New Revision: 65111
URL:
http://svn.reactos.org/svn/reactos?rev=65111&view=rev
Log:
[BROWSEUI]
* Allow the static items in the Favorites menu to be received by the shell browse window.
* Handle the Organize Favorites menu item by opening either the USER favorites, or the
COMMON version of the folder.
[RSHELL]
* Send the proper HWND together with the HMENU, when sending callbacks.
Modified:
branches/shell-experiments/base/shell/explorer-new/traywnd.c
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
branches/shell-experiments/base/shell/rshell/precomp.h
branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
branches/shell-experiments/include/reactos/undocshell.h
Modified: branches/shell-experiments/base/shell/explorer-new/traywnd.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/traywnd.c [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/explorer-new/traywnd.c [iso-8859-1] Wed Oct 29
22:28:51 2014
@@ -2929,7 +2929,7 @@
{
/* TODO: Implement properly */
- LPCWSTR strSite =
L"http://www.reactos.org/"org/";
+ LPCWSTR strSite =
L"https://www.reactos.org/"org/";
/* TODO: Make localizable */
LPCWSTR strCaption = L"Sorry";
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Wed Oct 29
22:28:51 2014
@@ -738,18 +738,14 @@
if (!m_psmc)
return S_FALSE;
- HWND hwnd;
- GetWindow(&hwnd);
-
SMDATA smData = { 0 };
smData.punk = static_cast<IShellMenu2*>(this);
smData.uId = id;
smData.uIdParent = m_uId;
smData.uIdAncestor = m_uIdAncestor;
smData.pidlItem = pidl;
- smData.hwnd = hwnd;
- if (m_hmenu)
- smData.hmenu = m_hmenu;
+ smData.hwnd = m_menuOwner ? m_menuOwner : m_topLevelWindow;
+ smData.hmenu = m_hmenu;
smData.pvUserData = NULL;
if (m_SFToolbar)
m_SFToolbar->GetShellFolder(NULL, &smData.pidlFolder,
IID_PPV_ARG(IShellFolder, &smData.psf));
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Wed Oct 29
22:28:51 2014
@@ -1111,7 +1111,8 @@
CMenuStaticToolbar::CMenuStaticToolbar(CMenuBand *menuBand) :
CMenuToolbarBase(menuBand, FALSE),
- m_hmenu(NULL)
+ m_hmenu(NULL),
+ m_hwndMenu(NULL)
{
}
@@ -1127,7 +1128,7 @@
if (phmenu)
*phmenu = m_hmenu;
if (phwnd)
- *phwnd = NULL;
+ *phwnd = m_hwndMenu;
if (pdwFlags)
*pdwFlags = m_dwMenuFlags;
@@ -1140,6 +1141,7 @@
DWORD dwFlags)
{
m_hmenu = hmenu;
+ m_hwndMenu = hwnd;
m_dwMenuFlags = dwFlags;
return S_OK;
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] Wed Oct 29
22:28:51 2014
@@ -137,6 +137,7 @@
{
private:
HMENU m_hmenu;
+ HWND m_hwndMenu;
public:
CMenuStaticToolbar(CMenuBand *menuBand);
Modified: branches/shell-experiments/base/shell/rshell/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] Wed Oct 29
22:28:51 2014
@@ -68,8 +68,6 @@
#endif
#define shell32_hInstance 0
-#define SMC_EXEC 4
-extern "C" INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex,
UINT bSimulateDoc);
extern "C" HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv);
extern "C" HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv);
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Wed Oct
29 22:28:51 2014
@@ -645,6 +645,9 @@
case SMC_GETOBJECT:
return GetObject(psmd, *reinterpret_cast<IID *>(wParam),
reinterpret_cast<void **>(lParam));
case SMC_GETSFOBJECT:
+ break;
+ case SMC_EXEC:
+ PostMessageW(psmd->hwnd, WM_COMMAND, psmd->uId, 0);
break;
case SMC_SFEXEC:
SHInvokeDefaultCommand(psmd->hwnd, psmd->psf, psmd->pidlItem);
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Wed Oct 29
22:28:51 2014
@@ -22,6 +22,7 @@
#include <shellapi.h>
#include <htiframe.h>
+#include <strsafe.h>
extern "C"
BOOL WINAPI Shell_GetImageLists(
@@ -633,6 +634,7 @@
LRESULT OnBackspace(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
LRESULT OnGoHome(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
LRESULT OnIsThisLegal(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled);
+ LRESULT OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled);
LRESULT OnToggleStatusBarVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled);
LRESULT OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled);
LRESULT OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled);
@@ -672,6 +674,7 @@
COMMAND_ID_HANDLER(IDM_GOTO_FORWARD, OnGoForward)
COMMAND_ID_HANDLER(IDM_GOTO_UPONELEVEL, OnGoUpLevel)
COMMAND_ID_HANDLER(IDM_GOTO_HOMEPAGE, OnGoHome)
+ COMMAND_ID_HANDLER(IDM_FAVORITES_ORGANIZEFAVORITES, OnOrganizeFavorites)
COMMAND_ID_HANDLER(IDM_HELP_ISTHISCOPYLEGAL, OnIsThisLegal)
COMMAND_ID_HANDLER(IDM_VIEW_STATUSBAR, OnToggleStatusBarVisible)
COMMAND_ID_HANDLER(IDM_TOOLBARS_LOCKTOOLBARS, OnToggleToolbarLock)
@@ -1871,7 +1874,7 @@
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
- hResult = shellMenu->SetMenu(hmenuShared, NULL, SMSET_DONTOWN);
+ hResult = shellMenu->SetMenu(hmenuShared, m_hWnd, SMSET_DONTOWN);
if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
fCurrentMenuBar = hmenuShared;
@@ -3252,9 +3255,54 @@
return 0;
}
+LRESULT CShellBrowser::OnOrganizeFavorites(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled)
+{
+ CComPtr<IShellFolder> psfDesktop;
+ LPITEMIDLIST pidlFavs;
+ HRESULT hr;
+ hr = SHGetSpecialFolderLocation(m_hWnd, CSIDL_FAVORITES, &pidlFavs);
+ if (FAILED(hr))
+ {
+ hr = SHGetSpecialFolderLocation(m_hWnd, CSIDL_COMMON_FAVORITES, &pidlFavs);
+ if (FAILED(hr))
+ return 0;
+ }
+
+ hr = SHGetDesktopFolder(&psfDesktop);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return 0;
+
+ hr = SHInvokeDefaultCommand(m_hWnd, psfDesktop, pidlFavs);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return 0;
+
+ return 0;
+}
+
LRESULT CShellBrowser::OnIsThisLegal(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled)
{
- ShellExecute(m_hWnd, NULL,
L"https://reactos.org/user-faq"-faq", NULL, NULL,
SW_SHOWNORMAL);
+ /* TODO: Implement properly */
+
+ LPCWSTR strSite =
L"https://www.reactos.org/user-faq"-faq";
+
+ /* TODO: Make localizable */
+ LPCWSTR strCaption = L"Sorry";
+ LPCWSTR strMessage = L"ReactOS could not browse to '%s' (error %d).
Please make sure there is a web browser installed.";
+ WCHAR tmpMessage[512];
+
+ /* TODO: Read from the registry */
+ LPCWSTR strVerb = NULL; /* default */
+ LPCWSTR strPath = strSite;
+ LPCWSTR strParams = NULL;
+
+ /* The return value is defined as HINSTANCE for backwards compatibility only, the
cast is needed */
+ int result = (int) ShellExecuteW(m_hWnd, strVerb, strPath, strParams, NULL,
SW_SHOWNORMAL);
+ if (result <= 32)
+ {
+ StringCchPrintfW(tmpMessage, 512, strMessage, strSite, result);
+ MessageBoxExW(m_hWnd, tmpMessage, strCaption, MB_OK, 0);
+ }
+
return 0;
}
Modified: branches/shell-experiments/include/reactos/undocshell.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/react…
==============================================================================
--- branches/shell-experiments/include/reactos/undocshell.h [iso-8859-1] (original)
+++ branches/shell-experiments/include/reactos/undocshell.h [iso-8859-1] Wed Oct 29
22:28:51 2014
@@ -531,6 +531,9 @@
/* Utility functions */
#include <stdio.h>
+
+#define SMC_EXEC 4
+extern "C" INT WINAPI Shell_GetCachedImageIndex(LPCWSTR szPath, INT nIndex,
UINT bSimulateDoc);
static inline ULONG
Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)