Navigate with volume keys.
[dorian] / librarydialog.cpp
index 32e7ad3..f861d26 100644 (file)
@@ -15,6 +15,7 @@
 #include "infodialog.h"
 #include "settings.h"
 #include "listwindow.h"
+#include "foldersdialog.h"
 
 LibraryDialog::LibraryDialog(QWidget *parent): ListWindow(parent)
 {
@@ -27,7 +28,6 @@ LibraryDialog::LibraryDialog(QWidget *parent): ListWindow(parent)
     list->setModel(sortedLibrary);
     list->setSelectionMode(QAbstractItemView::SingleSelection);
     list->setSpacing(1);
-    list->setUniformItemSizes(true);
     Library *library = Library::instance();
     QModelIndex current = library->nowReading();
     setSelected(current);
@@ -36,13 +36,13 @@ LibraryDialog::LibraryDialog(QWidget *parent): ListWindow(parent)
     // Add actions
 
 #ifndef Q_WS_MAEMO_5
-    addAction(tr("Details"), this, SLOT(onDetails()));
-    addAction(tr("Read"), this, SLOT(onRead()));
-    addAction(tr("Delete"), this, SLOT(onRemove()));
+    addItemAction(tr("Details"), this, SLOT(onDetails()));
+    addItemAction(tr("Read"), this, SLOT(onRead()));
+    addItemAction(tr("Delete"), this, SLOT(onRemove()));
 #endif // ! Q_WS_MAEMO_5
 
-    addAction(tr("Add"), this, SLOT(onAdd()));
-    addAction(tr("Folders"), this, SLOT(onShowFolders()));
+    addAction(tr("Add book"), this, SLOT(onAdd()));
+    addAction(tr("Manage folders"), this, SLOT(onShowFolders()));
 
     connect(Library::instance(), SIGNAL(nowReadingChanged()),
             this, SLOT(onCurrentBookChanged()));
@@ -52,13 +52,6 @@ LibraryDialog::LibraryDialog(QWidget *parent): ListWindow(parent)
             SLOT(onBookAdded()));
     connect(list, SIGNAL(activated(const QModelIndex &)),
             this, SLOT(onItemActivated(const QModelIndex &)));
-#ifndef Q_WS_MAEMO_5
-    connect(list->selectionModel(),
-            SIGNAL(selectionChanged(const QItemSelection &,
-                                    const QItemSelection &)),
-            this, SLOT(onItemSelectionChanged()));
-    onItemSelectionChanged();
-#endif // !Q_WS_MAEMO_5
 }
 
 void LibraryDialog::onAdd()
@@ -159,20 +152,6 @@ QString LibraryDialog::createItemText(const Book *book)
     return text;
 }
 
-#ifndef Q_WS_MAEMO_5
-
-void LibraryDialog::onItemSelectionChanged()
-{
-#if 0 // FIXME: API missing from ListWindow
-    bool enable = selected().isValid();
-    readButton->setEnabled(enable);
-    detailsButton->setEnabled(enable);
-    removeButton->setEnabled(enable);
-#endif
-}
-
-#endif // Q_WS_MAEMO_5
-
 void LibraryDialog::onCurrentBookChanged()
 {
     close();
@@ -200,4 +179,6 @@ QModelIndex LibraryDialog::selected() const
 
 void LibraryDialog::onShowFolders()
 {
+    FoldersDialog *folders = new FoldersDialog(this);
+    folders->show();
 }