| 358 | } |
| 359 | |
| 360 | std::optional<ShellBrowser::InfoTipResult> ShellBrowser::GetInfoTipAsync(HWND listView, |
| 361 | int infoTipResultId, int internalIndex, const BasicItemInfo_t &basicItemInfo, |
| 362 | const Config &config, HINSTANCE instance, bool virtualFolder) |
| 363 | { |
| 364 | std::wstring infoTip; |
| 365 | |
| 366 | /* Use Explorer infotips if the option is selected, or this is a |
| 367 | virtual folder. Otherwise, show the modified date. */ |
| 368 | if ((config.infoTipType == InfoTipType::System) || virtualFolder) |
| 369 | { |
| 370 | TCHAR infoTipText[256]; |
| 371 | HRESULT hr = GetItemInfoTip( |
| 372 | basicItemInfo.pidlComplete.get(), infoTipText, SIZEOF_ARRAY(infoTipText)); |
| 373 | |
| 374 | if (FAILED(hr)) |
| 375 | { |
| 376 | return std::nullopt; |
| 377 | } |
| 378 | |
| 379 | infoTip = infoTipText; |
| 380 | } |
| 381 | else |
| 382 | { |
| 383 | TCHAR dateModified[64]; |
| 384 | LoadString(instance, IDS_GENERAL_DATEMODIFIED, dateModified, SIZEOF_ARRAY(dateModified)); |
| 385 | |
| 386 | TCHAR fileModificationText[256]; |
| 387 | BOOL fileTimeResult = |
| 388 | CreateFileTimeString(&basicItemInfo.wfd.ftLastWriteTime, fileModificationText, |
| 389 | SIZEOF_ARRAY(fileModificationText), config.globalFolderSettings.showFriendlyDates); |
| 390 | |
| 391 | if (!fileTimeResult) |
| 392 | { |
| 393 | return std::nullopt; |
| 394 | } |
| 395 | |
| 396 | infoTip = str(boost::wformat(_T("%s: %s")) % dateModified % fileModificationText); |
| 397 | } |
| 398 | |
| 399 | PostMessage(listView, WM_APP_INFO_TIP_READY, infoTipResultId, 0); |
| 400 | |
| 401 | InfoTipResult result; |
| 402 | result.itemInternalIndex = internalIndex; |
| 403 | result.infoTip = infoTip; |
| 404 | |
| 405 | return result; |
| 406 | } |
| 407 | |
| 408 | void ShellBrowser::ProcessInfoTipResult(int infoTipResultId) |
| 409 | { |
nothing calls this directly
no test coverage detected