Handle selection changes.
[dorian] / librarydialog.h
1 #ifndef LIBRARYDIALOG_H
2 #define LIBRARYDIALOG_H
3
4 #include <QDialog>
5 #include <QString>
6 #include <QModelIndexList>
7
8 class QMainWindow;
9 class QListView;
10 class QPushButton;
11 class QModelIndex;
12 class Book;
13 class InfoWindow;
14 class SortedLibrary;
15
16 class LibraryDialog: public QDialog
17 {
18     Q_OBJECT
19
20 public:
21     explicit LibraryDialog(QWidget *parent = 0);
22
23 public slots:
24     void onAdd();
25 #ifndef Q_WS_MAEMO_5
26     void onRemove();
27     void onDetails();
28     void onRead();
29     void onItemSelectionChanged();
30 #endif // Q_WS_MAEMO_5
31     void onBookAdded();
32     void onItemActivated(const QModelIndex &index);
33     void onCurrentBookChanged();
34
35 private:
36     QString createItemText(const Book *book);
37     void setSelected(const QModelIndex &index);
38     QModelIndex selected() const;
39     QListView *list;
40     SortedLibrary *sortedLibrary;
41 #ifndef Q_WS_MAEMO_5
42     QPushButton *detailsButton;
43     QPushButton *removeButton;
44     QPushButton *readButton;
45 #endif // Q_WS_MAEMO_5
46     QPushButton *addButton;
47 };
48
49 #endif // LIBRARYDIALOG_H