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

Method addExtraFolder

src/database/WizIndex.cpp:3735–3767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3733}
3734
3735void WizIndex::addExtraFolder(const QString& strLocation)
3736{
3737 CWizStdStringArray arrayLocation;
3738 getExtraFolder(arrayLocation);
3739 if (-1 != ::WizFindInArray(arrayLocation, strLocation)) {
3740 return;
3741 }
3742
3743 arrayLocation.push_back(strLocation);
3744 Q_EMIT folderCreated(strLocation);
3745
3746 // add all of it's parents
3747 QString strParent = strLocation;
3748 int idx = strParent.lastIndexOf("/", -2);
3749 while (idx) {
3750 // 如果文件夹格式错误,直接退出,防止死循环
3751 if (strParent.left(1) != "/" || strParent.right(1) != "/")
3752 {
3753 qCritical() << "try to add a error location : " << strParent;
3754 return;
3755 }
3756
3757 strParent = strParent.left(idx + 1);
3758 idx = strParent.lastIndexOf("/", -2);
3759
3760 if (-1 == ::WizFindInArray(arrayLocation, strParent)) {
3761 arrayLocation.push_back(strParent);
3762 Q_EMIT folderCreated(strParent);
3763 }
3764 }
3765
3766 setExtraFolder(arrayLocation);
3767}
3768
3769void WizIndex::deleteExtraFolder(const QString& strLocation)
3770{

Callers 4

moveToLocationMethod · 0.80
initFoldersMethod · 0.80
createFolderItemMethod · 0.80

Calls 1

WizFindInArrayFunction · 0.85

Tested by

no test coverage detected