Commit d3397ea0 authored by David Faure's avatar David Faure

Support for document.lastModified

svn path=/trunk/kdelibs/; revision=118024
parent f6971c1a
......@@ -128,6 +128,12 @@ DOMString HTMLDocument::domain() const
return ((HTMLDocumentImpl *)impl)->domain();
}
DOMString HTMLDocument::lastModified() const
{
if(!impl) return DOMString();
return ((HTMLDocumentImpl *)impl)->lastModified();
}
DOMString HTMLDocument::URL() const
{
if(!impl) return DOMString();
......
......@@ -121,6 +121,12 @@ public:
*/
DOMString domain() const;
/**
* The date the document was last modified.
*
*/
DOMString lastModified() const;
/**
* The complete URI of the document.
*
......@@ -289,7 +295,7 @@ public:
*
* converts the given (potentially relative) URL in a
* full-qualified one, using the baseURL / document URL for
* the missing parts.
* the missing parts.
*/
DOMString completeURL( const DOMString& url) const;
};
......
......@@ -177,7 +177,8 @@ bool KJS::HTMLDocument::hasProperty(const UString &p, bool recursive) const
p == "body" || p == "location" || p == "images" || p == "applets" ||
p == "links" || p == "forms" || p == "anchors" || p == "all" ||
p == "cookie" || p == "open" || p == "close" || p == "write" ||
p == "writeln" || p == "getElementById" || p == "getElementsByName")
p == "writeln" || p == "getElementById" || p == "getElementsByName" ||
p == "lastModified" )
return true;
if (!static_cast<DOM::HTMLDocument>(node).all().
namedItem(p.string()).isNull())
......@@ -265,8 +266,8 @@ KJSO KJS::HTMLDocument::tryGet(const UString &p) const
// return Undefined();
// else if (p == "ids")
// return Undefined();
// else if (p == "lastModified")
// return Undefined();
else if (p == "lastModified")
return String(doc.lastModified());
else if (p == "height")
return Number(part->view() ? part->view()->visibleWidth() : 0);
else if (p == "width")
......
......@@ -108,6 +108,13 @@ DOMString HTMLDocumentImpl::domain() const
return KURL( URL() ).host();
}
DOMString HTMLDocumentImpl::lastModified() const
{
if ( view() )
return view()->part()->lastModified();
return DOMString();
}
HTMLElementImpl *HTMLDocumentImpl::body()
{
NodeImpl *de = documentElement();
......
......@@ -56,6 +56,7 @@ public:
DOMString referrer() const;
DOMString domain() const;
DOMString lastModified() const;
HTMLElementImpl *body();
void setBody(HTMLElementImpl *_body);
......
......@@ -268,6 +268,7 @@ public:
QString m_kjsStatusBarText;
QString m_kjsDefaultStatusBarText;
QString m_lastModified;
// QStrings for SSL metadata
// Note: When adding new variables don't forget to update ::saveState()/::restoreState()!
......@@ -1306,6 +1307,10 @@ void KHTMLPart::slotData( KIO::Job* kio_job, const QByteArray &data )
}
d->m_bHTTPRefresh = true;
}
// Support for http last-modified
d->m_lastModified = d->m_job->queryMetaData("modified");
kdDebug() << "KHTMLPart::slotData metadata modified: " << d->m_lastModified << endl;
}
KHTMLPageCache::self()->addData(d->m_cacheId, data);
......@@ -1953,7 +1958,7 @@ bool KHTMLPart::findTextNext( const QString &str, bool forward, bool caseSensiti
{
DOMStringImpl *t = (static_cast<TextImpl *>(d->m_findNode))->string();
QConstString s(t->s, t->l);
int matchLen = 0;
if ( isRegExp ) {
QRegExp matcher( str );
......@@ -1966,7 +1971,7 @@ bool KHTMLPart::findTextNext( const QString &str, bool forward, bool caseSensiti
d->m_findPos = s.string().find(str, d->m_findPos+1, caseSensitive);
matchLen = str.length();
}
if(d->m_findPos != -1)
{
int x = 0, y = 0;
......@@ -3532,6 +3537,11 @@ QString KHTMLPart::referrer() const
return d->m_referrer;
}
QString KHTMLPart::lastModified() const
{
return d->m_lastModified;
}
void KHTMLPart::updateFontSize( int add )
{
resetFontSizes();
......
......@@ -148,7 +148,7 @@ class KHTMLPart : public KParts::ReadOnlyPart
friend class KHTMLPartBrowserHostExtension;
friend class HTMLTokenizer;
friend class XMLTokenizer;
Q_PROPERTY( bool javaScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled )
Q_PROPERTY( bool javaEnabled READ javaEnabled WRITE setJavaEnabled )
Q_PROPERTY( bool autoloadImages READ autoloadImages WRITE setAutoloadImages )
......@@ -341,16 +341,16 @@ public:
void enablePlugins(bool e) { return setPluginsEnabled(e); }
void autoloadImages(bool e) { return setAutoloadImages(e); }
void enableMetaRefresh(bool e) { return setMetaRefreshEnabled(e); }
KURL baseURL() const;
QString baseTarget() const;
KURL completeURL( const QString &url );
#endif
#endif
/**
* schedules a redirection after delay seconds
*/
void scheduleRedirection( int delay, const QString &url );
void scheduleRedirection( int delay, const QString &url );
/**
* Clear the widget and prepares it for new content.
......@@ -527,7 +527,7 @@ public:
/**
* Retrieve the cursor which is used when the cursor is on a link.
*/
QCursor urlCursor() const;
QCursor urlCursor() const;
/**
* Initiate a text search.
......@@ -617,7 +617,7 @@ public:
/**
* @internal
*/
const KHTMLSettings *settings() const;
const KHTMLSettings *settings() const;
/**
* Retrieve a pointer to the parent KHTMLPart if the part is a frame
......@@ -634,11 +634,11 @@ public:
*/
QStringList frameNames() const;
#if QT_VERSION < 300
#if QT_VERSION < 300
QList<KParts::ReadOnlyPart> frames() const;
#else
QPtrList<KParts::ReadOnlyPart> frames() const;
#endif
#endif
/**
* Find a frame by name. Returns 0L if frame can't be found.
......@@ -687,6 +687,11 @@ public:
*/
QString referrer() const;
/**
* Last-modified date (in raw string format), if received in the [HTTP] headers.
*/
QString lastModified() const;
signals:
/**
* Emitted if the cursor is moved over an URL.
......@@ -788,7 +793,7 @@ private slots:
/**
* @internal
*/
void reparseConfiguration();
void reparseConfiguration();
/**
* @internal
......@@ -861,7 +866,7 @@ private slots:
void slotLoadImages();
/**
* @internal
* @internal
*/
void submitFormAgain();
......@@ -928,8 +933,8 @@ private:
/**
* @internal
*/
bool restoreURL( const KURL &url );
bool restoreURL( const KURL &url );
/**
* @internal
*/
......@@ -938,30 +943,30 @@ private:
/**
* @internal
*/
bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
void startAutoScroll();
void stopAutoScroll();
void overURL( const QString &url, const QString &target, bool shiftPressed = false );
void updateFontSize( int add );
void setFontBaseInternal( int base, bool absolute );
void updateFontSize( int add );
void setFontBaseInternal( int base, bool absolute );
/**
* @internal
*/
bool processObjectRequest( khtml::ChildFrame *child, const KURL &url, const QString &mimetype );
bool processObjectRequest( khtml::ChildFrame *child, const KURL &url, const QString &mimetype );
/**
* @internal
*/
void submitForm( const char *action, const QString &url, const QByteArray &formData,
const QString &target, const QString& contentType = QString::null,
const QString& boundary = QString::null );
const QString& boundary = QString::null );
/**
* @internal
*/
void popupMenu( const QString &url );
void popupMenu( const QString &url );
void init( KHTMLView *view, GUIProfile prof );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment