+
+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
+
+void BookView::adjustPosition()
+{
+ TRACE;
+ const qreal portraitMagic = 1.66;
+ const qreal landscapeMagic = 0.655;
+ if (mBook) {
+ QSize desktop = QApplication::desktop()->size();
+ int screenHeight = desktop.height();
+ int screenWidth = desktop.width();
+ qreal ratio = (screenWidth<screenHeight)? portraitMagic: landscapeMagic;
+ QWebFrame *frame = page()->mainFrame();
+ int current = frame->scrollPosition().y();
+ qDebug() << "From" << current << "to" << (int)(current * ratio);
+ frame->scroll(0, (int)(current * ratio) - current);
+ }
+}