diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-02-13 18:00:22 +0300 |
---|---|---|
committer | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-02-13 18:08:39 +0300 |
commit | 23e248b5d19ffddd4e836773044123ca977d09ef (patch) | |
tree | 662d1033633c050bf20fd3bada027b4f7e53861e | |
parent | 40dbc7840747973cbf68a039b141330ffe56ea4f (diff) |
shell_integration: Fetch the share menu title from the client on Windowsv1.8.0-beta1a
The context menu will now show "Share with ownCloud" instead of "Share" as
it does on other platforms.
This also updates the submodule to point to matching binaries.
m--------- | binary | 0 | ||||
-rw-r--r-- | doc/installing.rst | 2 | ||||
-rw-r--r-- | shell_integration/windows/OCContextMenu/OCClientInterface.cpp | 17 | ||||
-rw-r--r-- | shell_integration/windows/OCContextMenu/OCClientInterface.h | 6 | ||||
-rw-r--r-- | shell_integration/windows/OCContextMenu/OCContextMenu.cpp | 6 |
5 files changed, 21 insertions, 10 deletions
diff --git a/binary b/binary -Subproject 96dd38811b58b28146a204124a8e764b3513b7f +Subproject 5a664de4d3ac2b6edb6a16edbb5e376724e64e7 diff --git a/doc/installing.rst b/doc/installing.rst index 7f9a824b5..b950d5a55 100644 --- a/doc/installing.rst +++ b/doc/installing.rst @@ -81,7 +81,7 @@ file manager integration works. .. image:: images/client8.png When you are in your local ownCloud folder you can right-click any file or -folder, and then left-click Share to create a share link. Note that Windows +folder, and then left-click "Share with ownCloud" to create a share link. Note that Windows may also have a Share With option. This is not the ownCloud Share option. The ownCloud share dialog looks like the following example: diff --git a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp index 8472a7cca..ab6206f92 100644 --- a/shell_integration/windows/OCContextMenu/OCClientInterface.cpp +++ b/shell_integration/windows/OCContextMenu/OCClientInterface.cpp @@ -34,28 +34,33 @@ using namespace std; #define PIPE_TIMEOUT 5*1000 //ms #define SOCK_BUFFER 4096 -std::vector<std::wstring> OCClientInterface::WatchedDirectories() +OCClientInterface::ContextMenuInfo OCClientInterface::FetchInfo() { auto pipename = std::wstring(L"\\\\.\\pipe\\"); pipename += L"ownCloud"; CommunicationSocket socket; if (!WaitNamedPipe(pipename.data(), PIPE_TIMEOUT)) { - return std::vector<std::wstring>(); + return {}; } if (!socket.Connect(pipename)) { - return std::vector<std::wstring>(); + return {}; } - std::vector<std::wstring> watchedDirectories; + socket.SendMsg(L"SHARE_MENU_TITLE\n"); + + ContextMenuInfo info; std::wstring response; Sleep(50); while (socket.ReadLine(&response)) { if (StringUtil::begins_with(response, wstring(L"REGISTER_PATH:"))) { wstring responsePath = response.substr(14); // length of REGISTER_PATH - watchedDirectories.push_back(responsePath); + info.watchedDirectories.push_back(responsePath); + } + else if (StringUtil::begins_with(response, wstring(L"SHARE_MENU_TITLE:"))) { + info.shareMenuTitle = response.substr(17); // length of SHARE_MENU_TITLE: } } - return watchedDirectories; + return info; } void OCClientInterface::ShareObject(const std::wstring &path) diff --git a/shell_integration/windows/OCContextMenu/OCClientInterface.h b/shell_integration/windows/OCContextMenu/OCClientInterface.h index 7356d1e28..16608e276 100644 --- a/shell_integration/windows/OCContextMenu/OCClientInterface.h +++ b/shell_integration/windows/OCContextMenu/OCClientInterface.h @@ -43,7 +43,11 @@ class CommunicationSocket; class OCClientInterface { public: - static std::vector<std::wstring> WatchedDirectories(); + struct ContextMenuInfo { + std::vector<std::wstring> watchedDirectories; + std::wstring shareMenuTitle; + }; + static ContextMenuInfo FetchInfo(); static void ShareObject(const std::wstring &path); }; diff --git a/shell_integration/windows/OCContextMenu/OCContextMenu.cpp b/shell_integration/windows/OCContextMenu/OCContextMenu.cpp index 4a612a9ca..14cb1b65e 100644 --- a/shell_integration/windows/OCContextMenu/OCContextMenu.cpp +++ b/shell_integration/windows/OCContextMenu/OCContextMenu.cpp @@ -150,8 +150,9 @@ IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT return MAKE_HRESULT(SEVERITY_SUCCESS, 0, USHORT(0)); } + OCClientInterface::ContextMenuInfo info = OCClientInterface::FetchInfo(); bool skip = true; - for (const std::wstring path : OCClientInterface::WatchedDirectories()) { + for (const std::wstring path : info.watchedDirectories) { if (StringUtil::begins_with(std::wstring(m_szSelectedFile), path)) { skip = false; break; @@ -165,11 +166,12 @@ IFACEMETHODIMP OCContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT InsertSeperator(hMenu, indexMenu); indexMenu++; + assert(!info.shareMenuTitle.empty()); MENUITEMINFO mii = { sizeof(mii) }; mii.fMask = MIIM_BITMAP | MIIM_STRING | MIIM_FTYPE | MIIM_ID | MIIM_STATE; mii.wID = idCmdFirst + IDM_SHARE; mii.fType = MFT_STRING; - mii.dwTypeData = m_pszMenuText; + mii.dwTypeData = &info.shareMenuTitle[0]; mii.fState = MFS_ENABLED; if (!InsertMenuItem(hMenu, indexMenu, TRUE, &mii)) { |