diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2014-08-08 04:39:43 +0400 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2014-08-08 04:40:46 +0400 |
commit | 5306cdc7a1a8e56f3af1d09b7c109f4b5090c993 (patch) | |
tree | 11e87fc066b20bb4a7d8d11ba7cf43d9e95f06b3 /shell_integration | |
parent | 344b98bf1365a16f74694f97358080b6454d3507 (diff) |
Shell Integration: Fix Integration bug when explorer starts before OCC
Also slightly improves performance
Diffstat (limited to 'shell_integration')
-rw-r--r-- | shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp | 38 | ||||
-rw-r--r-- | shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h | 2 |
2 files changed, 34 insertions, 6 deletions
diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp index 20b809bdc..8e0265d67 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.cpp @@ -14,6 +14,7 @@ #include "OCOverlay.h" +#include "OCOverlayFactory.h" #include "RegistryUtil.h" #include "StringUtil.h" @@ -35,6 +36,10 @@ extern HINSTANCE instanceHandle; #define IDM_DISPLAY 0 #define IDB_OK 101 +namespace { + static std::vector<std::wstring> s_watchedDirectories; +} + OCOverlay::OCOverlay(int state) : _communicationSocket(0) , _referenceCount(1) @@ -42,8 +47,6 @@ OCOverlay::OCOverlay(int state) , _state(state) { - // FIXME: Use Registry instead - _watchedDirectories = _checker->WatchedDirectories(); } OCOverlay::~OCOverlay(void) @@ -90,7 +93,28 @@ IFACEMETHODIMP_(ULONG) OCOverlay::Release() IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority) { - pPriority = 0; + // this defines which handler has prededence, so + // we order this in terms of likelyhood + switch (_state) { + case State_OK: + *pPriority = 0; + case State_OKShared: + *pPriority = 1; + case State_Warning: + *pPriority = 2; + case State_WarningShared: + *pPriority = 3; + case State_Sync: + *pPriority = 4; + case State_SyncShared: + *pPriority = 5; + case State_Error: + *pPriority = 6; + case State_ErrorShared: + *pPriority = 7; + default: + *pPriority = 8; + } return S_OK; } @@ -103,11 +127,17 @@ IFACEMETHODIMP OCOverlay::GetPriority(int *pPriority) // return MAKE_HRESULT(S_FALSE, 0, 0); //} + // FIXME: Use Registry instead, this will only trigger once + // and now follow any user changes in the client + if (s_watchedDirectories.empty()) { + s_watchedDirectories = _checker->WatchedDirectories(); + } + wstring wpath(pwszPath); wpath.append(L"\\"); vector<wstring>::iterator it; bool watched = false; - for (it = _watchedDirectories.begin(); it != _watchedDirectories.end(); ++it) { + for (it = s_watchedDirectories.begin(); it != s_watchedDirectories.end(); ++it) { if (StringUtil::begins_with(wpath, *it)) { watched = true; } diff --git a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h index 801b30332..a84bc45b0 100644 --- a/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h +++ b/shell_integration/windows/OCShellExtensions/OCOverlays/OCOverlay.h @@ -45,8 +45,6 @@ private: CommunicationSocket* _communicationSocket; RemotePathChecker* _checker; int _state; - - std::vector<std::wstring> _watchedDirectories; }; #endif
\ No newline at end of file |