From 526aec41d5549be4c6bd40b35b733f0c0e1db063 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sat, 7 May 2011 20:07:24 +0000 Subject: [PATCH] + content mgmt last imp. : we have now something working as good as before but with C++ code --- src/common/kiwix/manager.cpp | 19 ++++++++++++++++--- src/common/kiwix/manager.h | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/common/kiwix/manager.cpp b/src/common/kiwix/manager.cpp index f515b2650..6bbaea0dd 100644 --- a/src/common/kiwix/manager.cpp +++ b/src/common/kiwix/manager.cpp @@ -68,10 +68,10 @@ namespace kiwix { library.addBook(book); } } + } - if (!readOnly) - this->writableLibraryPath = path; - + if (!readOnly) { + this->writableLibraryPath = path; } return result; @@ -235,6 +235,19 @@ namespace kiwix { return false; } + bool Manager::setBookIndex(const string id, const string path, const supportedIndexType type) { + std::vector::iterator itr; + for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) { + if ( itr->id == id) { + itr->indexPath = path; + itr->indexType = type; + return true; + } + } + + return false; + } + 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 182a0407b..c801c456f 100644 --- a/src/common/kiwix/manager.h +++ b/src/common/kiwix/manager.h @@ -44,6 +44,7 @@ namespace kiwix { bool removeBookByIndex(const unsigned int bookIndex); bool removeBookById(const string id); bool setCurrentBookId(const string id); + bool setBookIndex(const string id, const string path, const supportedIndexType type); string getCurrentBookId(); bool addBookFromPath(const string path, const string url = ""); Library cloneLibrary();