本文整理汇总了C++中CalendarItem::setLastModifiedString方法的典型用法代码示例。如果您正苦于以下问题:C++ CalendarItem::setLastModifiedString方法的具体用法?C++ CalendarItem::setLastModifiedString怎么用?C++ CalendarItem::setLastModifiedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CalendarItem
的用法示例。
在下文中一共展示了CalendarItem::setLastModifiedString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTodoItems
void OwnCloudService::loadTodoItems(QString &data) {
QDomDocument doc;
doc.setContent(data, true);
// fetch all urls that are currently in the calendar
QList<QUrl> calendarItemUrlRemoveList =
CalendarItem::fetchAllUrlsByCalendar(calendarName);
QDomNodeList responseNodes = doc.elementsByTagNameNS(NS_DAV, "response");
int responseNodesCount = responseNodes.length();
int requestCount = 0;
// set the preliminary maximum of the progress bar
this->todoDialog->todoItemLoadingProgressBarSetMaximum(responseNodesCount);
// loop all response blocks
for (int i = 0; i < responseNodesCount; ++i) {
QDomNode responseNode = responseNodes.at(i);
if (responseNode.isElement()) {
QDomElement elem = responseNode.toElement();
// check if we have an url
QDomNodeList urlPartNodes = elem.elementsByTagNameNS(NS_DAV,
"href");
if (urlPartNodes.length()) {
QString urlPart = urlPartNodes.at(0).toElement().text();
if (urlPart == "") {
continue;
}
QUrl calendarItemUrl = QUrl(serverUrlWithoutPath + urlPart);
// check if we have an etag
QDomNodeList etagNodes = elem.elementsByTagNameNS(NS_DAV,
"getetag");
if (etagNodes.length()) {
QString etag = etagNodes.at(0).toElement().text();
etag.replace("\"", "");
qDebug() << __func__ << " - 'etag': " << etag;
// check if we have a last modified date
QDomNodeList lastModifiedNodes = elem.elementsByTagNameNS(
NS_DAV, "getlastmodified");
if (lastModifiedNodes.length()) {
const QString lastModified = lastModifiedNodes.at(
0).toElement().text();
bool fetchItem = false;
// try to fetch the calendar item by url
CalendarItem calItem = CalendarItem::fetchByUrl(
calendarItemUrl);
if (calItem.isFetched()) {
// check if calendar item was modified
if (calItem.getETag() != etag) {
// store etag and last modified date
calItem.setETag(etag);
calItem.setLastModifiedString(lastModified);
calItem.store();
// we want to update the item from server
fetchItem = true;
}
} else {
// calendar item was not found
// create calendar item for fetching
CalendarItem::addCalendarItemForRequest(
calendarName, calendarItemUrl, etag,
lastModified);
fetchItem = true;
}
// remove the url from the list of calendar item urls
// to remove
if (calendarItemUrlRemoveList.contains(
calendarItemUrl)) {
calendarItemUrlRemoveList.removeAll(
calendarItemUrl);
}
// fetch the calendar item
if (fetchItem) {
QNetworkRequest r(calendarItemUrl);
addAuthHeader(&r);
QNetworkReply *reply = networkManager->get(r);
ignoreSslErrorsIfAllowed(reply);
requestCount++;
}
}
}
}
}
}
// set the real maximum of the progress bar
this->todoDialog->todoItemLoadingProgressBarSetMaximum(requestCount);
// hide progress bar if there were no updates
//.........这里部分代码省略.........