void AdopterWindow::keyPressEvent(QKeyEvent *event)
{
- TRACE;
+ Trace t("AdopterWindow::keyPressEvent");
+
switch (event->key()) {
case Qt::Key_PageDown:
#ifdef Q_WS_MAEMO_5
/**
* A toplevel window that can adopt a BookView and other children.
- * On Maemo, it can also grab the volume keys.
+ * On some platforms, it can also grab the volume keys.
*/
class AdopterWindow: public MainBase
{
/**
* Handle show events.
- * On Symbian, volume keys can only be grabbed, if the window is shown.
+ * On Symbian, volume keys can only be grabbed, when the window is shown.
+ * So we do it from here.
*/
void showEvent(QShowEvent *event);
/** Handle resize event: Restore reading position. */
void resizeEvent(QResizeEvent *event);
- /** Handle close event. */
+ /** Handle close event: Save reading position. */
void closeEvent(QCloseEvent *event);
/** Handle leave event: Save reading position. */
void FullScreenWindow::showEvent(QShowEvent *e)
{
Trace t("FullScreenWindow::showEvent");
- AdopterWindow::showEvent(e);
+ qDebug() << "Softkeys visible?"
+ << (windowFlags() & Qt::WindowSoftkeysVisibleHint);
placeChildren();
+ AdopterWindow::showEvent(e);
}
void FullScreenWindow::resizeEvent(QResizeEvent *e)
{
Trace t("FullScreenWindow::resizeEvent");
- AdopterWindow::resizeEvent(e);
placeChildren();
+ AdopterWindow::resizeEvent(e);
+}
+
+void FullScreenWindow::closeEvent(QCloseEvent *e)
+{
+ Trace t("FullscreenWindow::closeEvent");
+ AdopterWindow::closeEvent(e);
}
void FullScreenWindow::placeChildren()
Q_OBJECT
public:
- explicit FullScreenWindow(QWidget *parent);
+ explicit FullScreenWindow(QWidget *parent = 0);
/**
* Adopt children.
/** Handle show event. */
void showEvent(QShowEvent *e);
+ /** Handle close event. */
+ void closeEvent(QCloseEvent *e);
+
protected slots:
/** Re-align adopted child windows. */
void placeChildren();
setAttribute(Qt::WA_Maemo5StackedWindow, true);
#endif
-#ifndef Q_OS_SYMBIAN
- setWindowTitle("Dorian");
-#endif
-
// Central widget. Must be an intermediate, because the book view widget
// might be re-parented later
QFrame *central = new QFrame(this);
connect(view, SIGNAL(progress(qreal)), prog, SLOT(setProgress(qreal)));
// Shadow window for full screen reading
- fullScreenWindow = new FullScreenWindow(this);
+ fullScreenWindow = new FullScreenWindow();
connect(fullScreenWindow, SIGNAL(restore()), this, SLOT(showRegular()));
// Handle settings changes
#endif
}
+MainWindow::~MainWindow()
+{
+ delete fullScreenWindow;
+}
+
void MainWindow::initialize()
{
TRACE;
leaveBookView();
fullScreenWindow->takeBookView(view, prog, prev, next);
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5)
fullScreenWindow->raise();
#else
hide();
public:
MainWindow(QWidget *parent = 0);
+ ~MainWindow();
void initialize();
public slots:
void Book::close()
{
- TRACE;
+ Trace t("Book::close");
content.clear();
parts.clear();
QDir::setCurrent(QDir::rootPath());