X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=widgets%2Flistwindow.cpp;h=e12f4c2f4a15ee6afcd60cb533321586beea61fd;hb=9d6624b77d5ce16de6f3f722fd500f1a8ff6418f;hp=b0691bcedd5704d731ba9f83b6ba6ca8495fd32b;hpb=183951ae5a26f05d3e66a1e62b3ddae57528f08e;p=dorian diff --git a/widgets/listwindow.cpp b/widgets/listwindow.cpp index b0691bc..e12f4c2 100644 --- a/widgets/listwindow.cpp +++ b/widgets/listwindow.cpp @@ -20,12 +20,15 @@ ListWindow::ListWindow(const QString &noItems_, QWidget *parent): list = new QListWidget(this); list->setSelectionMode(QAbstractItemView::SingleSelection); +#if defined(Q_OS_SYMBIAN) + 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())); @@ -65,6 +68,9 @@ void ListWindow::insertButton(int row, const Button &b) { 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); @@ -98,14 +104,18 @@ void ListWindow::addButton(const QString &title, QObject *receiver, { 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, @@ -134,6 +144,15 @@ 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)); @@ -163,7 +182,7 @@ void ListWindow::closeEvent(QCloseEvent *event) { // 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); }