src/writely/WriterUI.cpp
/**
 * Create an empty folder and return the folder info
 * @param    documentPath    start with "/"
 */
Create an empty folder and return the folder info
@param    documentPath    start with "/"
Create an empty folder and return the folder info @param documentPath start with " / "
QVariantMap WriterUI::createEmptyFolder( QString documentPath ) {
    QString destPath = documentsFolderPath() + documentPath;
    qDebug() << "WriterUI::createEmptyFolder" << ":documentPath:" << documentPath << "destPath:" << destPath;
    QDir dir(destPath);
    if (!dir.exists()) return QVariantMap();
    int counter = 0;
    while (true) {
        QString folderName = genFolderPath(destPath, counter);
        QDir newFolder(folderName);
        if (!newFolder.exists())
            break;
        counter ++;
    }
    QString newFolderName =  genFolderPath(destPath, counter);
    QDir newFolder( newFolderName );
    if (!newFolder.mkdir( newFolderName ))
        return QVariantMap();
    QFileInfo folderInfo( newFolderName );
    QVariantMap entry;
    entry["type"] = "folder";
    loadFileInfo( entry, folderInfo);
    qDebug() << "Created New Folder:" << entry;
    return entry;
}
QVariantMap WriterUI :: createEmptyFolder ( QString documentPath ) { QString destPath = documentsFolderPath ( ) + documentPath ; qDebug ( ) << " " << " " << documentPath << " " << destPath ; QDir dir ( destPath ) ; if ( ! dir . exists ( ) ) return QVariantMap ( ) ; int counter = 0 ; while ( true ) { QString folderName = genFolderPath ( destPath , counter ) ; QDir newFolder ( folderName ) ; if ( ! newFolder . exists ( ) ) break ; counter ++ ; } QString newFolderName = genFolderPath ( destPath , counter ) ; QDir newFolder ( newFolderName ) ; if ( ! newFolder . mkdir ( newFolderName ) ) return QVariantMap ( ) ; QFileInfo folderInfo ( newFolderName ) ; QVariantMap entry ; entry [ " " ] = " " ; loadFileInfo ( entry , folderInfo ) ; qDebug ( ) << " " << entry ; return entry ; }
Create an empty folder and return the folder info
 @param    documentPath    start with "/"
Create an empty folder and return the folder info @param documentPath start with " / "