| 660 | } |
| 661 | |
| 662 | void FileSystemManager::createShortcut(QString shortcutFilePath, QString pathToTarget, QString desc) |
| 663 | { |
| 664 | HRESULT hres = NULL; |
| 665 | IShellLink * psl = NULL; |
| 666 | IPersistFile * ppf = NULL; |
| 667 | |
| 668 | QDir workingDirectory = scnManager->getWorkingDirectory(); |
| 669 | QDir linkPath = workingDirectory / shortcutFilePath; |
| 670 | |
| 671 | // Get a pointer to the IShellLink interface. |
| 672 | hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void **) &psl); |
| 673 | |
| 674 | if (SUCCEEDED(hres)) |
| 675 | { |
| 676 | // Set the path to the shortcut target |
| 677 | psl->SetPath((LPCWSTR) pathToTarget.utf16()); |
| 678 | psl->SetDescription((LPCWSTR) desc.utf16()); |
| 679 | |
| 680 | // Query IShellLink for the IPersistFile interface for |
| 681 | // saving the shortcut in persistent storage. |
| 682 | hres = psl->QueryInterface(IID_IPersistFile, (void **) &ppf); |
| 683 | |
| 684 | if (SUCCEEDED(hres)) |
| 685 | { |
| 686 | // Save the link by calling IPersistFile::Save. |
| 687 | hres = ppf->Save((LPCOLESTR) native(linkPath).utf16(), TRUE); |
| 688 | ppf->Release(); |
| 689 | } |
| 690 | |
| 691 | psl->Release(); |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | void FileSystemManager::onFileAdded(LPCWSTR strFileName) |
| 696 | { |
nothing calls this directly
no test coverage detected