| 3733 | } |
| 3734 | |
| 3735 | void 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 | |
| 3769 | void WizIndex::deleteExtraFolder(const QString& strLocation) |
| 3770 | { |
no test coverage detected