Commit 68b44411 authored by Alexander Semke's avatar Alexander Semke

[import] minor improvements in the ImportFileWidget:

1. showing the content of the file can be expensive, show the wait
cursor here.
2. clear the privous content of the model in JsonOptionsWidget when a new JSON file is loaded.
parent f6819f91
......@@ -1559,6 +1559,9 @@ void ImportFileWidget::updateContent(const QString& fileName) {
if (m_suppressRefresh)
return;
QApplication::processEvents(QEventLoop::AllEvents, 0);
WAIT_CURSOR;
QDEBUG("ImportFileWidget::updateContent(): file name = " << fileName);
if (auto filter = currentFileFilter()) {
switch (filter->type()) {
......@@ -1588,6 +1591,7 @@ void ImportFileWidget::updateContent(const QString& fileName) {
break;
}
}
RESET_CURSOR;
}
void ImportFileWidget::updateTypeChanged(int idx) {
......
......@@ -120,6 +120,7 @@ void JsonOptionsWidget::loadDocument(const QString& filename) {
m_filename = filename;
KFilterDev device(m_filename);
m_model->clear();
if (!device.open(QIODevice::ReadOnly) ||
(device.atEnd() && !device.isSequential()) || // empty file
!m_model->loadJson(device.readAll())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment