#include "infodialog.h"
#include "settings.h"
#include "listwindow.h"
+#include "foldersdialog.h"
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);
// 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()));
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()
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();
void LibraryDialog::onShowFolders()
{
+ FoldersDialog *folders = new FoldersDialog(this);
+ folders->show();
}