QString Folder::path() { QString s = "/" + fName + "/"; Folder *parentFolder = (Folder *)parent(); while (parentFolder) { s.prepend("/"+parentFolder->folderName()); parentFolder = (Folder *)parentFolder->parent(); } return s; }
QStringList Folder::subfolders() { QStringList lst = QStringList(); QObjectList* folderLst = (QObjectList*)children(); if (!folderLst) return lst; if (folderLst) { Folder *f; for (f = (Folder*)folderLst->first(); f; f = (Folder*)folderLst->next()) lst << f->folderName(); } return lst; }
Folder* Folder::findSubfolder(const QString& s, bool caseSensitive, bool partialMatch) { QObjectList* folderLst = (QObjectList*)children(); if (folderLst) { Folder *f; for (f = (Folder*)folderLst->first(); f; f = (Folder*)folderLst->next()) { QString name = f->folderName(); if (partialMatch && name.startsWith(s, caseSensitive)) return f; else if (caseSensitive && name == s) return f; else { QString text = s; if (name == text.lower()) return f; } } } return 0; }