! Loads from XML. */
| 846 | Loads from XML. |
| 847 | */ |
| 848 | bool LiveDataSource::load(XmlStreamReader* reader, bool preview) { |
| 849 | if (!readBasicAttributes(reader)) |
| 850 | return false; |
| 851 | |
| 852 | QXmlStreamAttributes attribs; |
| 853 | QString str; |
| 854 | |
| 855 | while (!reader->atEnd()) { |
| 856 | reader->readNext(); |
| 857 | if (reader->isEndElement() |
| 858 | && (reader->name() == QLatin1String("liveDataSource") |
| 859 | || reader->name() == QLatin1String("LiveDataSource"))) // TODO: remove "LiveDataSources" in couple of releases |
| 860 | break; |
| 861 | |
| 862 | if (!reader->isStartElement()) |
| 863 | continue; |
| 864 | |
| 865 | if (reader->name() == QLatin1String("comment")) { |
| 866 | if (!readCommentElement(reader)) |
| 867 | return false; |
| 868 | } else if (reader->name() == QLatin1String("general")) { |
| 869 | attribs = reader->attributes(); |
| 870 | |
| 871 | str = attribs.value(QStringLiteral("fileName")).toString(); |
| 872 | if (str.isEmpty()) |
| 873 | reader->raiseMissingAttributeWarning(QStringLiteral("fileName")); |
| 874 | else |
| 875 | m_fileName = str; |
| 876 | |
| 877 | str = attribs.value(QStringLiteral("fileType")).toString(); |
| 878 | if (str.isEmpty()) |
| 879 | reader->raiseMissingAttributeWarning(QStringLiteral("fileType")); |
| 880 | else |
| 881 | m_fileType = (AbstractFileFilter::FileType)str.toInt(); |
| 882 | |
| 883 | str = attribs.value(QStringLiteral("fileLinked")).toString(); |
| 884 | if (str.isEmpty()) |
| 885 | reader->raiseMissingAttributeWarning(QStringLiteral("fileLinked")); |
| 886 | else |
| 887 | m_fileLinked = str.toInt(); |
| 888 | |
| 889 | str = attribs.value(QStringLiteral("relativePath")).toString(); |
| 890 | if (str.isEmpty()) |
| 891 | reader->raiseMissingAttributeWarning(QStringLiteral("relativePath")); |
| 892 | else |
| 893 | m_relativePath = str.toInt(); |
| 894 | |
| 895 | str = attribs.value(QStringLiteral("updateType")).toString(); |
| 896 | if (str.isEmpty()) |
| 897 | reader->raiseMissingAttributeWarning(QStringLiteral("updateType")); |
| 898 | else |
| 899 | m_updateType = static_cast<UpdateType>(str.toInt()); |
| 900 | |
| 901 | str = attribs.value(QStringLiteral("sourceType")).toString(); |
| 902 | if (str.isEmpty()) |
| 903 | reader->raiseMissingAttributeWarning(QStringLiteral("sourceType")); |
| 904 | else |
| 905 | m_sourceType = static_cast<SourceType>(str.toInt()); |
nothing calls this directly
no test coverage detected