diff --git a/bookinfodialog.cpp b/bookinfodialog.cpp
index c3dcfc4..e0cc8b6 100644
--- a/bookinfodialog.cpp
+++ b/bookinfodialog.cpp
@@ -45,7 +45,31 @@ bookInfoDialog::bookInfoDialog(QWidget *parent) :
global::library::bookTitle = "";
}
else {
+ ui->bookTitleLabel->setText(global::library::bookTitle);
+ global::library::bookTitle = "";
+ QDir dictdir;
+ dictdir.mkpath("/inkbox/gutenberg");
+ string_writeconfig("/inkbox/gutenberg/bookid", QString::number(global::library::bookId).toStdString());
+ string_writeconfig("/opt/ibxd", "gutenberg_get_cover\n");
+ while(true) {
+ if(QFile::exists("/inkbox/gutenberg/getCoverDone")) {
+ if(checkconfig("/inkbox/gutenberg/getCoverDone") == true) {
+ QPixmap coverPixmap("/inkbox/gutenberg/book_cover.jpg");
+ QPixmap scaledCoverPixmap = coverPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
+ ui->bookCoverLabel->setPixmap(scaledCoverPixmap);
+ QFile::remove("/inkbox/gutenberg/getCoverDone");
+ break;
+ }
+ else {
+ QPixmap coverPixmap(":/resources/cover_unavailable.png");
+ QPixmap scaledCoverPixmap = coverPixmap.scaled(stdIconWidth, stdIconHeight, Qt::KeepAspectRatio);
+ ui->bookCoverLabel->setPixmap(scaledCoverPixmap);
+ QFile::remove("/inkbox/gutenberg/getCoverDone");
+ break;
+ }
+ }
+ }
}
// Centering dialog
diff --git a/eink.qrc b/eink.qrc
index aa1f896..7057e82 100644
--- a/eink.qrc
+++ b/eink.qrc
@@ -70,5 +70,6 @@
resources/alert-triangle.png
resources/online-library.png
resources/online-library-inverted.png
+ resources/cover_unavailable.png
diff --git a/generaldialog.cpp b/generaldialog.cpp
index 516b883..84a34bb 100644
--- a/generaldialog.cpp
+++ b/generaldialog.cpp
@@ -367,6 +367,7 @@ void generalDialog::on_okBtn_clicked()
connect(searchResultsWidgetWindow, SIGNAL(destroyed(QObject*)), SLOT(restartSearchDialog()));
searchResultsWidgetWindow->setListViewContents(searchResults);
ui->mainStackedWidget->insertWidget(1, searchResultsWidgetWindow);
+ QFile::remove("/inkbox/gutenberg-search/search_done");
break;
}
else {
@@ -374,9 +375,9 @@ void generalDialog::on_okBtn_clicked()
emit showToast("No results found");
keyboardWidget->clearLineEdit();
global::keyboard::keyboardText = "";
+ QFile::remove("/inkbox/gutenberg-search/search_done");
break;
}
- QFile::remove("/inkbox/gutenberg-search/search_done");
}
}
}
diff --git a/resources/cover_unavailable.png b/resources/cover_unavailable.png
new file mode 100644
index 0000000..392fe4a
Binary files /dev/null and b/resources/cover_unavailable.png differ
diff --git a/searchresultswidget.cpp b/searchresultswidget.cpp
index 59a818d..05ec0b3 100644
--- a/searchresultswidget.cpp
+++ b/searchresultswidget.cpp
@@ -39,16 +39,32 @@ void searchResultsWidget::on_openBtn_clicked()
// Get currently selected row number
int selectedRow = ui->listView->currentIndex().row();
// So that row 0 becomes row 1
- selectedRow = selectedRow++;
+ selectedRow = selectedRow + 1;
+ QString selectedRowQstr = QString::number(selectedRow);
- // TODO: Find book ID and pass it on to bookInfoDialog, then retrieve cover.jpg for display
+ QString prog ("sed");
+ QStringList args;
+ args << "-n" << selectedRowQstr + "p" << "/inkbox/gutenberg-search/search_results_ids";
+ QProcess *proc = new QProcess();
+ proc->start(prog, args);
+ proc->waitForFinished();
+ QString bookIdQstr = proc->readAllStandardOutput();
+ proc->deleteLater();
- global::keyboard::searchDialog = false;
- global::keyboard::keyboardDialog = false;
+ unsigned long bookId = bookIdQstr.toULong();
+ global::library::bookId = bookId;
+
+ index = ui->listView->currentIndex();
+ itemText = index.data(Qt::DisplayRole).toString();
+ global::library::bookTitle = itemText;
bookInfoDialog * bookInfoDialogWindow = new bookInfoDialog();
bookInfoDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
bookInfoDialogWindow->show();
+
+ global::keyboard::searchDialog = false;
+ global::keyboard::keyboardDialog = false;
+ searchResultsWidget::close();
}
else {
index = ui->listView->currentIndex();