|
@@ -27,6 +27,7 @@
|
|
|
|
|
|
#include <QDateTime>
|
|
|
#include <QDebug>
|
|
|
+#include <QStringList>
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
@@ -106,7 +107,33 @@ QString ctkXnatObject::childDataType() const
|
|
|
|
|
|
QDateTime ctkXnatObject::lastModifiedTime() const
|
|
|
{
|
|
|
- return this->session()->lastModified(this->resourceUri());
|
|
|
+ QUuid queryId = this->session()->httpHead(this->resourceUri());
|
|
|
+ QMap<QByteArray, QByteArray> header = this->session()->httpHeadSync(queryId);
|
|
|
+ QVariant lastModifiedHeader = header.value("Last-Modified");
|
|
|
+ QDateTime lastModifiedTime;
|
|
|
+ if (lastModifiedHeader.isValid())
|
|
|
+ {
|
|
|
+ QStringList dateformates;
|
|
|
+ // In case http date formate RFC 822 ( "Sun, 06 Nov 1994 08:49:37 GMT" )
|
|
|
+ dateformates<<"ddd, dd MMM yyyy HH:mm:ss";
|
|
|
+ // In case http date formate ANSI ( "Sun Nov 6 08:49:37 1994" )
|
|
|
+ dateformates<<"ddd MMM d HH:mm:ss yyyy";
|
|
|
+ // In case http date formate RFC 850 ( "Sunday, 06-Nov-94 08:49:37 GMT" )
|
|
|
+ dateformates<<"dddd, dd-MMM-yy HH:mm:ss";
|
|
|
+
|
|
|
+ QString dateText = lastModifiedHeader.toString();
|
|
|
+ // Remove "GMT" addition at the end of the http timestamp
|
|
|
+ if (dateText.indexOf("GMT") != -1)
|
|
|
+ dateText = dateText.left(dateText.length()-4);
|
|
|
+
|
|
|
+ foreach (QString format, dateformates)
|
|
|
+ {
|
|
|
+ lastModifiedTime = QDateTime::fromString(dateText, format);
|
|
|
+ if (lastModifiedTime.isValid())
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return lastModifiedTime;
|
|
|
}
|
|
|
|
|
|
void ctkXnatObject::setLastModifiedTime(const QDateTime &lastModifiedTime)
|