6 #include <QDialogButtonBox>
12 class QAbstractItemModel;
15 class QListWidgetItem;
17 /** A window with a list and menu actions (Maemo) or buttons (non-Maemo). */
18 class ListWindow: public MainBase
25 * @param noItems Text to display when the list has no items.
26 * @param parent Parent widget.
28 explicit ListWindow(const QString &noItems, QWidget *parent = 0);
30 /** Set the model for the list. */
31 void setModel(QAbstractItemModel *model);
34 QAbstractItemModel *model() const;
37 * Add an action button to the beginning of the list (Maemo) or to the
38 * tool bar (non-Maemo).
40 void addButton(const QString &title, QObject *receiver, const char *slot,
41 const QString &iconPath = QString());
44 * Add an action button to the tool bar, which is only active if a list
47 void addItemButton(const QString &title, QObject *receiver,
48 const char *slot, const QString &iconPath = QString());
50 /** Add an action to the menu. */
51 QAction *addMenuAction(const QString &title, QObject *receiver,
54 /** Get current (selected) item. */
55 QModelIndex currentItem() const;
58 /** Emitted when a list item is activated. */
59 void activated(const QModelIndex &index);
62 /** Set the current (selected) item. */
63 void setCurrentItem(const QModelIndex &item);
66 void onItemActivated(const QModelIndex &);
76 void insertButton(int row, const Button &button);
78 void closeEvent(QCloseEvent *event);
83 QAbstractItemModel *mModel;
84 QList<Button> buttons;
89 QList<QAction *>itemActions;
92 #endif // LISTWINDOW_H