6 #include <QDialogButtonBox>
12 class QAbstractItemModel;
16 /** A window with a list and menu actions (Maemo) or buttons (non-Maemo). */
17 class ListWindow: public MainBase
24 * @param noItems Text to display when the list has no items.
25 * @param parent Parent widget.
27 explicit ListWindow(const QString &noItems, QWidget *parent = 0);
29 /** Set the model for the list. */
30 void setModel(QAbstractItemModel *model);
33 QAbstractItemModel *model() const;
36 * Add an action button to the beginning of the list (Maemo) or to the
37 * tool bar (non-Maemo).
39 void addButton(const QString &title, QObject *receiver, const char *slot,
40 const QString &iconPath = QString());
43 * Add an action button to the tool bar, which is only active if a list
46 void addItemButton(const QString &title, QObject *receiver,
47 const char *slot, const QString &iconPath = QString());
49 /** Add an action to the menu. */
50 QAction *addMenuAction(const QString &title, QObject *receiver,
53 /** Get current (selected) item. */
54 QModelIndex currentItem() const;
57 /** Emitted when a list item is activated. */
58 void activated(const QModelIndex &index);
61 /** Set the current (selected) item. */
62 void setCurrentItem(const QModelIndex &item);
65 void onItemActivated(const QModelIndex &);
75 void insertButton(int row, const Button &button);
77 void closeEvent(QCloseEvent *event);
82 QAbstractItemModel *mModel;
83 QList<Button> buttons;
88 QList<QAction *>itemActions;
91 #endif // LISTWINDOW_H