| 203 | } |
| 204 | |
| 205 | bool CFavoriteModel::removeRows(int row, int count, const QModelIndex &parent) |
| 206 | { |
| 207 | tree* pItem = GetTree(parent); |
| 208 | if(!pItem || 0 > row || row + count > pItem->ChildCount()) |
| 209 | return false; |
| 210 | |
| 211 | beginRemoveRows(parent, row, row + count - 1); |
| 212 | for(int i = row; i < row + count; i++) { |
| 213 | auto t = pItem->children[i]; |
| 214 | if(!t) continue; |
| 215 | if(t->item.isFolder()) { |
| 216 | m_pDatabase->DeleteNode(t->item.id, true); |
| 217 | m_Folders.remove(t->item.id); |
| 218 | } else { |
| 219 | m_pDatabase->Delete(t->item.id, true); |
| 220 | } |
| 221 | pItem->RemoveChild(t); |
| 222 | ClearTree(t); |
| 223 | } |
| 224 | endRemoveRows(); |
| 225 | emit dataChanged(parent, parent); |
| 226 | return true; |
| 227 | } |
| 228 | |
| 229 | bool CFavoriteModel::AddFavorite( |
| 230 | const QString &szFile, const QString& szName, const QIcon &icon, |
nothing calls this directly
no test coverage detected