MCPcopy Create free account
hub / github.com/KDE/labplot / handleLooseWindows

Method handleLooseWindows

src/backend/datasources/projects/OriginProjectParser.cpp:672–825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672void OriginProjectParser::handleLooseWindows(Folder* folder, bool preview) {
673 QDEBUG(Q_FUNC_INFO << ", paths to load:" << folder->pathesToLoad());
674 QDEBUG(" spreads =" << m_spreadsheetNameList);
675 QDEBUG(" workbooks =" << m_workbookNameList);
676 QDEBUG(" matrices =" << m_matrixNameList);
677 QDEBUG(" worksheets =" << m_worksheetNameList);
678 QDEBUG(" notes =" << m_noteNameList);
679
680 DEBUG("Number of spreads loaded:\t" << m_spreadsheetNameList.size() << ", in file: " << m_originFile->spreadCount());
681 DEBUG("Number of excels loaded:\t" << m_workbookNameList.size() << ", in file: " << m_originFile->excelCount());
682 DEBUG("Number of matrices loaded:\t" << m_matrixNameList.size() << ", in file: " << m_originFile->matrixCount());
683 DEBUG("Number of graphs loaded:\t" << m_worksheetNameList.size() << ", in file: " << m_originFile->graphCount());
684 DEBUG("Number of notes loaded:\t\t" << m_noteNameList.size() << ", in file: " << m_originFile->noteCount());
685
686 // loop over all spreads to find loose ones
687 for (unsigned int i = 0; i < m_originFile->spreadCount(); i++) {
688 AbstractAspect* aspect = nullptr;
689 const auto& spread = m_originFile->spread(i);
690 QString name = QString::fromStdString(spread.name);
691
692 DEBUG(" spread.objectId = " << spread.objectID);
693 // skip unused spreads if selected
694 if (spread.objectID < 0 && !m_importUnusedObjects) {
695 DEBUG(" Dropping unused loose spread: " << STDSTRING(name));
696 continue;
697 }
698
699 const QString childPath = folder->path() + QLatin1Char('/') + name;
700 // we could also use spread.loose
701 if (!m_spreadsheetNameList.contains(name) && (preview || folder->pathesToLoad().indexOf(childPath) != -1)) {
702 DEBUG(" Adding loose spread: " << STDSTRING(name));
703
704 auto* spreadsheet = new Spreadsheet(name);
705 loadSpreadsheet(spreadsheet, preview, name);
706 aspect = spreadsheet;
707 }
708 if (aspect) {
709 folder->addChildFast(aspect);
710 DEBUG(" creation time as reported by liborigin: " << spread.creationDate);
711 aspect->setCreationTime(QDateTime::fromSecsSinceEpoch(spread.creationDate));
712 }
713 }
714 // loop over all workbooks to find loose ones
715 for (unsigned int i = 0; i < m_originFile->excelCount(); i++) {
716 AbstractAspect* aspect = nullptr;
717 const auto& excel = m_originFile->excel(i);
718 QString name = QString::fromStdString(excel.name);
719
720 DEBUG(" excel.objectId = " << excel.objectID);
721 // skip unused data sets if selected
722 if (excel.objectID < 0 && !m_importUnusedObjects) {
723 DEBUG(" Dropping unused loose excel: " << STDSTRING(name));
724 continue;
725 }
726
727 const QString childPath = folder->path() + QLatin1Char('/') + name;
728 // we could also use excel.loose
729 if (!m_workbookNameList.contains(name) && (preview || folder->pathesToLoad().indexOf(childPath) != -1)) {

Callers

nothing calls this directly

Calls 11

spreadCountMethod · 0.80
excelCountMethod · 0.80
matrixCountMethod · 0.80
graphCountMethod · 0.80
noteCountMethod · 0.80
addChildFastMethod · 0.80
setCreationTimeMethod · 0.80
sizeMethod · 0.45
pathMethod · 0.45
containsMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected