+ fix the generation of the lastopen list of files

This commit is contained in:
kelson42 2011-10-13 10:35:56 +00:00
parent aadce46adf
commit e33b448380
1 changed files with 30 additions and 27 deletions

View File

@ -452,33 +452,36 @@ namespace kiwix {
} }
/* Special sort for LASTOPEN */ /* Special sort for LASTOPEN */
if (mode == LASTOPEN) if (mode == LASTOPEN) {
std::sort(library.books.begin(), library.books.end(), kiwix::Book::sortByLastOpen); std::sort(library.books.begin(), library.books.end(), kiwix::Book::sortByLastOpen);
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
if (!itr->last.empty())
this->bookIdList.push_back(itr->id);
}
} else {
/* Generate the list of book id */
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
bool ok = true;
/* Generate the list of book id */ if (mode == LOCAL && itr->path.empty())
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) { ok = false;
bool ok = true;
if (mode == LOCAL && itr->path.empty()) if (ok == true && mode == REMOTE && (!itr->path.empty() || itr->url.empty()))
ok = false; ok = false;
if (mode == REMOTE && (!itr->path.empty() || itr->url.empty())) if (ok == true && atoi(itr->size.c_str()) > maxSize * 1024 * 1024)
ok = false; ok = false;
if (mode == LASTOPEN && itr->last.empty()) if (ok == true && !language.empty() && itr->language != language)
ok = false; ok = false;
if (atoi(itr->size.c_str()) > maxSize * 1024 * 1024) if (ok == true && !publisher.empty() && itr->creator != publisher)
ok = false; ok = false;
if (!language.empty() && itr->language != language) if (ok == true) {
ok = false; this->bookIdList.push_back(itr->id);
}
if (!publisher.empty() && itr->creator != publisher) }
ok = false;
if (ok == true)
this->bookIdList.push_back(itr->id);
} }
return true; return true;