567 |
567 |
568 subfileName = subfileRoot + "s" + digits + ".dat"; |
568 subfileName = subfileRoot + "s" + digits + ".dat"; |
569 fullSubfilePath = subfileDirectory.filePath(subfileName); |
569 fullSubfilePath = subfileDirectory.filePath(subfileName); |
570 subfileIndex += 1; |
570 subfileIndex += 1; |
571 } while ( |
571 } while ( |
572 m_documents->findDocumentByName("s\\" + subfileName) != nullptr |
572 m_documents->findDocumentByName("s\\" + subfileName) != m_documents->end() |
573 or QFileInfo {fullSubfilePath}.exists() |
573 or QFileInfo {fullSubfilePath}.exists() |
574 ); |
574 ); |
575 } |
575 } |
576 |
576 |
577 // Create the new subfile document |
577 // Create the new subfile document |
578 LDDocument* subfile = m_window->newDocument(); |
578 LDDocument* subfile = m_documents->createNew(false); |
579 subfile->setFullPath(fullSubfilePath); |
579 subfile->setFullPath(fullSubfilePath); |
580 subfile->header.description = subfileTitle; |
580 subfile->header.description = subfileTitle; |
581 subfile->header.type = LDHeader::Subpart; |
581 subfile->header.type = LDHeader::Subpart; |
582 subfile->header.name = LDDocument::shortenName(fullSubfilePath); |
582 subfile->header.name = LDDocument::shortenName(fullSubfilePath); |
583 subfile->header.author = format("%1 [%2]", config::defaultName(), config::defaultUser()); |
583 subfile->header.author = format("%1 [%2]", config::defaultName(), config::defaultUser()); |