diff --git a/src/common/kiwix/manager.cpp b/src/common/kiwix/manager.cpp index 0200ddc8..dfabebd8 100644 --- a/src/common/kiwix/manager.cpp +++ b/src/common/kiwix/manager.cpp @@ -340,6 +340,16 @@ namespace kiwix { return this->library; } + bool Manager::getCurrentBook(Book &book) { + string currentBookId = getCurrentBookId(); + if (currentBookId.empty()) { + return false; + } else { + getBookById(currentBookId, book); + return true; + } + } + bool Manager::getBookById(const string id, Book &book) { std::vector::iterator itr; for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) { diff --git a/src/common/kiwix/manager.h b/src/common/kiwix/manager.h index 19dfcbdd..9d415808 100644 --- a/src/common/kiwix/manager.h +++ b/src/common/kiwix/manager.h @@ -60,6 +60,7 @@ namespace kiwix { const bool checkMetaData = false); Library cloneLibrary(); bool getBookById(const string id, Book &book); + bool getCurrentBook(Book &book); unsigned int getBookCount(const bool localBooks, const bool remoteBooks); bool updateBookLastOpenDateById(const string id); void removeBookPaths();