Quintiq file version 2.0
#parent: ToolbarMain/ValueHolderImportProfileMessage
Response OnValueChanged () id:Response_ToolbarMain_ValueHolderImportProfileMessage_OnValueChanged
{
  #keys: '[132894.0.410538737]'
  Body:
  [*
    // When error messages change, we need to update the tooltip and image of Import profiles button
    
    image := 'IMPORT2';
    tooltip := Translations::MP_Designer_ImportProfiles_Tooltip();
    message := '';
    
    syncStatus := this.Value();
    
    // Only change icon image and tooltip when synchronization in progress
    if( not ( syncStatus = ''
              or syncStatus = Translations::MPSync_Synchronization_Complete() ) )
    {
      if( syncStatus = Translations::MPSync_Synchronization_Fail() )
      {
        image := 'DATA_ERROR';
        message := MacroPlan.SynchronizationErrorMessage();
      }
      else
      {
        image := 'HOURGLASS';
        message := syncStatus;
      }
    }
    
    /* Preserve broker error message so that user aware
       synchronization failed because of broker import error      */
    if( MPSync.ImportErrorMessage() <> '' )
    {
      image := 'DATA_ERROR';
      message := MPSync.ImportErrorMessage()
                 + '<br>'
                 + message;
    }
    
    if( message <> '' )
    {
      tooltip := tooltip + '<br>'
                 + message
                 + '</html>'
    }
    
    ButtonToolbarImportProfiles.SetProperty( 'Tooltip', tooltip );
    ButtonToolbarImportProfiles.SetProperty( 'Image', image );
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_ValueHolder_OnValueChanged'
  Precondition:
  [*
    return not isnull( MacroPlan );
  *]
}
