#include <QPrinter>
#include <QPrintDialog>
#include <QWebInspector>
+#include <QWebFrame>
+#include <QWebHistory>
//#include "Viewer.mpp"
#define prefix_
load(url);
inspector_ = new QWebInspector();
inspector_->setPage(page());
+ connect(page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
+ this, SLOT(initJSObjects()));
+ initJSObjects();
+}
+
+prefix_ pykit::Viewer::~Viewer()
+{
+ if (inspector_)
+ delete inspector_;
}
prefix_ pykit::Viewer * pykit::Viewer::instance()
return instance_;
}
-prefix_ pykit::Viewer::~Viewer()
+prefix_ bool pykit::Viewer::canGoBack()
{
- if (inspector_)
- delete inspector_;
+ return page()->history()->canGoBack();
+}
+
+prefix_ bool pykit::Viewer::canGoForward()
+{
+ return page()->history()->canGoForward();
+}
+
+prefix_ void pykit::Viewer::initJSObjects()
+{
+ page()->mainFrame()->addToJavaScriptWindowObject("view", this);
}
prefix_ void pykit::Viewer::printRequested()
static Viewer * instance();
+ Q_INVOKABLE bool canGoBack();
+ Q_INVOKABLE bool canGoForward();
+
private slots:
+ void initJSObjects();
void printRequested();
private: