| 561 | } |
| 562 | |
| 563 | void CRemoteFileSystemModel::slotGetDir( |
| 564 | CRemoteFileSystem *p, |
| 565 | QVector<QSharedPointer<CRemoteFileSystem> > contents, |
| 566 | bool bEnd) |
| 567 | { |
| 568 | if(!p) { |
| 569 | qCritical(log) << "The pointer is nullptr"; |
| 570 | return; |
| 571 | } |
| 572 | int nIndex = m_GetFolder.indexOf(p); |
| 573 | if(-1 == nIndex) { |
| 574 | qDebug(log) << "Is not the model"; |
| 575 | return; |
| 576 | } |
| 577 | //qDebug(log) << Q_FUNC_INFO << p->GetPath() << contents.size() << bEnd; |
| 578 | m_GetFolder.removeAt(nIndex); |
| 579 | QModelIndex parentIndex; |
| 580 | parentIndex = index(p, 0); |
| 581 | qDebug(log) << "slotGetDir:" << p << p << p->GetPath() << parentIndex << contents.size(); |
| 582 | p->SetState(CRemoteFileSystem::State::Ok); |
| 583 | if(contents.size() > 0) { |
| 584 | int nCount = 0; |
| 585 | foreach(auto c, contents) { |
| 586 | if(!c) continue; |
| 587 | if(!(c->GetType() & GetFilter())) continue; |
| 588 | nCount++; |
| 589 | } |
| 590 | beginInsertRows(parentIndex, 0, nCount); |
| 591 | foreach(auto c, contents) { |
| 592 | if(!c) continue; |
| 593 | if(!(c->GetType() & GetFilter())) continue; |
| 594 | CRemoteFileSystem* pRfs = |
| 595 | new CRemoteFileSystem(c->GetPath(), c->GetType()); |
| 596 | pRfs->SetSize(c->GetSize()); |
| 597 | pRfs->SetPermissions(c->GetPermissions()); |
| 598 | pRfs->SetLastModified(c->GetLastModified()); |
| 599 | pRfs->SetCreateTime(c->GetCreateTime()); |
| 600 | p->AppendChild(pRfs); |
| 601 | } |
| 602 | endInsertRows(); |
| 603 | auto topleft = index(0, 0, parentIndex); |
| 604 | auto bottomRight = index(p->ChildCount(), p->ColumnCount(), parentIndex); |
| 605 | if(topleft.isValid() && bottomRight.isValid()) |
| 606 | emit dataChanged(topleft, bottomRight); |
| 607 | } else |
| 608 | emit dataChanged(parentIndex, parentIndex); |
| 609 | } |
| 610 | |
| 611 | void CRemoteFileSystemModel::CreateDir(QModelIndex index, const QString &dir) |
| 612 | { |
nothing calls this directly
no test coverage detected