#include <QtGui>
#include "dyalog.h"
+#include "trace.h"
+
+#ifdef Q_OS_SYMBIAN
+#include "flickcharm.h"
+#endif
Dyalog::Dyalog(QWidget *parent, bool showButtons_):
QDialog(parent, Qt::Dialog | Qt::WindowTitleHint |
Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint),
showButtons(showButtons_)
{
+ setAttribute(Qt::WA_DeleteOnClose);
+
scroller = new QScrollArea(this);
-#ifdef Q_WS_MAEMO_5
+#if defined(Q_WS_MAEMO_5)
scroller->setProperty("FingerScrollable", true);
scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+#elif defined(Q_OS_SYMBIAN)
+ FlickCharm *charm = new FlickCharm(this);
+ charm->activateOn(scroller);
#else
scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
#endif
closeAction->setSoftKeyRole(QAction::NegativeSoftKey);
connect(closeAction, SIGNAL(triggered()), this, SLOT(reject()));
addAction(closeAction);
- menu = 0;
+ leftSoftKey = 0;
+ menuBar = 0;
#endif // Q_OS_SYMBIAN
}
void Dyalog::addButton(const QString &label, QObject *receiver,
const char *slot, QDialogButtonBox::ButtonRole role)
{
+ TRACE;
if (!showButtons) {
+ qDebug() << "Ignored: showButtons is false";
return;
}
#ifdef Q_OS_SYMBIAN
Q_UNUSED(role);
- if (!menu) {
- QAction *menuAction = new QAction(tr("Options"), this);
- menuAction->setSoftKeyRole(QAction::PositiveSoftKey);
- menu = new QMenu(this);
- menuAction->setMenu(menu);
+#if 0
+ if (!leftSoftKey) {
+ qDebug() << "Adding left soft key";
+ leftSoftKey = new QAction(label, this);
+ leftSoftKey->setSoftKeyRole(QAction::PositiveSoftKey);
+ connect(leftSoftKey, SIGNAL(triggered()), receiver, slot);
+ addAction(leftSoftKey);
+ } else {
+#endif
+ if (!menuBar) {
+ qDebug() << "Creating menu bar";
+ menuBar = new QMenuBar(this);
+ menuBar->addAction(leftSoftKey);
+ }
+ qDebug() << "Adding to menu bar";
+ QAction *action = new QAction(label, this);
+ connect(action, SIGNAL(triggered()), receiver, slot);
+ menuBar->addAction(action);
+#if 0
}
- QAction *action = new QAction(label, this);
- connect(action, SIGNAL(triggered()), receiver, slot);
- menu->addAction(action);
+#endif
#else
QPushButton *button = new QPushButton(label, this);
connect(button, SIGNAL(clicked()), receiver, slot);