- select(current);
-
- QHBoxLayout *horizontalLayout = new QHBoxLayout(this);
- horizontalLayout->addWidget(list);
-
- QDialogButtonBox *buttonBox = new QDialogButtonBox(Qt::Vertical);
-#ifndef Q_WS_MAEMO_5
- detailsButton = new QPushButton(tr("Details"), this);
- readButton = new QPushButton(tr("Read"), this);
- removeButton = new QPushButton(tr("Delete"), this);
-#endif
- addButton = new QPushButton(tr("Add"), this);
-
-#ifndef Q_WS_MAEMO_5
- buttonBox->addButton(detailsButton, QDialogButtonBox::ActionRole);
- buttonBox->addButton(readButton, QDialogButtonBox::AcceptRole);
- buttonBox->addButton(removeButton, QDialogButtonBox::ActionRole);
-#endif // Q_WS_MAEMO_5
- buttonBox->addButton(addButton, QDialogButtonBox::ActionRole);
-
- horizontalLayout->addWidget(buttonBox);
-
- connect(Library::instance(), SIGNAL(nowReadingChanged()),
- this, SLOT(onCurrentBookChanged()));
- connect(Library::instance(),
- SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this,
- SLOT(onBookAdded()));
-#ifndef Q_WS_MAEMO_5
- connect(list, SIGNAL(itemSelectionChanged()),
- this, SLOT(onItemSelectionChanged()));
- connect(detailsButton, SIGNAL(clicked()), this, SLOT(onDetails()));
- connect(readButton, SIGNAL(clicked()), this, SLOT(onRead()));
- connect(removeButton, SIGNAL(clicked()), this, SLOT(onRemove()));
-#endif
- connect(addButton, SIGNAL(clicked()), this, SLOT(onAdd()));
-#ifdef Q_WS_MAEMO_5
- connect(list, SIGNAL(itemActivated(QListWidgetItem *)),
- this, SLOT(onItemActivated(QListWidgetItem *)));
-#endif
-
-#ifndef Q_WS_MAEMO_5
- onItemSelectionChanged();
-#endif
+ setCurrentItem(sortedLibrary->mapFromSource(current));
+
+ // Search dialog box
+ searchDialog = new SearchDialog(this);
+ connect(Search::instance(), SIGNAL(endSearch()),
+ this, SLOT(showSearchResults()));
+
+ // Progress bar
+ progress = new ProgressDialog(tr("Adding books"), this);
+
+ connect(library, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
+ this, SLOT(onBookAdded()));
+ connect(this, SIGNAL(activated(const QModelIndex &)),
+ this, SLOT(onItemActivated(const QModelIndex &)));
+
+ // Retrieve default sort criteria
+ switch (Settings::instance()->value("lib/sortby").toInt()) {
+ case SortedLibrary::SortByAuthor:
+ onSortByAuthor();
+ break;
+ default:
+ onSortByTitle();
+ }