| 252 | } |
| 253 | |
| 254 | QSharedPointer<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 | |
| 288 | QSharedPointer<Library> LibraryManager::addFolderAsLibrary(PIDLIST_ABSOLUTE pidl) |
| 289 | { |
nothing calls this directly
no test coverage detected