Add tool bar button to change orientation.
authorAkos Polster <akos@pipacs.com>
Sun, 9 Jan 2011 21:18:06 +0000 (22:18 +0100)
committerAkos Polster <akos@pipacs.com>
Sun, 9 Jan 2011 21:18:06 +0000 (22:18 +0100)
bookview.cpp
bookview.h
mainwindow.cpp
mainwindow.h
pkg/changelog

index d94cb03..b2e69c6 100644 (file)
@@ -463,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();
index daf605b..74ef200 100644 (file)
@@ -102,6 +102,7 @@ protected:
     void wheelEvent(QWheelEvent *);
     bool eventFilter(QObject *o, QEvent *e);
     void timerEvent(QTimerEvent *e);
+    void hideEvent(QHideEvent *e);
 
     /** Load given part. */
     void loadContent(int index);
index ae78ed9..4d7aaf4 100755 (executable)
@@ -64,10 +64,10 @@ MainWindow::MainWindow(QWidget *parent):
                                       "chapters", tr("Chapters"), true);
     bookmarksAction = addToolBarAction(this, SLOT(showBookmarks()),
                                        "bookmarks", tr("Bookmarks"), true);
-    infoAction = addToolBarAction(this, SLOT(showInfo()),
-                                  "info", tr("Book info"), true);
     libraryAction = addToolBarAction(this, SLOT(showLibrary()),
                                      "library", tr("Library"), false);
+    rotateAction = addToolBarAction(this, SLOT(rotate()),
+                                    "rotate", tr("Rotate"), true);
 
 #ifdef Q_WS_MAEMO_5
     settingsAction = menuBar()->addAction(tr("Settings"));
@@ -228,12 +228,12 @@ void MainWindow::showSettings()
     (new SettingsWindow(this))->show();
 }
 
-void MainWindow::showInfo()
+void MainWindow::rotate()
 {
-    if (mCurrent.isValid()) {
-        (new InfoDialog(Library::instance()->book(mCurrent), this, false))->
-                exec();
-    }
+    QString current = Settings::instance()->value("orientation",
+        Platform::instance()->defaultOrientation()).toString();
+    QString target = (current == "landscape")? "portrait": "landscape";
+    Settings::instance()->setValue("orientation", target);
 }
 
 void MainWindow::showDevTools()
index 9bfbab4..1f50c41 100755 (executable)
@@ -26,7 +26,7 @@ public:
 
 public slots:
     void showLibrary();
-    void showInfo();
+    void rotate();
     void showSettings();
     void showDevTools();
     void showBookmarks();
@@ -58,7 +58,7 @@ private:
     BookView *view;
     QAction *settingsAction;
     QAction *libraryAction;
-    QAction *infoAction;
+    QAction *rotateAction;
     QAction *devToolsAction;
     QAction *bookmarksAction;
     QAction *fullScreenAction;
index ab2bd7c..081f781 100644 (file)
@@ -9,6 +9,7 @@ dorian (0.4.4-1) unstable; urgency=low
   * Allow editing bookmark notes
   * Make orientation switch explicit on Symbian, too
   * Show button for full screen mode on Symbian, too
+  * Add tool bar button to change orientation
 
  -- Akos Polster <akos@pipacs.com>  Sun,  5 Dec 2010 02:00:00 +0100