Author: benjimanw
Date: Tue Mar 18 18:14:43 2008
New Revision: 45562
URL: http://svn.opensuse.org/viewcvs/yast?rev=45562&view=rev
Log:
Misc features. See .changes.
Added:
trunk/metapackage/src/OneClickInstallCLI (with props)
trunk/metapackage/src/OneClickInstallCLI.ycp
trunk/metapackage/src/OneClickInstallWidgets.ycp
trunk/metapackage/src/OneClickInstallWorkerFunctions.ycp
trunk/metapackage/src/UserSettings.ycp
Modified:
trunk/metapackage/package/yast2-metapackage-handler.changes
trunk/metapackage/src/Makefile.am
trunk/metapackage/src/OneClickInstallUI.ycp
trunk/metapackage/src/OneClickInstallWorker.ycp
trunk/metapackage/yast2-metapackage-handler.spec.in
Modified: trunk/metapackage/package/yast2-metapackage-handler.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/package/yast2-metapackage-handler.changes?rev=45562&r1=45561&r2=45562&view=diff
==============================================================================
--- trunk/metapackage/package/yast2-metapackage-handler.changes (original)
+++ trunk/metapackage/package/yast2-metapackage-handler.changes Tue Mar 18 18:14:43 2008
@@ -1,4 +1,15 @@
-------------------------------------------------------------------
+Tue Mar 18 17:00:00 GMT 2008 - benji@opensuse.org
+
+- Command line Support.
+- Move dialogues out of main file to reduce size.
+- Refactor workflow so both UI and CLI can use it.
+- UI tweaks, including:
+- Don't show this again support for nag warning.
+- Removed "advanced mode" tickbox in favour of an editable proposal.
+- YMP description visible in detailed mode too.
+
+-------------------------------------------------------------------
Tue Nov 27 13:00:00 GMT 2007 - benji.weber@gmail.com
- Catch errors caused by invalid XML. (341840)
Modified: trunk/metapackage/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/Makefile.am?rev=45562&r1=45561&r2=45562&view=diff
==============================================================================
--- trunk/metapackage/src/Makefile.am (original)
+++ trunk/metapackage/src/Makefile.am Tue Mar 18 18:14:43 2008
@@ -2,16 +2,24 @@
client_DATA = \
OneClickInstallUI.ycp \
OneClickInstallWorker.ycp \
- OneClickInstallUrlHandler.ycp
+ OneClickInstallUrlHandler.ycp \
+ OneClickInstallCLI.ycp
module_DATA = \
OneClickInstall.ycp \
OneClickInstallWorkerResponse.ycp \
+ OneClickInstallWorkerFunctions.ycp \
+ OneClickInstallWidgets.ycp \
+ UserSettings.ycp \
YPX.pm
-dist_sbin_SCRIPTS = OneClickInstallUrlHandler
+dist_sbin_SCRIPTS = \
+ OneClickInstallUrlHandler \
+ OneClickInstallCLI
+
install-exec-hook:
- $(LN_S) OneClickInstallUrlHandler $(DESTDIR)$(sbindir)/OneClickInstallUI
+ $(LN_S) OneClickInstallUrlHandler $(DESTDIR)$(sbindir)/OneClickInstallUI
+ $(LN_S) OneClickInstallCLI $(DESTDIR)$(sbindir)/OCICLI
old_distro_Data = kdeymp.desktop x-suse-ymp.desktop
Added: trunk/metapackage/src/OneClickInstallCLI
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallCLI?rev=45562&view=auto
==============================================================================
--- trunk/metapackage/src/OneClickInstallCLI (added)
+++ trunk/metapackage/src/OneClickInstallCLI Tue Mar 18 18:14:43 2008
@@ -0,0 +1,22 @@
+#!/bin/sh
+if [ $# -ne 1 ]
+then
+ echo "Usage: <YMP URL>"
+ exit 1
+fi
+TEMPFILE=$(mktemp)
+/sbin/YaST OneClickInstallCLI prepareinstall url=$1 targetfile=$TEMPFILE
+if [ $? -ne 0 ]
+then
+ exit $?
+fi
+
+echo "Continue? y/N"
+read continue
+continue=${continue:="N"}
+if [ $continue == "Y" ] || [ $continue == "y" ]
+then
+ su -c "/sbin/YaST OneClickInstallCLI doinstall instructionsfile=$TEMPFILE"
+else
+ exit 2
+fi
Added: trunk/metapackage/src/OneClickInstallCLI.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallCLI.ycp?rev=45562&view=auto
==============================================================================
--- trunk/metapackage/src/OneClickInstallCLI.ycp (added)
+++ trunk/metapackage/src/OneClickInstallCLI.ycp Tue Mar 18 18:14:43 2008
@@ -0,0 +1,201 @@
+/*
+ * Command line interface for One Click Install
+ */
+{
+ textdomain "OneClickInstall";
+
+ import "OneClickInstall";
+ import "OneClickInstallWorkerFunctions";
+ import "CommandLine";
+ import "HTTP";
+ import "FTP";
+
+
+
+
+ boolean PrepareInstall(string ympFile, string tempFile)
+ {
+ OneClickInstall::Load(ympFile);
+
+ if (!OneClickInstall::HaveAnythingToDo())
+ {
+ y2error("Nothing to do specified in the YMP file");
+ CommandLine::Print(_("Error: Nothing to do specified in the YMP file"));
+ return false;
+ }
+
+ if (OneClickInstall::HaveRepositories())
+ {
+ CommandLine::Print(_("If you choose to continue, the following repositories will be subscribed to:"));
+ foreach (string repository, OneClickInstall::GetRequiredRepositories(),
+ {
+ CommandLine::Print("\t* " + repository);
+ });
+ }
+
+
+ if (OneClickInstall::HaveSoftware())
+ {
+ CommandLine::Print(_("If you choose to continue, the following software packages will be installed:"));
+ foreach (string software, OneClickInstall::GetRequiredSoftware(),
+ {
+ CommandLine::Print("\t* " + software);
+ });
+ }
+
+ OneClickInstall::ToXML(tempFile);
+ return true;
+ }
+
+ boolean PrepareInstallHandler(map options)
+ {
+ //trick ncurses
+ string url = options["url"]:"";
+ string tempFile = options["targetfile"]:"";
+ if (substring(url,0,1) != "/")
+ url = OneClickInstallWorkerFunctions::GrabFile(url);
+
+ if (url == nil)
+ {
+ y2error ("Unable to retrieve YMP at %1",options["url"]:"");
+ CommandLine::Print(sformat(_("Unable to retrieve YMP at %1"),options["url"]:""));
+ return false;
+ }
+
+ return PrepareInstall(url,tempFile);
+ }
+
+ boolean DoInstall(string xmlfile)
+ {
+ OneClickInstall::FromXML(xmlfile);
+
+ if (OneClickInstall::HaveRepositoriesToInstall())
+ CommandLine::Print(_("Adding Repositories..."));
+
+ boolean success = OneClickInstallWorkerFunctions::AddRepositories(OneClickInstall::GetRequiredRepositories());
+
+ if (!success)
+ {
+ y2error("Unable to add repositories");
+ CommandLine::Print(_("Error: Unable to add respositories"));
+ return false;
+ }
+
+ //Remove any removals
+ if (OneClickInstall::HaveRemovalsToInstall())
+ {
+ CommandLine::Print(_("Removing Packages..."));
+ success = OneClickInstallWorkerFunctions::RemovePackages(OneClickInstall::GetRequiredRemoveSoftware());
+ }
+ if (!success)
+ {
+ y2error("Unable to remove packages");
+ CommandLine::Print(_("Error: Unable to remove packages"));
+ return false;
+ }
+
+ //if that was successful now try and install the patterns
+ if (OneClickInstall::HavePatternsToInstall())
+ {
+ CommandLine::Print(_("Installing Patterns..."));
+ success = OneClickInstallWorkerFunctions::InstallPatterns(OneClickInstall::GetRequiredPatterns());
+ }
+ if (!success)
+ {
+ y2error("Unable to install patterns");
+ CommandLine::Print(_("Error: Unable to install patterns"));
+ return false;
+ }
+
+ //if that was successful now try and install the packages
+ if (OneClickInstall::HavePackagesToInstall())
+ {
+ CommandLine::Print(_("Installing Packages..."));
+ success = OneClickInstallWorkerFunctions::InstallPackages(OneClickInstall::GetRequiredPackages());
+ }
+ if (!success)
+ {
+ y2error("Unable to install packages");
+ CommandLine::Print(_("Error: Unable to install packages"));
+ return false;
+ }
+
+ //If we don't want to remain subscribed, remove the repositories that were added for installation.
+ if (OneClickInstall::HaveRepositoriesToInstall() && !OneClickInstall::GetRemainSubscribed())
+ {
+ success = OneClickInstallWorkerFunctions::RemoveAddedRepositories();
+ }
+ if (!success)
+ {
+ y2error("Unable to remove temporarily added repositories");
+ CommandLine::Print(_("Warning: Unable to remove temporarily added repositories."));
+ return false;
+ }
+ CommandLine::Print(_("Finished"));
+ return true;
+ }
+
+ boolean AmRoot()
+ {
+ map out = (map) SCR::Execute (.target.bash_output, "/usr/bin/id --user");
+ return out["stdout"]:"" == "0\n";
+ }
+
+ boolean DoInstallHandler(map options)
+ {
+
+ if ( AmRoot() )
+ return DoInstall(options["instructionsfile"]:"");
+ else
+ {
+ y2error("Cannot install software as limited user");
+ CommandLine::Print(_("Error: Must be root"));
+ return false;
+ }
+ }
+
+ map cmdline =
+ $[
+ "help" : _("One Click Install Command Line Installer"),
+ "id" : "OneClickInstall",
+ "actions" :
+ $[
+ "prepareinstall" :
+ $[
+ "help" : _("Processes a YMP file, ready for installation"),
+ "handler" : PrepareInstallHandler
+ ],
+ "doinstall" :
+ $[
+ "help" : _("Processes a YMP file, ready for installation"),
+ "handler" : DoInstallHandler
+ ]
+ ],
+ "options" :
+ $[
+ "url" :
+ $[
+ "help" : _("URL of .ymp file"),
+ "type" : "string"
+ ],
+ "targetfile" :
+ $[
+ "help" : _("File to put internal representation of YMP into"),
+ "type" : "string"
+ ],
+ "instructionsfile" :
+ $[
+ "help" : _("File containing internal representation of One Click Install instructions"),
+ "type" : "string"
+ ]
+ ],
+ "mappings" :
+ $[
+ "prepareinstall" : [ "url" , "targetfile" ],
+ "doinstall" : [ "instructionsfile" ]
+ ]
+ ];
+
+ any ret = CommandLine::Run(cmdline);
+ return ret;
+}
\ No newline at end of file
Modified: trunk/metapackage/src/OneClickInstallUI.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallUI.ycp?rev=45562&r1=45561&r2=45562&view=diff
==============================================================================
--- trunk/metapackage/src/OneClickInstallUI.ycp (original)
+++ trunk/metapackage/src/OneClickInstallUI.ycp Tue Mar 18 18:14:43 2008
@@ -5,12 +5,16 @@
textdomain "OneClickInstall";
import "OneClickInstall";
+ import "OneClickInstallWidgets";
import "OneClickInstallWorkerResponse";
+ import "OneClickInstallWorkerFunctions";
import "Wizard";
import "Popup";
import "Label";
import "HTTP";
import "FTP";
+ import "UserSettings";
+
list args = WFM::Args();
string SU_CMD = "xdg-su -c";
@@ -20,170 +24,42 @@
string metaPackageUrl = "http://opensuse.org/repos.ymp";
-
-
if (size(args) > 0)
metaPackageUrl = args[0]:metaPackageUrl;
+
if (substring(metaPackageUrl,0,1) != "/")
{
- string newUrl = (string)SCR::Read (.target.tmpdir) + SEPARATOR + "metapackage.xml";
- if (substring(metaPackageUrl,0,4) == "http" || substring(metaPackageUrl,0,4) == "file")
- {
- map response = HTTP::Get(metaPackageUrl,newUrl);
- if (response["code"]:400 >= 400)
- return;
- metaPackageUrl = newUrl;
- } else if (substring(metaPackageUrl,0,3) == "ftp")
- {
- FTP::Get(metaPackageUrl,newUrl);
- metaPackageUrl = newUrl;
- } else
- {
- y2error ("Argument is neither local absolute path nor an HTTP or FTP URL. Bye.");
- return false;
- }
+ metaPackageUrl = OneClickInstallWorkerFunctions::GrabFile(metaPackageUrl);
+ if (metaPackageUrl == nil)
+ return false;
}
OneClickInstall::Load(metaPackageUrl);
/** <region name="String constants"> **/
- string SOFTWARE_DESCRIPTION = _("Select the software components you wish to install:");
- string REMOVE_DESCRIPTION = _("Select the software components you wish to remove:");
- string REPOSITORIES_DESCRIPTION = _("Select the software repositories you wish to subscribe to:");
- string REPOSITORY_DESCRIPTION_HEADING = _("Repository Description:");
- string SOFTWARE_DESCRIPTION_HEADING = _("Package Description:");
- string REPOSITORY_HEADING = _("Additional Software Repositories");
- string SOFTWARE_HEADING = _("Software to be Installed");
- string REMOVE_HEADING = _("Software to be Removed");
- string PLEASE_WAIT = _("Please wait while this software is being installed.");
- string INSTALLATION_HEADING = _("Software installation");
string HELP1 = _("This wizard will install software onto your computer.");
string HELP2 = _("See http://en.opensuse.org/MetaPackages for more information.");
- string WARNING = _("Warning:");
- string WARNING1 = _("If you choose to continue, the following changes will be made to your system");
- string REPOSITORY_SUMMARY = _("The following repositories will be subscribed to:");
- string SOFTWARE_SUMMARY = _("The following software items will be installed:");
- string REMOVE_SUMMARY = _("The following software items will be REMOVED:");
- string FAILED = _("Unfortunately the installation has failed, see the log file at /var/log/YaST2/y2log for more information. Failure stage was: ");
- string ERROR_MESSAGE = _("Error Message");
- string SUCCESSFUL = _("Installation was successful");
- string ONLY_PARTIALLY_SUCCESSFUL = _("Installation was only partially successful.");
- string STATUS = _("Installation status:");
- string REMAIN_SUBSCRIBED = _("Remain subscribed to these repositories after installation");
- string WILL_REMAIN_SUBSCRIBED = _("You will remain subscribed to these repositories after installation.");
- string WILL_NOT_REMAIN_SUBSCRIBED = _("These repositories will only be added during installation, you will not remain subscribed.");
- string NB = _("Note:");
- string NOTHING = _("There is nothing to do.");
- string NOTHING_EXPLANATION = _("The 'one click install' link you used was probably malformed, please report this to the author.") ;
- string REQUIRE_ADVANCED = _("Advanced mode with ability to change settings.");
- string SPLASH_HEADING = _("Welcome");
- // %1: software package
- string WIZARD_DESCRIPTION = _("This wizard will install <b>%1</b> onto your computer.");
- string SUMMARY_HEADING = _("Summary");
- string DESCRIPTION_HEADING = _("Description");
- string REPOSITORIES_FAILED = _("The following repositories could not be added");
- string PATTERNS_FAILED = _("The following patterns could not be installed");
- string PACKAGES_FAILED = _("The following packages could not be installed");
- /** </region> **/
/** <region name="Define the UI components"> **/
string HELP_TEXT =
- "<h3>" + SOFTWARE_DESCRIPTION + "</h3>"
+ "<h3>" + _("Select the software components you wish to install:") + "</h3>"
+ "<p>" + HELP1 + "</p>"
+ "<p>" + HELP2 + "</p>";
-
//xxx without this the width of the items in the multi-selection-box seems to be broken.
string SPACER = " ";
- term repositoriesUI = `VBox
- (
- `VWeight(2,
- `Heading(REPOSITORY_HEADING)
- ),
- `VWeight(10,
- `MultiSelectionBox(`id(`repositoriesCheckList),`opt(`notify), REPOSITORIES_DESCRIPTION, [SPACER])
- ),
- `VWeight(1,
- `CheckBox(`id(`remain),REMAIN_SUBSCRIBED,true)
- ),
- `VWeight(5,
- `RichText(`id(`descrLabel),"")
- )
- );
-
- term softwareUI = `VBox
- (
- `VWeight(2,
- `Heading(SOFTWARE_HEADING)
- ),
- `VWeight(10,
- `MultiSelectionBox(`id(`softwareCheckList),`opt(`notify), SOFTWARE_DESCRIPTION, [SPACER])
- ),
- `VWeight(5,
- `RichText(`id(`packageDescrLabel),"")
- )
-
- );
-
- term removeUI = `VBox
- (
- `VWeight(2,
- `Heading(REMOVE_HEADING)
- ),
- `VWeight(10,
- `MultiSelectionBox(`id(`removeCheckList),`opt(`notify), REMOVE_DESCRIPTION, [SPACER])
- ),
- `VWeight(5,
- `RichText(`id(`removeDescrLabel),"")
- )
- );
- term nothing = `VBox
- (
- `Heading(NOTHING),
- `RichText(NOTHING_EXPLANATION)
- );
-
- term confirm = `HBox(
- `VBox(
-
- `VWeight(5,
- `RichText(`id(`summary),""))
- )
- );
-
- term splash = `HBox(
- `VBox(
-
- `VWeight(5,
- `RichText(`id(`splashMessage),"")),
- `VWeight(1,
- `CheckBox(`id(`advanced),REQUIRE_ADVANCED,false)
- )
- )
- );
- term perform = `HBox(
- `HSpacing(1),
- `VBox(
- `VSpacing(0.2),
- `Heading(PLEASE_WAIT),
- `VSpacing(0.2)
- ),
- `HSpacing(1)
- );
-
- term result = `HBox(
- `HSpacing(1),
- `VBox(
- `VSpacing(0.1),
- `RichText(`id(`resultLabel),""),
- `VSpacing(0.2)
- ),
- `HSpacing(1)
- );
+ boolean confirmCommit()
+ {
+ if (UserSettings::GetBooleanValue("OneClickInstallUI","CanRead"))
+ return true;
+ boolean confirmed = OneClickInstallWidgets::ConfirmUI();
+ UserSettings::SetValue("OneClickInstallUI","CanRead",OneClickInstallWidgets::GetCanRead());
+ return confirmed;
+ }
/** </region> **/
/** <region name="Setup the Wizard Steps"> **/
@@ -200,10 +76,10 @@
installation_widgets_simple =
[
- $["id": "splash", "widget":splash],
- $["id": "confirm", "widget":confirm],
- $["id": "perform", "widget":perform],
- $["id": "result", "widget":result]
+ $["id": "splash", "widget":OneClickInstallWidgets::GetDescriptionUI()],
+ $["id": "confirm", "widget":OneClickInstallWidgets::GetProposalUI()],
+ $["id": "perform", "widget":OneClickInstallWidgets::GetPerformingUI()],
+ $["id": "result", "widget":OneClickInstallWidgets::GetResultUI()]
];
list<map> installation_steps = installation_steps_simple;
@@ -225,11 +101,11 @@
installation_widgets_advanced =
[
- $["id": "repositoriesUI", "widget":repositoriesUI],
- $["id": "softwareUI", "widget":softwareUI],
- $["id": "confirm", "widget":confirm],
- $["id": "perform", "widget":perform],
- $["id": "result", "widget":result]
+ $["id": "repositoriesUI", "widget":OneClickInstallWidgets::GetRepositorySelectionUI()],
+ $["id": "softwareUI", "widget":OneClickInstallWidgets::GetSoftwareSelectionUI()],
+ $["id": "confirm", "widget":OneClickInstallWidgets::GetProposalUI()],
+ $["id": "perform", "widget":OneClickInstallWidgets::GetPerformingUI()],
+ $["id": "result", "widget":OneClickInstallWidgets::GetResultUI()]
];
} else if (OneClickInstall::HaveRepositories() && OneClickInstall::HaveSoftware() && OneClickInstall::HaveRemovals())
{
@@ -244,12 +120,12 @@
];
installation_widgets_advanced =
[
- $["id": "repositoriesUI", "widget":repositoriesUI],
- $["id": "softwareUI", "widget":softwareUI],
- $["id": "removeUI", "widget":removeUI],
- $["id": "confirm", "widget":confirm],
- $["id": "perform", "widget":perform],
- $["id": "result", "widget":result]
+ $["id": "repositoriesUI", "widget":OneClickInstallWidgets::GetRepositorySelectionUI()],
+ $["id": "softwareUI", "widget":OneClickInstallWidgets::GetSoftwareSelectionUI()],
+ $["id": "removeUI", "widget":OneClickInstallWidgets::GetSoftwareRemovalSelectionUI()],
+ $["id": "confirm", "widget":OneClickInstallWidgets::GetProposalUI()],
+ $["id": "perform", "widget":OneClickInstallWidgets::GetPerformingUI()],
+ $["id": "result", "widget":OneClickInstallWidgets::GetResultUI()]
];
} else if (OneClickInstall::HaveRepositories() && !OneClickInstall::HaveSoftware())
{
@@ -262,10 +138,10 @@
];
installation_widgets_advanced =
[
- $["id": "repositoriesUI", "widget":repositoriesUI],
- $["id": "confirm", "widget":confirm],
- $["id": "perform", "widget":perform],
- $["id": "result", "widget":result]
+ $["id": "repositoriesUI", "widget":OneClickInstallWidgets::GetRepositorySelectionUI()],
+ $["id": "confirm", "widget":OneClickInstallWidgets::GetProposalUI()],
+ $["id": "perform", "widget":OneClickInstallWidgets::GetPerformingUI()],
+ $["id": "result", "widget":OneClickInstallWidgets::GetResultUI()]
];
} else if (!OneClickInstall::HaveRepositories() && OneClickInstall::HaveSoftware() && !OneClickInstall::HaveRemovals())
{
@@ -278,10 +154,10 @@
];
installation_widgets_advanced =
[
- $["id": "softwareUI", "widget":softwareUI],
- $["id": "confirm", "widget":confirm],
- $["id": "perform", "widget":perform],
- $["id": "result", "widget":result]
+ $["id": "softwareUI", "widget":OneClickInstallWidgets::GetSoftwareSelectionUI()],
+ $["id": "confirm", "widget":OneClickInstallWidgets::GetProposalUI()],
+ $["id": "perform", "widget":OneClickInstallWidgets::GetPerformingUI()],
+ $["id": "result", "widget":OneClickInstallWidgets::GetResultUI()]
];
} else if (!OneClickInstall::HaveRepositories() && OneClickInstall::HaveSoftware() && OneClickInstall::HaveRemovals())
{
@@ -295,11 +171,11 @@
];
installation_widgets_advanced =
[
- $["id": "softwareUI", "widget":softwareUI],
- $["id": "removeUI", "widget":removeUI],
- $["id": "confirm", "widget":confirm],
- $["id": "perform", "widget":perform],
- $["id": "result", "widget":result]
+ $["id": "softwareUI", "widget":OneClickInstallWidgets::GetSoftwareSelectionUI()],
+ $["id": "removeUI", "widget":OneClickInstallWidgets::GetSoftwareRemovalSelectionUI()],
+ $["id": "confirm", "widget":OneClickInstallWidgets::GetProposalUI()],
+ $["id": "perform", "widget":OneClickInstallWidgets::GetPerformingUI()],
+ $["id": "result", "widget":OneClickInstallWidgets::GetResultUI()]
];
} else
{
@@ -309,7 +185,7 @@
];
installation_widgets_advanced =
[
- $["id": "nothing", "widget":nothing]
+ $["id": "nothing", "widget":OneClickInstallWidgets::GetIncompatibleYMPUI()]
];
}
@@ -318,6 +194,11 @@
{
installation_steps = installation_steps_advanced;
installation_widgets = installation_widgets_advanced;
+ } else if (OneClickInstall::HaveBundleDescription())
+ {
+ //Add the splash to the advanced steps too. Requested.
+ installation_steps_advanced = prepend(installation_steps_advanced,$[ "id": "splash", "label": _("Software Description") ]);
+ installation_widgets_advanced = prepend(installation_widgets_advanced,$["id": "splash", "widget":OneClickInstallWidgets::GetDescriptionUI()]);
}
@@ -325,17 +206,6 @@
/** <region name="wizardy bits"> **/
- define list<term> StringListToTermList(list<string> strList,boolean checked)
- {
- list<term> items = [];
- foreach(string str, strList,
- {
- items = add(items,`item(`id(str),str,checked));
- });
- return items;
- }
-
-
define boolean is_performing(integer no)
{
@@ -383,7 +253,7 @@
{
Wizard::OpenNextBackStepsDialog();
Wizard::SetDesktopIcon("sw_single"); // #329644
- Wizard::SetContents (INSTALLATION_HEADING, `Empty(), HELP_TEXT, true, true);
+ Wizard::SetContents (sformat(_("%1 Installation"),OneClickInstall::GetName()), `Empty(), HELP_TEXT, true, true);
UI::WizardCommand(`AddStepHeading( _("Installation Steps") ) );
@@ -392,7 +262,8 @@
});
}
SetupWizard();
-
+
+
integer current_step = 0;
boolean done = false;
@@ -400,20 +271,16 @@
/** </region> **/
/** <region name="wire up the wizard UI to the OCI module">**/
-
- //This wouldn't be necessary if regexpsub wasn't so retarded.
- define string NewLinesToRichText(string original)
+ define list<term> StringListToTermList(list<string> strList,boolean checked)
{
- string result = "";
- list<string> lines = splitstring(original,"\n");
- foreach(string line, lines,
+ list<term> items = [];
+ foreach(string str, strList,
{
- result = result + line + "<br/>";
+ items = add(items,`item(`id(str),str,checked));
});
- return result;
+ return items;
}
-
define void show_step(integer no)
{
string current_id = (installation_steps[ no ]:nil)["id"]:"";
@@ -422,91 +289,65 @@
Wizard::SetNextButton (`finish, Label::FinishButton());
}
- UI::ReplaceWidget(`id(`contents),(installation_widgets[ no ]:$[])["widget"]:nothing);
+ UI::ReplaceWidget(`id(`contents),(installation_widgets[ no ]:$[])["widget"]:OneClickInstallWidgets::GetIncompatibleYMPUI());
Wizard::SetTitleIcon ("yast-software");
UI::WizardCommand(`SetCurrentStep( current_id ) );
if (is_viewing_splash(no))
{
- string splashStr = "<h2>" + SPLASH_HEADING + "</h2>" ;
- splashStr = splashStr + sformat (WIZARD_DESCRIPTION, OneClickInstall::GetName());
- splashStr = splashStr + "<h3>" + SUMMARY_HEADING + "</h3>" + NewLinesToRichText(OneClickInstall::GetSummary()) + "</p>";
- splashStr = splashStr + "<h3>" + DESCRIPTION_HEADING + "</h3><p>" + NewLinesToRichText(OneClickInstall::GetDescription()) + "</p></body>";
- UI::ChangeWidget(`id(`splashMessage),`Value,splashStr);
+ OneClickInstallWidgets::PopulateDescriptionUI(OneClickInstall::GetName(),OneClickInstall::GetSummary(),OneClickInstall::GetDescription());
}
if (is_selecting_repositories(no))
{
- UI::ChangeWidget(`id(`remain),`Value,OneClickInstall::GetRemainSubscribed());
- list<term> newRepositoryNames = (list<term>) merge
- (
- StringListToTermList(OneClickInstall::GetRequiredRepositories(),true),
- StringListToTermList(OneClickInstall::GetNonRequiredRepositories(),false)
- );
- UI::ChangeWidget(`id(`repositoriesCheckList),`Items,
- newRepositoryNames
+ string firstUrl = OneClickInstall::GetRequiredRepositories()[0]:"";
+ OneClickInstallWidgets::PopulateRepositorySelectionUI(
+ OneClickInstall::GetRepositoryDescription(firstUrl),
+ OneClickInstall::GetRequiredRepositories(),
+ OneClickInstall::GetNonRequiredRepositories(),
+ OneClickInstall::GetRemainSubscribed()
);
- term first = newRepositoryNames[0]:nil;
- string firstUrl = "";
- if (first != nil)
- firstUrl = first[1]:"";
- UI::ChangeWidget(`descrLabel, `Value,"
<h3>" + REPOSITORY_DESCRIPTION_HEADING + "</h3>" + NewLinesToRichText(OneClickInstall::GetRepositoryDescription(firstUrl)) + "</body>");
}
if (is_selecting_software(no))
{
- list<term> newSoftwareNames = (list<term>) merge
- (
- StringListToTermList(OneClickInstall::GetRequiredSoftware(),true),
- StringListToTermList(OneClickInstall::GetNonRequiredSoftware(),false)
- );
- UI::ChangeWidget(`id(`softwareCheckList),`Items,
- newSoftwareNames
+ string firstname = OneClickInstall::GetRequiredSoftware()[0]:"";
+ OneClickInstallWidgets::PopulateSoftwareSelectionUI(
+ OneClickInstall::GetSoftwareDescription(firstname),
+ OneClickInstall::GetRequiredSoftware(),
+ OneClickInstall::GetNonRequiredSoftware()
);
- term first = newSoftwareNames[0]:nil;
- string firstname = "";
- if (first != nil)
- firstname = first[1]:"";
- UI::ChangeWidget(`packageDescrLabel, `Value,"<h3>" + SOFTWARE_DESCRIPTION_HEADING + "</h3>" + NewLinesToRichText(OneClickInstall::GetSoftwareDescription(firstname)) + "</body>");
}
if (is_selecting_removals(no))
{
- list<term> newSoftwareNames = (list<term>) merge
- (
- StringListToTermList(OneClickInstall::GetRequiredRemoveSoftware(),true),
- StringListToTermList(OneClickInstall::GetNonRequiredRemoveSoftware(),false)
- );
- UI::ChangeWidget(`id(`removeCheckList),`Items,
- newSoftwareNames
+ string firstname = OneClickInstall::GetRequiredRemoveSoftware()[0]:"";
+ OneClickInstallWidgets::PopulateSoftwareRemovalSelectionUI(
+ OneClickInstall::GetSoftwareDescription(firstname),
+ OneClickInstall::GetRequiredRemoveSoftware(),
+ OneClickInstall::GetNonRequiredRemoveSoftware()
);
- term first = newSoftwareNames[0]:nil;
- string firstname = "";
- if (first != nil)
- firstname = first[1]:"";
- UI::ChangeWidget(`removeDescrLabel, `Value,"<h3>" + SOFTWARE_DESCRIPTION_HEADING + "</h3>" + NewLinesToRichText(OneClickInstall::GetSoftwareDescription(firstname)) + "</body>");
}
};
+
+ void SwitchToAdvancedMode()
+ {
+ installation_steps = installation_steps_advanced;
+ installation_widgets = installation_widgets_advanced;
+ SetupWizard();
+ current_step = size(installation_steps_advanced) - 5;
+ show_step(current_step);
+ }
+
define boolean events_before_stage_change(integer step, symbol button)
{
if (is_selecting_repositories(step))
{
- OneClickInstall::SetRemainSubscribed((boolean)UI::QueryWidget(`id(`remain), `Value));
- }
- if (is_viewing_splash(step))
- {
- if((boolean)UI::QueryWidget(`id(`advanced), `Value))
- {
- installation_steps = installation_steps_advanced;
- installation_widgets = installation_widgets_advanced;
- SetupWizard();
- show_step(0);
- return false;
- }
+ OneClickInstall::SetRemainSubscribed(OneClickInstallWidgets::GetRepositoryRemainSubscribed());
}
if (is_confirming(step) && (button == `next) )
{
- return Popup::AnyQuestion (Label::WarningMsg(), _("Have you reviewed the changes that will be made to your system?\n\nMalicious packages could damage your system."), Label::YesButton(), Label::NoButton(),`focus_no);
+ return confirmCommit();
}
return true;
}
@@ -514,66 +355,16 @@
define void events_after_stage_change(integer step, symbol button)
{
+
if (is_confirming(step))
{
- string repoStr = "";
- string packageStr = "";
- string removeStr = "";
- foreach (string repo, OneClickInstall::GetRequiredRepositories(),
- {
- repoStr = repoStr + "<li>" + repo + " (" + OneClickInstall::GetRepositoryName(repo) + ")</li>";
- }
- );
-
- foreach (string package, OneClickInstall::GetRequiredSoftware(),
- {
- packageStr = packageStr + "<li>" + package + "</li>";
- }
- );
-
- foreach (string package, OneClickInstall::GetRequiredRemoveSoftware(),
- {
- removeStr = removeStr + "<li>" + package + "</li>";
- }
+ OneClickInstallWidgets::PopulateProposalUI(
+ maplist(string s,OneClickInstall::GetRequiredRepositories(),
+ {return s + " (" + OneClickInstall::GetRepositoryName(s) + ")";}),
+ OneClickInstall::GetRequiredSoftware(),
+ OneClickInstall::GetRequiredRemoveSoftware(),
+ OneClickInstall::GetRemainSubscribed()
);
-
- string tempOrPerm = WILL_REMAIN_SUBSCRIBED;
- if ( !OneClickInstall::GetRemainSubscribed())
- {
- tempOrPerm = WILL_NOT_REMAIN_SUBSCRIBED;
- } else
- {
- tempOrPerm = WILL_REMAIN_SUBSCRIBED;
- }
-
- string summaryStr = "<h1>" + WARNING + "</h1>" +
- "<font color='red'>" + WARNING1 + "</font>";
-
- //Put remove message at top, incase people try to push it off the bottom of the warning by adding lots of packages.
- if (removeStr != "")
- {
- summaryStr = summaryStr +"<h2><font color='red'>" + REMOVE_SUMMARY + "</font></h2>" +
- removeStr;
- }
-
- if (repoStr != "")
- {
- summaryStr = summaryStr + "<h2>" + REPOSITORY_SUMMARY +"</h2>" +
- repoStr + "<h3>" + NB + "</h3>" +
- "<li>" + tempOrPerm + "</li>";
- }
-
- if (packageStr != "")
- {
- summaryStr = summaryStr + "<h2>" + SOFTWARE_SUMMARY + "</h2>" +
- packageStr;
- }
-
-
- summaryStr = summaryStr + "</body>";
- UI::ChangeWidget(`summary, `Value,
- summaryStr
- );
}
if (is_performing(step))
{
@@ -600,69 +391,22 @@
//Load the response.
OneClickInstallWorkerResponse::FromXML(communication_file);
- string statusStr = "<h1>" + INSTALLATION_HEADING + "</h1>";
-
- if (OneClickInstallWorkerResponse::GetSuccess())
- {
- if (
- (size(OneClickInstallWorkerResponse::GetFailedRepositories()) == 0) &&
- (size(OneClickInstallWorkerResponse::GetFailedPatterns()) == 0 ) &&
- (size(OneClickInstallWorkerResponse::GetFailedPackages()) == 0 )
- )
- {
- statusStr = statusStr + "<p>" + SUCCESSFUL + "</p>";
- }
- else
- {
- statusStr = statusStr + "<p>" + ONLY_PARTIALLY_SUCCESSFUL + "</p>";
- }
- } else
- {
- statusStr = statusStr + "<p>" + FAILED + " " + OneClickInstallWorkerResponse::GetFailureStage() + "<p>";
- statusStr = statusStr + "<h2>"+ ERROR_MESSAGE + "</h2><p>" + OneClickInstallWorkerResponse::GetErrorMessage() + "</p>";
- }
-
- if (size(OneClickInstallWorkerResponse::GetFailedRepositories()) > 0 )
- {
- statusStr = statusStr + "<h3>" + REPOSITORIES_FAILED + "</h3><p>";
- foreach (string failed, OneClickInstallWorkerResponse::GetFailedRepositories(),
- {
- statusStr = statusStr + "<li>" + failed + "</li>";
- });
- statusStr = statusStr + "</p>";
- }
-
- if (size(OneClickInstallWorkerResponse::GetFailedPatterns()) > 0 )
- {
- statusStr = statusStr + "<h3>" + PATTERNS_FAILED + "</h3><p>";
- foreach (string failed, OneClickInstallWorkerResponse::GetFailedPatterns(),
- {
- statusStr = statusStr + "<li>" + failed + "</li>";
- });
- statusStr = statusStr + "</p>";
- }
-
- if (size(OneClickInstallWorkerResponse::GetFailedPackages()) > 0 )
- {
- statusStr = statusStr + "<h3>" + PACKAGES_FAILED + "</h3><p>";
- foreach (string failed, OneClickInstallWorkerResponse::GetFailedPackages(),
- {
- statusStr = statusStr + "<li>" + failed + "</li>";
- });
- statusStr = statusStr + "</p>";
- }
-
- statusStr = statusStr + "<p>" + OneClickInstallWorkerResponse::GetNote() + "</p>";
-
- statusStr = statusStr + "</body>";
+
current_step = current_step + 1;
Wizard::EnableNextButton();
show_step( current_step );
- UI::ChangeWidget(`resultLabel, `Value,
- statusStr);
+ OneClickInstallWidgets::PopulateResultUI(
+ OneClickInstallWorkerResponse::GetSuccess(),
+ OneClickInstallWorkerResponse::GetFailedRepositories(),
+ OneClickInstallWorkerResponse::GetFailedPatterns(),
+ OneClickInstallWorkerResponse::GetFailedPackages(),
+ OneClickInstallWorkerResponse::GetFailureStage(),
+ OneClickInstallWorkerResponse::GetErrorMessage(),
+ OneClickInstallWorkerResponse::GetNote()
+ );
}
}
define void handle_input(symbol button)
@@ -671,28 +415,36 @@
if (button == `repositoriesCheckList)
{
//Get the description of this one.
- string selected = (string) UI::QueryWidget( `id(button), `CurrentItem );
- UI::ChangeWidget(`descrLabel, `Value,"<h3>" + REPOSITORY_DESCRIPTION_HEADING + "</h3>" + NewLinesToRichText(OneClickInstall::GetRepositoryDescription(selected)) + "</body>");
+ OneClickInstallWidgets::PopulateRepositorySelectionUIDescription(
+ OneClickInstall::GetRepositoryDescription(
+ OneClickInstallWidgets::GetCurrentlySelectedRepository()
+ )
+ );
//Set all repositories to non-required
//Set the currently selected repositories back to subscribed.
- OneClickInstall::SetRequiredRepositories((list<string>)UI::QueryWidget(`id(button), `SelectedItems));
+ OneClickInstall::SetRequiredRepositories(OneClickInstallWidgets::GetRepositorySelectionItems());
}
if (button == `softwareCheckList)
{
- string selected = (string) UI::QueryWidget( `id(button), `CurrentItem );
- UI::ChangeWidget(`packageDescrLabel, `Value,"<h3>" + SOFTWARE_DESCRIPTION_HEADING + "</h3>" + NewLinesToRichText(OneClickInstall::GetSoftwareDescription(selected)) + "</body>");
- //Set the currently selected software back to install.
- OneClickInstall::SetRequiredSoftwares((list<string>)UI::QueryWidget(`id(button), `SelectedItems));
+ OneClickInstallWidgets::PopulateSoftwareSelectionUIDescription(
+ OneClickInstall::GetSoftwareDescription(
+ OneClickInstallWidgets::GetCurrentlySelectedSoftware()
+ )
+ );
+ OneClickInstall::SetRequiredSoftwares(OneClickInstallWidgets::GetSoftwareSelectionItems());
}
if (button == `removeCheckList)
{
- string selected = (string) UI::QueryWidget( `id(button), `CurrentItem );
- UI::ChangeWidget(`removeDescrLabel, `Value,"<h3>" + SOFTWARE_DESCRIPTION_HEADING + "</h3>" + NewLinesToRichText(OneClickInstall::GetSoftwareDescription(selected)) + "</body>" );
+ OneClickInstallWidgets::PopulateSoftwareRemovalSelectionUIDescription(
+ OneClickInstall::GetSoftwareDescription(
+ OneClickInstallWidgets::GetCurrentlySelectedRemoval()
+ )
+ );
//Set the currently selected removals back to remove.
- OneClickInstall::SetRequiredSoftwares((list<string>)UI::QueryWidget(`id(button), `SelectedItems));
+ OneClickInstall::SetRequiredSoftwares(OneClickInstallWidgets::GetSoftwareRemovalSelectionItems());
}
}
@@ -711,6 +463,12 @@
if ( button == `abort || button == `cancel)
break;
+ if (button == `alterProposal)
+ {
+ SwitchToAdvancedMode();
+ continue;
+ }
+
if ( button == `next || button == `back )
{
if (events_before_stage_change(current_step,button))
@@ -718,12 +476,12 @@
if ( button == `next && current_step+1 < size( installation_steps ) )
{
- current_step = current_step+1;
+ current_step = current_step + 1;
}
if ( button == `back && current_step > 0 )
{
- current_step = current_step -1;
+ current_step = current_step - 1;
}
show_step( current_step );
@@ -745,69 +503,3 @@
UI::CloseDialog();
/** </region> **/
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Added: trunk/metapackage/src/OneClickInstallWidgets.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallWidgets.ycp?rev=45562&view=auto
==============================================================================
--- trunk/metapackage/src/OneClickInstallWidgets.ycp (added)
+++ trunk/metapackage/src/OneClickInstallWidgets.ycp Tue Mar 18 18:14:43 2008
@@ -0,0 +1,451 @@
+{
+ /**
+ * Store the UI terms used in One Click Install client.
+ */
+ module "OneClickInstallWidgets";
+ textdomain "OneClickInstall";
+
+ import "Label";
+
+ string SPACER = " ";
+
+ term repositoriesUI = `VBox
+ (
+ `VWeight(2,
+ `Heading(_("Additional Software Repositories"))
+ ),
+ `VWeight(10,
+ `MultiSelectionBox(`id(`repositoriesCheckList),`opt(`notify), _("Select the software repositories you wish to subscribe to:"), [SPACER])
+ ),
+ `VWeight(1,
+ `CheckBox(`id(`remain),_("Remain subscribed to these repositories after installation"),true)
+ ),
+ `VWeight(5,
+ `RichText(`id(`descrLabel),"")
+ )
+ );
+
+
+ term softwareUI = `VBox
+ (
+ `VWeight(2,
+ `Heading(_("Software to be Installed"))
+ ),
+ `VWeight(10,
+ `MultiSelectionBox(`id(`softwareCheckList),`opt(`notify), _("Select the software components you wish to install:"), [SPACER])
+ ),
+ `VWeight(5,
+ `RichText(`id(`packageDescrLabel),"")
+ )
+
+ );
+
+ term removeUI = `VBox
+ (
+ `VWeight(2,
+ `Heading(_("Software to be Removed"))
+ ),
+ `VWeight(10,
+ `MultiSelectionBox(`id(`removeCheckList),`opt(`notify), _("Select the software components you wish to remove:"), [SPACER])
+ ),
+ `VWeight(5,
+ `RichText(`id(`removeDescrLabel),"")
+ )
+ );
+
+ term nothing = `VBox
+ (
+ `Heading(_("Installation not possible")),
+ `RichText(_("The install link/file you opened does not contain instructions for this version of openSUSE."))
+ );
+
+
+
+ term perform = `HBox(
+ `HSpacing(1),
+ `VBox(
+ `VSpacing(0.2),
+ `Heading( _("Please wait while this software is being installed.")),
+ `VSpacing(0.2)
+ ),
+ `HSpacing(1)
+ );
+
+ define list<term> StringListToTermList(list<string> strList,boolean checked)
+ {
+ list<term> items = [];
+ foreach(string str, strList,
+ {
+ items = add(items,`item(`id(str),str,checked));
+ });
+ return items;
+ }
+
+
+ //This wouldn't be necessary if regexpsub wasn't so retarded.
+ define string NewLinesToRichText(string original)
+ {
+ string result = "";
+ list<string> lines = splitstring(original,"\n");
+ foreach(string line, lines,
+ {
+ result = result + line + "<br/>";
+ });
+ return result;
+ }
+
+ global term GetRepositorySelectionUI()
+ {
+ return repositoriesUI;
+ }
+
+ global void PopulateRepositorySelectionUIDescription(string description)
+ {
+ UI::ChangeWidget(`descrLabel, `Value,"<h3>" + _("Repository Description:") + "</h3>" + NewLinesToRichText(description) + "</body>");
+ }
+
+ global void PopulateRepositorySelectionUI(string description,list<string> requiredRepos, list<string> nonRequiredRepos, boolean remainSubscribed)
+ {
+ UI::ChangeWidget(`id(`remain),`Value,remainSubscribed);
+ list<term> newRepositoryNames = (list<term>) merge
+ (
+ StringListToTermList(requiredRepos,true),
+ StringListToTermList(nonRequiredRepos,false)
+ );
+ UI::ChangeWidget(`id(`repositoriesCheckList),`Items,
+ newRepositoryNames
+ );
+ PopulateRepositorySelectionUIDescription(description);
+ }
+
+ global string GetCurrentlySelectedRepository()
+ {
+ return (string) UI::QueryWidget( `id(`repositoriesCheckList), `CurrentItem );
+ }
+
+ global list<string> GetRepositorySelectionItems()
+ {
+ return (list<string>)UI::QueryWidget(`id(`repositoriesCheckList), `SelectedItems);
+ }
+
+ global boolean GetRepositoryRemainSubscribed()
+ {
+ return (boolean)UI::QueryWidget(`id(`remain), `Value);
+ }
+
+ global term GetSoftwareSelectionUI()
+ {
+ return softwareUI;
+ }
+
+ global void PopulateSoftwareSelectionUIDescription(string description)
+ {
+ UI::ChangeWidget(`packageDescrLabel, `Value,"<h3>" + _("Package Description:") + "</h3>" + NewLinesToRichText(description) + "</body>");
+ }
+
+ global void PopulateSoftwareSelectionUI(string description,list<string> requiredSW, list<string> nonRequiredSW)
+ {
+ list<term> newSoftwareNames = (list<term>) merge
+ (
+ StringListToTermList(requiredSW,true),
+ StringListToTermList(nonRequiredSW,false)
+ );
+ UI::ChangeWidget(`id(`softwareCheckList),`Items,
+ newSoftwareNames
+ );
+ PopulateSoftwareSelectionUIDescription(description);
+ }
+
+ global string GetCurrentlySelectedSoftware()
+ {
+ return (string) UI::QueryWidget( `id(`softwareCheckList), `CurrentItem );
+ }
+
+ global list<string> GetSoftwareSelectionItems()
+ {
+ return (list<string>)UI::QueryWidget(`id(`softwareCheckList), `SelectedItems);
+ }
+
+ global term GetSoftwareRemovalSelectionUI()
+ {
+ return removeUI;
+ }
+
+ global void PopulateSoftwareRemovalSelectionUIDescription(string description)
+ {
+ UI::ChangeWidget(`removeDescrLabel, `Value,"<h3>" + _("Package Description:") + "</h3>" + NewLinesToRichText(description) + "</body>");
+ }
+
+ global void PopulateSoftwareRemovalSelectionUI(string description, list<string> requiredRemovals, list<string> nonRequiredRemovals)
+ {
+ list<term> newSoftwareNames = (list<term>) merge
+ (
+ StringListToTermList(requiredRemovals,true),
+ StringListToTermList(nonRequiredRemovals,false)
+ );
+ UI::ChangeWidget(`id(`removeCheckList),`Items,
+ newSoftwareNames
+ );
+
+ PopulateSoftwareRemovalSelectionUIDescription(description);
+ }
+
+ global string GetCurrentlySelectedRemoval()
+ {
+ return (string) UI::QueryWidget( `id(`removeCheckList), `CurrentItem );
+ }
+
+
+ global list<string> GetSoftwareRemovalSelectionItems()
+ {
+ return (list<string>)UI::QueryWidget(`id(`removeCheckList), `SelectedItems);
+ }
+
+ global term GetIncompatibleYMPUI()
+ {
+ return nothing;
+ }
+
+ boolean canRead = false;
+ global boolean GetCanRead()
+ {
+ return canRead;
+ }
+
+ global boolean ConfirmUI()
+ {
+ UI::OpenDialog(
+ `HBox(
+ `HSpacing(1),
+ `VBox(
+ `VSpacing(0.2),
+ `VBox(
+
+ `Left (`Heading(Label::WarningMsg())),
+ `HCenter(`Label( _("Have you reviewed the changes that will be made to your system?\n(Malicious packages could damage your system.)") )),
+ `VSpacing(0.4),
+ `Left(`CheckBox(`id(`iCanRead),`opt(`notify,`immediate),_("Don't ask me this again"))),
+ `VSpacing(0.2)
+ ),
+ `HBox(
+ `HStretch (),
+ `HWeight( 1,
+ `PushButton
+ (
+ `id(`yes),
+ `opt (`key_F10),
+ "Yes"
+ )
+ ),
+ `HSpacing(2),
+ `HWeight( 1,
+ `PushButton(
+ `id(`no),
+ `opt(`default, `key_F9),
+ "No"
+ )
+ ),
+ `HStretch ()
+ ),
+ `VSpacing(0.2)
+ ),
+ `HSpacing(1)
+ )
+ );
+ any ret = UI::UserInput();
+ while ((ret != `yes) && (ret != `no))
+ {
+ if (ret == `iCanRead)
+ {
+ UI::ChangeWidget(`no,`Enabled, !((boolean)UI::QueryWidget(`iCanRead,`Value)));
+ }
+ ret = UI::UserInput();
+ }
+ canRead = (boolean)UI::QueryWidget(`iCanRead,`Value);
+ UI::CloseDialog();
+ return ret == `yes;
+ }
+
+ string getProposalString(list<string> repositories, list<string> packages, list<string> removals, boolean remainSubscribed)
+ {
+ string repoStr = "";
+ string packageStr = "";
+ string removeStr = "";
+ foreach (string repo, repositories,
+ {
+ repoStr = repoStr + "<li>" + repo + "</li>";
+ }
+ );
+
+ foreach (string package, packages,
+ {
+ packageStr = packageStr + "<li>" + package + "</li>";
+ }
+ );
+
+ foreach (string package, removals,
+ {
+ removeStr = removeStr + "<li>" + package + "</li>";
+ }
+ );
+
+ string tempOrPerm = "";
+ if ( !remainSubscribed)
+ {
+ tempOrPerm = _("These repositories will only be added during installation, you will not remain subscribed.");
+ } else
+ {
+ tempOrPerm = _("You will remain subscribed to these repositories after installation.");
+ }
+
+ string summaryStr = "" +
+ "<font color='red'>" + _("If you choose to continue, the following changes will be made to your system") + "</font>";
+
+ //Put remove message at top, incase people try to push it off the bottom of the warning by adding lots of packages.
+ if (removeStr != "")
+ {
+ summaryStr = summaryStr +"<h2><font color='red'>" + _("Software to be REMOVED:") + "</font></h2>" +
+ removeStr;
+ }
+
+ if (repoStr != "")
+ {
+ summaryStr = summaryStr + "<h2>" + _("Repositories to be added:") +"</h2>" +
+ repoStr + "<h3>" + _("Note:") + "</h3>" +
+ "<li>" + tempOrPerm + "</li>";
+ }
+
+ if (packageStr != "")
+ {
+ summaryStr = summaryStr + "<h2>" + _("Software to be installed:") + "</h2>" +
+ packageStr;
+ }
+
+
+ summaryStr = summaryStr + "</body>";
+ return summaryStr;
+ }
+
+
+ global term GetProposalUI()
+ {
+ return `HBox(
+ `VBox(
+ `VSpacing(0.5),
+ `Left(`Heading(_("Proposal"))),
+ `VWeight(5,
+ `RichText(`id(`summary),"")
+ ),
+ `HBox(`Right(`PushButton(`id(`alterProposal),_("Customise"))))
+ )
+
+ );
+ }
+
+ global void PopulateProposalUI(list<string> repositories, list<string> packages, list<string> removals, boolean remainSubscribed)
+ {
+ string proposal = getProposalString(repositories,packages,removals,remainSubscribed);
+ UI::ChangeWidget(`id(`summary),`Value,proposal);
+ }
+
+ global term GetDescriptionUI()
+ {
+ return
+ `HBox(
+ `VBox(
+ `VSpacing(0.5),
+ `ReplacePoint(`id(`head),`Empty()),
+ `VSpacing(0.5),
+ `VWeight(5,
+ `RichText(`id(`splashMessage),"")
+ )
+ )
+ );
+ }
+
+ global void PopulateDescriptionUI(string name, string summary, string description)
+ {
+ UI::ReplaceWidget(`id(`head),`Left(`HBox(`Heading(name),`Label(summary))));
+ UI::ChangeWidget(`id(`splashMessage),`Value,"<p>" + NewLinesToRichText(description) + "</p></body>");
+ }
+
+ global term GetPerformingUI()
+ {
+ return perform;
+ }
+
+ global term GetResultUI()
+ {
+ return `HBox(
+ `HSpacing(1),
+ `VBox(
+ `VSpacing(0.1),
+ `RichText(`id(`resultLabel),""),
+ `VSpacing(0.2)
+ ),
+ `HSpacing(1)
+ );
+ }
+
+ global void PopulateResultUI(boolean success, list<string> failedRepositories, list<string> failedPatterns, list<string> failedPackages, string failureStage, string errorMessage, string note)
+ {
+ string statusStr = "<h1>" + _("Software installation") + "</h1>";
+
+ if (success)
+ {
+ if (
+ (size(failedRepositories) == 0) &&
+ (size(failedPatterns) == 0 ) &&
+ (size(failedPackages) == 0 )
+ )
+ {
+ statusStr = statusStr + "<p>" + _("Installation was successful") + "</p>";
+ }
+ else
+ {
+ statusStr = statusStr + "<p>" + _("Installation was only partially successful.") + "</p>";
+ }
+ } else
+ {
+ statusStr = statusStr + "<p>" + _("Unfortunately the installation has failed, see the log file at /var/log/YaST2/y2log for more information. Failure stage was: ") + " " + failureStage + "<p>";
+ statusStr = statusStr + "<h2>"+ _("Error Message") + "</h2><p>" + errorMessage + "</p>";
+ }
+
+ if (size(failedRepositories) > 0 )
+ {
+ statusStr = statusStr + "<h3>" + _("The following repositories could not be added") + "</h3><p>";
+ foreach (string failed, failedRepositories,
+ {
+ statusStr = statusStr + "<li>" + failed + "</li>";
+ });
+ statusStr = statusStr + "</p>";
+ }
+
+ if (size(failedPatterns) > 0 )
+ {
+ statusStr = statusStr + "<h3>" + _("The following patterns could not be installed") + "</h3><p>";
+ foreach (string failed, failedPatterns,
+ {
+ statusStr = statusStr + "<li>" + failed + "</li>";
+ });
+ statusStr = statusStr + "</p>";
+ }
+
+ if (size(failedPackages) > 0 )
+ {
+ statusStr = statusStr + "<h3>" + _("The following packages could not be installed") + "</h3><p>";
+ foreach (string failed, failedPackages,
+ {
+ statusStr = statusStr + "<li>" + failed + "</li>";
+ });
+ statusStr = statusStr + "</p>";
+ }
+
+ statusStr = statusStr + "<p>" + note + "</p>";
+
+ statusStr = statusStr + "</body>";
+
+ UI::ChangeWidget(`resultLabel, `Value, statusStr);
+ }
+
+}
\ No newline at end of file
Modified: trunk/metapackage/src/OneClickInstallWorker.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallWorker.ycp?rev=45562&r1=45561&r2=45562&view=diff
==============================================================================
--- trunk/metapackage/src/OneClickInstallWorker.ycp (original)
+++ trunk/metapackage/src/OneClickInstallWorker.ycp Tue Mar 18 18:14:43 2008
@@ -3,215 +3,13 @@
import "OneClickInstall";
import "OneClickInstallWorkerResponse";
+ import "OneClickInstallWorkerFunctions";
import "Popup";
include "packager/inst_source_dialogs.ycp";
import "PackageCallbacks";
import "SourceManager";
import "Progress";
- boolean FuzzyMatch(string one, string two)
- {
- string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- return (tolower(filterchars(one,chars)) == tolower(filterchars(two,chars)));
- }
-
- /**
- ** Check whether this repository is already subscribed
- **/
- list<string> DeDupe(list<string> url_list)
- {
- list<integer> sources = Pkg::SourceStartCache(true);
-
- list<string> deduped = [];
-
- foreach (string new, url_list,
- {
- boolean dupeFound = false;
- foreach (integer srcid, sources,
- {
- map repoData = Pkg::SourceGeneralData(srcid);
- if (repoData["url"]:"" == new)
- {
- dupeFound = true;
- break;
- }
- if (FuzzyMatch(repoData["name"]:"",OneClickInstall::GetRepositoryName(new)))
- {
- dupeFound = true;
- break;
- }
- if (FuzzyMatch(repoData["alias"]:"",OneClickInstall::GetRepositoryName(new)))
- {
- dupeFound = true;
- break;
- }
- });
- if (!dupeFound)
- deduped = add(deduped,new);
- });
-
- return deduped;
- }
-
- list<integer> sourceids = [];
- /**
- ** Subscribe to all the specified repositories
- ** return true if all catalogues were added successfully, false otherwise.
- **/
- boolean addRepositories(list<string> repositories)
- {
- list<string> dedupedRepos = DeDupe(repositories);
- foreach (string new_url, dedupedRepos,
- {
- boolean again = true;
- while(again)
- {
- map repoData =
- $[
- "enabled":true,
- "autorefresh":true,
- "name":OneClickInstall::GetRepositoryName(new_url),
- "alias":OneClickInstall::GetRepositoryName(new_url),
- "base_urls":[new_url]
- ];
- integer srcid = Pkg::RepositoryAdd(repoData);
- boolean success = Pkg::SourceRefreshNow(srcid);
- if (!success)
- {
- if (Popup::YesNo (_("An error occurred while initializing the software repository.") + "\n" + _("Details:") + "\n" + Pkg::LastError() + "\n" + _("Try again?")))
- {
- new_url = editUrl (new_url);
- }
- else
- {
- OneClickInstallWorkerResponse::AddFailedRepository(new_url);
- again = false;
- return false;
- }
- }
- else
- {
- sourceids = add(sourceids,srcid);
- // save the repository
- Pkg::SourceSaveAll();
- again = false;
- }
-
- }
- });
- return true;
- }
-
- /**
- ** Install all the specified packages
- ** return true if all installations were successful, false otherwise
- **/
- boolean installPackages(list<string> packages)
- {
- Pkg::SourceLoad();
- foreach (string name, packages,
- {
- if (!Pkg::PkgInstall(name))
- OneClickInstallWorkerResponse::AddFailedPackage(name);
- });
-
- boolean state = true;
- Pkg::TargetInit( "/", false );
- if(Pkg::PkgSolve(true))
- {
- state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
- } else //xxx no callback for resolve failures
- {
- symbol result = (symbol)WFM::CallFunction( "inst_packages", [`summaryMode]);
- if (result == `accept)
- {
- state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
- } else
- {
- state = false;
- }
- }
-
- return state;
- }
-
- /**
- ** Install all the specified patterns
- ** return true if all installations were successful, false otherwise
- **/
- boolean installPatterns(list<string> patterns)
- {
- Pkg::TargetInit( "/", false );
- foreach (string name, patterns,
- {
- if (!Pkg::ResolvableInstall(name,`pattern))
- OneClickInstallWorkerResponse::AddFailedPattern(name);
- });
-
- boolean state = true;
-
- if(Pkg::PkgSolve(true))
- {
- state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
- } else //xxx no callback for resolve failures
- {
- symbol result = (symbol)WFM::CallFunction( "inst_packages", [`summaryMode]);
- if (result == `accept)
- {
- state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
- } else
- {
- state = false;
- }
- }
-
- return state;
- }
-
- /**
- ** Remove all the specified packages
- ** return true if all installations were successful, false otherwise
- **/
- boolean removePackages(list<string> packages)
- {
- Pkg::TargetInit( "/", false );
- boolean result = true;
- foreach (string name, packages,
- {
- result = Pkg::PkgDelete(name);
- });
-
- boolean state = true;
- if(Pkg::PkgSolve(true))
- {
- state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
- } else //xxx no callback for resolve failures
- {
- symbol result = (symbol)WFM::CallFunction( "inst_packages", [`summaryMode]);
- if (result == `accept)
- {
- state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
- } else
- {
- state = false;
- }
- }
-
- return state;
- }
-
- boolean removeAddedRepositories()
- {
- boolean success = true;
- foreach(integer srcid, sourceids,
- {
- success = success && Pkg::SourceDelete(srcid);
- }
- );
- Pkg::SourceSaveAll();
- return success;
- }
-
//Get the catalogues to add and packages to install from the arguments
list args = WFM::Args();
@@ -230,7 +28,7 @@
//run this anyway so that source cache is initialised.
//if (OneClickInstall::HaveRepositoriesToInstall())
//{
- success = addRepositories(OneClickInstall::GetRequiredRepositories());
+ success = OneClickInstallWorkerFunctions::AddRepositories(OneClickInstall::GetRequiredRepositories());
//}
if (!success)
{
@@ -241,7 +39,7 @@
//Remove any removals
if (success && OneClickInstall::HaveRemovalsToInstall())
{
- success = removePackages(OneClickInstall::GetRequiredRemoveSoftware());
+ success = OneClickInstallWorkerFunctions::RemovePackages(OneClickInstall::GetRequiredRemoveSoftware());
}
if (!success)
{
@@ -252,7 +50,7 @@
//if that was successful now try and install the patterns
if (success && OneClickInstall::HavePatternsToInstall())
{
- success = installPatterns(OneClickInstall::GetRequiredPatterns());
+ success = OneClickInstallWorkerFunctions::InstallPatterns(OneClickInstall::GetRequiredPatterns());
}
if (!success)
{
@@ -263,7 +61,7 @@
//if that was successful now try and install the packages
if (success && OneClickInstall::HavePackagesToInstall())
{
- success = installPackages(OneClickInstall::GetRequiredPackages());
+ success = OneClickInstallWorkerFunctions::InstallPackages(OneClickInstall::GetRequiredPackages());
}
if (!success)
{
@@ -274,7 +72,7 @@
//If we don't want to remain subscribed, remove the repositories that were added for installation.
if (OneClickInstall::HaveRepositoriesToInstall() && !OneClickInstall::GetRemainSubscribed())
{
- success = removeAddedRepositories();
+ success = OneClickInstallWorkerFunctions::RemoveAddedRepositories();
}
if (!success)
{
Added: trunk/metapackage/src/OneClickInstallWorkerFunctions.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/OneClickInstallWorkerFunctions.ycp?rev=45562&view=auto
==============================================================================
--- trunk/metapackage/src/OneClickInstallWorkerFunctions.ycp (added)
+++ trunk/metapackage/src/OneClickInstallWorkerFunctions.ycp Tue Mar 18 18:14:43 2008
@@ -0,0 +1,273 @@
+/**
+ * Holds functions both the CLI and GUI installers require.
+ */
+{
+ module "OneClickInstallWorkerFunctions";
+
+ textdomain "OneClickInstall";
+
+ import "HTTP";
+ import "FTP";
+ import "OneClickInstall";
+ import "OneClickInstallWorkerResponse";
+ import "Popup";
+ include "packager/inst_source_dialogs.ycp";
+ import "PackageCallbacks";
+ import "SourceManager";
+ import "Progress";
+
+ import "CommandLine";
+
+ string SEPARATOR = "/";
+
+ boolean GUI = true;
+
+ global void setGUI(boolean value)
+ {
+ GUI = value;
+ }
+
+ void print(string value)
+ {
+ if (!GUI)
+ CommandLine::Print(value);
+ }
+
+ global boolean FuzzyMatch(string one, string two)
+ {
+ string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ return (tolower(filterchars(one,chars)) == tolower(filterchars(two,chars)));
+ }
+
+ /**
+ ** Check whether this repository is already subscribed
+ **/
+ global list<string> DeDupe(list<string> url_list)
+ {
+ list<integer> sources = Pkg::SourceStartCache(true);
+
+ list<string> deduped = [];
+
+ foreach (string new, url_list,
+ {
+ boolean dupeFound = false;
+ foreach (integer srcid, sources,
+ {
+ map repoData = Pkg::SourceGeneralData(srcid);
+ if (repoData["url"]:"" == new)
+ {
+ dupeFound = true;
+ break;
+ }
+ if (FuzzyMatch(repoData["name"]:"",OneClickInstall::GetRepositoryName(new)))
+ {
+ dupeFound = true;
+ break;
+ }
+ if (FuzzyMatch(repoData["alias"]:"",OneClickInstall::GetRepositoryName(new)))
+ {
+ dupeFound = true;
+ break;
+ }
+ });
+ if (!dupeFound)
+ deduped = add(deduped,new);
+ });
+
+ return deduped;
+ }
+
+ list<integer> sourceids = [];
+ /**
+ ** Subscribe to all the specified repositories
+ ** return true if all catalogues were added successfully, false otherwise.
+ **/
+ global boolean AddRepositories(list<string> repositories)
+ {
+ print(_("Loading Package Management"));
+
+ list<string> dedupedRepos = DeDupe(repositories);
+ foreach (string new_url, dedupedRepos,
+ {
+ print(sformat(_("Adding repository %1"),new_url));
+ boolean again = true;
+ while(again)
+ {
+ map repoData =
+ $[
+ "enabled":true,
+ "autorefresh":true,
+ "name":OneClickInstall::GetRepositoryName(new_url),
+ "alias":OneClickInstall::GetRepositoryName(new_url),
+ "base_urls":[new_url]
+ ];
+ integer srcid = Pkg::RepositoryAdd(repoData);
+ boolean success = Pkg::SourceRefreshNow(srcid);
+ if (!success)
+ {
+ if (Popup::YesNo (_("An error occurred while initializing the software repository.") + "\n" + _("Details:") + "\n" + Pkg::LastError() + "\n" + _("Try again?")))
+ {
+ new_url = editUrl (new_url);
+ }
+ else
+ {
+ OneClickInstallWorkerResponse::AddFailedRepository(new_url);
+ again = false;
+ return false;
+ }
+ }
+ else
+ {
+ sourceids = add(sourceids,srcid);
+ // save the repository
+ Pkg::SourceSaveAll();
+ again = false;
+ }
+
+ }
+ });
+ return true;
+ }
+
+ /**
+ ** Install all the specified packages
+ ** return true if all installations were successful, false otherwise
+ **/
+ global boolean InstallPackages(list<string> packages)
+ {
+ Pkg::SourceLoad();
+ foreach (string name, packages,
+ {
+ print(sformat(_("Marking package %1 for installation"),name));
+ if (!Pkg::PkgInstall(name))
+ {
+ print(sformat(_("Warning: package %1 could not be installed."),name));
+ if(GUI)
+ OneClickInstallWorkerResponse::AddFailedPackage(name);
+ }
+ });
+
+ boolean state = true;
+ Pkg::TargetInit( "/", false );
+ if(Pkg::PkgSolve(true))
+ {
+ print(_("Performing Installation..."));
+ state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
+ } else //xxx no callback for resolve failures
+ {
+ symbol result = (symbol)WFM::CallFunction( "inst_packages", [`summaryMode]);
+ if (result == `accept)
+ {
+ state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
+ } else
+ {
+ state = false;
+ }
+ }
+
+ return state;
+ }
+
+ /**
+ ** Install all the specified patterns
+ ** return true if all installations were successful, false otherwise
+ **/
+ global boolean InstallPatterns(list<string> patterns)
+ {
+ Pkg::TargetInit( "/", false );
+ foreach (string name, patterns,
+ {
+ if (!Pkg::ResolvableInstall(name,`pattern))
+ {
+ print(sformat(_("Warning: pattern %1 could not be installed."),name));
+ if (GUI)
+ OneClickInstallWorkerResponse::AddFailedPattern(name);
+ }
+ });
+
+ boolean state = true;
+
+ if(Pkg::PkgSolve(true))
+ {
+ state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
+ } else //xxx no callback for resolve failures
+ {
+ symbol result = (symbol)WFM::CallFunction( "inst_packages", [`summaryMode]);
+ if (result == `accept)
+ {
+ state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
+ } else
+ {
+ state = false;
+ }
+ }
+
+ return state;
+ }
+
+ /**
+ ** Remove all the specified packages
+ ** return true if all installations were successful, false otherwise
+ **/
+ global boolean RemovePackages(list<string> packages)
+ {
+ Pkg::TargetInit( "/", false );
+ boolean result = true;
+ foreach (string name, packages,
+ {
+ result = Pkg::PkgDelete(name);
+ });
+
+ boolean state = true;
+ if(Pkg::PkgSolve(true))
+ {
+ state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
+ } else //xxx no callback for resolve failures
+ {
+ symbol result = (symbol)WFM::CallFunction( "inst_packages", [`summaryMode]);
+ if (result == `accept)
+ {
+ state = !(Pkg::PkgCommit(0)[0]:-1 < 0);
+ } else
+ {
+ state = false;
+ }
+ }
+
+ return state;
+ }
+
+ global boolean RemoveAddedRepositories()
+ {
+ boolean success = true;
+ foreach(integer srcid, sourceids,
+ {
+ success = success && Pkg::SourceDelete(srcid);
+ }
+ );
+ Pkg::SourceSaveAll();
+ return success;
+ }
+
+ global string GrabFile(string url)
+ {
+ string newUrl = (string)SCR::Read (.target.tmpdir) + SEPARATOR + "metapackage.xml";
+ if (substring(url,0,4) == "http" || substring(url,0,4) == "file")
+ {
+ map response = HTTP::Get(url,newUrl);
+ if (response["code"]:400 >= 400)
+ return nil;
+ return newUrl;
+ } else if (substring(url,0,3) == "ftp")
+ {
+ FTP::Get(url,newUrl);
+ return newUrl;
+ } else
+ {
+ y2error ("Argument is neither local absolute path nor an HTTP or FTP URL. Bye.");
+ return nil;
+ }
+ return nil;
+ }
+
+}
\ No newline at end of file
Added: trunk/metapackage/src/UserSettings.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/src/UserSettings.ycp?rev=45562&view=auto
==============================================================================
--- trunk/metapackage/src/UserSettings.ycp (added)
+++ trunk/metapackage/src/UserSettings.ycp Tue Mar 18 18:14:43 2008
@@ -0,0 +1,91 @@
+{
+ /**
+ * Stores User Settings in home directory.
+ **/
+
+ module "UserSettings";
+
+ import "XML";
+ import "String";
+
+ string FILENAME = ".y2usersettings";
+
+ map > settings = $[];
+
+ global void UserSettings()
+ {
+ map homedir = (map) SCR::Execute(.target.bash_output, "echo $HOME");
+ FILENAME = String::FirstChunk(homedir["stdout"]:(((string)SCR::Read (.target.tmpdir))),"\n") + "/" + FILENAME;
+ y2debug("Reading UserSettings from %1",FILENAME);
+ settings = (map >) XML::XMLToYCPFile(FILENAME);
+ }
+
+ /**
+ * Retrieves the specified value.
+ * @param section The section to find KVP in, could be the module/client name.
+ * @param key The key used for retreiving value.
+ * @return The value of this key.
+ */
+ global any GetValue(string section, string key)
+ {
+ return (settings[section]:$[])[key]:nil;
+ }
+
+ /**
+ * Retrieves the specified value and casts to a String.
+ */
+ global string GetStringValue(string section, string key)
+ {
+ return (string) GetValue(section,key);
+ }
+
+ /**
+ * Retrieves the specified value and casts to an integer.
+ */
+ global integer GetIntegerValue(string section, string key)
+ {
+ return (integer) GetValue(section,key);
+ }
+
+ /**
+ * Retrieves the specified value and casts to a boolean.
+ */
+ global boolean GetBooleanValue(string section, string key)
+ {
+ return (boolean) GetValue(section,key);
+ }
+
+ /**
+ * Sets up a doctype for YaST's XML serialisation.
+ **/
+ void SetupXML()
+ {
+ map doc = $[];
+ doc["cdataSections"] = [];
+ doc["rootElement"] = "UserSettings";
+ doc["systemID"] = "/un/defined";
+ doc["nameSpace"] = "http://www.suse.com/1.0/yast2ns";
+ doc["typeNamespace"] = "http://www.suse.com/1.0/configns";
+ XML::xmlCreateDoc(`UserSettings,doc);
+ }
+
+
+ /**
+ * Writes a key value pair for specified section.
+ * @param section The section to write KVP in, could be the module/client name.
+ * @param key The key used for retreiving value later.
+ * @param value The value to store.
+ * @return True if the settings were written to disk successfully. False on failure.
+ */
+ global boolean SetValue(string section, string key, any value)
+ {
+ map kvps = settings[section]:$[];
+ kvps = add(kvps,key,value);
+ settings = add(settings,section,kvps);
+ SetupXML();
+ y2debug("Writing %1:%2 UserSetting to %3",key,value,FILENAME);
+ return XML::YCPToXMLFile(`UserSettings,settings,FILENAME);
+ }
+
+
+}
\ No newline at end of file
Modified: trunk/metapackage/yast2-metapackage-handler.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/metapackage/yast2-metapackage-handler.spec.in?rev=45562&r1=45561&r2=45562&view=diff
==============================================================================
--- trunk/metapackage/yast2-metapackage-handler.spec.in (original)
+++ trunk/metapackage/yast2-metapackage-handler.spec.in Tue Mar 18 18:14:43 2008
@@ -72,6 +72,7 @@
%doc @docdir@
/sbin/OneClickInstallUI
/sbin/OneClickInstallUrlHandler
+/sbin/OCICLI
%dir @clientdir@
@clientdir@/*.ycp
%dir @moduledir@
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org