Only adjust reading positon during orientation switch.
[dorian] / adopterwindow.cpp
index 2cdf4dd..173ed8b 100644 (file)
@@ -135,18 +135,32 @@ void AdopterWindow::showEvent(QShowEvent *e)
 void AdopterWindow::resizeEvent(QResizeEvent *event)
 {
     Trace t("AdopterWindow::resizeEvent");
-#if defined(Q_OS_SYMBIAN)
-    if (bookView) {
-        bookView->setLastBookmark();
-    }
-#endif
     MainBase::resizeEvent(event);
     placeDecorations();
-#if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN)
-    if (bookView) {
-        QTimer::singleShot(110, bookView, SLOT(restoreLastBookmark()));
+
+#if defined(Q_WS_MAEMO_5)
+    // Restore previous reading position
+    if (!bookView) {
+        return;
     }
-#endif
+    QTimer::singleShot(110, bookView, SLOT(restoreLastBookmark()));
+#endif // Q_WS_MAEMO_5
+
+#if defined(Q_OS_SYMBIAN)
+    // Adjust reading position after orientation change
+    if (!bookView) {
+        return;
+    }
+    if (event->oldSize().width() == -1) {
+        return;
+    }
+    bool oldPortrait = event->oldSize().width() < event->oldSize().height();
+    bool portrait = event->size().width() < event->size().height();
+    if (oldPortrait == portrait) {
+        return;
+    }
+    QTimer::singleShot(990, bookView, SLOT(adjustPosition()));
+#endif // Q_OS_SYMBIAN
 }
 
 void AdopterWindow::closeEvent(QCloseEvent *event)