MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / createNewDocumentGroup

Method createNewDocumentGroup

src/document/UBDocumentController.cpp:2016–2034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2014}
2015
2016void UBDocumentController::createNewDocumentGroup()
2017{
2018 UBPersistenceManager *pManager = UBPersistenceManager::persistenceManager();
2019 UBDocumentTreeModel *docModel = pManager->mDocumentTreeStructureModel;
2020 QModelIndex selectedIndex = firstSelectedTreeIndex();
2021 if (!selectedIndex.isValid()) {
2022 selectedIndex = docModel->myDocumentsIndex();
2023 }
2024 QModelIndex parentIndex = docModel->isCatalog(selectedIndex)
2025 ? selectedIndex
2026 : selectedIndex.parent();
2027
2028 QString newFolderName = docModel->adjustNameForParentIndex(tr("New Folder"), parentIndex);
2029
2030 QModelIndex newIndex = docModel->addCatalog(newFolderName, parentIndex);
2031 mDocumentUI->documentTreeView->setSelectedAndExpanded(newIndex, true, true);
2032
2033 pageSelectionChanged();
2034}
2035
2036
2037std::shared_ptr<UBDocumentProxy> UBDocumentController::selectedDocumentProxy()

Callers

nothing calls this directly

Calls 7

myDocumentsIndexMethod · 0.80
isCatalogMethod · 0.80
addCatalogMethod · 0.80
isValidMethod · 0.45
parentMethod · 0.45

Tested by

no test coverage detected