From 1e6e6ede6b680676f93da00c7fa61b3b50e94ab4 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Sun, 5 Sep 2021 10:29:52 -0400 Subject: [PATCH] Started work to open book file from search in Reader --- generaldialog.cpp | 2 +- reader.cpp | 6 ++++++ reader.h | 1 + searchresultswidget.cpp | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/generaldialog.cpp b/generaldialog.cpp index 793deb0..687d6ff 100644 --- a/generaldialog.cpp +++ b/generaldialog.cpp @@ -253,7 +253,7 @@ void generalDialog::on_okBtn_clicked() } if(keyboardDialog == true) { if(global::keyboard::searchDialog == true) { - if(global::keyboard::keyboardText != "") { + if(!global::keyboard::keyboardText.isEmpty()) { if(ui->searchComboBox->currentText() == "Dictionary") { string_writeconfig("/inkbox/searchComboBoxFunction", "Dictionary"); for(int i = ui->mainStackedWidget->count(); i >= 0; i--) { diff --git a/reader.cpp b/reader.cpp index 3beb81f..9fb9d4a 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1856,6 +1856,8 @@ void reader::setupSearchDialog() { generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose); connect(generalDialogWindow, SIGNAL(refreshScreen()), SLOT(searchRefreshScreen())); connect(generalDialogWindow, SIGNAL(destroyed(QObject*)), SLOT(setupSearchDialog())); + connect(generalDialogWindow, SIGNAL(openBookFile(QString, bool)), SLOT(openBookFile(QString, bool))); + connect(generalDialogWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString))); generalDialogWindow->show(); } else { @@ -2059,3 +2061,7 @@ void reader::on_increaseScaleBtn_clicked() ui->pdfScaleSlider->setValue(sliderWantedValue); } } + +void reader::openBookFile(QString book, bool relativePath) { + qDebug() << "Open book:" << book; +} diff --git a/reader.h b/reader.h index 9b7fa97..2c58f46 100644 --- a/reader.h +++ b/reader.h @@ -156,6 +156,7 @@ private slots: void on_pdfScaleSlider_valueChanged(int value); void on_decreaseScaleBtn_clicked(); void on_increaseScaleBtn_clicked(); + void openBookFile(QString book, bool relativePath); private: Ui::reader * ui; diff --git a/searchresultswidget.cpp b/searchresultswidget.cpp index c50e5ac..91eda8c 100644 --- a/searchresultswidget.cpp +++ b/searchresultswidget.cpp @@ -33,6 +33,8 @@ void searchResultsWidget::on_openBtn_clicked() itemText = index.data(Qt::DisplayRole).toString(); if(!itemText.isEmpty()) { emit openBookFile(itemText, true); + global::keyboard::searchDialog = false; + global::keyboard::keyboardDialog = false; searchResultsWidget::close(); } else {