From: Akos Polster Date: Sun, 9 Jan 2011 21:18:06 +0000 (+0100) Subject: Add tool bar button to change orientation. X-Git-Url: http://vcs.maemo.org/git/?p=dorian;a=commitdiff_plain;h=0602a1b0ce698da6ef427676db2660e174e28d49 Add tool bar button to change orientation. --- diff --git a/bookview.cpp b/bookview.cpp index d94cb03..b2e69c6 100644 --- a/bookview.cpp +++ b/bookview.cpp @@ -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(); diff --git a/bookview.h b/bookview.h index daf605b..74ef200 100644 --- a/bookview.h +++ b/bookview.h @@ -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); diff --git a/mainwindow.cpp b/mainwindow.cpp index ae78ed9..4d7aaf4 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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() diff --git a/mainwindow.h b/mainwindow.h index 9bfbab4..1f50c41 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -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; diff --git a/pkg/changelog b/pkg/changelog index ab2bd7c..081f781 100644 --- a/pkg/changelog +++ b/pkg/changelog @@ -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 Sun, 5 Dec 2010 02:00:00 +0100