X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=adopterwindow.cpp;h=daafa295e305fc5367077a530ab2c3063febbff0;hb=ac72b9ea7af92a9936a8e023a1923cdf94558d54;hp=2cdf4dd042f24cc4ac6c60ef4cdc3e6bcc5da3db;hpb=997033b4cb3081b0095bc230a9d4343cf98cc3b4;p=dorian diff --git a/adopterwindow.cpp b/adopterwindow.cpp index 2cdf4dd..daafa29 100644 --- a/adopterwindow.cpp +++ b/adopterwindow.cpp @@ -38,12 +38,14 @@ void AdopterWindow::takeBookView(BookView *view, Q_ASSERT(previous); Q_ASSERT(next); - leaveBookView(); + if (bookView) { + return; + } bookView = view; bookView->setParent(this); centralWidget()->layout()->addWidget(bookView); - bookView->show(); + // bookView->show(); progress = prog; previousButton = previous; @@ -62,10 +64,13 @@ void AdopterWindow::takeBookView(BookView *view, void AdopterWindow::leaveBookView() { TRACE; - if (bookView) { - bookView->hide(); - centralWidget()->layout()->removeWidget(bookView); + + if (!bookView) { + return; } + + // bookView->hide(); + centralWidget()->layout()->removeWidget(bookView); bookView = 0; progress = 0; nextButton = 0; @@ -121,11 +126,11 @@ void AdopterWindow::doGrabVolumeKeys(bool grab) #endif // Q_WS_MAEMO_5 -void AdopterWindow::showEvent(QShowEvent *e) +void AdopterWindow::showEvent(QShowEvent *event) { Trace t("AdopterWindow::showEvent"); - MainBase::showEvent(e); + MainBase::showEvent(event); #if defined(Q_WS_MAEMO_5) doGrabVolumeKeys(grabbingVolumeKeys); #endif @@ -135,18 +140,15 @@ 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) + // Restore previous reading position if (bookView) { QTimer::singleShot(110, bookView, SLOT(restoreLastBookmark())); } -#endif +#endif // defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) } void AdopterWindow::closeEvent(QCloseEvent *event) @@ -205,30 +207,16 @@ void AdopterWindow::placeDecorations() Trace t("AdopterWindow::placeDecorations"); if (!hasBookView()) { + qDebug() << "Doesn't have the book view"; return; } + qDebug() << "Has the book view"; int extraHeight = 0; QRect geo = bookView->geometry(); qDebug() << "bookView:" << geo; -#ifdef Q_OS_SYMBIAN - // Work around Symbian bug: If tool bar is hidden, increase bottom - // decorator widgets' Y coordinates by the tool bar's height - if (isToolBarHidden()) { - extraHeight = toolBarHeight(); - } - - // Work around another Symbian bug: When returning from full screen mode - // in landscape, the book view widget's height is miscalculated. - // My apologies for this kludge - if (geo.height() == 288) { - qDebug() << "Adjusting bottom Y"; - extraHeight -= 288 - 223; - } -#endif // Q_OS_SYMBIAN - progress->setGeometry(geo.x(), geo.y() + geo.height() - progress->thickness() + extraHeight, geo.width(), progress->thickness());