MCPcopy Create free account
hub / github.com/bumptop/BumpTop / createLibrary

Method createLibrary

trunk/win/Source/BT_LibraryManager.cpp:254–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254QSharedPointer<Library> LibraryManager::createLibrary(IShellItem* item)
255{
256 if (!_comInitialized)
257 return QSharedPointer<Library>();
258
259 QSharedPointer<LibraryImpl> lib;
260 LPWSTR name;
261 HRESULT hr = item->GetDisplayName(SIGDN_NORMALDISPLAY, &name);
262 if (SUCCEEDED(hr))
263 {
264 QString libraryName(QString::fromUtf16((const ushort*)name));
265 QString iconPath = getLibraryIconPath(item);
266
267 IShellLibrary* library;
268 hr = SHLoadLibraryFromItem(item, STGM_READ, IID_PPV_ARGS(&library));
269 if (SUCCEEDED(hr))
270 {
271 // Get the folders that this library uses
272 QList<QString> folderPaths = getLibraryFolderPaths(library);
273 if (!folderPaths.isEmpty())
274 {
275 lib = QSharedPointer<LibraryImpl>(new LibraryImpl(libraryName));
276 lib->setFolderPaths(folderPaths);
277 lib->setIconPath(iconPath);
278 lib->setValid(true);
279 lib->setHashKey(QString_NT("lib_%1").arg(libraryName));
280 }
281 library->Release();
282 }
283 CoTaskMemFree(name);
284 }
285 return lib;
286}
287
288QSharedPointer<Library> LibraryManager::addFolderAsLibrary(PIDLIST_ABSOLUTE pidl)
289{

Callers

nothing calls this directly

Calls 8

SHLoadLibraryFromItemFunction · 0.85
setFolderPathsMethod · 0.80
setIconPathMethod · 0.80
setValidMethod · 0.80
setHashKeyMethod · 0.80
isEmptyMethod · 0.45
argMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected