bool pEnvironmentVariablesManager::mergeNewVariables( pEnvironmentVariablesModel::Variables& variables ) const { const pEnvironmentVariablesModel::Variables newVariables = pEnvironmentVariablesModel::stringListToVariables( QProcess::systemEnvironment() ); bool modified = false; foreach ( const QString& name, newVariables.keys() ) { if ( variables.contains( name ) ) { continue; } modified = true; variables[ name ] = newVariables[ name ]; } return modified; }
bool pEnvironmentVariablesManager::removeUnmodifiedVariables( pEnvironmentVariablesModel::Variables& variables ) const { const pEnvironmentVariablesModel::Variables sysVariables = pEnvironmentVariablesModel::stringListToVariables( QProcess::systemEnvironment() ); bool modified = false; foreach ( const pEnvironmentVariablesModel::Variable& variable, variables ) { if ( !variable.enabled ) { continue; } if ( sysVariables.contains( variable.name ) && variable.value == sysVariables[ variable.name ].value ) { variables.remove( variable.name ); modified = true; } } return modified; }