MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / open

Method open

src/database/WizDatabase.cpp:2665–2708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2663
2664
2665bool WizDatabase::open(const QString& strAccountFolderName, const QString& strKbGUID /* = NULL */)
2666{
2667 Q_ASSERT(!strAccountFolderName.isEmpty());
2668
2669 m_strAccountFolderName = strAccountFolderName;
2670
2671 if (strKbGUID.isEmpty()) {
2672 m_bIsPersonal = true;
2673 } else {
2674 m_bIsPersonal = false;
2675 setKbGUID(strKbGUID);
2676 }
2677
2678 if (!WizIndex::open(getIndexFileName())) {
2679 // If can not open db, try again. If db still can not be opened, delete the db file and download data from server.
2680 if (!WizIndex::open(getIndexFileName())) {
2681 QFile::remove(getIndexFileName());
2682 return false;
2683 }
2684 }
2685
2686 // user private database opened, try to load kb guid
2687 if (strKbGUID.isEmpty()) {
2688 // user private kb_guid should be set before actually open for operating
2689 QString strUserKbGuid = getMetaDef(g_strDatabaseInfoSection, "KBGUID");
2690 if (!strUserKbGuid.isEmpty())
2691 setKbGUID(strUserKbGuid);
2692 }
2693
2694 // FIXME
2695 if (!WizThumbIndex::openThumb(getThumbFileName(), getThumIndexVersion())) {
2696 // If can not open db, try again. If db still can not be opened, delete the db file and download data from server.
2697 if (!WizThumbIndex::openThumb(getThumbFileName(), getThumIndexVersion())) {
2698 QFile::remove(getThumbFileName());
2699 return false;
2700 }
2701 }
2702
2703 setThumbIndexVersion(WIZNOTE_THUMB_VERSION);
2704
2705 loadDatabaseInfo();
2706
2707 return true;
2708}
2709
2710bool WizDatabase::loadDatabaseInfo()
2711{

Callers 5

loadFileDataMethod · 0.45
writeDataToDocumentMethod · 0.45
loadAttachmentDataMethod · 0.45

Calls 1

isEmptyMethod · 0.80

Tested by

no test coverage detected