MCPcopy Create free account
hub / github.com/buggins/coolreader / openRecentBook

Method openRecentBook

android/jni/docview.cpp:443–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443bool DocViewNative::openRecentBook()
444{
445 CRLog::debug("DocViewNative::openRecentBook()");
446 int index = 0;
447 if ( _docview->isDocumentOpened() ) {
448 CRLog::debug("DocViewNative::openRecentBook() : saving previous document state");
449 _docview->swapToCache();
450 _docview->getDocument()->updateMap();
451 _docview->savePosition();
452 closeBook();
453 index = 1;
454 }
455 LVPtrVector<CRFileHistRecord> & files = _docview->getHistory()->getRecords();
456 CRLog::info("DocViewNative::openRecentBook() : %d files found in history, startIndex=%d", files.length(), index);
457 if ( index < files.length() ) {
458 CRFileHistRecord * file = files.get( index );
459 lString16 fn = file->getFilePathName();
460 CRLog::info("DocViewNative::openRecentBook() : checking file %s", LCSTR(fn));
461 // TODO: check error
462 if ( LVFileExists(fn) ) {
463 return loadDocument( fn );
464 } else {
465 CRLog::error("file %s doesn't exist", LCSTR(fn));
466 return false;
467 }
468 //_docview->swapToCache();
469 } else {
470 CRLog::info("DocViewNative::openRecentBook() : no recent book found in history");
471 }
472 return false;
473}
474
475bool DocViewNative::closeBook()
476{

Callers

nothing calls this directly

Calls 10

LVFileExistsFunction · 0.85
isDocumentOpenedMethod · 0.80
getFilePathNameMethod · 0.80
swapToCacheMethod · 0.45
updateMapMethod · 0.45
getDocumentMethod · 0.45
savePositionMethod · 0.45
getHistoryMethod · 0.45
lengthMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected