From 215300f206c881e65630ad99cfd0836e950c96b2 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Thu, 25 Aug 2011 06:39:53 +0000 Subject: [PATCH] + load content manager per default if not local content detected (first start use case) --- src/common/kiwix/manager.cpp | 10 ++++++++++ src/common/kiwix/manager.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/common/kiwix/manager.cpp b/src/common/kiwix/manager.cpp index a33794da4..dfe375d92 100644 --- a/src/common/kiwix/manager.cpp +++ b/src/common/kiwix/manager.cpp @@ -321,6 +321,16 @@ namespace kiwix { } } + unsigned int Manager::getBookCount(const bool localBooks, const bool remoteBooks) { + unsigned int result = 0; + std::vector::iterator itr; + for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) { + if (!itr->path.empty() && localBooks || itr->path.empty() && remoteBooks) + result++; + } + return result; + } + bool Manager::listBooks(const supportedListMode mode) { this->bookIdList.clear(); std::vector::iterator itr; diff --git a/src/common/kiwix/manager.h b/src/common/kiwix/manager.h index 15806a168..89abd8829 100644 --- a/src/common/kiwix/manager.h +++ b/src/common/kiwix/manager.h @@ -58,6 +58,7 @@ namespace kiwix { bool addBookFromPath(const string path, const string url = "", const bool checkMetaData = false); Library cloneLibrary(); bool getBookById(const string id, Book &book); + unsigned int getBookCount(const bool localBooks, const bool remoteBooks); bool updateBookLastOpenDateById(const string id); void removeBookPaths(); bool listBooks(const supportedListMode);