X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=widgets%2Fdyalog.cpp;h=addef7033cf43edd76fc680e247d35752aa12e26;hb=9f73b19627aba7a802daa22df7b7683fd47ec809;hp=3ffdfbcfb6568c08e3b7895c5d05da8fddf19bdd;hpb=9c05884a77fb00596e9579fd4eacdff848383710;p=dorian diff --git a/widgets/dyalog.cpp b/widgets/dyalog.cpp index 3ffdfbc..addef70 100644 --- a/widgets/dyalog.cpp +++ b/widgets/dyalog.cpp @@ -1,6 +1,7 @@ #include #include "dyalog.h" +#include "trace.h" #ifdef Q_OS_SYMBIAN #include "flickcharm.h" @@ -11,6 +12,8 @@ Dyalog::Dyalog(QWidget *parent, bool showButtons_): Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint), showButtons(showButtons_) { + setAttribute(Qt::WA_DeleteOnClose); + scroller = new QScrollArea(this); #if defined(Q_WS_MAEMO_5) @@ -64,6 +67,7 @@ Dyalog::Dyalog(QWidget *parent, bool showButtons_): closeAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(closeAction, SIGNAL(triggered()), this, SLOT(reject())); addAction(closeAction); + leftSoftKey = 0; menuBar = 0; #endif // Q_OS_SYMBIAN } @@ -81,17 +85,32 @@ void Dyalog::addStretch(int stretch) 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 (!menuBar) { - menuBar = new QMenuBar(this); + if (!leftSoftKey) { + // Add new action as left softkey + leftSoftKey = new QAction(label, this); + leftSoftKey->setSoftKeyRole(QAction::PositiveSoftKey); + connect(leftSoftKey, SIGNAL(triggered()), receiver, slot); + addAction(leftSoftKey); + } else { + if (!menuBar) { + // Create menu bar + menuBar = new QMenuBar(this); + // Add previous LSK to menu bar + leftSoftKey->setSoftKeyRole(QAction::NoSoftKey); + menuBar->addAction(leftSoftKey); + } + // Add new action to menu bar + QAction *action = new QAction(label, this); + connect(action, SIGNAL(triggered()), receiver, slot); + menuBar->addAction(action); } - QAction *action = new QAction(label, this); - connect(action, SIGNAL(triggered()), receiver, slot); - menuBar->addAction(action); #else QPushButton *button = new QPushButton(label, this); connect(button, SIGNAL(clicked()), receiver, slot);