Changeset 0b8f7055dad4…
Parent cf4b87c14212…
by
Changes to 3 files · Browse files at 0b8f7055dad4 Showing diff from parent cf4b87c14212 Diff from another changeset...
@@ -17,6 +17,7 @@ #include "THgShell_h.h"
#include "TortoiseHgKeyboard.h"
+#include "TortoiseUtils.h"
// Each Windows Explorer window is launched in a separate thread. Therefore, use thread
// local storage so that each thread can have its own hook.
@@ -75,6 +76,8 @@ {
CAtlList<CString> listFiles;
g_pObject->GetSelectedFiles(listFiles);
+ CString strFolder;
+ g_pObject->GetFolder(strFolder);
}
}
}
@@ -131,6 +134,27 @@ return true;
}
+#define FILE_PREFIX "file:///"
+#define FILE_PREFIX_LENGTH (sizeof(FILE_PREFIX) / sizeof(TCHAR) - 1)
+
+bool CTortoiseHgKeyboard::GetFolder(CString& strFolder)
+{
+ // Get the URL of the current location.
+ CComQIPtr<IWebBrowser2> spWB = m_spUnkSite;
+ if (spWB == NULL) return false;
+ BSTR bstrURL;
+ if (FAILED(spWB->get_LocationURL(&bstrURL))) return false;
+ strFolder = bstrURL;
+ ::SysFreeString(bstrURL);
+
+ // Check if it's a file URL and extract the path.
+ if (StartsWith(strFolder, FILE_PREFIX))
+ {
+ strFolder = strFolder.Mid(FILE_PREFIX_LENGTH);
+ }
+ return true;
+}
+
CTortoiseHgKeyboard::CTortoiseHgKeyboard() :
m_hHook(NULL)
{
|
@@ -39,6 +39,7 @@ private:
bool GetActiveShellView(IShellView** ppSV);
bool GetSelectedFiles(CAtlList<CString>& listFiles);
+ bool GetFolder(CString& strFolder);
static LRESULT CALLBACK HookProc(int code, WPARAM wParam, LPARAM lParam);
};
|
@@ -26,4 +26,5 @@ #include <atlcom.h>
#include <atlstr.h>
#include <atlcoll.h>
+#include <atlutil.h>
#include <shlobj.h>
|
Loading...