Initial steps to keep library in a database.
[dorian] / widgets / adopterwindow.cpp
index 844ebf0..6e0eb96 100644 (file)
@@ -7,17 +7,14 @@
 #endif // Q_WS_MAEMO_5
 
 #include "adopterwindow.h"
+#include "platform.h"
 #include "trace.h"
 
-#ifdef Q_WS_MAC
-#   define ICON_PREFIX ":/icons/mac/"
-#else
-#   define ICON_PREFIX ":/icons/"
-#endif
-
 AdopterWindow::AdopterWindow(QWidget *parent):
         QMainWindow(parent), grabbingZoomKeys(false), mainChild(0)
 {
+    Trace t("AdopterWindow::AdopterWindow");
+
 #ifdef Q_WS_MAEMO_5
     setAttribute(Qt::WA_Maemo5StackedWindow, true);
 #endif // Q_WS_MAEMO_5
@@ -28,7 +25,12 @@ AdopterWindow::AdopterWindow(QWidget *parent):
     frame->setLayout(layout);
     setCentralWidget(frame);
 
-#ifndef Q_OS_SYMBIAN
+#ifdef Q_OS_SYMBIAN
+    QAction *closeAction = new QAction(parent? tr("Back"): tr("Exit"), this);
+    closeAction->setSoftKeyRole(QAction::NegativeSoftKey);
+    connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
+    QMainWindow::addAction(closeAction);
+#else
     // Tool bar
     setUnifiedTitleAndToolBarOnMac(true);
     toolBar = addToolBar("controls");
@@ -114,6 +116,9 @@ void AdopterWindow::doGrabZoomKeys(bool grab)
 void AdopterWindow::show()
 {
 #ifdef Q_OS_SYMBIAN
+    foreach (QWidget *w, QApplication::allWidgets()) {
+        w->setContextMenuPolicy(Qt::NoContextMenu);
+    }
     showMaximized();
 #else
     QMainWindow::show();
@@ -125,9 +130,11 @@ QAction *AdopterWindow::addToolBarAction(QObject *receiver,
                                          const QString &iconName,
                                          const QString &text)
 {
+    Trace t("AdopterWindow::addToolBarAction");
+    qDebug() << "icon" << iconName << "text" << text;
 #ifndef Q_OS_SYMBIAN
-    return toolBar->addAction(QIcon(ICON_PREFIX + iconName + ".png"), text,
-                              receiver, member);
+    return toolBar->addAction(QIcon(Platform::icon(iconName)),
+                              text, receiver, member);
 #else
     Q_UNUSED(iconName);
     QAction *action = new QAction(text, this);
@@ -136,3 +143,12 @@ QAction *AdopterWindow::addToolBarAction(QObject *receiver,
     return action;
 #endif
 }
+
+void AdopterWindow::addToolBarSpace()
+{
+#ifndef Q_OS_SYMBIAN
+    QFrame *frame = new QFrame(toolBar);
+    frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+    toolBar->addWidget(frame);
+#endif
+}