CSV import has now support for optional columns.
This commit is contained in:
@ -119,13 +119,16 @@ void GenericCore::importCSVFile(const QString& filePath) {
|
||||
qInfo() << "importing items from CSV...";
|
||||
qDebug() << "filePath:" << filePath;
|
||||
const QList<ModelItemValues> itemValuesList = FileHandler::getItemValuesFromCSVFile(filePath);
|
||||
// TODO inform UI on errors
|
||||
if (itemValuesList.isEmpty()) {
|
||||
qDebug() << "No items found. Doing nothing...";
|
||||
displayStatusMessage("No items found in CSV file. Either empty or not compatible.");
|
||||
return;
|
||||
}
|
||||
// qDebug() << "CSV file content:" << itemValuesList;
|
||||
m_mainModel->insertItems(m_mainModel->rowCount(), itemValuesList);
|
||||
const QString messageString =
|
||||
QString(tr("Imported %1 item(s) from CSV file.")).arg(itemValuesList.size());
|
||||
displayStatusMessage(messageString);
|
||||
}
|
||||
|
||||
bool GenericCore::exportCSVFile(const QString& filePath) {
|
||||
|
||||
Reference in New Issue
Block a user