int PWScore::MergeDependents(PWScore *pothercore, MultiCommands *pmulticmds, uuid_array_t &base_uuid, uuid_array_t &new_base_uuid, const bool bTitleRenamed, stringT &str_timestring, const CItemData::EntryType et, std::vector<StringX> &vs_added) { UUIDVector dependentslist; UUIDVectorIter paiter; ItemListIter iter; ItemListConstIter foundPos; CItemData ci_temp; int numadded(0); StringX sx_merged; LoadAString(sx_merged, IDSC_MERGED); // Get all the dependents pothercore->GetAllDependentEntries(base_uuid, dependentslist, et); for (paiter = dependentslist.begin(); paiter != dependentslist.end(); paiter++) { iter = pothercore->Find(*paiter); if (iter == pothercore->GetEntryEndIter()) continue; CItemData *pci = &iter->second; ci_temp = (*pci); if (Find(*paiter) != GetEntryEndIter()) { ci_temp.CreateUUID(); } // If the base title was renamed - we should automatically rename any dependent. // If we didn't, we still need to check uniqueness! StringX sx_newTitle = ci_temp.GetTitle(); if (bTitleRenamed) { StringX sx_otherTitle(sx_newTitle); Format(sx_newTitle, L"%ls%ls%ls", sx_otherTitle.c_str(), sx_merged.c_str(), str_timestring.c_str()); ci_temp.SetTitle(sx_newTitle); } // Check this is unique - if not - don't add this one! - its only an alias/shortcut! // We can't keep trying for uniqueness after adding a timestamp! foundPos = Find(ci_temp.GetGroup(), sx_newTitle, ci_temp.GetUser()); if (foundPos != GetEntryEndIter()) continue; Command *pcmd1 = AddEntryCommand::Create(this, ci_temp, new_base_uuid); pcmd1->SetNoGUINotify(); pmulticmds->Add(pcmd1); if (et == CItemData::ET_ALIAS) { ci_temp.SetPassword(_T("[Alias]")); ci_temp.SetAlias(); } else if (et == CItemData::ET_SHORTCUT) { ci_temp.SetPassword(_T("[Shortcut]")); ci_temp.SetShortcut(); } else ASSERT(0); StringX sx_added; Format(sx_added, GROUPTITLEUSERINCHEVRONS, ci_temp.GetGroup().c_str(), ci_temp.GetTitle().c_str(), ci_temp.GetUser().c_str()); vs_added.push_back(sx_added); numadded++; } return numadded; }