| 97 | } |
| 98 | |
| 99 | void JsonOptionsWidget::loadDocument(const QString& filename) { |
| 100 | PERFTRACE(QStringLiteral("JsonOptionsWidget::loadDocument")); |
| 101 | if (m_filename == filename) |
| 102 | return; |
| 103 | else |
| 104 | m_filename = filename; |
| 105 | |
| 106 | KCompressionDevice device(m_filename); |
| 107 | m_model->clear(); |
| 108 | if (!device.open(QIODevice::ReadOnly) || (device.atEnd() && !device.isSequential()) || // empty file |
| 109 | !m_model->loadJson(device.readAll())) |
| 110 | clearModel(); |
| 111 | } |
| 112 | |
| 113 | QAbstractItemModel* JsonOptionsWidget::model() { |
| 114 | return m_model; |
no test coverage detected