+
+void BookView::timerEvent(QTimerEvent *e)
+{
+#if defined(Q_WS_MAEMO_5)
+ if (e->timerId() == scrollerMonitor) {
+ if (scroller &&
+ ((scroller->state() == QAbstractKineticScroller::AutoScrolling) ||
+ (scroller->state() == QAbstractKineticScroller::Pushing))) {
+ showProgress();
+ } else {
+ killTimer(scrollerMonitor);
+ scrollerMonitor = -1;
+ }
+ }
+#endif
+ QWebView::timerEvent(e);
+}
+
+void BookView::goPreviousPage()
+{
+ QWebFrame *frame = page()->mainFrame();
+ int pos = frame->scrollPosition().y();
+ frame->scroll(0, -height());
+ if (pos == frame->scrollPosition().y()) {
+ if (contentIndex > 0) {
+ Book::Bookmark bookmark(contentIndex - 1, 1.0);
+ mBook->setLastBookmark(contentIndex - 1, 1.0);
+ goToBookmark(bookmark);
+ }
+ } else {
+ showProgress();
+ }
+}
+
+void BookView::goNextPage()
+{
+ TRACE;
+ QWebFrame *frame = page()->mainFrame();
+ int pos = frame->scrollPosition().y();
+ frame->scroll(0, height());
+ if (pos == frame->scrollPosition().y()) {
+ goNext();
+ } else {
+ setLastBookmark();
+ showProgress();
+ }
+}
+
+void BookView::grabVolumeKeys(bool grab)
+{
+ TRACE;
+ grabbingVolumeKeys = grab;
+}
+
+#ifdef Q_OS_SYMBIAN
+
+void BookView::onMediaKeysPressed(MediaKeysObserver::MediaKeys key)
+{
+ TRACE;
+ qDebug() << "Key" << (int)key;
+ if (grabbingVolumeKeys) {
+ if (key == MediaKeysObserver::EVolIncKey) {
+ qDebug() << "Volume up";
+ goPreviousPage();
+ } else if (key == MediaKeysObserver::EVolDecKey){
+ qDebug() << "Volume down";
+ goNextPage();
+ }
+ }
+}
+
+#endif // Q_OS_SYMBIAN