Remove the "last" book functionnality.

- This is not used by any application.
- This is application specific and should not be stored in the library
  (who is a list of book).
This commit is contained in:
Matthieu Gautier 2018-09-03 15:43:41 +02:00
parent efae3e0d2f
commit aa6772b345
3 changed files with 0 additions and 23 deletions

View File

@ -49,7 +49,6 @@ class Book
~Book(); ~Book();
bool update(const Book& other); bool update(const Book& other);
static bool sortByLastOpen(const Book& a, const Book& b);
static bool sortByTitle(const Book& a, const Book& b); static bool sortByTitle(const Book& a, const Book& b);
static bool sortBySize(const Book& a, const Book& b); static bool sortBySize(const Book& a, const Book& b);
static bool sortByDate(const Book& a, const Book& b); static bool sortByDate(const Book& a, const Book& b);
@ -61,7 +60,6 @@ class Book
bool readOnly() const { return m_readOnly; } bool readOnly() const { return m_readOnly; }
const string& id() const { return m_id; } const string& id() const { return m_id; }
const string& path() const { return m_path; } const string& path() const { return m_path; }
const string& last() const { return m_last; }
const string& indexPath() const { return m_indexPath; } const string& indexPath() const { return m_indexPath; }
const supportedIndexType& indexType() const { return m_indexType; } const supportedIndexType& indexType() const { return m_indexType; }
const string& title() const { return m_title; } const string& title() const { return m_title; }
@ -83,7 +81,6 @@ class Book
void setReadOnly(bool readOnly) { m_readOnly = readOnly; } void setReadOnly(bool readOnly) { m_readOnly = readOnly; }
void setId(const std::string& id) { m_id = id; } void setId(const std::string& id) { m_id = id; }
void setPath(const std::string& path); void setPath(const std::string& path);
void setLast(const std::string& last) { m_last = last; }
void setIndexPath(const std::string& indexPath); void setIndexPath(const std::string& indexPath);
void setIndexType(supportedIndexType indexType) { m_indexType = indexType;} void setIndexType(supportedIndexType indexType) { m_indexType = indexType;}
void setTitle(const std::string& title) { m_title = title; } void setTitle(const std::string& title) { m_title = title; }
@ -105,7 +102,6 @@ class Book
protected: protected:
string m_id; string m_id;
string m_path; string m_path;
string m_last;
string m_indexPath; string m_indexPath;
supportedIndexType m_indexType; supportedIndexType m_indexType;
string m_title; string m_title;

View File

@ -32,10 +32,6 @@ Book::~Book()
{ {
} }
/* Sort functions */ /* Sort functions */
bool Book::sortByLastOpen(const kiwix::Book& a, const kiwix::Book& b)
{
return atoi(a.last.c_str()) > atoi(b.last.c_str());
}
bool Book::sortByTitle(const kiwix::Book& a, const kiwix::Book& b) bool Book::sortByTitle(const kiwix::Book& a, const kiwix::Book& b)
{ {
return a.m_title < b.m_title; return a.m_title < b.m_title;

View File

@ -53,9 +53,6 @@ bool Manager::parseXmlDom(const pugi::xml_document& doc,
removeLastPathElement(libraryPath, true, false), path); removeLastPathElement(libraryPath, true, false), path);
} }
book.setPath(path); book.setPath(path);
book.setLast(std::string(bookNode.attribute("last").value()) != "undefined"
? bookNode.attribute("last").value()
: "");
std::string indexPath = bookNode.attribute("indexPath").value(); std::string indexPath = bookNode.attribute("indexPath").value();
if (isRelativePath(indexPath)) { if (isRelativePath(indexPath)) {
indexPath = computeAbsolutePath( indexPath = computeAbsolutePath(
@ -288,18 +285,6 @@ bool Manager::removeBookById(const string id)
{ {
return library.removeBookById(id); return library.removeBookById(id);
} }
bool Manager::updateBookLastOpenDateById(const string id)
try {
auto book = library.getBookById(id);
char unixdate[12];
sprintf(unixdate, "%d", (int)time(NULL));
book.last = unixdate;
return true;
} catch(...) {
return false;
}
bool Manager::setBookIndex(const string id, bool Manager::setBookIndex(const string id,
const string path, const string path,
const supportedIndexType type) const supportedIndexType type)