Changeset View
Changeset View
Standalone View
Standalone View
src/acbf/AcbfPublishinfo.cpp
Context not available. | |||||
56 | writer->writeEndElement(); | 56 | writer->writeEndElement(); | ||
---|---|---|---|---|---|
57 | 57 | | |||
58 | writer->writeStartElement(QStringLiteral("publish-date")); | 58 | writer->writeStartElement(QStringLiteral("publish-date")); | ||
59 | writer->writeAttribute(QStringLiteral("value"), d->publishDate.toString(QStringLiteral("YYYY-MM-dd"))); | 59 | writer->writeAttribute(QStringLiteral("value"), d->publishDate.toString(QStringLiteral("yyyy-MM-dd"))); | ||
60 | writer->writeCharacters(d->publishDate.toString(QStringLiteral("MMMM d yyyy"))); | 60 | writer->writeCharacters(d->publishDate.toString(QStringLiteral("MMMM d yyyy"))); | ||
61 | writer->writeEndElement(); | 61 | writer->writeEndElement(); | ||
62 | 62 | | |||
Context not available. | |||||
86 | else if(xmlReader->name() == QStringLiteral("publish-date")) | 86 | else if(xmlReader->name() == QStringLiteral("publish-date")) | ||
87 | { | 87 | { | ||
88 | QString date = xmlReader->attributes().value(QStringLiteral("value")).toString(); | 88 | QString date = xmlReader->attributes().value(QStringLiteral("value")).toString(); | ||
89 | if(date.isEmpty()) { | 89 | if(date.isEmpty() || !QDate::fromString(date, Qt::ISODate).isValid()) { | ||
90 | date = xmlReader->readElementText(); | 90 | date = xmlReader->readElementText(); | ||
91 | setPublishDate(QDate::fromString(date)); | ||||
91 | } else { | 92 | } else { | ||
93 | setPublishDate(QDate::fromString(date, Qt::ISODate)); | ||||
92 | xmlReader->skipCurrentElement(); | 94 | xmlReader->skipCurrentElement(); | ||
93 | } | 95 | } | ||
94 | setPublishDate(QDate::fromString(date)); | | |||
95 | } | 96 | } | ||
96 | else if(xmlReader->name() == QStringLiteral("city")) | 97 | else if(xmlReader->name() == QStringLiteral("city")) | ||
97 | { | 98 | { | ||
Context not available. | |||||
126 | void PublishInfo::setPublisher(const QString& publisher) | 127 | void PublishInfo::setPublisher(const QString& publisher) | ||
127 | { | 128 | { | ||
128 | d->publisher = publisher; | 129 | d->publisher = publisher; | ||
130 | emit publisherChanged(); | ||||
129 | } | 131 | } | ||
130 | 132 | | |||
131 | QDate PublishInfo::publishDate() const | 133 | QDate PublishInfo::publishDate() const | ||
132 | { | 134 | { | ||
133 | return d->publishDate; | 135 | if (d->publishDate.isValid()) { | ||
136 | return d->publishDate; | ||||
137 | } else { | ||||
138 | return QDate().currentDate(); | ||||
139 | } | ||||
134 | } | 140 | } | ||
135 | 141 | | |||
136 | void PublishInfo::setPublishDate(const QDate& publishDate) | 142 | void PublishInfo::setPublishDate(const QDate& publishDate) | ||
137 | { | 143 | { | ||
138 | d->publishDate = publishDate; | 144 | d->publishDate = publishDate; | ||
145 | emit publishDateChanged(); | ||||
146 | } | ||||
147 | | ||||
148 | void PublishInfo::setPublishDateFromInts(const int &year, const int &month, const int &day) | ||||
149 | { | ||||
150 | QDate date(year, month, day); | ||||
151 | setPublishDate(date); | ||||
139 | } | 152 | } | ||
140 | 153 | | |||
141 | QString PublishInfo::city() const | 154 | QString PublishInfo::city() const | ||
Context not available. | |||||
146 | void PublishInfo::setCity(const QString& city) | 159 | void PublishInfo::setCity(const QString& city) | ||
147 | { | 160 | { | ||
148 | d->city = city; | 161 | d->city = city; | ||
162 | emit cityChanged(); | ||||
149 | } | 163 | } | ||
150 | 164 | | |||
151 | QString PublishInfo::isbn() const | 165 | QString PublishInfo::isbn() const | ||
Context not available. | |||||
156 | void PublishInfo::setIsbn(const QString& isbn) | 170 | void PublishInfo::setIsbn(const QString& isbn) | ||
157 | { | 171 | { | ||
158 | d->isbn = isbn; | 172 | d->isbn = isbn; | ||
173 | emit isbnChanged(); | ||||
159 | } | 174 | } | ||
160 | 175 | | |||
161 | QString PublishInfo::license() const | 176 | QString PublishInfo::license() const | ||
Context not available. | |||||
166 | void PublishInfo::setLicense(const QString& license) | 181 | void PublishInfo::setLicense(const QString& license) | ||
167 | { | 182 | { | ||
168 | d->license = license; | 183 | d->license = license; | ||
184 | emit licenseChanged(); | ||||
169 | } | 185 | } | ||
Context not available. |