ACC SHELL

Path : /proc/self/root/usr/share/YaST2/include/firewall/
File Upload :
Current File : //proc/self/root/usr/share/YaST2/include/firewall/complex.ycp

/**
 * File:	include/firewall/complex.ycp
 * Package:	Firewall configuration
 * Summary:	Complex dialogs definitions
 * Authors:	Michal Svec <msvec@suse.cz>
 *
 * $Id: complex.ycp 49128 2008-07-15 16:39:03Z locilka $
 */

{

    textdomain "firewall";

    import "Popup";
    import "SuSEFirewall";
    import "Wizard";
    import "Confirm";
    import "Report";
    import "Message";

    include "firewall/helps.ycp";

    /**
     * Read settings dialog.
     *
     * @return `next if success, else `abort
     */
    define symbol ReadDialog() {

	Wizard::RestoreHelp(HelpForDialog("reading_configuration"));

	// Checking for root's permissions
	if (!Confirm::MustBeRoot())
	    return `abort;

	// reading firewall settings
	boolean ret = SuSEFirewall::Read();
	if (!ret) {
	    Report::Error(Message::CannotContinueWithoutPackagesInstalled());
	    return `abort;
	}

	// testing for other firewall running
	if (SuSEFirewall::IsOtherFirewallRunning()) {
	    // TRANSLATORS: Popup headline
	    if(Popup::ContinueCancelHeadline(_("Another Firewall Active"),
		// TRANSLATORS: Popup text
		_("Another kind of firewall is active in your system.
If you continue, SuSEfirewall2 may produce undefined errors.
It would be better to remove the other firewall before
configuring SuSEfirewall2.
Continue with configuration?
")) != true)
	    return `abort;
	}

	// hidding finished progress
	Wizard::SetContentsButtons ("", `Empty(), "", "", "");
	Wizard::SetAbortButton (`abort, Label::CancelButton());

	/* FIXME: handle possible read errors */
	return ret ? `next : `abort;
    }

    /**
     * Write settings dialog
     * @return `next if success, else `abort
     */
    define symbol WriteDialog() ``{

	Wizard::RestoreHelp(HelpForDialog("saving_configuration"));

	boolean ret = SuSEFirewall::Write();
	return ret ? `next : `abort;

	// hidding finished progress
	Wizard::SetContentsButtons ("", `Empty(), "", "", "");
	Wizard::SetAbortButton (`abort, Label::CancelButton());
    }

    /**
     * Returns whether user confirmed aborting the configuration.
     *
     * @return boolean result
     */
    define boolean AbortDialog () {
	if (SuSEFirewall::GetModified()) {
	    return Popup::YesNoHeadline(
		// TRANSLATORS: popup headline
		_("Aborting Firewall Configuration"),
		// TRANSLATORS: popup message
		_("All changes would be lost.
Really abort configuration?
")
	    );
	} else {
	    return true;
	}
    }

/* EOF */
}

ACC SHELL 2018