| 332 | } |
| 333 | |
| 334 | std::vector<LPCITEMIDLIST> ShellMenu::createIdls(const std::vector<QFileInfo>& files) |
| 335 | { |
| 336 | std::vector<LPCITEMIDLIST> idls; |
| 337 | std::optional<QDir> parent; |
| 338 | |
| 339 | for (auto&& f : files) { |
| 340 | const auto path = QDir::toNativeSeparators(f.absoluteFilePath()).toStdWString(); |
| 341 | |
| 342 | if (!parent) { |
| 343 | parent = f.absoluteDir(); |
| 344 | } else { |
| 345 | if (*parent != f.absoluteDir()) { |
| 346 | throw DummyMenu(QObject::tr("Selected files must be in the same directory")); |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | auto item = createShellItem(path); |
| 351 | auto pidlist = getPersistIDList(item.get()); |
| 352 | auto absIdl = getIDList(pidlist.get()); |
| 353 | |
| 354 | idls.push_back(absIdl.release()); |
| 355 | } |
| 356 | |
| 357 | return idls; |
| 358 | } |
| 359 | |
| 360 | COMPtr<IShellItemArray> ShellMenu::createItemArray(std::vector<LPCITEMIDLIST>& idls) |
| 361 | { |