list = new QListWidget(this);
list->setSelectionMode(QAbstractItemView::SingleSelection);
+#if defined(Q_OS_SYMBIAN)
+ list->setFixedWidth(QApplication::desktop()->availableGeometry().width());
+ list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+#endif
populateList();
setCentralWidget(list);
#ifdef Q_OS_SYMBIAN
charm = new FlickCharm(this);
- charm->activateOn(list);
+ // charm->activateOn(list);
QAction *closeAction = new QAction(parent? tr("Back"): tr("Exit"), this);
closeAction->setSoftKeyRole(QAction::NegativeSoftKey);
connect(closeAction, SIGNAL(triggered()), this, SLOT(close()));
{
QPushButton *pushButton = new QPushButton(
QIcon(Platform::instance()->icon(b.iconName)), b.title, this);
+#ifdef Q_OS_SYMBIAN
+ pushButton->setFixedWidth(list->width());
+#endif
connect(pushButton, SIGNAL(clicked()), b.receiver, b.slot);
QListWidgetItem *item = new QListWidgetItem();
item->setFlags(Qt::NoItemFlags);
{
TRACE;
+#ifdef Q_OS_SYMBIAN
+ Q_UNUSED(iconName);
+ addMenuAction(title, receiver, slot);
+#else
Button b;
b.title = title;
b.receiver = receiver;
b.slot = slot;
b.iconName = iconName;
-
insertButton(buttons.length(), b);
buttons.append(b);
+#endif
}
QAction *ListWindow::addMenuAction(const QString &title, QObject *receiver,
void ListWindow::onItemActivated(const QModelIndex &index)
{
TRACE;
+
+ // Work around Qt/Symbian^3 bug: Disabled list items still can be selected
+ if (!mModel) {
+ return;
+ }
+ if (!mModel->rowCount()) {
+ return;
+ }
+
int row = index.row() - buttons.count();
qDebug() << "Activated" << index.row() << ", emit activated(" << row << ")";
emit activated(mModel->index(row, 0));
{
// Work around Maemo/Qt bug: Menu items are not removed on close
menuBar()->clear();
- // FIXME: Is this needed? event->accept();
+ event->accept();
QMainWindow::closeEvent(event);
}