| 286 | } |
| 287 | |
| 288 | QSharedPointer<Library> LibraryManager::addFolderAsLibrary(PIDLIST_ABSOLUTE pidl) |
| 289 | { |
| 290 | QSharedPointer<LibraryImpl> library(NULL); |
| 291 | |
| 292 | if (!_comInitialized) |
| 293 | return library; |
| 294 | |
| 295 | IShellItem* folderItem; |
| 296 | if (SUCCEEDED(SHCreateShellItem(NULL, NULL, pidl, &folderItem))) |
| 297 | { |
| 298 | PWSTR filePath = NULL; |
| 299 | if (SUCCEEDED(folderItem->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, &filePath))) |
| 300 | { |
| 301 | QList<QString> directories; |
| 302 | directories.append(QString::fromUtf16((const ushort*)filePath)); |
| 303 | CoTaskMemFree(filePath); |
| 304 | |
| 305 | PWSTR displayName = NULL; |
| 306 | if (SUCCEEDED(folderItem->GetDisplayName(SIGDN_PARENTRELATIVEFORADDRESSBAR, &displayName))) |
| 307 | { |
| 308 | QString name = QString::fromUtf16((const ushort*)displayName); |
| 309 | CoTaskMemFree(displayName); |
| 310 | |
| 311 | library = QSharedPointer<LibraryImpl>(new LibraryImpl(name)); |
| 312 | library->setFolderPaths(directories); |
| 313 | library->setHashKey(QString_NT("usr_%1").arg(directories.front())); |
| 314 | library->setTextureKey(QString_NT("library_default.folder.icon")); |
| 315 | _libraries.insert(library->getHashKey(), library); |
| 316 | } |
| 317 | } |
| 318 | folderItem->Release(); |
| 319 | } |
| 320 | return library; |
| 321 | } |
| 322 | |
| 323 | QSharedPointer<Library> LibraryManager::addFolderAsLibrary(QString& folderPath) |
| 324 | { |
no test coverage detected