You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
14 years ago
|
/*! @file
|
||
|
|
||
|
@id $Id$
|
||
|
*/
|
||
|
// 1 2 3 4 5 6 7 8
|
||
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||
|
|
||
|
#ifndef __WEBPAGE_HXX__
|
||
|
#define __WEBPAGE_HXX__
|
||
|
|
||
|
#include <QtWebKit/QWebPage>
|
||
14 years ago
|
#include <QtCore/QProcessEnvironment>
|
||
14 years ago
|
|
||
14 years ago
|
#include <QtCore/QDebug>
|
||
|
#ifndef LOG
|
||
|
#define LOG qDebug()<<__PRETTY_FUNCTION__
|
||
|
#endif
|
||
|
|
||
14 years ago
|
class Browser;
|
||
|
|
||
|
class WebPage: public QWebPage {
|
||
|
public:
|
||
|
WebPage(Browser* b, QObject *parent = 0): QWebPage(parent), _browser(b) {}
|
||
|
protected:
|
||
14 years ago
|
virtual QWebPage* createWindow(WebWindowType type);
|
||
|
virtual QString userAgentForUrl(const QUrl& url) const {
|
||
14 years ago
|
QString add(QProcessEnvironment::systemEnvironment()
|
||
|
.value("SWISSSURFER_USERAGENT"));
|
||
|
return QWebPage::userAgentForUrl(url)+(add.size()?" "+add:QString());
|
||
14 years ago
|
}
|
||
14 years ago
|
QObject* createPlugin(const QString& classid, const QUrl& url,
|
||
|
const QStringList& paramNames,
|
||
|
const QStringList& paramValues) {
|
||
|
LOG<<"classid:"<<classid
|
||
|
<<"url:"<<url
|
||
|
<<"paramNames:"<<paramNames.join(", ")
|
||
|
<<"paramValues:"<<paramValues.join(", ");
|
||
|
return QWebPage::createPlugin(classid, url, paramNames, paramValues);
|
||
|
}
|
||
14 years ago
|
private:
|
||
|
Browser* _browser;
|
||
|
};
|
||
|
|
||
|
#endif
|