Logo Search packages:      
Sourcecode: kdar version File versions  Download package

libdar::et_mask KDarConfig::libdarCreateDirectoryMask (  ) 

Returns the full creation directory mask.

Definition at line 2106 of file kdarConfig.cpp.

References directoryMaskList(), directoryMaskTypes(), and kdar::toStdString().

Referenced by createArchiveThread::run(), and kdarView::slotArchiveCreate().

{
//    kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): reached." << endl;
    //Directories to include ["list of paths"],
    //or exclude ["-P" option]
    libdar::et_mask subtree;
    libdar::ou_mask directoryIncludes;
    libdar::ou_mask directoryExcludes;

    QStringList directoryList = directoryMaskList();
    QStringList maskTypes = directoryMaskTypes();
//    kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): mask type count is " << maskTypes.count() << endl;
    kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): mask directory count is " << directoryList.count() << endl;

    //Iterate over the QStringList, adding the masks to the appropriate libdar::ou_mask
    if ( maskTypes.count() == directoryList.count() )
    {
        QStringList::Iterator typeIterator = maskTypes.begin();
        for( QStringList::Iterator directoryIterator = directoryList.begin(); directoryIterator != directoryList.end(); ++directoryIterator )
        {
// TODO handle caseSensitive:
            bool caseSensitive = false;
            //Add the directory to the appropriate include or exclude mask
            if ( *typeIterator == i18n( "filter type for inclusion", "Include" ) )
            {
                directoryIncludes.add_mask( libdar::simple_path_mask( libdar::path( kdar::toStdString( *directoryIterator ) ).display(), caseSensitive ) );
//                 kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): added include mask " << endl;
            }
            else //exclude "Exclude" and "Auto" masks
            {
                directoryExcludes.add_mask( libdar::simple_mask( libdar::path( kdar::toStdString( *directoryIterator ) ).display(), caseSensitive ) );
//                 kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): added exclude mask " << endl;
            }
            ++typeIterator;
        }
    }
    //If the include or exclude masks contain items, add them to the subtree mask
//     kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): directoryIncludes.size() = "  << directoryIncludes.size() << endl;
//     kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): directoryExcludes.size() = "  << directoryExcludes.size() << endl;

    if ( directoryIncludes.size() != 0 )
    {
        subtree.add_mask( directoryIncludes );
//         kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): subtree got include mask" << endl;

    }
    else
    {
        subtree.add_mask( libdar::bool_mask( true ) );
    }
    if ( directoryExcludes.size() != 0 )
    {
        subtree.add_mask( libdar::not_mask( directoryExcludes ) );
//         kdDebug() << "KDarConfig::libdarCreateDirectoryMask(): subtree got exclude mask" << endl;
    }

    return subtree;
}


Generated by  Doxygen 1.6.0   Back to index