X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=searchresultsdialog.cpp;h=db0192b8fc0e4da6912b5c539cab09c76a0fcd20;hb=ee43811f99a9f2f047ed4aceeea2bdbf411f2fe0;hp=9535938f39eae811293c2178ef586a4099e5e796;hpb=156e40ef8337b8c0d668fb33a9c8bf2b6b34ba79;p=dorian diff --git a/searchresultsdialog.cpp b/searchresultsdialog.cpp index 9535938..db0192b 100644 --- a/searchresultsdialog.cpp +++ b/searchresultsdialog.cpp @@ -5,7 +5,6 @@ #include #include -#include "listview.h" #include "searchresultsdialog.h" #include "searchresultinfodialog.h" #include "trace.h" @@ -14,9 +13,9 @@ #include "platform.h" SearchResultsDialog::SearchResultsDialog(const QList results_, - QWidget *parent): ListWindow(parent), results(results_) + QWidget *parent): ListWindow(tr("(No results)"), parent), results(results_) { - setWindowTitle(tr("Search Results")); + setWindowTitle(tr("Search results")); foreach (Search::Result result, results) { QString author; @@ -27,13 +26,8 @@ SearchResultsDialog::SearchResultsDialog(const QList results_, } QStringListModel *model = new QStringListModel(data, this); - list = new ListView; - list->setSelectionMode(QAbstractItemView::SingleSelection); - list->setModel(model); - list->setUniformItemSizes(true); - addList(list); - addItemAction(tr("Download book"), this, SLOT(onDownload())); - connect(list, SIGNAL(activated(const QModelIndex &)), + setModel(model); + connect(this, SIGNAL(activated(const QModelIndex &)), this, SLOT(onItemActivated(const QModelIndex &))); Search *search = Search::instance(); connect(search, SIGNAL(beginDownload(int)), this, SLOT(onBeginDownload(int))); @@ -42,7 +36,7 @@ SearchResultsDialog::SearchResultsDialog(const QList results_, this, SLOT(onEndDownload(int, const Search::Result &, const QString &))); - progress = new ProgressDialog(tr("Downloading Book"), this); + progress = new ProgressDialog(tr("Downloading book"), this); } void SearchResultsDialog::onItemActivated(const QModelIndex &index) @@ -61,11 +55,6 @@ void SearchResultsDialog::onItemActivated(const QModelIndex &index) } } -void SearchResultsDialog::onDownload() -{ - onItemActivated(list->currentIndex()); -} - QString SearchResultsDialog::downloadName() const { TRACE; @@ -100,9 +89,11 @@ void SearchResultsDialog::onEndDownload(int status, const Search::Result &result Library::instance()->add(fileName); int row = results.indexOf(result); if (-1 != row) { - list->model()->removeRow(row); + results.removeAt(row); + model()->removeRow(row); } - Platform::instance()->information(tr("Downloaded \"%1\"\nand added to the " - "library").arg(result.title), this); + Platform::instance()-> + information(tr("Downloaded \"%1\"\nand added to the " + "library").arg(result.title), this); } }