Esempio n. 1
0
int MItem::expandAction( MAction* action, WString& command )
{
    WFileName fn;
    if( _isTarget ) {
        absName( fn );
    } else {
        WVList actions;
        int ocount = addActions( actions );
        if( !action ) {
            int icount = actions.count();
            if( icount > 0 ) {
                for( int i=0; i<icount; i++ ) {
                    MAction* act = (MAction*)actions[i];
                    if( act->defAction() ) {
                        if( act->okForMask() || !isMask() ) {
                            action = act;
                            break;
                        }
                    }
                }
            }
        }
        if( action ) {
            int ix = actions.indexOfSame( action );
            if( ix < 0 ) {
                action = NULL;
            } else if( ix >= ocount ) {
                absResult( fn );
            } else {
                absName( fn );
            }
        }
    }
    if( action ) {
        WVList* states = findActionStates( action );
        return( action->expand( command, &fn, _component->mask(), states, _component->mode() ) );
    }
    return( -1 );
}