* \brief Load name and creation time from XML * * \return false on error */
| 946 | * \return false on error |
| 947 | */ |
| 948 | bool AbstractAspect::readBasicAttributes(XmlStreamReader* reader) { |
| 949 | const QXmlStreamAttributes& attribs = reader->attributes(); |
| 950 | |
| 951 | // name |
| 952 | QString str = attribs.value(QLatin1String("name")).toString(); |
| 953 | if (str.isEmpty()) |
| 954 | reader->raiseWarning(i18n("Attribute 'name' is missing or empty.")); |
| 955 | |
| 956 | d->m_name = str; |
| 957 | |
| 958 | // creation time |
| 959 | str = attribs.value(QLatin1String("creation_time")).toString(); |
| 960 | if (str.isEmpty()) { |
| 961 | reader->raiseWarning(i18n("Invalid creation time for '%1'. Using current time.", name())); |
| 962 | d->m_creation_time = QDateTime::currentDateTime(); |
| 963 | } else { |
| 964 | QDateTime creation_time = QDateTime::fromString(str, QLatin1String("yyyy-dd-MM hh:mm:ss:zzz")); |
| 965 | if (creation_time.isValid()) |
| 966 | d->m_creation_time = std::move(creation_time); |
| 967 | else |
| 968 | d->m_creation_time = QDateTime::currentDateTime(); |
| 969 | } |
| 970 | |
| 971 | str = attribs.value(QLatin1String("uuid")).toString(); |
| 972 | if (!str.isEmpty()) { |
| 973 | d->m_uuid = QUuid(str); |
| 974 | } |
| 975 | return true; |
| 976 | } |
| 977 | |
| 978 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 979 | //@} |
nothing calls this directly
no test coverage detected