ImportDescriptor* ModelServicesImp::createImportDescriptor(DataDescriptor* pDescriptor, bool bImported) const { ImportDescriptor* pImportDescriptor = NULL; if (pDescriptor != NULL) { pImportDescriptor = new ImportDescriptorImp(pDescriptor); if (pImportDescriptor != NULL) { pImportDescriptor->setImported(bImported); } } return pImportDescriptor; }
void ImportOptionsDlg::accept() { // Apply changes to the data descriptor applyChanges(); // Check if the user has no selected data sets for a file and display a message box if necessary if (mAllowDeselectedFiles == true) { for (int i = 0; i < mpDatasetTree->topLevelItemCount(); ++i) { QTreeWidgetItem* pFileItem = mpDatasetTree->topLevelItem(i); if ((pFileItem != NULL) && (pFileItem->checkState(0) == Qt::Unchecked)) { int returnValue = QMessageBox::question(this, windowTitle(), "At least one file does not have any data " "sets that will be imported. Do you want to continue?", QMessageBox::Yes | QMessageBox::No); if (returnValue == QMessageBox::No) { return; } break; } } } // Apply changes to the imported data sets for (map<ImportDescriptor*, QTreeWidgetItem*>::iterator iter = mDatasets.begin(); iter != mDatasets.end(); ++iter) { ImportDescriptor* pDataset = iter->first; if (pDataset != NULL) { QTreeWidgetItem* pItem = iter->second; if (pItem != NULL) { bool bImport = (pItem->checkState(0) != Qt::Unchecked); pDataset->setImported(bImport); } } } // Close the dialog QDialog::accept(); }