#include <QDir>
#include <QFile>
-#ifdef Q_WS_MAEMO_5
-#include <QtMaemo5/QMaemo5InformationBox>
-#endif
-
-#include "listview.h"
#include "searchresultsdialog.h"
#include "searchresultinfodialog.h"
#include "trace.h"
#include "platform.h"
SearchResultsDialog::SearchResultsDialog(const QList<Search::Result> 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;
}
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)));
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)
}
}
-void SearchResultsDialog::onDownload()
-{
- onItemActivated(list->currentIndex());
-}
-
QString SearchResultsDialog::downloadName() const
{
TRACE;
- QString dir = Platform::downloadDir();
+ QString dir = Platform::instance()->downloadDir();
QDir().mkpath(dir); // Not sure if this works. QDir API is quiet lame.
unsigned i = 0;
QString fileName;
Library::instance()->add(fileName);
int row = results.indexOf(result);
if (-1 != row) {
- list->model()->removeRow(row);
+ results.removeAt(row);
+ model()->removeRow(row);
}
-#ifdef Q_WS_MAEMO_5
- QMaemo5InformationBox::information(this,
- tr("Downloaded \"%1\"\nand added to the library").arg(result.title),
- QMaemo5InformationBox::DefaultTimeout);
-#endif
+ Platform::instance()->
+ information(tr("Downloaded \"%1\"\nand added to the "
+ "library").arg(result.title), this);
}
}