ACC SHELL

Path : /usr/share/YaST2/clients/
File Upload :
Current File : //usr/share/YaST2/clients/online_update_install.ycp

/**
 * File:	clients/online_update_install.ycp
 * Package:	Configuration of online_update
 * Summary: YOU installation page
 * Authors: Cornelius Schumacher <cschum@suse.de>
 *
 * $Id: online_update_install.ycp 58403 2009-08-20 14:41:43Z jsuchome $
 *
 * This is a client for installation.
 * It displays the dialog with a progress of the actual installation and
 * executes the installation.
 */

{

  textdomain "online-update";

  import "Label";
  import "Stage";
  import "Wizard";
  import "OnlineUpdateDialogs";


  term contents = `VBox(
	    `VSpacing( 0.2 ),
	    // progress window label
            `LogView(`id(`log), _("Progress Log"), 5, 0 ),
	    `VSpacing( 0.5 ),
	    `ReplacePoint (`id (`rppatch),
		// progress bar label
		`ProgressBar (`id (`you_patch_progress), _("Package Progress"))
	    ),
            `VSpacing( 0.2 ),
	    `ReplacePoint (`id(`rpprogress),
		// progress bar label
		`ProgressBar( `id( `you_total_progress ), _("Total Progress") )
	    ),
	    `VSpacing( 0.5 ),
            `VSpacing( 0.2 )
  );
  // help text for online update
  string help_part1 =  _("<p>After connecting to the update server,
YaST will download all selected patches.
This could take some time. Download details are shown in the log window.</p>");

  // help text for online update
  string help_part2 =  _("<p>If special messages associated with patches are available, they will be shown in an extra dialog when the patch is installed.</p>
");

  string help_text = help_part1 + help_part2;

  // using SetContents (define in online_update.ycp)
  Wizard::SetContents( _("Patch Download and Installation"), contents,
                       help_text, false, false);

  if (!Stage::cont ())
    Wizard::SetNextButton(`next, Label::FinishButton() );

  integer total_progress = size (Pkg::GetPackages (`selected, true)) * 2;
  if (total_progress == 0)
      total_progress	= 100;

  UI::ReplaceWidget (`id(`rpprogress),
    // progress bar label
    `ProgressBar( `id( `you_total_progress ), _("Total Progress"), total_progress)
  );

  // FIXME no chance to get this after Commit (bug 188556)
  boolean changed_packages	= Pkg::PkgAnyToDelete ();

  list commit = Pkg::PkgCommit (0);

  import "OnlineUpdateCallbacks";

  // progress information
  OnlineUpdateCallbacks::ProgressLog (_("Installation finished.\n"));

  if (Stage::cont ())
  {
    // one more finish message (#191400)
    UI::ReplaceWidget (`id (`rppatch),
	// label
	`Left (`Label (`opt (`boldFont), _("Patch installation finished.")))
    );
    UI::ReplaceWidget (`id(`rpprogress), `Empty ());
  }


  if ( commit[1]:[] != [] ) {
    string details = Pkg::LastError() + "\n" + Pkg::LastErrorDetails();
    // error message
    OnlineUpdateDialogs::ErrorPopup( _("Patch processing failed."), details );
  }

  Wizard::EnableBackButton();
  Wizard::EnableNextButton();
  Wizard::SetFocusToNextButton();

  changed_packages = changed_packages || commit[0]:0 > 0;

  UI::ChangeWidget( `id( `you_patch_progress ), `Value, 100 );
  UI::ChangeWidget( `id( `you_total_progress ), `Value, total_progress);

  symbol ret = `next;
  if (!Stage::cont ())
  {
    if (!changed_packages)
	ret = `abort;
    return ret;
  }

  ////////////////////////////////////////////////////////////////////////
  ////  Loop for User Input ....
  repeat {
    ret = (symbol)UI::UserInput();

    if (ret == `cancel && !changed_packages) ret = `abort;

    if (ret == `abort && !OnlineUpdateDialogs::ConfirmAbortUpdate(`suseconfig))
	ret = `this;

    if (!changed_packages && ( ret == `next || ret == `cancel ))
	ret = `abort;

  } until ( ret == `next || ret == `back || ret == `abort || ret == `again ||
            ret == `cancel );

  return ret;
}

ACC SHELL 2018