MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / Enabled

Method Enabled

PathCopyCopy/plugins/src/COMPlugin.cpp:196–211  ·  view source on GitHub ↗

Returns whether plugin should be enabled in the contextual menu. @param p_ParentPath Path of the parent directory of files that triggered the contextual menu. @param p_File Path of one file that was selected. @return Whether plugin should be enabled or not in the contextual menu.

Source from the content-addressed store, hash-verified

194 // @return Whether plugin should be enabled or not in the contextual menu.
195 //
196 bool COMPlugin::Enabled(const std::wstring& p_ParentPath,
197 const std::wstring& p_File) const
198 {
199 // Check if plugin supports state changes. Otherwise assume it is enabled.
200 bool enabled = true;
201 if (m_cpPluginState != nullptr) {
202 // Ask plugin if it should be enabled. If an error
203 // code is returned, do not enable the plugin.
204 ATL::CComBSTR bstrParentPath(p_ParentPath.c_str());
205 ATL::CComBSTR bstrFile(p_File.c_str());
206 VARIANT_BOOL bEnabled = VARIANT_FALSE;
207 const HRESULT hRes = m_cpPluginState->Enabled(bstrParentPath, bstrFile, &bEnabled);
208 enabled = SUCCEEDED(hRes) && hRes != S_FALSE && bEnabled != VARIANT_FALSE;
209 }
210 return enabled;
211 }
212
213 //
214 // Transforms the given path using the plugin.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected