{\r
TRACE;\r
\r
-#ifdef Q_WS_MAEMO_5\r
+#if defined(Q_WS_MAEMO_5)\r
setAttribute(Qt::WA_Maemo5StackedWindow, true);\r
#endif\r
\r
QVBoxLayout *layout = new QVBoxLayout(frame);\r
layout->setMargin(0);\r
frame->setLayout(layout);\r
- //frame->show();\r
setCentralWidget(frame);\r
\r
-#ifdef Q_OS_SYMBIAN\r
+#if defined(Q_OS_SYMBIAN)\r
QAction *closeAction = new QAction(parent? tr("Back"): tr("Exit"), this);\r
closeAction->setSoftKeyRole(QAction::NegativeSoftKey);\r
connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));\r
QMainWindow::addAction(closeAction);\r
+#endif // Q_OS_SYMBIAN\r
+}\r
+\r
+void MainBase::addToolBar()\r
+{\r
+ TRACE;\r
+\r
+ if (toolBar) {\r
+ return;\r
+ }\r
+\r
+#if defined(Q_OS_SYMBIAN)\r
+ toolBar = new QToolBar("", this);\r
+ QMainWindow::addToolBar(Qt::BottomToolBarArea, toolBar);\r
#else\r
- // Tool bar\r
+ toolBar = QMainWindow::addToolBar("");\r
+#endif\r
+\r
setUnifiedTitleAndToolBarOnMac(true);\r
- toolBar = addToolBar("");\r
toolBar->setMovable(false);\r
toolBar->setFloatable(false);\r
toolBar->toggleViewAction()->setVisible(false);\r
+\r
#if defined(Q_WS_X11) && !defined(Q_WS_MAEMO_5)\r
toolBar->setIconSize(QSize(42, 42));\r
#endif\r
-#endif // Q_OS_SYMBIAN\r
}\r
\r
QAction *MainBase::addToolBarAction(QObject *receiver,\r
QAction *action;\r
#ifdef Q_OS_SYMBIAN\r
if (important) {\r
- if (!toolBar) {\r
- // Create tool bar if needed\r
- toolBar = new QToolBar("", this);\r
- addToolBar(Qt::BottomToolBarArea, toolBar);\r
- }\r
// Add tool bar action\r
+ addToolBar();\r
QPushButton *button = new QPushButton(this);\r
button->setIconSize(QSize(60, 60));\r
button->setFixedHeight(60);\r
connect(action, SIGNAL(triggered()), receiver, member);\r
#else\r
Q_UNUSED(important);\r
+ addToolBar();\r
action = toolBar->addAction(QIcon(Platform::instance()->icon(iconName)),\r
text, receiver, member);\r
#endif\r
\r
void MainBase::addToolBarSpace()\r
{\r
+ addToolBar();\r
QFrame *frame = new QFrame(toolBar);\r
frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);\r
toolBar->addWidget(frame);\r
}\r
\r
-void MainBase::updateToolBar()\r
-{\r
-#if 0 // ifdef Q_OS_SYMBIAN\r
- TRACE;\r
- if (toolBar) {\r
- QRect geometry = QApplication::desktop()->geometry();\r
- bool isPortrait = geometry.width() < geometry.height();\r
- bool isToolBarHidden = toolBar->isHidden();\r
- if (isPortrait && isToolBarHidden) {\r
- qDebug() << "Show tool bar";\r
- toolBar->setVisible(true);\r
- } else if (!isPortrait && !isToolBarHidden) {\r
- qDebug() << "Hide tool bar";\r
- toolBar->setVisible(false);\r
- }\r
- }\r
-#endif // Q_OS_SYMBIAN\r
-}\r
-\r
-void MainBase::showEvent(QShowEvent *event)\r
-{\r
- Trace t("MainBase::showEvent");\r
- updateToolBar();\r
- QMainWindow::showEvent(event);\r
-}\r
-\r
-void MainBase::resizeEvent(QResizeEvent *event)\r
-{\r
- Trace t("MainBase::resizeEvent");\r
- updateToolBar();\r
- QMainWindow::resizeEvent(event);\r
-}\r
-\r
-void MainBase::hideToolBar()\r
-{\r
- if (toolBar) {\r
- toolBar->hide();\r
- }\r
-}\r
-\r
-bool MainBase::isToolBarHidden()\r
-{\r
- return toolBar && toolBar->isHidden();\r
-}\r
-\r
int MainBase::toolBarHeight()\r
{\r
return toolBar? toolBar->height(): 0;\r