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

Method RemoveDir

Plugins/FileTransfer/RemoteFileSystemModel.cpp:628–654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

626}
627
628void CRemoteFileSystemModel::RemoveDir(QModelIndex index)
629{
630 auto p = GetRemoteFileSystemFromIndex(index);
631 if(p && !p->GetPath().isEmpty()) {
632 if(QMessageBox::question(
633 nullptr, tr("Delete directory"),
634 tr("Are you sure you want to delete '%1'?").arg(p->GetPath()),
635 QMessageBox::Yes | QMessageBox::No)
636 != QMessageBox::Yes)
637 return;
638 if(p->GetType() & CRemoteFileSystem::TYPE::DIR)
639 emit sigRemoveDir(p->GetPath());
640 else
641 emit sigRemoveFile(p->GetPath());
642
643 auto pParent = p->GetParent();
644 if(pParent) {
645 int nIdx = pParent->IndexOf(p);
646 beginRemoveRows(index.parent(), nIdx, nIdx);
647 pParent->RemoveChild(nIdx);
648 DeleteRemoteFileSystem(p);
649 endRemoveRows();
650 pParent->SetState(CRemoteFileSystem::State::No);
651 fetchMore(index.parent());
652 }
653 }
654}
655
656bool CRemoteFileSystemModel::setData(
657 const QModelIndex &index, const QVariant &value, int role)

Callers

nothing calls this directly

Calls 8

GetPathMethod · 0.80
GetParentMethod · 0.80
IndexOfMethod · 0.80
SetStateMethod · 0.80
isEmptyMethod · 0.45
GetTypeMethod · 0.45
parentMethod · 0.45
RemoveChildMethod · 0.45

Tested by

no test coverage detected