| 441 | } |
| 442 | |
| 443 | bool 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 | |
| 475 | bool DocViewNative::closeBook() |
| 476 | { |
nothing calls this directly
no test coverage detected