Add tool bars to list windows on Symbian.
[dorian] / widgets / listwindow.h
index 71cef8b..3f75f78 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef LISTWINDOW_H
 #define LISTWINDOW_H
 
-#include <QMainWindow>
+#include "mainbase.h"
+
 #include <QDialogButtonBox>
 #include <QList>
 
@@ -13,7 +14,7 @@ class QListWidget;
 class QModelIndex;
 
 /** A window with a list and menu actions (Maemo) or buttons (non-Maemo). */
-class ListWindow: public QMainWindow
+class ListWindow: public MainBase
 {
     Q_OBJECT
 
@@ -31,14 +32,27 @@ public:
     /** Get model. */
     QAbstractItemModel *model() const;
 
-    /** Add an action button to the beginning of the list. */
+    /**
+     * Add an action button to the beginning of the list (Maemo) or to the
+     * tool bar (non-Maemo).
+     */
     void addButton(const QString &title, QObject *receiver, const char *slot,
                    const QString &iconPath = QString());
 
+    /**
+     * Add an action button to the tool bar, which is only active if a list
+     * item is selected.
+     */
+    void addItemButton(const QString &title, QObject *receiver,
+                       const char *slot, const QString &iconPath = QString());
+
     /** Add an action to the menu. */
     QAction *addMenuAction(const QString &title, QObject *receiver,
                            const char *slot);
 
+    /** Get current (selected) item. */
+    QModelIndex currentItem() const;
+
 signals:
     /** Emitted when a list item is activated. */
     void activated(const QModelIndex &index);
@@ -47,10 +61,6 @@ public slots:
     /** Set the current (selected) item. */
     void setCurrentItem(const QModelIndex &item);
 
-#ifdef Q_OS_SYMBIAN
-    void show();
-#endif
-
 protected slots:
     void onItemActivated(const QModelIndex &);
     void populateList();
@@ -75,6 +85,7 @@ private:
 #ifdef Q_OS_SYMBIAN
     FlickCharm *charm;
 #endif
+    QList<QAction *>itemActions;
 };
 
 #endif // LISTWINDOW_H