Esempio n. 1
0
/**
 * Fetches a note sub folder by it's path data
 */
NoteSubFolder NoteSubFolder::fetchByPathData(QString pathData) {
    QStringList pathList = pathData.split("\n");
    NoteSubFolder noteSubFolder;
    QStringListIterator itr(pathList);

    // loop through all names to fetch the deepest note sub folder
    while (itr.hasNext()) {
        QString name = itr.next();
        noteSubFolder = NoteSubFolder::fetchByNameAndParentId(
                name, noteSubFolder.getId());
        if (!noteSubFolder.isFetched()) {
            return NoteSubFolder();
        }
    }

    return noteSubFolder;
}
Esempio n. 2
0
/**
 * Fetches a note sub folder by its path data
 */
NoteSubFolder NoteSubFolder::fetchByPathData(QString pathData,
                                             QString separator) {
    pathData = Utils::Misc::removeIfStartsWith(pathData, separator);
    QStringList pathList = pathData.split(separator);
    NoteSubFolder noteSubFolder;
    QStringListIterator itr(pathList);

    // loop through all names to fetch the deepest note sub folder
    while (itr.hasNext()) {
        QString name = itr.next();
        noteSubFolder = NoteSubFolder::fetchByNameAndParentId(
                name, noteSubFolder.getId());
        if (!noteSubFolder.isFetched()) {
            return NoteSubFolder();
        }
    }

    return noteSubFolder;
}