| 227 | } |
| 228 | |
| 229 | void CGenericClientListCtrl::AddSource(CKnownFile* owner, const CClientRef& source, SourceItemType type) |
| 230 | { |
| 231 | wxCHECK_RET(owner, "NULL owner in CGenericClientListCtrl::AddSource"); |
| 232 | wxCHECK_RET(source.IsLinked(), "Unlinked source in CGenericClientListCtrl::AddSource"); |
| 233 | |
| 234 | // Update the other instances of this source |
| 235 | bool bFound = false; |
| 236 | ListIteratorPair rangeIt = m_ListItems.equal_range(source.ECID()); |
| 237 | for ( ListItems::iterator it = rangeIt.first; it != rangeIt.second; ++it ) { |
| 238 | ClientCtrlItem_Struct* cur_item = it->second; |
| 239 | |
| 240 | // Check if this source has been already added to this file => to be sure |
| 241 | if ( cur_item->GetOwner() == owner ) { |
| 242 | // Update this instance with its new setting |
| 243 | if ((type == A4AF_SOURCE) && |
| 244 | cur_item->GetSource().GetRequestFile() |
| 245 | && std::binary_search(m_knownfiles.begin(), m_knownfiles.end(), cur_item->GetSource().GetRequestFile())) { |
| 246 | cur_item->SetContents(owner, source, AVAILABLE_SOURCE); |
| 247 | } else { |
| 248 | cur_item->SetContents(owner, source, type); |
| 249 | } |
| 250 | cur_item->dwUpdated = 0; |
| 251 | bFound = true; |
| 252 | } else if ( type == AVAILABLE_SOURCE ) { |
| 253 | // The state 'Available' is exclusive |
| 254 | cur_item->SetContents(cur_item->GetOwner(), source, A4AF_SOURCE); |
| 255 | cur_item->dwUpdated = 0; |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | if ( bFound ) { |
| 260 | return; |
| 261 | } |
| 262 | |
| 263 | if ( std::binary_search(m_knownfiles.begin(), m_knownfiles.end(), owner) ) { |
| 264 | RawAddSource(owner, source, type); |
| 265 | |
| 266 | ShowSourcesCount( 1 ); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | void CGenericClientListCtrl::RawRemoveSource( ListItems::iterator& it) |
| 271 | { |
nothing calls this directly
no test coverage detected