| 1352 | } |
| 1353 | |
| 1354 | bool CSaveModifiedItemsDialog::AddItems(ITabbedMDIChildModifiedList* list, int indent) |
| 1355 | { |
| 1356 | if(list == NULL) |
| 1357 | { |
| 1358 | return false; |
| 1359 | } |
| 1360 | |
| 1361 | bool success = true; |
| 1362 | |
| 1363 | long count = 0; |
| 1364 | list->get_Count(&count); |
| 1365 | for(long i=0; i<count; ++i) |
| 1366 | { |
| 1367 | ATL::CComPtr<ITabbedMDIChildModifiedItem> item; |
| 1368 | list->get_Item(i, &item); |
| 1369 | if(item) |
| 1370 | { |
| 1371 | ATL::CComBSTR displayName, description; |
| 1372 | item->get_DisplayName(&displayName); |
| 1373 | item->get_Description(&description); |
| 1374 | |
| 1375 | DATE lastModified = 0; |
| 1376 | item->get_LastModifiedUTC(&lastModified); |
| 1377 | |
| 1378 | _CSTRING_NS::CString displayNameForItem(displayName); |
| 1379 | _CSTRING_NS::CString descriptionForItem(description); |
| 1380 | _CSTRING_NS::CString lastModifiedForItem = this->FormatLastModifiedDateString(lastModified); |
| 1381 | |
| 1382 | if(displayNameForItem.GetLength() < 1) |
| 1383 | { |
| 1384 | displayNameForItem = _T("(New)"); |
| 1385 | } |
| 1386 | |
| 1387 | int imageIndex = 0; |
| 1388 | HICON hIcon = NULL; |
| 1389 | item->get_Icon(&hIcon); |
| 1390 | if(hIcon != NULL) |
| 1391 | { |
| 1392 | imageIndex = m_images.AddIcon(hIcon); |
| 1393 | } |
| 1394 | |
| 1395 | // NOTE: The handler of LVN_INSERTITEM will AddRef, |
| 1396 | // and the handler of LVN_DELETEITEM will Release |
| 1397 | // to be sure we keep the item reference counted appropriately |
| 1398 | // no matter where the InsertItem comes from. |
| 1399 | //IUnknown* punkItem = NULL; |
| 1400 | ATL::CComPtr<IUnknown> punkItem; |
| 1401 | item->QueryInterface(IID_IUnknown, (void**)&punkItem); |
| 1402 | |
| 1403 | LVITEM lvItem = {0}; |
| 1404 | lvItem.mask = (LVIF_TEXT | LVIF_INDENT | LVIF_IMAGE | LVIF_PARAM); |
| 1405 | lvItem.iItem = m_list.GetItemCount(); |
| 1406 | lvItem.iSubItem = 0; |
| 1407 | lvItem.pszText = (LPTSTR)(LPCTSTR)displayNameForItem; |
| 1408 | lvItem.iIndent = indent; |
| 1409 | lvItem.iImage = imageIndex; |
| 1410 | lvItem.lParam = (LPARAM)punkItem.p; |
| 1411 |
no test coverage detected