home *** CD-ROM | disk | FTP | other *** search
- /**
- * File: installation/general/inst_relase_notes.ycp
- * Module: Installation
- * Summary: Display release notes
- * Authors: Arvin Schnell <arvin@suse.de>
- *
- * Display release notes.
- *
- * $Id: release_notes_popup.ycp 34411 2006-11-15 13:45:11Z locilka $
- */
-
- {
- textdomain "installation";
-
- import "Language";
- import "Report";
- import "Label";
- import "Stage";
- import "Packages";
-
- /* filename of release notes */
- string file = "";
-
- /* release notes */
- string text = "";
-
-
- /* function to load release notes */
- define boolean load_release_notes ()
- {
- string path_to_relnotes = "/docu";
- integer source_id = 0;
- if (Stage::initial ())
- {
- source_id = Packages::theSources[0]:0;
- }
- else
- {
- list<integer> sources = Pkg::SourceStartCache (true);
- source_id = sources[0]:0;
- }
- string path_templ = path_to_relnotes + "/RELEASE-NOTES.%1.rtf";
- y2debug ("Path template: %1", path_templ);
- string tmp = sformat (path_templ, Language::language);
- y2debug ("Trying to get %1", tmp);
- tmp = Pkg::SourceProvideOptionalFile (source_id, 1, tmp);
- if (tmp == nil)
- {
- tmp = sformat (path_templ, substring (Language::language, 0, 2));
- y2debug ("Trying to get %1", tmp);
- tmp = Pkg::SourceProvideOptionalFile (source_id, 1, tmp);
- }
- if (tmp == nil)
- {
- tmp = sformat (path_templ, "en");
- y2debug ("Trying to get %1", tmp);
- tmp = Pkg::SourceProvideFile (source_id, 1, tmp);
- }
- if (tmp == nil)
- return false;
-
- text = (string)SCR::Read (.target.string, [tmp, ""]);
- if (text != "" && text != nil)
- return true;
- return false;
- };
-
- y2milestone ("Calling: Release Notes Popup");
-
- if (! load_release_notes ())
- {
- // error report
- Report::Error (_("Cannot load release notes."));
- return nil;
- }
-
- text =
- // beginning of the rich text with the release notes
- _("<p><b>These are the release notes made for the first initial release. They are
- part of the installation media. During installation, if a connection
- to the Internet is available, you can download updated release notes
- from the SUSE Linux Web server.</b></p>") + text;
-
- // bugzilla #221222, #213239
- map display_info = UI::GetDisplayInfo();
- integer min_size_x = 76;
- integer min_size_y = 22;
-
- // textmode
- if (display_info["TextMode"]:true) {
- min_size_x = tointeger(display_info["Width"]:80) * 3 / 4;
- min_size_y = tointeger(display_info["Height"]:25) * 2 / 3;
- if (min_size_x < 76) min_size_x = 76;
- if (min_size_y < 22) min_size_y = 22;
- y2milestone("X/x Y/y %1/%2 %3/%4",
- display_info["Width"]:80, min_size_x,
- display_info["Height"]:25, min_size_y);
- // GUI
- } else {
- min_size_x = 100;
- min_size_y = 30;
- }
-
- term contents = `MinSize (
- min_size_x, min_size_y,
- `VBox (
- `VSpacing (0.5),
- `Left (`Heading (_("Release Notes"))),
- `RichText (`id (`text), text),
- `VSpacing (0.5),
- `PushButton (`id (`close), Label::CloseButton ()),
- `VSpacing (0.5)
- )
- );
-
- UI::OpenDialog (contents);
- contents = nil;
- UI::SetFocus (`close);
-
- // FIXME: richtext eats return key, but only in NCurses and we want to
- // make users read release notes (and make PgDn work). For Next, F10 is
- // availbale
- UI::SetFocus (`id (`text));
-
- any ret = nil;
- repeat {
- ret = UI::UserInput();
- } until ( ret == `close || ret == `back );
- UI::CloseDialog ();
-
- y2milestone ("Finishing: Release Notes Popup");
-
- return ret;
- }
-