5 #include <QDialogButtonBox>
11 class QAbstractItemModel;
15 /** A window with a list and menu actions (Maemo) or buttons (non-Maemo). */
16 class ListWindow: public QMainWindow
23 * @param noItems Text to display when the list has no items.
24 * @param parent Parent widget.
26 explicit ListWindow(const QString &noItems, QWidget *parent = 0);
28 /** Set the model for the list. */
29 void setModel(QAbstractItemModel *model);
32 QAbstractItemModel *model() const;
34 /** Add an action button to the beginning of the list. */
35 void addButton(const QString &title, QObject *receiver, const char *slot,
36 const QString &iconPath = QString());
38 /** Add an action to the menu. */
39 QAction *addMenuAction(const QString &title, QObject *receiver,
42 /** Get current (selected) item. */
43 QModelIndex currentItem() const;
46 /** Emitted when a list item is activated. */
47 void activated(const QModelIndex &index);
50 /** Set the current (selected) item. */
51 void setCurrentItem(const QModelIndex &item);
58 void onItemActivated(const QModelIndex &);
68 void insertButton(int row, const Button &button);
70 void closeEvent(QCloseEvent *event);
75 QAbstractItemModel *mModel;
76 QList<Button> buttons;
83 #endif // LISTWINDOW_H