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

Method getUniqueFolderName

src/share/WizObjectOperator.cpp:682–716  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

680}
681
682QString WizDocumentOperatorPrivate::getUniqueFolderName(const QString& parentLocation, const QString& locationName)
683{
684 QString name = locationName;
685 int nRepeat = 0;
686 WizDatabase& db = WizDatabaseManager::instance()->db();
687 CWizStdStringArray arrayAllLocations;
688 if (!db.getAllLocations(arrayAllLocations))
689 return "";
690 CWizStdStringArray arrayChild;
691 if (!db.getChildLocations(arrayAllLocations, parentLocation, arrayChild))
692 return "";
693
694 while (true)
695 {
696 if (nRepeat > 0)
697 {
698 name = locationName + "_" + QString::number(nRepeat);
699 }
700 bool continueLoop = false;
701 CWizStdStringArray::const_iterator it;
702 for (it = arrayChild.begin(); it != arrayChild.end(); it++)
703 {
704 QString brotherLocation = *it;
705 if (WizDatabase::getLocationName(brotherLocation) == name)
706 {
707 nRepeat ++;
708 continueLoop = true;
709 break;
710 }
711 }
712 if (!continueLoop)
713 break;
714 }
715 return name;
716}
717
718QString WizDocumentOperatorPrivate::getUniqueFolderName(const WIZTAGDATA& parentTag, const WIZTAGDATA& sourceTag, bool combineFolder, const QString& exceptGUID)
719{

Callers

nothing calls this directly

Calls 7

getAllLocationsMethod · 0.80
getChildLocationsMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
getChildTagsMethod · 0.80
isEmptyMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected