| 540 | } |
| 541 | |
| 542 | void WizDocumentView::reviewCurrentNote() |
| 543 | { |
| 544 | Q_ASSERT(!m_note.strGUID.isEmpty()); |
| 545 | |
| 546 | initStat(m_note, m_editorMode == modeEditor); |
| 547 | |
| 548 | // download document if not exist |
| 549 | WizDatabase& db = m_dbMgr.db(m_note.strKbGUID); |
| 550 | QString strDocumentFileName = db.getDocumentFileName(m_note.strGUID); |
| 551 | if (!db.isObjectDataDownloaded(m_note.strGUID, "document") || \ |
| 552 | !WizPathFileExists(strDocumentFileName)) |
| 553 | { |
| 554 | downloadNoteFromServer(m_note); |
| 555 | |
| 556 | return; |
| 557 | } |
| 558 | |
| 559 | // ask user cipher if needed |
| 560 | if (m_note.nProtected) { |
| 561 | if(!db.loadUserCert()) { |
| 562 | return; |
| 563 | } |
| 564 | |
| 565 | if (db.getCertPassword().isEmpty()) { |
| 566 | m_passwordView->setHint(db.getCertPasswordHint()); |
| 567 | m_stack->setCurrentWidget(m_passwordView); |
| 568 | m_passwordView->setCipherEditorFocus(); |
| 569 | |
| 570 | return; |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | if (m_stack->currentWidget() != m_docView) { |
| 575 | m_stack->setCurrentWidget(m_docView); |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | /*! |
| 580 | Set the \a mode of editor and try to save document before switching mode. |
no test coverage detected