Add tool bar button to change orientation.
[dorian] / bookview.cpp
index 9f3daf5..b2e69c6 100644 (file)
@@ -400,7 +400,9 @@ bool BookView::eventFilter(QObject *o, QEvent *e)
         mousePressed = true;
         break;
     case QEvent::MouseButtonRelease:
+#ifndef Q_OS_SYMBIAN // Too heavy on Symbian
         showProgress();
+#endif
         mousePressed = false;
         break;
     case QEvent::MouseMove:
@@ -434,6 +436,7 @@ void BookView::goToPosition(qreal position)
 
 void BookView::showProgress()
 {
+    TRACE;
     if (mBook) {
         int contentsHeight = page()->mainFrame()->contentsSize().height();
         qreal pos = (qreal)(page()->mainFrame()->scrollPosition().y()) /
@@ -460,6 +463,17 @@ void BookView::timerEvent(QTimerEvent *e)
     QWebView::timerEvent(e);
 }
 
+void BookView::hideEvent(QHideEvent *e)
+{
+    Trace t("BookView::hideEvent");
+
+#if defined(Q_OS_SYMBIAN)
+    setLastBookmark();
+#endif
+
+    QWebView::hideEvent(e);
+}
+
 void BookView::goPreviousPage()
 {
     QWebFrame *frame = page()->mainFrame();
@@ -513,20 +527,3 @@ void BookView::onMediaKeysPressed(MediaKeysObserver::MediaKeys key)
 }
 
 #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);
-    }
-}