MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / Copy

Method Copy

App/Client/Favorite/FavoriteModel.cpp:301–321  ·  view source on GitHub ↗

TODO: not test!!!

Source from the content-addressed store, hash-verified

299
300// TODO: not test!!!
301bool CFavoriteModel::Copy(QModelIndex index, QModelIndex parentIndex)
302{
303 bool bRet = false;
304 if(!index.isValid()) return false;
305 tree* ip = GetTree(index);
306 if(!ip) return false;
307 tree* ipParent = GetTree(parentIndex);
308 if(!ipParent || ipParent->item.isFavorite()) return false;
309 int nParentId = ipParent->item.id;
310 auto& item = ip->item;
311 if(item.isFavorite())
312 bRet = AddFavorite(item.szFile, item.szName, item.GetIcon(),
313 item.szDescription, nParentId);
314 else {
315 if(item.id != nParentId)
316 bRet = m_pDatabase->AddNode(item.szName, nParentId);
317 if(bRet)
318 bRet = AddTree(item, nParentId);
319 }
320 return bRet;
321}
322
323CFavoriteDatabase::Item CFavoriteModel::GetFavorite(const QString &szFile)
324{

Callers 1

foreachFunction · 0.80

Calls 4

isValidMethod · 0.80
isFavoriteMethod · 0.80
GetIconMethod · 0.45
AddNodeMethod · 0.45

Tested by

no test coverage detected